@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,320 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { a as $4e85f108e88277b8$export$b085522c77523c51 } from "../../RSPContexts-2lR5GG9p.js";
3
- import { d as $3ef42575df84b30b$export$9d1611c77c2fe928, a as $64fa3d84918910a7$export$29f1550f4b0d4415, $ as $64fa3d84918910a7$export$fabf2dc03a41866e, l as $df56164dff5785e2$export$4338b53315abf666, m as $5dc95899b306f630$export$c9058316764c140e, h as $64fa3d84918910a7$export$ef03459518577ad4, b as $64fa3d84918910a7$export$4d86445c2cf5e3 } from "../../utils-DkCSC521.js";
4
- import { $ as $d3e0e05bdfcf66bd$export$c24727297075ec6a } from "../../Form-Cq3fu75_.js";
5
- import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-EDDcM64A.js";
6
- import React__default, { useEffect, useRef, forwardRef, useContext, createContext } from "react";
7
- import { $ as $e5be200c675c3b3a$export$fc1a364ae1f3ff10, a as $e93e671b31057976$export$b8473d3665f3a75a, b as $e5be200c675c3b3a$export$a763b9476acd3eb, c as $e5be200c675c3b3a$export$dad6ae84456c676a } from "../../useFormValidation-DhDNSjws.js";
8
- import { $ as $f6c31cce2adf654f$export$45712eceda6fad21 } from "../../usePress-DNW8qpY6.js";
9
- import { $ as $d2c8e2b0480f3f34$export$cbe85ee05b554577 } from "../../useToggle-BrpmSOB-.js";
10
- import { $ as $3017fa7ffdddec74$export$8042c6c013fd5226 } from "../../useToggleState-CmQX3SoX.js";
11
- import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "../../useFocusRing-CV5l3lf6.js";
12
- import { $ as $6179b936705e76d3$export$ae780daf29e6d456 } from "../../useHover-DwDr6ozG.js";
13
- import { $ as $5c3e21d68f1c4674$export$439d29a4e110a164 } from "../../VisuallyHidden-f9zX67a_.js";
14
- import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-icmbmNdI.js";
15
- import { c as clsx } from "../../lite-DVmmD_-j.js";
16
- import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
17
- import { icons } from "../../icons/icons.js";
18
- import { RichLabel } from "../rich-label/rich-label.js";
19
- function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) {
20
- let validationState = $e5be200c675c3b3a$export$fc1a364ae1f3ff10({
21
- ...props,
22
- value: state.isSelected
23
- });
24
- let { isInvalid, validationErrors, validationDetails } = validationState.displayValidation;
25
- let { labelProps, inputProps, isSelected, isPressed, isDisabled, isReadOnly } = $d2c8e2b0480f3f34$export$cbe85ee05b554577({
26
- ...props,
27
- isInvalid
28
- }, state, inputRef);
29
- $e93e671b31057976$export$b8473d3665f3a75a(props, validationState, inputRef);
30
- let { isIndeterminate, isRequired, validationBehavior = "aria" } = props;
31
- useEffect(() => {
32
- if (inputRef.current) inputRef.current.indeterminate = !!isIndeterminate;
33
- });
34
- let { pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21({
35
- isDisabled: isDisabled || isReadOnly,
36
- onPress() {
37
- let { [$e5be200c675c3b3a$export$a763b9476acd3eb]: groupValidationState } = props;
38
- let { commitValidation } = groupValidationState ? groupValidationState : validationState;
39
- commitValidation();
40
- }
41
- });
42
- return {
43
- labelProps: $3ef42575df84b30b$export$9d1611c77c2fe928(labelProps, pressProps),
44
- inputProps: {
45
- ...inputProps,
46
- checked: isSelected,
47
- "aria-required": isRequired && validationBehavior === "aria" || void 0,
48
- required: isRequired && validationBehavior === "native"
49
- },
50
- isSelected,
51
- isPressed,
52
- isDisabled,
53
- isReadOnly,
54
- isInvalid,
55
- validationErrors,
56
- validationDetails
57
- };
58
- }
59
- const $1ae600c947479353$export$ec98120685d4f57d = /* @__PURE__ */ new WeakMap();
60
- function $fba3e38d5ca8983f$export$353b32fc6898d37d(props, state, inputRef) {
61
- const toggleState = $3017fa7ffdddec74$export$8042c6c013fd5226({
62
- isReadOnly: props.isReadOnly || state.isReadOnly,
63
- isSelected: state.isSelected(props.value),
64
- onChange(isSelected) {
65
- if (isSelected) state.addValue(props.value);
66
- else state.removeValue(props.value);
67
- if (props.onChange) props.onChange(isSelected);
68
- }
69
- });
70
- let { name, descriptionId, errorMessageId, validationBehavior } = $1ae600c947479353$export$ec98120685d4f57d.get(state);
71
- var _props_validationBehavior;
72
- validationBehavior = (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : validationBehavior;
73
- let { realtimeValidation } = $e5be200c675c3b3a$export$fc1a364ae1f3ff10({
74
- ...props,
75
- value: toggleState.isSelected,
76
- // Server validation is handled at the group level.
77
- name: void 0,
78
- validationBehavior: "aria"
79
- });
80
- let nativeValidation = useRef($e5be200c675c3b3a$export$dad6ae84456c676a);
81
- let updateValidation = () => {
82
- state.setInvalid(props.value, realtimeValidation.isInvalid ? realtimeValidation : nativeValidation.current);
83
- };
84
- useEffect(updateValidation);
85
- let combinedRealtimeValidation = state.realtimeValidation.isInvalid ? state.realtimeValidation : realtimeValidation;
86
- let displayValidation = validationBehavior === "native" ? state.displayValidation : combinedRealtimeValidation;
87
- var _props_isRequired;
88
- let res = $406796ff087fe49b$export$e375f10ce42261c5({
89
- ...props,
90
- isReadOnly: props.isReadOnly || state.isReadOnly,
91
- isDisabled: props.isDisabled || state.isDisabled,
92
- name: props.name || name,
93
- isRequired: (_props_isRequired = props.isRequired) !== null && _props_isRequired !== void 0 ? _props_isRequired : state.isRequired,
94
- validationBehavior,
95
- [$e5be200c675c3b3a$export$a763b9476acd3eb]: {
96
- realtimeValidation: combinedRealtimeValidation,
97
- displayValidation,
98
- resetValidation: state.resetValidation,
99
- commitValidation: state.commitValidation,
100
- updateValidation(v) {
101
- nativeValidation.current = v;
102
- updateValidation();
103
- }
104
- }
105
- }, toggleState, inputRef);
106
- return {
107
- ...res,
108
- inputProps: {
109
- ...res.inputProps,
110
- "aria-describedby": [
111
- props["aria-describedby"],
112
- state.isInvalid ? errorMessageId : null,
113
- descriptionId
114
- ].filter(Boolean).join(" ") || void 0
115
- }
116
- };
117
- }
118
- const $bc237834342dbd75$export$139c5b8563afc1fc = /* @__PURE__ */ createContext(null);
119
- const $bc237834342dbd75$export$48513f6b9f8ce62d = /* @__PURE__ */ forwardRef(function Checkbox(props, ref) {
120
- let { inputRef: userProvidedInputRef = null, ...otherProps } = props;
121
- [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(otherProps, ref, $4e85f108e88277b8$export$b085522c77523c51);
122
- let { validationBehavior: formValidationBehavior } = $64fa3d84918910a7$export$fabf2dc03a41866e($d3e0e05bdfcf66bd$export$c24727297075ec6a) || {};
123
- var _props_validationBehavior, _ref;
124
- let validationBehavior = (_ref = (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : formValidationBehavior) !== null && _ref !== void 0 ? _ref : "native";
125
- let groupState = useContext($bc237834342dbd75$export$139c5b8563afc1fc);
126
- let inputRef = $df56164dff5785e2$export$4338b53315abf666($5dc95899b306f630$export$c9058316764c140e(userProvidedInputRef, props.inputRef !== void 0 ? props.inputRef : null));
127
- let { labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed, isInvalid } = groupState ? $fba3e38d5ca8983f$export$353b32fc6898d37d({
128
- ...$64fa3d84918910a7$export$ef03459518577ad4(props),
129
- // Value is optional for standalone checkboxes, but required for CheckboxGroup items;
130
- // it's passed explicitly here to avoid typescript error (requires ignore).
131
- // @ts-ignore
132
- value: props.value,
133
- // ReactNode type doesn't allow function children.
134
- children: typeof props.children === "function" ? true : props.children
135
- }, groupState, inputRef) : $406796ff087fe49b$export$e375f10ce42261c5({
136
- ...$64fa3d84918910a7$export$ef03459518577ad4(props),
137
- children: typeof props.children === "function" ? true : props.children,
138
- validationBehavior
139
- }, $3017fa7ffdddec74$export$8042c6c013fd5226(props), inputRef);
140
- let { isFocused, isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f();
141
- let isInteractionDisabled = isDisabled || isReadOnly;
142
- let { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456({
143
- ...props,
144
- isDisabled: isInteractionDisabled
145
- });
146
- let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
147
- ...props,
148
- defaultClassName: "react-aria-Checkbox",
149
- values: {
150
- isSelected,
151
- isIndeterminate: props.isIndeterminate || false,
152
- isPressed,
153
- isHovered,
154
- isFocused,
155
- isFocusVisible,
156
- isDisabled,
157
- isReadOnly,
158
- isInvalid,
159
- isRequired: props.isRequired || false
160
- }
161
- });
162
- let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
163
- delete DOMProps.id;
164
- return /* @__PURE__ */ React__default.createElement("label", {
165
- ...$3ef42575df84b30b$export$9d1611c77c2fe928(DOMProps, labelProps, hoverProps, renderProps),
166
- ref,
167
- slot: props.slot || void 0,
168
- "data-selected": isSelected || void 0,
169
- "data-indeterminate": props.isIndeterminate || void 0,
170
- "data-pressed": isPressed || void 0,
171
- "data-hovered": isHovered || void 0,
172
- "data-focused": isFocused || void 0,
173
- "data-focus-visible": isFocusVisible || void 0,
174
- "data-disabled": isDisabled || void 0,
175
- "data-readonly": isReadOnly || void 0,
176
- "data-invalid": isInvalid || void 0,
177
- "data-required": props.isRequired || void 0
178
- }, /* @__PURE__ */ React__default.createElement($5c3e21d68f1c4674$export$439d29a4e110a164, {
179
- elementType: "span"
180
- }, /* @__PURE__ */ React__default.createElement("input", {
181
- ...$3ef42575df84b30b$export$9d1611c77c2fe928(inputProps, focusProps),
182
- ref: inputRef
183
- })), renderProps.children);
184
- });
185
- /**
186
- * A simple checkbox.
187
- *
188
- * @component
189
- * @param {Object} props - Component props.
190
- * @param {JSX.Element} [props.icon] - The checkbox icon.
191
- * @param {string} [props.label] - The checkbox label.
192
- * @param {string} [props.subtitle] - The checkbox subtitle.
193
- * @param {boolean} props.checked - Whether the checkbox is checked.
194
- * @param {boolean} [props.disabled] - Whether the checkbox is disabled.
195
- * @param {boolean} [props.readOnly] - Whether the checkbox is read-only.
196
- * @param {boolean} [props.indeterminate] - Whether the checkbox is in an indeterminate state.
197
- * @param {Function} props.onChange - The function to call when the checkbox is changed.
198
- * @param {string} [props.className] - Additional classes to add to the checkbox container.
199
- * @param {string} [props.labelClassName] - Additional classes to add to the label container.
200
- * @param {boolean} [props.alignEnd] - Whether the label should be aligned to the end.
201
- * @param {boolean} [props.inlineSubtitle] - If `true`, the subtitle is shown after the label instead of below it.
202
- * @param {boolean} [props.hidden] - If `true`, the component is not rendered.
203
- *
204
- * @returns {JSX.Element} The Checkbox component.
205
- *
206
- * @example
207
- * <Checkbox
208
- * label='My label'
209
- * checked={myValue}
210
- * onChange={(value) => setMyValue(value)}
211
- * />
212
- *
213
- * @preserve
214
- */
215
- const Checkbox2 = (props) => {
216
- const {
217
- icon,
218
- label,
219
- subtitle,
220
- checked,
221
- disabled,
222
- readOnly,
223
- indeterminate,
224
- onChange,
225
- className,
226
- labelClassName,
227
- inlineSubtitle,
228
- alignEnd,
229
- children,
230
- hidden,
231
- ...other
232
- } = props;
233
- if (hidden) {
234
- return null;
235
- }
236
- const selectedOrIntermediate = checked || indeterminate;
237
- return /* @__PURE__ */ jsxs(
238
- $bc237834342dbd75$export$48513f6b9f8ce62d,
239
- {
240
- isDisabled: disabled,
241
- isIndeterminate: indeterminate,
242
- isReadOnly: readOnly,
243
- isSelected: checked ?? false,
244
- onChange,
245
- className: clsx("es:group es:flex es:w-full es:items-center es:gap-1.5 es:text-sm", className),
246
- ...other,
247
- children: [
248
- (icon || alignEnd) && (label || subtitle) && /* @__PURE__ */ jsx(
249
- RichLabel,
250
- {
251
- icon,
252
- label,
253
- subtitle,
254
- className: clsx("es:ml-1", labelClassName),
255
- inlineSubtitle,
256
- fullSizeSubtitle: true,
257
- fullWidth: true,
258
- as: $01b77f81d0f07f68$export$b04be29aa201d4f5
259
- }
260
- ),
261
- /* @__PURE__ */ jsxs(
262
- "div",
263
- {
264
- className: clsx(
265
- "es:size-5 es:flex es:items-center es:justify-center",
266
- "es:transition es:cursor-pointer",
267
- "es:bg-radial es:border es:rounded-md",
268
- "es:shadow-xs es:inset-ring es:inset-shadow-xs",
269
- "es:any-focus:outline-hidden es:group-focus-visible:ring-2 es:group-focus-visible:ring-accent-500/50",
270
- !selectedOrIntermediate && "es:group-focus-visible:border-accent-500",
271
- !selectedOrIntermediate && "es:border-secondary-300 es:inset-ring-secondary-100 es:inset-shadow-secondary-100/50",
272
- !selectedOrIntermediate && "es:from-secondary-50 es:to-white es:text-secondary-600 es:hover:text-accent-950",
273
- !selectedOrIntermediate && "es:hover:inset-shadow-secondary-100 es:hover:to-secondary-100 es:hover:inset-ring-secondary-100",
274
- selectedOrIntermediate && "es:text-white es:from-accent-500 es:to-accent-600",
275
- selectedOrIntermediate && "es:shadow-accent-600/30 es:border-accent-700 es:inset-ring es:inset-ring-accent-600 es:inset-shadow-accent-400/75",
276
- selectedOrIntermediate && "es:group-focus-visible:inset-ring-accent-600 es:group-focus-visible:inset-shadow-xs es:group-focus-visible:inset-shadow-accent-400",
277
- !alignEnd && subtitle && "es:mb-auto"
278
- ),
279
- children: [
280
- /* @__PURE__ */ jsx(
281
- AnimatedVisibility,
282
- {
283
- transition: "scaleFade",
284
- visible: indeterminate,
285
- className: "es:transition-none",
286
- children: /* @__PURE__ */ jsx("div", { className: "es:h-0.5 es:w-3 es:rounded es:bg-white" })
287
- }
288
- ),
289
- /* @__PURE__ */ jsx(
290
- AnimatedVisibility,
291
- {
292
- transition: "scaleRotateFade",
293
- visible: !indeterminate && checked,
294
- className: "es:transition-none es:icon:size-3 es:icon:stroke-3",
295
- noInitial: true,
296
- children: icons.check
297
- }
298
- )
299
- ]
300
- }
301
- ),
302
- !icon && !alignEnd && (label || subtitle) && /* @__PURE__ */ jsx(
303
- RichLabel,
304
- {
305
- label,
306
- subtitle,
307
- className: clsx(subtitle && "es:mt-0.5", "es:ml-0.5 es:*:space-y-0.5", labelClassName),
308
- inlineSubtitle,
309
- fullSizeSubtitle: true,
310
- as: $01b77f81d0f07f68$export$b04be29aa201d4f5
311
- }
312
- ),
313
- !(icon || label || subtitle) && children
314
- ]
315
- }
316
- );
317
- };
318
- export {
319
- Checkbox2 as Checkbox
320
- };
@@ -1,272 +0,0 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { _ as __ } from "../../default-i18n-CT_oS1Fy.js";
3
- import { Menu, MenuItem, MenuSeparator, MenuSection } from "../menu/menu.js";
4
- import { ColorSwatch } from "./color-swatch.js";
5
- import { RichLabel } from "../rich-label/rich-label.js";
6
- import { BaseControl } from "../base-control/base-control.js";
7
- import { c as clsx } from "../../lite-DVmmD_-j.js";
8
- import { icons } from "../../icons/icons.js";
9
- /**
10
- * Color picker.
11
- *
12
- * @component
13
- * @param {Object} props - Component props.
14
- * @param {string} [props.icon] - Icon to display.
15
- * @param {string} [props.label] - Label to display.
16
- * @param {string} [props.subtitle] - Subtitle to display.
17
- * @param {string} [props.labelClassName] - Additional clsx passed to the label.
18
- * @param {string} props.value - Selected value.
19
- * @param {Function} props.onChange - Function to run when the value changes.
20
- * @param {Object[]} props.colors - Colors to display.
21
- * @param {string} props.colors[].name - Color name.
22
- * @param {string} props.colors[].slug - Color slug.
23
- * @param {string} props.colors[].color - Color value (HEX, RGB, HSL, HSB).
24
- * @param {boolean} [props.showColorCode] - If `true`, the HEX color code is shown below the color name.
25
- * @param {boolean} [props.noColorGroups] - If `true`, colors won't be grouped by shades.
26
- * @param {ColorPickerType} props.type - Type of the color picker. Affects the icon and tooltip.
27
- * @param {boolean} [props.clearable] - If `true`, the picked color can be removed.
28
- * @param {boolean} [props.stacked] - If `true`, the control is not rendered inline.
29
- * @param {boolean} [props.hidden] - If `true`, the component is not rendered.
30
- * @param {string} [props.tooltip] - If provided, overrides the default tooltip text. If there is no label, the value will still be shown within the tooltip.
31
- * @param {string} [props.clearItemLabel] - Label for the "None" item, if `clearable` is enabled.
32
- * @param {JSX.Element|JSX.Element[]} [props.extraOptions] - If `type` is `menu`, allows passing additional menu items, which will be displayed below the options.
33
- *
34
- * @returns {JSX.Element} The ColorPicker component.
35
- *
36
- * @typedef {'default' | 'fillColor' | 'textColor' | 'textHighlightColor' | 'listMarkerColor'} ColorPickerType
37
- *
38
- * @example
39
- * <ColorPicker
40
- * icon={icons.fillColor}
41
- * label={__('Fill color', 'eightshift-ui-components')}
42
- * subtitle={__('Select fill color', 'eightshift-ui-components')}
43
- * value={fillColor}
44
- * onChange={(value) => setAttributes({ fillColor: value })}
45
- * colors={[
46
- * { name: 'Red', slug: 'red', color: '#ff0000' },
47
- * { name: 'Green', slug: 'green', color: '#00ff00' },
48
- * { name: 'Blue', slug: 'blue', color: '#0000ff' },
49
- * ]}
50
- * />
51
- *
52
- * @preserve
53
- */
54
- const ColorPicker = (props) => {
55
- var _a, _b;
56
- const {
57
- icon,
58
- label,
59
- subtitle,
60
- labelClassName,
61
- value,
62
- onChange,
63
- colors,
64
- showColorCode,
65
- noColorGroups,
66
- type = "default",
67
- stacked,
68
- clearable,
69
- clearItemLabel = __("None", "eightshift-ui-components"),
70
- hidden,
71
- tooltip,
72
- extraOptions,
73
- ...rest
74
- } = props;
75
- if (hidden) {
76
- return null;
77
- }
78
- const currentColor = (_a = colors == null ? void 0 : colors.find(({ slug }) => slug === value)) == null ? void 0 : _a.color;
79
- const colorSuffixRegex = /(?!^.+)(-?(?:50|100|200|300|400|500|600|700|800|900|950|10|20|30|40|50|60|70|80|90){1})$/gi;
80
- const hasColorGroups = !noColorGroups && (colors == null ? void 0 : colors.some(({ slug }) => colorSuffixRegex.test(slug)));
81
- let groupedColors;
82
- const colorGroupNames = {
83
- generic: __("Other colors", "eightshift-ui-components")
84
- };
85
- if (hasColorGroups) {
86
- groupedColors = colors.reduce(
87
- (output, current) => {
88
- var _a2;
89
- if (current === void 0 || (current == null ? void 0 : current.name) === void 0 || (current == null ? void 0 : current.slug) === void 0) {
90
- return output;
91
- }
92
- if ((_a2 = current.slug.match(colorSuffixRegex)) == null ? void 0 : _a2.length) {
93
- const newSlug = current.slug.replace(colorSuffixRegex, "").trim();
94
- if (!output[newSlug]) {
95
- output[newSlug] = [];
96
- colorGroupNames[newSlug] = current.name.replace(colorSuffixRegex, "").trim();
97
- }
98
- output[newSlug] = [
99
- ...output[newSlug],
100
- {
101
- ...current,
102
- shade: current.slug.match(colorSuffixRegex)[0].replace("-", "")
103
- }
104
- ];
105
- } else {
106
- output.generic = [...output.generic, current];
107
- }
108
- return output;
109
- },
110
- { generic: [] }
111
- );
112
- }
113
- const SingleItem = ({ name, slug, color, ...rest2 }) => /* @__PURE__ */ jsxs(
114
- MenuItem,
115
- {
116
- ...rest2,
117
- endIcon: /* @__PURE__ */ jsx(
118
- ColorSwatch,
119
- {
120
- className: "es:size-5.5!",
121
- color
122
- }
123
- ),
124
- onClick: () => onChange(slug),
125
- selected: value === slug,
126
- children: [
127
- !showColorCode && name.replaceAll("-", " "),
128
- showColorCode && /* @__PURE__ */ jsx(
129
- RichLabel,
130
- {
131
- label: name.replaceAll("-", " "),
132
- subtitle: color.toUpperCase()
133
- }
134
- )
135
- ]
136
- }
137
- );
138
- let tooltipText;
139
- let menuTriggerIcon;
140
- if (type === "default") {
141
- tooltipText = __("Color", "eightshift-ui-components");
142
- } else if (type === "fillColor") {
143
- tooltipText = __("Fill color", "eightshift-ui-components");
144
- menuTriggerIcon = icons.colorPickerFill;
145
- } else if (type === "textColor") {
146
- tooltipText = __("Text color", "eightshift-ui-components");
147
- menuTriggerIcon = icons.colorPickerText;
148
- } else if (type === "textHighlightColor") {
149
- tooltipText = __("Text highlight color", "eightshift-ui-components");
150
- menuTriggerIcon = icons.colorPickerTextHighlight;
151
- } else if (type === "listMarkerColor") {
152
- tooltipText = __("List marker color", "eightshift-ui-components");
153
- menuTriggerIcon = icons.colorPickerListMarker;
154
- }
155
- const currentColorName = (_b = colors == null ? void 0 : colors.find((color) => (color == null ? void 0 : color.slug) === value)) == null ? void 0 : _b.name;
156
- if (!label && tooltipText) {
157
- tooltipText = /* @__PURE__ */ jsx(
158
- RichLabel,
159
- {
160
- label: tooltipText,
161
- subtitle: currentColorName,
162
- noColor: true
163
- }
164
- );
165
- } else if (!label && tooltip) {
166
- tooltipText = /* @__PURE__ */ jsx(
167
- RichLabel,
168
- {
169
- label: tooltip,
170
- subtitle: currentColorName,
171
- noColor: true
172
- }
173
- );
174
- } else if (label) {
175
- tooltipText = currentColorName;
176
- }
177
- return /* @__PURE__ */ jsx(
178
- BaseControl,
179
- {
180
- icon,
181
- label,
182
- subtitle,
183
- className: clsx("es:w-full", labelClassName),
184
- inline: !stacked,
185
- children: /* @__PURE__ */ jsxs(
186
- Menu,
187
- {
188
- triggerIcon: /* @__PURE__ */ jsxs(Fragment, { children: [
189
- (type === "default" || icon) && /* @__PURE__ */ jsx(
190
- ColorSwatch,
191
- {
192
- color: currentColor,
193
- className: "es:size-6! es:shadow-none!"
194
- }
195
- ),
196
- !icon && type !== "default" && /* @__PURE__ */ jsxs("div", { className: "es:relative es:size-6 es:icon:absolute es:icon:inset-0 es:icon:size-full", children: [
197
- menuTriggerIcon,
198
- /* @__PURE__ */ jsx(
199
- ColorSwatch,
200
- {
201
- color: currentColor,
202
- className: "es:absolute es:-bottom-0.5 es:left-0 es:h-2! es:shadow-none!"
203
- }
204
- )
205
- ] })
206
- ] }),
207
- keepOpen: true,
208
- tooltip: tooltipText,
209
- triggerProps: {
210
- ...rest.triggerProps,
211
- "aria-label": typeof label !== "undefined" ? null : props == null ? void 0 : props["aria-label"]
212
- },
213
- ...rest,
214
- children: [
215
- clearable && /* @__PURE__ */ jsxs(Fragment, { children: [
216
- /* @__PURE__ */ jsx(
217
- MenuItem,
218
- {
219
- onClick: () => onChange(void 0),
220
- selected: typeof value === "undefined",
221
- endIcon: /* @__PURE__ */ jsx(ColorSwatch, { className: "es:size-5.5!" }),
222
- children: clearItemLabel
223
- }
224
- ),
225
- /* @__PURE__ */ jsx(MenuSeparator, {})
226
- ] }),
227
- (noColorGroups || !hasColorGroups) && colors.map((color) => /* @__PURE__ */ jsx(
228
- SingleItem,
229
- {
230
- ...color
231
- },
232
- color.slug
233
- )),
234
- hasColorGroups && /* @__PURE__ */ jsxs(Fragment, { children: [
235
- Object.entries(groupedColors).map(([groupSlug, colors2]) => {
236
- if (groupSlug === "generic") {
237
- return null;
238
- }
239
- return /* @__PURE__ */ jsx(
240
- MenuSection,
241
- {
242
- "aria-label": colorGroupNames[groupSlug],
243
- children: colors2.map((color) => /* @__PURE__ */ jsx(
244
- SingleItem,
245
- {
246
- ...color
247
- },
248
- color.slug
249
- ))
250
- },
251
- groupSlug
252
- );
253
- }),
254
- groupedColors.generic.length > 0 && /* @__PURE__ */ jsx(MenuSection, { "aria-label": colorGroupNames.generic, children: groupedColors.generic.map((color) => /* @__PURE__ */ jsx(
255
- SingleItem,
256
- {
257
- ...color
258
- },
259
- color.slug
260
- )) })
261
- ] }),
262
- extraOptions && /* @__PURE__ */ jsx(MenuSeparator, {}),
263
- extraOptions
264
- ]
265
- }
266
- )
267
- }
268
- );
269
- };
270
- export {
271
- ColorPicker
272
- };
@@ -1,58 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { $ as $251c695a52d94a8d$export$cae13e90592f246a } from "../../ColorSwatch-BqQfVu4L.js";
3
- import { c as clsx } from "../../lite-DVmmD_-j.js";
4
- import { _ as __ } from "../../default-i18n-CT_oS1Fy.js";
5
- import { $ as $799cddbef784668f$export$6e865ea70d7724f } from "../../Color-MV5kBVXr.js";
6
- /**
7
- * A simple color/gradient swatch.
8
- *
9
- * @component
10
- * @param {Object} props - Component props.
11
- * @param {string} [props.color] - The color to display.
12
- * @param {string} [props.gradient] - The gradient to display.
13
- * @param {string} [props.className] - Additional clsx to apply.
14
- * @param {string} [props.colorName] - The name of the color. Should be auto-generated for colors.
15
- *
16
- * @returns {JSX.Element} The ColorSwatch component.
17
- *
18
- * @example
19
- * <ColorSwatch color="#FF0000" />
20
- *
21
- * @example
22
- * <ColorSwatch gradient="linear-gradient(45deg, #FF0000, #00FF00)" />
23
- *
24
- * @preserve
25
- */
26
- const ColorSwatch = (props) => {
27
- const { color: rawColor, gradient, className, colorName } = props;
28
- const checkerPattern = "repeating-conic-gradient(#CCC 0% 25%, white 0% 50%) 50% / 0.75rem 0.75rem";
29
- let color;
30
- if (rawColor && !gradient) {
31
- try {
32
- if (rawColor === "transparent") {
33
- color = "rgba(0, 0, 0, 0)";
34
- } else {
35
- color = $799cddbef784668f$export$6e865ea70d7724f(rawColor);
36
- }
37
- } catch (error) {
38
- color = null;
39
- }
40
- }
41
- const backgroundGradient = gradient ? `${gradient}, ${checkerPattern}` : `linear-gradient(${color}, ${color}), ${checkerPattern}`;
42
- return /* @__PURE__ */ jsx(
43
- $251c695a52d94a8d$export$cae13e90592f246a,
44
- {
45
- ...props,
46
- style: {
47
- background: (color || gradient) && backgroundGradient
48
- },
49
- className: () => clsx("es:size-6 es:rounded es:border es:border-secondary-300 es:shadow-xs", !color && !gradient && "es:bg-white", className),
50
- colorName: !color && !gradient ? __("No color", "eightshift-ui-components") : colorName,
51
- color,
52
- children: !color && !gradient && /* @__PURE__ */ jsx("div", { className: "es:m-auto es:h-full es:w-px es:rotate-45 es:rounded es:bg-red-500" })
53
- }
54
- );
55
- };
56
- export {
57
- ColorSwatch
58
- };