@alto-avios/alto-ui 5.0.0-alpha.13 → 5.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/assets/Dialog.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._dialogWrapper_g6psf_1{align-items:center;display:flex;top:0;right:0;bottom:0;left:0;justify-content:center;position:fixed;z-index:99}._dialogWrapper_g6psf_1._absolute_g6psf_10{position:absolute}._overlay_g6psf_14{background-color:var(--alto-sem-color-overlay-scrim);top:0;right:0;bottom:0;left:0;position:fixed}._overlay_g6psf_14._absolute_g6psf_10{position:absolute}._dialog_g6psf_1{background-color:var(--alto-sem-color-bg-layer2-default);border:1px solid var(--alto-sem-color-border-tertiary);border-radius:var(--alto-card-radius);box-shadow:0 25px 50px -12px #00000040;margin:var(--alto-sem-space-md);max-height:calc(100vh - var(--alto-sem-space-xl)*2);outline:none;overflow-y:auto;padding:var(--alto-sem-space-lg);position:relative;width:calc(100% - var(--alto-sem-space-md)*2)}._dialog_g6psf_1._noPadding_g6psf_38{padding:0}@media (min-width:640px){._dialog_g6psf_1{margin:var(--alto-sem-space-xl);padding:var(--alto-sem-space-xl);width:calc(100% - var(--alto-sem-space-xl)*2)}._dialog_g6psf_1._noPadding_g6psf_38{padding:0}}@media (min-width:1024px){._dialog_g6psf_1{margin:var(--alto-sem-space-2xl);max-height:calc(100vh - var(--alto-sem-space-2xl)*2);padding:var(--alto-sem-space-2xl);width:calc(100% - var(--alto-sem-space-2xl)*2)}._dialog_g6psf_1._noPadding_g6psf_38{padding:0}}._dialogContent_g6psf_67{display:flex;flex-direction:column;gap:var(--alto-sem-space-md);position:relative}._dialogHeading_g6psf_74{margin:0}._dialogContentInner_g6psf_78{display:flex;flex-direction:column;gap:var(--alto-sem-space-md)}._noHeader_g6psf_84 ._dialogContentInner_g6psf_78{padding-top:0}._closeButton_g6psf_88{align-items:center;background:none;border:none;border-radius:var(--alto-sem-border-radius-sm);color:var(--alto-sem-color-fg-secondary);cursor:pointer;display:flex;justify-content:center;outline:2px solid transparent;outline-offset:2px;position:absolute;right:var(--alto-sem-space-sm);top:var(--alto-sem-space-sm);transition:outline-color .2s ease}._closeButton_g6psf_88:focus,._closeButton_g6psf_88:hover{background-color:var(--alto-sem-color-bg-hover)}._closeButton_g6psf_88:focus{outline-color:var(--alto-sem-color-focus-ring)}._dialogSmall_g6psf_114{max-width:25.625rem}._dialogMedium_g6psf_118{max-width:39.25rem}._dialogLarge_g6psf_122{max-width:52.875rem}
|
|
@@ -54,6 +54,16 @@ export interface DialogProps extends AriaDialogProps {
|
|
|
54
54
|
* @default 99 (from CSS)
|
|
55
55
|
*/
|
|
56
56
|
zIndex?: number;
|
|
57
|
+
/**
|
|
58
|
+
* The container element in which the dialog portal will be placed.
|
|
59
|
+
* The container should have `position: relative` and `overflow: hidden` to properly contain the dialog.
|
|
60
|
+
*
|
|
61
|
+
* @warning Changing the portal container can impact accessibility, styling, and stacking contexts.
|
|
62
|
+
* Portaling to a custom container may cause issues with screen readers, z-index layering, and CSS properties
|
|
63
|
+
* like overflow and positioning. Use only when you specifically need to constrain the dialog to a container.
|
|
64
|
+
* @default document.body
|
|
65
|
+
*/
|
|
66
|
+
portalContainer?: HTMLElement;
|
|
57
67
|
}
|
|
58
68
|
export interface DialogComposition {
|
|
59
69
|
Header: typeof DialogHeader;
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { useRef } from "react";
|
|
3
3
|
import { useDialog } from "@react-aria/dialog";
|
|
4
|
-
import { OverlayContainer, useOverlay, usePreventScroll, useModal } from "@react-aria/overlays";
|
|
4
|
+
import { OverlayContainer, UNSAFE_PortalProvider, useOverlay, usePreventScroll, useModal } from "@react-aria/overlays";
|
|
5
5
|
import { FocusScope } from "@react-aria/focus";
|
|
6
6
|
import { IconButton } from "../IconButton/IconButton.js";
|
|
7
|
-
import '../../assets/Dialog.css';const dialogWrapper = "
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
7
|
+
import '../../assets/Dialog.css';const dialogWrapper = "_dialogWrapper_g6psf_1";
|
|
8
|
+
const absolute = "_absolute_g6psf_10";
|
|
9
|
+
const overlay = "_overlay_g6psf_14";
|
|
10
|
+
const dialog = "_dialog_g6psf_1";
|
|
11
|
+
const noPadding = "_noPadding_g6psf_38";
|
|
12
|
+
const dialogContent = "_dialogContent_g6psf_67";
|
|
13
|
+
const dialogHeading = "_dialogHeading_g6psf_74";
|
|
14
|
+
const dialogContentInner = "_dialogContentInner_g6psf_78";
|
|
15
|
+
const noHeader = "_noHeader_g6psf_84";
|
|
16
|
+
const closeButton = "_closeButton_g6psf_88";
|
|
17
|
+
const dialogSmall = "_dialogSmall_g6psf_114";
|
|
18
|
+
const dialogMedium = "_dialogMedium_g6psf_118";
|
|
19
|
+
const dialogLarge = "_dialogLarge_g6psf_122";
|
|
19
20
|
const styles = {
|
|
20
21
|
dialogWrapper,
|
|
22
|
+
absolute,
|
|
21
23
|
overlay,
|
|
22
24
|
dialog,
|
|
23
25
|
noPadding,
|
|
@@ -54,6 +56,7 @@ function DialogWrapper(props) {
|
|
|
54
56
|
id,
|
|
55
57
|
removePadding = false,
|
|
56
58
|
zIndex,
|
|
59
|
+
portalContainer,
|
|
57
60
|
children
|
|
58
61
|
} = props;
|
|
59
62
|
const ref = useRef(null);
|
|
@@ -85,8 +88,10 @@ function DialogWrapper(props) {
|
|
|
85
88
|
const wrapperStyle = zIndex !== void 0 ? {
|
|
86
89
|
zIndex
|
|
87
90
|
} : {};
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
const wrapperClasses = [styles.dialogWrapper, modal ? styles.modal : "", portalContainer ? styles.absolute : ""].filter(Boolean).join(" ");
|
|
92
|
+
const overlayClasses = [styles.overlay, portalContainer ? styles.absolute : ""].filter(Boolean).join(" ");
|
|
93
|
+
return /* @__PURE__ */ jsxs("div", { className: wrapperClasses, style: wrapperStyle, children: [
|
|
94
|
+
modal && /* @__PURE__ */ jsx("div", { className: overlayClasses, ...underlayProps, onClick: onClose, "aria-hidden": "true" }),
|
|
90
95
|
/* @__PURE__ */ jsx(FocusScope, { contain: true, restoreFocus: true, autoFocus: false, children: /* @__PURE__ */ jsxs("div", { ...overlayProps, ...dialogProps, ...modalProps, ref, className: dialogClasses, "data-size": size, id, role, "aria-labelledby": headerId, "aria-describedby": contentId, children: [
|
|
91
96
|
/* @__PURE__ */ jsxs("div", { className: `${styles.dialogContent} ${!hasHeader ? styles.noHeader : ""}`, children: [
|
|
92
97
|
hasHeader && /* @__PURE__ */ jsx("div", { className: styles.dialogHeader, id: headerId, children: headerChild }),
|
|
@@ -103,12 +108,17 @@ function DialogWrapper(props) {
|
|
|
103
108
|
function Dialog(props) {
|
|
104
109
|
const {
|
|
105
110
|
isOpen,
|
|
106
|
-
children
|
|
111
|
+
children,
|
|
112
|
+
portalContainer
|
|
107
113
|
} = props;
|
|
108
114
|
if (!isOpen) {
|
|
109
115
|
return null;
|
|
110
116
|
}
|
|
111
|
-
|
|
117
|
+
const content = /* @__PURE__ */ jsx(OverlayContainer, { children: /* @__PURE__ */ jsx(DialogWrapper, { ...props, children }) });
|
|
118
|
+
if (portalContainer) {
|
|
119
|
+
return /* @__PURE__ */ jsx(UNSAFE_PortalProvider, { getContainer: () => portalContainer, children: content });
|
|
120
|
+
}
|
|
121
|
+
return content;
|
|
112
122
|
}
|
|
113
123
|
Dialog.Header = DialogHeader;
|
|
114
124
|
Dialog.Content = DialogContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Dialog.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|