@eightshift/ui-components 3.0.1 → 5.0.0
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/package.json +101 -101
- package/dist/Button-BPLceDeW.js +0 -185
- package/dist/Collection-CZxddMZS.js +0 -2332
- package/dist/Color-MV5kBVXr.js +0 -2452
- package/dist/ColorSwatch-BqQfVu4L.js +0 -64
- package/dist/ComboBox-_RfyhwZw.js +0 -1906
- package/dist/Dialog-8tYeQ9n4.js +0 -2300
- package/dist/FieldError-52GVSGgC.js +0 -42
- package/dist/FocusScope-Cri5BFRz.js +0 -831
- package/dist/Form-Cq3fu75_.js +0 -5
- package/dist/Group-_emcIVxI.js +0 -48
- package/dist/Heading-B2153VXe.js +0 -16
- package/dist/Hidden-rE6uR-lr.js +0 -41
- package/dist/Input-BxpFEIXV.js +0 -133
- package/dist/Label-icmbmNdI.js +0 -17
- package/dist/List-CZMUbkFU.js +0 -593
- package/dist/ListBox-Ca6hiCqz.js +0 -581
- package/dist/NumberFormatter-DA8u1Ot7.js +0 -140
- package/dist/OverlayArrow-CYXQSlEU.js +0 -629
- package/dist/RSPContexts-2lR5GG9p.js +0 -14
- package/dist/Select-aab027f3.esm-PDJCDE95.js +0 -2469
- package/dist/Separator-4IIDRlV_.js +0 -322
- package/dist/Slider-rz2XRMGm.js +0 -853
- package/dist/Text-DVSAPY-K.js +0 -16
- package/dist/VisuallyHidden-f9zX67a_.js +0 -48
- package/dist/_commonjsHelpers-CUmg6egw.js +0 -6
- package/dist/assets/index.css +0 -37
- package/dist/assets/style-admin.css +0 -5255
- package/dist/assets/style-editor.css +0 -5255
- package/dist/assets/style.css +0 -5261
- package/dist/assets/wp-font-enhancements.css +0 -8
- package/dist/assets/wp-ui-enhancements.css +0 -299
- package/dist/components/animated-visibility/animated-visibility.js +0 -105
- package/dist/components/base-control/base-control.js +0 -86
- package/dist/components/breakpoint-preview/breakpoint-preview.js +0 -161
- package/dist/components/button/button.js +0 -387
- package/dist/components/checkbox/checkbox.js +0 -320
- package/dist/components/color-pickers/color-picker.js +0 -272
- package/dist/components/color-pickers/color-swatch.js +0 -58
- package/dist/components/color-pickers/gradient-editor.js +0 -534
- package/dist/components/color-pickers/solid-color-picker.js +0 -1567
- package/dist/components/component-toggle/component-toggle.js +0 -158
- package/dist/components/container-panel/container-panel.js +0 -131
- package/dist/components/draggable/draggable-context.js +0 -5
- package/dist/components/draggable/draggable-handle.js +0 -46
- package/dist/components/draggable/draggable.js +0 -6207
- package/dist/components/draggable-list/draggable-list-context.js +0 -5
- package/dist/components/draggable-list/draggable-list-item.js +0 -77
- package/dist/components/draggable-list/draggable-list.js +0 -151
- package/dist/components/expandable/expandable.js +0 -342
- package/dist/components/index.js +0 -137
- package/dist/components/input-field/input-field.js +0 -231
- package/dist/components/item-collection/item-collection.js +0 -59
- package/dist/components/layout/hstack.js +0 -30
- package/dist/components/layout/vstack.js +0 -30
- package/dist/components/link-input/link-input.js +0 -293
- package/dist/components/matrix-align/matrix-align.js +0 -134
- package/dist/components/menu/menu.js +0 -285
- package/dist/components/modal/modal.js +0 -305
- package/dist/components/notice/notice.js +0 -123
- package/dist/components/number-picker/number-picker.js +0 -292
- package/dist/components/option-select/option-select.js +0 -264
- package/dist/components/options-panel/options-panel.js +0 -158
- package/dist/components/placeholders/file-placeholder.js +0 -42
- package/dist/components/placeholders/image-placeholder.js +0 -88
- package/dist/components/placeholders/media-placeholder.js +0 -63
- package/dist/components/popover/popover.js +0 -207
- package/dist/components/radio/radio.js +0 -579
- package/dist/components/repeater/repeater-context.js +0 -5
- package/dist/components/repeater/repeater-item.js +0 -119
- package/dist/components/repeater/repeater.js +0 -280
- package/dist/components/responsive/mini-responsive.js +0 -498
- package/dist/components/responsive/responsive-legacy.js +0 -343
- package/dist/components/responsive/responsive.js +0 -580
- package/dist/components/responsive-preview/responsive-preview.js +0 -123
- package/dist/components/rich-label/rich-label.js +0 -66
- package/dist/components/select/async-multi-select.js +0 -157
- package/dist/components/select/async-single-select.js +0 -137
- package/dist/components/select/custom-select-default-components.js +0 -38
- package/dist/components/select/multi-select-components.js +0 -8
- package/dist/components/select/multi-select.js +0 -151
- package/dist/components/select/react-select-component-wrappers.js +0 -90
- package/dist/components/select/shared.js +0 -26
- package/dist/components/select/single-select.js +0 -131
- package/dist/components/select/styles.js +0 -49
- package/dist/components/select/v2/async-select.js +0 -297
- package/dist/components/select/v2/shared.js +0 -24
- package/dist/components/select/v2/single-select.js +0 -990
- package/dist/components/slider/column-config-slider.js +0 -210
- package/dist/components/slider/slider.js +0 -343
- package/dist/components/slider/utils.js +0 -84
- package/dist/components/spacer/spacer.js +0 -97
- package/dist/components/tabs/tabs.js +0 -702
- package/dist/components/toggle/switch.js +0 -155
- package/dist/components/toggle/toggle.js +0 -64
- package/dist/components/toggle-button/toggle-button.js +0 -324
- package/dist/components/tooltip/tooltip.js +0 -525
- package/dist/context-D2KUdwNL.js +0 -92
- package/dist/default-i18n-CT_oS1Fy.js +0 -922
- package/dist/filterDOMProps-EDDcM64A.js +0 -28
- package/dist/icons/block-icon.js +0 -42
- package/dist/icons/generic-color-swatch.js +0 -113
- package/dist/icons/icons.js +0 -30371
- package/dist/icons/index.js +0 -11
- package/dist/icons/jsx-svg.js +0 -50
- package/dist/index-641ee5b8.esm-DIuJijyT.js +0 -3137
- package/dist/index-BKGQ6jGS.js +0 -44
- package/dist/index-CFozsmNS.js +0 -28321
- package/dist/index.js +0 -139
- package/dist/lite-DVmmD_-j.js +0 -7
- package/dist/modifiers.esm-BuJQPI1X.js +0 -31
- package/dist/multi-select-components-Sp-JEFEX.js +0 -3744
- package/dist/number-GajL10e1.js +0 -36
- package/dist/react-jsx-parser.min-DZCiis5V.js +0 -11753
- package/dist/react-select-async.esm-Bql4G5iV.js +0 -107
- package/dist/react-select.esm-B_TudhTU.js +0 -15
- package/dist/style-admin.js +0 -1
- package/dist/style-editor.js +0 -1
- package/dist/style.js +0 -1
- package/dist/textSelection-0UUS8Yfg.js +0 -46
- package/dist/useButton-Cg474OYB.js +0 -71
- package/dist/useEvent-B0b-6KBr.js +0 -23
- package/dist/useFocusRing-CV5l3lf6.js +0 -107
- package/dist/useFormReset-C5OggHsw.js +0 -22
- package/dist/useFormValidation-DhDNSjws.js +0 -224
- package/dist/useHover-DwDr6ozG.js +0 -900
- package/dist/useLabel-D7HkNEHT.js +0 -27
- package/dist/useLabels-D8cxd1Z8.js +0 -23
- package/dist/useListState-DVr6aYd_.js +0 -161
- package/dist/useLocalizedStringFormatter-CFP1YZWQ.js +0 -121
- package/dist/useNumberField-TwM0Z9D1.js +0 -1204
- package/dist/useNumberFormatter-321rAb4J.js +0 -13
- package/dist/usePress-Cucx-xSA.js +0 -664
- package/dist/useSingleSelectListState-CMGsRHHh.js +0 -38
- package/dist/useToggle-C0I3vs0g.js +0 -59
- package/dist/useToggleState-CmQX3SoX.js +0 -19
- package/dist/utilities/array-helpers.js +0 -56
- package/dist/utilities/debounce-throttle.js +0 -123
- package/dist/utilities/es-dash.js +0 -376
- package/dist/utilities/index.js +0 -27
- package/dist/utilities/text-helpers.js +0 -136
- package/dist/utils-DkCSC521.js +0 -370
- package/dist/wp/wp-font-enhancements.js +0 -1
- package/dist/wp/wp-ui-enhancements.js +0 -1
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { $ as $72a5793c14baf454$export$8b251419efc915eb, a as $431f98aba6844401$export$1ff3c3f08ae963c0 } from "../../Separator-4IIDRlV_.js";
|
|
3
|
-
import { a as $3674c52c6b3c5bce$export$27d2ad3c5815583e, b as $3674c52c6b3c5bce$export$d9b273488cd8ce6f, c as $3674c52c6b3c5bce$export$2ce376c2cc3355c8, d as $3674c52c6b3c5bce$export$4b1545b4f2016d26, e as $3674c52c6b3c5bce$export$ecabc99eeffab7ca } from "../../Dialog-8tYeQ9n4.js";
|
|
4
|
-
import { icons } from "../../icons/icons.js";
|
|
5
|
-
import { Button } from "../button/button.js";
|
|
6
|
-
import { Popover } from "../popover/popover.js";
|
|
7
|
-
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
8
|
-
import { cloneElement } from "react";
|
|
9
|
-
import { _ as __ } from "../../default-i18n-CT_oS1Fy.js";
|
|
10
|
-
/**
|
|
11
|
-
* A simple menu component.
|
|
12
|
-
*
|
|
13
|
-
* @component
|
|
14
|
-
* @param {Object} props - Component props.
|
|
15
|
-
* @param {string} [props.triggerLabel] - The label of the trigger button.
|
|
16
|
-
* @param {JSX.Element} [props.triggerIcon] - The icon of the trigger button.
|
|
17
|
-
* @param {Object} [props.triggerProps] - Props to pass to the trigger button.
|
|
18
|
-
* @param {string} [props.tooltip] - Tooltip text to display on the trigger button.
|
|
19
|
-
* @param {boolean} [props.keepOpen=false] - If `true`, the menu will not close when an item is selected.
|
|
20
|
-
* @param {boolean} [props.openOnLongPress=false] - If `true`, the menu will open on long press instead of click. If enabled, a regular `onPress` event can also be passed to the trigger button to enable dual behavior.
|
|
21
|
-
* @param {Object} [props.popoverProps] - Props to pass to the popover.
|
|
22
|
-
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
23
|
-
*
|
|
24
|
-
* @returns {JSX.Element} The Menu component.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* <Menu>
|
|
28
|
-
* <MenuSection label='Section 1'>
|
|
29
|
-
* <MenuItem>Item 1</MenuItem>
|
|
30
|
-
* <MenuItem>Item 2</MenuItem>
|
|
31
|
-
* </MenuSection>
|
|
32
|
-
* <MenuSection label='Section 2'>
|
|
33
|
-
* <MenuItem>Item 3</MenuItem>
|
|
34
|
-
* <MenuItem>Item 4</MenuItem>
|
|
35
|
-
* </MenuSection>
|
|
36
|
-
* </Menu>
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* <Menu>
|
|
40
|
-
* <MenuItem>Item 1</MenuItem>
|
|
41
|
-
* <MenuItem>Item 2</MenuItem>
|
|
42
|
-
* <MenuSeparator />
|
|
43
|
-
* <MenuItem>Item 3</MenuItem>
|
|
44
|
-
* <MenuItem>Item 4</MenuItem>
|
|
45
|
-
* </Menu>
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* <Menu>
|
|
49
|
-
* <MenuItem>Item 1</MenuItem>
|
|
50
|
-
* <MenuItem>Item 2</MenuItem>
|
|
51
|
-
* <SubMenuItem
|
|
52
|
-
* trigger={<MenuItem>Submenu</MenuItem>}
|
|
53
|
-
* >
|
|
54
|
-
* <MenuItem>Subitem 1</MenuItem>
|
|
55
|
-
* <MenuItem>Subitem 2</MenuItem>
|
|
56
|
-
* </SubMenuItem>
|
|
57
|
-
* </Menu>
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* @preserve
|
|
61
|
-
*/
|
|
62
|
-
const Menu = (props) => {
|
|
63
|
-
var _a;
|
|
64
|
-
const {
|
|
65
|
-
children,
|
|
66
|
-
triggerLabel,
|
|
67
|
-
triggerIcon = !triggerLabel && icons.hamburgerMenu,
|
|
68
|
-
triggerProps,
|
|
69
|
-
popoverProps,
|
|
70
|
-
tooltip,
|
|
71
|
-
keepOpen = false,
|
|
72
|
-
"aria-label": ariaLabel = triggerLabel ?? __("Menu", "eightshift-ui-components"),
|
|
73
|
-
openOnLongPress = false,
|
|
74
|
-
hidden
|
|
75
|
-
} = props;
|
|
76
|
-
if (hidden) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
let additionalProps = {};
|
|
80
|
-
if (keepOpen) {
|
|
81
|
-
additionalProps = {
|
|
82
|
-
...additionalProps,
|
|
83
|
-
selectionMode: "multiple",
|
|
84
|
-
selectedKeys: [],
|
|
85
|
-
onSelectionChange: () => {
|
|
86
|
-
},
|
|
87
|
-
items: []
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
if (openOnLongPress) {
|
|
91
|
-
additionalProps.trigger = "longPress";
|
|
92
|
-
}
|
|
93
|
-
const hasSubmenuItems = Array.isArray(children) ? children.some((child) => {
|
|
94
|
-
var _a2;
|
|
95
|
-
return ((_a2 = child == null ? void 0 : child.type) == null ? void 0 : _a2.displayName) === "SubMenuItem";
|
|
96
|
-
}) : ((_a = children == null ? void 0 : children.type) == null ? void 0 : _a.displayName) === "SubMenuItem";
|
|
97
|
-
return /* @__PURE__ */ jsxs(
|
|
98
|
-
$3674c52c6b3c5bce$export$27d2ad3c5815583e,
|
|
99
|
-
{
|
|
100
|
-
...props,
|
|
101
|
-
...additionalProps,
|
|
102
|
-
children: [
|
|
103
|
-
/* @__PURE__ */ jsx(
|
|
104
|
-
Button,
|
|
105
|
-
{
|
|
106
|
-
icon: triggerIcon,
|
|
107
|
-
tooltip,
|
|
108
|
-
...triggerProps,
|
|
109
|
-
children: triggerLabel
|
|
110
|
-
}
|
|
111
|
-
),
|
|
112
|
-
/* @__PURE__ */ jsx(
|
|
113
|
-
Popover,
|
|
114
|
-
{
|
|
115
|
-
className: "es:p-0! es:any-focus:outline-hidden",
|
|
116
|
-
"aria-label": ariaLabel,
|
|
117
|
-
wrapperClassName: clsx(!hasSubmenuItems && "es:overflow-y-auto"),
|
|
118
|
-
...popoverProps,
|
|
119
|
-
children: /* @__PURE__ */ jsx(
|
|
120
|
-
$3674c52c6b3c5bce$export$d9b273488cd8ce6f,
|
|
121
|
-
{
|
|
122
|
-
className: "es:outline-hidden",
|
|
123
|
-
...props,
|
|
124
|
-
...additionalProps,
|
|
125
|
-
children
|
|
126
|
-
}
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
)
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
);
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* A wrapper for `MenuItem` components that visually groups them and ensures proper keyboard navigation.
|
|
136
|
-
*
|
|
137
|
-
* **Important**: <MenuSection> cannot be mixed with other <MenuItem> in the top-level of the same menu.
|
|
138
|
-
*
|
|
139
|
-
* @component
|
|
140
|
-
* @param {Object} props - Component props.
|
|
141
|
-
* @param {string} [props.label] - The label of the section.
|
|
142
|
-
*
|
|
143
|
-
* @returns {JSX.Element} The MenuSection component.
|
|
144
|
-
*
|
|
145
|
-
* @see {@link Menu} for usage example.
|
|
146
|
-
*
|
|
147
|
-
* @preserve
|
|
148
|
-
*/
|
|
149
|
-
const MenuSection = (props) => {
|
|
150
|
-
const { children, label } = props;
|
|
151
|
-
return /* @__PURE__ */ jsxs(
|
|
152
|
-
$3674c52c6b3c5bce$export$4b1545b4f2016d26,
|
|
153
|
-
{
|
|
154
|
-
className: clsx(
|
|
155
|
-
"es:space-y-1 es:border-b es:border-b-secondary-200 es:last:border-b-0",
|
|
156
|
-
label && "es:pt-2 es:first:pt-1.5 es:last:pb-0",
|
|
157
|
-
!label && "es:has-[>_:only-child]:pb-0"
|
|
158
|
-
),
|
|
159
|
-
children: [
|
|
160
|
-
label && /* @__PURE__ */ jsx($72a5793c14baf454$export$8b251419efc915eb, { className: "es:ml-1.5 es:text-xs es:font-medium es:text-secondary-400", children: label }),
|
|
161
|
-
children
|
|
162
|
-
]
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
};
|
|
166
|
-
/**
|
|
167
|
-
* A menu separator.
|
|
168
|
-
*
|
|
169
|
-
* @returns {JSX.Element} The MenuSeparator component.
|
|
170
|
-
*
|
|
171
|
-
* @see {@link Menu} for usage example.
|
|
172
|
-
*
|
|
173
|
-
* @preserve
|
|
174
|
-
*/
|
|
175
|
-
const MenuSeparator = () => {
|
|
176
|
-
return /* @__PURE__ */ jsx($431f98aba6844401$export$1ff3c3f08ae963c0, { className: "es:mb-1 es:border-b es:border-secondary-200/50" });
|
|
177
|
-
};
|
|
178
|
-
/**
|
|
179
|
-
* A menu item.
|
|
180
|
-
*
|
|
181
|
-
* @component
|
|
182
|
-
* @param {Object} props - Component props.
|
|
183
|
-
* @param {JSX.Element} [props.icon] - The icon of the item.
|
|
184
|
-
* @param {string} [props.shortcut] - A slot for text like the keyboard shortcut, displayed on the right side of the item.
|
|
185
|
-
* @param {boolean} [props.checked] - If `true`, the item is marked as checked. This is visually represented by a checkmark icon.
|
|
186
|
-
* @param {boolean} [props.selected] - If `true`, the item is marked as selected. This is visually represented by a circle.
|
|
187
|
-
* @param {boolean} [props.disabled] - If `true`, the item will be disabled.
|
|
188
|
-
* @param {JSX.Element} [props.endIcon] - The icon at the right side of the item.
|
|
189
|
-
* @param {Function} [props.onClick] - Function to run when the item is clicked.
|
|
190
|
-
* @param {string} [props.className] - Classes to pass to the menu item.
|
|
191
|
-
*
|
|
192
|
-
* @returns {JSX.Element} The MenuItem component.
|
|
193
|
-
*
|
|
194
|
-
* @see {@link Menu} for usage example.
|
|
195
|
-
*
|
|
196
|
-
* @preserve
|
|
197
|
-
*/
|
|
198
|
-
const MenuItem = (props) => {
|
|
199
|
-
const {
|
|
200
|
-
icon,
|
|
201
|
-
children,
|
|
202
|
-
checked,
|
|
203
|
-
selected,
|
|
204
|
-
disabled,
|
|
205
|
-
endIcon,
|
|
206
|
-
onClick,
|
|
207
|
-
shortcut,
|
|
208
|
-
className,
|
|
209
|
-
"aria-label": ariaLabel = typeof children === "string" ? children : __("Menu item", "eightshift-ui-components")
|
|
210
|
-
} = props;
|
|
211
|
-
return /* @__PURE__ */ jsxs(
|
|
212
|
-
$3674c52c6b3c5bce$export$2ce376c2cc3355c8,
|
|
213
|
-
{
|
|
214
|
-
...props,
|
|
215
|
-
"aria-label": ariaLabel,
|
|
216
|
-
isDisabled: disabled,
|
|
217
|
-
className: clsx(
|
|
218
|
-
"es:mx-1 es:mb-1 es:flex es:min-w-44 es:min-h-8 es:items-center es:gap-1.5",
|
|
219
|
-
"es:first:mt-1 es:icon:size-5 es:icon:text-secondary-500",
|
|
220
|
-
"es:select-none es:rounded-md es:p-1.5 es:text-sm es:transition",
|
|
221
|
-
"es:any-focus:outline-hidden",
|
|
222
|
-
!disabled && "es:hover:bg-secondary-100 es:focus-visible:inset-ring es:focus-visible:inset-ring-secondary-100/30 es:focus-visible:bg-secondary-100 es:contrast-more:focus-visible:bg-accent-500/15",
|
|
223
|
-
disabled ? "es:text-secondary-400" : "es:text-secondary-800",
|
|
224
|
-
className
|
|
225
|
-
),
|
|
226
|
-
onAction: onClick,
|
|
227
|
-
children: [
|
|
228
|
-
checked === true && icons.menuItemCheck,
|
|
229
|
-
selected === true && icons.menuItemCircle,
|
|
230
|
-
(selected === false || checked === false) && icons.dummySpacer,
|
|
231
|
-
icon,
|
|
232
|
-
children,
|
|
233
|
-
shortcut && /* @__PURE__ */ jsx("div", { className: "es:ml-auto es:pl-2 es:text-[0.6875rem] es:tracking-tight es:text-secondary-400", children: shortcut }),
|
|
234
|
-
endIcon && /* @__PURE__ */ jsx("div", { className: clsx(!shortcut && "es:ml-auto es:pl-2"), children: endIcon })
|
|
235
|
-
]
|
|
236
|
-
}
|
|
237
|
-
);
|
|
238
|
-
};
|
|
239
|
-
/**
|
|
240
|
-
* A supplementary menu item that triggers a submenu.
|
|
241
|
-
*
|
|
242
|
-
* @component
|
|
243
|
-
* @param {Object} props - Component props.
|
|
244
|
-
* @param {JSX.Element} props.trigger - The trigger button for the submenu. **This should be a `MenuItem`.**
|
|
245
|
-
* @param {Object} [props.popoverProps] - Props to pass to the popover.
|
|
246
|
-
*
|
|
247
|
-
* @returns {JSX.Element} The SubMenuItem component.
|
|
248
|
-
*
|
|
249
|
-
* @see {@link Menu} for usage example.
|
|
250
|
-
*
|
|
251
|
-
* @preserve
|
|
252
|
-
*/
|
|
253
|
-
const SubMenuItem = (props) => {
|
|
254
|
-
const { children, trigger, popoverProps } = props;
|
|
255
|
-
return /* @__PURE__ */ jsxs($3674c52c6b3c5bce$export$ecabc99eeffab7ca, { children: [
|
|
256
|
-
cloneElement(trigger, {
|
|
257
|
-
endIcon: /* @__PURE__ */ jsx("span", { className: "es:text-secondary-400", children: icons.caretRightFill })
|
|
258
|
-
}),
|
|
259
|
-
/* @__PURE__ */ jsx(
|
|
260
|
-
Popover,
|
|
261
|
-
{
|
|
262
|
-
"aria-label": props["aria-label"] ?? __("Submenu", "eightshift-ui-components"),
|
|
263
|
-
className: "es:p-0! es:any-focus:outline-hidden",
|
|
264
|
-
offset: -1,
|
|
265
|
-
...popoverProps,
|
|
266
|
-
children: /* @__PURE__ */ jsx(
|
|
267
|
-
$3674c52c6b3c5bce$export$d9b273488cd8ce6f,
|
|
268
|
-
{
|
|
269
|
-
"aria-label": props["aria-label"] ?? __("Submenu", "eightshift-ui-components"),
|
|
270
|
-
className: "es:any-focus:outline-hidden",
|
|
271
|
-
children
|
|
272
|
-
}
|
|
273
|
-
)
|
|
274
|
-
}
|
|
275
|
-
)
|
|
276
|
-
] });
|
|
277
|
-
};
|
|
278
|
-
SubMenuItem.displayName = "SubMenuItem";
|
|
279
|
-
export {
|
|
280
|
-
Menu,
|
|
281
|
-
MenuItem,
|
|
282
|
-
MenuSection,
|
|
283
|
-
MenuSeparator,
|
|
284
|
-
SubMenuItem
|
|
285
|
-
};
|
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { h as $a11501f3d1d39e6c$export$ea8f71083e90600f, i as $49c51c25361d4cd2$export$ee0f7cc6afcd1c18, j as $337b884510726a0d$export$14c98a7594375490, k as $5e3802645cc19319$export$1c3ebcada18427bf, l as $de32f1b87079253c$export$d2f961adcb0afbe, m as $86ea4cb521eb2e37$export$2317d149ed6f78c4, n as $337b884510726a0d$export$c6fdb837b070b4ff, g as $de32f1b87079253c$export$2e1e1122cf0cba88, f as $de32f1b87079253c$export$3ddf2d174ce01153 } from "../../Dialog-8tYeQ9n4.js";
|
|
3
|
-
import { $ as $5cb03073d3f54797$export$a8a3e93435678ff9 } from "../../Heading-B2153VXe.js";
|
|
4
|
-
import { n as $b5e257d569688ac6$export$535bd6ca7f90a273, d as $3ef42575df84b30b$export$9d1611c77c2fe928, a as $64fa3d84918910a7$export$29f1550f4b0d4415, l as $df56164dff5785e2$export$4338b53315abf666, m as $5dc95899b306f630$export$c9058316764c140e, b as $64fa3d84918910a7$export$4d86445c2cf5e3, i as $64fa3d84918910a7$export$2881499e37b75b9a } from "../../utils-DkCSC521.js";
|
|
5
|
-
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-EDDcM64A.js";
|
|
6
|
-
import React__default, { useState, useEffect, forwardRef, useContext, createContext, useRef, useMemo } from "react";
|
|
7
|
-
import { $ as $fc909762b330b746$export$61c6a8c84e605fb6, a as $d3f049242431219c$export$45fda7c47f93fd48, b as $d3f049242431219c$export$6d3443f2c48bfc20 } from "../../OverlayArrow-CYXQSlEU.js";
|
|
8
|
-
import { Button } from "../button/button.js";
|
|
9
|
-
import { _ as __ } from "../../default-i18n-CT_oS1Fy.js";
|
|
10
|
-
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
11
|
-
import { icons } from "../../icons/icons.js";
|
|
12
|
-
import "../../react-jsx-parser.min-DZCiis5V.js";
|
|
13
|
-
import { HStack } from "../layout/hstack.js";
|
|
14
|
-
let $5df64b3807dc15ee$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
15
|
-
function $5df64b3807dc15ee$export$d699905dd57c73ca() {
|
|
16
|
-
let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273();
|
|
17
|
-
let [size, setSize] = useState(() => isSSR ? {
|
|
18
|
-
width: 0,
|
|
19
|
-
height: 0
|
|
20
|
-
} : $5df64b3807dc15ee$var$getViewportSize());
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
let onResize = () => {
|
|
23
|
-
setSize((size2) => {
|
|
24
|
-
let newSize = $5df64b3807dc15ee$var$getViewportSize();
|
|
25
|
-
if (newSize.width === size2.width && newSize.height === size2.height) return size2;
|
|
26
|
-
return newSize;
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
if (!$5df64b3807dc15ee$var$visualViewport) window.addEventListener("resize", onResize);
|
|
30
|
-
else $5df64b3807dc15ee$var$visualViewport.addEventListener("resize", onResize);
|
|
31
|
-
return () => {
|
|
32
|
-
if (!$5df64b3807dc15ee$var$visualViewport) window.removeEventListener("resize", onResize);
|
|
33
|
-
else $5df64b3807dc15ee$var$visualViewport.removeEventListener("resize", onResize);
|
|
34
|
-
};
|
|
35
|
-
}, []);
|
|
36
|
-
return size;
|
|
37
|
-
}
|
|
38
|
-
function $5df64b3807dc15ee$var$getViewportSize() {
|
|
39
|
-
return {
|
|
40
|
-
width: $5df64b3807dc15ee$var$visualViewport && ($5df64b3807dc15ee$var$visualViewport === null || $5df64b3807dc15ee$var$visualViewport === void 0 ? void 0 : $5df64b3807dc15ee$var$visualViewport.width) || window.innerWidth,
|
|
41
|
-
height: $5df64b3807dc15ee$var$visualViewport && ($5df64b3807dc15ee$var$visualViewport === null || $5df64b3807dc15ee$var$visualViewport === void 0 ? void 0 : $5df64b3807dc15ee$var$visualViewport.height) || window.innerHeight
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function $8ac8429251c45e4b$export$dbc0f175b25fb0fb(props, state, ref) {
|
|
45
|
-
let { overlayProps, underlayProps } = $a11501f3d1d39e6c$export$ea8f71083e90600f({
|
|
46
|
-
...props,
|
|
47
|
-
isOpen: state.isOpen,
|
|
48
|
-
onClose: state.close
|
|
49
|
-
}, ref);
|
|
50
|
-
$49c51c25361d4cd2$export$ee0f7cc6afcd1c18({
|
|
51
|
-
isDisabled: !state.isOpen
|
|
52
|
-
});
|
|
53
|
-
$337b884510726a0d$export$14c98a7594375490();
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
if (state.isOpen && ref.current) return $5e3802645cc19319$export$1c3ebcada18427bf([
|
|
56
|
-
ref.current
|
|
57
|
-
]);
|
|
58
|
-
}, [
|
|
59
|
-
state.isOpen,
|
|
60
|
-
ref
|
|
61
|
-
]);
|
|
62
|
-
return {
|
|
63
|
-
modalProps: $3ef42575df84b30b$export$9d1611c77c2fe928(overlayProps),
|
|
64
|
-
underlayProps
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
const $f3f84453ead64de5$export$ab57792b9b6974a6 = /* @__PURE__ */ createContext(null);
|
|
68
|
-
const $f3f84453ead64de5$var$InternalModalContext = /* @__PURE__ */ createContext(null);
|
|
69
|
-
const $f3f84453ead64de5$export$2b77a92f1a5ad772 = /* @__PURE__ */ forwardRef(function Modal(props, ref) {
|
|
70
|
-
let ctx = useContext($f3f84453ead64de5$var$InternalModalContext);
|
|
71
|
-
if (ctx) return /* @__PURE__ */ React__default.createElement($f3f84453ead64de5$var$ModalContent, {
|
|
72
|
-
...props,
|
|
73
|
-
modalRef: ref
|
|
74
|
-
}, props.children);
|
|
75
|
-
let { isDismissable, isKeyboardDismissDisabled, isOpen, defaultOpen, onOpenChange, children, isEntering, isExiting, UNSTABLE_portalContainer, shouldCloseOnInteractOutside, ...otherProps } = props;
|
|
76
|
-
return /* @__PURE__ */ React__default.createElement($f3f84453ead64de5$export$8948f78d83984c69, {
|
|
77
|
-
isDismissable,
|
|
78
|
-
isKeyboardDismissDisabled,
|
|
79
|
-
isOpen,
|
|
80
|
-
defaultOpen,
|
|
81
|
-
onOpenChange,
|
|
82
|
-
isEntering,
|
|
83
|
-
isExiting,
|
|
84
|
-
UNSTABLE_portalContainer,
|
|
85
|
-
shouldCloseOnInteractOutside
|
|
86
|
-
}, /* @__PURE__ */ React__default.createElement($f3f84453ead64de5$var$ModalContent, {
|
|
87
|
-
...otherProps,
|
|
88
|
-
modalRef: ref
|
|
89
|
-
}, children));
|
|
90
|
-
});
|
|
91
|
-
function $f3f84453ead64de5$var$ModalOverlayWithForwardRef(props, ref) {
|
|
92
|
-
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $f3f84453ead64de5$export$ab57792b9b6974a6);
|
|
93
|
-
let contextState = useContext($de32f1b87079253c$export$d2f961adcb0afbe);
|
|
94
|
-
let localState = $fc909762b330b746$export$61c6a8c84e605fb6(props);
|
|
95
|
-
let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;
|
|
96
|
-
let objectRef = $df56164dff5785e2$export$4338b53315abf666(ref);
|
|
97
|
-
let modalRef = useRef(null);
|
|
98
|
-
let isOverlayExiting = $d3f049242431219c$export$45fda7c47f93fd48(objectRef, state.isOpen);
|
|
99
|
-
let isModalExiting = $d3f049242431219c$export$45fda7c47f93fd48(modalRef, state.isOpen);
|
|
100
|
-
let isExiting = isOverlayExiting || isModalExiting || props.isExiting || false;
|
|
101
|
-
let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273();
|
|
102
|
-
if (!state.isOpen && !isExiting || isSSR) return null;
|
|
103
|
-
return /* @__PURE__ */ React__default.createElement($f3f84453ead64de5$var$ModalOverlayInner, {
|
|
104
|
-
...props,
|
|
105
|
-
state,
|
|
106
|
-
isExiting,
|
|
107
|
-
overlayRef: objectRef,
|
|
108
|
-
modalRef
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
const $f3f84453ead64de5$export$8948f78d83984c69 = /* @__PURE__ */ forwardRef($f3f84453ead64de5$var$ModalOverlayWithForwardRef);
|
|
112
|
-
function $f3f84453ead64de5$var$ModalOverlayInner({ UNSTABLE_portalContainer, ...props }) {
|
|
113
|
-
let modalRef = props.modalRef;
|
|
114
|
-
let { state } = props;
|
|
115
|
-
let { modalProps, underlayProps } = $8ac8429251c45e4b$export$dbc0f175b25fb0fb(props, state, modalRef);
|
|
116
|
-
let entering = $d3f049242431219c$export$6d3443f2c48bfc20(props.overlayRef) || props.isEntering || false;
|
|
117
|
-
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
118
|
-
...props,
|
|
119
|
-
defaultClassName: "react-aria-ModalOverlay",
|
|
120
|
-
values: {
|
|
121
|
-
isEntering: entering,
|
|
122
|
-
isExiting: props.isExiting,
|
|
123
|
-
state
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
let viewport = $5df64b3807dc15ee$export$d699905dd57c73ca();
|
|
127
|
-
let style = {
|
|
128
|
-
...renderProps.style,
|
|
129
|
-
"--visual-viewport-height": viewport.height + "px"
|
|
130
|
-
};
|
|
131
|
-
return /* @__PURE__ */ React__default.createElement($337b884510726a0d$export$c6fdb837b070b4ff, {
|
|
132
|
-
isExiting: props.isExiting,
|
|
133
|
-
portalContainer: UNSTABLE_portalContainer
|
|
134
|
-
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
135
|
-
...$3ef42575df84b30b$export$9d1611c77c2fe928($65484d02dcb7eb3e$export$457c3d6518dd4c6f(props), underlayProps),
|
|
136
|
-
...renderProps,
|
|
137
|
-
style,
|
|
138
|
-
ref: props.overlayRef,
|
|
139
|
-
"data-entering": entering || void 0,
|
|
140
|
-
"data-exiting": props.isExiting || void 0
|
|
141
|
-
}, /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
|
|
142
|
-
values: [
|
|
143
|
-
[
|
|
144
|
-
$f3f84453ead64de5$var$InternalModalContext,
|
|
145
|
-
{
|
|
146
|
-
modalProps,
|
|
147
|
-
modalRef,
|
|
148
|
-
isExiting: props.isExiting,
|
|
149
|
-
isDismissable: props.isDismissable
|
|
150
|
-
}
|
|
151
|
-
],
|
|
152
|
-
[
|
|
153
|
-
$de32f1b87079253c$export$d2f961adcb0afbe,
|
|
154
|
-
state
|
|
155
|
-
]
|
|
156
|
-
]
|
|
157
|
-
}, renderProps.children)));
|
|
158
|
-
}
|
|
159
|
-
function $f3f84453ead64de5$var$ModalContent(props) {
|
|
160
|
-
let { modalProps, modalRef, isExiting, isDismissable } = useContext($f3f84453ead64de5$var$InternalModalContext);
|
|
161
|
-
let state = useContext($de32f1b87079253c$export$d2f961adcb0afbe);
|
|
162
|
-
let mergedRefs = useMemo(() => $5dc95899b306f630$export$c9058316764c140e(props.modalRef, modalRef), [
|
|
163
|
-
props.modalRef,
|
|
164
|
-
modalRef
|
|
165
|
-
]);
|
|
166
|
-
let ref = $df56164dff5785e2$export$4338b53315abf666(mergedRefs);
|
|
167
|
-
let entering = $d3f049242431219c$export$6d3443f2c48bfc20(ref);
|
|
168
|
-
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
169
|
-
...props,
|
|
170
|
-
defaultClassName: "react-aria-Modal",
|
|
171
|
-
values: {
|
|
172
|
-
isEntering: entering,
|
|
173
|
-
isExiting,
|
|
174
|
-
state
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
|
178
|
-
...$3ef42575df84b30b$export$9d1611c77c2fe928($65484d02dcb7eb3e$export$457c3d6518dd4c6f(props), modalProps),
|
|
179
|
-
...renderProps,
|
|
180
|
-
ref,
|
|
181
|
-
"data-entering": entering || void 0,
|
|
182
|
-
"data-exiting": isExiting || void 0
|
|
183
|
-
}, isDismissable && /* @__PURE__ */ React__default.createElement($86ea4cb521eb2e37$export$2317d149ed6f78c4, {
|
|
184
|
-
onDismiss: state.close
|
|
185
|
-
}), renderProps.children);
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Modal dialog.
|
|
189
|
-
*
|
|
190
|
-
* @component
|
|
191
|
-
* @param {Object} props - Component props.
|
|
192
|
-
* @param {boolean} [props.open] - **Controlled mode ** - whether the modal is open.
|
|
193
|
-
* @param {boolean} [props.defaultOpen] - **Uncontrolled mode ** - whether the modal is initially open.
|
|
194
|
-
* @param {string|JSX.Element} [props.triggerLabel] - Label for the trigger button.
|
|
195
|
-
* @param {JSX.Element} [props.triggerIcon] - Trigger button icon.
|
|
196
|
-
* @param {Object} [props.triggerProps] - Props to pass to the trigger button.
|
|
197
|
-
* @param {ReactNode} [props.customTrigger] - If provided, replaces the default trigger button. The passed component should be something button-related that can open the modal.
|
|
198
|
-
* @param {string|JSX.Element} [props.title] - Title of the modal.
|
|
199
|
-
* @param {boolean} [props.noCloseButton] - If `true`, the close button will not be displayed.
|
|
200
|
-
* @param {boolean} [props.noClickToDismiss] - If `true`, the modal will not close when clicking outside of it.
|
|
201
|
-
* @param {boolean} [props.noKeyboardDismiss] - If `true`, the modal will not close when pressing the `Esc` key.
|
|
202
|
-
* @param {string} [props.className] - Classes to pass to the modal container.
|
|
203
|
-
* @param {string} [props.overlayClassName] - Classes to pass to the modal backdrop.
|
|
204
|
-
* @param {Function} [props.shouldCloseOnInteractOutside=() => true] - Allows ignoring close events for certain elements. `(element: HTMLElement) => boolean`.
|
|
205
|
-
*
|
|
206
|
-
* @returns {JSX.Element} The Modal component.
|
|
207
|
-
*
|
|
208
|
-
* @example
|
|
209
|
-
* <Modal>
|
|
210
|
-
* <p>Modal content</p>
|
|
211
|
-
* </Modal>
|
|
212
|
-
*
|
|
213
|
-
* @preserve
|
|
214
|
-
*/
|
|
215
|
-
const Modal2 = (props) => {
|
|
216
|
-
const {
|
|
217
|
-
children,
|
|
218
|
-
shouldCloseOnInteractOutside,
|
|
219
|
-
open,
|
|
220
|
-
defaultOpen,
|
|
221
|
-
triggerLabel,
|
|
222
|
-
triggerIcon,
|
|
223
|
-
triggerProps,
|
|
224
|
-
customTrigger,
|
|
225
|
-
title,
|
|
226
|
-
noCloseButton,
|
|
227
|
-
noClickToDismiss,
|
|
228
|
-
noKeyboardDismiss,
|
|
229
|
-
"aria-label": ariaLabel,
|
|
230
|
-
className,
|
|
231
|
-
overlayClassName
|
|
232
|
-
} = props;
|
|
233
|
-
return /* @__PURE__ */ jsxs($de32f1b87079253c$export$2e1e1122cf0cba88, { children: [
|
|
234
|
-
!customTrigger && /* @__PURE__ */ jsx(
|
|
235
|
-
Button,
|
|
236
|
-
{
|
|
237
|
-
icon: triggerIcon,
|
|
238
|
-
...triggerProps,
|
|
239
|
-
children: triggerLabel ?? (!triggerIcon && __("Open", "eightshift-frontend-libs"))
|
|
240
|
-
}
|
|
241
|
-
),
|
|
242
|
-
customTrigger,
|
|
243
|
-
/* @__PURE__ */ jsx(
|
|
244
|
-
$f3f84453ead64de5$export$8948f78d83984c69,
|
|
245
|
-
{
|
|
246
|
-
isDismissable: !noClickToDismiss,
|
|
247
|
-
defaultOpen,
|
|
248
|
-
isOpen: open,
|
|
249
|
-
shouldCloseOnInteractOutside,
|
|
250
|
-
isKeyboardDismissDisabled: noKeyboardDismiss,
|
|
251
|
-
className: ({ isEntering, isExiting }) => clsx(
|
|
252
|
-
"es:fixed es:inset-0 es:z-9999 es:flex es:min-h-full es:items-center es:justify-center es:overflow-y-auto es:bg-black/25 es:p-4 es:text-center es:backdrop-blur",
|
|
253
|
-
isEntering && "es:motion-opacity-in es:motion-duration-150",
|
|
254
|
-
isExiting && "es:motion-opacity-out es:motion-duration-150",
|
|
255
|
-
overlayClassName
|
|
256
|
-
),
|
|
257
|
-
children: /* @__PURE__ */ jsx(
|
|
258
|
-
$f3f84453ead64de5$export$2b77a92f1a5ad772,
|
|
259
|
-
{
|
|
260
|
-
className: ({ isEntering, isExiting }) => clsx(
|
|
261
|
-
"es:w-full es:max-w-lg es:overflow-hidden es:rounded-xl es:border es:border-secondary-100 es:bg-white es:p-5 es:text-left es:align-middle es:shadow-xl es:inset-ring es:inset-ring-secondary-100",
|
|
262
|
-
isEntering && "es:motion-safe:motion-scale-in-95 es:motion-fade-in es:motion-duration-300 es:motion-ease-spring-smooth/scale",
|
|
263
|
-
isExiting && "es:motion-safe:motion-scale-out-95 es:motion-fade-out es:motion-duration-250 es:motion-ease-spring-smooth/scale",
|
|
264
|
-
className
|
|
265
|
-
),
|
|
266
|
-
children: /* @__PURE__ */ jsx(
|
|
267
|
-
$de32f1b87079253c$export$3ddf2d174ce01153,
|
|
268
|
-
{
|
|
269
|
-
className: "es:relative es:text-sm es:outline-hidden",
|
|
270
|
-
"aria-label": ariaLabel,
|
|
271
|
-
children: ({ close }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
272
|
-
/* @__PURE__ */ jsxs(HStack, { children: [
|
|
273
|
-
title && /* @__PURE__ */ jsx(
|
|
274
|
-
$5cb03073d3f54797$export$a8a3e93435678ff9,
|
|
275
|
-
{
|
|
276
|
-
className: "es:text-balance es:text-base",
|
|
277
|
-
slot: "title",
|
|
278
|
-
children: title
|
|
279
|
-
}
|
|
280
|
-
),
|
|
281
|
-
!noCloseButton && /* @__PURE__ */ jsx(
|
|
282
|
-
Button,
|
|
283
|
-
{
|
|
284
|
-
className: "es:ml-auto",
|
|
285
|
-
onPress: close,
|
|
286
|
-
type: "ghost",
|
|
287
|
-
size: "small",
|
|
288
|
-
icon: icons.clear,
|
|
289
|
-
"aria-label": __("Close modal", "eightshift-frontend-libs")
|
|
290
|
-
}
|
|
291
|
-
)
|
|
292
|
-
] }),
|
|
293
|
-
children
|
|
294
|
-
] })
|
|
295
|
-
}
|
|
296
|
-
)
|
|
297
|
-
}
|
|
298
|
-
)
|
|
299
|
-
}
|
|
300
|
-
)
|
|
301
|
-
] });
|
|
302
|
-
};
|
|
303
|
-
export {
|
|
304
|
-
Modal2 as Modal
|
|
305
|
-
};
|