@sanity/ui 5.0.0-alpha.6 → 5.0.0-alpha.7
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/index.d.ts +41 -41
- package/dist/index.js +173 -173
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/{modal/Modal.tsx → dialog/Dialog.tsx} +27 -27
- package/src/components/{modal/modal.css → dialog/dialog.css} +11 -11
- package/src/components/{modal/modal.props.ts → dialog/dialog.props.ts} +6 -6
- package/src/components/index.css +1 -1
- package/src/index.ts +1 -1
- package/src/version.ts +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -180,6 +180,47 @@ declare const DENSITY: readonly ["compact", "regular", "loose"];
|
|
|
180
180
|
/** @public */
|
|
181
181
|
export declare type Density = (typeof DENSITY)[number];
|
|
182
182
|
|
|
183
|
+
/**
|
|
184
|
+
* @beta
|
|
185
|
+
*
|
|
186
|
+
* Renders a modal dialog element — should not be used for nonmodal dialogs.
|
|
187
|
+
* Modal dialogs make their containing documents inert, and render on the topmost
|
|
188
|
+
* layer within that containing document; they must be dimissed before the containing
|
|
189
|
+
* document and its contents become unblocked. They also trap focus within the bounds
|
|
190
|
+
* of the dialog element and its descendants.
|
|
191
|
+
*
|
|
192
|
+
* For more on dialogs and modality, refer to the HTML specification for the dialog element:
|
|
193
|
+
* https://html.spec.whatwg.org/dev/interactive-elements.html#the-dialog-element
|
|
194
|
+
*/
|
|
195
|
+
export declare const Dialog: typeof DialogRoot;
|
|
196
|
+
|
|
197
|
+
declare function DialogContent(props: ComponentProps<"div">): JSX.Element;
|
|
198
|
+
|
|
199
|
+
declare function DialogFooter(props: ComponentProps<"div">): JSX.Element;
|
|
200
|
+
|
|
201
|
+
/** @beta */
|
|
202
|
+
export declare interface DialogProps extends Omit<
|
|
203
|
+
React.ComponentProps<"dialog">,
|
|
204
|
+
"open"
|
|
205
|
+
> {
|
|
206
|
+
/** Text to be displayed as the dialog's heading; optional but recommended for optimal accessibility and presentation */
|
|
207
|
+
header?: string;
|
|
208
|
+
/** Used to set the value of open to false. Fires whenever the dialog is closed, either programmatically or by the user (via Esc key, clicking background, clicking the dialog's close button, or any other means.) */
|
|
209
|
+
onClose: React.ReactEventHandler<HTMLDialogElement>;
|
|
210
|
+
/** Whether the dialog is open; defaults to false. */
|
|
211
|
+
open?: boolean;
|
|
212
|
+
/** Max width of the dialog */
|
|
213
|
+
size?: Responsive<ContainerSize>;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
declare function DialogRoot({ open, size, ...props }: DialogProps): JSX.Element;
|
|
217
|
+
|
|
218
|
+
declare namespace DialogRoot {
|
|
219
|
+
var displayName: string;
|
|
220
|
+
var Content: typeof DialogContent;
|
|
221
|
+
var Footer: typeof DialogFooter;
|
|
222
|
+
}
|
|
223
|
+
|
|
183
224
|
declare const DISPLAY_BLOCK: readonly ["block", "inline-block", "none"];
|
|
184
225
|
|
|
185
226
|
declare const DISPLAY_FLEX: readonly ["flex", "inline-flex", "none"];
|
|
@@ -641,47 +682,6 @@ export declare type MarginProps = {
|
|
|
641
682
|
marginLeft?: Responsive<SpaceAutoNegative>;
|
|
642
683
|
};
|
|
643
684
|
|
|
644
|
-
/**
|
|
645
|
-
* @beta
|
|
646
|
-
*
|
|
647
|
-
* Renders a modal dialog element — should not be used for nonmodal dialogs.
|
|
648
|
-
* Modal dialogs make their containing documents inert, and render on the topmost
|
|
649
|
-
* layer within that containing document; they must be dimissed before the containing
|
|
650
|
-
* document and its contents become unblocked. They also trap focus within the bounds
|
|
651
|
-
* of the modal element and its descendants.
|
|
652
|
-
*
|
|
653
|
-
* For more on dialogs and modality, refer to the HTML specification for the dialog element:
|
|
654
|
-
* https://html.spec.whatwg.org/dev/interactive-elements.html#the-dialog-element
|
|
655
|
-
*/
|
|
656
|
-
export declare const Modal: typeof ModalRoot;
|
|
657
|
-
|
|
658
|
-
declare function ModalContent(props: ComponentProps<"div">): JSX.Element;
|
|
659
|
-
|
|
660
|
-
declare function ModalFooter(props: ComponentProps<"div">): JSX.Element;
|
|
661
|
-
|
|
662
|
-
/** @beta */
|
|
663
|
-
export declare interface ModalProps extends Omit<
|
|
664
|
-
React.ComponentProps<"dialog">,
|
|
665
|
-
"open"
|
|
666
|
-
> {
|
|
667
|
-
/** Text to be displayed as the modal's heading; optional but recommended for optimal accessibility and presentation */
|
|
668
|
-
header?: string;
|
|
669
|
-
/** Used to set the value of open to false. Fires whenever the modal is closed, either programmatically or by the user (via Esc key, clicking background, clicking the modal's close button, or any other means.) */
|
|
670
|
-
onClose: React.ReactEventHandler<HTMLDialogElement>;
|
|
671
|
-
/** Whether the modal is open; defaults to false. */
|
|
672
|
-
open?: boolean;
|
|
673
|
-
/** Max width of the modal */
|
|
674
|
-
size?: Responsive<ContainerSize>;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
declare function ModalRoot({ open, size, ...props }: ModalProps): JSX.Element;
|
|
678
|
-
|
|
679
|
-
declare namespace ModalRoot {
|
|
680
|
-
var displayName: string;
|
|
681
|
-
var Content: typeof ModalContent;
|
|
682
|
-
var Footer: typeof ModalFooter;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
685
|
declare const OVERFLOW: readonly [
|
|
686
686
|
"visible",
|
|
687
687
|
"hidden",
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
4
|
import clsx from "clsx";
|
|
5
|
-
import { isValidElement, useRef, useEffect, lazy, Suspense,
|
|
5
|
+
import { isValidElement, useRef, useEffect, lazy, Suspense, useId, Children, useSyncExternalStore, useState, cloneElement, Activity } from "react";
|
|
6
6
|
import { SpinnerIcon, RemoveIcon, CheckmarkIcon, CloseIcon } from "@sanity/icons";
|
|
7
7
|
import { createPortal } from "react-dom";
|
|
8
8
|
const PREFIX = "sui", BREAKPOINTS_LENGTH = 6;
|
|
@@ -96,7 +96,7 @@ function getCompositeValue(propValue, propDef, key) {
|
|
|
96
96
|
compositeValue = mapping?.[propValue];
|
|
97
97
|
return compositeValue;
|
|
98
98
|
}
|
|
99
|
-
const HASH = "
|
|
99
|
+
const HASH = "47d232";
|
|
100
100
|
function suffixClassName(className) {
|
|
101
101
|
return `${className}-${HASH}`;
|
|
102
102
|
}
|
|
@@ -971,6 +971,176 @@ function Container(t0) {
|
|
|
971
971
|
let t2;
|
|
972
972
|
return $[6] !== T0 || $[7] !== children || $[8] !== rest || $[9] !== style || $[10] !== t1 ? (t2 = /* @__PURE__ */ jsx(T0, { className: t1, style, "data-ui": "Container", ...rest, children }), $[6] = T0, $[7] = children, $[8] = rest, $[9] = style, $[10] = t1, $[11] = t2) : t2 = $[11], t2;
|
|
973
973
|
}
|
|
974
|
+
const HEADING_TAG = ["h1", "h2", "h3", "h4", "h5", "h6"], HEADING_SIZE = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], headingProps = {
|
|
975
|
+
as: {
|
|
976
|
+
type: "union",
|
|
977
|
+
values: HEADING_TAG
|
|
978
|
+
},
|
|
979
|
+
size: {
|
|
980
|
+
type: "union",
|
|
981
|
+
className: "text-heading",
|
|
982
|
+
values: HEADING_SIZE
|
|
983
|
+
},
|
|
984
|
+
...typographyProps
|
|
985
|
+
}, headingClassName = suffixClassName("sui-Heading");
|
|
986
|
+
function Heading(t0) {
|
|
987
|
+
const $ = c(15);
|
|
988
|
+
let T0, children, rest, style, t1, t2;
|
|
989
|
+
if ($[0] !== t0) {
|
|
990
|
+
t2 = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
|
|
991
|
+
bb0: {
|
|
992
|
+
const {
|
|
993
|
+
size: t32,
|
|
994
|
+
weight: t4,
|
|
995
|
+
...props
|
|
996
|
+
} = t0, size = t32 === void 0 ? 2 : t32, weight = t4 === void 0 ? "bold" : t4, {
|
|
997
|
+
as,
|
|
998
|
+
children: t5,
|
|
999
|
+
className,
|
|
1000
|
+
style: t6,
|
|
1001
|
+
...t7
|
|
1002
|
+
} = getProps({
|
|
1003
|
+
size,
|
|
1004
|
+
weight,
|
|
1005
|
+
...props
|
|
1006
|
+
}, headingProps);
|
|
1007
|
+
children = t5, style = t6, rest = t7;
|
|
1008
|
+
const Component = as || "h2";
|
|
1009
|
+
if (props.truncate && props.trim) {
|
|
1010
|
+
const t8 = clsx(headingClassName, className?.replace("sui-line-clamp", "").replace("sui-text-overflow", "")), t9 = props.truncate === 1 ? "sui-text-overflow" : "sui-line-clamp";
|
|
1011
|
+
let t10;
|
|
1012
|
+
$[7] !== t9 ? (t10 = clsx("sui-overflow-hidden", t9), $[7] = t9, $[8] = t10) : t10 = $[8], t2 = /* @__PURE__ */ jsx(Component, { className: t8, style, "data-ui": "Heading", ...rest, children: /* @__PURE__ */ jsx("span", { className: t10, children }) });
|
|
1013
|
+
break bb0;
|
|
1014
|
+
}
|
|
1015
|
+
T0 = Component, t1 = clsx(headingClassName, props.truncate && "sui-overflow-hidden", className);
|
|
1016
|
+
}
|
|
1017
|
+
$[0] = t0, $[1] = T0, $[2] = children, $[3] = rest, $[4] = style, $[5] = t1, $[6] = t2;
|
|
1018
|
+
} else
|
|
1019
|
+
T0 = $[1], children = $[2], rest = $[3], style = $[4], t1 = $[5], t2 = $[6];
|
|
1020
|
+
if (t2 !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel"))
|
|
1021
|
+
return t2;
|
|
1022
|
+
let t3;
|
|
1023
|
+
return $[9] !== T0 || $[10] !== children || $[11] !== rest || $[12] !== style || $[13] !== t1 ? (t3 = /* @__PURE__ */ jsx(T0, { className: t1, style, "data-ui": "Heading", ...rest, children }), $[9] = T0, $[10] = children, $[11] = rest, $[12] = style, $[13] = t1, $[14] = t3) : t3 = $[14], t3;
|
|
1024
|
+
}
|
|
1025
|
+
const iconButtonProps = {
|
|
1026
|
+
"aria-label": {
|
|
1027
|
+
type: "string"
|
|
1028
|
+
},
|
|
1029
|
+
as: buttonProps.as,
|
|
1030
|
+
icon: {
|
|
1031
|
+
type: "string"
|
|
1032
|
+
}
|
|
1033
|
+
}, iconButtonClassName = suffixClassName("sui-IconButton");
|
|
1034
|
+
function IconButton(props) {
|
|
1035
|
+
const $ = c(16);
|
|
1036
|
+
let IconProp, T0, rest, style, t0, t1;
|
|
1037
|
+
if ($[0] !== props) {
|
|
1038
|
+
const {
|
|
1039
|
+
as,
|
|
1040
|
+
className,
|
|
1041
|
+
style: t22,
|
|
1042
|
+
icon: t32,
|
|
1043
|
+
...t4
|
|
1044
|
+
} = getProps(props, iconButtonProps);
|
|
1045
|
+
style = t22, IconProp = t32, rest = t4;
|
|
1046
|
+
const Component = as || "button";
|
|
1047
|
+
T0 = Button, t0 = Component, t1 = clsx(iconButtonClassName, className), $[0] = props, $[1] = IconProp, $[2] = T0, $[3] = rest, $[4] = style, $[5] = t0, $[6] = t1;
|
|
1048
|
+
} else
|
|
1049
|
+
IconProp = $[1], T0 = $[2], rest = $[3], style = $[4], t0 = $[5], t1 = $[6];
|
|
1050
|
+
let t2;
|
|
1051
|
+
$[7] !== IconProp ? (t2 = /* @__PURE__ */ jsx(Icon, { icon: IconProp, margin: -2, size: 1 }), $[7] = IconProp, $[8] = t2) : t2 = $[8];
|
|
1052
|
+
let t3;
|
|
1053
|
+
return $[9] !== T0 || $[10] !== rest || $[11] !== style || $[12] !== t0 || $[13] !== t1 || $[14] !== t2 ? (t3 = /* @__PURE__ */ jsx(T0, { as: t0, className: t1, style, "data-ui": "IconButton", ...rest, children: t2 }), $[9] = T0, $[10] = rest, $[11] = style, $[12] = t0, $[13] = t1, $[14] = t2, $[15] = t3) : t3 = $[15], t3;
|
|
1054
|
+
}
|
|
1055
|
+
const dialogProps = {
|
|
1056
|
+
header: {
|
|
1057
|
+
type: "string"
|
|
1058
|
+
},
|
|
1059
|
+
open: {
|
|
1060
|
+
type: "boolean"
|
|
1061
|
+
},
|
|
1062
|
+
size: {
|
|
1063
|
+
type: "union",
|
|
1064
|
+
className: "container",
|
|
1065
|
+
values: CONTAINER_SIZE
|
|
1066
|
+
}
|
|
1067
|
+
}, dialogClassName = suffixClassName("sui-Dialog"), dialogContentClassName = suffixClassName("sui-DialogContent"), dialogFooterClassName = suffixClassName("sui-DialogFooter");
|
|
1068
|
+
function DialogRoot(t0) {
|
|
1069
|
+
const $ = c(17), {
|
|
1070
|
+
open: t1,
|
|
1071
|
+
size: t2,
|
|
1072
|
+
...props
|
|
1073
|
+
} = t0, open = t1 === void 0 ? !1 : t1, size = t2 === void 0 ? 0 : t2, {
|
|
1074
|
+
children,
|
|
1075
|
+
className,
|
|
1076
|
+
style,
|
|
1077
|
+
header,
|
|
1078
|
+
onClose,
|
|
1079
|
+
...rest
|
|
1080
|
+
} = getProps({
|
|
1081
|
+
size,
|
|
1082
|
+
...props
|
|
1083
|
+
}, dialogProps), dialogRef = useRef(null), headerId = useId(), dialogClasses = clsx(dialogClassName, "sui-inset0 sui-m-auto sui-radius5 sui-shadow3 sui-p4 sui-flex-direction-column sui-gap4 sui-overflow-y-auto");
|
|
1084
|
+
let t3, t4;
|
|
1085
|
+
$[0] !== open ? (t3 = () => {
|
|
1086
|
+
const dialogElement = dialogRef.current;
|
|
1087
|
+
if (dialogElement)
|
|
1088
|
+
return open ? dialogElement.open || dialogElement.showModal() : dialogElement.open && dialogElement.close(), () => {
|
|
1089
|
+
dialogElement.close();
|
|
1090
|
+
};
|
|
1091
|
+
}, t4 = [open], $[0] = open, $[1] = t3, $[2] = t4) : (t3 = $[1], t4 = $[2]), useEffect(t3, t4);
|
|
1092
|
+
const t5 = "any", t6 = header ? headerId : void 0, t7 = clsx(dialogClasses, className);
|
|
1093
|
+
let t8;
|
|
1094
|
+
$[3] !== header || $[4] !== headerId ? (t8 = header ? /* @__PURE__ */ jsx(Heading, { trim: !0, size: 1, id: headerId, children: header }) : /* @__PURE__ */ jsx("div", {}), $[3] = header, $[4] = headerId, $[5] = t8) : t8 = $[5];
|
|
1095
|
+
let t9;
|
|
1096
|
+
$[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsx(IconButton, { "aria-label": "Close", level: "tertiary", icon: CloseIcon, onClick: () => dialogRef.current?.close() }), $[6] = t9) : t9 = $[6];
|
|
1097
|
+
let t10;
|
|
1098
|
+
$[7] !== t8 ? (t10 = /* @__PURE__ */ jsxs(Flex, { flexShrink: 0, justifyContent: "space-between", alignItems: "center", children: [
|
|
1099
|
+
t8,
|
|
1100
|
+
t9
|
|
1101
|
+
] }), $[7] = t8, $[8] = t10) : t10 = $[8];
|
|
1102
|
+
let t11;
|
|
1103
|
+
return $[9] !== children || $[10] !== onClose || $[11] !== rest || $[12] !== style || $[13] !== t10 || $[14] !== t6 || $[15] !== t7 ? (t11 = /* @__PURE__ */ jsxs("dialog", { ...rest, ref: dialogRef, closedby: t5, "aria-labelledby": t6, onClose, className: t7, style, "data-ui": "Dialog", children: [
|
|
1104
|
+
t10,
|
|
1105
|
+
children
|
|
1106
|
+
] }), $[9] = children, $[10] = onClose, $[11] = rest, $[12] = style, $[13] = t10, $[14] = t6, $[15] = t7, $[16] = t11) : t11 = $[16], t11;
|
|
1107
|
+
}
|
|
1108
|
+
function DialogContent(props) {
|
|
1109
|
+
const $ = c(12);
|
|
1110
|
+
let T0, children, style, t0, t1;
|
|
1111
|
+
if ($[0] !== props) {
|
|
1112
|
+
const {
|
|
1113
|
+
children: t22,
|
|
1114
|
+
className,
|
|
1115
|
+
style: t3,
|
|
1116
|
+
...rest
|
|
1117
|
+
} = getProps(props, {});
|
|
1118
|
+
children = t22, style = t3, T0 = Box, t0 = rest, t1 = clsx(dialogContentClassName, className), $[0] = props, $[1] = T0, $[2] = children, $[3] = style, $[4] = t0, $[5] = t1;
|
|
1119
|
+
} else
|
|
1120
|
+
T0 = $[1], children = $[2], style = $[3], t0 = $[4], t1 = $[5];
|
|
1121
|
+
let t2;
|
|
1122
|
+
return $[6] !== T0 || $[7] !== children || $[8] !== style || $[9] !== t0 || $[10] !== t1 ? (t2 = /* @__PURE__ */ jsx(T0, { ...t0, className: t1, style, "data-ui": "DialogContent", flexGrow: 1, overflowY: "auto", children }), $[6] = T0, $[7] = children, $[8] = style, $[9] = t0, $[10] = t1, $[11] = t2) : t2 = $[11], t2;
|
|
1123
|
+
}
|
|
1124
|
+
function DialogFooter(props) {
|
|
1125
|
+
const $ = c(12);
|
|
1126
|
+
let T0, children, style, t0, t1;
|
|
1127
|
+
if ($[0] !== props) {
|
|
1128
|
+
const {
|
|
1129
|
+
children: t22,
|
|
1130
|
+
className,
|
|
1131
|
+
style: t3,
|
|
1132
|
+
...rest
|
|
1133
|
+
} = getProps(props, {});
|
|
1134
|
+
children = t22, style = t3, T0 = Box, t0 = rest, t1 = clsx(dialogFooterClassName, className), $[0] = props, $[1] = T0, $[2] = children, $[3] = style, $[4] = t0, $[5] = t1;
|
|
1135
|
+
} else
|
|
1136
|
+
T0 = $[1], children = $[2], style = $[3], t0 = $[4], t1 = $[5];
|
|
1137
|
+
let t2;
|
|
1138
|
+
return $[6] !== T0 || $[7] !== children || $[8] !== style || $[9] !== t0 || $[10] !== t1 ? (t2 = /* @__PURE__ */ jsx(T0, { ...t0, className: t1, style, "data-ui": "DialogFooter", flexShrink: 0, children }), $[6] = T0, $[7] = children, $[8] = style, $[9] = t0, $[10] = t1, $[11] = t2) : t2 = $[11], t2;
|
|
1139
|
+
}
|
|
1140
|
+
DialogRoot.displayName = "Dialog";
|
|
1141
|
+
const Dialog = DialogRoot;
|
|
1142
|
+
DialogRoot.Content = DialogContent;
|
|
1143
|
+
DialogRoot.Footer = DialogFooter;
|
|
974
1144
|
const dividerProps = {
|
|
975
1145
|
...marginProps
|
|
976
1146
|
}, dividerClassName = suffixClassName("sui-Divider");
|
|
@@ -1130,87 +1300,6 @@ function HStack(props) {
|
|
|
1130
1300
|
let t2;
|
|
1131
1301
|
return $[7] !== T0 || $[8] !== children || $[9] !== rest || $[10] !== style || $[11] !== t0 || $[12] !== t1 ? (t2 = /* @__PURE__ */ jsx(T0, { as: t0, className: t1, style, "data-ui": "HStack", display: "inline-flex", alignItems: "center", flexWrap: "wrap", ...rest, children }), $[7] = T0, $[8] = children, $[9] = rest, $[10] = style, $[11] = t0, $[12] = t1, $[13] = t2) : t2 = $[13], t2;
|
|
1132
1302
|
}
|
|
1133
|
-
const HEADING_TAG = ["h1", "h2", "h3", "h4", "h5", "h6"], HEADING_SIZE = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], headingProps = {
|
|
1134
|
-
as: {
|
|
1135
|
-
type: "union",
|
|
1136
|
-
values: HEADING_TAG
|
|
1137
|
-
},
|
|
1138
|
-
size: {
|
|
1139
|
-
type: "union",
|
|
1140
|
-
className: "text-heading",
|
|
1141
|
-
values: HEADING_SIZE
|
|
1142
|
-
},
|
|
1143
|
-
...typographyProps
|
|
1144
|
-
}, headingClassName = suffixClassName("sui-Heading");
|
|
1145
|
-
function Heading(t0) {
|
|
1146
|
-
const $ = c(15);
|
|
1147
|
-
let T0, children, rest, style, t1, t2;
|
|
1148
|
-
if ($[0] !== t0) {
|
|
1149
|
-
t2 = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
|
|
1150
|
-
bb0: {
|
|
1151
|
-
const {
|
|
1152
|
-
size: t32,
|
|
1153
|
-
weight: t4,
|
|
1154
|
-
...props
|
|
1155
|
-
} = t0, size = t32 === void 0 ? 2 : t32, weight = t4 === void 0 ? "bold" : t4, {
|
|
1156
|
-
as,
|
|
1157
|
-
children: t5,
|
|
1158
|
-
className,
|
|
1159
|
-
style: t6,
|
|
1160
|
-
...t7
|
|
1161
|
-
} = getProps({
|
|
1162
|
-
size,
|
|
1163
|
-
weight,
|
|
1164
|
-
...props
|
|
1165
|
-
}, headingProps);
|
|
1166
|
-
children = t5, style = t6, rest = t7;
|
|
1167
|
-
const Component = as || "h2";
|
|
1168
|
-
if (props.truncate && props.trim) {
|
|
1169
|
-
const t8 = clsx(headingClassName, className?.replace("sui-line-clamp", "").replace("sui-text-overflow", "")), t9 = props.truncate === 1 ? "sui-text-overflow" : "sui-line-clamp";
|
|
1170
|
-
let t10;
|
|
1171
|
-
$[7] !== t9 ? (t10 = clsx("sui-overflow-hidden", t9), $[7] = t9, $[8] = t10) : t10 = $[8], t2 = /* @__PURE__ */ jsx(Component, { className: t8, style, "data-ui": "Heading", ...rest, children: /* @__PURE__ */ jsx("span", { className: t10, children }) });
|
|
1172
|
-
break bb0;
|
|
1173
|
-
}
|
|
1174
|
-
T0 = Component, t1 = clsx(headingClassName, props.truncate && "sui-overflow-hidden", className);
|
|
1175
|
-
}
|
|
1176
|
-
$[0] = t0, $[1] = T0, $[2] = children, $[3] = rest, $[4] = style, $[5] = t1, $[6] = t2;
|
|
1177
|
-
} else
|
|
1178
|
-
T0 = $[1], children = $[2], rest = $[3], style = $[4], t1 = $[5], t2 = $[6];
|
|
1179
|
-
if (t2 !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel"))
|
|
1180
|
-
return t2;
|
|
1181
|
-
let t3;
|
|
1182
|
-
return $[9] !== T0 || $[10] !== children || $[11] !== rest || $[12] !== style || $[13] !== t1 ? (t3 = /* @__PURE__ */ jsx(T0, { className: t1, style, "data-ui": "Heading", ...rest, children }), $[9] = T0, $[10] = children, $[11] = rest, $[12] = style, $[13] = t1, $[14] = t3) : t3 = $[14], t3;
|
|
1183
|
-
}
|
|
1184
|
-
const iconButtonProps = {
|
|
1185
|
-
"aria-label": {
|
|
1186
|
-
type: "string"
|
|
1187
|
-
},
|
|
1188
|
-
as: buttonProps.as,
|
|
1189
|
-
icon: {
|
|
1190
|
-
type: "string"
|
|
1191
|
-
}
|
|
1192
|
-
}, iconButtonClassName = suffixClassName("sui-IconButton");
|
|
1193
|
-
function IconButton(props) {
|
|
1194
|
-
const $ = c(16);
|
|
1195
|
-
let IconProp, T0, rest, style, t0, t1;
|
|
1196
|
-
if ($[0] !== props) {
|
|
1197
|
-
const {
|
|
1198
|
-
as,
|
|
1199
|
-
className,
|
|
1200
|
-
style: t22,
|
|
1201
|
-
icon: t32,
|
|
1202
|
-
...t4
|
|
1203
|
-
} = getProps(props, iconButtonProps);
|
|
1204
|
-
style = t22, IconProp = t32, rest = t4;
|
|
1205
|
-
const Component = as || "button";
|
|
1206
|
-
T0 = Button, t0 = Component, t1 = clsx(iconButtonClassName, className), $[0] = props, $[1] = IconProp, $[2] = T0, $[3] = rest, $[4] = style, $[5] = t0, $[6] = t1;
|
|
1207
|
-
} else
|
|
1208
|
-
IconProp = $[1], T0 = $[2], rest = $[3], style = $[4], t0 = $[5], t1 = $[6];
|
|
1209
|
-
let t2;
|
|
1210
|
-
$[7] !== IconProp ? (t2 = /* @__PURE__ */ jsx(Icon, { icon: IconProp, margin: -2, size: 1 }), $[7] = IconProp, $[8] = t2) : t2 = $[8];
|
|
1211
|
-
let t3;
|
|
1212
|
-
return $[9] !== T0 || $[10] !== rest || $[11] !== style || $[12] !== t0 || $[13] !== t1 || $[14] !== t2 ? (t3 = /* @__PURE__ */ jsx(T0, { as: t0, className: t1, style, "data-ui": "IconButton", ...rest, children: t2 }), $[9] = T0, $[10] = rest, $[11] = style, $[12] = t0, $[13] = t1, $[14] = t2, $[15] = t3) : t3 = $[15], t3;
|
|
1213
|
-
}
|
|
1214
1303
|
const indicatorProps = {
|
|
1215
1304
|
as: {
|
|
1216
1305
|
type: "string"
|
|
@@ -1648,95 +1737,6 @@ ListRoot.Item = ListItem;
|
|
|
1648
1737
|
ListRoot.ButtonItem = ListButtonItem;
|
|
1649
1738
|
ListRoot.ItemText = ListItemText;
|
|
1650
1739
|
ListRoot.ItemImage = ListItemImage;
|
|
1651
|
-
const modalProps = {
|
|
1652
|
-
header: {
|
|
1653
|
-
type: "string"
|
|
1654
|
-
},
|
|
1655
|
-
open: {
|
|
1656
|
-
type: "boolean"
|
|
1657
|
-
},
|
|
1658
|
-
size: {
|
|
1659
|
-
type: "union",
|
|
1660
|
-
className: "container",
|
|
1661
|
-
values: CONTAINER_SIZE
|
|
1662
|
-
}
|
|
1663
|
-
}, modalClassName = suffixClassName("sui-Modal"), modalContentClassName = suffixClassName("sui-ModalContent"), modalFooterClassName = suffixClassName("sui-ModalFooter");
|
|
1664
|
-
function ModalRoot(t0) {
|
|
1665
|
-
const $ = c(17), {
|
|
1666
|
-
open: t1,
|
|
1667
|
-
size: t2,
|
|
1668
|
-
...props
|
|
1669
|
-
} = t0, open = t1 === void 0 ? !1 : t1, size = t2 === void 0 ? 0 : t2, {
|
|
1670
|
-
children,
|
|
1671
|
-
className,
|
|
1672
|
-
style,
|
|
1673
|
-
header,
|
|
1674
|
-
onClose,
|
|
1675
|
-
...rest
|
|
1676
|
-
} = getProps({
|
|
1677
|
-
size,
|
|
1678
|
-
...props
|
|
1679
|
-
}, modalProps), modalRef = useRef(null), headerId = useId(), modalClasses = clsx(modalClassName, "sui-inset0 sui-m-auto sui-radius5 sui-shadow3 sui-p4 sui-flex-direction-column sui-gap4 sui-overflow-y-auto");
|
|
1680
|
-
let t3, t4;
|
|
1681
|
-
$[0] !== open ? (t3 = () => {
|
|
1682
|
-
const dialogElement = modalRef.current;
|
|
1683
|
-
if (dialogElement)
|
|
1684
|
-
return open ? dialogElement.open || dialogElement.showModal() : dialogElement.open && dialogElement.close(), () => {
|
|
1685
|
-
dialogElement.close();
|
|
1686
|
-
};
|
|
1687
|
-
}, t4 = [open], $[0] = open, $[1] = t3, $[2] = t4) : (t3 = $[1], t4 = $[2]), useEffect(t3, t4);
|
|
1688
|
-
const t5 = "any", t6 = header ? headerId : void 0, t7 = clsx(modalClasses, className);
|
|
1689
|
-
let t8;
|
|
1690
|
-
$[3] !== header || $[4] !== headerId ? (t8 = header ? /* @__PURE__ */ jsx(Heading, { trim: !0, size: 1, id: headerId, children: header }) : /* @__PURE__ */ jsx("div", {}), $[3] = header, $[4] = headerId, $[5] = t8) : t8 = $[5];
|
|
1691
|
-
let t9;
|
|
1692
|
-
$[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsx(IconButton, { "aria-label": "Close", level: "tertiary", icon: CloseIcon, onClick: () => modalRef.current?.close() }), $[6] = t9) : t9 = $[6];
|
|
1693
|
-
let t10;
|
|
1694
|
-
$[7] !== t8 ? (t10 = /* @__PURE__ */ jsxs(Flex, { flexShrink: 0, justifyContent: "space-between", alignItems: "center", children: [
|
|
1695
|
-
t8,
|
|
1696
|
-
t9
|
|
1697
|
-
] }), $[7] = t8, $[8] = t10) : t10 = $[8];
|
|
1698
|
-
let t11;
|
|
1699
|
-
return $[9] !== children || $[10] !== onClose || $[11] !== rest || $[12] !== style || $[13] !== t10 || $[14] !== t6 || $[15] !== t7 ? (t11 = /* @__PURE__ */ jsxs("dialog", { ...rest, ref: modalRef, closedby: t5, "aria-labelledby": t6, onClose, className: t7, style, "data-ui": "Modal", children: [
|
|
1700
|
-
t10,
|
|
1701
|
-
children
|
|
1702
|
-
] }), $[9] = children, $[10] = onClose, $[11] = rest, $[12] = style, $[13] = t10, $[14] = t6, $[15] = t7, $[16] = t11) : t11 = $[16], t11;
|
|
1703
|
-
}
|
|
1704
|
-
function ModalContent(props) {
|
|
1705
|
-
const $ = c(12);
|
|
1706
|
-
let T0, children, style, t0, t1;
|
|
1707
|
-
if ($[0] !== props) {
|
|
1708
|
-
const {
|
|
1709
|
-
children: t22,
|
|
1710
|
-
className,
|
|
1711
|
-
style: t3,
|
|
1712
|
-
...rest
|
|
1713
|
-
} = getProps(props, {});
|
|
1714
|
-
children = t22, style = t3, T0 = Box, t0 = rest, t1 = clsx(modalContentClassName, className), $[0] = props, $[1] = T0, $[2] = children, $[3] = style, $[4] = t0, $[5] = t1;
|
|
1715
|
-
} else
|
|
1716
|
-
T0 = $[1], children = $[2], style = $[3], t0 = $[4], t1 = $[5];
|
|
1717
|
-
let t2;
|
|
1718
|
-
return $[6] !== T0 || $[7] !== children || $[8] !== style || $[9] !== t0 || $[10] !== t1 ? (t2 = /* @__PURE__ */ jsx(T0, { ...t0, className: t1, style, "data-ui": "ModalContent", flexGrow: 1, overflowY: "auto", children }), $[6] = T0, $[7] = children, $[8] = style, $[9] = t0, $[10] = t1, $[11] = t2) : t2 = $[11], t2;
|
|
1719
|
-
}
|
|
1720
|
-
function ModalFooter(props) {
|
|
1721
|
-
const $ = c(12);
|
|
1722
|
-
let T0, children, style, t0, t1;
|
|
1723
|
-
if ($[0] !== props) {
|
|
1724
|
-
const {
|
|
1725
|
-
children: t22,
|
|
1726
|
-
className,
|
|
1727
|
-
style: t3,
|
|
1728
|
-
...rest
|
|
1729
|
-
} = getProps(props, {});
|
|
1730
|
-
children = t22, style = t3, T0 = Box, t0 = rest, t1 = clsx(modalFooterClassName, className), $[0] = props, $[1] = T0, $[2] = children, $[3] = style, $[4] = t0, $[5] = t1;
|
|
1731
|
-
} else
|
|
1732
|
-
T0 = $[1], children = $[2], style = $[3], t0 = $[4], t1 = $[5];
|
|
1733
|
-
let t2;
|
|
1734
|
-
return $[6] !== T0 || $[7] !== children || $[8] !== style || $[9] !== t0 || $[10] !== t1 ? (t2 = /* @__PURE__ */ jsx(T0, { ...t0, className: t1, style, "data-ui": "ModalFooter", flexShrink: 0, children }), $[6] = T0, $[7] = children, $[8] = style, $[9] = t0, $[10] = t1, $[11] = t2) : t2 = $[11], t2;
|
|
1735
|
-
}
|
|
1736
|
-
ModalRoot.displayName = "Modal";
|
|
1737
|
-
const Modal = ModalRoot;
|
|
1738
|
-
ModalRoot.Content = ModalContent;
|
|
1739
|
-
ModalRoot.Footer = ModalFooter;
|
|
1740
1740
|
function useIsClient() {
|
|
1741
1741
|
return useSyncExternalStore(_temp2, _temp3, _temp4);
|
|
1742
1742
|
}
|
|
@@ -2049,6 +2049,7 @@ export {
|
|
|
2049
2049
|
Checkbox,
|
|
2050
2050
|
Code,
|
|
2051
2051
|
Container,
|
|
2052
|
+
Dialog,
|
|
2052
2053
|
Divider,
|
|
2053
2054
|
Eyebrow,
|
|
2054
2055
|
Flex,
|
|
@@ -2063,7 +2064,6 @@ export {
|
|
|
2063
2064
|
Label,
|
|
2064
2065
|
Link,
|
|
2065
2066
|
List,
|
|
2066
|
-
Modal,
|
|
2067
2067
|
Popover,
|
|
2068
2068
|
PressArea,
|
|
2069
2069
|
Radio,
|