@eightshift/ui-components 0.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.
Files changed (112) hide show
  1. package/README.md +27 -0
  2. package/dist/Checkbox-BLcVbhiO.js +178 -0
  3. package/dist/ColorSwatch-Cmlex_kT.js +66 -0
  4. package/dist/FieldError-wtMA4667.js +42 -0
  5. package/dist/FocusScope-1u9yyfIN.js +725 -0
  6. package/dist/Form-Cq3fu75_.js +5 -0
  7. package/dist/GridList-BZPXp3_O.js +1256 -0
  8. package/dist/Group-DyqpTRPe.js +49 -0
  9. package/dist/Input-jsbb4ugq.js +130 -0
  10. package/dist/Label-BPzS-sR7.js +17 -0
  11. package/dist/ListBox-w9gDaJkV.js +4423 -0
  12. package/dist/LiveAnnouncer-IsokfWQ5.js +73 -0
  13. package/dist/NumberFormatter-LzoKy975.js +160 -0
  14. package/dist/RSPContexts-CrNYmadY.js +14 -0
  15. package/dist/Select-49a62830.esm-C-RFtLiD.js +2541 -0
  16. package/dist/SelectionManager-mefd0ThJ.js +2155 -0
  17. package/dist/Separator-DHn0CwdK.js +325 -0
  18. package/dist/Slider-Pyh2V4bY.js +885 -0
  19. package/dist/Text-BM136LvS.js +17 -0
  20. package/dist/VisuallyHidden-BYRI1Lfo.js +51 -0
  21. package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
  22. package/dist/ariaHideOutside-ByKBPHmX.js +113 -0
  23. package/dist/assets/style.css +1 -0
  24. package/dist/button-BkkdyHfJ.js +307 -0
  25. package/dist/components/animated-visibility/animated-visibility.js +7165 -0
  26. package/dist/components/base-control/base-control.js +97 -0
  27. package/dist/components/breakpoint-preview/breakpoint-preview.js +218 -0
  28. package/dist/components/button/button.js +10 -0
  29. package/dist/components/checkbox/checkbox.js +119 -0
  30. package/dist/components/color-pickers/color-picker.js +242 -0
  31. package/dist/components/color-pickers/color-swatch.js +62 -0
  32. package/dist/components/color-pickers/gradient-editor.js +516 -0
  33. package/dist/components/color-pickers/solid-color-picker.js +1633 -0
  34. package/dist/components/component-toggle/component-toggle.js +71 -0
  35. package/dist/components/container-panel/container-panel.js +39 -0
  36. package/dist/components/expandable/expandable.js +144 -0
  37. package/dist/components/input-field/input-field.js +224 -0
  38. package/dist/components/link-input/link-input.js +937 -0
  39. package/dist/components/list-box/list-box.js +152 -0
  40. package/dist/components/matrix-align/matrix-align.js +185 -0
  41. package/dist/components/menu/menu.js +1608 -0
  42. package/dist/components/notice/notice.js +119 -0
  43. package/dist/components/number-picker/number-picker.js +277 -0
  44. package/dist/components/popover/popover.js +9 -0
  45. package/dist/components/radio/radio.js +552 -0
  46. package/dist/components/repeater/repeater-item.js +127 -0
  47. package/dist/components/repeater/repeater.js +248 -0
  48. package/dist/components/responsive/responsive-legacy.js +326 -0
  49. package/dist/components/responsive/responsive.js +499 -0
  50. package/dist/components/responsive-preview/responsive-preview.js +119 -0
  51. package/dist/components/rich-label/rich-label.js +56 -0
  52. package/dist/components/select/async-multi-select.js +144 -0
  53. package/dist/components/select/async-single-select.js +126 -0
  54. package/dist/components/select/custom-select-default-components.js +38 -0
  55. package/dist/components/select/multi-select-components.js +8 -0
  56. package/dist/components/select/multi-select.js +134 -0
  57. package/dist/components/select/react-select-component-wrappers.js +90 -0
  58. package/dist/components/select/shared.js +45 -0
  59. package/dist/components/select/single-select.js +116 -0
  60. package/dist/components/select/styles.js +55 -0
  61. package/dist/components/slider/column-config-slider.js +225 -0
  62. package/dist/components/slider/slider.js +362 -0
  63. package/dist/components/slider/utils.js +45 -0
  64. package/dist/components/spacer/spacer.js +93 -0
  65. package/dist/components/tabs/tabs.js +626 -0
  66. package/dist/components/toggle/switch.js +140 -0
  67. package/dist/components/toggle/toggle.js +58 -0
  68. package/dist/components/toggle-button/toggle-button.js +206 -0
  69. package/dist/components/tooltip/tooltip.js +10 -0
  70. package/dist/context-jMy6xdVq.js +98 -0
  71. package/dist/default-i18n-BhE-OUmt.js +873 -0
  72. package/dist/filterDOMProps-DG2RfOUr.js +30 -0
  73. package/dist/focusSafely-C3K8zAKj.js +743 -0
  74. package/dist/hooks/use-cell-edit-mode.js +35 -0
  75. package/dist/icons/block-icon.js +42 -0
  76. package/dist/icons/generic-color-swatch.js +21 -0
  77. package/dist/icons/icons.js +3636 -0
  78. package/dist/index-Bfb9bWcb.js +28844 -0
  79. package/dist/index-a301f526.esm-Bioi4cGX.js +3576 -0
  80. package/dist/index.js +109 -0
  81. package/dist/intlStrings-CUhoK9EN.js +2484 -0
  82. package/dist/isScrollable-PcyglExV.js +10 -0
  83. package/dist/modifiers.esm-BuJQPI1X.js +31 -0
  84. package/dist/multi-select-components-CjVpCNko.js +3677 -0
  85. package/dist/number-rWqELA8W.js +39 -0
  86. package/dist/popover-Dx3vKXUX.js +1061 -0
  87. package/dist/react-select-async.esm-TFb_ZX6C.js +111 -0
  88. package/dist/react-select.esm-BjRWqf0E.js +15 -0
  89. package/dist/style.js +1 -0
  90. package/dist/textSelection-BosCCRVE.js +89 -0
  91. package/dist/tooltip-CkCndvTI.js +1094 -0
  92. package/dist/useButton-CuG5UzUw.js +74 -0
  93. package/dist/useEvent-DHv-yhOH.js +24 -0
  94. package/dist/useFocusRing-Cc-4eouh.js +41 -0
  95. package/dist/useFocusable-5q1Gek1J.js +81 -0
  96. package/dist/useFormReset-Buc9YJcv.js +23 -0
  97. package/dist/useFormValidationState-BAPPNXic.js +238 -0
  98. package/dist/useHasTabbableChild-D3uUNhJ0.js +37 -0
  99. package/dist/useLabel-CGlkoFG0.js +28 -0
  100. package/dist/useLabels-Dg62M_3P.js +25 -0
  101. package/dist/useListData-BelKu4kx.js +211 -0
  102. package/dist/useListState-Domq0blV.js +137 -0
  103. package/dist/useLocalizedStringFormatter-Prmz0h0A.js +130 -0
  104. package/dist/useNumberFieldState-BLU3uhSR.js +1253 -0
  105. package/dist/useNumberFormatter-BLc2xjZn.js +13 -0
  106. package/dist/usePress-BQgVor4T.js +698 -0
  107. package/dist/useToggle-C9ETOBaZ.js +58 -0
  108. package/dist/useToggleState-DJ_z5E2S.js +21 -0
  109. package/dist/utilities/classnames.js +16 -0
  110. package/dist/utilities/text-helpers.js +79 -0
  111. package/dist/utils-BsiH7-5Y.js +488 -0
  112. package/package.json +71 -0
