@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,77 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
3
|
-
import "../../default-i18n-CT_oS1Fy.js";
|
|
4
|
-
import { BaseControl } from "../base-control/base-control.js";
|
|
5
|
-
import { icons } from "../../icons/icons.js";
|
|
6
|
-
import { cloneElement } from "react";
|
|
7
|
-
import "../../react-jsx-parser.min-DZCiis5V.js";
|
|
8
|
-
/**
|
|
9
|
-
* A DraggableList item.
|
|
10
|
-
*
|
|
11
|
-
* @component
|
|
12
|
-
* @param {Object} props - Component props.
|
|
13
|
-
* @param {JSX.Element} [props.icon] - Icon to display in the label.
|
|
14
|
-
* @param {string} [props.label] - Label to display.
|
|
15
|
-
* @param {string} [props.subtitle] - Subtitle to display.
|
|
16
|
-
* @param {JSX.Element|JSX.Element[]} [props.actions] - Actions to display to the right of the label.
|
|
17
|
-
* @param {string} [props.textValue] - The text value of the item.
|
|
18
|
-
* @param {string} [props.className] - Classes to pass to the label.
|
|
19
|
-
*
|
|
20
|
-
* @returns {JSX.Element} The DraggableList component.
|
|
21
|
-
*
|
|
22
|
-
* @see {@link DraggableList} for usage example.
|
|
23
|
-
*
|
|
24
|
-
* @preserve
|
|
25
|
-
*/
|
|
26
|
-
const DraggableListItem = (props) => {
|
|
27
|
-
const { children, icon, label, subtitle, className, ...rest } = props;
|
|
28
|
-
return /* @__PURE__ */ jsxs(
|
|
29
|
-
BaseControl,
|
|
30
|
-
{
|
|
31
|
-
icon,
|
|
32
|
-
label,
|
|
33
|
-
subtitle,
|
|
34
|
-
className: clsx("es:w-full", className),
|
|
35
|
-
fullWidthLabel: true,
|
|
36
|
-
inline: true,
|
|
37
|
-
...rest,
|
|
38
|
-
children: [
|
|
39
|
-
cloneElement(icons.reorderGrabberV, {
|
|
40
|
-
className: "es:opacity-0 es:transition-opacity es:group-focus-visible:opacity-100 es:text-secondary-400 es:size-4 es:group-hover:opacity-100"
|
|
41
|
-
}),
|
|
42
|
-
children
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* A Draggable item handle.
|
|
49
|
-
*
|
|
50
|
-
* @component
|
|
51
|
-
* @param {Object} props - Component props.
|
|
52
|
-
* @param {string} [props.className] - Classes to pass to the handle.
|
|
53
|
-
*
|
|
54
|
-
* @returns {JSX.Element} The DraggableListItemHandle component.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* <DraggableListItemHandle />
|
|
58
|
-
*
|
|
59
|
-
* @preserve
|
|
60
|
-
*/
|
|
61
|
-
const DraggableListItemHandle = (props) => {
|
|
62
|
-
const { className, children, ...rest } = props;
|
|
63
|
-
return /* @__PURE__ */ jsx(
|
|
64
|
-
"button",
|
|
65
|
-
{
|
|
66
|
-
className: className ?? 'es:relative es:h-6 es:w-2 es:cursor-pointer es:items-center es:justify-center es:self-center es:rounded es:border es:border-secondary-300 es:bg-secondary-50 es:transition es:after:absolute es:after:inset-0 es:after:m-auto es:after:h-4 es:after:w-px es:after:bg-secondary-200 es:after:transition es:after:content-[""] es:hover:border-accent-500 es:hover:bg-accent-400 es:hover:after:bg-accent-500',
|
|
67
|
-
...rest,
|
|
68
|
-
"data-movable-handle": true,
|
|
69
|
-
tabIndex: -1,
|
|
70
|
-
children
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
export {
|
|
75
|
-
DraggableListItem,
|
|
76
|
-
DraggableListItemHandle
|
|
77
|
-
};
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useId } from "react";
|
|
3
|
-
import { _ as __ } from "../../default-i18n-CT_oS1Fy.js";
|
|
4
|
-
import { BaseControl } from "../base-control/base-control.js";
|
|
5
|
-
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
6
|
-
import { L as List, a as arrayRemove, b as arrayMove } from "../../List-CZMUbkFU.js";
|
|
7
|
-
const fixIds = (items, itemIdBase) => {
|
|
8
|
-
return items == null ? void 0 : items.map((item, i) => ({
|
|
9
|
-
...item,
|
|
10
|
-
id: (item == null ? void 0 : item.id) ?? `${itemIdBase}-${i}`
|
|
11
|
-
}));
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* A component that allows re-ordering a list of items.
|
|
15
|
-
*
|
|
16
|
-
* @component
|
|
17
|
-
* @param {Object} props - Component props.
|
|
18
|
-
* @param {JSX.Element} [props.icon] - Icon to display in the label.
|
|
19
|
-
* @param {string} [props.label] - Label to display.
|
|
20
|
-
* @param {string} [props.subtitle] - Subtitle to display.
|
|
21
|
-
* @param {string} [props.help] - Help text to display below the input.
|
|
22
|
-
* @param {JSX.Element|JSX.Element[]} [props.actions] - Actions to display to the right of the label.
|
|
23
|
-
* @param {Object<string, any>[]} props.items - Data to display in the list.
|
|
24
|
-
* @param {Function} props.onChange - Function to run when the items change.
|
|
25
|
-
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
26
|
-
* @param {boolean} [props.disabled] - If `true`, item reordering is disabled.
|
|
27
|
-
* @param {string} [props.className] - Classes to pass to the item wrapper.
|
|
28
|
-
*
|
|
29
|
-
* @returns {JSX.Element} The DraggableList component.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* <DraggableList
|
|
33
|
-
* label='My draggable list'
|
|
34
|
-
* items={items}
|
|
35
|
-
* onChange={setItems}
|
|
36
|
-
* >
|
|
37
|
-
* {(item) => {
|
|
38
|
-
* const { title, updateData } = item;
|
|
39
|
-
*
|
|
40
|
-
* return (
|
|
41
|
-
* <DraggableListItem
|
|
42
|
-
* label={title ?? 'New item'}
|
|
43
|
-
* icon={icons.myIcon}
|
|
44
|
-
* >
|
|
45
|
-
* <InputField
|
|
46
|
-
* label='Title'
|
|
47
|
-
* type='text'
|
|
48
|
-
* value={title}
|
|
49
|
-
* onChange={(value) => updateData({ title: value })}
|
|
50
|
-
* />
|
|
51
|
-
* </DraggableListItem>
|
|
52
|
-
* );
|
|
53
|
-
* }}
|
|
54
|
-
* </DraggableList>
|
|
55
|
-
*
|
|
56
|
-
* @preserve
|
|
57
|
-
*/
|
|
58
|
-
const DraggableList = (props) => {
|
|
59
|
-
const itemIdBase = useId("draggable-list-item-");
|
|
60
|
-
const {
|
|
61
|
-
children,
|
|
62
|
-
items: rawItems,
|
|
63
|
-
onChange,
|
|
64
|
-
icon,
|
|
65
|
-
label,
|
|
66
|
-
subtitle,
|
|
67
|
-
help,
|
|
68
|
-
actions,
|
|
69
|
-
disabled,
|
|
70
|
-
className,
|
|
71
|
-
labelAsHandle,
|
|
72
|
-
hidden,
|
|
73
|
-
...rest
|
|
74
|
-
} = props;
|
|
75
|
-
if (typeof rawItems === "undefined" || rawItems === null || !Array.isArray(rawItems)) {
|
|
76
|
-
console.warn(__("DraggableList: 'items' are not an array or are undefined!", "eightshift-ui-components"));
|
|
77
|
-
}
|
|
78
|
-
const items = fixIds(rawItems ?? [], itemIdBase);
|
|
79
|
-
if (hidden) {
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
return /* @__PURE__ */ jsx(
|
|
83
|
-
BaseControl,
|
|
84
|
-
{
|
|
85
|
-
icon,
|
|
86
|
-
label,
|
|
87
|
-
subtitle,
|
|
88
|
-
help,
|
|
89
|
-
actions,
|
|
90
|
-
className: "es:w-full",
|
|
91
|
-
...rest,
|
|
92
|
-
children: /* @__PURE__ */ jsx(
|
|
93
|
-
List,
|
|
94
|
-
{
|
|
95
|
-
values: items,
|
|
96
|
-
onChange: ({ oldIndex, newIndex }) => onChange(newIndex === -1 ? arrayRemove(items, oldIndex) : arrayMove(items, oldIndex, newIndex)),
|
|
97
|
-
renderList: ({ children: children2, props: props2 }) => {
|
|
98
|
-
const { key, ...rest2 } = props2;
|
|
99
|
-
return /* @__PURE__ */ jsx(
|
|
100
|
-
"ul",
|
|
101
|
-
{
|
|
102
|
-
className: "es:w-full es:list-none",
|
|
103
|
-
...rest2,
|
|
104
|
-
children: children2
|
|
105
|
-
},
|
|
106
|
-
key
|
|
107
|
-
);
|
|
108
|
-
},
|
|
109
|
-
renderItem: ({ value, index, isDisabled, isDragged, isSelected, isOutOfBounds, props: props2 }) => {
|
|
110
|
-
const { key, ...rest2 } = props2;
|
|
111
|
-
return /* @__PURE__ */ jsx(
|
|
112
|
-
"li",
|
|
113
|
-
{
|
|
114
|
-
className: clsx(
|
|
115
|
-
"es:group",
|
|
116
|
-
"es:min-h-8 es:w-full",
|
|
117
|
-
"es:flex es:items-center es:gap-1 es:rounded-lg",
|
|
118
|
-
"es:transition-[box-shadow,background-color,filter,opacity,border-color]",
|
|
119
|
-
"es:border es:border-transparent",
|
|
120
|
-
"es:any-focus:outline-hidden es:focus:ring-2 es:focus:ring-accent-500/50 es:focus:border-accent-500",
|
|
121
|
-
isDisabled && "es:grayscale",
|
|
122
|
-
isDragged && "es:bg-white es:opacity-50",
|
|
123
|
-
isSelected && "es:bg-accent-50",
|
|
124
|
-
isDragged ? "es:cursor-grabbing" : "es:cursor-grab"
|
|
125
|
-
),
|
|
126
|
-
...rest2,
|
|
127
|
-
children: children({
|
|
128
|
-
...value,
|
|
129
|
-
updateData: (newValue) => {
|
|
130
|
-
onChange(items.map((i) => i.id === value.id ? { ...i, ...newValue } : i));
|
|
131
|
-
},
|
|
132
|
-
itemIndex: index,
|
|
133
|
-
deleteItem: () => {
|
|
134
|
-
onChange(items.filter((i) => i.id !== value.id));
|
|
135
|
-
if (value.onAfterItemRemove) {
|
|
136
|
-
onAfterItemRemove(value);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
},
|
|
141
|
-
(value == null ? void 0 : value.id) ?? key
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
|
-
};
|
|
149
|
-
export {
|
|
150
|
-
DraggableList
|
|
151
|
-
};
|
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import React__default, { useRef, useCallback, useEffect, forwardRef, createContext, useContext } from "react";
|
|
3
|
-
import { RichLabel } from "../rich-label/rich-label.js";
|
|
4
|
-
import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
|
|
5
|
-
import { Button } from "../button/button.js";
|
|
6
|
-
import { icons } from "../../icons/icons.js";
|
|
7
|
-
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
8
|
-
import { _ as __ } from "../../default-i18n-CT_oS1Fy.js";
|
|
9
|
-
import { a as $d2b4bc8c273e7be6$export$24d547caef80ccd1 } from "../../Button-BPLceDeW.js";
|
|
10
|
-
import { e as $bdb11010cef70236$export$f680877a34711e37, n as $b5e257d569688ac6$export$535bd6ca7f90a273, k as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, a as $64fa3d84918910a7$export$29f1550f4b0d4415, b as $64fa3d84918910a7$export$4d86445c2cf5e3, i as $64fa3d84918910a7$export$2881499e37b75b9a, o as $64fa3d84918910a7$export$c62b8e45d58ddad9, d as $3ef42575df84b30b$export$9d1611c77c2fe928, m as $5dc95899b306f630$export$c9058316764c140e } from "../../utils-DkCSC521.js";
|
|
11
|
-
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-EDDcM64A.js";
|
|
12
|
-
import { b as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "../../useHover-DwDr6ozG.js";
|
|
13
|
-
import { r as reactDomExports } from "../../index-CFozsmNS.js";
|
|
14
|
-
import { $ as $e9faafb641e167db$export$90fc3a17d93f704c } from "../../useEvent-B0b-6KBr.js";
|
|
15
|
-
import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "../../useFocusRing-CV5l3lf6.js";
|
|
16
|
-
import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-icmbmNdI.js";
|
|
17
|
-
function $5e910fae8e128ead$export$6e3e27031a30522f(props, state, ref) {
|
|
18
|
-
let { isDisabled } = props;
|
|
19
|
-
let triggerId = $bdb11010cef70236$export$f680877a34711e37();
|
|
20
|
-
let panelId = $bdb11010cef70236$export$f680877a34711e37();
|
|
21
|
-
let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273();
|
|
22
|
-
let supportsBeforeMatch = !isSSR && "onbeforematch" in document.body;
|
|
23
|
-
let raf = useRef(null);
|
|
24
|
-
let handleBeforeMatch = useCallback(() => {
|
|
25
|
-
raf.current = requestAnimationFrame(() => {
|
|
26
|
-
if (ref.current) ref.current.setAttribute("hidden", "until-found");
|
|
27
|
-
});
|
|
28
|
-
reactDomExports.flushSync(() => {
|
|
29
|
-
state.toggle();
|
|
30
|
-
});
|
|
31
|
-
}, [
|
|
32
|
-
ref,
|
|
33
|
-
state
|
|
34
|
-
]);
|
|
35
|
-
$e9faafb641e167db$export$90fc3a17d93f704c(ref, "beforematch", supportsBeforeMatch ? handleBeforeMatch : null);
|
|
36
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
37
|
-
if (raf.current) cancelAnimationFrame(raf.current);
|
|
38
|
-
if (supportsBeforeMatch && ref.current && !isDisabled) {
|
|
39
|
-
if (state.isExpanded) ref.current.removeAttribute("hidden");
|
|
40
|
-
else ref.current.setAttribute("hidden", "until-found");
|
|
41
|
-
}
|
|
42
|
-
}, [
|
|
43
|
-
isDisabled,
|
|
44
|
-
ref,
|
|
45
|
-
state.isExpanded,
|
|
46
|
-
supportsBeforeMatch
|
|
47
|
-
]);
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
return () => {
|
|
50
|
-
if (raf.current) cancelAnimationFrame(raf.current);
|
|
51
|
-
};
|
|
52
|
-
}, []);
|
|
53
|
-
return {
|
|
54
|
-
buttonProps: {
|
|
55
|
-
id: triggerId,
|
|
56
|
-
"aria-expanded": state.isExpanded,
|
|
57
|
-
"aria-controls": panelId,
|
|
58
|
-
onPress: (e) => {
|
|
59
|
-
if (!isDisabled && e.pointerType !== "keyboard") state.toggle();
|
|
60
|
-
},
|
|
61
|
-
isDisabled,
|
|
62
|
-
onPressStart(e) {
|
|
63
|
-
if (e.pointerType === "keyboard" && !isDisabled) state.toggle();
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
panelProps: {
|
|
67
|
-
id: panelId,
|
|
68
|
-
// This can be overridden at the panel element level.
|
|
69
|
-
role: "group",
|
|
70
|
-
"aria-labelledby": triggerId,
|
|
71
|
-
"aria-hidden": !state.isExpanded,
|
|
72
|
-
hidden: supportsBeforeMatch ? true : !state.isExpanded
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
function $bf996d45f4a36925$export$3fcbf6e4407997e0(props) {
|
|
77
|
-
let [isExpanded, setExpanded] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(props.isExpanded, props.defaultExpanded || false, props.onExpandedChange);
|
|
78
|
-
const expand = useCallback(() => {
|
|
79
|
-
setExpanded(true);
|
|
80
|
-
}, [
|
|
81
|
-
setExpanded
|
|
82
|
-
]);
|
|
83
|
-
const collapse = useCallback(() => {
|
|
84
|
-
setExpanded(false);
|
|
85
|
-
}, [
|
|
86
|
-
setExpanded
|
|
87
|
-
]);
|
|
88
|
-
const toggle = useCallback(() => {
|
|
89
|
-
setExpanded(!isExpanded);
|
|
90
|
-
}, [
|
|
91
|
-
setExpanded,
|
|
92
|
-
isExpanded
|
|
93
|
-
]);
|
|
94
|
-
return {
|
|
95
|
-
isExpanded,
|
|
96
|
-
setExpanded,
|
|
97
|
-
expand,
|
|
98
|
-
collapse,
|
|
99
|
-
toggle
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
const $28f4fd908f0de97f$export$1d40e3e0cc4d5de = /* @__PURE__ */ createContext(null);
|
|
103
|
-
const $28f4fd908f0de97f$export$d665dd135a51b28a = /* @__PURE__ */ createContext(null);
|
|
104
|
-
const $28f4fd908f0de97f$export$dab3ea4a6ef094da = /* @__PURE__ */ createContext(null);
|
|
105
|
-
const $28f4fd908f0de97f$var$InternalDisclosureContext = /* @__PURE__ */ createContext(null);
|
|
106
|
-
const $28f4fd908f0de97f$export$74a362b31437ec83 = /* @__PURE__ */ forwardRef(function Disclosure(props, ref) {
|
|
107
|
-
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $28f4fd908f0de97f$export$d665dd135a51b28a);
|
|
108
|
-
let groupState = useContext($28f4fd908f0de97f$export$1d40e3e0cc4d5de);
|
|
109
|
-
let { id, ...otherProps } = props;
|
|
110
|
-
let defaultId = $bdb11010cef70236$export$f680877a34711e37();
|
|
111
|
-
id || (id = defaultId);
|
|
112
|
-
let isExpanded = groupState ? groupState.expandedKeys.has(id) : props.isExpanded;
|
|
113
|
-
let state = $bf996d45f4a36925$export$3fcbf6e4407997e0({
|
|
114
|
-
...props,
|
|
115
|
-
isExpanded,
|
|
116
|
-
onExpandedChange(isExpanded2) {
|
|
117
|
-
var _props_onExpandedChange;
|
|
118
|
-
if (groupState) groupState.toggleKey(id);
|
|
119
|
-
(_props_onExpandedChange = props.onExpandedChange) === null || _props_onExpandedChange === void 0 ? void 0 : _props_onExpandedChange.call(props, isExpanded2);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
let panelRef = React__default.useRef(null);
|
|
123
|
-
let isDisabled = props.isDisabled || (groupState === null || groupState === void 0 ? void 0 : groupState.isDisabled) || false;
|
|
124
|
-
let { buttonProps, panelProps } = $5e910fae8e128ead$export$6e3e27031a30522f({
|
|
125
|
-
...props,
|
|
126
|
-
isExpanded,
|
|
127
|
-
isDisabled
|
|
128
|
-
}, state, panelRef);
|
|
129
|
-
let { isFocusVisible: isFocusVisibleWithin, focusProps: focusWithinProps } = $f7dceffc5ad7768b$export$4e328f61c538687f({
|
|
130
|
-
within: true
|
|
131
|
-
});
|
|
132
|
-
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
133
|
-
...props,
|
|
134
|
-
id: void 0,
|
|
135
|
-
defaultClassName: "react-aria-Disclosure",
|
|
136
|
-
values: {
|
|
137
|
-
isExpanded: state.isExpanded,
|
|
138
|
-
isDisabled,
|
|
139
|
-
isFocusVisibleWithin,
|
|
140
|
-
state
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(otherProps);
|
|
144
|
-
return /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
|
|
145
|
-
values: [
|
|
146
|
-
[
|
|
147
|
-
$d2b4bc8c273e7be6$export$24d547caef80ccd1,
|
|
148
|
-
{
|
|
149
|
-
slots: {
|
|
150
|
-
[$64fa3d84918910a7$export$c62b8e45d58ddad9]: {},
|
|
151
|
-
trigger: buttonProps
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
],
|
|
155
|
-
[
|
|
156
|
-
$28f4fd908f0de97f$var$InternalDisclosureContext,
|
|
157
|
-
{
|
|
158
|
-
panelProps,
|
|
159
|
-
panelRef
|
|
160
|
-
}
|
|
161
|
-
],
|
|
162
|
-
[
|
|
163
|
-
$28f4fd908f0de97f$export$dab3ea4a6ef094da,
|
|
164
|
-
state
|
|
165
|
-
]
|
|
166
|
-
]
|
|
167
|
-
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
168
|
-
ref,
|
|
169
|
-
"data-expanded": state.isExpanded || void 0,
|
|
170
|
-
"data-disabled": isDisabled || void 0,
|
|
171
|
-
"data-focus-visible-within": isFocusVisibleWithin || void 0,
|
|
172
|
-
...domProps,
|
|
173
|
-
...focusWithinProps,
|
|
174
|
-
...renderProps
|
|
175
|
-
}, renderProps.children));
|
|
176
|
-
});
|
|
177
|
-
const $28f4fd908f0de97f$export$feabaa331e1d464c = /* @__PURE__ */ forwardRef(function DisclosurePanel(props, ref) {
|
|
178
|
-
let { role = "group" } = props;
|
|
179
|
-
let { panelProps, panelRef } = useContext($28f4fd908f0de97f$var$InternalDisclosureContext);
|
|
180
|
-
let { isFocusVisible: isFocusVisibleWithin, focusProps: focusWithinProps } = $f7dceffc5ad7768b$export$4e328f61c538687f({
|
|
181
|
-
within: true
|
|
182
|
-
});
|
|
183
|
-
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
184
|
-
...props,
|
|
185
|
-
defaultClassName: "react-aria-DisclosurePanel",
|
|
186
|
-
values: {
|
|
187
|
-
isFocusVisibleWithin
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
|
|
191
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
|
192
|
-
...DOMProps,
|
|
193
|
-
ref: $5dc95899b306f630$export$c9058316764c140e(ref, panelRef),
|
|
194
|
-
...$3ef42575df84b30b$export$9d1611c77c2fe928(panelProps, focusWithinProps),
|
|
195
|
-
...renderProps,
|
|
196
|
-
role,
|
|
197
|
-
"data-focus-visible-within": isFocusVisibleWithin || void 0
|
|
198
|
-
}, /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
|
|
199
|
-
values: [
|
|
200
|
-
[
|
|
201
|
-
$d2b4bc8c273e7be6$export$24d547caef80ccd1,
|
|
202
|
-
null
|
|
203
|
-
]
|
|
204
|
-
]
|
|
205
|
-
}, props.children));
|
|
206
|
-
});
|
|
207
|
-
/**
|
|
208
|
-
* A component that allows hiding content in an expandable panel, to declutter the UI.
|
|
209
|
-
*
|
|
210
|
-
* @component
|
|
211
|
-
* @param {Object} props - Component props.
|
|
212
|
-
* @param {JSX.Element} [props.icon] - Icon to display in the label.
|
|
213
|
-
* @param {string} props.label - Label to display.
|
|
214
|
-
* @param {string} [props.subtitle] - Subtitle to display.
|
|
215
|
-
* @param {string} [props.className] - Classes to pass to the container.
|
|
216
|
-
* @param {string} [props.contentClassName] - Classes to pass to the inner content wrapper.
|
|
217
|
-
* @param {string} [props.labelClassName] - Classes to pass to the label.
|
|
218
|
-
* @param {string} [props.headerClassName] - Classes to pass to the header (label + trigger).
|
|
219
|
-
* @param {JSX.Element|JSX.Element[]} [props.actions] - Actions to display in the panel header, left of the expand button.
|
|
220
|
-
* @param {boolean} [props.keepActionsOnExpand=false] - If `true`, the actions are not hidden when the panel is expanded.
|
|
221
|
-
* @param {boolean} [props.disabled] - If `true`, the expand button is disabled.
|
|
222
|
-
* @param {boolean} [props.open] - Whether the expandable is open.
|
|
223
|
-
* @param {Function} [props.onOpenChange] - Function is called when the panel is opened or closed.
|
|
224
|
-
* @param {object} [props.headerProps] - Props to pass to the header (label + trigger).
|
|
225
|
-
* @param {JSX.Element} [props.customOpenButton] - Allows adding a custom open button. **IMPORTANT**: make sure to set `slot='trigger'` on the passed element!
|
|
226
|
-
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
227
|
-
*
|
|
228
|
-
* @returns {JSX.Element} The Expandable component.
|
|
229
|
-
*
|
|
230
|
-
* @example
|
|
231
|
-
* <Expandable label='My component'>
|
|
232
|
-
* ...
|
|
233
|
-
* </Expandable>
|
|
234
|
-
*
|
|
235
|
-
* @preserve
|
|
236
|
-
*/
|
|
237
|
-
const Expandable = (props) => {
|
|
238
|
-
const {
|
|
239
|
-
icon,
|
|
240
|
-
label,
|
|
241
|
-
subtitle,
|
|
242
|
-
className,
|
|
243
|
-
labelClassName,
|
|
244
|
-
contentClassName,
|
|
245
|
-
headerClassName,
|
|
246
|
-
actions,
|
|
247
|
-
keepActionsOnExpand = false,
|
|
248
|
-
disabled,
|
|
249
|
-
noFocusHandling,
|
|
250
|
-
children,
|
|
251
|
-
open = false,
|
|
252
|
-
onOpenChange,
|
|
253
|
-
customOpenButton,
|
|
254
|
-
headerProps,
|
|
255
|
-
hidden,
|
|
256
|
-
...other
|
|
257
|
-
} = props;
|
|
258
|
-
const [isOpen, setIsOpen] = React__default.useState(open);
|
|
259
|
-
if (isOpen && disabled) {
|
|
260
|
-
setIsOpen(false);
|
|
261
|
-
}
|
|
262
|
-
if (hidden) {
|
|
263
|
-
return null;
|
|
264
|
-
}
|
|
265
|
-
return /* @__PURE__ */ jsxs(
|
|
266
|
-
$28f4fd908f0de97f$export$74a362b31437ec83,
|
|
267
|
-
{
|
|
268
|
-
isExpanded: isOpen,
|
|
269
|
-
className: clsx("es:w-full es:rounded-xl es:border es:border-secondary-300/0 es:text-sm es:transition", isOpen && "es:border-secondary-300/100 es:shadow-lg", className),
|
|
270
|
-
...other,
|
|
271
|
-
children: [
|
|
272
|
-
/* @__PURE__ */ jsxs("div", { className: clsx("es:flex es:h-10 es:items-center es:gap-1 es:transition-[padding]", isOpen && "es:py-1 es:pl-2 es:pr-1", headerClassName), children: [
|
|
273
|
-
/* @__PURE__ */ jsx(
|
|
274
|
-
RichLabel,
|
|
275
|
-
{
|
|
276
|
-
icon,
|
|
277
|
-
label,
|
|
278
|
-
subtitle,
|
|
279
|
-
className: labelClassName,
|
|
280
|
-
as: $01b77f81d0f07f68$export$b04be29aa201d4f5,
|
|
281
|
-
fullWidth: true
|
|
282
|
-
}
|
|
283
|
-
),
|
|
284
|
-
actions && !keepActionsOnExpand && /* @__PURE__ */ jsx(
|
|
285
|
-
AnimatedVisibility,
|
|
286
|
-
{
|
|
287
|
-
visible: !isOpen,
|
|
288
|
-
className: "es:ml-auto es:flex es:gap-2",
|
|
289
|
-
transition: "slideFadeDownSlight",
|
|
290
|
-
noInitial: true,
|
|
291
|
-
children: actions
|
|
292
|
-
}
|
|
293
|
-
),
|
|
294
|
-
actions && keepActionsOnExpand && /* @__PURE__ */ jsx("div", { className: "es:ml-auto es:flex es:gap-2", children: actions }),
|
|
295
|
-
customOpenButton && customOpenButton({
|
|
296
|
-
open: isOpen,
|
|
297
|
-
toggleOpen: () => {
|
|
298
|
-
setIsOpen(!isOpen);
|
|
299
|
-
if (onOpenChange) {
|
|
300
|
-
onOpenChange(!isOpen);
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
tooltip: isOpen ? __("Close", "eightshift-ui-components") : __("Open", "eightshift-ui-components"),
|
|
304
|
-
disabled
|
|
305
|
-
}),
|
|
306
|
-
!customOpenButton && /* @__PURE__ */ jsx(
|
|
307
|
-
Button,
|
|
308
|
-
{
|
|
309
|
-
slot: "trigger",
|
|
310
|
-
type: "ghost",
|
|
311
|
-
icon: isOpen ? icons.caretDownFill : icons.caretDown,
|
|
312
|
-
onPress: () => {
|
|
313
|
-
setIsOpen(!isOpen);
|
|
314
|
-
if (onOpenChange) {
|
|
315
|
-
onOpenChange(!isOpen);
|
|
316
|
-
}
|
|
317
|
-
},
|
|
318
|
-
tooltip: isOpen ? __("Close", "eightshift-ui-components") : __("Open", "eightshift-ui-components"),
|
|
319
|
-
disabled,
|
|
320
|
-
className: clsx("es:icon:size-5 es:icon:transition-transform", isOpen && "es:icon:-scale-y-100"),
|
|
321
|
-
size: "small"
|
|
322
|
-
}
|
|
323
|
-
)
|
|
324
|
-
] }),
|
|
325
|
-
/* @__PURE__ */ jsx(
|
|
326
|
-
$28f4fd908f0de97f$export$feabaa331e1d464c,
|
|
327
|
-
{
|
|
328
|
-
className: clsx(
|
|
329
|
-
isOpen && "es:space-y-2.5 es:border-t es:border-t-secondary-200 es:p-2",
|
|
330
|
-
isOpen && "es:motion-safe:motion-preset-slide-down-sm es:motion-safe:motion-ease-spring-smooth es:motion-safe:motion-ease-linear/opacity es:motion-safe:motion-duration-300 es:motion-reduce:motion-preset-fade-md",
|
|
331
|
-
contentClassName
|
|
332
|
-
),
|
|
333
|
-
children
|
|
334
|
-
}
|
|
335
|
-
)
|
|
336
|
-
]
|
|
337
|
-
}
|
|
338
|
-
);
|
|
339
|
-
};
|
|
340
|
-
export {
|
|
341
|
-
Expandable
|
|
342
|
-
};
|