@eightshift/ui-components 5.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/Button-wERNNG0T.js +185 -0
  2. package/dist/Collection-CKsHTyhc.js +2363 -0
  3. package/dist/Color-BhgbJF5x.js +2452 -0
  4. package/dist/ColorSwatch-Bcn6oRSg.js +64 -0
  5. package/dist/ComboBox-D1LPUwWP.js +1906 -0
  6. package/dist/Dialog-D190gMbE.js +2298 -0
  7. package/dist/FieldError-DeUh5Wkw.js +42 -0
  8. package/dist/FocusScope-C-plSxbS.js +831 -0
  9. package/dist/Form-Cq3fu75_.js +5 -0
  10. package/dist/Group-C5iZpSAM.js +48 -0
  11. package/dist/Heading-D-Pboe4p.js +16 -0
  12. package/dist/Hidden-rE6uR-lr.js +41 -0
  13. package/dist/Input--mF4XVE1.js +133 -0
  14. package/dist/Label-Fp6AwSRn.js +17 -0
  15. package/dist/List-CZMUbkFU.js +593 -0
  16. package/dist/ListBox-4oW9kh3R.js +582 -0
  17. package/dist/NumberFormatter-DA8u1Ot7.js +140 -0
  18. package/dist/OverlayArrow-BpB9uB_I.js +637 -0
  19. package/dist/RSPContexts-2lR5GG9p.js +14 -0
  20. package/dist/Select-aab027f3.esm-BKIJGje-.js +2469 -0
  21. package/dist/Separator-B88tj5YD.js +323 -0
  22. package/dist/Slider-CyJzC1bp.js +853 -0
  23. package/dist/Text-DRpwWot2.js +16 -0
  24. package/dist/VisuallyHidden-DsKYcRQ_.js +48 -0
  25. package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
  26. package/dist/assets/index.css +57 -0
  27. package/dist/assets/style-admin.css +5864 -0
  28. package/dist/assets/style-editor.css +5864 -0
  29. package/dist/assets/style.css +5870 -0
  30. package/dist/assets/wp-font-enhancements.css +8 -0
  31. package/dist/assets/wp-ui-enhancements.css +377 -0
  32. package/dist/components/animated-visibility/animated-visibility.js +105 -0
  33. package/dist/components/base-control/base-control.js +86 -0
  34. package/dist/components/breakpoint-preview/breakpoint-preview.js +161 -0
  35. package/dist/components/button/button.js +387 -0
  36. package/dist/components/checkbox/checkbox.js +320 -0
  37. package/dist/components/color-pickers/color-picker.js +272 -0
  38. package/dist/components/color-pickers/color-swatch.js +59 -0
  39. package/dist/components/color-pickers/gradient-editor.js +534 -0
  40. package/dist/components/color-pickers/solid-color-picker.js +1567 -0
  41. package/dist/components/component-toggle/component-toggle.js +161 -0
  42. package/dist/components/container-panel/container-panel.js +131 -0
  43. package/dist/components/draggable/draggable-context.js +5 -0
  44. package/dist/components/draggable/draggable-handle.js +46 -0
  45. package/dist/components/draggable/draggable.js +6979 -0
  46. package/dist/components/draggable-list/draggable-list-context.js +5 -0
  47. package/dist/components/draggable-list/draggable-list-item.js +77 -0
  48. package/dist/components/draggable-list/draggable-list.js +151 -0
  49. package/dist/components/expandable/expandable.js +342 -0
  50. package/dist/components/index.js +137 -0
  51. package/dist/components/input-field/input-field.js +231 -0
  52. package/dist/components/item-collection/item-collection.js +59 -0
  53. package/dist/components/layout/hstack.js +30 -0
  54. package/dist/components/layout/vstack.js +30 -0
  55. package/dist/components/link-input/link-input.js +291 -0
  56. package/dist/components/matrix-align/matrix-align.js +134 -0
  57. package/dist/components/menu/menu.js +285 -0
  58. package/dist/components/modal/modal.js +305 -0
  59. package/dist/components/notice/notice.js +123 -0
  60. package/dist/components/number-picker/number-picker.js +292 -0
  61. package/dist/components/option-select/option-select.js +264 -0
  62. package/dist/components/options-panel/options-panel.js +158 -0
  63. package/dist/components/placeholders/file-placeholder.js +42 -0
  64. package/dist/components/placeholders/image-placeholder.js +88 -0
  65. package/dist/components/placeholders/media-placeholder.js +63 -0
  66. package/dist/components/popover/popover.js +207 -0
  67. package/dist/components/radio/radio.js +579 -0
  68. package/dist/components/repeater/repeater-context.js +5 -0
  69. package/dist/components/repeater/repeater-item.js +119 -0
  70. package/dist/components/repeater/repeater.js +280 -0
  71. package/dist/components/responsive/mini-responsive.js +498 -0
  72. package/dist/components/responsive/responsive-legacy.js +343 -0
  73. package/dist/components/responsive/responsive.js +583 -0
  74. package/dist/components/responsive-preview/responsive-preview.js +123 -0
  75. package/dist/components/rich-label/rich-label.js +66 -0
  76. package/dist/components/select/async-multi-select.js +157 -0
  77. package/dist/components/select/async-single-select.js +137 -0
  78. package/dist/components/select/custom-select-default-components.js +38 -0
  79. package/dist/components/select/multi-select-components.js +8 -0
  80. package/dist/components/select/multi-select.js +151 -0
  81. package/dist/components/select/react-select-component-wrappers.js +90 -0
  82. package/dist/components/select/shared.js +26 -0
  83. package/dist/components/select/single-select.js +131 -0
  84. package/dist/components/select/styles.js +49 -0
  85. package/dist/components/select/v2/async-select.js +297 -0
  86. package/dist/components/select/v2/shared.js +24 -0
  87. package/dist/components/select/v2/single-select.js +991 -0
  88. package/dist/components/slider/column-config-slider.js +210 -0
  89. package/dist/components/slider/slider.js +345 -0
  90. package/dist/components/slider/utils.js +94 -0
  91. package/dist/components/spacer/spacer.js +97 -0
  92. package/dist/components/tabs/tabs.js +704 -0
  93. package/dist/components/toggle/switch.js +156 -0
  94. package/dist/components/toggle/toggle.js +64 -0
  95. package/dist/components/toggle-button/toggle-button.js +343 -0
  96. package/dist/components/tooltip/tooltip.js +527 -0
  97. package/dist/context-BYWrbm1z.js +92 -0
  98. package/dist/default-i18n-CT_oS1Fy.js +922 -0
  99. package/dist/filterDOMProps-EDDcM64A.js +28 -0
  100. package/dist/icons/block-icon.js +42 -0
  101. package/dist/icons/generic-color-swatch.js +113 -0
  102. package/dist/icons/icons.js +30371 -0
  103. package/dist/icons/index.js +11 -0
  104. package/dist/icons/jsx-svg.js +50 -0
  105. package/dist/index-641ee5b8.esm-BPU8rMZr.js +3137 -0
  106. package/dist/index-CFozsmNS.js +28321 -0
  107. package/dist/index-wl5606BX.js +44 -0
  108. package/dist/index.js +139 -0
  109. package/dist/lite-DVmmD_-j.js +7 -0
  110. package/dist/modifiers.esm-BuJQPI1X.js +31 -0
  111. package/dist/multi-select-components-Sp-JEFEX.js +3744 -0
  112. package/dist/number-GajL10e1.js +36 -0
  113. package/dist/react-jsx-parser.min-DZCiis5V.js +11753 -0
  114. package/dist/react-select-async.esm-D937XTWW.js +107 -0
  115. package/dist/react-select.esm-Ciai3aKf.js +15 -0
  116. package/dist/style-admin.js +1 -0
  117. package/dist/style-editor.js +1 -0
  118. package/dist/style.js +1 -0
  119. package/dist/textSelection-CCcyjiRP.js +46 -0
  120. package/dist/useButton-BOHxkGQF.js +50 -0
  121. package/dist/useEvent-D5o_CqDH.js +23 -0
  122. package/dist/useFocusRing-nMG2uzxS.js +107 -0
  123. package/dist/useFormReset-DlmRL87g.js +22 -0
  124. package/dist/useFormValidation-D0_aaK-e.js +224 -0
  125. package/dist/useHover-VO5tcIli.js +890 -0
  126. package/dist/useLabel-BKH4fVA4.js +27 -0
  127. package/dist/useLabels-ntF3rFY0.js +23 -0
  128. package/dist/useListState-Cq2Nvr-v.js +161 -0
  129. package/dist/useLocalizedStringFormatter-CGzwx1a0.js +121 -0
  130. package/dist/useNumberField-C9dmERhP.js +1207 -0
  131. package/dist/useNumberFormatter-MrRLgvhj.js +13 -0
  132. package/dist/usePress-DjNo5790.js +677 -0
  133. package/dist/useSingleSelectListState--r3AAhRj.js +38 -0
  134. package/dist/useToggle-CQaXLe-O.js +59 -0
  135. package/dist/useToggleState-C3DLdez5.js +19 -0
  136. package/dist/utilities/array-helpers.js +56 -0
  137. package/dist/utilities/debounce-throttle.js +123 -0
  138. package/dist/utilities/es-dash.js +382 -0
  139. package/dist/utilities/index.js +27 -0
  140. package/dist/utilities/text-helpers.js +136 -0
  141. package/dist/utils-B94NDG0v.js +370 -0
  142. package/dist/wp/wp-font-enhancements.js +1 -0
  143. package/dist/wp/wp-ui-enhancements.js +1 -0
  144. package/package.json +8 -8
