@eightshift/ui-components 4.0.0 → 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.
Files changed (144) hide show
  1. package/package.json +101 -101
  2. package/dist/Button-CvzGKGCo.js +0 -185
  3. package/dist/Collection-ddre1L5v.js +0 -2332
  4. package/dist/Color-MV5kBVXr.js +0 -2452
  5. package/dist/ColorSwatch-BqQfVu4L.js +0 -64
  6. package/dist/ComboBox-jQ-dk95U.js +0 -1906
  7. package/dist/Dialog-DX1aiYyE.js +0 -2300
  8. package/dist/FieldError-52GVSGgC.js +0 -42
  9. package/dist/FocusScope-Cri5BFRz.js +0 -831
  10. package/dist/Form-Cq3fu75_.js +0 -5
  11. package/dist/Group-_emcIVxI.js +0 -48
  12. package/dist/Heading-B2153VXe.js +0 -16
  13. package/dist/Hidden-rE6uR-lr.js +0 -41
  14. package/dist/Input-BxpFEIXV.js +0 -133
  15. package/dist/Label-icmbmNdI.js +0 -17
  16. package/dist/List-BYNHbol3.js +0 -593
  17. package/dist/ListBox-mJ4nQaL7.js +0 -581
  18. package/dist/NumberFormatter-DA8u1Ot7.js +0 -140
  19. package/dist/OverlayArrow-BB0CWwdq.js +0 -629
  20. package/dist/RSPContexts-2lR5GG9p.js +0 -14
  21. package/dist/Select-aab027f3.esm--EmXjiL3.js +0 -2469
  22. package/dist/Separator-D9moUgP8.js +0 -322
  23. package/dist/Slider-rz2XRMGm.js +0 -853
  24. package/dist/Text-DVSAPY-K.js +0 -16
  25. package/dist/VisuallyHidden-f9zX67a_.js +0 -48
  26. package/dist/_commonjsHelpers-CUmg6egw.js +0 -6
  27. package/dist/assets/index.css +0 -37
  28. package/dist/assets/style-admin.css +0 -5255
  29. package/dist/assets/style-editor.css +0 -5255
  30. package/dist/assets/style.css +0 -5261
  31. package/dist/assets/wp-font-enhancements.css +0 -8
  32. package/dist/assets/wp-ui-enhancements.css +0 -299
  33. package/dist/components/animated-visibility/animated-visibility.js +0 -105
  34. package/dist/components/base-control/base-control.js +0 -86
  35. package/dist/components/breakpoint-preview/breakpoint-preview.js +0 -161
  36. package/dist/components/button/button.js +0 -387
  37. package/dist/components/checkbox/checkbox.js +0 -320
  38. package/dist/components/color-pickers/color-picker.js +0 -272
  39. package/dist/components/color-pickers/color-swatch.js +0 -58
  40. package/dist/components/color-pickers/gradient-editor.js +0 -534
  41. package/dist/components/color-pickers/solid-color-picker.js +0 -1567
  42. package/dist/components/component-toggle/component-toggle.js +0 -158
  43. package/dist/components/container-panel/container-panel.js +0 -131
  44. package/dist/components/draggable/draggable-context.js +0 -5
  45. package/dist/components/draggable/draggable-handle.js +0 -46
  46. package/dist/components/draggable/draggable.js +0 -6207
  47. package/dist/components/draggable-list/draggable-list-context.js +0 -5
  48. package/dist/components/draggable-list/draggable-list-item.js +0 -77
  49. package/dist/components/draggable-list/draggable-list.js +0 -151
  50. package/dist/components/expandable/expandable.js +0 -342
  51. package/dist/components/index.js +0 -137
  52. package/dist/components/input-field/input-field.js +0 -231
  53. package/dist/components/item-collection/item-collection.js +0 -59
  54. package/dist/components/layout/hstack.js +0 -30
  55. package/dist/components/layout/vstack.js +0 -30
  56. package/dist/components/link-input/link-input.js +0 -293
  57. package/dist/components/matrix-align/matrix-align.js +0 -134
  58. package/dist/components/menu/menu.js +0 -285
  59. package/dist/components/modal/modal.js +0 -305
  60. package/dist/components/notice/notice.js +0 -123
  61. package/dist/components/number-picker/number-picker.js +0 -292
  62. package/dist/components/option-select/option-select.js +0 -264
  63. package/dist/components/options-panel/options-panel.js +0 -158
  64. package/dist/components/placeholders/file-placeholder.js +0 -42
  65. package/dist/components/placeholders/image-placeholder.js +0 -88
  66. package/dist/components/placeholders/media-placeholder.js +0 -63
  67. package/dist/components/popover/popover.js +0 -207
  68. package/dist/components/radio/radio.js +0 -579
  69. package/dist/components/repeater/repeater-context.js +0 -5
  70. package/dist/components/repeater/repeater-item.js +0 -119
  71. package/dist/components/repeater/repeater.js +0 -280
  72. package/dist/components/responsive/mini-responsive.js +0 -498
  73. package/dist/components/responsive/responsive-legacy.js +0 -343
  74. package/dist/components/responsive/responsive.js +0 -580
  75. package/dist/components/responsive-preview/responsive-preview.js +0 -123
  76. package/dist/components/rich-label/rich-label.js +0 -66
  77. package/dist/components/select/async-multi-select.js +0 -157
  78. package/dist/components/select/async-single-select.js +0 -137
  79. package/dist/components/select/custom-select-default-components.js +0 -38
  80. package/dist/components/select/multi-select-components.js +0 -8
  81. package/dist/components/select/multi-select.js +0 -151
  82. package/dist/components/select/react-select-component-wrappers.js +0 -90
  83. package/dist/components/select/shared.js +0 -26
  84. package/dist/components/select/single-select.js +0 -131
  85. package/dist/components/select/styles.js +0 -49
  86. package/dist/components/select/v2/async-select.js +0 -297
  87. package/dist/components/select/v2/shared.js +0 -24
  88. package/dist/components/select/v2/single-select.js +0 -990
  89. package/dist/components/slider/column-config-slider.js +0 -210
  90. package/dist/components/slider/slider.js +0 -343
  91. package/dist/components/slider/utils.js +0 -84
  92. package/dist/components/spacer/spacer.js +0 -97
  93. package/dist/components/tabs/tabs.js +0 -702
  94. package/dist/components/toggle/switch.js +0 -155
  95. package/dist/components/toggle/toggle.js +0 -64
  96. package/dist/components/toggle-button/toggle-button.js +0 -324
  97. package/dist/components/tooltip/tooltip.js +0 -525
  98. package/dist/context-D2KUdwNL.js +0 -92
  99. package/dist/default-i18n-CT_oS1Fy.js +0 -922
  100. package/dist/filterDOMProps-EDDcM64A.js +0 -28
  101. package/dist/icons/block-icon.js +0 -42
  102. package/dist/icons/generic-color-swatch.js +0 -113
  103. package/dist/icons/icons.js +0 -30371
  104. package/dist/icons/index.js +0 -11
  105. package/dist/icons/jsx-svg.js +0 -50
  106. package/dist/index-641ee5b8.esm-BPz6U6sJ.js +0 -3137
  107. package/dist/index-BKGQ6jGS.js +0 -44
  108. package/dist/index-BYHhzLf-.js +0 -444
  109. package/dist/index.js +0 -139
  110. package/dist/lite-DVmmD_-j.js +0 -7
  111. package/dist/modifiers.esm-BuJQPI1X.js +0 -31
  112. package/dist/multi-select-components-BlZZoNXC.js +0 -3744
  113. package/dist/number-GajL10e1.js +0 -36
  114. package/dist/react-jsx-parser.min-DZCiis5V.js +0 -11753
  115. package/dist/react-select-async.esm-CwUoej5h.js +0 -107
  116. package/dist/react-select.esm-DcwYxadV.js +0 -15
  117. package/dist/style-admin.js +0 -1
  118. package/dist/style-editor.js +0 -1
  119. package/dist/style.js +0 -1
  120. package/dist/textSelection-0UUS8Yfg.js +0 -46
  121. package/dist/useButton-BpOKDWEN.js +0 -71
  122. package/dist/useEvent-B0b-6KBr.js +0 -23
  123. package/dist/useFocusRing-CV5l3lf6.js +0 -107
  124. package/dist/useFormReset-C5OggHsw.js +0 -22
  125. package/dist/useFormValidation-DhDNSjws.js +0 -224
  126. package/dist/useHover-DwDr6ozG.js +0 -900
  127. package/dist/useLabel-D7HkNEHT.js +0 -27
  128. package/dist/useLabels-D8cxd1Z8.js +0 -23
  129. package/dist/useListState-UGlN5-7P.js +0 -161
  130. package/dist/useLocalizedStringFormatter-CFP1YZWQ.js +0 -121
  131. package/dist/useNumberField-CEAj7Mrj.js +0 -1204
  132. package/dist/useNumberFormatter-321rAb4J.js +0 -13
  133. package/dist/usePress-DNW8qpY6.js +0 -664
  134. package/dist/useSingleSelectListState-DC0wWTUM.js +0 -38
  135. package/dist/useToggle-BrpmSOB-.js +0 -59
  136. package/dist/useToggleState-CmQX3SoX.js +0 -19
  137. package/dist/utilities/array-helpers.js +0 -56
  138. package/dist/utilities/debounce-throttle.js +0 -123
  139. package/dist/utilities/es-dash.js +0 -376
  140. package/dist/utilities/index.js +0 -27
  141. package/dist/utilities/text-helpers.js +0 -136
  142. package/dist/utils-DkCSC521.js +0 -370
  143. package/dist/wp/wp-font-enhancements.js +0 -1
  144. package/dist/wp/wp-ui-enhancements.js +0 -1