@@ -0,0 +1,552 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { a as $01b77f81d0f07f68$export$75b6ee27786ba447, $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-BPzS-sR7.js";
3
+ import { d as $3ef42575df84b30b$export$9d1611c77c2fe928, e as $bdb11010cef70236$export$f680877a34711e37, a as $64fa3d84918910a7$export$29f1550f4b0d4415, $ as $64fa3d84918910a7$export$fabf2dc03a41866e, h as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, c as $64fa3d84918910a7$export$4d86445c2cf5e3, j as $64fa3d84918910a7$export$2881499e37b75b9a, l as $df56164dff5785e2$export$4338b53315abf666, m as $5dc95899b306f630$export$c9058316764c140e, i as $64fa3d84918910a7$export$ef03459518577ad4 } from "../../utils-BsiH7-5Y.js";
4
+ import { a as $2baaea4c71418dea$export$294aa081a6c6f55d, $ as $ee014567cb39d3f0$export$ff05c3ac10437e03 } from "../../FieldError-wtMA4667.js";
5
+ import { $ as $d3e0e05bdfcf66bd$export$c24727297075ec6a } from "../../Form-Cq3fu75_.js";
6
+ import { a as $514c0188e459b4c0$export$9afb8bc826b033ea } from "../../Text-BM136LvS.js";
7
+ import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-DG2RfOUr.js";
8
+ import React__default, { useMemo, useState, forwardRef, createContext, cloneElement } from "react";
9
+ import { a as $e93e671b31057976$export$b8473d3665f3a75a, $ as $e5be200c675c3b3a$export$fc1a364ae1f3ff10 } from "../../useFormValidationState-BAPPNXic.js";
10
+ import { d as $9ab94262bd0047c7$export$420e68273165f4ec, e as $458b0a5536c1a7cf$export$40bfa8c7b0832715, $ as $6179b936705e76d3$export$ae780daf29e6d456 } from "../../focusSafely-C3K8zAKj.js";
11
+ import { a as $9bf71ea28793e738$export$2d6ec8fc375ceafa } from "../../FocusScope-1u9yyfIN.js";
12
+ import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "../../context-jMy6xdVq.js";
13
+ import { $ as $99facab73266f662$export$5add1d006293d136 } from "../../useFormReset-Buc9YJcv.js";
14
+ import { $ as $e6afbd83fe6ebbd2$export$4c014de7c8940b4c } from "../../useFocusable-5q1Gek1J.js";
15
+ import { $ as $f6c31cce2adf654f$export$45712eceda6fad21 } from "../../usePress-BQgVor4T.js";
16
+ import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "../../useFocusRing-Cc-4eouh.js";
17
+ import { $ as $5c3e21d68f1c4674$export$439d29a4e110a164 } from "../../VisuallyHidden-BYRI1Lfo.js";
18
+ import { classnames } from "../../utilities/classnames.js";
19
+ import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
20
+ import { RichLabel } from "../rich-label/rich-label.js";
21
+ import { BaseControl } from "../base-control/base-control.js";
22
+ const $884aeceb3d67f00f$export$37b65e5b5444d35c = /* @__PURE__ */ new WeakMap();
23
+ function $0d5c49892c1215da$export$37b0961d2f4751e2(props, state, ref) {
24
+ let { value, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby } = props;
25
+ const isDisabled = props.isDisabled || state.isDisabled;
26
+ let hasChildren = children != null;
27
+ let hasAriaLabel = ariaLabel != null || ariaLabelledby != null;
28
+ if (!hasChildren && !hasAriaLabel)
29
+ console.warn("If you do not provide children, you must specify an aria-label for accessibility");
30
+ let checked = state.selectedValue === value;
31
+ let onChange = (e) => {
32
+ e.stopPropagation();
33
+ state.setSelectedValue(value);
34
+ };
35
+ let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21({
36
+ isDisabled
37
+ });
38
+ let { pressProps: labelProps, isPressed: isLabelPressed } = $f6c31cce2adf654f$export$45712eceda6fad21({
39
+ isDisabled,
40
+ onPress() {
41
+ state.setSelectedValue(value);
42
+ }
43
+ });
44
+ let { focusableProps } = $e6afbd83fe6ebbd2$export$4c014de7c8940b4c($3ef42575df84b30b$export$9d1611c77c2fe928(props, {
45
+ onFocus: () => state.setLastFocusedValue(value)
46
+ }), ref);
47
+ let interactions = $3ef42575df84b30b$export$9d1611c77c2fe928(pressProps, focusableProps);
48
+ let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
49
+ labelable: true
50
+ });
51
+ let tabIndex = -1;
52
+ if (state.selectedValue != null) {
53
+ if (state.selectedValue === value)
54
+ tabIndex = 0;
55
+ } else if (state.lastFocusedValue === value || state.lastFocusedValue == null)
56
+ tabIndex = 0;
57
+ if (isDisabled)
58
+ tabIndex = void 0;
59
+ let { name, descriptionId, errorMessageId, validationBehavior } = $884aeceb3d67f00f$export$37b65e5b5444d35c.get(state);
60
+ $99facab73266f662$export$5add1d006293d136(ref, state.selectedValue, state.setSelectedValue);
61
+ $e93e671b31057976$export$b8473d3665f3a75a({
62
+ validationBehavior
63
+ }, state, ref);
64
+ return {
65
+ labelProps: $3ef42575df84b30b$export$9d1611c77c2fe928(labelProps, {
66
+ onClick: (e) => e.preventDefault()
67
+ }),
68
+ inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, {
69
+ ...interactions,
70
+ type: "radio",
71
+ name,
72
+ tabIndex,
73
+ disabled: isDisabled,
74
+ required: state.isRequired && validationBehavior === "native",
75
+ checked,
76
+ value,
77
+ onChange,
78
+ "aria-describedby": [
79
+ props["aria-describedby"],
80
+ state.isInvalid ? errorMessageId : null,
81
+ descriptionId
82
+ ].filter(Boolean).join(" ") || void 0
83
+ }),
84
+ isDisabled,
85
+ isSelected: checked,
86
+ isPressed: isPressed || isLabelPressed
87
+ };
88
+ }
89
+ function $430f30ed08ec25fa$export$62b9571f283ff5c2(props, state) {
90
+ let { name, isReadOnly, isRequired, isDisabled, orientation = "vertical", validationBehavior = "aria" } = props;
91
+ let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
92
+ let { isInvalid, validationErrors, validationDetails } = state.displayValidation;
93
+ let { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d({
94
+ ...props,
95
+ // Radio group is not an HTML input element so it
96
+ // shouldn't be labeled by a <label> element.
97
+ labelElementType: "span",
98
+ isInvalid: state.isInvalid,
99
+ errorMessage: props.errorMessage || validationErrors
100
+ });
101
+ let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
102
+ labelable: true
103
+ });
104
+ let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec({
105
+ onBlurWithin(e) {
106
+ var _props_onBlur;
107
+ (_props_onBlur = props.onBlur) === null || _props_onBlur === void 0 ? void 0 : _props_onBlur.call(props, e);
108
+ if (!state.selectedValue)
109
+ state.setLastFocusedValue(null);
110
+ },
111
+ onFocusWithin: props.onFocus,
112
+ onFocusWithinChange: props.onFocusChange
113
+ });
114
+ let onKeyDown = (e) => {
115
+ let nextDir;
116
+ switch (e.key) {
117
+ case "ArrowRight":
118
+ if (direction === "rtl" && orientation !== "vertical")
119
+ nextDir = "prev";
120
+ else
121
+ nextDir = "next";
122
+ break;
123
+ case "ArrowLeft":
124
+ if (direction === "rtl" && orientation !== "vertical")
125
+ nextDir = "next";
126
+ else
127
+ nextDir = "prev";
128
+ break;
129
+ case "ArrowDown":
130
+ nextDir = "next";
131
+ break;
132
+ case "ArrowUp":
133
+ nextDir = "prev";
134
+ break;
135
+ default:
136
+ return;
137
+ }
138
+ e.preventDefault();
139
+ let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(e.currentTarget, {
140
+ from: e.target
141
+ });
142
+ let nextElem;
143
+ if (nextDir === "next") {
144
+ nextElem = walker.nextNode();
145
+ if (!nextElem) {
146
+ walker.currentNode = e.currentTarget;
147
+ nextElem = walker.firstChild();
148
+ }
149
+ } else {
150
+ nextElem = walker.previousNode();
151
+ if (!nextElem) {
152
+ walker.currentNode = e.currentTarget;
153
+ nextElem = walker.lastChild();
154
+ }
155
+ }
156
+ if (nextElem) {
157
+ nextElem.focus();
158
+ state.setSelectedValue(nextElem.value);
159
+ }
160
+ };
161
+ let groupName = $bdb11010cef70236$export$f680877a34711e37(name);
162
+ $884aeceb3d67f00f$export$37b65e5b5444d35c.set(state, {
163
+ name: groupName,
164
+ descriptionId: descriptionProps.id,
165
+ errorMessageId: errorMessageProps.id,
166
+ validationBehavior
167
+ });
168
+ return {
169
+ radioGroupProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, {
170
+ // https://www.w3.org/TR/wai-aria-1.2/#radiogroup
171
+ role: "radiogroup",
172
+ onKeyDown,
173
+ "aria-invalid": state.isInvalid || void 0,
174
+ "aria-errormessage": props["aria-errormessage"],
175
+ "aria-readonly": isReadOnly || void 0,
176
+ "aria-required": isRequired || void 0,
177
+ "aria-disabled": isDisabled || void 0,
178
+ "aria-orientation": orientation,
179
+ ...fieldProps,
180
+ ...focusWithinProps
181
+ }),
182
+ labelProps,
183
+ descriptionProps,
184
+ errorMessageProps,
185
+ isInvalid,
186
+ validationErrors,
187
+ validationDetails
188
+ };
189
+ }
190
+ let $a54cdc5c1942b639$var$instance = Math.round(Math.random() * 1e10);
191
+ let $a54cdc5c1942b639$var$i = 0;
192
+ function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
193
+ let name = useMemo(() => props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [
194
+ props.name
195
+ ]);
196
+ var _props_defaultValue;
197
+ let [selectedValue, setSelected] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
198
+ let [lastFocusedValue, setLastFocusedValue] = useState(null);
199
+ let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10({
200
+ ...props,
201
+ value: selectedValue
202
+ });
203
+ let setSelectedValue = (value) => {
204
+ if (!props.isReadOnly && !props.isDisabled) {
205
+ setSelected(value);
206
+ validation.commitValidation();
207
+ }
208
+ };
209
+ let isInvalid = validation.displayValidation.isInvalid;
210
+ return {
211
+ ...validation,
212
+ name,
213
+ selectedValue,
214
+ setSelectedValue,
215
+ lastFocusedValue,
216
+ setLastFocusedValue,
217
+ isDisabled: props.isDisabled || false,
218
+ isReadOnly: props.isReadOnly || false,
219
+ isRequired: props.isRequired || false,
220
+ validationState: props.validationState || (isInvalid ? "invalid" : null),
221
+ isInvalid
222
+ };
223
+ }
224
+ const $b6c3ddc6086f204d$export$a79eda4ff50e30b6 = /* @__PURE__ */ createContext(null);
225
+ const $b6c3ddc6086f204d$export$b118023277d4a5c3 = /* @__PURE__ */ createContext(null);
226
+ const $b6c3ddc6086f204d$export$29d84393af70866c = /* @__PURE__ */ createContext(null);
227
+ function $b6c3ddc6086f204d$var$RadioGroup(props, ref) {
228
+ [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $b6c3ddc6086f204d$export$a79eda4ff50e30b6);
229
+ let { validationBehavior: formValidationBehavior } = $64fa3d84918910a7$export$fabf2dc03a41866e($d3e0e05bdfcf66bd$export$c24727297075ec6a) || {};
230
+ var _props_validationBehavior, _ref;
231
+ let validationBehavior = (_ref = (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : formValidationBehavior) !== null && _ref !== void 0 ? _ref : "native";
232
+ let state = $a54cdc5c1942b639$export$bca9d026f8e704eb({
233
+ ...props,
234
+ validationBehavior
235
+ });
236
+ let [labelRef, label] = $64fa3d84918910a7$export$9d4c57ee4c6ffdd8();
237
+ let { radioGroupProps, labelProps, descriptionProps, errorMessageProps, ...validation } = $430f30ed08ec25fa$export$62b9571f283ff5c2({
238
+ ...props,
239
+ label,
240
+ validationBehavior
241
+ }, state);
242
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
243
+ ...props,
244
+ values: {
245
+ orientation: props.orientation || "vertical",
246
+ isDisabled: state.isDisabled,
247
+ isReadOnly: state.isReadOnly,
248
+ isRequired: state.isRequired,
249
+ isInvalid: state.isInvalid,
250
+ state
251
+ },
252
+ defaultClassName: "react-aria-RadioGroup"
253
+ });
254
+ return /* @__PURE__ */ React__default.createElement("div", {
255
+ ...radioGroupProps,
256
+ ...renderProps,
257
+ ref,
258
+ slot: props.slot || void 0,
259
+ "data-orientation": props.orientation || "vertical",
260
+ "data-invalid": state.isInvalid || void 0,
261
+ "data-disabled": state.isDisabled || void 0,
262
+ "data-readonly": state.isReadOnly || void 0,
263
+ "data-required": state.isRequired || void 0
264
+ }, /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
265
+ values: [
266
+ [
267
+ $b6c3ddc6086f204d$export$29d84393af70866c,
268
+ state
269
+ ],
270
+ [
271
+ $01b77f81d0f07f68$export$75b6ee27786ba447,
272
+ {
273
+ ...labelProps,
274
+ ref: labelRef,
275
+ elementType: "span"
276
+ }
277
+ ],
278
+ [
279
+ $514c0188e459b4c0$export$9afb8bc826b033ea,
280
+ {
281
+ slots: {
282
+ description: descriptionProps,
283
+ errorMessage: errorMessageProps
284
+ }
285
+ }
286
+ ],
287
+ [
288
+ $ee014567cb39d3f0$export$ff05c3ac10437e03,
289
+ validation
290
+ ]
291
+ ]
292
+ }, renderProps.children));
293
+ }
294
+ function $b6c3ddc6086f204d$var$Radio(props, ref) {
295
+ let { inputRef: userProvidedInputRef = null, ...otherProps } = props;
296
+ [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(otherProps, ref, $b6c3ddc6086f204d$export$b118023277d4a5c3);
297
+ let state = React__default.useContext($b6c3ddc6086f204d$export$29d84393af70866c);
298
+ let inputRef = $df56164dff5785e2$export$4338b53315abf666($5dc95899b306f630$export$c9058316764c140e(userProvidedInputRef, props.inputRef !== void 0 ? props.inputRef : null));
299
+ let { labelProps, inputProps, isSelected, isDisabled, isPressed } = $0d5c49892c1215da$export$37b0961d2f4751e2({
300
+ ...$64fa3d84918910a7$export$ef03459518577ad4(props),
301
+ // ReactNode type doesn't allow function children.
302
+ children: typeof props.children === "function" ? true : props.children
303
+ }, state, inputRef);
304
+ let { isFocused, isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f();
305
+ let interactionDisabled = isDisabled || state.isReadOnly;
306
+ let { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456({
307
+ ...props,
308
+ isDisabled: interactionDisabled
309
+ });
310
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
311
+ ...props,
312
+ defaultClassName: "react-aria-Radio",
313
+ values: {
314
+ isSelected,
315
+ isPressed,
316
+ isHovered,
317
+ isFocused,
318
+ isFocusVisible,
319
+ isDisabled,
320
+ isReadOnly: state.isReadOnly,
321
+ isInvalid: state.isInvalid,
322
+ isRequired: state.isRequired
323
+ }
324
+ });
325
+ let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
326
+ delete DOMProps.id;
327
+ return /* @__PURE__ */ React__default.createElement("label", {
328
+ ...$3ef42575df84b30b$export$9d1611c77c2fe928(DOMProps, labelProps, hoverProps, renderProps),
329
+ ref,
330
+ "data-selected": isSelected || void 0,
331
+ "data-pressed": isPressed || void 0,
332
+ "data-hovered": isHovered || void 0,
333
+ "data-focused": isFocused || void 0,
334
+ "data-focus-visible": isFocusVisible || void 0,
335
+ "data-disabled": isDisabled || void 0,
336
+ "data-readonly": state.isReadOnly || void 0,
337
+ "data-invalid": state.isInvalid || void 0,
338
+ "data-required": state.isRequired || void 0
339
+ }, /* @__PURE__ */ React__default.createElement($5c3e21d68f1c4674$export$439d29a4e110a164, {
340
+ elementType: "span"
341
+ }, /* @__PURE__ */ React__default.createElement("input", {
342
+ ...$3ef42575df84b30b$export$9d1611c77c2fe928(inputProps, focusProps),
343
+ ref: inputRef
344
+ })), renderProps.children);
345
+ }
346
+ const $b6c3ddc6086f204d$export$a98f0dcb43a68a25 = /* @__PURE__ */ forwardRef($b6c3ddc6086f204d$var$RadioGroup);
347
+ const $b6c3ddc6086f204d$export$d7b12c4107be0d61 = /* @__PURE__ */ forwardRef($b6c3ddc6086f204d$var$Radio);
348
+ /**
349
+ * A simple radio button.
350
+ *
351
+ * @component
352
+ * @param {Object} props - Component props.
353
+ * @param {JSX.Element} [props.icon] - The checkbox icon.
354
+ * @param {string} [props.label] - The checkbox label.
355
+ * @param {string} [props.subtitle] - The checkbox subtitle.
356
+ * @param {boolean} [props.disabled] - Whether the checkbox is disabled.
357
+ * @param {string} [props.className] - Additional classes to add to the checkbox container.
358
+ * @param {string} [props.labelClassName] - Additional classes to add to the label container.
359
+ * @param {boolean} [props.alignEnd] - Whether the label should be aligned to the end.
360
+ *
361
+ * @returns {JSX.Element} The RadioButton component.
362
+ *
363
+ * @see {@link RadioButtonGroup} for usage example.
364
+ *
365
+ * @preserve
366
+ */
367
+ const RadioButton = (props) => {
368
+ const {
369
+ icon,
370
+ label,
371
+ subtitle,
372
+ disabled,
373
+ className,
374
+ labelClassName,
375
+ design = "default",
376
+ alignEnd,
377
+ children,
378
+ ...other
379
+ } = props;
380
+ const styles = {
381
+ segmented: classnames(
382
+ "es-uic-py-1 es-uic-px-1.5 es-uic-border hover:es-uic-bg-gray-50 es-uic-transition",
383
+ "first:es-uic-rounded-t-lg last:es-uic-rounded-b-lg",
384
+ "focus-visible:es-uic-ring focus-visible:es-uic-ring-teal-500 focus-visible:es-uic-ring-opacity-50 focus-visible:es-uic-z-10"
385
+ ),
386
+ segmentedHorizontal: classnames(
387
+ "es-uic-py-1 es-uic-px-1.5 es-uic-border hover:es-uic-bg-gray-50 es-uic-transition es-uic-grow",
388
+ "first:es-uic-rounded-l-lg last:es-uic-rounded-r-lg",
389
+ "focus-visible:es-uic-ring focus-visible:es-uic-ring-teal-500 focus-visible:es-uic-ring-opacity-50 focus-visible:es-uic-z-10"
390
+ )
391
+ };
392
+ return /* @__PURE__ */ jsx(
393
+ $b6c3ddc6086f204d$export$d7b12c4107be0d61,
394
+ {
395
+ isDisabled: disabled,
396
+ className: classnames(
397
+ "es-uic-flex es-uic-items-center es-uic-gap-1.5 es-uic-text-sm",
398
+ styles[design],
399
+ className
400
+ ),
401
+ ...other,
402
+ children: ({ isSelected }) => /* @__PURE__ */ jsxs(Fragment, { children: [
403
+ (icon || alignEnd) && (label || subtitle) && /* @__PURE__ */ jsx(
404
+ RichLabel,
405
+ {
406
+ icon,
407
+ label,
408
+ subtitle,
409
+ className: labelClassName,
410
+ fullWidth: true
411
+ }
412
+ ),
413
+ /* @__PURE__ */ jsx(
414
+ "div",
415
+ {
416
+ className: classnames(
417
+ "es-uic-flex es-uic-size-5 es-uic-items-center es-uic-justify-center es-uic-rounded-full es-uic-border es-uic-text-gray-600 es-uic-shadow-sm es-uic-transition",
418
+ isSelected ? "es-uic-border-teal-600 es-uic-bg-teal-600 es-uic-text-white" : "es-uic-border-gray-300"
419
+ ),
420
+ children: /* @__PURE__ */ jsx(
421
+ AnimatedVisibility,
422
+ {
423
+ transition: "scaleFade",
424
+ visible: isSelected,
425
+ className: "[&>svg]:es-uic-size-3 [&>svg]:es-uic-stroke-2",
426
+ noInitial: true,
427
+ children: /* @__PURE__ */ jsx("div", { className: "es-uic-size-2.5 es-uic-rounded-full es-uic-bg-white es-uic-shadow-sm" })
428
+ }
429
+ )
430
+ }
431
+ ),
432
+ !icon && !alignEnd && (label || subtitle) && /* @__PURE__ */ jsx(
433
+ RichLabel,
434
+ {
435
+ label,
436
+ subtitle,
437
+ className: labelClassName
438
+ }
439
+ ),
440
+ !(icon || label || subtitle) && children
441
+ ] })
442
+ }
443
+ );
444
+ };
445
+ RadioButton.displayName = "RadioButton";
446
+ /**
447
+ * A group of radio buttons.
448
+ * This component is required to control radio buttons.
449
+ *
450
+ * Each radio button should have a `value` set!
451
+ *
452
+ * @component
453
+ * @param {Object} props - Component props.
454
+ * @param {JSX.Element} [props.icon] - Icon to show before the label.
455
+ * @param {string} [props.label] - Label to show above the control.
456
+ * @param {string} [props.help] - Help text displayed below the control.
457
+ * @param {JSX.Element|JSX.Element[]} [props.actions] - Actions to show to the right of the label.
458
+ * @param {string} [props.subtitle] - Subtitle to show below the label.
459
+ * @param {RadioButtonGroupOrientation} [props.orientation='vertical'] - Orientation of the radio buttons.
460
+ * @param {RadioButtonGroupDesign} [props.design='default'] - Design of the radio buttons.
461
+ * @param {boolean} [props.disabled] - Whether the radio button group is disabled.
462
+ * @param {boolean} [props.readOnly] - Whether the radio button group is read-only.
463
+ * @param {string} [props.value] - Value of the currently selected radio button.
464
+ * @param {Function} [props.onChange] - Function to call when the value of the selected radio button changes.
465
+ * @param {string} [props.className] - Additional classes to add to the group container.
466
+ * @param {string} [props.labelClassName] - Additional classes to add to the label container.
467
+ *
468
+ * @returns {JSX.Element} The RadioButtonGroup component.
469
+ *
470
+ * @typedef {'horizontal' | 'vertical'} RadioButtonGroupOrientation
471
+ * @typedef {'default' | 'segmented'} RadioButtonGroupDesign
472
+ *
473
+ * @example
474
+ * const [value, setValue] = useState('first'); // Or "null" if you don't want anything selected by default.
475
+ *
476
+ * <RadioButtonGroup
477
+ * label='My radio buttons'
478
+ * value={value}
479
+ * onChange={setValue}
480
+ * >
481
+ * <RadioButton value='first' label='First option' />
482
+ * <RadioButton value='second' label='Second option' />
483
+ * </RadioButtonGroup>
484
+ *
485
+ * @preserve
486
+ */
487
+ const RadioButtonGroup = (props) => {
488
+ const {
489
+ icon,
490
+ help,
491
+ label,
492
+ actions,
493
+ subtitle,
494
+ orientation = "vertical",
495
+ design = "default",
496
+ disabled,
497
+ readOnly,
498
+ value,
499
+ onChange,
500
+ children,
501
+ className,
502
+ labelClassName,
503
+ ...other
504
+ } = props;
505
+ let mappedChildren = children ?? [];
506
+ if (!Array.isArray(children)) {
507
+ mappedChildren = [children];
508
+ }
509
+ mappedChildren = children.map((child, index) => {
510
+ if (child.type.displayName !== "RadioButton") {
511
+ return child;
512
+ }
513
+ return cloneElement(child, {
514
+ design: orientation === "horizontal" ? `${design}Horizontal` : design,
515
+ key: child.props.value ?? index
516
+ });
517
+ });
518
+ return /* @__PURE__ */ jsx(
519
+ $b6c3ddc6086f204d$export$a98f0dcb43a68a25,
520
+ {
521
+ className: classnames("es-uic-w-full", className),
522
+ isDisabled: disabled,
523
+ isReadOnly: readOnly,
524
+ onChange,
525
+ value,
526
+ orientation,
527
+ ...other,
528
+ children: /* @__PURE__ */ jsx(
529
+ BaseControl,
530
+ {
531
+ icon,
532
+ label,
533
+ subtitle,
534
+ actions,
535
+ help,
536
+ labelAs: $01b77f81d0f07f68$export$b04be29aa201d4f5,
537
+ className: labelClassName,
538
+ controlContainerClassName: classnames(
539
+ orientation === "horizontal" && "es-uic-flex es-uic-flex-wrap !es-uic-space-y-0 es-uic-gap-2.5",
540
+ design === "segmented" && orientation === "vertical" && "!-es-uic-space-y-px",
541
+ design === "segmented" && orientation === "horizontal" && "!es-uic-gap-0 !es-uic-nowrap -es-uic-space-x-px"
542
+ ),
543
+ children: mappedChildren
544
+ }
545
+ )
546
+ }
547
+ );
548
+ };
549
+ export {
550
+ RadioButton,
551
+ RadioButtonGroup
552
+ };
@@ -0,0 +1,127 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { $ as $bc237834342dbd75$export$48513f6b9f8ce62d } from "../../Checkbox-BLcVbhiO.js";
3
+ import { $ as $72e60046c03fbe42$export$54fe942636b6416d, b as $72e60046c03fbe42$export$e96fc9a8407faa6b } from "../../GridList-BZPXp3_O.js";
4
+ import { B as Button } from "../../button-BkkdyHfJ.js";
5
+ import { icons } from "../../icons/icons.js";
6
+ import { classnames } from "../../utilities/classnames.js";
7
+ import { Expandable } from "../expandable/expandable.js";
8
+ import { _ as __ } from "../../default-i18n-BhE-OUmt.js";
9
+ import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
10
+ import { useRef } from "react";
11
+ import { useCellEditMode } from "../../hooks/use-cell-edit-mode.js";
12
+ /**
13
+ * A Repeater item.
14
+ *
15
+ * @component
16
+ * @param {Object} props - Component props.
17
+ * @param {JSX.Element} [props.icon] - Icon to display in the label.
18
+ * @param {string} [props.label] - Label to display.
19
+ * @param {string} [props.subtitle] - Subtitle to display.
20
+ * @param {JSX.Element|JSX.Element[]} [props.actions] - Actions to display to the right of the label.
21
+ * @param {string} [props.textValue] - The text value of the item.
22
+ * @param {string} [props.className] - Classes to pass to the item.
23
+ *
24
+ * @returns {JSX.Element} The ButtonGroup component.
25
+ *
26
+ * @see {@link Repeater} for usage example.
27
+ *
28
+ * @preserve
29
+ */
30
+ const RepeaterItem = (props) => {
31
+ const {
32
+ children,
33
+ icon,
34
+ label,
35
+ subtitle,
36
+ "aria-label": ariaLabel,
37
+ className,
38
+ actions,
39
+ textValue,
40
+ ...rest
41
+ } = props;
42
+ let a11yLabel = textValue;
43
+ if ((label == null ? void 0 : label.length) > 0) {
44
+ a11yLabel = label;
45
+ }
46
+ if (a11yLabel === "" || !a11yLabel) {
47
+ a11yLabel = __("New item", "eightshift-ui-components");
48
+ }
49
+ useRef(null);
50
+ const preventProps = useCellEditMode();
51
+ return /* @__PURE__ */ jsx($72e60046c03fbe42$export$54fe942636b6416d.Consumer, { children: ({ setCanReorder }) => {
52
+ return /* @__PURE__ */ jsx(
53
+ $72e60046c03fbe42$export$e96fc9a8407faa6b,
54
+ {
55
+ "aria-label": ariaLabel ?? a11yLabel,
56
+ textValue: a11yLabel,
57
+ className: classnames(
58
+ "es-uic-rounded-lg es-uic-transition",
59
+ "focus:es-uic-outline-none focus-visible:es-uic-ring focus-visible:es-uic-ring-teal-500 focus-visible:es-uic-ring-opacity-50"
60
+ ),
61
+ ...rest,
62
+ children: ({ selectionMode, allowsDragging, isDragging }) => /* @__PURE__ */ jsx(
63
+ Expandable,
64
+ {
65
+ disabled: selectionMode === "multiple",
66
+ icon: /* @__PURE__ */ jsxs(Fragment, { children: [
67
+ selectionMode === "multiple" && /* @__PURE__ */ jsx(Checkbox, { slot: "selection" }),
68
+ selectionMode === "none" && icon
69
+ ] }),
70
+ label: /* @__PURE__ */ jsx("div", { className: "es-uic-flex es-uic-items-center es-uic-gap-1", children: label }),
71
+ subtitle,
72
+ labelClassName: className,
73
+ className: classnames(isDragging && "es-uic-opacity-25"),
74
+ onOpenChange: (isOpen) => setCanReorder(!isOpen),
75
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
76
+ selectionMode === "none" && allowsDragging && /* @__PURE__ */ jsx(
77
+ Button,
78
+ {
79
+ size: "small",
80
+ className: "es-uic-h-6 es-uic-w-4 !es-uic-text-gray-500 es-uic-opacity-5 focus:!es-uic-opacity-100",
81
+ slot: "drag",
82
+ type: "ghost",
83
+ icon: icons.reorderGrabberV,
84
+ tooltip: __("Re-order", "eightshift-ui-components")
85
+ }
86
+ ),
87
+ actions
88
+ ] }),
89
+ noFocusHandling: true,
90
+ ...preventProps,
91
+ children
92
+ }
93
+ )
94
+ }
95
+ );
96
+ } });
97
+ };
98
+ const Checkbox = (props) => {
99
+ return /* @__PURE__ */ jsx($bc237834342dbd75$export$48513f6b9f8ce62d, { ...props, children: ({ isIndeterminate, isSelected }) => /* @__PURE__ */ jsxs(Fragment, { children: [
100
+ /* @__PURE__ */ jsxs(
101
+ "div",
102
+ {
103
+ className: classnames(
104
+ "es-uic-flex es-uic-size-5.5 es-uic-items-center es-uic-justify-center es-uic-rounded-md es-uic-border es-uic-text-gray-600 es-uic-shadow-sm es-uic-transition",
105
+ isSelected && "es-uic-border-teal-600 es-uic-bg-teal-600 es-uic-text-white"
106
+ ),
107
+ children: [
108
+ isIndeterminate && icons.solidRectFilled,
109
+ /* @__PURE__ */ jsx(
110
+ AnimatedVisibility,
111
+ {
112
+ transition: "scaleRotateFade",
113
+ visible: !isIndeterminate && isSelected,
114
+ className: "[&>svg]:es-uic-size-3 [&>svg]:es-uic-stroke-2",
115
+ noInitial: true,
116
+ children: icons.check
117
+ }
118
+ )
119
+ ]
120
+ }
121
+ ),
122
+ props.children
123
+ ] }) });
124
+ };
125
+ export {
126
+ RepeaterItem
127
+ };