@guardian/stand 0.0.51 → 0.0.53
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/Modal.cjs +7 -0
- package/dist/Modal.d.cts +5 -0
- package/dist/Modal.d.ts +5 -0
- package/dist/Modal.js +3 -0
- package/dist/components/Form/Form.cjs +1 -0
- package/dist/components/Form/Form.js +1 -0
- package/dist/components/InlineMessage/InlineMessage.cjs +2 -1
- package/dist/components/InlineMessage/InlineMessage.d.cts +1 -0
- package/dist/components/InlineMessage/InlineMessage.d.ts +1 -0
- package/dist/components/InlineMessage/InlineMessage.js +2 -1
- package/dist/components/InlineMessage/types.d.cts +5 -0
- package/dist/components/InlineMessage/types.d.ts +5 -0
- package/dist/components/Modal/Modal.cjs +97 -0
- package/dist/components/Modal/Modal.d.cts +21 -0
- package/dist/components/Modal/Modal.d.ts +21 -0
- package/dist/components/Modal/Modal.js +93 -0
- package/dist/components/Modal/styles.cjs +100 -0
- package/dist/components/Modal/styles.d.cts +10 -0
- package/dist/components/Modal/styles.d.ts +10 -0
- package/dist/components/Modal/styles.js +92 -0
- package/dist/components/Modal/types.d.cts +20 -0
- package/dist/components/Modal/types.d.ts +20 -0
- package/dist/components/TagPicker/Autocomplete.js +11 -11
- package/dist/components/TagPicker/TagPicker.js +7 -7
- package/dist/components/TagPicker/TagSearchWithFilters.js +4 -4
- package/dist/components/TagPicker/TagTable.js +19 -19
- package/dist/components/TopBar/TopBarNavigation/TopBarNavigation.cjs +2 -2
- package/dist/components/TopBar/TopBarNavigation/TopBarNavigation.js +2 -2
- package/dist/components/TopBar/TopBarNavigation/styles.cjs +2 -2
- package/dist/components/TopBar/TopBarNavigation/styles.js +2 -2
- package/dist/components/Typography/Typography.cjs +7 -4
- package/dist/components/Typography/Typography.d.cts +1 -5
- package/dist/components/Typography/Typography.d.ts +1 -5
- package/dist/components/Typography/Typography.js +7 -4
- package/dist/components/Typography/types.d.cts +3 -2
- package/dist/components/Typography/types.d.ts +3 -2
- package/dist/components/UserMenu/PreferenceRadioGroup.js +5 -5
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -1
- package/dist/styleD/build/css/component/modal.css +51 -0
- package/dist/styleD/build/typescript/component/modal.cjs +72 -0
- package/dist/styleD/build/typescript/component/modal.d.cts +75 -0
- package/dist/styleD/build/typescript/component/modal.d.ts +75 -0
- package/dist/styleD/build/typescript/component/modal.js +72 -0
- package/package.json +16 -2
package/dist/Modal.cjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_modal = require("./styleD/build/typescript/component/modal.cjs");
|
|
3
|
+
const require_Modal = require("./components/Modal/Modal.cjs");
|
|
4
|
+
exports.Dialog = require_Modal.Dialog;
|
|
5
|
+
exports.DialogTrigger = require_Modal.DialogTrigger;
|
|
6
|
+
exports.Modal = require_Modal.Modal;
|
|
7
|
+
exports.componentModal = require_modal.componentModal;
|
package/dist/Modal.d.cts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentModal, componentModal } from "./styleD/build/typescript/component/modal.cjs";
|
|
2
|
+
import { PartialModalTheme } from "./components/Modal/styles.cjs";
|
|
3
|
+
import { DialogButtonsProps, DialogContentProps, DialogHeaderProps, DialogProps, DialogTriggerProps, ModalProps } from "./components/Modal/types.cjs";
|
|
4
|
+
import { Dialog, DialogTrigger, Modal } from "./components/Modal/Modal.cjs";
|
|
5
|
+
export { type ComponentModal, Dialog, type DialogButtonsProps, type DialogContentProps, type DialogHeaderProps, type DialogProps, DialogTrigger, type DialogTriggerProps, Modal, type ModalProps, type PartialModalTheme as ModalTheme, componentModal };
|
package/dist/Modal.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentModal, componentModal } from "./styleD/build/typescript/component/modal.js";
|
|
2
|
+
import { PartialModalTheme } from "./components/Modal/styles.js";
|
|
3
|
+
import { DialogButtonsProps, DialogContentProps, DialogHeaderProps, DialogProps, DialogTriggerProps, ModalProps } from "./components/Modal/types.js";
|
|
4
|
+
import { Dialog, DialogTrigger, Modal } from "./components/Modal/Modal.js";
|
|
5
|
+
export { type ComponentModal, Dialog, type DialogButtonsProps, type DialogContentProps, type DialogHeaderProps, type DialogProps, DialogTrigger, type DialogTriggerProps, Modal, type ModalProps, type PartialModalTheme as ModalTheme, componentModal };
|
package/dist/Modal.js
ADDED
|
@@ -27,6 +27,7 @@ function FormInputContainer({ as: Component, size = "md", fluid = false, label,
|
|
|
27
27
|
children,
|
|
28
28
|
error && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react_aria_components.FieldError, { children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_InlineMessage.InlineMessage, {
|
|
29
29
|
level: "error",
|
|
30
|
+
slot: "errorMessage",
|
|
30
31
|
children: error
|
|
31
32
|
}) })
|
|
32
33
|
]
|
|
@@ -27,6 +27,7 @@ function FormInputContainer({ as: Component, size = "md", fluid = false, label,
|
|
|
27
27
|
children,
|
|
28
28
|
error && /* @__PURE__ */ jsx(FieldError, { children: /* @__PURE__ */ jsx(InlineMessage, {
|
|
29
29
|
level: "error",
|
|
30
|
+
slot: "errorMessage",
|
|
30
31
|
children: error
|
|
31
32
|
}) })
|
|
32
33
|
]
|
|
@@ -5,7 +5,7 @@ const require_styles = require("./styles.cjs");
|
|
|
5
5
|
let react = require("react");
|
|
6
6
|
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
|
|
7
7
|
//#region src/components/InlineMessage/InlineMessage.tsx
|
|
8
|
-
function InlineMessage({ children, level, hideIcon = false, icon, theme = {}, cssOverrides, className, ...props }) {
|
|
8
|
+
function InlineMessage({ children, level, hideIcon = false, icon, theme = {}, cssOverrides, className, slot, ...props }) {
|
|
9
9
|
const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultInlineMessageTheme, theme);
|
|
10
10
|
const determinedIcon = (0, react.useMemo)(() => {
|
|
11
11
|
if (icon) return icon;
|
|
@@ -27,6 +27,7 @@ function InlineMessage({ children, level, hideIcon = false, icon, theme = {}, cs
|
|
|
27
27
|
}), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_Typography.Typography, {
|
|
28
28
|
variant: "helpTextFormMd",
|
|
29
29
|
theme: { color: mergedTheme[level].color },
|
|
30
|
+
slot,
|
|
30
31
|
children
|
|
31
32
|
})]
|
|
32
33
|
});
|
|
@@ -5,7 +5,7 @@ import { defaultInlineMessageTheme, inlineMessageIconStyles, inlineMessageStyles
|
|
|
5
5
|
import { useMemo } from "react";
|
|
6
6
|
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
7
7
|
//#region src/components/InlineMessage/InlineMessage.tsx
|
|
8
|
-
function InlineMessage({ children, level, hideIcon = false, icon, theme = {}, cssOverrides, className, ...props }) {
|
|
8
|
+
function InlineMessage({ children, level, hideIcon = false, icon, theme = {}, cssOverrides, className, slot, ...props }) {
|
|
9
9
|
const mergedTheme = mergeDeep(defaultInlineMessageTheme, theme);
|
|
10
10
|
const determinedIcon = useMemo(() => {
|
|
11
11
|
if (icon) return icon;
|
|
@@ -27,6 +27,7 @@ function InlineMessage({ children, level, hideIcon = false, icon, theme = {}, cs
|
|
|
27
27
|
}), /* @__PURE__ */ jsx(Typography, {
|
|
28
28
|
variant: "helpTextFormMd",
|
|
29
29
|
theme: { color: mergedTheme[level].color },
|
|
30
|
+
slot,
|
|
30
31
|
children
|
|
31
32
|
})]
|
|
32
33
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DefaultPropsWithChildren } from "../../util/types.cjs";
|
|
2
2
|
import { IconProps } from "../Icon/types.cjs";
|
|
3
|
+
import { TypographyProps } from "../Typography/types.cjs";
|
|
3
4
|
import { InlineMessageTheme } from "./styles.cjs";
|
|
4
5
|
|
|
5
6
|
//#region src/components/InlineMessage/types.d.ts
|
|
@@ -20,6 +21,10 @@ interface InlineMessageProps extends DefaultPropsWithChildren<InlineMessageTheme
|
|
|
20
21
|
* Passed to the Icon component, so can be either a string (for material symbols) or an SVG element.
|
|
21
22
|
*/
|
|
22
23
|
icon?: IconProps['symbol'] | Exclude<IconProps['children'], string>;
|
|
24
|
+
/**
|
|
25
|
+
* Optional prop to specify the slot for the Typography component, allowing for better accessibility and semantic structure.
|
|
26
|
+
*/
|
|
27
|
+
slot?: TypographyProps['slot'];
|
|
23
28
|
}
|
|
24
29
|
//#endregion
|
|
25
30
|
export { InlineMessageProps };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DefaultPropsWithChildren } from "../../util/types.js";
|
|
2
2
|
import { IconProps } from "../Icon/types.js";
|
|
3
|
+
import { TypographyProps } from "../Typography/types.js";
|
|
3
4
|
import { InlineMessageTheme } from "./styles.js";
|
|
4
5
|
|
|
5
6
|
//#region src/components/InlineMessage/types.d.ts
|
|
@@ -20,6 +21,10 @@ interface InlineMessageProps extends DefaultPropsWithChildren<InlineMessageTheme
|
|
|
20
21
|
* Passed to the Icon component, so can be either a string (for material symbols) or an SVG element.
|
|
21
22
|
*/
|
|
22
23
|
icon?: IconProps['symbol'] | Exclude<IconProps['children'], string>;
|
|
24
|
+
/**
|
|
25
|
+
* Optional prop to specify the slot for the Typography component, allowing for better accessibility and semantic structure.
|
|
26
|
+
*/
|
|
27
|
+
slot?: TypographyProps['slot'];
|
|
23
28
|
}
|
|
24
29
|
//#endregion
|
|
25
30
|
export { InlineMessageProps };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_mergeDeep = require("../../util/mergeDeep.cjs");
|
|
3
|
+
const require_IconButton = require("../IconButton/IconButton.cjs");
|
|
4
|
+
const require_AvatarButton = require("../AvatarButton/AvatarButton.cjs");
|
|
5
|
+
const require_Button = require("../Button/Button.cjs");
|
|
6
|
+
const require_Typography = require("../Typography/Typography.cjs");
|
|
7
|
+
const require_styles = require("./styles.cjs");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
react = require_runtime.__toESM(react);
|
|
10
|
+
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
|
|
11
|
+
let react_aria_components = require("react-aria-components");
|
|
12
|
+
//#region src/components/Modal/Modal.tsx
|
|
13
|
+
const Modal = ({ theme = {}, children, cssOverrides, ...props }) => {
|
|
14
|
+
const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultModalTheme, theme);
|
|
15
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react_aria_components.ModalOverlay, {
|
|
16
|
+
css: require_styles.modalOverlayStyles(mergedTheme),
|
|
17
|
+
...props,
|
|
18
|
+
children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react_aria_components.Modal, {
|
|
19
|
+
css: [require_styles.modalStyles(mergedTheme), cssOverrides],
|
|
20
|
+
children
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const DialogTrigger = (props) => {
|
|
25
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react_aria_components.DialogTrigger, { ...props });
|
|
26
|
+
};
|
|
27
|
+
const DialogRoot = ({ children, theme = {}, cssOverrides, ...props }) => {
|
|
28
|
+
const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultDialogTheme.container, theme);
|
|
29
|
+
const filteredChildren = react.default.Children.toArray(typeof children === "function" ? void 0 : children).map((child) => {
|
|
30
|
+
if (!react.default.isValidElement(child)) return false;
|
|
31
|
+
switch (child.type) {
|
|
32
|
+
case Dialog.Header:
|
|
33
|
+
case Dialog.Buttons:
|
|
34
|
+
case Dialog.Content:
|
|
35
|
+
case Dialog.Dismiss: return child;
|
|
36
|
+
default: return false;
|
|
37
|
+
}
|
|
38
|
+
}).filter((child) => child !== false);
|
|
39
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react_aria_components.Dialog, {
|
|
40
|
+
css: [require_styles.dialogStyles(mergedTheme), cssOverrides],
|
|
41
|
+
...props,
|
|
42
|
+
children: filteredChildren
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const DialogHeader = ({ variant = "headingLg", element = "h2", theme = {}, cssOverrides, ...props }) => {
|
|
46
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_Typography.Typography, {
|
|
47
|
+
slot: "title",
|
|
48
|
+
variant,
|
|
49
|
+
element,
|
|
50
|
+
cssOverrides: [require_styles.dialogHeadingStyles(require_mergeDeep.mergeDeep(require_styles.defaultDialogTheme.title, theme)), ...cssOverrides == null ? [] : Array.isArray(cssOverrides) ? cssOverrides : [cssOverrides]],
|
|
51
|
+
...props
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
const DialogButtons = ({ children, theme = {}, cssOverrides, ...props }) => {
|
|
55
|
+
const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultDialogTheme.ctas, theme);
|
|
56
|
+
const buttons = react.default.Children.toArray(children).map((child) => {
|
|
57
|
+
if (!react.default.isValidElement(child)) return false;
|
|
58
|
+
switch (child.type) {
|
|
59
|
+
case require_Button.Button:
|
|
60
|
+
case require_AvatarButton.AvatarButton:
|
|
61
|
+
case require_IconButton.IconButton: return child;
|
|
62
|
+
default: return false;
|
|
63
|
+
}
|
|
64
|
+
}).filter((child) => child !== false);
|
|
65
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
|
|
66
|
+
css: [require_styles.dialogButtonsStyles(mergedTheme), cssOverrides],
|
|
67
|
+
...props,
|
|
68
|
+
children: buttons
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
const DialogContent = ({ children, theme = {}, cssOverrides, ...props }) => {
|
|
72
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
|
|
73
|
+
css: [require_styles.dialogContentStyles(require_mergeDeep.mergeDeep(require_styles.defaultDialogTheme.children, theme)), cssOverrides],
|
|
74
|
+
...props,
|
|
75
|
+
children
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
const DialogDismiss = ({ theme = {}, size = "lg", symbol = "close", variant = "tertiary", ...props }) => {
|
|
79
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_IconButton.IconButton, {
|
|
80
|
+
size,
|
|
81
|
+
symbol,
|
|
82
|
+
variant,
|
|
83
|
+
cssOverrides: require_styles.dialogDismissStyles(require_mergeDeep.mergeDeep(require_styles.defaultDialogTheme.dismiss, theme)),
|
|
84
|
+
slot: "close",
|
|
85
|
+
...props
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
const Dialog = Object.assign(DialogRoot, {
|
|
89
|
+
Header: DialogHeader,
|
|
90
|
+
Buttons: DialogButtons,
|
|
91
|
+
Content: DialogContent,
|
|
92
|
+
Dismiss: DialogDismiss
|
|
93
|
+
});
|
|
94
|
+
//#endregion
|
|
95
|
+
exports.Dialog = Dialog;
|
|
96
|
+
exports.DialogTrigger = DialogTrigger;
|
|
97
|
+
exports.Modal = Modal;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DialogButtonsProps, DialogContentProps, DialogDismissProps, DialogHeaderProps, DialogProps, DialogTriggerProps, ModalProps } from "./types.cjs";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/Modal/Modal.d.ts
|
|
5
|
+
declare const Modal: ({
|
|
6
|
+
theme,
|
|
7
|
+
children,
|
|
8
|
+
cssOverrides,
|
|
9
|
+
...props
|
|
10
|
+
}: ModalProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare const DialogTrigger: (props: DialogTriggerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
interface DialogCompound {
|
|
13
|
+
(props: DialogProps): React.ReactElement;
|
|
14
|
+
Header: (props: DialogHeaderProps) => React.ReactElement;
|
|
15
|
+
Buttons: (props: DialogButtonsProps) => React.ReactElement;
|
|
16
|
+
Content: (props: DialogContentProps) => React.ReactElement;
|
|
17
|
+
Dismiss: (props: DialogDismissProps) => React.ReactElement;
|
|
18
|
+
}
|
|
19
|
+
declare const Dialog: DialogCompound;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Dialog, DialogTrigger, Modal };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DialogButtonsProps, DialogContentProps, DialogDismissProps, DialogHeaderProps, DialogProps, DialogTriggerProps, ModalProps } from "./types.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/Modal/Modal.d.ts
|
|
5
|
+
declare const Modal: ({
|
|
6
|
+
theme,
|
|
7
|
+
children,
|
|
8
|
+
cssOverrides,
|
|
9
|
+
...props
|
|
10
|
+
}: ModalProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare const DialogTrigger: (props: DialogTriggerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
interface DialogCompound {
|
|
13
|
+
(props: DialogProps): React.ReactElement;
|
|
14
|
+
Header: (props: DialogHeaderProps) => React.ReactElement;
|
|
15
|
+
Buttons: (props: DialogButtonsProps) => React.ReactElement;
|
|
16
|
+
Content: (props: DialogContentProps) => React.ReactElement;
|
|
17
|
+
Dismiss: (props: DialogDismissProps) => React.ReactElement;
|
|
18
|
+
}
|
|
19
|
+
declare const Dialog: DialogCompound;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Dialog, DialogTrigger, Modal };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { mergeDeep } from "../../util/mergeDeep.js";
|
|
2
|
+
import { IconButton } from "../IconButton/IconButton.js";
|
|
3
|
+
import { AvatarButton } from "../AvatarButton/AvatarButton.js";
|
|
4
|
+
import { Button as Button$1 } from "../Button/Button.js";
|
|
5
|
+
import { Typography } from "../Typography/Typography.js";
|
|
6
|
+
import { defaultDialogTheme, defaultModalTheme, dialogButtonsStyles, dialogContentStyles, dialogDismissStyles, dialogHeadingStyles, dialogStyles, modalOverlayStyles, modalStyles } from "./styles.js";
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
9
|
+
import { Dialog, DialogTrigger, Modal, ModalOverlay } from "react-aria-components";
|
|
10
|
+
//#region src/components/Modal/Modal.tsx
|
|
11
|
+
const Modal$1 = ({ theme = {}, children, cssOverrides, ...props }) => {
|
|
12
|
+
const mergedTheme = mergeDeep(defaultModalTheme, theme);
|
|
13
|
+
return /* @__PURE__ */ jsx(ModalOverlay, {
|
|
14
|
+
css: modalOverlayStyles(mergedTheme),
|
|
15
|
+
...props,
|
|
16
|
+
children: /* @__PURE__ */ jsx(Modal, {
|
|
17
|
+
css: [modalStyles(mergedTheme), cssOverrides],
|
|
18
|
+
children
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const DialogTrigger$1 = (props) => {
|
|
23
|
+
return /* @__PURE__ */ jsx(DialogTrigger, { ...props });
|
|
24
|
+
};
|
|
25
|
+
const DialogRoot = ({ children, theme = {}, cssOverrides, ...props }) => {
|
|
26
|
+
const mergedTheme = mergeDeep(defaultDialogTheme.container, theme);
|
|
27
|
+
const filteredChildren = React.Children.toArray(typeof children === "function" ? void 0 : children).map((child) => {
|
|
28
|
+
if (!React.isValidElement(child)) return false;
|
|
29
|
+
switch (child.type) {
|
|
30
|
+
case Dialog$1.Header:
|
|
31
|
+
case Dialog$1.Buttons:
|
|
32
|
+
case Dialog$1.Content:
|
|
33
|
+
case Dialog$1.Dismiss: return child;
|
|
34
|
+
default: return false;
|
|
35
|
+
}
|
|
36
|
+
}).filter((child) => child !== false);
|
|
37
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
38
|
+
css: [dialogStyles(mergedTheme), cssOverrides],
|
|
39
|
+
...props,
|
|
40
|
+
children: filteredChildren
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
const DialogHeader = ({ variant = "headingLg", element = "h2", theme = {}, cssOverrides, ...props }) => {
|
|
44
|
+
return /* @__PURE__ */ jsx(Typography, {
|
|
45
|
+
slot: "title",
|
|
46
|
+
variant,
|
|
47
|
+
element,
|
|
48
|
+
cssOverrides: [dialogHeadingStyles(mergeDeep(defaultDialogTheme.title, theme)), ...cssOverrides == null ? [] : Array.isArray(cssOverrides) ? cssOverrides : [cssOverrides]],
|
|
49
|
+
...props
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const DialogButtons = ({ children, theme = {}, cssOverrides, ...props }) => {
|
|
53
|
+
const mergedTheme = mergeDeep(defaultDialogTheme.ctas, theme);
|
|
54
|
+
const buttons = React.Children.toArray(children).map((child) => {
|
|
55
|
+
if (!React.isValidElement(child)) return false;
|
|
56
|
+
switch (child.type) {
|
|
57
|
+
case Button$1:
|
|
58
|
+
case AvatarButton:
|
|
59
|
+
case IconButton: return child;
|
|
60
|
+
default: return false;
|
|
61
|
+
}
|
|
62
|
+
}).filter((child) => child !== false);
|
|
63
|
+
return /* @__PURE__ */ jsx("div", {
|
|
64
|
+
css: [dialogButtonsStyles(mergedTheme), cssOverrides],
|
|
65
|
+
...props,
|
|
66
|
+
children: buttons
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const DialogContent = ({ children, theme = {}, cssOverrides, ...props }) => {
|
|
70
|
+
return /* @__PURE__ */ jsx("div", {
|
|
71
|
+
css: [dialogContentStyles(mergeDeep(defaultDialogTheme.children, theme)), cssOverrides],
|
|
72
|
+
...props,
|
|
73
|
+
children
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
const DialogDismiss = ({ theme = {}, size = "lg", symbol = "close", variant = "tertiary", ...props }) => {
|
|
77
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
78
|
+
size,
|
|
79
|
+
symbol,
|
|
80
|
+
variant,
|
|
81
|
+
cssOverrides: dialogDismissStyles(mergeDeep(defaultDialogTheme.dismiss, theme)),
|
|
82
|
+
slot: "close",
|
|
83
|
+
...props
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const Dialog$1 = Object.assign(DialogRoot, {
|
|
87
|
+
Header: DialogHeader,
|
|
88
|
+
Buttons: DialogButtons,
|
|
89
|
+
Content: DialogContent,
|
|
90
|
+
Dismiss: DialogDismiss
|
|
91
|
+
});
|
|
92
|
+
//#endregion
|
|
93
|
+
export { Dialog$1 as Dialog, DialogTrigger$1 as DialogTrigger, Modal$1 as Modal };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
const require_typography = require("../../styleD/utils/semantic/typography.cjs");
|
|
2
|
+
const require_mq = require("../../styleD/utils/semantic/mq.cjs");
|
|
3
|
+
const require_modal = require("../../styleD/build/typescript/component/modal.cjs");
|
|
4
|
+
const require_typography$1 = require("../../styleD/build/typescript/semantic/typography.cjs");
|
|
5
|
+
let _emotion_react = require("@emotion/react");
|
|
6
|
+
//#region src/components/Modal/styles.ts
|
|
7
|
+
const defaultModalTheme = {
|
|
8
|
+
modal: require_modal.componentModal.modal,
|
|
9
|
+
overlay: require_modal.componentModal.overlay
|
|
10
|
+
};
|
|
11
|
+
const modalOverlayStyles = (theme) => {
|
|
12
|
+
return _emotion_react.css`
|
|
13
|
+
position: ${theme.overlay.position};
|
|
14
|
+
top: ${theme.overlay.top};
|
|
15
|
+
left: ${theme.overlay.left};
|
|
16
|
+
width: ${theme.overlay.width};
|
|
17
|
+
height: ${theme.overlay.height};
|
|
18
|
+
background: ${theme.overlay.backgroundColor};
|
|
19
|
+
overflow: ${theme.overlay.overflow};
|
|
20
|
+
z-index: ${theme.overlay.zIndex};
|
|
21
|
+
`;
|
|
22
|
+
};
|
|
23
|
+
const modalStyles = (theme) => {
|
|
24
|
+
return _emotion_react.css`
|
|
25
|
+
position: ${theme.modal.position};
|
|
26
|
+
max-height: calc(var(--visual-viewport-height, 100svh) * 0.9);
|
|
27
|
+
top: calc(var(--visual-viewport-height, 100svh) / 2);
|
|
28
|
+
margin-left: ${theme.modal.marginLeft};
|
|
29
|
+
translate: ${theme.modal.translate};
|
|
30
|
+
box-shadow: ${theme.modal.boxShadow};
|
|
31
|
+
border-radius: ${theme.modal.borderRadius};
|
|
32
|
+
width: ${theme.modal.width};
|
|
33
|
+
max-width: ${theme.modal.maxWidth};
|
|
34
|
+
background-color: ${theme.modal.backgroundColor};
|
|
35
|
+
padding-top: ${theme.modal.padding.top};
|
|
36
|
+
padding-bottom: ${theme.modal.padding.bottom};
|
|
37
|
+
padding-left: ${theme.modal.padding.left};
|
|
38
|
+
padding-right: ${theme.modal.padding.right};
|
|
39
|
+
`;
|
|
40
|
+
};
|
|
41
|
+
const defaultDialogTheme = require_modal.componentModal.dialog;
|
|
42
|
+
const dialogStyles = (theme) => {
|
|
43
|
+
return _emotion_react.css`
|
|
44
|
+
display: ${theme.display};
|
|
45
|
+
grid-template-areas: ${theme.gridTemplateAreas};
|
|
46
|
+
grid-template-columns: ${theme.gridTemplateColumns};
|
|
47
|
+
grid-template-rows: ${theme.gridTemplateRows};
|
|
48
|
+
`;
|
|
49
|
+
};
|
|
50
|
+
const dialogDismissStyles = (theme) => {
|
|
51
|
+
return _emotion_react.css`
|
|
52
|
+
grid-area: ${theme.gridArea};
|
|
53
|
+
margin-left: ${theme.marginLeft};
|
|
54
|
+
margin-bottom: ${theme.marginBottom};
|
|
55
|
+
border: ${theme.border};
|
|
56
|
+
height: ${theme.height};
|
|
57
|
+
width: ${theme.width};
|
|
58
|
+
|
|
59
|
+
&[data-hovered] {
|
|
60
|
+
background: ${theme.hovered.background};
|
|
61
|
+
border: ${theme.hovered.border};
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
};
|
|
65
|
+
const dialogHeadingStyles = (theme) => {
|
|
66
|
+
return _emotion_react.css`
|
|
67
|
+
grid-area: ${theme.gridArea};
|
|
68
|
+
margin-bottom: ${theme.marginBottom};
|
|
69
|
+
`;
|
|
70
|
+
};
|
|
71
|
+
const dialogContentStyles = (theme) => {
|
|
72
|
+
return _emotion_react.css`
|
|
73
|
+
grid-area: ${theme.gridArea};
|
|
74
|
+
margin-bottom: ${theme.marginBottom};
|
|
75
|
+
${require_typography.convertTypographyToEmotionStringStyle(require_typography$1.semanticTypography.bodyMd)}
|
|
76
|
+
`;
|
|
77
|
+
};
|
|
78
|
+
const dialogButtonsStyles = (theme) => {
|
|
79
|
+
return _emotion_react.css`
|
|
80
|
+
grid-area: ${theme.gridArea};
|
|
81
|
+
display: ${theme.display};
|
|
82
|
+
flex-direction: ${theme.flexDirection};
|
|
83
|
+
gap: ${theme.gap};
|
|
84
|
+
justify-content: ${theme.justifyContent};
|
|
85
|
+
|
|
86
|
+
${require_mq.from.md} {
|
|
87
|
+
flex-direction: ${theme.md.flexDirection};
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
};
|
|
91
|
+
//#endregion
|
|
92
|
+
exports.defaultDialogTheme = defaultDialogTheme;
|
|
93
|
+
exports.defaultModalTheme = defaultModalTheme;
|
|
94
|
+
exports.dialogButtonsStyles = dialogButtonsStyles;
|
|
95
|
+
exports.dialogContentStyles = dialogContentStyles;
|
|
96
|
+
exports.dialogDismissStyles = dialogDismissStyles;
|
|
97
|
+
exports.dialogHeadingStyles = dialogHeadingStyles;
|
|
98
|
+
exports.dialogStyles = dialogStyles;
|
|
99
|
+
exports.modalOverlayStyles = modalOverlayStyles;
|
|
100
|
+
exports.modalStyles = modalStyles;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DeepPartial, Prettify } from "../../util/types.cjs";
|
|
2
|
+
import { ComponentModal } from "../../styleD/build/typescript/component/modal.cjs";
|
|
3
|
+
import { SerializedStyles } from "@emotion/react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Modal/styles.d.ts
|
|
6
|
+
type ModalTheme = Prettify<Pick<ComponentModal, 'modal' | 'overlay'>>;
|
|
7
|
+
type PartialModalTheme = Prettify<DeepPartial<ModalTheme>>;
|
|
8
|
+
type DialogTheme = Prettify<ComponentModal['dialog']>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { DialogTheme, ModalTheme, PartialModalTheme };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DeepPartial, Prettify } from "../../util/types.js";
|
|
2
|
+
import { ComponentModal } from "../../styleD/build/typescript/component/modal.js";
|
|
3
|
+
import { SerializedStyles } from "@emotion/react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Modal/styles.d.ts
|
|
6
|
+
type ModalTheme = Prettify<Pick<ComponentModal, 'modal' | 'overlay'>>;
|
|
7
|
+
type PartialModalTheme = Prettify<DeepPartial<ModalTheme>>;
|
|
8
|
+
type DialogTheme = Prettify<ComponentModal['dialog']>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { DialogTheme, ModalTheme, PartialModalTheme };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { convertTypographyToEmotionStringStyle } from "../../styleD/utils/semantic/typography.js";
|
|
2
|
+
import { from } from "../../styleD/utils/semantic/mq.js";
|
|
3
|
+
import { componentModal } from "../../styleD/build/typescript/component/modal.js";
|
|
4
|
+
import { semanticTypography } from "../../styleD/build/typescript/semantic/typography.js";
|
|
5
|
+
import { css } from "@emotion/react";
|
|
6
|
+
//#region src/components/Modal/styles.ts
|
|
7
|
+
const defaultModalTheme = {
|
|
8
|
+
modal: componentModal.modal,
|
|
9
|
+
overlay: componentModal.overlay
|
|
10
|
+
};
|
|
11
|
+
const modalOverlayStyles = (theme) => {
|
|
12
|
+
return css`
|
|
13
|
+
position: ${theme.overlay.position};
|
|
14
|
+
top: ${theme.overlay.top};
|
|
15
|
+
left: ${theme.overlay.left};
|
|
16
|
+
width: ${theme.overlay.width};
|
|
17
|
+
height: ${theme.overlay.height};
|
|
18
|
+
background: ${theme.overlay.backgroundColor};
|
|
19
|
+
overflow: ${theme.overlay.overflow};
|
|
20
|
+
z-index: ${theme.overlay.zIndex};
|
|
21
|
+
`;
|
|
22
|
+
};
|
|
23
|
+
const modalStyles = (theme) => {
|
|
24
|
+
return css`
|
|
25
|
+
position: ${theme.modal.position};
|
|
26
|
+
max-height: calc(var(--visual-viewport-height, 100svh) * 0.9);
|
|
27
|
+
top: calc(var(--visual-viewport-height, 100svh) / 2);
|
|
28
|
+
margin-left: ${theme.modal.marginLeft};
|
|
29
|
+
translate: ${theme.modal.translate};
|
|
30
|
+
box-shadow: ${theme.modal.boxShadow};
|
|
31
|
+
border-radius: ${theme.modal.borderRadius};
|
|
32
|
+
width: ${theme.modal.width};
|
|
33
|
+
max-width: ${theme.modal.maxWidth};
|
|
34
|
+
background-color: ${theme.modal.backgroundColor};
|
|
35
|
+
padding-top: ${theme.modal.padding.top};
|
|
36
|
+
padding-bottom: ${theme.modal.padding.bottom};
|
|
37
|
+
padding-left: ${theme.modal.padding.left};
|
|
38
|
+
padding-right: ${theme.modal.padding.right};
|
|
39
|
+
`;
|
|
40
|
+
};
|
|
41
|
+
const defaultDialogTheme = componentModal.dialog;
|
|
42
|
+
const dialogStyles = (theme) => {
|
|
43
|
+
return css`
|
|
44
|
+
display: ${theme.display};
|
|
45
|
+
grid-template-areas: ${theme.gridTemplateAreas};
|
|
46
|
+
grid-template-columns: ${theme.gridTemplateColumns};
|
|
47
|
+
grid-template-rows: ${theme.gridTemplateRows};
|
|
48
|
+
`;
|
|
49
|
+
};
|
|
50
|
+
const dialogDismissStyles = (theme) => {
|
|
51
|
+
return css`
|
|
52
|
+
grid-area: ${theme.gridArea};
|
|
53
|
+
margin-left: ${theme.marginLeft};
|
|
54
|
+
margin-bottom: ${theme.marginBottom};
|
|
55
|
+
border: ${theme.border};
|
|
56
|
+
height: ${theme.height};
|
|
57
|
+
width: ${theme.width};
|
|
58
|
+
|
|
59
|
+
&[data-hovered] {
|
|
60
|
+
background: ${theme.hovered.background};
|
|
61
|
+
border: ${theme.hovered.border};
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
};
|
|
65
|
+
const dialogHeadingStyles = (theme) => {
|
|
66
|
+
return css`
|
|
67
|
+
grid-area: ${theme.gridArea};
|
|
68
|
+
margin-bottom: ${theme.marginBottom};
|
|
69
|
+
`;
|
|
70
|
+
};
|
|
71
|
+
const dialogContentStyles = (theme) => {
|
|
72
|
+
return css`
|
|
73
|
+
grid-area: ${theme.gridArea};
|
|
74
|
+
margin-bottom: ${theme.marginBottom};
|
|
75
|
+
${convertTypographyToEmotionStringStyle(semanticTypography.bodyMd)}
|
|
76
|
+
`;
|
|
77
|
+
};
|
|
78
|
+
const dialogButtonsStyles = (theme) => {
|
|
79
|
+
return css`
|
|
80
|
+
grid-area: ${theme.gridArea};
|
|
81
|
+
display: ${theme.display};
|
|
82
|
+
flex-direction: ${theme.flexDirection};
|
|
83
|
+
gap: ${theme.gap};
|
|
84
|
+
justify-content: ${theme.justifyContent};
|
|
85
|
+
|
|
86
|
+
${from.md} {
|
|
87
|
+
flex-direction: ${theme.md.flexDirection};
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
};
|
|
91
|
+
//#endregion
|
|
92
|
+
export { defaultDialogTheme, defaultModalTheme, dialogButtonsStyles, dialogContentStyles, dialogDismissStyles, dialogHeadingStyles, dialogStyles, modalOverlayStyles, modalStyles };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DeepPartial, DefaultProps, DefaultPropsWithChildren } from "../../util/types.cjs";
|
|
2
|
+
import { IconButtonProps } from "../IconButton/types.cjs";
|
|
3
|
+
import { TypographyProps } from "../Typography/types.cjs";
|
|
4
|
+
import { DialogTheme, ModalTheme } from "./styles.cjs";
|
|
5
|
+
import { DialogProps, DialogTriggerProps, ModalOverlayProps } from "react-aria-components";
|
|
6
|
+
|
|
7
|
+
//#region src/components/Modal/types.d.ts
|
|
8
|
+
type ModalProps = DefaultProps<ModalTheme, ModalOverlayProps['className']> & ModalOverlayProps;
|
|
9
|
+
type DialogProps$1 = DefaultProps<DialogTheme['container'], DialogProps['className']> & DialogProps;
|
|
10
|
+
type DialogHeaderProps = Omit<TypographyProps, 'theme'> & {
|
|
11
|
+
theme?: DeepPartial<DialogTheme['title']>;
|
|
12
|
+
};
|
|
13
|
+
type DialogButtonsProps = DefaultPropsWithChildren<DialogTheme['ctas']>;
|
|
14
|
+
type DialogContentProps = DefaultPropsWithChildren<DialogTheme['children']>;
|
|
15
|
+
type DialogDismissProps = Omit<IconButtonProps, 'theme'> & {
|
|
16
|
+
theme?: DeepPartial<DialogTheme['dismiss']>;
|
|
17
|
+
};
|
|
18
|
+
type DialogTriggerProps$1 = DialogTriggerProps;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { DialogButtonsProps, DialogContentProps, DialogDismissProps, DialogHeaderProps, DialogProps$1 as DialogProps, DialogTriggerProps$1 as DialogTriggerProps, ModalProps };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DeepPartial, DefaultProps, DefaultPropsWithChildren } from "../../util/types.js";
|
|
2
|
+
import { IconButtonProps } from "../IconButton/types.js";
|
|
3
|
+
import { TypographyProps } from "../Typography/types.js";
|
|
4
|
+
import { DialogTheme, ModalTheme } from "./styles.js";
|
|
5
|
+
import { DialogProps, DialogTriggerProps, ModalOverlayProps } from "react-aria-components";
|
|
6
|
+
|
|
7
|
+
//#region src/components/Modal/types.d.ts
|
|
8
|
+
type ModalProps = DefaultProps<ModalTheme, ModalOverlayProps['className']> & ModalOverlayProps;
|
|
9
|
+
type DialogProps$1 = DefaultProps<DialogTheme['container'], DialogProps['className']> & DialogProps;
|
|
10
|
+
type DialogHeaderProps = Omit<TypographyProps, 'theme'> & {
|
|
11
|
+
theme?: DeepPartial<DialogTheme['title']>;
|
|
12
|
+
};
|
|
13
|
+
type DialogButtonsProps = DefaultPropsWithChildren<DialogTheme['ctas']>;
|
|
14
|
+
type DialogContentProps = DefaultPropsWithChildren<DialogTheme['children']>;
|
|
15
|
+
type DialogDismissProps = Omit<IconButtonProps, 'theme'> & {
|
|
16
|
+
theme?: DeepPartial<DialogTheme['dismiss']>;
|
|
17
|
+
};
|
|
18
|
+
type DialogTriggerProps$1 = DialogTriggerProps;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { DialogButtonsProps, DialogContentProps, DialogDismissProps, DialogHeaderProps, DialogProps$1 as DialogProps, DialogTriggerProps$1 as DialogTriggerProps, ModalProps };
|