@eightshift/ui-components 5.0.0 → 5.0.2
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/Button-BpwTmkAe.js +185 -0
- package/dist/Collection-n5d0zIgb.js +2398 -0
- package/dist/Color-lVhk8V_G.js +2452 -0
- package/dist/ColorSwatch-DntWEAC3.js +64 -0
- package/dist/ComboBox-BJpTEATT.js +1915 -0
- package/dist/Dialog-O9uw63D7.js +2317 -0
- package/dist/FieldError-DHrSdE_Q.js +42 -0
- package/dist/FocusScope-BEPI2m7u.js +831 -0
- package/dist/Form-Cq3fu75_.js +5 -0
- package/dist/Group-DDPhPPTQ.js +48 -0
- package/dist/Heading-ba38ScjJ.js +16 -0
- package/dist/Hidden-rE6uR-lr.js +41 -0
- package/dist/Input-BmDS8Juy.js +133 -0
- package/dist/Label-JS_ob-kh.js +17 -0
- package/dist/List-CZMUbkFU.js +593 -0
- package/dist/ListBox-BTxlCGcc.js +664 -0
- package/dist/NumberFormatter-DA8u1Ot7.js +140 -0
- package/dist/OverlayArrow-5aDgmImj.js +637 -0
- package/dist/RSPContexts-2lR5GG9p.js +14 -0
- package/dist/Select-aab027f3.esm-BKIJGje-.js +2469 -0
- package/dist/Separator-CaTBkETC.js +332 -0
- package/dist/Slider-C-S1oEH9.js +853 -0
- package/dist/Text-BuJgePCv.js +16 -0
- package/dist/VisuallyHidden-BYi0pekx.js +48 -0
- package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
- package/dist/assets/index.css +57 -0
- package/dist/assets/style-admin.css +5908 -0
- package/dist/assets/style-editor.css +5908 -0
- package/dist/assets/style.css +5914 -0
- package/dist/assets/wp-font-enhancements.css +8 -0
- package/dist/assets/wp-ui-enhancements.css +396 -0
- package/dist/components/animated-visibility/animated-visibility.js +105 -0
- package/dist/components/base-control/base-control.js +86 -0
- package/dist/components/breakpoint-preview/breakpoint-preview.js +161 -0
- package/dist/components/button/button.js +387 -0
- package/dist/components/checkbox/checkbox.js +323 -0
- package/dist/components/color-pickers/color-picker.js +272 -0
- package/dist/components/color-pickers/color-swatch.js +59 -0
- package/dist/components/color-pickers/gradient-editor.js +534 -0
- package/dist/components/color-pickers/solid-color-picker.js +1567 -0
- package/dist/components/component-toggle/component-toggle.js +161 -0
- package/dist/components/container-panel/container-panel.js +131 -0
- package/dist/components/draggable/draggable-context.js +5 -0
- package/dist/components/draggable/draggable-handle.js +46 -0
- package/dist/components/draggable/draggable.js +7320 -0
- package/dist/components/draggable-list/draggable-list-context.js +5 -0
- package/dist/components/draggable-list/draggable-list-item.js +77 -0
- package/dist/components/draggable-list/draggable-list.js +151 -0
- package/dist/components/expandable/expandable.js +342 -0
- package/dist/components/index.js +137 -0
- package/dist/components/input-field/input-field.js +231 -0
- package/dist/components/item-collection/item-collection.js +59 -0
- package/dist/components/layout/hstack.js +30 -0
- package/dist/components/layout/vstack.js +30 -0
- package/dist/components/link-input/link-input.js +284 -0
- package/dist/components/matrix-align/matrix-align.js +134 -0
- package/dist/components/menu/menu.js +285 -0
- package/dist/components/modal/modal.js +305 -0
- package/dist/components/notice/notice.js +123 -0
- package/dist/components/number-picker/number-picker.js +292 -0
- package/dist/components/option-select/option-select.js +264 -0
- package/dist/components/options-panel/options-panel.js +158 -0
- package/dist/components/placeholders/file-placeholder.js +42 -0
- package/dist/components/placeholders/image-placeholder.js +88 -0
- package/dist/components/placeholders/media-placeholder.js +63 -0
- package/dist/components/popover/popover.js +207 -0
- package/dist/components/radio/radio.js +582 -0
- package/dist/components/repeater/repeater-context.js +5 -0
- package/dist/components/repeater/repeater-item.js +119 -0
- package/dist/components/repeater/repeater.js +280 -0
- package/dist/components/responsive/mini-responsive.js +498 -0
- package/dist/components/responsive/responsive-legacy.js +343 -0
- package/dist/components/responsive/responsive.js +583 -0
- package/dist/components/responsive-preview/responsive-preview.js +123 -0
- package/dist/components/rich-label/rich-label.js +66 -0
- package/dist/components/select/async-multi-select.js +157 -0
- package/dist/components/select/async-single-select.js +137 -0
- package/dist/components/select/custom-select-default-components.js +38 -0
- package/dist/components/select/multi-select-components.js +8 -0
- package/dist/components/select/multi-select.js +151 -0
- package/dist/components/select/react-select-component-wrappers.js +90 -0
- package/dist/components/select/shared.js +26 -0
- package/dist/components/select/single-select.js +131 -0
- package/dist/components/select/styles.js +49 -0
- package/dist/components/select/v2/async-select.js +297 -0
- package/dist/components/select/v2/shared.js +24 -0
- package/dist/components/select/v2/single-select.js +1004 -0
- package/dist/components/slider/column-config-slider.js +210 -0
- package/dist/components/slider/slider.js +345 -0
- package/dist/components/slider/utils.js +94 -0
- package/dist/components/spacer/spacer.js +97 -0
- package/dist/components/tabs/tabs.js +703 -0
- package/dist/components/toggle/switch.js +156 -0
- package/dist/components/toggle/toggle.js +64 -0
- package/dist/components/toggle-button/toggle-button.js +343 -0
- package/dist/components/tooltip/tooltip.js +527 -0
- package/dist/context-BbYZoHvX.js +92 -0
- package/dist/default-i18n-CT_oS1Fy.js +922 -0
- package/dist/filterDOMProps-EDDcM64A.js +28 -0
- package/dist/icons/block-icon.js +42 -0
- package/dist/icons/generic-color-swatch.js +113 -0
- package/dist/icons/icons.js +30495 -0
- package/dist/icons/index.js +11 -0
- package/dist/icons/jsx-svg.js +50 -0
- package/dist/index-641ee5b8.esm-BPU8rMZr.js +3137 -0
- package/dist/index-BljRBEr_.js +44 -0
- package/dist/index-CFozsmNS.js +28321 -0
- package/dist/index.js +139 -0
- package/dist/lite-DVmmD_-j.js +7 -0
- package/dist/modifiers.esm-BuJQPI1X.js +31 -0
- package/dist/multi-select-components-Sp-JEFEX.js +3744 -0
- package/dist/number-GajL10e1.js +36 -0
- package/dist/react-jsx-parser.min-DZCiis5V.js +11753 -0
- package/dist/react-select-async.esm-D937XTWW.js +107 -0
- package/dist/react-select.esm-Ciai3aKf.js +15 -0
- package/dist/style-admin.js +1 -0
- package/dist/style-editor.js +1 -0
- package/dist/style.js +1 -0
- package/dist/textSelection-8DpK8fJl.js +46 -0
- package/dist/useButton-Bt3BffJm.js +50 -0
- package/dist/useEvent-ICdlokG-.js +23 -0
- package/dist/useFocusRing-Bv0UJQl8.js +107 -0
- package/dist/useFormReset-D2YaWRIA.js +22 -0
- package/dist/useFormValidation-Dy0PXJg5.js +224 -0
- package/dist/useHover-C2SkI1Fn.js +895 -0
- package/dist/useLabel-BPCd5c7-.js +27 -0
- package/dist/useLabels-B7-lUnAF.js +23 -0
- package/dist/useListState-DkyH7elT.js +168 -0
- package/dist/useLocalizedStringFormatter-C9GO0IDB.js +121 -0
- package/dist/useNumberField-CU1_u8ze.js +1215 -0
- package/dist/useNumberFormatter-CZ9QUnRt.js +13 -0
- package/dist/usePress-BrJylgPR.js +688 -0
- package/dist/useSingleSelectListState-C4sorv2p.js +38 -0
- package/dist/useToggle-CDa3YAZI.js +59 -0
- package/dist/useToggleState-ibcBUHnB.js +19 -0
- package/dist/utilities/array-helpers.js +56 -0
- package/dist/utilities/debounce-throttle.js +123 -0
- package/dist/utilities/es-dash.js +382 -0
- package/dist/utilities/index.js +27 -0
- package/dist/utilities/text-helpers.js +136 -0
- package/dist/utils-CZt7LCbO.js +403 -0
- package/dist/wp/wp-font-enhancements.js +1 -0
- package/dist/wp/wp-ui-enhancements.js +1 -0
- package/package.json +24 -24
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slices the string in the middle and inputs the provided separator so that the string is maxLength characters long.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} input - String to slice.
|
|
5
|
+
* @param {number} maxLength - Maximum allowed string length.
|
|
6
|
+
* @param {string} [separator='...'] - Separator to insert.
|
|
7
|
+
*
|
|
8
|
+
* @access public
|
|
9
|
+
*
|
|
10
|
+
* @returns {string|Error} Truncated string or error if separator length exceeds maxLength.
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* ```js
|
|
14
|
+
* truncateMiddle('https://eightshift.com/contact/', 22);
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Output:
|
|
18
|
+
* ```js
|
|
19
|
+
* "https://ei.../contact/"
|
|
20
|
+
*
|
|
21
|
+
* @preserve
|
|
22
|
+
*/
|
|
23
|
+
const truncateMiddle = (input, maxLength, separator = "...") => {
|
|
24
|
+
if (!input) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if ((input == null ? void 0 : input.length) <= maxLength) {
|
|
28
|
+
return input;
|
|
29
|
+
}
|
|
30
|
+
if (separator.length + 1 > maxLength) {
|
|
31
|
+
throw new Error("Separator length exceeds the passed maximum length, string wouldn't be visible.");
|
|
32
|
+
}
|
|
33
|
+
const maxStringLength = maxLength - separator.length;
|
|
34
|
+
const leftPartLength = Math.ceil(maxStringLength / 2);
|
|
35
|
+
const rightPartLength = Math.floor(maxStringLength / 2);
|
|
36
|
+
const leftPart = input.slice(0, leftPartLength).trim();
|
|
37
|
+
const rightPart = rightPartLength > 0 ? input.slice(-1 * rightPartLength).trim() : "";
|
|
38
|
+
return `${leftPart}${separator}${rightPart}`;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Un-escapes HTML entities.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} input - Input string.
|
|
44
|
+
*
|
|
45
|
+
* @access public
|
|
46
|
+
*
|
|
47
|
+
* @returns {string} String with HTML entities unescaped.
|
|
48
|
+
*
|
|
49
|
+
* Usage:
|
|
50
|
+
* ```js
|
|
51
|
+
* unescapeHTML('Test&Up');
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* Output:
|
|
55
|
+
* ```js
|
|
56
|
+
* Test&Up
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @preserve
|
|
60
|
+
*/
|
|
61
|
+
const unescapeHTML = (input = "") => new DOMParser().parseFromString(input, "text/html").documentElement.textContent;
|
|
62
|
+
/**
|
|
63
|
+
* Limits the string to the maximum length and adds the provided separator in case the string is longer.
|
|
64
|
+
*
|
|
65
|
+
* @param {string} input - String to slice.
|
|
66
|
+
* @param {number} maxLength - Maximum allowed string length.
|
|
67
|
+
* @param {string} [separator='...'] - Separator to insert.
|
|
68
|
+
*
|
|
69
|
+
* @access public
|
|
70
|
+
*
|
|
71
|
+
* @returns {string|Error} Truncated string or error if separator length exceeds maxLength.
|
|
72
|
+
*
|
|
73
|
+
* Usage:
|
|
74
|
+
* ```js
|
|
75
|
+
* truncate('Hello this is a string', 13); // => "Hello this..."
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @preserve
|
|
79
|
+
*/
|
|
80
|
+
const truncate = (input, maxLength, separator = "...") => {
|
|
81
|
+
if (!input) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
if ((input == null ? void 0 : input.length) <= maxLength) {
|
|
85
|
+
return input;
|
|
86
|
+
}
|
|
87
|
+
if (separator.length + 1 > maxLength) {
|
|
88
|
+
throw new Error("Separator length exceeds the passed maximum length, string wouldn't be visible.");
|
|
89
|
+
}
|
|
90
|
+
const maxStringLength = maxLength - separator.length;
|
|
91
|
+
const leftPart = input.slice(0, maxStringLength).trim();
|
|
92
|
+
return `${leftPart}${separator}`;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Slices the string at the end and inputs the provided separator so that the string is maxLength characters long.
|
|
96
|
+
*
|
|
97
|
+
* @param {string} input - String to slice.
|
|
98
|
+
* @param {number} maxLength - Maximum allowed string length.
|
|
99
|
+
* @param {string} [separator='...'] - Separator to insert.
|
|
100
|
+
*
|
|
101
|
+
* @access public
|
|
102
|
+
*
|
|
103
|
+
* @returns {string|Error} Truncated string or error if separator length exceeds maxLength.
|
|
104
|
+
*
|
|
105
|
+
* Usage:
|
|
106
|
+
* ```js
|
|
107
|
+
* truncateMiddle('https://eightshift.com/contact/', 22);
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* Output:
|
|
111
|
+
* ```js
|
|
112
|
+
* "https://ei.../contact/"
|
|
113
|
+
*
|
|
114
|
+
* @preserve
|
|
115
|
+
*/
|
|
116
|
+
const truncateEnd = (input, maxLength, separator = "...") => {
|
|
117
|
+
if (!input) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
if ((input == null ? void 0 : input.length) <= maxLength) {
|
|
121
|
+
return input;
|
|
122
|
+
}
|
|
123
|
+
if (separator.length + 1 > maxLength) {
|
|
124
|
+
throw new Error("Separator length exceeds the passed maximum length, string wouldn't be visible.");
|
|
125
|
+
}
|
|
126
|
+
const maxStringLength = maxLength - separator.length;
|
|
127
|
+
const leftPartLength = Math.ceil(maxStringLength);
|
|
128
|
+
const leftPart = input.slice(0, leftPartLength).trim();
|
|
129
|
+
return `${leftPart}${separator}`;
|
|
130
|
+
};
|
|
131
|
+
export {
|
|
132
|
+
truncate,
|
|
133
|
+
truncateEnd,
|
|
134
|
+
truncateMiddle,
|
|
135
|
+
unescapeHTML
|
|
136
|
+
};
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import React__default, { useRef, useCallback, useState, useContext, useEffect, useMemo } from "react";
|
|
2
|
+
const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof document !== "undefined" ? React__default.useLayoutEffect : () => {
|
|
3
|
+
};
|
|
4
|
+
function $8ae05eaa5c114e9c$export$7f54fc3180508a52(fn) {
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
7
|
+
ref.current = fn;
|
|
8
|
+
}, [
|
|
9
|
+
fn
|
|
10
|
+
]);
|
|
11
|
+
return useCallback((...args) => {
|
|
12
|
+
const f = ref.current;
|
|
13
|
+
return f === null || f === void 0 ? void 0 : f(...args);
|
|
14
|
+
}, []);
|
|
15
|
+
}
|
|
16
|
+
function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue) {
|
|
17
|
+
let [value, setValue] = useState(defaultValue);
|
|
18
|
+
let effect = useRef(null);
|
|
19
|
+
let nextRef = $8ae05eaa5c114e9c$export$7f54fc3180508a52(() => {
|
|
20
|
+
if (!effect.current) return;
|
|
21
|
+
let newValue = effect.current.next();
|
|
22
|
+
if (newValue.done) {
|
|
23
|
+
effect.current = null;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (value === newValue.value) nextRef();
|
|
27
|
+
else setValue(newValue.value);
|
|
28
|
+
});
|
|
29
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
30
|
+
if (effect.current) nextRef();
|
|
31
|
+
});
|
|
32
|
+
let queue = $8ae05eaa5c114e9c$export$7f54fc3180508a52((fn) => {
|
|
33
|
+
effect.current = fn(value);
|
|
34
|
+
nextRef();
|
|
35
|
+
});
|
|
36
|
+
return [
|
|
37
|
+
value,
|
|
38
|
+
queue
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
const $b5e257d569688ac6$var$defaultContext = {
|
|
42
|
+
prefix: String(Math.round(Math.random() * 1e10)),
|
|
43
|
+
current: 0
|
|
44
|
+
};
|
|
45
|
+
const $b5e257d569688ac6$var$SSRContext = /* @__PURE__ */ React__default.createContext($b5e257d569688ac6$var$defaultContext);
|
|
46
|
+
const $b5e257d569688ac6$var$IsSSRContext = /* @__PURE__ */ React__default.createContext(false);
|
|
47
|
+
let $b5e257d569688ac6$var$canUseDOM = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
48
|
+
let $b5e257d569688ac6$var$componentIds = /* @__PURE__ */ new WeakMap();
|
|
49
|
+
function $b5e257d569688ac6$var$useCounter(isDisabled = false) {
|
|
50
|
+
let ctx = useContext($b5e257d569688ac6$var$SSRContext);
|
|
51
|
+
let ref = useRef(null);
|
|
52
|
+
if (ref.current === null && !isDisabled) {
|
|
53
|
+
var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
54
|
+
let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React__default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
|
|
55
|
+
if (currentOwner) {
|
|
56
|
+
let prevComponentValue = $b5e257d569688ac6$var$componentIds.get(currentOwner);
|
|
57
|
+
if (prevComponentValue == null)
|
|
58
|
+
$b5e257d569688ac6$var$componentIds.set(currentOwner, {
|
|
59
|
+
id: ctx.current,
|
|
60
|
+
state: currentOwner.memoizedState
|
|
61
|
+
});
|
|
62
|
+
else if (currentOwner.memoizedState !== prevComponentValue.state) {
|
|
63
|
+
ctx.current = prevComponentValue.id;
|
|
64
|
+
$b5e257d569688ac6$var$componentIds.delete(currentOwner);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
ref.current = ++ctx.current;
|
|
68
|
+
}
|
|
69
|
+
return ref.current;
|
|
70
|
+
}
|
|
71
|
+
function $b5e257d569688ac6$var$useLegacySSRSafeId(defaultId) {
|
|
72
|
+
let ctx = useContext($b5e257d569688ac6$var$SSRContext);
|
|
73
|
+
if (ctx === $b5e257d569688ac6$var$defaultContext && !$b5e257d569688ac6$var$canUseDOM && process.env.NODE_ENV !== "production") console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");
|
|
74
|
+
let counter = $b5e257d569688ac6$var$useCounter(!!defaultId);
|
|
75
|
+
let prefix = ctx === $b5e257d569688ac6$var$defaultContext && process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${ctx.prefix}`;
|
|
76
|
+
return defaultId || `${prefix}-${counter}`;
|
|
77
|
+
}
|
|
78
|
+
function $b5e257d569688ac6$var$useModernSSRSafeId(defaultId) {
|
|
79
|
+
let id = React__default.useId();
|
|
80
|
+
let [didSSR] = useState($b5e257d569688ac6$export$535bd6ca7f90a273());
|
|
81
|
+
let prefix = didSSR || process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext.prefix}`;
|
|
82
|
+
return defaultId || `${prefix}-${id}`;
|
|
83
|
+
}
|
|
84
|
+
const $b5e257d569688ac6$export$619500959fc48b26 = typeof React__default["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId : $b5e257d569688ac6$var$useLegacySSRSafeId;
|
|
85
|
+
function $b5e257d569688ac6$var$getSnapshot() {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
function $b5e257d569688ac6$var$getServerSnapshot() {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
function $b5e257d569688ac6$var$subscribe(onStoreChange) {
|
|
92
|
+
return () => {
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function $b5e257d569688ac6$export$535bd6ca7f90a273() {
|
|
96
|
+
if (typeof React__default["useSyncExternalStore"] === "function") return React__default["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe, $b5e257d569688ac6$var$getSnapshot, $b5e257d569688ac6$var$getServerSnapshot);
|
|
97
|
+
return useContext($b5e257d569688ac6$var$IsSSRContext);
|
|
98
|
+
}
|
|
99
|
+
let $bdb11010cef70236$var$canUseDOM = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
100
|
+
let $bdb11010cef70236$export$d41a04c74483c6ef = /* @__PURE__ */ new Map();
|
|
101
|
+
let $bdb11010cef70236$var$registry;
|
|
102
|
+
if (typeof FinalizationRegistry !== "undefined") $bdb11010cef70236$var$registry = new FinalizationRegistry((heldValue) => {
|
|
103
|
+
$bdb11010cef70236$export$d41a04c74483c6ef.delete(heldValue);
|
|
104
|
+
});
|
|
105
|
+
function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
|
|
106
|
+
let [value, setValue] = useState(defaultId);
|
|
107
|
+
let nextId = useRef(null);
|
|
108
|
+
let res = $b5e257d569688ac6$export$619500959fc48b26(value);
|
|
109
|
+
let cleanupRef = useRef(null);
|
|
110
|
+
if ($bdb11010cef70236$var$registry) $bdb11010cef70236$var$registry.register(cleanupRef, res);
|
|
111
|
+
if ($bdb11010cef70236$var$canUseDOM) {
|
|
112
|
+
const cacheIdRef = $bdb11010cef70236$export$d41a04c74483c6ef.get(res);
|
|
113
|
+
if (cacheIdRef && !cacheIdRef.includes(nextId)) cacheIdRef.push(nextId);
|
|
114
|
+
else $bdb11010cef70236$export$d41a04c74483c6ef.set(res, [
|
|
115
|
+
nextId
|
|
116
|
+
]);
|
|
117
|
+
}
|
|
118
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
119
|
+
let r2 = res;
|
|
120
|
+
return () => {
|
|
121
|
+
if ($bdb11010cef70236$var$registry) $bdb11010cef70236$var$registry.unregister(cleanupRef);
|
|
122
|
+
$bdb11010cef70236$export$d41a04c74483c6ef.delete(r2);
|
|
123
|
+
};
|
|
124
|
+
}, [
|
|
125
|
+
res
|
|
126
|
+
]);
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
let newId = nextId.current;
|
|
129
|
+
if (newId) setValue(newId);
|
|
130
|
+
return () => {
|
|
131
|
+
if (newId) nextId.current = null;
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
return res;
|
|
135
|
+
}
|
|
136
|
+
function $bdb11010cef70236$export$cd8c9cb68f842629(idA, idB) {
|
|
137
|
+
if (idA === idB) return idA;
|
|
138
|
+
let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef.get(idA);
|
|
139
|
+
if (setIdsA) {
|
|
140
|
+
setIdsA.forEach((ref) => ref.current = idB);
|
|
141
|
+
return idB;
|
|
142
|
+
}
|
|
143
|
+
let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef.get(idB);
|
|
144
|
+
if (setIdsB) {
|
|
145
|
+
setIdsB.forEach((ref) => ref.current = idA);
|
|
146
|
+
return idA;
|
|
147
|
+
}
|
|
148
|
+
return idB;
|
|
149
|
+
}
|
|
150
|
+
function $bdb11010cef70236$export$b4cc09c592e8fdb8(depArray = []) {
|
|
151
|
+
let id = $bdb11010cef70236$export$f680877a34711e37();
|
|
152
|
+
let [resolvedId, setResolvedId] = $1dbecbe27a04f9af$export$14d238f342723f25(id);
|
|
153
|
+
let updateId = useCallback(() => {
|
|
154
|
+
setResolvedId(function* () {
|
|
155
|
+
yield id;
|
|
156
|
+
yield document.getElementById(id) ? id : void 0;
|
|
157
|
+
});
|
|
158
|
+
}, [
|
|
159
|
+
id,
|
|
160
|
+
setResolvedId
|
|
161
|
+
]);
|
|
162
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(updateId, [
|
|
163
|
+
id,
|
|
164
|
+
updateId,
|
|
165
|
+
...depArray
|
|
166
|
+
]);
|
|
167
|
+
return resolvedId;
|
|
168
|
+
}
|
|
169
|
+
function $ff5963eb1fccf552$export$e08e3b67e392101e(...callbacks) {
|
|
170
|
+
return (...args) => {
|
|
171
|
+
for (let callback of callbacks) if (typeof callback === "function") callback(...args);
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function r(e) {
|
|
175
|
+
var t, f, n = "";
|
|
176
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
177
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
178
|
+
var o = e.length;
|
|
179
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
180
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
181
|
+
return n;
|
|
182
|
+
}
|
|
183
|
+
function clsx() {
|
|
184
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
185
|
+
return n;
|
|
186
|
+
}
|
|
187
|
+
function $3ef42575df84b30b$export$9d1611c77c2fe928(...args) {
|
|
188
|
+
let result = {
|
|
189
|
+
...args[0]
|
|
190
|
+
};
|
|
191
|
+
for (let i = 1; i < args.length; i++) {
|
|
192
|
+
let props = args[i];
|
|
193
|
+
for (let key in props) {
|
|
194
|
+
let a = result[key];
|
|
195
|
+
let b = props[key];
|
|
196
|
+
if (typeof a === "function" && typeof b === "function" && // This is a lot faster than a regex.
|
|
197
|
+
key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
|
|
198
|
+
65 && key.charCodeAt(2) <= /* 'Z' */
|
|
199
|
+
90) result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e(a, b);
|
|
200
|
+
else if ((key === "className" || key === "UNSAFE_className") && typeof a === "string" && typeof b === "string") result[key] = clsx(a, b);
|
|
201
|
+
else if (key === "id" && a && b) result.id = $bdb11010cef70236$export$cd8c9cb68f842629(a, b);
|
|
202
|
+
else result[key] = b !== void 0 ? b : a;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return result;
|
|
206
|
+
}
|
|
207
|
+
function $5dc95899b306f630$export$c9058316764c140e(...refs) {
|
|
208
|
+
if (refs.length === 1 && refs[0]) return refs[0];
|
|
209
|
+
return (value) => {
|
|
210
|
+
let hasCleanup = false;
|
|
211
|
+
const cleanups = refs.map((ref) => {
|
|
212
|
+
const cleanup = $5dc95899b306f630$var$setRef(ref, value);
|
|
213
|
+
hasCleanup || (hasCleanup = typeof cleanup == "function");
|
|
214
|
+
return cleanup;
|
|
215
|
+
});
|
|
216
|
+
if (hasCleanup) return () => {
|
|
217
|
+
cleanups.forEach((cleanup, i) => {
|
|
218
|
+
if (typeof cleanup === "function") cleanup();
|
|
219
|
+
else $5dc95899b306f630$var$setRef(refs[i], null);
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function $5dc95899b306f630$var$setRef(ref, value) {
|
|
225
|
+
if (typeof ref === "function") return ref(value);
|
|
226
|
+
else if (ref != null) ref.current = value;
|
|
227
|
+
}
|
|
228
|
+
function $df56164dff5785e2$export$4338b53315abf666(ref) {
|
|
229
|
+
const objRef = useRef(null);
|
|
230
|
+
const cleanupRef = useRef(void 0);
|
|
231
|
+
const refEffect = useCallback((instance) => {
|
|
232
|
+
if (typeof ref === "function") {
|
|
233
|
+
const refCallback = ref;
|
|
234
|
+
const refCleanup = refCallback(instance);
|
|
235
|
+
return () => {
|
|
236
|
+
if (typeof refCleanup === "function") refCleanup();
|
|
237
|
+
else refCallback(null);
|
|
238
|
+
};
|
|
239
|
+
} else if (ref) {
|
|
240
|
+
ref.current = instance;
|
|
241
|
+
return () => {
|
|
242
|
+
ref.current = null;
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
}, [
|
|
246
|
+
ref
|
|
247
|
+
]);
|
|
248
|
+
return useMemo(() => ({
|
|
249
|
+
get current() {
|
|
250
|
+
return objRef.current;
|
|
251
|
+
},
|
|
252
|
+
set current(value) {
|
|
253
|
+
objRef.current = value;
|
|
254
|
+
if (cleanupRef.current) {
|
|
255
|
+
cleanupRef.current();
|
|
256
|
+
cleanupRef.current = void 0;
|
|
257
|
+
}
|
|
258
|
+
if (value != null) cleanupRef.current = refEffect(value);
|
|
259
|
+
}
|
|
260
|
+
}), [
|
|
261
|
+
refEffect
|
|
262
|
+
]);
|
|
263
|
+
}
|
|
264
|
+
const $64fa3d84918910a7$export$c62b8e45d58ddad9 = Symbol("default");
|
|
265
|
+
function $64fa3d84918910a7$export$2881499e37b75b9a({ values, children }) {
|
|
266
|
+
for (let [Context, value] of values)
|
|
267
|
+
children = /* @__PURE__ */ React__default.createElement(Context.Provider, {
|
|
268
|
+
value
|
|
269
|
+
}, children);
|
|
270
|
+
return children;
|
|
271
|
+
}
|
|
272
|
+
function $64fa3d84918910a7$export$4d86445c2cf5e3(props) {
|
|
273
|
+
let { className, style, children, defaultClassName, defaultChildren, defaultStyle, values } = props;
|
|
274
|
+
return useMemo(() => {
|
|
275
|
+
let computedClassName;
|
|
276
|
+
let computedStyle;
|
|
277
|
+
let computedChildren;
|
|
278
|
+
if (typeof className === "function") computedClassName = className({
|
|
279
|
+
...values,
|
|
280
|
+
defaultClassName
|
|
281
|
+
});
|
|
282
|
+
else computedClassName = className;
|
|
283
|
+
if (typeof style === "function") computedStyle = style({
|
|
284
|
+
...values,
|
|
285
|
+
defaultStyle: defaultStyle || {}
|
|
286
|
+
});
|
|
287
|
+
else computedStyle = style;
|
|
288
|
+
if (typeof children === "function") computedChildren = children({
|
|
289
|
+
...values,
|
|
290
|
+
defaultChildren
|
|
291
|
+
});
|
|
292
|
+
else if (children == null) computedChildren = defaultChildren;
|
|
293
|
+
else computedChildren = children;
|
|
294
|
+
return {
|
|
295
|
+
className: computedClassName !== null && computedClassName !== void 0 ? computedClassName : defaultClassName,
|
|
296
|
+
style: computedStyle || defaultStyle ? {
|
|
297
|
+
...defaultStyle,
|
|
298
|
+
...computedStyle
|
|
299
|
+
} : void 0,
|
|
300
|
+
children: computedChildren !== null && computedChildren !== void 0 ? computedChildren : defaultChildren,
|
|
301
|
+
"data-rac": ""
|
|
302
|
+
};
|
|
303
|
+
}, [
|
|
304
|
+
className,
|
|
305
|
+
style,
|
|
306
|
+
children,
|
|
307
|
+
defaultClassName,
|
|
308
|
+
defaultChildren,
|
|
309
|
+
defaultStyle,
|
|
310
|
+
values
|
|
311
|
+
]);
|
|
312
|
+
}
|
|
313
|
+
function $64fa3d84918910a7$export$fabf2dc03a41866e(context, slot) {
|
|
314
|
+
let ctx = useContext(context);
|
|
315
|
+
if (slot === null)
|
|
316
|
+
return null;
|
|
317
|
+
if (ctx && typeof ctx === "object" && "slots" in ctx && ctx.slots) {
|
|
318
|
+
let slotKey = slot || $64fa3d84918910a7$export$c62b8e45d58ddad9;
|
|
319
|
+
if (!ctx.slots[slotKey]) {
|
|
320
|
+
let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map((p) => `"${p}"`));
|
|
321
|
+
let errorMessage = slot ? `Invalid slot "${slot}".` : "A slot prop is required.";
|
|
322
|
+
throw new Error(`${errorMessage} Valid slot names are ${availableSlots}.`);
|
|
323
|
+
}
|
|
324
|
+
return ctx.slots[slotKey];
|
|
325
|
+
}
|
|
326
|
+
return ctx;
|
|
327
|
+
}
|
|
328
|
+
function $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, context) {
|
|
329
|
+
let ctx = $64fa3d84918910a7$export$fabf2dc03a41866e(context, props.slot) || {};
|
|
330
|
+
let { ref: contextRef, ...contextProps } = ctx;
|
|
331
|
+
let mergedRef = $df56164dff5785e2$export$4338b53315abf666(useMemo(() => $5dc95899b306f630$export$c9058316764c140e(ref, contextRef), [
|
|
332
|
+
ref,
|
|
333
|
+
contextRef
|
|
334
|
+
]));
|
|
335
|
+
let mergedProps = $3ef42575df84b30b$export$9d1611c77c2fe928(contextProps, props);
|
|
336
|
+
if ("style" in contextProps && contextProps.style && "style" in props && props.style) {
|
|
337
|
+
if (typeof contextProps.style === "function" || typeof props.style === "function")
|
|
338
|
+
mergedProps.style = (renderProps) => {
|
|
339
|
+
let contextStyle = typeof contextProps.style === "function" ? contextProps.style(renderProps) : contextProps.style;
|
|
340
|
+
let defaultStyle = {
|
|
341
|
+
...renderProps.defaultStyle,
|
|
342
|
+
...contextStyle
|
|
343
|
+
};
|
|
344
|
+
let style = typeof props.style === "function" ? props.style({
|
|
345
|
+
...renderProps,
|
|
346
|
+
defaultStyle
|
|
347
|
+
}) : props.style;
|
|
348
|
+
return {
|
|
349
|
+
...defaultStyle,
|
|
350
|
+
...style
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
else
|
|
354
|
+
mergedProps.style = {
|
|
355
|
+
...contextProps.style,
|
|
356
|
+
...props.style
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
return [
|
|
360
|
+
mergedProps,
|
|
361
|
+
mergedRef
|
|
362
|
+
];
|
|
363
|
+
}
|
|
364
|
+
function $64fa3d84918910a7$export$9d4c57ee4c6ffdd8(initialState = true) {
|
|
365
|
+
let [hasSlot, setHasSlot] = useState(initialState);
|
|
366
|
+
let hasRun = useRef(false);
|
|
367
|
+
let ref = useCallback((el) => {
|
|
368
|
+
hasRun.current = true;
|
|
369
|
+
setHasSlot(!!el);
|
|
370
|
+
}, []);
|
|
371
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
372
|
+
if (!hasRun.current) setHasSlot(false);
|
|
373
|
+
}, []);
|
|
374
|
+
return [
|
|
375
|
+
ref,
|
|
376
|
+
hasSlot
|
|
377
|
+
];
|
|
378
|
+
}
|
|
379
|
+
function $64fa3d84918910a7$export$ef03459518577ad4(props) {
|
|
380
|
+
const prefix = /^(data-.*)$/;
|
|
381
|
+
let filteredProps = {};
|
|
382
|
+
for (const prop in props) if (!prefix.test(prop)) filteredProps[prop] = props[prop];
|
|
383
|
+
return filteredProps;
|
|
384
|
+
}
|
|
385
|
+
export {
|
|
386
|
+
$64fa3d84918910a7$export$fabf2dc03a41866e as $,
|
|
387
|
+
$64fa3d84918910a7$export$29f1550f4b0d4415 as a,
|
|
388
|
+
$64fa3d84918910a7$export$4d86445c2cf5e3 as b,
|
|
389
|
+
clsx as c,
|
|
390
|
+
$3ef42575df84b30b$export$9d1611c77c2fe928 as d,
|
|
391
|
+
$bdb11010cef70236$export$f680877a34711e37 as e,
|
|
392
|
+
$8ae05eaa5c114e9c$export$7f54fc3180508a52 as f,
|
|
393
|
+
$64fa3d84918910a7$export$9d4c57ee4c6ffdd8 as g,
|
|
394
|
+
$64fa3d84918910a7$export$ef03459518577ad4 as h,
|
|
395
|
+
$64fa3d84918910a7$export$2881499e37b75b9a as i,
|
|
396
|
+
$bdb11010cef70236$export$b4cc09c592e8fdb8 as j,
|
|
397
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c as k,
|
|
398
|
+
$df56164dff5785e2$export$4338b53315abf666 as l,
|
|
399
|
+
$5dc95899b306f630$export$c9058316764c140e as m,
|
|
400
|
+
$b5e257d569688ac6$export$535bd6ca7f90a273 as n,
|
|
401
|
+
$64fa3d84918910a7$export$c62b8e45d58ddad9 as o,
|
|
402
|
+
$ff5963eb1fccf552$export$e08e3b67e392101e as p
|
|
403
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../assets/wp-font-enhancements.css';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../assets/wp-ui-enhancements.css';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eightshift/ui-components",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -43,53 +43,53 @@
|
|
|
43
43
|
"react-dom": "^18.3.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@adobe/react-spectrum": "^3.
|
|
47
|
-
"@dnd-kit/abstract": "^0.1.
|
|
46
|
+
"@adobe/react-spectrum": "^3.42.1",
|
|
47
|
+
"@dnd-kit/abstract": "^0.1.18",
|
|
48
48
|
"@dnd-kit/core": "^6.3.1",
|
|
49
|
-
"@dnd-kit/dom": "^0.1.
|
|
50
|
-
"@dnd-kit/helpers": "^0.1.
|
|
49
|
+
"@dnd-kit/dom": "^0.1.18",
|
|
50
|
+
"@dnd-kit/helpers": "^0.1.18",
|
|
51
51
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
52
|
-
"@dnd-kit/react": "^0.1.
|
|
52
|
+
"@dnd-kit/react": "^0.1.18",
|
|
53
53
|
"@dnd-kit/sortable": "^10.0.0",
|
|
54
54
|
"@dnd-kit/utilities": "^3.2.2",
|
|
55
55
|
"@eslint/compat": "^1.2.9",
|
|
56
|
-
"@react-stately/collections": "^3.12.
|
|
57
|
-
"@stylistic/eslint-plugin-js": "^4.
|
|
58
|
-
"@tailwindcss/vite": "^4.1.
|
|
59
|
-
"@types/react": "^18.3.
|
|
56
|
+
"@react-stately/collections": "^3.12.5",
|
|
57
|
+
"@stylistic/eslint-plugin-js": "^4.4.1",
|
|
58
|
+
"@tailwindcss/vite": "^4.1.8",
|
|
59
|
+
"@types/react": "^18.3.23",
|
|
60
60
|
"@types/react-dom": "^18.3.7",
|
|
61
|
-
"@vitejs/plugin-react-swc": "^3.
|
|
62
|
-
"@wordpress/i18n": "^5.
|
|
61
|
+
"@vitejs/plugin-react-swc": "^3.10.1",
|
|
62
|
+
"@wordpress/i18n": "^5.25.0",
|
|
63
63
|
"autoprefixer": "^10.4.21",
|
|
64
64
|
"class-variance-authority": "^0.7.1",
|
|
65
65
|
"clsx": "^2.1.1",
|
|
66
66
|
"css-gradient-parser": "^0.0.16",
|
|
67
|
-
"eslint": "^9.
|
|
68
|
-
"eslint-config-prettier": "^10.1.
|
|
69
|
-
"eslint-plugin-jsdoc": "^50.
|
|
70
|
-
"eslint-plugin-prettier": "^5.4.
|
|
67
|
+
"eslint": "^9.28.0",
|
|
68
|
+
"eslint-config-prettier": "^10.1.5",
|
|
69
|
+
"eslint-plugin-jsdoc": "^50.7.1",
|
|
70
|
+
"eslint-plugin-prettier": "^5.4.1",
|
|
71
71
|
"glob": "^11.0.2",
|
|
72
|
-
"globals": "^16.
|
|
72
|
+
"globals": "^16.2.0",
|
|
73
73
|
"just-camel-case": "^6.2.0",
|
|
74
74
|
"just-debounce-it": "^3.2.0",
|
|
75
75
|
"just-has": "^2.3.0",
|
|
76
76
|
"just-is-empty": "^3.4.1",
|
|
77
77
|
"just-kebab-case": "^4.2.0",
|
|
78
78
|
"just-throttle": "^4.2.0",
|
|
79
|
-
"lightningcss": "^1.
|
|
80
|
-
"postcss": "^8.5.
|
|
79
|
+
"lightningcss": "^1.30.1",
|
|
80
|
+
"postcss": "^8.5.4",
|
|
81
81
|
"prettier": "^3.5.3",
|
|
82
|
-
"prettier-plugin-tailwindcss": "^0.6.
|
|
82
|
+
"prettier-plugin-tailwindcss": "^0.6.12",
|
|
83
83
|
"react": "^18.3.1",
|
|
84
|
-
"react-aria": "^3.
|
|
85
|
-
"react-aria-components": "^1.
|
|
84
|
+
"react-aria": "^3.41.0",
|
|
85
|
+
"react-aria-components": "^1.10.0",
|
|
86
86
|
"react-dom": "^18.3.1",
|
|
87
87
|
"react-jsx-parser": "^2.4.0",
|
|
88
88
|
"react-movable": "^3.4.1",
|
|
89
89
|
"react-select": "^5.10.1",
|
|
90
|
-
"react-stately": "^3.
|
|
90
|
+
"react-stately": "^3.39.0",
|
|
91
91
|
"svg-to-jsx-string": "^0.1.1",
|
|
92
|
-
"tailwindcss": "^4.1.
|
|
92
|
+
"tailwindcss": "^4.1.8",
|
|
93
93
|
"tailwindcss-motion": "^1.1.0",
|
|
94
94
|
"tailwindcss-react-aria-components": "^2.0.0",
|
|
95
95
|
"vite": "^6.3.5",
|