@@ -0,0 +1,704 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { c as $880e95eb8b93ba9a$export$ecf600387e221c37, k as $ae20dd8cbca75726$export$d6daf82dcd84e87c, d as $e1995378a142960e$export$18af5c7a9e9b3664, f as $e1995378a142960e$export$fb8073518f34e6ec, g as $7135fc7d473fd974$export$4feb769f8ddf26c5, m as $7135fc7d473fd974$export$a164736487e3f0ae, e as $e1995378a142960e$export$bf788dd355e3a401, n as $7135fc7d473fd974$export$90e00781bc59d8f9 } from "../../Collection-CKsHTyhc.js";
3
+ import { k as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, d as $3ef42575df84b30b$export$9d1611c77c2fe928, e as $bdb11010cef70236$export$f680877a34711e37, l as $df56164dff5785e2$export$4338b53315abf666, b as $64fa3d84918910a7$export$4d86445c2cf5e3, i as $64fa3d84918910a7$export$2881499e37b75b9a, a as $64fa3d84918910a7$export$29f1550f4b0d4415, $ as $64fa3d84918910a7$export$fabf2dc03a41866e } from "../../utils-B94NDG0v.js";
4
+ import { $ as $f39a9eba43920ace$export$86427a43e3e48ebb } from "../../Hidden-rE6uR-lr.js";
5
+ import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-EDDcM64A.js";
6
+ import React__default, { version, useState, useMemo, useRef, useEffect, forwardRef, useContext, createContext, isValidElement, useId, cloneElement } from "react";
7
+ import { a as $ea8dcbcb9ea1b556$export$7e924b3091a3bd18 } from "../../usePress-DjNo5790.js";
8
+ import { a as $f645667febf57a63$export$4c014de7c8940b4c, $ as $6179b936705e76d3$export$ae780daf29e6d456 } from "../../useHover-VO5tcIli.js";
9
+ import { $ as $313b98861ee5dd6c$export$d6875122194c7b44 } from "../../useLabels-ntF3rFY0.js";
10
+ import { a as $9bf71ea28793e738$export$2d6ec8fc375ceafa } from "../../FocusScope-C-plSxbS.js";
11
+ import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "../../context-BYWrbm1z.js";
12
+ import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "../../useFocusRing-nMG2uzxS.js";
13
+ import { $ as $a0d645289fe9b86b$export$e7f05e985daf4b5f } from "../../useSingleSelectListState--r3AAhRj.js";
14
+ import { _ as __, s as sprintf } from "../../default-i18n-CT_oS1Fy.js";
15
+ import { c as clsx } from "../../lite-DVmmD_-j.js";
16
+ import { c as cva } from "../../index-wl5606BX.js";
17
+ import { Notice } from "../notice/notice.js";
18
+ import { RichLabel } from "../rich-label/rich-label.js";
19
+ function $cdc5a6778b766db2$export$a9d04c5684123369(value) {
20
+ const pieces = version.split(".");
21
+ const major = parseInt(pieces[0], 10);
22
+ if (major >= 19) return value;
23
+ return value ? "true" : void 0;
24
+ }
25
+ function $83013635b024ae3d$export$eac1895992b9f3d6(ref, options) {
26
+ let isDisabled = options === null || options === void 0 ? void 0 : options.isDisabled;
27
+ let [hasTabbableChild, setHasTabbableChild] = useState(false);
28
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
29
+ if ((ref === null || ref === void 0 ? void 0 : ref.current) && !isDisabled) {
30
+ let update = () => {
31
+ if (ref.current) {
32
+ let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(ref.current, {
33
+ tabbable: true
34
+ });
35
+ setHasTabbableChild(!!walker.nextNode());
36
+ }
37
+ };
38
+ update();
39
+ let observer = new MutationObserver(update);
40
+ observer.observe(ref.current, {
41
+ subtree: true,
42
+ childList: true,
43
+ attributes: true,
44
+ attributeFilter: [
45
+ "tabIndex",
46
+ "disabled"
47
+ ]
48
+ });
49
+ return () => {
50
+ observer.disconnect();
51
+ };
52
+ }
53
+ });
54
+ return isDisabled ? false : hasTabbableChild;
55
+ }
56
+ const $99b62ae3ff97ec45$export$c5f62239608282b6 = /* @__PURE__ */ new WeakMap();
57
+ function $99b62ae3ff97ec45$export$567fc7097e064344(state, key, role) {
58
+ if (!state)
59
+ return "";
60
+ if (typeof key === "string") key = key.replace(/\s+/g, "");
61
+ let baseId = $99b62ae3ff97ec45$export$c5f62239608282b6.get(state);
62
+ return `${baseId}-${role}-${key}`;
63
+ }
64
+ function $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
65
+ let { key, isDisabled: propsDisabled, shouldSelectOnPressUp } = props;
66
+ let { selectionManager: manager, selectedKey } = state;
67
+ let isSelected = key === selectedKey;
68
+ let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);
69
+ let { itemProps, isPressed } = $880e95eb8b93ba9a$export$ecf600387e221c37({
70
+ selectionManager: manager,
71
+ key,
72
+ ref,
73
+ isDisabled,
74
+ shouldSelectOnPressUp,
75
+ linkBehavior: "selection"
76
+ });
77
+ let tabId = $99b62ae3ff97ec45$export$567fc7097e064344(state, key, "tab");
78
+ let tabPanelId = $99b62ae3ff97ec45$export$567fc7097e064344(state, key, "tabpanel");
79
+ let { tabIndex } = itemProps;
80
+ let item = state.collection.getItem(key);
81
+ let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(item === null || item === void 0 ? void 0 : item.props, {
82
+ labelable: true
83
+ });
84
+ delete domProps.id;
85
+ let linkProps = $ea8dcbcb9ea1b556$export$7e924b3091a3bd18(item === null || item === void 0 ? void 0 : item.props);
86
+ let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c({
87
+ isDisabled
88
+ }, ref);
89
+ return {
90
+ tabProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, focusableProps, linkProps, itemProps, {
91
+ id: tabId,
92
+ "aria-selected": isSelected,
93
+ "aria-disabled": isDisabled || void 0,
94
+ "aria-controls": isSelected ? tabPanelId : void 0,
95
+ tabIndex: isDisabled ? void 0 : tabIndex,
96
+ role: "tab"
97
+ }),
98
+ isSelected,
99
+ isDisabled,
100
+ isPressed
101
+ };
102
+ }
103
+ function $34bce698202e07cb$export$fae0121b5afe572d(props, state, ref) {
104
+ let tabIndex = $83013635b024ae3d$export$eac1895992b9f3d6(ref) ? void 0 : 0;
105
+ var _props_id;
106
+ 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");
107
+ const tabPanelProps = $313b98861ee5dd6c$export$d6875122194c7b44({
108
+ ...props,
109
+ id,
110
+ "aria-labelledby": $99b62ae3ff97ec45$export$567fc7097e064344(state, state === null || state === void 0 ? void 0 : state.selectedKey, "tab")
111
+ });
112
+ return {
113
+ tabPanelProps: $3ef42575df84b30b$export$9d1611c77c2fe928(tabPanelProps, {
114
+ tabIndex,
115
+ role: "tabpanel",
116
+ "aria-describedby": props["aria-describedby"],
117
+ "aria-details": props["aria-details"]
118
+ })
119
+ };
120
+ }
121
+ class $bfc6f2d60b8a4c40$export$15010ca3c1abe90b {
122
+ getKeyLeftOf(key) {
123
+ if (this.flipDirection) return this.getNextKey(key);
124
+ return this.getPreviousKey(key);
125
+ }
126
+ getKeyRightOf(key) {
127
+ if (this.flipDirection) return this.getPreviousKey(key);
128
+ return this.getNextKey(key);
129
+ }
130
+ isDisabled(key) {
131
+ var _this_collection_getItem_props, _this_collection_getItem;
132
+ 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);
133
+ }
134
+ getFirstKey() {
135
+ let key = this.collection.getFirstKey();
136
+ if (key != null && this.isDisabled(key)) key = this.getNextKey(key);
137
+ return key;
138
+ }
139
+ getLastKey() {
140
+ let key = this.collection.getLastKey();
141
+ if (key != null && this.isDisabled(key)) key = this.getPreviousKey(key);
142
+ return key;
143
+ }
144
+ getKeyAbove(key) {
145
+ if (this.tabDirection) return null;
146
+ return this.getPreviousKey(key);
147
+ }
148
+ getKeyBelow(key) {
149
+ if (this.tabDirection) return null;
150
+ return this.getNextKey(key);
151
+ }
152
+ getNextKey(startKey) {
153
+ let key = startKey;
154
+ do {
155
+ key = this.collection.getKeyAfter(key);
156
+ if (key == null) key = this.collection.getFirstKey();
157
+ } while (key != null && this.isDisabled(key));
158
+ return key;
159
+ }
160
+ getPreviousKey(startKey) {
161
+ let key = startKey;
162
+ do {
163
+ key = this.collection.getKeyBefore(key);
164
+ if (key == null) key = this.collection.getLastKey();
165
+ } while (key != null && this.isDisabled(key));
166
+ return key;
167
+ }
168
+ constructor(collection, direction, orientation, disabledKeys = /* @__PURE__ */ new Set()) {
169
+ this.collection = collection;
170
+ this.flipDirection = direction === "rtl" && orientation === "horizontal";
171
+ this.disabledKeys = disabledKeys;
172
+ this.tabDirection = orientation === "horizontal";
173
+ }
174
+ }
175
+ function $58d314389b21fa3f$export$773e389e644c5874(props, state, ref) {
176
+ let { orientation = "horizontal", keyboardActivation = "automatic" } = props;
177
+ let { collection, selectionManager: manager, disabledKeys } = state;
178
+ let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
179
+ let delegate = useMemo(() => new $bfc6f2d60b8a4c40$export$15010ca3c1abe90b(collection, direction, orientation, disabledKeys), [
180
+ collection,
181
+ disabledKeys,
182
+ orientation,
183
+ direction
184
+ ]);
185
+ let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c({
186
+ ref,
187
+ selectionManager: manager,
188
+ keyboardDelegate: delegate,
189
+ selectOnFocus: keyboardActivation === "automatic",
190
+ disallowEmptySelection: true,
191
+ scrollRef: ref,
192
+ linkBehavior: "selection"
193
+ });
194
+ let tabsId = $bdb11010cef70236$export$f680877a34711e37();
195
+ $99b62ae3ff97ec45$export$c5f62239608282b6.set(state, tabsId);
196
+ let tabListLabelProps = $313b98861ee5dd6c$export$d6875122194c7b44({
197
+ ...props,
198
+ id: tabsId
199
+ });
200
+ return {
201
+ tabListProps: {
202
+ ...$3ef42575df84b30b$export$9d1611c77c2fe928(collectionProps, tabListLabelProps),
203
+ role: "tablist",
204
+ "aria-orientation": orientation,
205
+ tabIndex: void 0
206
+ }
207
+ };
208
+ }
209
+ function $76f919a04c5a7d14$export$4ba071daf4e486(props) {
210
+ var _props_defaultSelectedKey, _ref;
211
+ let state = $a0d645289fe9b86b$export$e7f05e985daf4b5f({
212
+ ...props,
213
+ suppressTextValueWarning: true,
214
+ defaultSelectedKey: (_ref = (_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())) !== null && _ref !== void 0 ? _ref : void 0
215
+ });
216
+ let { selectionManager, collection, selectedKey: currentSelectedKey } = state;
217
+ let lastSelectedKey = useRef(currentSelectedKey);
218
+ useEffect(() => {
219
+ let selectedKey = currentSelectedKey;
220
+ if (props.selectedKey == null && (selectionManager.isEmpty || selectedKey == null || !collection.getItem(selectedKey))) {
221
+ selectedKey = $76f919a04c5a7d14$var$findDefaultSelectedKey(collection, state.disabledKeys);
222
+ if (selectedKey != null)
223
+ selectionManager.setSelectedKeys([
224
+ selectedKey
225
+ ]);
226
+ }
227
+ if (selectedKey != null && selectionManager.focusedKey == null || !selectionManager.isFocused && selectedKey !== lastSelectedKey.current) selectionManager.setFocusedKey(selectedKey);
228
+ lastSelectedKey.current = selectedKey;
229
+ });
230
+ return {
231
+ ...state,
232
+ isDisabled: props.isDisabled || false
233
+ };
234
+ }
235
+ function $76f919a04c5a7d14$var$findDefaultSelectedKey(collection, disabledKeys) {
236
+ let selectedKey = null;
237
+ if (collection) {
238
+ var _collection_getItem_props, _collection_getItem, _collection_getItem_props1, _collection_getItem1;
239
+ selectedKey = collection.getFirstKey();
240
+ while (selectedKey != null && (disabledKeys.has(selectedKey) || ((_collection_getItem = collection.getItem(selectedKey)) === null || _collection_getItem === void 0 ? void 0 : (_collection_getItem_props = _collection_getItem.props) === null || _collection_getItem_props === void 0 ? void 0 : _collection_getItem_props.isDisabled)) && selectedKey !== collection.getLastKey()) selectedKey = collection.getKeyAfter(selectedKey);
241
+ if (selectedKey != null && (disabledKeys.has(selectedKey) || ((_collection_getItem1 = collection.getItem(selectedKey)) === null || _collection_getItem1 === void 0 ? void 0 : (_collection_getItem_props1 = _collection_getItem1.props) === null || _collection_getItem_props1 === void 0 ? void 0 : _collection_getItem_props1.isDisabled)) && selectedKey === collection.getLastKey()) selectedKey = collection.getFirstKey();
242
+ }
243
+ return selectedKey;
244
+ }
245
+ const $5e8ad37a45e1c704$export$cfa7aa87c26e7d1f = /* @__PURE__ */ createContext(null);
246
+ const $5e8ad37a45e1c704$export$364712098d2aa57c = /* @__PURE__ */ createContext(null);
247
+ const $5e8ad37a45e1c704$export$b2539bed5023c21c = /* @__PURE__ */ forwardRef(function Tabs(props, ref) {
248
+ [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $5e8ad37a45e1c704$export$cfa7aa87c26e7d1f);
249
+ let { children, orientation = "horizontal" } = props;
250
+ children = useMemo(() => typeof children === "function" ? children({
251
+ orientation,
252
+ defaultChildren: null
253
+ }) : children, [
254
+ children,
255
+ orientation
256
+ ]);
257
+ return /* @__PURE__ */ React__default.createElement($e1995378a142960e$export$bf788dd355e3a401, {
258
+ content: children
259
+ }, (collection) => /* @__PURE__ */ React__default.createElement($5e8ad37a45e1c704$var$TabsInner, {
260
+ props,
261
+ collection,
262
+ tabsRef: ref
263
+ }));
264
+ });
265
+ function $5e8ad37a45e1c704$var$TabsInner({ props, tabsRef: ref, collection }) {
266
+ let { orientation = "horizontal" } = props;
267
+ let state = $76f919a04c5a7d14$export$4ba071daf4e486({
268
+ ...props,
269
+ collection,
270
+ children: void 0
271
+ });
272
+ let { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f({
273
+ within: true
274
+ });
275
+ let values = useMemo(() => ({
276
+ orientation,
277
+ isFocusWithin: isFocused,
278
+ isFocusVisible
279
+ }), [
280
+ orientation,
281
+ isFocused,
282
+ isFocusVisible
283
+ ]);
284
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
285
+ ...props,
286
+ defaultClassName: "react-aria-Tabs",
287
+ values
288
+ });
289
+ return /* @__PURE__ */ React__default.createElement("div", {
290
+ ...$65484d02dcb7eb3e$export$457c3d6518dd4c6f(props),
291
+ ...focusProps,
292
+ ...renderProps,
293
+ ref,
294
+ slot: props.slot || void 0,
295
+ "data-focused": isFocused || void 0,
296
+ "data-orientation": orientation,
297
+ "data-focus-visible": isFocusVisible || void 0,
298
+ "data-disabled": state.isDisabled || void 0
299
+ }, /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
300
+ values: [
301
+ [
302
+ $5e8ad37a45e1c704$export$cfa7aa87c26e7d1f,
303
+ props
304
+ ],
305
+ [
306
+ $5e8ad37a45e1c704$export$364712098d2aa57c,
307
+ state
308
+ ]
309
+ ]
310
+ }, renderProps.children));
311
+ }
312
+ const $5e8ad37a45e1c704$export$e51a686c67fdaa2d = /* @__PURE__ */ forwardRef(function TabList(props, ref) {
313
+ let state = useContext($5e8ad37a45e1c704$export$364712098d2aa57c);
314
+ return state ? /* @__PURE__ */ React__default.createElement($5e8ad37a45e1c704$var$TabListInner, {
315
+ props,
316
+ forwardedRef: ref
317
+ }) : /* @__PURE__ */ React__default.createElement($e1995378a142960e$export$fb8073518f34e6ec, props);
318
+ });
319
+ function $5e8ad37a45e1c704$var$TabListInner({ props, forwardedRef: ref }) {
320
+ let state = useContext($5e8ad37a45e1c704$export$364712098d2aa57c);
321
+ let { CollectionRoot } = useContext($7135fc7d473fd974$export$4feb769f8ddf26c5);
322
+ let { orientation = "horizontal", keyboardActivation = "automatic" } = $64fa3d84918910a7$export$fabf2dc03a41866e($5e8ad37a45e1c704$export$cfa7aa87c26e7d1f);
323
+ let objectRef = $df56164dff5785e2$export$4338b53315abf666(ref);
324
+ let { tabListProps } = $58d314389b21fa3f$export$773e389e644c5874({
325
+ ...props,
326
+ orientation,
327
+ keyboardActivation
328
+ }, state, objectRef);
329
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
330
+ ...props,
331
+ children: null,
332
+ defaultClassName: "react-aria-TabList",
333
+ values: {
334
+ orientation,
335
+ state
336
+ }
337
+ });
338
+ let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
339
+ delete DOMProps.id;
340
+ return /* @__PURE__ */ React__default.createElement("div", {
341
+ ...DOMProps,
342
+ ...tabListProps,
343
+ ref: objectRef,
344
+ ...renderProps,
345
+ "data-orientation": orientation || void 0
346
+ }, /* @__PURE__ */ React__default.createElement(CollectionRoot, {
347
+ collection: state.collection,
348
+ persistedKeys: $7135fc7d473fd974$export$90e00781bc59d8f9(state.selectionManager.focusedKey)
349
+ }));
350
+ }
351
+ const $5e8ad37a45e1c704$export$3e41faf802a29e71 = /* @__PURE__ */ $e1995378a142960e$export$18af5c7a9e9b3664("item", (props, forwardedRef, item) => {
352
+ let state = useContext($5e8ad37a45e1c704$export$364712098d2aa57c);
353
+ let ref = $df56164dff5785e2$export$4338b53315abf666(forwardedRef);
354
+ let { tabProps, isSelected, isDisabled, isPressed } = $0175d55c2a017ebc$export$fdf4756d5b8ef90a({
355
+ key: item.key,
356
+ ...props
357
+ }, state, ref);
358
+ let { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f();
359
+ let { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456({
360
+ isDisabled,
361
+ onHoverStart: props.onHoverStart,
362
+ onHoverEnd: props.onHoverEnd,
363
+ onHoverChange: props.onHoverChange
364
+ });
365
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
366
+ ...props,
367
+ id: void 0,
368
+ children: item.rendered,
369
+ defaultClassName: "react-aria-Tab",
370
+ values: {
371
+ isSelected,
372
+ isDisabled,
373
+ isFocused,
374
+ isFocusVisible,
375
+ isPressed,
376
+ isHovered
377
+ }
378
+ });
379
+ let ElementType = item.props.href ? "a" : "div";
380
+ return /* @__PURE__ */ React__default.createElement(ElementType, {
381
+ ...$3ef42575df84b30b$export$9d1611c77c2fe928(tabProps, focusProps, hoverProps, renderProps),
382
+ ref,
383
+ "data-selected": isSelected || void 0,
384
+ "data-disabled": isDisabled || void 0,
385
+ "data-focused": isFocused || void 0,
386
+ "data-focus-visible": isFocusVisible || void 0,
387
+ "data-pressed": isPressed || void 0,
388
+ "data-hovered": isHovered || void 0
389
+ }, renderProps.children);
390
+ });
391
+ const $5e8ad37a45e1c704$export$3d96ec278d3efce4 = /* @__PURE__ */ $f39a9eba43920ace$export$86427a43e3e48ebb(function TabPanel(props, forwardedRef) {
392
+ const state = useContext($5e8ad37a45e1c704$export$364712098d2aa57c);
393
+ let ref = $df56164dff5785e2$export$4338b53315abf666(forwardedRef);
394
+ let { tabPanelProps } = $34bce698202e07cb$export$fae0121b5afe572d(props, state, ref);
395
+ let { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f();
396
+ let isSelected = state.selectedKey === props.id;
397
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
398
+ ...props,
399
+ defaultClassName: "react-aria-TabPanel",
400
+ values: {
401
+ isFocused,
402
+ isFocusVisible,
403
+ isInert: !isSelected,
404
+ state
405
+ }
406
+ });
407
+ if (!isSelected && !props.shouldForceMount) return null;
408
+ let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
409
+ delete DOMProps.id;
410
+ let domProps = isSelected ? $3ef42575df84b30b$export$9d1611c77c2fe928(DOMProps, tabPanelProps, focusProps, renderProps) : renderProps;
411
+ return /* @__PURE__ */ React__default.createElement("div", {
412
+ ...domProps,
413
+ ref,
414
+ "data-focused": isFocused || void 0,
415
+ "data-focus-visible": isFocusVisible || void 0,
416
+ // @ts-ignore
417
+ inert: $cdc5a6778b766db2$export$a9d04c5684123369(!isSelected),
418
+ "data-inert": !isSelected ? "true" : void 0
419
+ }, /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
420
+ values: [
421
+ [
422
+ $5e8ad37a45e1c704$export$cfa7aa87c26e7d1f,
423
+ null
424
+ ],
425
+ [
426
+ $5e8ad37a45e1c704$export$364712098d2aa57c,
427
+ null
428
+ ]
429
+ ]
430
+ }, /* @__PURE__ */ React__default.createElement($7135fc7d473fd974$export$4feb769f8ddf26c5.Provider, {
431
+ value: $7135fc7d473fd974$export$a164736487e3f0ae
432
+ }, renderProps.children)));
433
+ });
434
+ /**
435
+ * Main tab container.
436
+ *
437
+ * @component
438
+ * @param {Object} props - Component props.
439
+ * @param {boolean} [props.vertical=false] - Whether the tabs are vertical.
440
+ * @param {string} [props.className] - Classes to pass to the tabs container.
441
+ * @param {TabsType} [props.type='underline'] - Design of the tabs.
442
+ * @param {boolean} [props.hidden] - If `true`, the component is not rendered.
443
+ *
444
+ * @returns {JSX.Element} The Tabs component.
445
+ *
446
+ * @typedef {'underline' | 'pill' | 'pillInverse' | 'pillCompact' | 'pillCompactInverse'} TabsType
447
+ *
448
+ * @example
449
+ * <Tabs>
450
+ * <TabList>
451
+ * <Tab>Tab 1</Tab>
452
+ * <Tab>Tab 2</Tab>
453
+ * </TabList>
454
+ * <TabPanel>Content 1</TabPanel>
455
+ * <TabPanel>Content 2</TabPanel>
456
+ * </Tabs>
457
+ *
458
+ * @preserve
459
+ */
460
+ const Tabs2 = (props) => {
461
+ const { children, vertical, className, hidden, type = "underline", ...rest } = props;
462
+ const baseId = useId();
463
+ if (hidden) {
464
+ return null;
465
+ }
466
+ let tabPanelCounter = 1;
467
+ let tabCounter = 1;
468
+ const preparedChildren = Array.isArray(children) ? children : [children];
469
+ const childrenWithIds = preparedChildren.reduce((acc, child, index) => {
470
+ var _a, _b, _c;
471
+ if (child.type.displayName === "TabList") {
472
+ 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);
473
+ tabCounter = ((childItems == null ? void 0 : childItems.length) ?? 0) + 1;
474
+ if (childItems.length < 1) {
475
+ return acc;
476
+ }
477
+ return [
478
+ ...acc,
479
+ cloneElement(
480
+ child,
481
+ {
482
+ key: index,
483
+ type
484
+ },
485
+ childItems == null ? void 0 : childItems.map(
486
+ (innerChild, i) => cloneElement(innerChild, {
487
+ id: `tab-${baseId}-${i + 1}`,
488
+ key: i,
489
+ isParentVertical: vertical,
490
+ type
491
+ })
492
+ )
493
+ )
494
+ ];
495
+ }
496
+ if (child.type.displayName === "TabPanel") {
497
+ return [
498
+ ...acc,
499
+ cloneElement(child, {
500
+ id: `tab-${baseId}-${tabPanelCounter++}`,
501
+ key: index,
502
+ className: clsx(child.props.className, vertical && "es:pl-3")
503
+ })
504
+ ];
505
+ }
506
+ return acc;
507
+ }, []);
508
+ if (tabCounter !== tabPanelCounter) {
509
+ return /* @__PURE__ */ jsx(
510
+ Notice,
511
+ {
512
+ type: "error",
513
+ label: __("Component is not configured correctly. Skipping render to prevent errors.", "eightshift-ui-components"),
514
+ subtitle: sprintf(
515
+ __("Number of <Tab>s (%s) and <TabPanel>s (%s) should be the same. <Tab>s should be within a <TabList>.", "eightshift-ui-components"),
516
+ tabCounter - 1,
517
+ tabPanelCounter - 1
518
+ ),
519
+ alignIconToTitle: true
520
+ }
521
+ );
522
+ }
523
+ return /* @__PURE__ */ jsx(
524
+ $5e8ad37a45e1c704$export$b2539bed5023c21c,
525
+ {
526
+ ...rest,
527
+ orientation: vertical ? "vertical" : "horizontal",
528
+ className: clsx(vertical ? "es:grid es:size-full es:min-h-40 es:grid-cols-[minmax(0,15rem)_2fr] es:gap-4" : "es:flex-col", className),
529
+ children: childrenWithIds
530
+ }
531
+ );
532
+ };
533
+ Tabs2.displayName = "Tabs";
534
+ /**
535
+ * Container for tabs within the Tabs component.
536
+ *
537
+ * @component
538
+ * @param {Object} props - Component props.
539
+ * @param {string} [props.className] - Classes to pass to the tab list.
540
+ *
541
+ * @returns {JSX.Element} The TabList component.
542
+ *
543
+ * @see {@link Tabs} for usage example.
544
+ *
545
+ * @preserve
546
+ */
547
+ const TabList2 = (props) => {
548
+ const { children, "aria-label": ariaLabel, className, type, ...other } = props;
549
+ return /* @__PURE__ */ jsx(
550
+ $5e8ad37a45e1c704$export$e51a686c67fdaa2d,
551
+ {
552
+ "aria-label": ariaLabel ?? __("tabs", "eightshift-ui-components"),
553
+ className: ({ orientation }) => {
554
+ const horizontal = orientation === "horizontal";
555
+ const vertical = orientation === "vertical";
556
+ return clsx(
557
+ "es:flex es:p-0.5 es:-m-0.5",
558
+ vertical && "es:h-full es:flex-col es:gap-1.5 es:pr-1.5 es:overflow-y-auto es:overflow-x-visible",
559
+ horizontal && "es:w-full es:items-stretch es:gap-1.5 es:overflow-x-auto es:overflow-y-visible es:mb-3",
560
+ horizontal && type === "underline" && 'es:relative es:isolate es:after:content-[""] es:after:-z-10 es:after:absolute es:after:bottom-0.5 es:after:left-0 es:after:w-full es:after:h-px es:after:bg-secondary-300',
561
+ className
562
+ );
563
+ },
564
+ ...other,
565
+ children
566
+ }
567
+ );
568
+ };
569
+ TabList2.displayName = "TabList";
570
+ /**
571
+ * A tab within the TabList component, in the Tabs component.
572
+ *
573
+ * @component
574
+ * @param {Object} props - Component props.
575
+ * @param {boolean} [props.disabled] - Whether the tab is disabled.
576
+ * @param {string} [props.className] - Classes to pass to the tab.
577
+ * @param {JSX.Element} [props.icon] - Icon to show on the tab.
578
+ * @param {string|JSX.Element} [props.badge] - Badge to render besides the label.
579
+ * @param {boolean} [props.invisible] - If `true`, the tab is disabled and not rendered, but is not unmounted from the DOM.
580
+ * @param {string} [props.label] - Tab label. **Note**: overrides inner items!
581
+ * @param {string} [props.subtitle] - Tab subtitle. **Note**: overrides inner items!
582
+ *
583
+ * @returns {JSX.Element} The Tab component.
584
+ *
585
+ * @see {@link Tabs} for usage example.
586
+ *
587
+ * @preserve
588
+ */
589
+ const Tab = (props) => {
590
+ const { children, disabled, isParentVertical, className, icon, label, subtitle, type, badge, invisible, ...other } = props;
591
+ const componentClasses = cva(
592
+ [
593
+ "es:group es:flex es:items-center es:gap-1.5 es:relative es:shrink-0",
594
+ "es:select-none es:text-sm es:transition es:not-disabled:cursor-pointer",
595
+ "es:any-focus:outline-hidden es:focus-visible:ring-2 es:focus-visible:ring-accent-500/50",
596
+ !(type === "pillCompact" || type === "pillCompactInverse") && "es:min-h-9.5",
597
+ isParentVertical && (type === "pillCompact" || type === "pillCompactInverse") && "es:min-h-8",
598
+ invisible && "es:hidden",
599
+ className
600
+ ],
601
+ {
602
+ variants: {
603
+ type: {
604
+ underline: "es:disabled:text-secondary-400 es:selected:text-accent-950",
605
+ pill: "es:font-[450] es:border es:border-transparent es:px-3 es:py-2 es:rounded-lg es:not-disabled:not-selected:hover:text-secondary-900 es:not-disabled:not-selected:hover:bg-secondary-100 es:text-secondary-500 es:selected:text-accent-900 es:selected:bg-accent-400/15 es:has-icon:pl-2.5 es:focus-visible:border-accent-500 es:disabled:text-secondary-400/75",
606
+ pillInverse: "es:font-[450] es:border es:border-transparent es:px-3 es:py-2 es:rounded-lg es:not-disabled:not-selected:hover:text-secondary-900 es:not-disabled:not-selected:hover:bg-secondary-100 es:text-secondary-500 es:selected:text-white es:selected:bg-accent-600 es:has-icon:pl-2.5 es:focus-visible:border-accent-500 es:disabled:text-secondary-400/75",
607
+ pillCompact: "es:icon:size-4 es:font-[450] es:border es:border-transparent es:px-1.5 es:py-1 es:rounded-lg es:not-disabled:not-selected:hover:text-secondary-900 es:not-disabled:not-selected:hover:bg-secondary-100 es:text-secondary-500 es:selected:text-accent-900 es:selected:bg-accent-400/15 es:has-icon:pl-1 es:focus-visible:border-accent-500 es:disabled:text-secondary-400/75",
608
+ pillCompactInverse: "es:icon:size-4 es:font-[450] es:border es:border-transparent es:px-1.5 es:py-1 es:rounded-lg es:not-disabled:not-selected:hover:text-secondary-900 es:not-disabled:not-selected:hover:bg-secondary-100 es:text-secondary-500 es:selected:text-white es:selected:bg-accent-600 es:has-icon:pl-1 es:focus-visible:border-accent-500 es:disabled:text-secondary-400/75"
609
+ }
610
+ },
611
+ compoundVariants: [
612
+ {
613
+ vertical: false,
614
+ type: "underline",
615
+ class: [
616
+ "es:px-2 es:py-2.5 es:rounded-lg",
617
+ 'es:after:content-[""] es:after:absolute es:after:bottom-px es:after:left-0 es:after:right-0 es:after:w-5/6 es:after:mx-auto es:after:h-0.75',
618
+ "es:after:bg-linear-to-b es:hover:not-selected:not-disabled:after:from-secondary-200 es:hover:not-selected:not-disabled:after:to-secondary-300 es:selected:after:from-accent-500 es:selected:after:to-accent-600",
619
+ "es:after:rounded-t-full es:selected:after:shadow-xs es:selected:after:shadow-accent-700/30 es:after:transition"
620
+ ]
621
+ },
622
+ {
623
+ vertical: true,
624
+ type: "underline",
625
+ class: [
626
+ "es:pl-3 es:pr-2 es:py-2.5 es:rounded-lg es:selected:bg-accent-50/50 es:selected:text-accent-950 es:transition",
627
+ 'es:after:content-[""] es:after:absolute es:after:-left-0 es:after:top-0 es:after:bottom-0 es:after:h-5/6 es:after:my-auto es:after:w-1',
628
+ "es:after:bg-linear-to-r es:hover:not-selected:not-disabled:after:from-secondary-200 es:hover:not-selected:not-disabled:after:to-secondary-300 es:selected:after:from-accent-500 es:selected:after:to-accent-600",
629
+ "es:after:rounded-full es:selected:after:shadow-xs es:selected:after:shadow-accent-700/30 es:after:transition"
630
+ ]
631
+ }
632
+ ]
633
+ }
634
+ );
635
+ return /* @__PURE__ */ jsxs(
636
+ $5e8ad37a45e1c704$export$3e41faf802a29e71,
637
+ {
638
+ ...other,
639
+ isDisabled: disabled || invisible,
640
+ className: componentClasses({ vertical: Boolean(isParentVertical), type }),
641
+ children: [
642
+ (icon || subtitle) && /* @__PURE__ */ jsx(
643
+ RichLabel,
644
+ {
645
+ icon,
646
+ label: label ?? children,
647
+ subtitle,
648
+ noColor: true,
649
+ iconClassName: clsx((type === "pillCompact" || type === "pillCompactInverse") && "es:icon:size-4!")
650
+ }
651
+ ),
652
+ !(icon || subtitle) && (label ?? children),
653
+ badge && !isValidElement(badge) && /* @__PURE__ */ jsx(
654
+ "span",
655
+ {
656
+ className: clsx(
657
+ "es:transition-colors es:px-1.5 es:py-1 es:leading-none es:rounded-md es:text-xs es:font-medium",
658
+ type === "underline" && "es:inset-ring es:inset-ring-secondary-200/20 es:bg-secondary-100 es:group-selected:bg-accent-500/10 es:group-selected:text-accent-900 es:group-selected:inset-ring-accent-500/10",
659
+ type === "pill" && "es:bg-secondary-100 es:group-selected:bg-accent-600 es:group-selected:text-white",
660
+ type === "pillInverse" && "es:bg-secondary-100 es:group-selected:bg-accent-50 es:group-selected:text-accent-900",
661
+ type === "pillCompact" && "es:bg-secondary-100 es:group-selected:bg-accent-600 es:group-selected:text-white",
662
+ type === "pillCompactInverse" && "es:bg-secondary-100 es:group-selected:bg-accent-50 es:group-selected:text-accent-900",
663
+ (type === "pillCompact" || type === "pillCompactInverse") && "es:[&_svg]:size-4!"
664
+ ),
665
+ children: badge
666
+ }
667
+ ),
668
+ badge && isValidElement(badge) && /* @__PURE__ */ jsx("div", { children: badge })
669
+ ]
670
+ }
671
+ );
672
+ };
673
+ Tab.displayName = "Tab";
674
+ /**
675
+ * Container for tab content within the Tabs component.
676
+ *
677
+ * @component
678
+ * @param {Object} props - Component props.
679
+ * @param {string} [props.className] - Classes to pass to the tab content container.
680
+ *
681
+ * @returns {JSX.Element} The TabPanel component.
682
+ *
683
+ * @see {@link Tabs} for usage example.
684
+ *
685
+ * @preserve
686
+ */
687
+ const TabPanel2 = (props) => {
688
+ const { children, className, ...other } = props;
689
+ return /* @__PURE__ */ jsx(
690
+ $5e8ad37a45e1c704$export$3d96ec278d3efce4,
691
+ {
692
+ ...other,
693
+ className: clsx("es:space-y-2.5 es:text-sm es:any-focus:outline-hidden", className),
694
+ children
695
+ }
696
+ );
697
+ };
698
+ TabPanel2.displayName = "TabPanel";
699
+ export {
700
+ Tab,
701
+ TabList2 as TabList,
702
+ TabPanel2 as TabPanel,
703
+ Tabs2 as Tabs
704
+ };