@eightshift/ui-components 5.0.0 → 5.0.1
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/Button-wERNNG0T.js +185 -0
- package/dist/Collection-CKsHTyhc.js +2363 -0
- package/dist/Color-BhgbJF5x.js +2452 -0
- package/dist/ColorSwatch-Bcn6oRSg.js +64 -0
- package/dist/ComboBox-D1LPUwWP.js +1906 -0
- package/dist/Dialog-D190gMbE.js +2298 -0
- package/dist/FieldError-DeUh5Wkw.js +42 -0
- package/dist/FocusScope-C-plSxbS.js +831 -0
- package/dist/Form-Cq3fu75_.js +5 -0
- package/dist/Group-C5iZpSAM.js +48 -0
- package/dist/Heading-D-Pboe4p.js +16 -0
- package/dist/Hidden-rE6uR-lr.js +41 -0
- package/dist/Input--mF4XVE1.js +133 -0
- package/dist/Label-Fp6AwSRn.js +17 -0
- package/dist/List-CZMUbkFU.js +593 -0
- package/dist/ListBox-4oW9kh3R.js +582 -0
- package/dist/NumberFormatter-DA8u1Ot7.js +140 -0
- package/dist/OverlayArrow-BpB9uB_I.js +637 -0
- package/dist/RSPContexts-2lR5GG9p.js +14 -0
- package/dist/Select-aab027f3.esm-BKIJGje-.js +2469 -0
- package/dist/Separator-B88tj5YD.js +323 -0
- package/dist/Slider-CyJzC1bp.js +853 -0
- package/dist/Text-DRpwWot2.js +16 -0
- package/dist/VisuallyHidden-DsKYcRQ_.js +48 -0
- package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
- package/dist/assets/index.css +57 -0
- package/dist/assets/style-admin.css +5864 -0
- package/dist/assets/style-editor.css +5864 -0
- package/dist/assets/style.css +5870 -0
- package/dist/assets/wp-font-enhancements.css +8 -0
- package/dist/assets/wp-ui-enhancements.css +377 -0
- package/dist/components/animated-visibility/animated-visibility.js +105 -0
- package/dist/components/base-control/base-control.js +86 -0
- package/dist/components/breakpoint-preview/breakpoint-preview.js +161 -0
- package/dist/components/button/button.js +387 -0
- package/dist/components/checkbox/checkbox.js +320 -0
- package/dist/components/color-pickers/color-picker.js +272 -0
- package/dist/components/color-pickers/color-swatch.js +59 -0
- package/dist/components/color-pickers/gradient-editor.js +534 -0
- package/dist/components/color-pickers/solid-color-picker.js +1567 -0
- package/dist/components/component-toggle/component-toggle.js +161 -0
- package/dist/components/container-panel/container-panel.js +131 -0
- package/dist/components/draggable/draggable-context.js +5 -0
- package/dist/components/draggable/draggable-handle.js +46 -0
- package/dist/components/draggable/draggable.js +6979 -0
- package/dist/components/draggable-list/draggable-list-context.js +5 -0
- package/dist/components/draggable-list/draggable-list-item.js +77 -0
- package/dist/components/draggable-list/draggable-list.js +151 -0
- package/dist/components/expandable/expandable.js +342 -0
- package/dist/components/index.js +137 -0
- package/dist/components/input-field/input-field.js +231 -0
- package/dist/components/item-collection/item-collection.js +59 -0
- package/dist/components/layout/hstack.js +30 -0
- package/dist/components/layout/vstack.js +30 -0
- package/dist/components/link-input/link-input.js +291 -0
- package/dist/components/matrix-align/matrix-align.js +134 -0
- package/dist/components/menu/menu.js +285 -0
- package/dist/components/modal/modal.js +305 -0
- package/dist/components/notice/notice.js +123 -0
- package/dist/components/number-picker/number-picker.js +292 -0
- package/dist/components/option-select/option-select.js +264 -0
- package/dist/components/options-panel/options-panel.js +158 -0
- package/dist/components/placeholders/file-placeholder.js +42 -0
- package/dist/components/placeholders/image-placeholder.js +88 -0
- package/dist/components/placeholders/media-placeholder.js +63 -0
- package/dist/components/popover/popover.js +207 -0
- package/dist/components/radio/radio.js +579 -0
- package/dist/components/repeater/repeater-context.js +5 -0
- package/dist/components/repeater/repeater-item.js +119 -0
- package/dist/components/repeater/repeater.js +280 -0
- package/dist/components/responsive/mini-responsive.js +498 -0
- package/dist/components/responsive/responsive-legacy.js +343 -0
- package/dist/components/responsive/responsive.js +583 -0
- package/dist/components/responsive-preview/responsive-preview.js +123 -0
- package/dist/components/rich-label/rich-label.js +66 -0
- package/dist/components/select/async-multi-select.js +157 -0
- package/dist/components/select/async-single-select.js +137 -0
- package/dist/components/select/custom-select-default-components.js +38 -0
- package/dist/components/select/multi-select-components.js +8 -0
- package/dist/components/select/multi-select.js +151 -0
- package/dist/components/select/react-select-component-wrappers.js +90 -0
- package/dist/components/select/shared.js +26 -0
- package/dist/components/select/single-select.js +131 -0
- package/dist/components/select/styles.js +49 -0
- package/dist/components/select/v2/async-select.js +297 -0
- package/dist/components/select/v2/shared.js +24 -0
- package/dist/components/select/v2/single-select.js +991 -0
- package/dist/components/slider/column-config-slider.js +210 -0
- package/dist/components/slider/slider.js +345 -0
- package/dist/components/slider/utils.js +94 -0
- package/dist/components/spacer/spacer.js +97 -0
- package/dist/components/tabs/tabs.js +704 -0
- package/dist/components/toggle/switch.js +156 -0
- package/dist/components/toggle/toggle.js +64 -0
- package/dist/components/toggle-button/toggle-button.js +343 -0
- package/dist/components/tooltip/tooltip.js +527 -0
- package/dist/context-BYWrbm1z.js +92 -0
- package/dist/default-i18n-CT_oS1Fy.js +922 -0
- package/dist/filterDOMProps-EDDcM64A.js +28 -0
- package/dist/icons/block-icon.js +42 -0
- package/dist/icons/generic-color-swatch.js +113 -0
- package/dist/icons/icons.js +30371 -0
- package/dist/icons/index.js +11 -0
- package/dist/icons/jsx-svg.js +50 -0
- package/dist/index-641ee5b8.esm-BPU8rMZr.js +3137 -0
- package/dist/index-CFozsmNS.js +28321 -0
- package/dist/index-wl5606BX.js +44 -0
- package/dist/index.js +139 -0
- package/dist/lite-DVmmD_-j.js +7 -0
- package/dist/modifiers.esm-BuJQPI1X.js +31 -0
- package/dist/multi-select-components-Sp-JEFEX.js +3744 -0
- package/dist/number-GajL10e1.js +36 -0
- package/dist/react-jsx-parser.min-DZCiis5V.js +11753 -0
- package/dist/react-select-async.esm-D937XTWW.js +107 -0
- package/dist/react-select.esm-Ciai3aKf.js +15 -0
- package/dist/style-admin.js +1 -0
- package/dist/style-editor.js +1 -0
- package/dist/style.js +1 -0
- package/dist/textSelection-CCcyjiRP.js +46 -0
- package/dist/useButton-BOHxkGQF.js +50 -0
- package/dist/useEvent-D5o_CqDH.js +23 -0
- package/dist/useFocusRing-nMG2uzxS.js +107 -0
- package/dist/useFormReset-DlmRL87g.js +22 -0
- package/dist/useFormValidation-D0_aaK-e.js +224 -0
- package/dist/useHover-VO5tcIli.js +890 -0
- package/dist/useLabel-BKH4fVA4.js +27 -0
- package/dist/useLabels-ntF3rFY0.js +23 -0
- package/dist/useListState-Cq2Nvr-v.js +161 -0
- package/dist/useLocalizedStringFormatter-CGzwx1a0.js +121 -0
- package/dist/useNumberField-C9dmERhP.js +1207 -0
- package/dist/useNumberFormatter-MrRLgvhj.js +13 -0
- package/dist/usePress-DjNo5790.js +677 -0
- package/dist/useSingleSelectListState--r3AAhRj.js +38 -0
- package/dist/useToggle-CQaXLe-O.js +59 -0
- package/dist/useToggleState-C3DLdez5.js +19 -0
- package/dist/utilities/array-helpers.js +56 -0
- package/dist/utilities/debounce-throttle.js +123 -0
- package/dist/utilities/es-dash.js +382 -0
- package/dist/utilities/index.js +27 -0
- package/dist/utilities/text-helpers.js +136 -0
- package/dist/utils-B94NDG0v.js +370 -0
- package/dist/wp/wp-font-enhancements.js +1 -0
- package/dist/wp/wp-ui-enhancements.js +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { _ as __, s as sprintf } from "../../default-i18n-CT_oS1Fy.js";
|
|
3
|
+
import { Expandable } from "../expandable/expandable.js";
|
|
4
|
+
import { icons } from "../../icons/icons.js";
|
|
5
|
+
import { Switch } from "../toggle/switch.js";
|
|
6
|
+
import { TriggeredPopover } from "../popover/popover.js";
|
|
7
|
+
import { ButtonGroup } from "../button/button.js";
|
|
8
|
+
import { ToggleButton } from "../toggle-button/toggle-button.js";
|
|
9
|
+
import { BaseControl } from "../base-control/base-control.js";
|
|
10
|
+
import { Spacer } from "../spacer/spacer.js";
|
|
11
|
+
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
12
|
+
import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
|
|
13
|
+
/**
|
|
14
|
+
* A component that provides a nice way to toggle a component on and off, and display its content in an expandable panel.
|
|
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 {boolean} props.useComponent - Whether the component is used. If `false`, the content is hidden.
|
|
22
|
+
* @param {Function} props.onChange - Function to run when the toggle state changes.
|
|
23
|
+
* @param {boolean} [props.noUseToggle] - If `true`, the toggle is not displayed.
|
|
24
|
+
* @param {boolean} [props.noExpandButton] - If `true`, the expand button is not shown.
|
|
25
|
+
* @param {boolean} [props.noLabel] - If `true`, the label is not shown.
|
|
26
|
+
* @param {boolean} [props.noUseToggle] - If `true`, the toggle is not displayed.
|
|
27
|
+
* @param {boolean} [props.expandButtonDisabled] - If `true`, the expand button is disabled.
|
|
28
|
+
* @param {boolean} [props.controlOnly] - If `true`, only the control is displayed.
|
|
29
|
+
* @param {boolean} [props.hideUseToggleOnExpand] - If `true`, and the component is display in a variant where it can be expanded, the use toggle will hide when the component is expanded.
|
|
30
|
+
* @param {string} [props.contentClassName] - Classes to pass to the content container.
|
|
31
|
+
* @param {ComponentToggleDesign} [props.design='default'] - Design of the component.
|
|
32
|
+
* @param {string} [props.switchAriaLabel] - ARIA label of the toggle switch.
|
|
33
|
+
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
34
|
+
*
|
|
35
|
+
* @returns {JSX.Element} The ComponentToggle component.
|
|
36
|
+
*
|
|
37
|
+
* @typedef {'default' | 'compact' | 'compactLabel' | 'compactIcon'} ComponentToggleDesign
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* <ComponentToggle
|
|
41
|
+
* label='My component'
|
|
42
|
+
* useComponent={useComponent}
|
|
43
|
+
* onChange={setUseComponent}
|
|
44
|
+
* >
|
|
45
|
+
* ...
|
|
46
|
+
* </ComponentToggle>
|
|
47
|
+
*
|
|
48
|
+
* @preserve
|
|
49
|
+
*/
|
|
50
|
+
const ComponentToggle = (props) => {
|
|
51
|
+
const {
|
|
52
|
+
children,
|
|
53
|
+
icon,
|
|
54
|
+
label,
|
|
55
|
+
subtitle,
|
|
56
|
+
useComponent,
|
|
57
|
+
onChange,
|
|
58
|
+
noLabel,
|
|
59
|
+
noUseToggle,
|
|
60
|
+
noExpandButton,
|
|
61
|
+
controlOnly,
|
|
62
|
+
expandButtonDisabled,
|
|
63
|
+
hideUseToggleOnExpand,
|
|
64
|
+
switchAriaLabel = __("Use component", "eightshift-ui-components"),
|
|
65
|
+
contentClassName = "es:space-y-2.5",
|
|
66
|
+
design = "default",
|
|
67
|
+
hidden
|
|
68
|
+
} = props;
|
|
69
|
+
if (hidden) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
if (controlOnly || noLabel && noUseToggle && noExpandButton) {
|
|
73
|
+
return children;
|
|
74
|
+
}
|
|
75
|
+
if (design.startsWith("compact")) {
|
|
76
|
+
const optionsLabel = sprintf(__("%s options", "eightshift-ui-components"), label);
|
|
77
|
+
const hasIcon = design === "compact" || design === "compactIcon";
|
|
78
|
+
const hasLabel = design === "compact" || design === "compactLabel";
|
|
79
|
+
return /* @__PURE__ */ jsxs(ButtonGroup, { children: [
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
ToggleButton,
|
|
82
|
+
{
|
|
83
|
+
icon: hasIcon && (icon ?? icons.componentGeneric),
|
|
84
|
+
tooltip: hasIcon && !noLabel && label,
|
|
85
|
+
selected: useComponent,
|
|
86
|
+
onChange,
|
|
87
|
+
children: hasLabel && label
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ jsxs(
|
|
91
|
+
TriggeredPopover,
|
|
92
|
+
{
|
|
93
|
+
triggerButtonProps: {
|
|
94
|
+
className: "es:w-5.5 es:stroke-[1.25]",
|
|
95
|
+
tooltip: optionsLabel,
|
|
96
|
+
disabled: !useComponent
|
|
97
|
+
},
|
|
98
|
+
triggerButtonIcon: icons.dropdownCaretAlt,
|
|
99
|
+
className: clsx("es:w-[18.5rem] es:p-2", contentClassName),
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ jsx(Spacer, { text: optionsLabel }),
|
|
102
|
+
children
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
] });
|
|
107
|
+
}
|
|
108
|
+
if (noExpandButton) {
|
|
109
|
+
return /* @__PURE__ */ jsxs(
|
|
110
|
+
BaseControl,
|
|
111
|
+
{
|
|
112
|
+
icon: icon ?? icons.componentGeneric,
|
|
113
|
+
label: !noLabel && label,
|
|
114
|
+
subtitle,
|
|
115
|
+
actions: !noUseToggle && /* @__PURE__ */ jsx(
|
|
116
|
+
Switch,
|
|
117
|
+
{
|
|
118
|
+
checked: useComponent,
|
|
119
|
+
onChange,
|
|
120
|
+
"aria-label": switchAriaLabel
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
disabled: !useComponent || expandButtonDisabled,
|
|
124
|
+
children: [
|
|
125
|
+
noUseToggle && children,
|
|
126
|
+
!noUseToggle && /* @__PURE__ */ jsx(
|
|
127
|
+
AnimatedVisibility,
|
|
128
|
+
{
|
|
129
|
+
visible: useComponent,
|
|
130
|
+
className: contentClassName,
|
|
131
|
+
noInitial: true,
|
|
132
|
+
children
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
return /* @__PURE__ */ jsx(
|
|
140
|
+
Expandable,
|
|
141
|
+
{
|
|
142
|
+
icon: icon ?? icons.componentGeneric,
|
|
143
|
+
label: !noLabel && label,
|
|
144
|
+
subtitle,
|
|
145
|
+
keepActionsOnExpand: !hideUseToggleOnExpand,
|
|
146
|
+
actions: !noUseToggle && /* @__PURE__ */ jsx(
|
|
147
|
+
Switch,
|
|
148
|
+
{
|
|
149
|
+
checked: useComponent,
|
|
150
|
+
onChange
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
disabled: !useComponent || expandButtonDisabled,
|
|
154
|
+
noFocusHandling: true,
|
|
155
|
+
children: !expandButtonDisabled && /* @__PURE__ */ jsx("div", { className: contentClassName, children })
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
export {
|
|
160
|
+
ComponentToggle
|
|
161
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
4
|
+
import { Switch } from "../toggle/switch.js";
|
|
5
|
+
import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
|
|
6
|
+
import { Button } from "../button/button.js";
|
|
7
|
+
import { icons } from "../../icons/icons.js";
|
|
8
|
+
import { HStack } from "../layout/hstack.js";
|
|
9
|
+
import { BaseControl } from "../base-control/base-control.js";
|
|
10
|
+
/**
|
|
11
|
+
* Component that provides a container panel for options, with an optional title.
|
|
12
|
+
* Best used within the Gutenberg sidebar, instead of the default `PanelBody` component.
|
|
13
|
+
* Ensures that the content is spaced nicely.
|
|
14
|
+
*
|
|
15
|
+
* @component
|
|
16
|
+
* @param {Object} props - Component props.
|
|
17
|
+
* @param {string} [props.className] - Classes to pass to the container.
|
|
18
|
+
* @param {string} [props.title] - Title to display on the top of the panel.
|
|
19
|
+
* @param {JSX.Element} [props.icon] - Icon to display on the top of the panel.
|
|
20
|
+
* @param {string} [props.subtitle] - Subtitle to display on the top of the panel.
|
|
21
|
+
* @param {boolean} [props.use] - Controls the panel use toggle.
|
|
22
|
+
* @param {Function} [props.onUseChange] - Function to call when the use toggle is toggled. `(value: boolean) => void`.
|
|
23
|
+
* @param {boolean} [props.closable] - If `true`, the panel can be closed. Will not show if `title` is not set.
|
|
24
|
+
* @param {boolean} [props.startOpen=false] - Controls whether the panel is open by default.
|
|
25
|
+
* @param {JSX.Element} [props.actions] - Actions to show at the end
|
|
26
|
+
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
27
|
+
*
|
|
28
|
+
* @returns {JSX.Element} The ContainerPanel component.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* <ContainerPanel title='Paragraph'>
|
|
32
|
+
* ...
|
|
33
|
+
* </ContainerPanel>
|
|
34
|
+
*
|
|
35
|
+
* @preserve
|
|
36
|
+
*/
|
|
37
|
+
const ContainerPanel = (props) => {
|
|
38
|
+
const { children, className, title, icon, subtitle, use, onUseChange, closable, startOpen = false, actions, hidden } = props;
|
|
39
|
+
const [open, setOpen] = useState(startOpen);
|
|
40
|
+
if (hidden) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
if (!title && typeof use === "undefined") {
|
|
44
|
+
return /* @__PURE__ */ jsx("div", { className: clsx("es:space-y-2 es:border-t es:border-t-secondary-200 es:p-4", className), children });
|
|
45
|
+
}
|
|
46
|
+
const justUse = !closable && typeof onUseChange !== "undefined";
|
|
47
|
+
const justClosable = closable && typeof onUseChange === "undefined";
|
|
48
|
+
const useAndClosable = closable && typeof onUseChange !== "undefined";
|
|
49
|
+
return /* @__PURE__ */ jsxs(
|
|
50
|
+
BaseControl,
|
|
51
|
+
{
|
|
52
|
+
icon,
|
|
53
|
+
label: title,
|
|
54
|
+
subtitle,
|
|
55
|
+
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
56
|
+
actions,
|
|
57
|
+
/* @__PURE__ */ jsxs(
|
|
58
|
+
HStack,
|
|
59
|
+
{
|
|
60
|
+
hidden: !closable && !onUseChange,
|
|
61
|
+
className: "es:ml-auto",
|
|
62
|
+
children: [
|
|
63
|
+
onUseChange && /* @__PURE__ */ jsx(
|
|
64
|
+
Switch,
|
|
65
|
+
{
|
|
66
|
+
checked: use,
|
|
67
|
+
onChange: (value) => {
|
|
68
|
+
if (!value) {
|
|
69
|
+
setOpen(false);
|
|
70
|
+
}
|
|
71
|
+
onUseChange(value);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
closable && /* @__PURE__ */ jsx(
|
|
76
|
+
Button,
|
|
77
|
+
{
|
|
78
|
+
onPress: () => setOpen(!open),
|
|
79
|
+
icon: (typeof use !== "undefined" ? open && use : open) ? icons.caretDownFill : icons.caretDown,
|
|
80
|
+
type: "ghost",
|
|
81
|
+
size: "small",
|
|
82
|
+
className: clsx("es:icon:size-5 es:icon:transition-transform", (typeof use !== "undefined" ? open && use : open) && "es:icon:-scale-y-100"),
|
|
83
|
+
disabled: typeof use !== "undefined" && !use
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
] }),
|
|
90
|
+
className: clsx(
|
|
91
|
+
"es:border-t es:border-t-secondary-200",
|
|
92
|
+
!closable && typeof use === "undefined" && "es:space-y-2",
|
|
93
|
+
justClosable && open && "es:pb-4",
|
|
94
|
+
justUse && use && "es:pb-4",
|
|
95
|
+
useAndClosable && use && open && "es:pb-4",
|
|
96
|
+
!justClosable && !justUse && !useAndClosable && "es:pb-4",
|
|
97
|
+
!closable && !onUseChange && typeof use === "undefined" && "es:px-4",
|
|
98
|
+
className
|
|
99
|
+
),
|
|
100
|
+
labelContainerClassName: clsx((closable || onUseChange) && "es:pl-4 es:pr-3 es:min-h-12", !(closable || onUseChange) && "es:mt-3 es:mb-3", "es:pb-0!"),
|
|
101
|
+
controlContainerClassName: "es:px-4",
|
|
102
|
+
labelClassName: "es:text-secondary-600!",
|
|
103
|
+
children: [
|
|
104
|
+
!closable && !onUseChange && typeof use === "undefined" && children,
|
|
105
|
+
closable && typeof use === "undefined" && /* @__PURE__ */ jsx(
|
|
106
|
+
AnimatedVisibility,
|
|
107
|
+
{
|
|
108
|
+
visible: open,
|
|
109
|
+
className: "es:space-y-2 es:px-4",
|
|
110
|
+
transition: "slideFadeDownSlight",
|
|
111
|
+
noInitial: true,
|
|
112
|
+
children
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
typeof use !== "undefined" && /* @__PURE__ */ jsx(
|
|
116
|
+
AnimatedVisibility,
|
|
117
|
+
{
|
|
118
|
+
visible: closable ? use && open : use,
|
|
119
|
+
className: "es:space-y-2 es:px-4",
|
|
120
|
+
transition: "slideFadeDownSlight",
|
|
121
|
+
noInitial: true,
|
|
122
|
+
children
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
export {
|
|
130
|
+
ContainerPanel
|
|
131
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
3
|
+
import "../../default-i18n-CT_oS1Fy.js";
|
|
4
|
+
import { DraggableContext } from "./draggable-context.js";
|
|
5
|
+
import { useContext } from "react";
|
|
6
|
+
import { icons } from "../../icons/icons.js";
|
|
7
|
+
import "../../react-jsx-parser.min-DZCiis5V.js";
|
|
8
|
+
/**
|
|
9
|
+
* A Draggable item handle.
|
|
10
|
+
*
|
|
11
|
+
* @component
|
|
12
|
+
* @param {Object} props - Component props.
|
|
13
|
+
* @param {string} [props.className] - Classes to pass to the handle.
|
|
14
|
+
*
|
|
15
|
+
* @returns {JSX.Element} The DraggableHandle component.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <DraggableHandle />
|
|
19
|
+
*
|
|
20
|
+
* @preserve
|
|
21
|
+
*/
|
|
22
|
+
const DraggableHandle = (props) => {
|
|
23
|
+
const { className, children, ...rest } = props;
|
|
24
|
+
const { handleRef, status } = useContext(DraggableContext);
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
className: clsx(
|
|
29
|
+
"es:flex es:h-5 es:w-4 es:cursor-pointer es:items-center es:justify-center es:rounded es:border es:border-secondary-200 es:bg-white es:text-secondary-400 es:transition",
|
|
30
|
+
"es:icon:size-4 es:icon:shrink-0",
|
|
31
|
+
"es:active:border-accent-500/30 es:active:bg-accent-50 es:active:text-accent-500",
|
|
32
|
+
"es:any-focus:outline-hidden",
|
|
33
|
+
status !== "dragging" && "es:focus:border-accent-500 es:focus:ring-2 es:focus:ring-accent-500/50",
|
|
34
|
+
"es:hover:text-accent-500",
|
|
35
|
+
status === "dragging" && "es:border-accent-600! es:bg-accent-500! es:text-white! es:shadow-sm es:shadow-accent-500/30 es:ring-3 es:ring-accent-500/50",
|
|
36
|
+
className
|
|
37
|
+
),
|
|
38
|
+
ref: handleRef,
|
|
39
|
+
...rest,
|
|
40
|
+
children: children ?? icons.reorderGrabberV
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
DraggableHandle
|
|
46
|
+
};
|