@@ -1,158 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { s as sprintf, _ as __ } 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 {boolean} [props.hidden] - If `true`, the component is not rendered.
33
- *
34
- * @returns {JSX.Element} The ComponentToggle component.
35
- *
36
- * @typedef {'default' | 'compact' | 'compactLabel' | 'compactIcon'} ComponentToggleDesign
37
- *
38
- * @example
39
- * <ComponentToggle
40
- * label='My component'
41
- * useComponent={useComponent}
42
- * onChange={setUseComponent}
43
- * >
44
- * ...
45
- * </ComponentToggle>
46
- *
47
- * @preserve
48
- */
49
- const ComponentToggle = (props) => {
50
- const {
51
- children,
52
- icon,
53
- label,
54
- subtitle,
55
- useComponent,
56
- onChange,
57
- noLabel,
58
- noUseToggle,
59
- noExpandButton,
60
- controlOnly,
61
- expandButtonDisabled,
62
- hideUseToggleOnExpand,
63
- contentClassName = "es:space-y-2.5",
64
- design = "default",
65
- hidden
66
- } = props;
67
- if (hidden) {
68
- return null;
69
- }
70
- if (controlOnly || noLabel && noUseToggle && noExpandButton) {
71
- return children;
72
- }
73
- if (design.startsWith("compact")) {
74
- const optionsLabel = sprintf(__("%s options", "eightshift-ui-components"), label);
75
- const hasIcon = design === "compact" || design === "compactIcon";
76
- const hasLabel = design === "compact" || design === "compactLabel";
77
- return /* @__PURE__ */ jsxs(ButtonGroup, { children: [
78
- /* @__PURE__ */ jsx(
79
- ToggleButton,
80
- {
81
- icon: hasIcon && (icon ?? icons.componentGeneric),
82
- tooltip: hasIcon && !noLabel && label,
83
- selected: useComponent,
84
- onChange,
85
- children: hasLabel && label
86
- }
87
- ),
88
- /* @__PURE__ */ jsxs(
89
- TriggeredPopover,
90
- {
91
- triggerButtonProps: {
92
- className: "es:w-5.5 es:stroke-[1.25]",
93
- tooltip: optionsLabel,
94
- disabled: !useComponent
95
- },
96
- triggerButtonIcon: icons.dropdownCaretAlt,
97
- className: clsx("es:w-[18.5rem] es:p-2", contentClassName),
98
- children: [
99
- /* @__PURE__ */ jsx(Spacer, { text: optionsLabel }),
100
- children
101
- ]
102
- }
103
- )
104
- ] });
105
- }
106
- if (noExpandButton) {
107
- return /* @__PURE__ */ jsxs(
108
- BaseControl,
109
- {
110
- icon: icon ?? icons.componentGeneric,
111
- label: !noLabel && label,
112
- subtitle,
113
- actions: !noUseToggle && /* @__PURE__ */ jsx(
114
- Switch,
115
- {
116
- checked: useComponent,
117
- onChange
118
- }
119
- ),
120
- disabled: !useComponent || expandButtonDisabled,
121
- children: [
122
- noUseToggle && children,
123
- !noUseToggle && /* @__PURE__ */ jsx(
124
- AnimatedVisibility,
125
- {
126
- visible: useComponent,
127
- className: contentClassName,
128
- noInitial: true,
129
- children
130
- }
131
- )
132
- ]
133
- }
134
- );
135
- }
136
- return /* @__PURE__ */ jsx(
137
- Expandable,
138
- {
139
- icon: icon ?? icons.componentGeneric,
140
- label: !noLabel && label,
141
- subtitle,
142
- keepActionsOnExpand: !hideUseToggleOnExpand,
143
- actions: !noUseToggle && /* @__PURE__ */ jsx(
144
- Switch,
145
- {
146
- checked: useComponent,
147
- onChange
148
- }
149
- ),
150
- disabled: !useComponent || expandButtonDisabled,
151
- noFocusHandling: true,
152
- children: !expandButtonDisabled && /* @__PURE__ */ jsx("div", { className: contentClassName, children })
153
- }
154
- );
155
- };
156
- export {
157
- ComponentToggle
158
- };
@@ -1,131 +0,0 @@
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
- };
@@ -1,5 +0,0 @@
1
- import { createContext } from "react";
2
- const DraggableContext = createContext();
3
- export {
4
- DraggableContext
5
- };
@@ -1,46 +0,0 @@
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
- };