@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,626 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { f as $880e95eb8b93ba9a$export$ecf600387e221c37, c as $ae20dd8cbca75726$export$d6daf82dcd84e87c, g as $7135fc7d473fd974$export$7cd71aa5ddd6dc4e, h as $7135fc7d473fd974$export$8c25dea96356a8b6, i as $7135fc7d473fd974$export$813b5978dd974d8, j as $7135fc7d473fd974$export$e7c29ae2353b16ea } from "../../SelectionManager-mefd0ThJ.js";
3
+ import { d as $3ef42575df84b30b$export$9d1611c77c2fe928, e as $bdb11010cef70236$export$f680877a34711e37, b as $64fa3d84918910a7$export$86427a43e3e48ebb, a as $64fa3d84918910a7$export$29f1550f4b0d4415, p as $64fa3d84918910a7$export$8dc98ba7eadeaa56, c as $64fa3d84918910a7$export$4d86445c2cf5e3, j as $64fa3d84918910a7$export$2881499e37b75b9a, $ as $64fa3d84918910a7$export$fabf2dc03a41866e, l as $df56164dff5785e2$export$4338b53315abf666 } from "../../utils-BsiH7-5Y.js";
4
+ import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-DG2RfOUr.js";
5
+ import React__default, { useMemo, useRef, useEffect, forwardRef, useContext, createContext, useId, cloneElement } from "react";
6
+ import { $ as $e72dd72e1c76a225$export$2f645645f7bca764 } from "../../useListState-Domq0blV.js";
7
+ import { e as $458b0a5536c1a7cf$export$40bfa8c7b0832715, $ as $6179b936705e76d3$export$ae780daf29e6d456 } from "../../focusSafely-C3K8zAKj.js";
8
+ import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "../../useFocusRing-Cc-4eouh.js";
9
+ import { $ as $313b98861ee5dd6c$export$d6875122194c7b44 } from "../../useLabels-Dg62M_3P.js";
10
+ import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "../../context-jMy6xdVq.js";
11
+ import { a as $ea8dcbcb9ea1b556$export$7e924b3091a3bd18 } from "../../usePress-BQgVor4T.js";
12
+ import { $ as $83013635b024ae3d$export$eac1895992b9f3d6 } from "../../useHasTabbableChild-D3uUNhJ0.js";
13
+ import { _ as __, s as sprintf } from "../../default-i18n-BhE-OUmt.js";
14
+ import { classnames } from "../../utilities/classnames.js";
15
+ import { Notice } from "../notice/notice.js";
16
+ const $99b62ae3ff97ec45$export$c5f62239608282b6 = /* @__PURE__ */ new WeakMap();
17
+ function $99b62ae3ff97ec45$export$567fc7097e064344(state, key, role) {
18
+ if (typeof key === "string")
19
+ key = key.replace(/\s+/g, "");
20
+ let baseId = $99b62ae3ff97ec45$export$c5f62239608282b6.get(state);
21
+ return `${baseId}-${role}-${key}`;
22
+ }
23
+ function $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
24
+ let { key, isDisabled: propsDisabled, shouldSelectOnPressUp } = props;
25
+ let { selectionManager: manager, selectedKey } = state;
26
+ let isSelected = key === selectedKey;
27
+ let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);
28
+ let { itemProps, isPressed } = $880e95eb8b93ba9a$export$ecf600387e221c37({
29
+ selectionManager: manager,
30
+ key,
31
+ ref,
32
+ isDisabled,
33
+ shouldSelectOnPressUp,
34
+ linkBehavior: "selection"
35
+ });
36
+ let tabId = $99b62ae3ff97ec45$export$567fc7097e064344(state, key, "tab");
37
+ let tabPanelId = $99b62ae3ff97ec45$export$567fc7097e064344(state, key, "tabpanel");
38
+ let { tabIndex } = itemProps;
39
+ let item = state.collection.getItem(key);
40
+ let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(item === null || item === void 0 ? void 0 : item.props, {
41
+ labelable: true
42
+ });
43
+ delete domProps.id;
44
+ let linkProps = $ea8dcbcb9ea1b556$export$7e924b3091a3bd18(item === null || item === void 0 ? void 0 : item.props);
45
+ return {
46
+ tabProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, linkProps, itemProps, {
47
+ id: tabId,
48
+ "aria-selected": isSelected,
49
+ "aria-disabled": isDisabled || void 0,
50
+ "aria-controls": isSelected ? tabPanelId : void 0,
51
+ tabIndex: isDisabled ? void 0 : tabIndex,
52
+ role: "tab"
53
+ }),
54
+ isSelected,
55
+ isDisabled,
56
+ isPressed
57
+ };
58
+ }
59
+ function $34bce698202e07cb$export$fae0121b5afe572d(props, state, ref) {
60
+ let tabIndex = $83013635b024ae3d$export$eac1895992b9f3d6(ref) ? void 0 : 0;
61
+ var _props_id;
62
+ const id = $99b62ae3ff97ec45$export$567fc7097e064344(state, (_props_id = props.id) !== null && _props_id !== void 0 ? _props_id : state === null || state === void 0 ? void 0 : state.selectedKey, "tabpanel");
63
+ const tabPanelProps = $313b98861ee5dd6c$export$d6875122194c7b44({
64
+ ...props,
65
+ id,
66
+ "aria-labelledby": $99b62ae3ff97ec45$export$567fc7097e064344(state, state === null || state === void 0 ? void 0 : state.selectedKey, "tab")
67
+ });
68
+ return {
69
+ tabPanelProps: $3ef42575df84b30b$export$9d1611c77c2fe928(tabPanelProps, {
70
+ tabIndex,
71
+ role: "tabpanel",
72
+ "aria-describedby": props["aria-describedby"],
73
+ "aria-details": props["aria-details"]
74
+ })
75
+ };
76
+ }
77
+ class $bfc6f2d60b8a4c40$export$15010ca3c1abe90b {
78
+ getKeyLeftOf(key) {
79
+ if (this.flipDirection)
80
+ return this.getNextKey(key);
81
+ return this.getPreviousKey(key);
82
+ }
83
+ getKeyRightOf(key) {
84
+ if (this.flipDirection)
85
+ return this.getPreviousKey(key);
86
+ return this.getNextKey(key);
87
+ }
88
+ getKeyAbove(key) {
89
+ return this.getPreviousKey(key);
90
+ }
91
+ getKeyBelow(key) {
92
+ return this.getNextKey(key);
93
+ }
94
+ isDisabled(key) {
95
+ var _this_collection_getItem_props, _this_collection_getItem;
96
+ return this.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled);
97
+ }
98
+ getFirstKey() {
99
+ let key = this.collection.getFirstKey();
100
+ if (key != null && this.isDisabled(key))
101
+ key = this.getNextKey(key);
102
+ return key;
103
+ }
104
+ getLastKey() {
105
+ let key = this.collection.getLastKey();
106
+ if (key != null && this.isDisabled(key))
107
+ key = this.getPreviousKey(key);
108
+ return key;
109
+ }
110
+ getNextKey(key) {
111
+ do {
112
+ key = this.collection.getKeyAfter(key);
113
+ if (key == null)
114
+ key = this.collection.getFirstKey();
115
+ } while (this.isDisabled(key));
116
+ return key;
117
+ }
118
+ getPreviousKey(key) {
119
+ do {
120
+ key = this.collection.getKeyBefore(key);
121
+ if (key == null)
122
+ key = this.collection.getLastKey();
123
+ } while (this.isDisabled(key));
124
+ return key;
125
+ }
126
+ constructor(collection, direction, orientation, disabledKeys = /* @__PURE__ */ new Set()) {
127
+ this.collection = collection;
128
+ this.flipDirection = direction === "rtl" && orientation === "horizontal";
129
+ this.disabledKeys = disabledKeys;
130
+ }
131
+ }
132
+ function $58d314389b21fa3f$export$773e389e644c5874(props, state, ref) {
133
+ let { orientation = "horizontal", keyboardActivation = "automatic" } = props;
134
+ let { collection, selectionManager: manager, disabledKeys } = state;
135
+ let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
136
+ let delegate = useMemo(() => new $bfc6f2d60b8a4c40$export$15010ca3c1abe90b(collection, direction, orientation, disabledKeys), [
137
+ collection,
138
+ disabledKeys,
139
+ orientation,
140
+ direction
141
+ ]);
142
+ let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c({
143
+ ref,
144
+ selectionManager: manager,
145
+ keyboardDelegate: delegate,
146
+ selectOnFocus: keyboardActivation === "automatic",
147
+ disallowEmptySelection: true,
148
+ scrollRef: ref,
149
+ linkBehavior: "selection"
150
+ });
151
+ let tabsId = $bdb11010cef70236$export$f680877a34711e37();
152
+ $99b62ae3ff97ec45$export$c5f62239608282b6.set(state, tabsId);
153
+ let tabListLabelProps = $313b98861ee5dd6c$export$d6875122194c7b44({
154
+ ...props,
155
+ id: tabsId
156
+ });
157
+ return {
158
+ tabListProps: {
159
+ ...$3ef42575df84b30b$export$9d1611c77c2fe928(collectionProps, tabListLabelProps),
160
+ role: "tablist",
161
+ "aria-orientation": orientation,
162
+ tabIndex: void 0
163
+ }
164
+ };
165
+ }
166
+ function $a0d645289fe9b86b$export$e7f05e985daf4b5f(props) {
167
+ var _props_defaultSelectedKey;
168
+ let [selectedKey, setSelectedKey] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(props.selectedKey, (_props_defaultSelectedKey = props.defaultSelectedKey) !== null && _props_defaultSelectedKey !== void 0 ? _props_defaultSelectedKey : null, props.onSelectionChange);
169
+ let selectedKeys = useMemo(() => selectedKey != null ? [
170
+ selectedKey
171
+ ] : [], [
172
+ selectedKey
173
+ ]);
174
+ let { collection, disabledKeys, selectionManager } = $e72dd72e1c76a225$export$2f645645f7bca764({
175
+ ...props,
176
+ selectionMode: "single",
177
+ disallowEmptySelection: true,
178
+ allowDuplicateSelectionEvents: true,
179
+ selectedKeys,
180
+ onSelectionChange: (keys) => {
181
+ var _keys_values_next_value;
182
+ let key = (_keys_values_next_value = keys.values().next().value) !== null && _keys_values_next_value !== void 0 ? _keys_values_next_value : null;
183
+ if (key === selectedKey && props.onSelectionChange)
184
+ props.onSelectionChange(key);
185
+ setSelectedKey(key);
186
+ }
187
+ });
188
+ let selectedItem = selectedKey != null ? collection.getItem(selectedKey) : null;
189
+ return {
190
+ collection,
191
+ disabledKeys,
192
+ selectionManager,
193
+ selectedKey,
194
+ setSelectedKey,
195
+ selectedItem
196
+ };
197
+ }
198
+ function $76f919a04c5a7d14$export$4ba071daf4e486(props) {
199
+ var _props_defaultSelectedKey;
200
+ let state = $a0d645289fe9b86b$export$e7f05e985daf4b5f({
201
+ ...props,
202
+ suppressTextValueWarning: true,
203
+ defaultSelectedKey: (_props_defaultSelectedKey = props.defaultSelectedKey) !== null && _props_defaultSelectedKey !== void 0 ? _props_defaultSelectedKey : $76f919a04c5a7d14$var$findDefaultSelectedKey(props.collection, props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set())
204
+ });
205
+ let { selectionManager, collection, selectedKey: currentSelectedKey } = state;
206
+ let lastSelectedKey = useRef(currentSelectedKey);
207
+ useEffect(() => {
208
+ let selectedKey = currentSelectedKey;
209
+ if (selectionManager.isEmpty || !collection.getItem(selectedKey)) {
210
+ selectedKey = $76f919a04c5a7d14$var$findDefaultSelectedKey(collection, state.disabledKeys);
211
+ if (selectedKey != null)
212
+ selectionManager.setSelectedKeys([
213
+ selectedKey
214
+ ]);
215
+ }
216
+ if (selectedKey != null && selectionManager.focusedKey == null || !selectionManager.isFocused && selectedKey !== lastSelectedKey.current)
217
+ selectionManager.setFocusedKey(selectedKey);
218
+ lastSelectedKey.current = selectedKey;
219
+ });
220
+ return {
221
+ ...state,
222
+ isDisabled: props.isDisabled || false
223
+ };
224
+ }
225
+ function $76f919a04c5a7d14$var$findDefaultSelectedKey(collection, disabledKeys) {
226
+ let selectedKey = null;
227
+ if (collection) {
228
+ selectedKey = collection.getFirstKey();
229
+ while (disabledKeys.has(selectedKey) && selectedKey !== collection.getLastKey())
230
+ selectedKey = collection.getKeyAfter(selectedKey);
231
+ if (disabledKeys.has(selectedKey) && selectedKey === collection.getLastKey())
232
+ selectedKey = collection.getFirstKey();
233
+ }
234
+ return selectedKey;
235
+ }
236
+ const $5e8ad37a45e1c704$export$cfa7aa87c26e7d1f = /* @__PURE__ */ createContext(null);
237
+ const $5e8ad37a45e1c704$export$364712098d2aa57c = /* @__PURE__ */ createContext(null);
238
+ function $5e8ad37a45e1c704$var$Tabs(props, ref) {
239
+ [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $5e8ad37a45e1c704$export$cfa7aa87c26e7d1f);
240
+ let { collection, document } = $7135fc7d473fd974$export$7cd71aa5ddd6dc4e();
241
+ let { children, orientation = "horizontal" } = props;
242
+ children = useMemo(() => typeof children === "function" ? children({
243
+ orientation,
244
+ defaultChildren: null
245
+ }) : children, [
246
+ children,
247
+ orientation
248
+ ]);
249
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$8dc98ba7eadeaa56, null, /* @__PURE__ */ React__default.createElement($7135fc7d473fd974$export$8c25dea96356a8b6.Provider, {
250
+ value: document
251
+ }, children)), /* @__PURE__ */ React__default.createElement($5e8ad37a45e1c704$var$TabsInner, {
252
+ props,
253
+ collection,
254
+ tabsRef: ref
255
+ }));
256
+ }
257
+ function $5e8ad37a45e1c704$var$TabsInner({ props, tabsRef: ref, collection }) {
258
+ let { orientation = "horizontal" } = props;
259
+ let state = $76f919a04c5a7d14$export$4ba071daf4e486({
260
+ ...props,
261
+ collection,
262
+ children: void 0
263
+ });
264
+ let { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f({
265
+ within: true
266
+ });
267
+ let values = useMemo(() => ({
268
+ orientation,
269
+ isFocusWithin: isFocused,
270
+ isFocusVisible
271
+ }), [
272
+ orientation,
273
+ isFocused,
274
+ isFocusVisible
275
+ ]);
276
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
277
+ ...props,
278
+ defaultClassName: "react-aria-Tabs",
279
+ values
280
+ });
281
+ return /* @__PURE__ */ React__default.createElement("div", {
282
+ ...$65484d02dcb7eb3e$export$457c3d6518dd4c6f(props),
283
+ ...focusProps,
284
+ ...renderProps,
285
+ ref,
286
+ slot: props.slot || void 0,
287
+ "data-focused": isFocused || void 0,
288
+ "data-orientation": orientation,
289
+ "data-focus-visible": isFocusVisible || void 0,
290
+ "data-disabled": state.isDisabled || void 0
291
+ }, /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
292
+ values: [
293
+ [
294
+ $5e8ad37a45e1c704$export$cfa7aa87c26e7d1f,
295
+ props
296
+ ],
297
+ [
298
+ $5e8ad37a45e1c704$export$364712098d2aa57c,
299
+ state
300
+ ]
301
+ ]
302
+ }, renderProps.children));
303
+ }
304
+ const $5e8ad37a45e1c704$export$b2539bed5023c21c = /* @__PURE__ */ forwardRef($5e8ad37a45e1c704$var$Tabs);
305
+ function $5e8ad37a45e1c704$var$TabList(props, ref) {
306
+ let document = useContext($7135fc7d473fd974$export$8c25dea96356a8b6);
307
+ return document ? /* @__PURE__ */ React__default.createElement($7135fc7d473fd974$export$813b5978dd974d8, props) : /* @__PURE__ */ React__default.createElement($5e8ad37a45e1c704$var$TabListInner, {
308
+ props,
309
+ forwardedRef: ref
310
+ });
311
+ }
312
+ function $5e8ad37a45e1c704$var$TabListInner({ props, forwardedRef: ref }) {
313
+ let state = useContext($5e8ad37a45e1c704$export$364712098d2aa57c);
314
+ let { orientation = "horizontal", keyboardActivation = "automatic" } = $64fa3d84918910a7$export$fabf2dc03a41866e($5e8ad37a45e1c704$export$cfa7aa87c26e7d1f);
315
+ let objectRef = $df56164dff5785e2$export$4338b53315abf666(ref);
316
+ let { tabListProps } = $58d314389b21fa3f$export$773e389e644c5874({
317
+ ...props,
318
+ orientation,
319
+ keyboardActivation
320
+ }, state, objectRef);
321
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
322
+ ...props,
323
+ children: null,
324
+ defaultClassName: "react-aria-TabList",
325
+ values: {
326
+ orientation,
327
+ state
328
+ }
329
+ });
330
+ let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
331
+ delete DOMProps.id;
332
+ return /* @__PURE__ */ React__default.createElement("div", {
333
+ ...DOMProps,
334
+ ...tabListProps,
335
+ ref: objectRef,
336
+ ...renderProps,
337
+ "data-orientation": orientation || void 0
338
+ }, [
339
+ ...state.collection
340
+ ].map((item) => /* @__PURE__ */ React__default.createElement($5e8ad37a45e1c704$var$TabInner, {
341
+ key: item.key,
342
+ item,
343
+ state
344
+ })));
345
+ }
346
+ const $5e8ad37a45e1c704$export$e51a686c67fdaa2d = /* @__PURE__ */ forwardRef($5e8ad37a45e1c704$var$TabList);
347
+ function $5e8ad37a45e1c704$var$Tab(props, ref) {
348
+ return $7135fc7d473fd974$export$e7c29ae2353b16ea("item", props, ref, props.children);
349
+ }
350
+ const $5e8ad37a45e1c704$export$3e41faf802a29e71 = /* @__PURE__ */ forwardRef($5e8ad37a45e1c704$var$Tab);
351
+ function $5e8ad37a45e1c704$var$TabInner({ item, state }) {
352
+ let ref = $df56164dff5785e2$export$4338b53315abf666(item.props.ref);
353
+ let { tabProps, isSelected, isDisabled, isPressed } = $0175d55c2a017ebc$export$fdf4756d5b8ef90a({
354
+ key: item.key,
355
+ ...item.props
356
+ }, state, ref);
357
+ let { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f();
358
+ let { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456({
359
+ isDisabled
360
+ });
361
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
362
+ ...item.props,
363
+ children: item.rendered,
364
+ defaultClassName: "react-aria-Tab",
365
+ values: {
366
+ isSelected,
367
+ isDisabled,
368
+ isFocused,
369
+ isFocusVisible,
370
+ isPressed,
371
+ isHovered,
372
+ state
373
+ }
374
+ });
375
+ let ElementType = item.props.href ? "a" : "div";
376
+ return /* @__PURE__ */ React__default.createElement(ElementType, {
377
+ ...$3ef42575df84b30b$export$9d1611c77c2fe928(tabProps, focusProps, hoverProps, renderProps),
378
+ ref,
379
+ "data-selected": isSelected || void 0,
380
+ "data-disabled": isDisabled || void 0,
381
+ "data-focused": isFocused || void 0,
382
+ "data-focus-visible": isFocusVisible || void 0,
383
+ "data-pressed": isPressed || void 0,
384
+ "data-hovered": isHovered || void 0
385
+ });
386
+ }
387
+ function $5e8ad37a45e1c704$var$TabPanel(props, forwardedRef) {
388
+ const state = useContext($5e8ad37a45e1c704$export$364712098d2aa57c);
389
+ let ref = $df56164dff5785e2$export$4338b53315abf666(forwardedRef);
390
+ let { tabPanelProps } = $34bce698202e07cb$export$fae0121b5afe572d(props, state, ref);
391
+ let { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f();
392
+ let isSelected = state.selectedKey === props.id;
393
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
394
+ ...props,
395
+ defaultClassName: "react-aria-TabPanel",
396
+ values: {
397
+ isFocused,
398
+ isFocusVisible,
399
+ isInert: !isSelected,
400
+ state
401
+ }
402
+ });
403
+ if (!isSelected && !props.shouldForceMount)
404
+ return null;
405
+ let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
406
+ delete DOMProps.id;
407
+ let domProps = isSelected ? $3ef42575df84b30b$export$9d1611c77c2fe928(DOMProps, tabPanelProps, focusProps, renderProps) : renderProps;
408
+ return /* @__PURE__ */ React__default.createElement("div", {
409
+ ...domProps,
410
+ ref,
411
+ "data-focused": isFocused || void 0,
412
+ "data-focus-visible": isFocusVisible || void 0,
413
+ // @ts-ignore
414
+ inert: !isSelected ? "true" : void 0,
415
+ "data-inert": !isSelected ? "true" : void 0
416
+ });
417
+ }
418
+ const $5e8ad37a45e1c704$export$3d96ec278d3efce4 = /* @__PURE__ */ $64fa3d84918910a7$export$86427a43e3e48ebb($5e8ad37a45e1c704$var$TabPanel);
419
+ /**
420
+ * Main tab container.
421
+ *
422
+ * @component
423
+ * @param {Object} props - Component props.
424
+ * @param {boolean} [props.vertical=false] - Whether the tabs are vertical.
425
+ * @param {string} [props.className] - Classes to pass to the tabs container.
426
+ *
427
+ * @returns {JSX.Element} The Tabs component.
428
+ *
429
+ * @example
430
+ * <Tabs>
431
+ * <TabList>
432
+ * <Tab>Tab 1</Tab>
433
+ * <Tab>Tab 2</Tab>
434
+ * </TabList>
435
+ * <TabPanel>Content 1</TabPanel>
436
+ * <TabPanel>Content 2</TabPanel>
437
+ * </Tabs>
438
+ *
439
+ * @preserve
440
+ */
441
+ const Tabs = (props) => {
442
+ const { children, vertical, className, ...rest } = props;
443
+ const baseId = useId();
444
+ let tabPanelCounter = 1;
445
+ let tabCounter = 1;
446
+ const preparedChildren = Array.isArray(children) ? children : [children];
447
+ const childrenWithIds = preparedChildren.reduce((acc, child, index) => {
448
+ var _a, _b, _c;
449
+ if (child.type.displayName === "TabList") {
450
+ const childItems = Array.isArray((_a = child == null ? void 0 : child.props) == null ? void 0 : _a.children) ? (_b = child == null ? void 0 : child.props) == null ? void 0 : _b.children : [(_c = child == null ? void 0 : child.props) == null ? void 0 : _c.children].filter(Boolean);
451
+ tabCounter = ((childItems == null ? void 0 : childItems.length) ?? 0) + 1;
452
+ if (childItems.length < 1) {
453
+ return acc;
454
+ }
455
+ return [
456
+ ...acc,
457
+ cloneElement(
458
+ child,
459
+ {
460
+ key: index
461
+ },
462
+ childItems == null ? void 0 : childItems.map(
463
+ (innerChild, i) => cloneElement(innerChild, {
464
+ id: `tab-${baseId}-${i + 1}`,
465
+ key: i,
466
+ isParentVertical: vertical
467
+ })
468
+ )
469
+ )
470
+ ];
471
+ }
472
+ if (child.type.displayName === "TabPanel") {
473
+ return [
474
+ ...acc,
475
+ cloneElement(child, {
476
+ id: `tab-${baseId}-${tabPanelCounter++}`,
477
+ key: index,
478
+ className: classnames(child.props.className, vertical && "es-uic-border-l es-uic-border-l-300 es-uic-pl-3")
479
+ })
480
+ ];
481
+ }
482
+ return acc;
483
+ }, []);
484
+ if (tabCounter !== tabPanelCounter) {
485
+ return /* @__PURE__ */ jsx(
486
+ Notice,
487
+ {
488
+ type: "error",
489
+ label: __(
490
+ "Component is not configured correctly. Skipping render to prevent errors.",
491
+ "eightshift-ui-components"
492
+ ),
493
+ subtitle: sprintf(
494
+ __(
495
+ "Number of <Tab>s (%s) and <TabPanel>s (%s) should be the same. <Tab>s should be within a <TabList>.",
496
+ "eightshift-ui-components"
497
+ ),
498
+ tabCounter - 1,
499
+ tabPanelCounter - 1
500
+ ),
501
+ alignIconToTitle: true
502
+ }
503
+ );
504
+ }
505
+ return /* @__PURE__ */ jsx(
506
+ $5e8ad37a45e1c704$export$b2539bed5023c21c,
507
+ {
508
+ ...rest,
509
+ orientation: vertical ? "vertical" : "horizontal",
510
+ className: classnames(
511
+ vertical ? "es-uic-grid es-uic-size-full es-uic-min-h-40 es-uic-grid-cols-[minmax(0,_15rem),_2fr] es-uic-gap-4" : "es-uic-flex-col",
512
+ className
513
+ ),
514
+ children: childrenWithIds
515
+ }
516
+ );
517
+ };
518
+ Tabs.displayName = "Tabs";
519
+ /**
520
+ * Container for tabs within the Tabs component.
521
+ *
522
+ * @component
523
+ * @param {Object} props - Component props.
524
+ * @param {string} [props.className] - Classes to pass to the tab list.
525
+ *
526
+ * @returns {JSX.Element} The TabList component.
527
+ *
528
+ * @see {@link Tabs} for usage example.
529
+ *
530
+ * @preserve
531
+ */
532
+ const TabList = (props) => {
533
+ const { children, "aria-label": ariaLabel, className, ...other } = props;
534
+ return /* @__PURE__ */ jsx(
535
+ $5e8ad37a45e1c704$export$e51a686c67fdaa2d,
536
+ {
537
+ "aria-label": ariaLabel ?? __("tabs", "eightshift-ui-components"),
538
+ className: ({ orientation }) => classnames(
539
+ "es-uic-flex es-uic-gap-1",
540
+ orientation === "vertical" && "es-uic-h-full es-uic-flex-col es-uic-pr-1.5",
541
+ orientation === "horizontal" && "es-uic-w-full es-uic-items-end es-uic-border-b es-uic-border-b-gray-300",
542
+ className
543
+ ),
544
+ ...other,
545
+ children
546
+ }
547
+ );
548
+ };
549
+ TabList.displayName = "TabList";
550
+ /**
551
+ * A tab within the TabList component, in the Tabs component.
552
+ *
553
+ * @component
554
+ * @param {Object} props - Component props.
555
+ * @param {boolean} [props.disabled] - Whether the tab is disabled.
556
+ * @param {string} [props.className] - Classes to pass to the tab.
557
+ *
558
+ * @returns {JSX.Element} The Tab component.
559
+ *
560
+ * @see {@link Tabs} for usage example.
561
+ *
562
+ * @preserve
563
+ */
564
+ const Tab = (props) => {
565
+ const { children, disabled, isParentVertical, className, ...other } = props;
566
+ return /* @__PURE__ */ jsx(
567
+ $5e8ad37a45e1c704$export$3e41faf802a29e71,
568
+ {
569
+ ...other,
570
+ isDisabled: disabled,
571
+ className: ({ isSelected, isDisabled }) => {
572
+ return classnames(
573
+ "es-uic-relative es-uic-flex es-uic-select-none es-uic-items-center es-uic-rounded es-uic-p-1.5 es-uic-text-sm es-uic-transition",
574
+ "focus:es-uic-outline-none focus-visible:es-uic-outline-none focus-visible:es-uic-ring focus-visible:es-uic-ring-teal-500 focus-visible:es-uic-ring-opacity-50",
575
+ 'after:es-uic-absolute after:es-uic-rounded-full after:es-uic-bg-teal-600 after:es-uic-shadow-sm after:es-uic-shadow-teal-500/25 after:es-uic-transition after:es-uic-duration-300 after:es-uic-content-[""]',
576
+ !isParentVertical && "after:es-uic-inset-x-0 after:-es-uic-bottom-px after:es-uic-h-0.5",
577
+ isSelected && "es-uic-border-b-teal-600 es-uic-text-teal-900 after:es-uic-opacity-100",
578
+ isSelected && isParentVertical && "after:es-uic-scale-y-100",
579
+ isSelected && !isParentVertical && "after:es-uic-scale-x-100",
580
+ !isSelected && !isDisabled && "es-uic-text-gray-800 after:es-uic-opacity-0 hover:es-uic-bg-gray-100",
581
+ !isSelected && !isDisabled && isParentVertical && "after:es-uic-scale-y-75",
582
+ !isSelected && !isDisabled && !isParentVertical && "after:es-uic-scale-x-75",
583
+ isDisabled && "es-uic-text-gray-300 after:es-uic-hidden",
584
+ isParentVertical && "es-uic-pl-3 after:es-uic-inset-y-0 after:es-uic-left-px after:es-uic-right-auto after:es-uic-my-auto after:es-uic-h-7 after:es-uic-w-[0.1875rem]",
585
+ className
586
+ );
587
+ },
588
+ children
589
+ }
590
+ );
591
+ };
592
+ Tab.displayName = "Tab";
593
+ /**
594
+ * Container for tab content within the Tabs component.
595
+ *
596
+ * @component
597
+ * @param {Object} props - Component props.
598
+ * @param {string} [props.className] - Classes to pass to the tab content container.
599
+ *
600
+ * @returns {JSX.Element} The TabPanel component.
601
+ *
602
+ * @see {@link Tabs} for usage example.
603
+ *
604
+ * @preserve
605
+ */
606
+ const TabPanel = (props) => {
607
+ const { children, className, ...other } = props;
608
+ return /* @__PURE__ */ jsx(
609
+ $5e8ad37a45e1c704$export$3d96ec278d3efce4,
610
+ {
611
+ ...other,
612
+ className: classnames(
613
+ "es-uic-mt-1.5 es-uic-space-y-2.5 es-uic-text-sm focus:es-uic-outline-none",
614
+ className
615
+ ),
616
+ children
617
+ }
618
+ );
619
+ };
620
+ TabPanel.displayName = "TabPanel";
621
+ export {
622
+ Tab,
623
+ TabList,
624
+ TabPanel,
625
+ Tabs
626
+ };