@eightshift/ui-components 4.0.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/package.json +101 -101
  2. package/dist/Button-CvzGKGCo.js +0 -185
  3. package/dist/Collection-ddre1L5v.js +0 -2332
  4. package/dist/Color-MV5kBVXr.js +0 -2452
  5. package/dist/ColorSwatch-BqQfVu4L.js +0 -64
  6. package/dist/ComboBox-jQ-dk95U.js +0 -1906
  7. package/dist/Dialog-DX1aiYyE.js +0 -2300
  8. package/dist/FieldError-52GVSGgC.js +0 -42
  9. package/dist/FocusScope-Cri5BFRz.js +0 -831
  10. package/dist/Form-Cq3fu75_.js +0 -5
  11. package/dist/Group-_emcIVxI.js +0 -48
  12. package/dist/Heading-B2153VXe.js +0 -16
  13. package/dist/Hidden-rE6uR-lr.js +0 -41
  14. package/dist/Input-BxpFEIXV.js +0 -133
  15. package/dist/Label-icmbmNdI.js +0 -17
  16. package/dist/List-BYNHbol3.js +0 -593
  17. package/dist/ListBox-mJ4nQaL7.js +0 -581
  18. package/dist/NumberFormatter-DA8u1Ot7.js +0 -140
  19. package/dist/OverlayArrow-BB0CWwdq.js +0 -629
  20. package/dist/RSPContexts-2lR5GG9p.js +0 -14
  21. package/dist/Select-aab027f3.esm--EmXjiL3.js +0 -2469
  22. package/dist/Separator-D9moUgP8.js +0 -322
  23. package/dist/Slider-rz2XRMGm.js +0 -853
  24. package/dist/Text-DVSAPY-K.js +0 -16
  25. package/dist/VisuallyHidden-f9zX67a_.js +0 -48
  26. package/dist/_commonjsHelpers-CUmg6egw.js +0 -6
  27. package/dist/assets/index.css +0 -37
  28. package/dist/assets/style-admin.css +0 -5255
  29. package/dist/assets/style-editor.css +0 -5255
  30. package/dist/assets/style.css +0 -5261
  31. package/dist/assets/wp-font-enhancements.css +0 -8
  32. package/dist/assets/wp-ui-enhancements.css +0 -299
  33. package/dist/components/animated-visibility/animated-visibility.js +0 -105
  34. package/dist/components/base-control/base-control.js +0 -86
  35. package/dist/components/breakpoint-preview/breakpoint-preview.js +0 -161
  36. package/dist/components/button/button.js +0 -387
  37. package/dist/components/checkbox/checkbox.js +0 -320
  38. package/dist/components/color-pickers/color-picker.js +0 -272
  39. package/dist/components/color-pickers/color-swatch.js +0 -58
  40. package/dist/components/color-pickers/gradient-editor.js +0 -534
  41. package/dist/components/color-pickers/solid-color-picker.js +0 -1567
  42. package/dist/components/component-toggle/component-toggle.js +0 -158
  43. package/dist/components/container-panel/container-panel.js +0 -131
  44. package/dist/components/draggable/draggable-context.js +0 -5
  45. package/dist/components/draggable/draggable-handle.js +0 -46
  46. package/dist/components/draggable/draggable.js +0 -6207
  47. package/dist/components/draggable-list/draggable-list-context.js +0 -5
  48. package/dist/components/draggable-list/draggable-list-item.js +0 -77
  49. package/dist/components/draggable-list/draggable-list.js +0 -151
  50. package/dist/components/expandable/expandable.js +0 -342
  51. package/dist/components/index.js +0 -137
  52. package/dist/components/input-field/input-field.js +0 -231
  53. package/dist/components/item-collection/item-collection.js +0 -59
  54. package/dist/components/layout/hstack.js +0 -30
  55. package/dist/components/layout/vstack.js +0 -30
  56. package/dist/components/link-input/link-input.js +0 -293
  57. package/dist/components/matrix-align/matrix-align.js +0 -134
  58. package/dist/components/menu/menu.js +0 -285
  59. package/dist/components/modal/modal.js +0 -305
  60. package/dist/components/notice/notice.js +0 -123
  61. package/dist/components/number-picker/number-picker.js +0 -292
  62. package/dist/components/option-select/option-select.js +0 -264
  63. package/dist/components/options-panel/options-panel.js +0 -158
  64. package/dist/components/placeholders/file-placeholder.js +0 -42
  65. package/dist/components/placeholders/image-placeholder.js +0 -88
  66. package/dist/components/placeholders/media-placeholder.js +0 -63
  67. package/dist/components/popover/popover.js +0 -207
  68. package/dist/components/radio/radio.js +0 -579
  69. package/dist/components/repeater/repeater-context.js +0 -5
  70. package/dist/components/repeater/repeater-item.js +0 -119
  71. package/dist/components/repeater/repeater.js +0 -280
  72. package/dist/components/responsive/mini-responsive.js +0 -498
  73. package/dist/components/responsive/responsive-legacy.js +0 -343
  74. package/dist/components/responsive/responsive.js +0 -580
  75. package/dist/components/responsive-preview/responsive-preview.js +0 -123
  76. package/dist/components/rich-label/rich-label.js +0 -66
  77. package/dist/components/select/async-multi-select.js +0 -157
  78. package/dist/components/select/async-single-select.js +0 -137
  79. package/dist/components/select/custom-select-default-components.js +0 -38
  80. package/dist/components/select/multi-select-components.js +0 -8
  81. package/dist/components/select/multi-select.js +0 -151
  82. package/dist/components/select/react-select-component-wrappers.js +0 -90
  83. package/dist/components/select/shared.js +0 -26
  84. package/dist/components/select/single-select.js +0 -131
  85. package/dist/components/select/styles.js +0 -49
  86. package/dist/components/select/v2/async-select.js +0 -297
  87. package/dist/components/select/v2/shared.js +0 -24
  88. package/dist/components/select/v2/single-select.js +0 -990
  89. package/dist/components/slider/column-config-slider.js +0 -210
  90. package/dist/components/slider/slider.js +0 -343
  91. package/dist/components/slider/utils.js +0 -84
  92. package/dist/components/spacer/spacer.js +0 -97
  93. package/dist/components/tabs/tabs.js +0 -702
  94. package/dist/components/toggle/switch.js +0 -155
  95. package/dist/components/toggle/toggle.js +0 -64
  96. package/dist/components/toggle-button/toggle-button.js +0 -324
  97. package/dist/components/tooltip/tooltip.js +0 -525
  98. package/dist/context-D2KUdwNL.js +0 -92
  99. package/dist/default-i18n-CT_oS1Fy.js +0 -922
  100. package/dist/filterDOMProps-EDDcM64A.js +0 -28
  101. package/dist/icons/block-icon.js +0 -42
  102. package/dist/icons/generic-color-swatch.js +0 -113
  103. package/dist/icons/icons.js +0 -30371
  104. package/dist/icons/index.js +0 -11
  105. package/dist/icons/jsx-svg.js +0 -50
  106. package/dist/index-641ee5b8.esm-BPz6U6sJ.js +0 -3137
  107. package/dist/index-BKGQ6jGS.js +0 -44
  108. package/dist/index-BYHhzLf-.js +0 -444
  109. package/dist/index.js +0 -139
  110. package/dist/lite-DVmmD_-j.js +0 -7
  111. package/dist/modifiers.esm-BuJQPI1X.js +0 -31
  112. package/dist/multi-select-components-BlZZoNXC.js +0 -3744
  113. package/dist/number-GajL10e1.js +0 -36
  114. package/dist/react-jsx-parser.min-DZCiis5V.js +0 -11753
  115. package/dist/react-select-async.esm-CwUoej5h.js +0 -107
  116. package/dist/react-select.esm-DcwYxadV.js +0 -15
  117. package/dist/style-admin.js +0 -1
  118. package/dist/style-editor.js +0 -1
  119. package/dist/style.js +0 -1
  120. package/dist/textSelection-0UUS8Yfg.js +0 -46
  121. package/dist/useButton-BpOKDWEN.js +0 -71
  122. package/dist/useEvent-B0b-6KBr.js +0 -23
  123. package/dist/useFocusRing-CV5l3lf6.js +0 -107
  124. package/dist/useFormReset-C5OggHsw.js +0 -22
  125. package/dist/useFormValidation-DhDNSjws.js +0 -224
  126. package/dist/useHover-DwDr6ozG.js +0 -900
  127. package/dist/useLabel-D7HkNEHT.js +0 -27
  128. package/dist/useLabels-D8cxd1Z8.js +0 -23
  129. package/dist/useListState-UGlN5-7P.js +0 -161
  130. package/dist/useLocalizedStringFormatter-CFP1YZWQ.js +0 -121
  131. package/dist/useNumberField-CEAj7Mrj.js +0 -1204
  132. package/dist/useNumberFormatter-321rAb4J.js +0 -13
  133. package/dist/usePress-DNW8qpY6.js +0 -664
  134. package/dist/useSingleSelectListState-DC0wWTUM.js +0 -38
  135. package/dist/useToggle-BrpmSOB-.js +0 -59
  136. package/dist/useToggleState-CmQX3SoX.js +0 -19
  137. package/dist/utilities/array-helpers.js +0 -56
  138. package/dist/utilities/debounce-throttle.js +0 -123
  139. package/dist/utilities/es-dash.js +0 -376
  140. package/dist/utilities/index.js +0 -27
  141. package/dist/utilities/text-helpers.js +0 -136
  142. package/dist/utils-DkCSC521.js +0 -370
  143. package/dist/wp/wp-font-enhancements.js +0 -1
  144. package/dist/wp/wp-ui-enhancements.js +0 -1
