@eightshift/ui-components 8.1.0 → 8.2.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.
- package/dist/{Autocomplete-BUU44AuW.js → Autocomplete-CO9aIsTe.js} +29 -25
- package/dist/{Button-_E2Z5G2l.js → Button-DO3oQfCq.js} +15 -9
- package/dist/{Dialog-3XLIaepk.js → Dialog-Bdqjmtt2.js} +293 -160
- package/dist/{Disclosure-Dh0z_DEQ.js → Disclosure-BTSsPhG9.js} +33 -29
- package/dist/{FocusScope-BKGWN6UK.js → FocusScope-Cj6cUR6X.js} +8 -6
- package/dist/{Heading-BWTs9ckA.js → Heading-BQje2nS2.js} +1 -1
- package/dist/{I18nProvider-BskRMK8G.js → I18nProvider-R_4IDnf9.js} +1 -1
- package/dist/{Label-UpU4cKPh.js → Label-C4bJkVti.js} +1 -1
- package/dist/{ListBox-DepY-52g.js → ListBox-CBvtIFuB.js} +20 -16
- package/dist/{NumberFormatter-WKBRKiEA.js → NumberFormatter-Bwdv413k.js} +4 -2
- package/dist/{RadioGroup-Br9Mn9QJ.js → RadioGroup-Dxzko0ma.js} +35 -35
- package/dist/{SearchField-q2Fj0L9K.js → SearchField-zY9JqR1c.js} +29 -26
- package/dist/{Slider-B8icnyOo.js → Slider-BXc72kE0.js} +55 -44
- package/dist/{Text-D4y19vs8.js → Text-i-ZK4MiL.js} +1 -1
- package/dist/{VisuallyHidden-B_LZ_kn7.js → VisuallyHidden-CsM0VnV1.js} +2 -2
- package/dist/{animation-DpSgtWyu.js → animation-COc9P6ap.js} +2 -4
- package/dist/assets/{image-analysis-worker-BuHru-CI.js → image-analysis-worker-CBOB71mx.js} +1 -1
- package/dist/assets/style-admin.css +1 -1
- package/dist/assets/style-editor.css +1 -1
- package/dist/assets/style.css +1 -1
- package/dist/{button-XSk_8UW7.js → button-C7mc6eS1.js} +15 -12
- package/dist/{checkbox-BYaS9tQ5.js → checkbox-DlG5DILl.js} +8 -8
- package/dist/{color-swatch-6ZEIXej3.js → color-swatch-D6xMLGU-.js} +14 -15
- package/dist/components/animated-visibility/animated-visibility.js +5 -3
- package/dist/components/base-control/base-control.js +1 -1
- package/dist/components/base-control/container.d.ts +4 -30
- package/dist/components/base-control/container.js +5 -32
- package/dist/components/breakpoint-preview/breakpoint-preview.js +1 -1
- package/dist/components/button/button.js +1 -1
- package/dist/components/checkbox/checkbox.js +1 -1
- package/dist/components/color-pickers/color-picker.js +7 -7
- package/dist/components/color-pickers/color-swatch.js +1 -1
- package/dist/components/color-pickers/gradient-editor.js +1 -1
- package/dist/components/color-pickers/solid-color-picker.js +1 -1
- package/dist/components/component-toggle/component-toggle.js +3 -3
- package/dist/components/container-panel/container-panel.js +11 -11
- package/dist/components/contextual-help/contextual-help.js +2 -2
- package/dist/components/draggable/draggable.d.ts +3 -3
- package/dist/components/draggable/draggable.js +1 -1
- package/dist/components/draggable-list/draggable-list.d.ts +3 -3
- package/dist/components/draggable-list/draggable-list.js +8 -8
- package/dist/components/expandable/expandable.js +3 -3
- package/dist/components/index.js +16 -16
- package/dist/components/input-field/input-field.js +1 -1
- package/dist/components/item-collection/item-collection.d.ts +3 -28
- package/dist/components/item-collection/item-collection.js +6 -6
- package/dist/components/link-input/link-input.d.ts +0 -2
- package/dist/components/link-input/link-input.js +1 -1
- package/dist/components/matrix-align/matrix-align.js +4 -3
- package/dist/components/menu/menu.js +10 -7
- package/dist/components/modal/modal.js +1 -1
- package/dist/components/notice/notice.js +8 -8
- package/dist/components/number-picker/number-picker.js +1 -1
- package/dist/components/option-select/option-select.d.ts +1 -1
- package/dist/components/option-select/option-select.js +21 -15
- package/dist/components/options-panel/options-panel.js +4 -4
- package/dist/components/placeholders/file-picker-shell.js +4 -3
- package/dist/components/placeholders/file-placeholder.js +2 -1
- package/dist/components/popover/popover.js +3 -3
- package/dist/components/portal-provider/portal-provider.js +2 -1
- package/dist/components/radio/radio.js +2 -2
- package/dist/components/repeater/repeater-context.d.ts +0 -1
- package/dist/components/repeater/repeater-item.js +1 -1
- package/dist/components/repeater/repeater.d.ts +5 -38
- package/dist/components/repeater/repeater.js +7 -10
- package/dist/components/responsive/mini-responsive.d.ts +0 -1
- package/dist/components/responsive/mini-responsive.js +30 -30
- package/dist/components/responsive/responsive-legacy.d.ts +0 -1
- package/dist/components/responsive/responsive-legacy.js +12 -10
- package/dist/components/responsive/responsive.d.ts +0 -1
- package/dist/components/responsive/responsive.js +28 -28
- package/dist/components/responsive-preview/responsive-preview.js +3 -3
- package/dist/components/select/async-multi-select.d.ts +12 -13
- package/dist/components/select/async-multi-select.js +39 -20
- package/dist/components/select/async-select.d.ts +12 -13
- package/dist/components/select/async-select.js +38 -20
- package/dist/components/select/multi-select.d.ts +2 -8
- package/dist/components/select/multi-select.js +19 -19
- package/dist/components/select/shared.d.ts +5 -9
- package/dist/components/select/shared.js +2 -2
- package/dist/components/select/single-select.d.ts +2 -8
- package/dist/components/select/single-select.js +16 -16
- package/dist/components/slider/column-config-slider.js +7 -5
- package/dist/components/slider/slider.js +15 -11
- package/dist/components/smart-image/smart-image.d.ts +0 -1
- package/dist/components/smart-image/smart-image.js +52 -50
- package/dist/components/tabs/tabs.js +1 -1
- package/dist/components/toggle/switch.js +1 -1
- package/dist/components/toggle/toggle.js +2 -2
- package/dist/components/toggle-button/toggle-button.js +1 -1
- package/dist/components/tooltip/tooltip.js +1 -1
- package/dist/{draggable-9MfdTVWP.js → draggable-BUfOpGSZ.js} +129 -124
- package/dist/{es-dash-DunirOmV.js → es-dash-DPtJSRjw.js} +23 -52
- package/dist/{gradient-editor-yqSw0uPA.js → gradient-editor-_q3XF10i.js} +38 -29
- package/dist/icons/block-icon.js +1 -1
- package/dist/icons/icon.d.ts +3 -3
- package/dist/icons/icon.js +21 -9
- package/dist/icons/icons.d.ts +210 -1
- package/dist/icons/index.js +1 -1
- package/dist/icons/jsx-svg.d.ts +5 -4
- package/dist/icons/jsx-svg.js +1 -1
- package/dist/index.js +16 -16
- package/dist/{input-field-nN6BO0oz.js → input-field-QzBpjm-m.js} +8 -8
- package/dist/{jsx-svg-BjGQUBLh.js → jsx-svg-DRwJdRpA.js} +171 -129
- package/dist/{keyboard-g5Amam-c.js → keyboard-BxnnQA2Z.js} +1 -1
- package/dist/{link-input-BhlPElU8.js → link-input-CElQp3lP.js} +145 -87
- package/dist/{modal-B5axB0Fc.js → modal-BeacK9N_.js} +14 -13
- package/dist/{number-picker-nnOf0XnN.js → number-picker-CK_OHBXw.js} +9 -9
- package/dist/{react-y40Dt3ab.js → react-C6Y6cCOx.js} +194 -215
- package/dist/{shared-Ba_bt4s9.js → shared-DBCipn_m.js} +59 -43
- package/dist/{solid-color-picker-CsosgTVa.js → solid-color-picker-2-X3ridX.js} +58 -53
- package/dist/{switch-BJ4_OyUm.js → switch-B87lQ1V0.js} +6 -6
- package/dist/{tabs-wAe0AAyu.js → tabs-DgkJUkIX.js} +33 -28
- package/dist/{text-helpers-2j9DuxP1.js → text-helpers-QrwKKaOh.js} +3 -2
- package/dist/{textSelection-B_Nv6Jz3.js → textSelection-5Qk8tLtm.js} +3 -3
- package/dist/{toggle-button-BLJdEp8V.js → toggle-button-B2-f2rU6.js} +8 -7
- package/dist/{tooltip-BW9nj5-V.js → tooltip-AzOLps8g.js} +68 -62
- package/dist/{useAsyncList-B3-uyJgA.js → useAsyncList-CjKVLGN0.js} +8 -4
- package/dist/{useButton-CPMVLXoX.js → useButton-BIrfoiY8.js} +3 -3
- package/dist/{useCollection-PzY6FI39.js → useCollection-LQlZnc1u.js} +267 -180
- package/dist/{useEvent-CzuFZ2HT.js → useEvent-Bih8lvtM.js} +1 -1
- package/dist/{useField-DrfR8j9h.js → useField-B_ibsWst.js} +2 -2
- package/dist/{useFilter-CiCjo6Na.js → useFilter-BFaOw4yi.js} +1 -1
- package/dist/{useFocusRing-CrYHpV7C.js → useFocusRing-ZXFsftJJ.js} +1 -1
- package/dist/{useFormReset-U6c35PHq.js → useFormReset-DDJhIIfG.js} +1 -1
- package/dist/{useFormValidation-B2q2MGWN.js → useFormValidation-BfnJKcdX.js} +2 -2
- package/dist/{useHover-CNsbAR0V.js → useHover-CbyH227W.js} +216 -39
- package/dist/{useLabel-DuxAjaic.js → useLabel-gfFDE4bn.js} +2 -2
- package/dist/{useLabels-NUsp5IW3.js → useLabels-Dcg-cEyM.js} +1 -1
- package/dist/{useListState-FLxa7R_U.js → useListState-I22DfnmE.js} +4 -2
- package/dist/{useLocalizedStringFormatter-Ccm8EL_u.js → useLocalizedStringFormatter-CTCqjYu4.js} +6 -1
- package/dist/{useNumberFieldState-DWvm7CXu.js → useNumberFieldState-C1gD0RuW.js} +79 -62
- package/dist/{useNumberFormatter-B0_D7a_o.js → useNumberFormatter-DbAt_fC_.js} +2 -2
- package/dist/{useOverlayTriggerState-zZ7homyI.js → useOverlayTriggerState-Cpc_IbQf.js} +12 -9
- package/dist/{usePress-DRoujMNm.js → usePress-BF7otjax.js} +30 -19
- package/dist/{useSlot-pRz-v9kC.js → useSlot-CnQHcvd4.js} +1 -1
- package/dist/{useTextField-e8jIFT3s.js → useTextField-CnTuCBMs.js} +6 -6
- package/dist/{useToggle-CR_ZKvr_.js → useToggle-Cgv5UXaB.js} +6 -6
- package/dist/{useToggleState-ButQxGrJ.js → useToggleState-Cy1E36QZ.js} +1 -1
- package/dist/utilities/array-helpers.d.ts +1 -1
- package/dist/utilities/array-helpers.js +4 -3
- package/dist/utilities/debounce-throttle.d.ts +9 -2
- package/dist/utilities/es-dash.d.ts +11 -8
- package/dist/utilities/es-dash.js +1 -1
- package/dist/utilities/index.js +2 -2
- package/dist/utilities/text-helpers.js +1 -1
- package/dist/utilities/web-workers.d.ts +7 -7
- package/dist/utilities/web-workers.js +5 -5
- package/dist/{utils-Czi6q2Ub.js → utils-ClM91CuL.js} +30 -19
- package/package.json +21 -25
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { Prettify } from '../../utilities/types';
|
|
3
|
-
type ItemCollectionRenderContext<TItem extends
|
|
3
|
+
type ItemCollectionRenderContext<TItem extends object> = TItem & {
|
|
4
4
|
updateData: (newValue: Partial<TItem>) => void;
|
|
5
5
|
itemIndex: number;
|
|
6
6
|
deleteItem: () => void;
|
|
7
7
|
};
|
|
8
|
-
type ItemCollectionProps<TItem extends
|
|
8
|
+
type ItemCollectionProps<TItem extends object> = {
|
|
9
9
|
children: (item: ItemCollectionRenderContext<TItem>) => ReactNode;
|
|
10
10
|
/** Items to show. */
|
|
11
11
|
items?: TItem[] | null;
|
|
@@ -13,30 +13,5 @@ type ItemCollectionProps<TItem extends Record<string, unknown>> = {
|
|
|
13
13
|
/** If `true`, the component is not rendered. */
|
|
14
14
|
hidden?: boolean;
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
* A simple component to manage a collection of items.
|
|
18
|
-
*
|
|
19
|
-
* @component
|
|
20
|
-
* @param {ItemCollectionProps} props - Component props.
|
|
21
|
-
*
|
|
22
|
-
* @returns {JSX.Element} The ItemCollection component.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* <ItemCollection
|
|
26
|
-
* items={items}
|
|
27
|
-
* onChange={setItems}
|
|
28
|
-
* >
|
|
29
|
-
* {({ title, updateData, deleteItem }) => (
|
|
30
|
-
* <div>
|
|
31
|
-
* <InputField
|
|
32
|
-
* label={__('Title', 'demo')}
|
|
33
|
-
* value={title}
|
|
34
|
-
* onChange={(nextTitle) => updateData({ title: nextTitle })}
|
|
35
|
-
* />
|
|
36
|
-
* <Button onPress={deleteItem}>Remove</Button>
|
|
37
|
-
* </div>
|
|
38
|
-
* )}
|
|
39
|
-
* </ItemCollection>
|
|
40
|
-
*/
|
|
41
|
-
export declare const ItemCollection: <TItem extends Record<string, unknown>>(props: Prettify<ItemCollectionProps<TItem>>) => import("react").JSX.Element[] | null;
|
|
16
|
+
export declare const ItemCollection: <TItem extends object>(props: Prettify<ItemCollectionProps<TItem>>) => import("react").JSX.Element[] | null;
|
|
42
17
|
export {};
|
|
@@ -27,19 +27,19 @@ import { jsx } from "react/jsx-runtime";
|
|
|
27
27
|
* )}
|
|
28
28
|
* </ItemCollection>
|
|
29
29
|
*/
|
|
30
|
+
var mergeItem = (item, newValue) => ({
|
|
31
|
+
...item,
|
|
32
|
+
...newValue
|
|
33
|
+
});
|
|
30
34
|
var ItemCollection = (props) => {
|
|
31
35
|
const { children, items: rawItems, onChange, hidden } = props;
|
|
32
36
|
if (hidden) return null;
|
|
33
|
-
if (
|
|
37
|
+
if (rawItems === void 0 || rawItems === null || !Array.isArray(rawItems)) console.warn(__("ItemCollection: 'items' are not an array or are undefined!", "eightshift-ui-components"));
|
|
34
38
|
const items = rawItems ?? [];
|
|
35
39
|
return items.map((item, index) => jsx(Fragment, { children: children({
|
|
36
40
|
...item,
|
|
37
41
|
updateData: (newValue) => {
|
|
38
|
-
const updated =
|
|
39
|
-
updated[index] = {
|
|
40
|
-
...updated[index],
|
|
41
|
-
...newValue
|
|
42
|
-
};
|
|
42
|
+
const updated = items.map((currentItem, itemIndex) => itemIndex === index ? mergeItem(currentItem, newValue) : currentItem);
|
|
43
43
|
onChange(updated);
|
|
44
44
|
},
|
|
45
45
|
itemIndex: index,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as LinkInput } from "../../link-input-
|
|
1
|
+
import { t as LinkInput } from "../../link-input-CElQp3lP.js";
|
|
2
2
|
export { LinkInput };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { t as clsx } from "../../clsx-DQoRUQAf.js";
|
|
2
|
-
import { n as $fe21c36db05242bb$export$d7b12c4107be0d61, t as $fe21c36db05242bb$export$a98f0dcb43a68a25 } from "../../RadioGroup-
|
|
2
|
+
import { n as $fe21c36db05242bb$export$d7b12c4107be0d61, t as $fe21c36db05242bb$export$a98f0dcb43a68a25 } from "../../RadioGroup-Dxzko0ma.js";
|
|
3
3
|
import { RichLabel } from "../rich-label/rich-label.js";
|
|
4
4
|
import { BaseControl } from "../base-control/base-control.js";
|
|
5
|
-
import { f as upperFirst, t as camelCase } from "../../es-dash-
|
|
5
|
+
import { f as upperFirst, t as camelCase } from "../../es-dash-DPtJSRjw.js";
|
|
6
6
|
import { t as __ } from "../../build-module-DG6ZK7Ty.js";
|
|
7
7
|
import { Icon } from "../../icons/icon.js";
|
|
8
8
|
import { TriggeredPopover } from "../popover/popover.js";
|
|
9
9
|
import "react";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
//#region lib/components/matrix-align/matrix-align.tsx
|
|
12
|
+
var isStringValue = (value) => Object.prototype.toString.call(value) === "[object String]";
|
|
12
13
|
var allSizeOptions = [
|
|
13
14
|
{
|
|
14
15
|
value: "top left",
|
|
@@ -99,7 +100,7 @@ var MatrixAlign = (props) => {
|
|
|
99
100
|
children: [jsx("div", {
|
|
100
101
|
className: "es:bg-accent-50/60 es:inset-ring es:inset-ring-accent-800/3 es:rounded-t-xl es:rounded-b-md",
|
|
101
102
|
children: jsx($fe21c36db05242bb$export$a98f0dcb43a68a25, {
|
|
102
|
-
"aria-label":
|
|
103
|
+
"aria-label": isStringValue(tooltip) ? tooltip : __("Position", "eightshift-ui-components"),
|
|
103
104
|
value,
|
|
104
105
|
onChange,
|
|
105
106
|
orientation: "horizontal",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as clsx } from "../../clsx-DQoRUQAf.js";
|
|
2
|
-
import { S as $e28ab3efe3e87743$export$1ff3c3f08ae963c0, a as $49319ee1285aa241$export$2ce376c2cc3355c8, c as $49319ee1285aa241$export$ecabc99eeffab7ca, i as $49319ee1285aa241$export$27d2ad3c5815583e, o as $49319ee1285aa241$export$4b1545b4f2016d26, s as $49319ee1285aa241$export$d9b273488cd8ce6f } from "../../Dialog-
|
|
3
|
-
import { t as Button } from "../../button-
|
|
2
|
+
import { S as $e28ab3efe3e87743$export$1ff3c3f08ae963c0, a as $49319ee1285aa241$export$2ce376c2cc3355c8, c as $49319ee1285aa241$export$ecabc99eeffab7ca, i as $49319ee1285aa241$export$27d2ad3c5815583e, o as $49319ee1285aa241$export$4b1545b4f2016d26, s as $49319ee1285aa241$export$d9b273488cd8ce6f } from "../../Dialog-Bdqjmtt2.js";
|
|
3
|
+
import { t as Button } from "../../button-C7mc6eS1.js";
|
|
4
4
|
import { RichLabel } from "../rich-label/rich-label.js";
|
|
5
5
|
import { t as __ } from "../../build-module-DG6ZK7Ty.js";
|
|
6
6
|
import { dummySpacer } from "../../icons/ui-icons/dummy-spacer.js";
|
|
@@ -12,10 +12,13 @@ import { Popover } from "../popover/popover.js";
|
|
|
12
12
|
import { Children, Fragment, cloneElement, isValidElement } from "react";
|
|
13
13
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
//#region lib/components/menu/menu.tsx
|
|
15
|
+
var isStringValue = (value) => Object.prototype.toString.call(value) === "[object String]";
|
|
16
|
+
var isSymbolValue = (value) => Object.prototype.toString.call(value) === "[object Symbol]";
|
|
17
|
+
var emptyMenuItems = [];
|
|
15
18
|
var isSubMenuItem = (child) => {
|
|
16
19
|
if (!isValidElement(child)) return false;
|
|
17
20
|
if (child.type === Fragment) return Children.toArray(child.props.children).some(isSubMenuItem);
|
|
18
|
-
if (
|
|
21
|
+
if (isStringValue(child.type) || isSymbolValue(child.type)) return false;
|
|
19
22
|
return child.type === SubMenuItem || "displayName" in child.type && child.type.displayName === "SubMenuItem";
|
|
20
23
|
};
|
|
21
24
|
/**
|
|
@@ -58,14 +61,14 @@ var isSubMenuItem = (child) => {
|
|
|
58
61
|
* </Menu>
|
|
59
62
|
*/
|
|
60
63
|
var Menu = (props) => {
|
|
61
|
-
const { children, triggerLabel, triggerIcon = !triggerLabel ? hamburgerMenu : void 0, triggerProps, popoverProps, tooltip, keepOpen = false, "aria-label": ariaLabel =
|
|
64
|
+
const { children, triggerLabel, triggerIcon = !triggerLabel ? hamburgerMenu : void 0, triggerProps, popoverProps, tooltip, keepOpen = false, "aria-label": ariaLabel = isStringValue(triggerLabel) ? triggerLabel : __("Menu", "eightshift-ui-components"), openOnLongPress = false, disabled, manualWidth, hidden, ...other } = props;
|
|
62
65
|
if (hidden) return null;
|
|
63
66
|
const triggerBehavior = openOnLongPress ? { trigger: "longPress" } : void 0;
|
|
64
67
|
const keepOpenProps = keepOpen ? {
|
|
65
68
|
selectionMode: "multiple",
|
|
66
69
|
selectedKeys: new Set(),
|
|
67
70
|
onSelectionChange: () => {},
|
|
68
|
-
items:
|
|
71
|
+
items: emptyMenuItems
|
|
69
72
|
} : void 0;
|
|
70
73
|
const hasSubmenuItems = Children.toArray(children).some(isSubMenuItem);
|
|
71
74
|
const { className: popoverClassName, wrapperClassName: popoverWrapperClassName, popoverProps: nestedPopoverProps, ...otherPopoverProps } = popoverProps ?? {};
|
|
@@ -143,7 +146,7 @@ var MenuSeparator = ({ className }) => {
|
|
|
143
146
|
* @see {@link Menu} for usage example.
|
|
144
147
|
*/
|
|
145
148
|
var MenuItem = (props) => {
|
|
146
|
-
const { icon, children, subtitle, checked, selected, disabled, endIcon, onClick, onClickNative = (event) => event.stopPropagation(), shortcut, danger, primary, className, "aria-label": ariaLabel =
|
|
149
|
+
const { icon, children, subtitle, checked, selected, disabled, endIcon, onClick, onClickNative = (event) => event.stopPropagation(), shortcut, danger, primary, className, "aria-label": ariaLabel = isStringValue(children) ? children : __("Menu item", "eightshift-ui-components"), hidden, ...other } = props;
|
|
147
150
|
if (hidden) return null;
|
|
148
151
|
let itemIcon = icon;
|
|
149
152
|
if (checked === true) itemIcon = menuItemCheck;
|
|
@@ -191,7 +194,7 @@ var SubMenuItem = (props) => {
|
|
|
191
194
|
selectionMode: "multiple",
|
|
192
195
|
selectedKeys: new Set(),
|
|
193
196
|
onSelectionChange: () => {},
|
|
194
|
-
items:
|
|
197
|
+
items: emptyMenuItems
|
|
195
198
|
} : void 0;
|
|
196
199
|
return jsxs($49319ee1285aa241$export$ecabc99eeffab7ca, { children: [cloneElement(trigger, { endIcon: jsx("span", {
|
|
197
200
|
className: "es:text-surface-500 es:contrast-more:text-current es:icon:size-3! es:icon:stroke-2!",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Modal } from "../../modal-
|
|
1
|
+
import { t as Modal } from "../../modal-BeacK9N_.js";
|
|
2
2
|
export { Modal };
|
|
@@ -21,7 +21,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
21
21
|
var Notice = (props) => {
|
|
22
22
|
const { icon, label, subtitle, className, type = "default", alignIconToTitle = false, flat, hidden } = props;
|
|
23
23
|
if (hidden) return null;
|
|
24
|
-
const
|
|
24
|
+
const currentStyle = {
|
|
25
25
|
info: {
|
|
26
26
|
icon: info,
|
|
27
27
|
className: "es:inset-ring-blue-600/15 es:shadow-blue-800/5 es:from-blue-400/2 es:to-blue-600/5 es:inset-shadow-blue-500/10",
|
|
@@ -69,20 +69,20 @@ var Notice = (props) => {
|
|
|
69
69
|
subtitleColorClassName: "es:text-surface-800/50",
|
|
70
70
|
selectionClassName: "es:selection:bg-accent-100 es:selection:text-accent-700"
|
|
71
71
|
}
|
|
72
|
-
};
|
|
72
|
+
}[type];
|
|
73
73
|
return jsxs("div", {
|
|
74
|
-
className: clsx("es:grid es:grid-cols-[auto_1fr] es:grid-rows-[auto_auto]", "es:rounded-xl", "es:bg-white", "es:inset-ring", "es:bg-linear-to-b es:from-35%", "es:inset-shadow-sm", flat ? "es:shadow-2xs" : "es:shadow-sm",
|
|
74
|
+
className: clsx("es:grid es:grid-cols-[auto_1fr] es:grid-rows-[auto_auto]", "es:rounded-xl", "es:bg-white", "es:inset-ring", "es:bg-linear-to-b es:from-35%", "es:inset-shadow-sm", flat ? "es:shadow-2xs" : "es:shadow-sm", currentStyle.className, "es:icon:shrink-0", "es:selection:p-2", currentStyle.selectionClassName, icon || currentStyle.icon ? "es:gap-x-2 es:py-3 es:pl-2.5 es:pr-3" : "es:py-3 es:px-3.5", className),
|
|
75
75
|
children: [
|
|
76
|
-
(icon ||
|
|
77
|
-
className: clsx("es:col-span-1 es:col-start-1 es:row-span-2 es:row-start-1 es:shrink-0 es:icon:size-6", alignIconToTitle ? "es:self-baseline" : "es:self-center-safe",
|
|
78
|
-
children: icon ??
|
|
76
|
+
(icon || currentStyle.icon) && jsx("div", {
|
|
77
|
+
className: clsx("es:col-span-1 es:col-start-1 es:row-span-2 es:row-start-1 es:shrink-0 es:icon:size-6", alignIconToTitle ? "es:self-baseline" : "es:self-center-safe", currentStyle.iconColorClassName),
|
|
78
|
+
children: icon ?? currentStyle.icon
|
|
79
79
|
}),
|
|
80
80
|
label && jsx("span", {
|
|
81
|
-
className: clsx("es:col-span-2 es:col-start-2 es:text-balance es:text-14", subtitle ? "es:self-end" : "es:row-span-2 es:self-center-safe", "es:font-variation-[\"wdth\"_78,\"wght\"_325,\"ROND\"_100]",
|
|
81
|
+
className: clsx("es:col-span-2 es:col-start-2 es:text-balance es:text-14", subtitle ? "es:self-end" : "es:row-span-2 es:self-center-safe", "es:font-variation-[\"wdth\"_78,\"wght\"_325,\"ROND\"_100]", currentStyle.textColorClassName),
|
|
82
82
|
children: label
|
|
83
83
|
}),
|
|
84
84
|
subtitle && jsx("span", {
|
|
85
|
-
className: clsx("es:col-span-2 es:col-start-2 es:text-balance es:text-xs es:leading-tighter es:pt-0.75", "es:font-variation-[\"wdth\"_90,\"wght\"_350,\"slnt\"_-1]",
|
|
85
|
+
className: clsx("es:col-span-2 es:col-start-2 es:text-balance es:text-xs es:leading-tighter es:pt-0.75", "es:font-variation-[\"wdth\"_90,\"wght\"_350,\"slnt\"_-1]", currentStyle.subtitleColorClassName, label ? "es:self-start" : "es:row-span-2 es:self-center-safe"),
|
|
86
86
|
children: subtitle
|
|
87
87
|
})
|
|
88
88
|
]
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as NumberPicker } from "../../number-picker-
|
|
1
|
+
import { t as NumberPicker } from "../../number-picker-CK_OHBXw.js";
|
|
2
2
|
export { NumberPicker };
|
|
@@ -6,7 +6,7 @@ import { RadioButton, RadioButtonGroup } from '../radio/radio';
|
|
|
6
6
|
import { ToggleButton } from '../toggle-button/toggle-button';
|
|
7
7
|
import type { Prettify } from '../../utilities/types';
|
|
8
8
|
type OptionSelectType = 'toggleButtons' | 'toggleButtonsSplit' | 'radios' | 'radiosSegmented' | 'menu' | 'submenu' | 'standaloneMenuItems';
|
|
9
|
-
type OptionValue = string | number | boolean;
|
|
9
|
+
type OptionValue = string | number | boolean | null | undefined;
|
|
10
10
|
type IconValue = string | JSX.Element | null;
|
|
11
11
|
type OptionSeparator = boolean | 'above' | 'below';
|
|
12
12
|
type OptionItem = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as ToggleButton } from "../../toggle-button-
|
|
2
|
-
import { n as ButtonGroup } from "../../button-
|
|
1
|
+
import { t as ToggleButton } from "../../toggle-button-B2-f2rU6.js";
|
|
2
|
+
import { n as ButtonGroup } from "../../button-C7mc6eS1.js";
|
|
3
3
|
import { RichLabel } from "../rich-label/rich-label.js";
|
|
4
4
|
import { BaseControl } from "../base-control/base-control.js";
|
|
5
5
|
import { t as __ } from "../../build-module-DG6ZK7Ty.js";
|
|
@@ -9,7 +9,13 @@ import { RadioButton, RadioButtonGroup } from "../radio/radio.js";
|
|
|
9
9
|
import { Fragment } from "react";
|
|
10
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
//#region lib/components/option-select/option-select.tsx
|
|
12
|
-
var
|
|
12
|
+
var isStringValue = (value) => Object.prototype.toString.call(value) === "[object String]";
|
|
13
|
+
var isBooleanValue = (value) => Object.prototype.toString.call(value) === "[object Boolean]";
|
|
14
|
+
var getOptionKey = (value) => {
|
|
15
|
+
if (value === null) return "null";
|
|
16
|
+
if (value === void 0) return "undefined";
|
|
17
|
+
return JSON.stringify([value]);
|
|
18
|
+
};
|
|
13
19
|
var renderOptionIcon = (icon) => icon ? jsx(Icon, { icon }) : null;
|
|
14
20
|
/**
|
|
15
21
|
* A component that allows the user to select an option from a list of options.
|
|
@@ -60,9 +66,9 @@ var OptionSelect = (props) => {
|
|
|
60
66
|
});
|
|
61
67
|
};
|
|
62
68
|
const getToggleTooltip = (optionTooltip, optionAriaLabel, optionLabel) => {
|
|
63
|
-
if (
|
|
69
|
+
if (isStringValue(optionTooltip) || isBooleanValue(optionTooltip)) return optionTooltip;
|
|
64
70
|
if (optionAriaLabel) return optionAriaLabel;
|
|
65
|
-
if (noItemLabel &&
|
|
71
|
+
if (noItemLabel && isStringValue(optionLabel)) return optionLabel;
|
|
66
72
|
};
|
|
67
73
|
const renderMenuOptions = () => options.map(({ label: optionLabel, value: optionValue, icon: optionIcon, endIcon: optionEndIcon, ariaLabel: optionAriaLabel, subtitle: optionSubtitle, separator: optionHasSeparator, sectionTitle: optionSectionTitle, sectionIcon: optionSectionIcon, sectionSubtitle: optionSectionSubtitle, sectionEndIcon: optionSectionEndIcon, shortcut: optionShortcut, disabled: optionDisabled }) => jsxs(Fragment, { children: [
|
|
68
74
|
optionHasSeparator === true || optionHasSeparator === "above" ? jsx(MenuSeparator, {}) : null,
|
|
@@ -79,7 +85,7 @@ var OptionSelect = (props) => {
|
|
|
79
85
|
className: itemClassName,
|
|
80
86
|
icon: !noItemIcon ? renderOptionIcon(optionIcon) : null,
|
|
81
87
|
endIcon: !noItemIcon ? renderOptionIcon(optionEndIcon) : null,
|
|
82
|
-
"aria-label": optionAriaLabel ?? (
|
|
88
|
+
"aria-label": optionAriaLabel ?? (isStringValue(optionLabel) ? optionLabel : void 0),
|
|
83
89
|
onClick: () => onChange(optionValue),
|
|
84
90
|
shortcut: optionShortcut,
|
|
85
91
|
...itemProps,
|
|
@@ -112,7 +118,7 @@ var OptionSelect = (props) => {
|
|
|
112
118
|
children: [
|
|
113
119
|
["toggleButtons", "toggleButtonsSplit"].includes(type) ? jsx(ButtonGroup, {
|
|
114
120
|
vertical,
|
|
115
|
-
"aria-label":
|
|
121
|
+
"aria-label": label !== void 0 ? void 0 : ariaLabel,
|
|
116
122
|
type: type === "toggleButtonsSplit" ? "split" : "segmented",
|
|
117
123
|
...wrapperProps,
|
|
118
124
|
children: options.map(({ label: optionLabel, value: optionValue, icon: optionIcon, tooltip: optionTooltip, ariaLabel: optionAriaLabel, subtitle: optionSubtitle, disabled: optionDisabled }) => jsx(ToggleButton, {
|
|
@@ -122,7 +128,7 @@ var OptionSelect = (props) => {
|
|
|
122
128
|
className: itemClassName,
|
|
123
129
|
icon: !noItemIcon ? renderOptionIcon(optionIcon) : null,
|
|
124
130
|
tooltip: getToggleTooltip(optionTooltip, optionAriaLabel, optionLabel),
|
|
125
|
-
"aria-label": optionAriaLabel ?? (
|
|
131
|
+
"aria-label": optionAriaLabel ?? (isStringValue(optionLabel) ? optionLabel : void 0),
|
|
126
132
|
...itemProps,
|
|
127
133
|
children: renderOptionContent(optionLabel, optionSubtitle)
|
|
128
134
|
}, getOptionKey(optionValue)))
|
|
@@ -134,8 +140,8 @@ var OptionSelect = (props) => {
|
|
|
134
140
|
if (nextItem) onChange(nextItem.value);
|
|
135
141
|
},
|
|
136
142
|
design: radioDesign,
|
|
137
|
-
"aria-label":
|
|
138
|
-
value:
|
|
143
|
+
"aria-label": label !== void 0 ? void 0 : ariaLabel,
|
|
144
|
+
value: currentItem ? getOptionKey(currentItem.value) : void 0,
|
|
139
145
|
...wrapperProps,
|
|
140
146
|
children: options.map(({ label: optionLabel, value: optionValue, icon: optionIcon, ariaLabel: optionAriaLabel, subtitle: optionSubtitle, disabled: optionDisabled }) => jsx(RadioButton, {
|
|
141
147
|
value: getOptionKey(optionValue),
|
|
@@ -143,14 +149,14 @@ var OptionSelect = (props) => {
|
|
|
143
149
|
className: itemClassName,
|
|
144
150
|
subtitle: !noItemLabel ? optionSubtitle : void 0,
|
|
145
151
|
icon: !noItemIcon ? renderOptionIcon(optionIcon) : null,
|
|
146
|
-
"aria-label": optionAriaLabel ?? (
|
|
152
|
+
"aria-label": optionAriaLabel ?? (isStringValue(optionLabel) ? optionLabel : void 0),
|
|
147
153
|
label: !noItemLabel ? optionLabel : void 0,
|
|
148
154
|
...itemProps
|
|
149
155
|
}, getOptionKey(optionValue)))
|
|
150
156
|
}) : null,
|
|
151
157
|
type === "menu" ? jsxs(Menu, {
|
|
152
|
-
triggerLabel:
|
|
153
|
-
triggerIcon:
|
|
158
|
+
triggerLabel: currentItem ? resolvedMenuTriggerLabel : notSetLabel,
|
|
159
|
+
triggerIcon: currentItem ? resolvedTriggerIcon : void 0,
|
|
154
160
|
tooltip: noTriggerLabel ? jsx(RichLabel, {
|
|
155
161
|
label: tooltip || currentItem?.tooltip || currentItem?.label,
|
|
156
162
|
subtitle: tooltip ? currentItem?.tooltip || currentItem?.label : void 0,
|
|
@@ -158,10 +164,10 @@ var OptionSelect = (props) => {
|
|
|
158
164
|
}) : tooltip,
|
|
159
165
|
triggerProps: {
|
|
160
166
|
...wrapperProps?.triggerProps,
|
|
161
|
-
"aria-label":
|
|
167
|
+
"aria-label": label !== void 0 ? void 0 : ariaLabel ?? (isStringValue(label) ? label : void 0) ?? (isStringValue(tooltip) ? tooltip : void 0)
|
|
162
168
|
},
|
|
163
169
|
keepOpen: true,
|
|
164
|
-
"aria-label": ariaLabel ?? (
|
|
170
|
+
"aria-label": ariaLabel ?? (isStringValue(label) ? label : void 0) ?? (isStringValue(tooltip) ? tooltip : void 0) ?? __("Menu", "eightshift-ui-components"),
|
|
165
171
|
...wrapperProps,
|
|
166
172
|
children: [renderMenuOptions(), children]
|
|
167
173
|
}) : null
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as clsx } from "../../clsx-DQoRUQAf.js";
|
|
2
|
-
import { t as $2ec61d1d4f780267$export$a8a3e93435678ff9 } from "../../Heading-
|
|
3
|
-
import { Container, ContainerGroup } from "../base-control/container.js";
|
|
2
|
+
import { t as $2ec61d1d4f780267$export$a8a3e93435678ff9 } from "../../Heading-BQje2nS2.js";
|
|
3
|
+
import { Container as TypedContainer, ContainerGroup as TypedContainerGroup } from "../base-control/container.js";
|
|
4
4
|
import { cloneElement } from "react";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region lib/components/options-panel/options-panel.tsx
|
|
@@ -22,7 +22,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
22
22
|
var OptionsPanel = (props) => {
|
|
23
23
|
const { children, className, title, help, hidden } = props;
|
|
24
24
|
if (hidden) return null;
|
|
25
|
-
return jsxs(Fragment$1, { children: [jsx(
|
|
25
|
+
return jsxs(Fragment$1, { children: [jsx(TypedContainerGroup, {
|
|
26
26
|
title,
|
|
27
27
|
className,
|
|
28
28
|
children
|
|
@@ -46,7 +46,7 @@ var OptionsPanel = (props) => {
|
|
|
46
46
|
*/
|
|
47
47
|
var OptionsPanelSection = ({ children, className, hidden }) => {
|
|
48
48
|
if (hidden) return null;
|
|
49
|
-
return jsx(
|
|
49
|
+
return jsx(TypedContainer, {
|
|
50
50
|
className: clsx("es:max-w-lg", className),
|
|
51
51
|
children
|
|
52
52
|
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { t as clsx } from "../../clsx-DQoRUQAf.js";
|
|
2
|
-
import { r as truncateMiddle } from "../../text-helpers-
|
|
2
|
+
import { r as truncateMiddle } from "../../text-helpers-QrwKKaOh.js";
|
|
3
3
|
import { file } from "../../icons/ui-icons/file.js";
|
|
4
4
|
import { SmartImage } from "../smart-image/smart-image.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region lib/components/placeholders/file-picker-shell.tsx
|
|
8
|
+
var isRenderFunction = (value) => Object.prototype.toString.call(value) === "[object Function]";
|
|
8
9
|
var TypedSmartImage = SmartImage;
|
|
9
10
|
/**
|
|
10
11
|
* A shell for a file picker UI, handling both rich visual presentation and simple file placeholders.
|
|
@@ -51,7 +52,7 @@ var FilePickerShell = (props) => {
|
|
|
51
52
|
className: "es:line-clamp-1",
|
|
52
53
|
children: truncateMiddle(url, 34)
|
|
53
54
|
})]
|
|
54
|
-
}) : null, children &&
|
|
55
|
+
}) : null, children && !isRenderFunction(children) ? jsx("div", {
|
|
55
56
|
className: "es:flex es:items-center-safe es:gap-0.75 es-button-group-h",
|
|
56
57
|
children
|
|
57
58
|
}) : null]
|
|
@@ -70,7 +71,7 @@ var FilePickerShell = (props) => {
|
|
|
70
71
|
hasError ? errorBadge : null,
|
|
71
72
|
children ? jsx("div", {
|
|
72
73
|
className: clsx("es:flex es:items-center-safe es:gap-0.75", "es-button-group-h", !hasError && !isTransparent && "es:absolute es:bottom-2 es:left-2 es:right-2 es:translate-y-[125%] es:group-hover:translate-y-0 es:has-aria-expanded:translate-y-0 es:has-focus-visible:translate-y-0 es:transition-transform es:ease-spring-smooth"),
|
|
73
|
-
children:
|
|
74
|
+
children: isRenderFunction(children) ? children({
|
|
74
75
|
dominantColors,
|
|
75
76
|
isDark,
|
|
76
77
|
isTransparent,
|
|
@@ -5,6 +5,7 @@ import { file } from "../../icons/ui-icons/file.js";
|
|
|
5
5
|
import "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
//#region lib/components/placeholders/file-placeholder.tsx
|
|
8
|
+
var isStringValue = (value) => Object.prototype.toString.call(value) === "[object String]";
|
|
8
9
|
/**
|
|
9
10
|
* A simple file placeholder.
|
|
10
11
|
*
|
|
@@ -21,7 +22,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
21
22
|
*/
|
|
22
23
|
var FilePlaceholder = (props) => {
|
|
23
24
|
const { icon, fileName, className, flat, children } = props;
|
|
24
|
-
const label = fileName ?? (
|
|
25
|
+
const label = fileName ?? (isStringValue(children) ? children : void 0) ?? __("No file selected", "eightshift-ui-components");
|
|
25
26
|
return jsx(RichLabel, {
|
|
26
27
|
icon: jsx("div", {
|
|
27
28
|
className: clsx("es:w-fit es:rounded-xl es:p-2", fileName && [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as clsx } from "../../clsx-DQoRUQAf.js";
|
|
2
|
-
import { n as $f2ff30fde7b014be$export$3ddf2d174ce01153, t as $f2ff30fde7b014be$export$2e1e1122cf0cba88, u as $542a13ca2fa5b484$export$5b6b19405a83ff9d } from "../../Dialog-
|
|
3
|
-
import { o as $4fcfe18fac72dabd$export$746d02f47f4d381 } from "../../useOverlayTriggerState-
|
|
4
|
-
import { t as Button } from "../../button-
|
|
2
|
+
import { n as $f2ff30fde7b014be$export$3ddf2d174ce01153, t as $f2ff30fde7b014be$export$2e1e1122cf0cba88, u as $542a13ca2fa5b484$export$5b6b19405a83ff9d } from "../../Dialog-Bdqjmtt2.js";
|
|
3
|
+
import { o as $4fcfe18fac72dabd$export$746d02f47f4d381 } from "../../useOverlayTriggerState-Cpc_IbQf.js";
|
|
4
|
+
import { t as Button } from "../../button-C7mc6eS1.js";
|
|
5
5
|
import { t as __ } from "../../build-module-DG6ZK7Ty.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -16,8 +16,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
16
16
|
* </PortalProvider>
|
|
17
17
|
*/
|
|
18
18
|
var PortalProvider = ({ children, portalElement }) => {
|
|
19
|
+
const getContainer = useCallback(() => portalElement ?? null, [portalElement]);
|
|
19
20
|
return jsx($72abaeab4d80592f$export$78efe591171d7d45, {
|
|
20
|
-
getContainer
|
|
21
|
+
getContainer,
|
|
21
22
|
children
|
|
22
23
|
});
|
|
23
24
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as clsx } from "../../clsx-DQoRUQAf.js";
|
|
2
2
|
import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
|
|
3
|
-
import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-
|
|
4
|
-
import { n as $fe21c36db05242bb$export$d7b12c4107be0d61, t as $fe21c36db05242bb$export$a98f0dcb43a68a25 } from "../../RadioGroup-
|
|
3
|
+
import { n as $43a3b93638fe5db9$export$b04be29aa201d4f5 } from "../../Label-C4bJkVti.js";
|
|
4
|
+
import { n as $fe21c36db05242bb$export$d7b12c4107be0d61, t as $fe21c36db05242bb$export$a98f0dcb43a68a25 } from "../../RadioGroup-Dxzko0ma.js";
|
|
5
5
|
import { RichLabel } from "../rich-label/rich-label.js";
|
|
6
6
|
import { BaseControl } from "../base-control/base-control.js";
|
|
7
7
|
import { t as cva } from "../../dist-DpXluZqJ.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as clsx } from "../../clsx-DQoRUQAf.js";
|
|
2
|
-
import { t as Button } from "../../button-
|
|
2
|
+
import { t as Button } from "../../button-C7mc6eS1.js";
|
|
3
3
|
import { t as __ } from "../../build-module-DG6ZK7Ty.js";
|
|
4
4
|
import { copy } from "../../icons/ui-icons/copy.js";
|
|
5
5
|
import { dropdownCaretAlt } from "../../icons/ui-icons/dropdown-caret-alt.js";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { Prettify } from '../../utilities/types';
|
|
3
|
-
type RepeaterItemData =
|
|
4
|
-
type RepeaterListItemValue<Item extends
|
|
3
|
+
type RepeaterItemData = object;
|
|
4
|
+
type RepeaterListItemValue<Item extends object> = Item & {
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
};
|
|
7
|
-
type RepeaterChildValue<Item extends
|
|
7
|
+
type RepeaterChildValue<Item extends object> = RepeaterListItemValue<Item> & {
|
|
8
8
|
updateData: (newValue: Partial<Item>) => void;
|
|
9
9
|
itemIndex: number;
|
|
10
10
|
deleteItem: () => void;
|
|
11
11
|
};
|
|
12
|
-
type AddButtonProps<Item extends
|
|
12
|
+
type AddButtonProps<Item extends object> = {
|
|
13
13
|
addItem: (additional?: Partial<RepeaterListItemValue<Item>>) => void;
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
};
|
|
16
|
-
type RepeaterProps<Item extends
|
|
16
|
+
type RepeaterProps<Item extends object = object> = {
|
|
17
17
|
children: (item: RepeaterChildValue<Item>) => ReactNode;
|
|
18
18
|
/** Function to run when the items change. */
|
|
19
19
|
onChange: (items: Item[]) => void;
|
|
@@ -61,38 +61,5 @@ type RepeaterProps<Item extends RepeaterItemData = RepeaterItemData> = {
|
|
|
61
61
|
hidden?: boolean;
|
|
62
62
|
itemLabelProp?: string;
|
|
63
63
|
};
|
|
64
|
-
/**
|
|
65
|
-
* A component that allows re-ordering a list of items with additional sub-options.
|
|
66
|
-
*
|
|
67
|
-
* @component
|
|
68
|
-
* @param {RepeaterProps} props - Component props.
|
|
69
|
-
*
|
|
70
|
-
* @returns {JSX.Element} The Repeater component.
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* <Repeater
|
|
74
|
-
* label='My repeater'
|
|
75
|
-
* items={items}
|
|
76
|
-
* onChange={setItems}
|
|
77
|
-
* >
|
|
78
|
-
* {(item) => {
|
|
79
|
-
* const { title, updateData } = item;
|
|
80
|
-
*
|
|
81
|
-
* return (
|
|
82
|
-
* <RepeaterItem
|
|
83
|
-
* label={title ?? 'New item'}
|
|
84
|
-
* icon={myIcon}
|
|
85
|
-
* >
|
|
86
|
-
* <InputField
|
|
87
|
-
* label='Title'
|
|
88
|
-
* type='text'
|
|
89
|
-
* value={title}
|
|
90
|
-
* onChange={(value) => updateData({ title: value })}
|
|
91
|
-
* />
|
|
92
|
-
* </RepeaterItem>
|
|
93
|
-
* );
|
|
94
|
-
* }}
|
|
95
|
-
* </Repeater>
|
|
96
|
-
*/
|
|
97
64
|
export declare const Repeater: <Item extends RepeaterItemData>(props: Prettify<RepeaterProps<Item>>) => import("react").JSX.Element | null;
|
|
98
65
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as clsx } from "../../clsx-DQoRUQAf.js";
|
|
2
2
|
import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
|
|
3
|
-
import { t as Button } from "../../button-
|
|
3
|
+
import { t as Button } from "../../button-C7mc6eS1.js";
|
|
4
4
|
import { BaseControl } from "../base-control/base-control.js";
|
|
5
5
|
import { t as __ } from "../../build-module-DG6ZK7Ty.js";
|
|
6
6
|
import { add } from "../../icons/ui-icons/add.js";
|
|
@@ -46,6 +46,10 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
46
46
|
* }}
|
|
47
47
|
* </Repeater>
|
|
48
48
|
*/
|
|
49
|
+
var mergeItem = (item, newValue) => ({
|
|
50
|
+
...item,
|
|
51
|
+
...newValue
|
|
52
|
+
});
|
|
49
53
|
var Repeater = (props) => {
|
|
50
54
|
const { children, onChange, items, icon, label, subtitle, help, actions, hideEmptyState, addDefaultItem = {}, addDisabled, onAfterItemAdd, onAfterItemRemove, minItems, maxItems, addButton, className, emptyState, noExpandAllButton, noDuplicateButton, noDragToRemove, moreOptions, hidden } = props;
|
|
51
55
|
const [allOpen, setAllOpen] = useState(false);
|
|
@@ -54,10 +58,7 @@ var Repeater = (props) => {
|
|
|
54
58
|
const canDelete = items.length > (minItems ?? 0);
|
|
55
59
|
const canAdd = items.length < (maxItems ?? Number.MAX_SAFE_INTEGER) && !addDisabled;
|
|
56
60
|
const addItem = useCallback((additional = {}) => {
|
|
57
|
-
const newItem =
|
|
58
|
-
...addDefaultItem,
|
|
59
|
-
...additional
|
|
60
|
-
};
|
|
61
|
+
const newItem = mergeItem(addDefaultItem, additional);
|
|
61
62
|
onChange([...items, newItem]);
|
|
62
63
|
onAfterItemAdd?.(newItem);
|
|
63
64
|
}, [
|
|
@@ -105,11 +106,7 @@ var Repeater = (props) => {
|
|
|
105
106
|
children: children({
|
|
106
107
|
...item,
|
|
107
108
|
updateData: (newValue) => {
|
|
108
|
-
const updatedItems =
|
|
109
|
-
updatedItems[index] = {
|
|
110
|
-
...updatedItems[index],
|
|
111
|
-
...newValue
|
|
112
|
-
};
|
|
109
|
+
const updatedItems = items.map((currentItem, itemIndex) => itemIndex === index ? mergeItem(currentItem, newValue) : currentItem);
|
|
113
110
|
onChange(updatedItems);
|
|
114
111
|
},
|
|
115
112
|
itemIndex: index,
|
|
@@ -5,7 +5,6 @@ type InnerContentAlign = 'start' | 'center' | 'end' | 'stretch';
|
|
|
5
5
|
type ResponsiveOption = {
|
|
6
6
|
label: string;
|
|
7
7
|
value: Exclude<ResponsiveValueItem, undefined>;
|
|
8
|
-
[key: string]: unknown;
|
|
9
8
|
};
|
|
10
9
|
type ResponsiveValue = Record<string, ResponsiveValueItem>;
|
|
11
10
|
type BreakpointUiOverride = {
|