diff --git a/packages/docs/components/Modal.md b/packages/docs/components/Modal.md index e8b2245e7..1cf4758a0 100644 --- a/packages/docs/components/Modal.md +++ b/packages/docs/components/Modal.md @@ -44,7 +44,10 @@ The component supports the W3C ARIA APG [Dialog (Modal) Pattern](https://www.w3. | component | Component to be injected.
Close the component by emitting a 'close' event — `$emit('close')` | Component | - | | | content | Text content, unnecessary when default slot is used | string | - | | | events | Events to be binded to the injected component | {} | - | | -| fullScreen | Display modal as full screen | boolean | - | false | +| fullheight | Display modal in fullheight | boolean | - | false | +| fullscreen | Display modal in fullwidth and fullheight | boolean | - | false | +| fullwidth | Display modal in fullwidth | boolean | - | false | +| height | Height of the modal | Numberish | - |
From config:
modal: {
  height: undefined
}
| | iconPack | Icon pack to use | string | `mdi`, `fa`, `fas and any other custom icon pack` |
From config:
modal: {
  iconPack: undefined
}
| | mobileBreakpoint | Mobile breakpoint as `max-width` value | string | - |
From config:
modal: {
  mobileBreakpoint: undefined
}
| | overlay | Show an overlay | boolean | - |
From config:
modal: {
  overlay: true
}
| @@ -52,7 +55,7 @@ The component supports the W3C ARIA APG [Dialog (Modal) Pattern](https://www.w3. | props | Props to be binded to the injected component | any | - | | | teleport | Append the component to another part of the DOM.
Set `true` to append the component to the body.
In addition, any CSS selector string or an actual DOM node can be used. | boolean \| object \| string | - |
From config:
modal: {
  teleport: false
}
| | trapFocus | Trap focus inside the modal | boolean | - |
From config:
modal: {
  trapFocus: true
}
| -| width | Width of the Modal | Numberish | - |
From config:
modal: {
  width: 960
}
| +| width | Width of the modal | Numberish | - |
From config:
modal: {
  width: undefined
}
| ### Events diff --git a/packages/oruga/src/components/modal/Modal.vue b/packages/oruga/src/components/modal/Modal.vue index 252b19eaf..3ac40d2d1 100644 --- a/packages/oruga/src/components/modal/Modal.vue +++ b/packages/oruga/src/components/modal/Modal.vue @@ -41,11 +41,14 @@ defineOptions({ const props = withDefaults(defineProps>(), { override: undefined, active: false, - fullScreen: false, content: undefined, - width: () => getDefault("modal.width", 960), animation: () => getDefault("modal.animation", "zoom-out"), overlay: () => getDefault("modal.overlay", true), + width: () => getDefault("modal.width"), + height: () => getDefault("modal.height"), + fullscreen: false, + fullheight: false, + fullwidth: false, cancelable: () => getDefault("modal.cancelable", ["escape", "x", "outside"]), trapFocus: () => getDefault("modal.trapFocus", true), @@ -98,9 +101,17 @@ const showX = computed(() => : props.cancelable, ); -const customStyle = computed(() => - !props.fullScreen ? { maxWidth: toCssDimension(props.width) } : null, -); +// TODO: Maybe remove?! +const contentStyle = computed(() => ({ + width: + !props.fullscreen && !props.fullwidth + ? toCssDimension(props.width) + : undefined, + height: + !props.fullscreen && !props.fullheight + ? toCssDimension(props.height) + : undefined, +})); const toggleScroll = usePreventScrolling(props.clipScroll); @@ -117,7 +128,7 @@ onMounted(() => { if (isActive.value && props.overlay) toggleScroll(isActive.value); }); -// --- Events Feature --- +// #region --- Close Events Feature --- if (isClient) if (!props.overlay) @@ -165,7 +176,9 @@ function close(...args: [] | [string] | CloseEventArgs): void { emits("close", ...args); } -// --- Animation Feature --- +// #endregion --- Close Events Feature --- + +// #region --- Animation Feature --- const isAnimated = ref(props.active); @@ -179,12 +192,20 @@ function beforeLeave(): void { isAnimated.value = false; } -// --- Computed Component Classes --- +// #endregion --- Animation Feature --- + +// #region --- Computed Component Classes --- const rootClasses = defineClasses( ["rootClass", "o-modal"], ["mobileClass", "o-modal--mobile", null, isMobile], ["activeClass", "o-modal--active", null, isActive], + [ + "teleportClass", + "o-modal--teleport", + null, + computed(() => !!props.teleport), + ], ); const overlayClasses = defineClasses(["overlayClass", "o-modal__overlay"]); @@ -195,16 +216,32 @@ const contentClasses = defineClasses( "fullScreenClass", "o-modal__content--full-screen", null, - computed(() => props.fullScreen), + computed(() => props.fullscreen), + ], + [ + "fullheightClass", + "o-modal__content--fullheight", + null, + computed(() => props.fullheight || props.fullscreen), + ], + [ + "fullwidthClass", + "o-modal__content--fullwidth", + null, + computed(() => props.fullwidth || props.fullscreen), ], ); const closeClasses = defineClasses(["closeClass", "o-modal__close"]); -// --- Expose Public Functionalities --- +// #endregion --- Computed Component Classes --- + +// #region --- Expose Public Functionalities --- /** expose functionalities for programmatic usage */ defineExpose({ close }); + +// #endregion --- Expose Public Functionalities ---