@@ -1,119 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Button } from "../button/button.js";
3
- import { Menu, MenuSeparator, MenuItem } from "../menu/menu.js";
4
- import { icons } from "../../icons/icons.js";
5
- import { c as clsx } from "../../lite-DVmmD_-j.js";
6
- import { useContext } from "react";
7
- import { Expandable } from "../expandable/expandable.js";
8
- import { _ as __ } from "../../default-i18n-CT_oS1Fy.js";
9
- import { RepeaterContext } from "./repeater-context.js";
10
- /**
11
- * A Repeater item.
12
- *
13
- * @component
14
- * @param {Object} props - Component props.
15
- * @param {JSX.Element} [props.icon] - Icon to display in the label.
16
- * @param {string} [props.label] - Label to display.
17
- * @param {string} [props.subtitle] - Subtitle to display.
18
- * @param {JSX.Element|JSX.Element[]} [props.actions] - Actions to display to the right of the label.
19
- * @param {string} [props.textValue] - The text value of the item.
20
- * @param {string} [props.className] - Classes to pass to the item.
21
- * @param {JSX.Element|JSX.Element[]} [props.menuOptions] - Additional menu options to display next to the expand button.
22
- * @param {bool} [props.noMenuButton] - If `true`, the menu button next to the expand button is not displayed.
23
- * @param {bool} [props.expandDisabled] - If `true`, the item cannot be expanded.
24
- *
25
- * @returns {JSX.Element} The RepeaterItem component.
26
- *
27
- * @see {@link Repeater} for usage example.
28
- *
29
- * @preserve
30
- */
31
- const RepeaterItem = (props) => {
32
- const { children, icon, label, subtitle, "aria-label": ariaLabel, className, actions, textValue, expandDisabled, menuOptions, noMenuButton, ...rest } = props;
33
- const { deleteItem, duplicateItem, isDragged, isOutOfBounds, isSelected, canDelete, canAdd, allOpen, setAllOpen } = useContext(RepeaterContext);
34
- return /* @__PURE__ */ jsx(
35
- Expandable,
36
- {
37
- icon: isOutOfBounds ? icons.trash : icon,
38
- label: isOutOfBounds ? __("Release to delete", "eightshift-ui-components") : label,
39
- subtitle: isOutOfBounds ? null : subtitle,
40
- className: clsx(
41
- "es:transition",
42
- isDragged && "es:border es:border-secondary-100 es:bg-white/50 es:shadow-md es:backdrop-blur-lg",
43
- isOutOfBounds && "es:border es:border-red-200! es:bg-red-50 es:shadow-red-500/20 es:[&_button]:invisible es:[&_svg_path]:stroke-red-500"
44
- ),
45
- labelClassName: clsx(className, isDragged ? "es:cursor-grabbing" : "es:cursor-grab"),
46
- headerClassName: clsx(
47
- "es:transition es:rounded-lg es:border es:border-transparent",
48
- isSelected && "es:bg-accent-50 es:border-accent-100",
49
- "es:group-focus:outline-hidden es:group-focus:border-accent-500 es:group-focus:ring-2 es:group-focus:ring-accent-500/50"
50
- ),
51
- open: allOpen,
52
- onOpenChange: (open) => {
53
- if (allOpen && !open) {
54
- setAllOpen(false);
55
- }
56
- },
57
- customOpenButton: ({ open, toggleOpen, tooltip, disabled }) => {
58
- return /* @__PURE__ */ jsxs("div", { className: "es:flex es:items-center es:gap-px", children: [
59
- /* @__PURE__ */ jsxs(
60
- Menu,
61
- {
62
- hidden: noMenuButton,
63
- triggerIcon: icons.moreH,
64
- triggerProps: {
65
- className: "es:icon:size-5 es:icon:shrink-0",
66
- size: "small",
67
- type: "ghost"
68
- },
69
- tooltip: __("More options", "eightshift-ui-components"),
70
- children: [
71
- menuOptions,
72
- menuOptions && /* @__PURE__ */ jsx(MenuSeparator, {}),
73
- /* @__PURE__ */ jsx(
74
- MenuItem,
75
- {
76
- disabled: !canAdd,
77
- icon: icons.copy,
78
- onPress: () => duplicateItem(),
79
- children: __("Duplicate", "eightshift-ui-components")
80
- }
81
- ),
82
- /* @__PURE__ */ jsx(
83
- MenuItem,
84
- {
85
- disabled: !canDelete,
86
- icon: icons.trash,
87
- onPress: () => deleteItem(),
88
- children: __("Remove", "eightshift-ui-components")
89
- }
90
- )
91
- ]
92
- }
93
- ),
94
- /* @__PURE__ */ jsx(
95
- Button,
96
- {
97
- type: "ghost",
98
- icon: open ? icons.caretDownFill : icons.caretDown,
99
- onPress: toggleOpen,
100
- tooltip,
101
- disabled,
102
- className: clsx("es:icon:size-5 es:icon:transition-transform", open && "es:icon:-scale-y-100"),
103
- size: "small"
104
- }
105
- )
106
- ] });
107
- },
108
- actions,
109
- headerProps: { "data-movable-handle": true },
110
- noFocusHandling: true,
111
- ...rest,
112
- children
113
- },
114
- allOpen
115
- );
116
- };
117
- export {
118
- RepeaterItem
119
- };
@@ -1,280 +0,0 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { useId, useState } from "react";
3
- import { _ as __ } from "../../default-i18n-CT_oS1Fy.js";
4
- import { Button } from "../button/button.js";
5
- import { icons } from "../../icons/icons.js";
6
- import { BaseControl } from "../base-control/base-control.js";
7
- import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
8
- import { RepeaterContext } from "./repeater-context.js";
9
- import { c as clsx } from "../../lite-DVmmD_-j.js";
10
- import { L as List, a as arrayRemove, b as arrayMove } from "../../List-BYNHbol3.js";
11
- import { Menu, MenuItem, MenuSeparator } from "../menu/menu.js";
12
- const fixIds = (items, itemIdBase) => {
13
- return items == null ? void 0 : items.map((item, i) => ({
14
- ...item,
15
- id: (item == null ? void 0 : item.id) ?? `${itemIdBase}-${i}`
16
- }));
17
- };
18
- /**
19
- * A component that allows re-ordering a list of items with additional sub-options.
20
- *
21
- * @component
22
- * @param {Object} props - Component props.
23
- * @param {JSX.Element} [props.icon] - Icon to display in the label.
24
- * @param {string} [props.label] - Label to display.
25
- * @param {string} [props.subtitle] - Subtitle to display.
26
- * @param {string} [props.help] - Help text to display below the input.
27
- * @param {JSX.Element|JSX.Element[]} [props.actions] - Actions to display to the right of the label.
28
- * @param {Object<string, any>[]} props.items - Data to display in the repeater.
29
- * @param {boolean} [props.hideEmptyState] - If `true`, the empty state will not be displayed when there are no items.
30
- * @param {Object<string, any>} [props.addDefaultItem] - Additional properties to add to a new item.
31
- * @param {boolean} [props.addDisabled] - If `true`, the add button is disabled.
32
- * @param {Function} props.onChange - Function to run when the items change.
33
- * @param {Function} [props.onAfterItemAdd] - Function to run after an item is added.
34
- * @param {Function} [props.onAfterItemRemove] - Function to run after an item is removed.
35
- * @param {Number} [props.minItems] - The minimum number of items that must be present. If there are less items than this, deleting items will be disabled.
36
- * @param {Number} [props.maxItems] - The maximum number of items that can be present. If there are more items than this, adding items will be disabled.
37
- * @param {boolean} [props.hidden] - If `true`, the component is not rendered.
38
- * @param {JSX.Element} [props.addButton] - If provided, overrides the default add button. `(props: { addItem: (additional: Object<string, any>?) => void, disabled: Boolean }) => JSX.Element`.
39
- * @param {string} [props.className] - Classes to pass to the item wrapper.
40
- * @param {boolean} [props.noExpandAllButton] - If `true`, the "Expand all"/"Collapse all" button is not displayed.
41
- * @param {JSX.Element|JSX.Element[]} [props.moreOptions] - Options to add in the "More options" menu.
42
- * @param {JSX.Element} [props.emptyState] - Allows overriding the default empty state.
43
- *
44
- * @returns {JSX.Element} The Repeater component.
45
- *
46
- * @example
47
- * <Repeater
48
- * label='My repeater'
49
- * items={items}
50
- * onChange={setItems}
51
- * >
52
- * {(item) => {
53
- * const { title, updateData } = item;
54
- *
55
- * return (
56
- * <RepeaterItem
57
- * label={title ?? 'New item'}
58
- * icon={icons.myIcon}
59
- * >
60
- * <InputField
61
- * label='Title'
62
- * type='text'
63
- * value={title}
64
- * onChange={(value) => updateData({ title: value })}
65
- * />
66
- * </RepeaterItem>
67
- * );
68
- * }}
69
- * </Repeater>
70
- *
71
- * @preserve
72
- */
73
- const Repeater = (props) => {
74
- const itemIdBase = `item-${useId().replaceAll(":", "")}`;
75
- const {
76
- children,
77
- onChange,
78
- items: rawItems,
79
- icon,
80
- label,
81
- subtitle,
82
- help,
83
- actions,
84
- hideEmptyState,
85
- addDefaultItem = {},
86
- addDisabled,
87
- onAfterItemAdd,
88
- onAfterItemRemove,
89
- minItems,
90
- maxItems,
91
- addButton,
92
- className,
93
- emptyState,
94
- noExpandAllButton,
95
- moreOptions,
96
- hidden
97
- } = props;
98
- const [allOpen, setAllOpen] = useState(false);
99
- if (typeof rawItems === "undefined" || rawItems === null || !Array.isArray(rawItems)) {
100
- console.warn(__("Repeater: 'items' are not an array or are undefined!", "eightshift-ui-components"));
101
- }
102
- const items = fixIds(rawItems ?? [], itemIdBase);
103
- const canDelete = items.length > (minItems ?? 0);
104
- const canAdd = items.length < (maxItems ?? Number.MAX_SAFE_INTEGER);
105
- if (hidden) {
106
- return null;
107
- }
108
- return /* @__PURE__ */ jsxs(
109
- BaseControl,
110
- {
111
- icon,
112
- label,
113
- subtitle,
114
- help,
115
- actions: /* @__PURE__ */ jsxs(Fragment, { children: [
116
- actions,
117
- /* @__PURE__ */ jsxs(
118
- Menu,
119
- {
120
- tooltip: __("More options", "eightshift-ui-components"),
121
- triggerIcon: icons.moreH,
122
- triggerProps: { type: "ghost", size: "small" },
123
- hidden: (items == null ? void 0 : items.length) < 1 || noExpandAllButton && !moreOptions,
124
- children: [
125
- !noExpandAllButton && /* @__PURE__ */ jsx(
126
- MenuItem,
127
- {
128
- endIcon: allOpen ? icons.panelCollapse : icons.panelExpand,
129
- onClick: () => setAllOpen(!allOpen),
130
- children: allOpen ? __("Collapse all", "eightshift-ui-components") : __("Expand all", "eightshift-ui-components")
131
- }
132
- ),
133
- moreOptions && /* @__PURE__ */ jsx(MenuSeparator, {}),
134
- moreOptions
135
- ]
136
- }
137
- ),
138
- !addButton && /* @__PURE__ */ jsx(
139
- Button,
140
- {
141
- onPress: () => {
142
- const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem };
143
- onChange([...items, newItem]);
144
- if (onAfterItemAdd) {
145
- onAfterItemAdd(newItem);
146
- }
147
- },
148
- size: "small",
149
- icon: icons.add,
150
- className: clsx("es:icon:size-4", !hideEmptyState && items.length < 1 && "es:invisible"),
151
- tooltip: __("Add item", "eightshift-ui-components"),
152
- disabled: addDisabled || !canAdd
153
- }
154
- ),
155
- addButton && /* @__PURE__ */ jsx("div", { className: clsx(!hideEmptyState && items.length < 1 && "es:invisible"), children: addButton({
156
- addItem: (additional = {}) => {
157
- const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem, ...additional };
158
- onChange([...items, newItem]);
159
- if (onAfterItemAdd) {
160
- onAfterItemAdd(newItem);
161
- }
162
- },
163
- disabled: addDisabled
164
- }) })
165
- ] }),
166
- className: "es:w-full",
167
- children: [
168
- /* @__PURE__ */ jsx(
169
- List,
170
- {
171
- values: items,
172
- onChange: ({ oldIndex, newIndex }) => onChange(newIndex === -1 ? arrayRemove(items, oldIndex) : arrayMove(items, oldIndex, newIndex)),
173
- renderList: ({ children: children2, props: props2 }) => {
174
- const { key, ...rest } = props2;
175
- return /* @__PURE__ */ jsx(
176
- "ul",
177
- {
178
- className: clsx("es:w-full es:list-none", className),
179
- ...rest,
180
- children: children2
181
- },
182
- key
183
- );
184
- },
185
- renderItem: ({ value: item, index, isDragged, isSelected, isOutOfBounds, props: props2 }) => {
186
- const { key, ...rest } = props2;
187
- return /* @__PURE__ */ jsx(
188
- "li",
189
- {
190
- className: "es:group es:w-full es:list-none es:any-focus:outline-hidden",
191
- ...rest,
192
- children: /* @__PURE__ */ jsx(
193
- RepeaterContext.Provider,
194
- {
195
- value: {
196
- ...item,
197
- index,
198
- deleteItem: () => {
199
- onChange([...items].filter((i) => i.id !== item.id));
200
- if (onAfterItemRemove) {
201
- onAfterItemRemove(item);
202
- }
203
- },
204
- duplicateItem: () => {
205
- const newItem = { ...item, id: `${itemIdBase}${items.length + 1}` };
206
- onChange([...items, newItem]);
207
- if (onAfterItemAdd) {
208
- onAfterItemAdd(newItem);
209
- }
210
- },
211
- isDragged,
212
- isOutOfBounds,
213
- isSelected,
214
- canDelete,
215
- canAdd,
216
- allOpen,
217
- setAllOpen
218
- },
219
- children: children({
220
- ...item,
221
- updateData: (newValue) => {
222
- const updated = [...items].map((i) => i.id === item.id ? { ...i, ...newValue } : i);
223
- onChange(updated);
224
- },
225
- itemIndex: index,
226
- deleteItem: () => {
227
- onChange([...items].filter((i) => i.id !== item.id));
228
- if (onAfterItemRemove) {
229
- onAfterItemRemove(item);
230
- }
231
- }
232
- })
233
- }
234
- )
235
- },
236
- (item == null ? void 0 : item.id) ?? key
237
- );
238
- },
239
- removableByMove: true
240
- }
241
- ),
242
- /* @__PURE__ */ jsxs(AnimatedVisibility, { visible: items.length < 1, children: [
243
- emptyState,
244
- !hideEmptyState && /* @__PURE__ */ jsxs("div", { className: "es:flex es:flex-col es:items-center es:gap-2 es:rounded-md es:border es:border-dashed es:border-secondary-300 es:p-4 es:text-center es:text-sm es:text-secondary-400", children: [
245
- !addButton && /* @__PURE__ */ jsx(
246
- Button,
247
- {
248
- onPress: () => {
249
- const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem };
250
- onChange([...items, newItem]);
251
- if (onAfterItemAdd) {
252
- onAfterItemAdd(newItem);
253
- }
254
- },
255
- size: "small",
256
- icon: icons.add,
257
- className: "es:icon:size-4",
258
- disabled: addDisabled,
259
- children: __("Add item", "eightshift-ui-components")
260
- }
261
- ),
262
- addButton && !hideEmptyState && addButton({
263
- addItem: (additional = {}) => {
264
- const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem, ...additional };
265
- onChange([...items, newItem]);
266
- if (onAfterItemAdd) {
267
- onAfterItemAdd(newItem);
268
- }
269
- },
270
- disabled: addDisabled
271
- })
272
- ] })
273
- ] })
274
- ]
275
- }
276
- );
277
- };
278
- export {
279
- Repeater
280
- };