@eightshift/ui-components 1.0.6 → 1.1.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/README.md +9 -0
- package/dist/{Button-eebLs4cp.js → Button-CbFrFO04.js} +5 -5
- package/dist/{Checkbox-BN0TEda-.js → Checkbox-Cv3pZDHg.js} +12 -16
- package/dist/{ColorSwatch-BrowHhTG.js → ColorSwatch-CNQmCQV8.js} +6 -7
- package/dist/{FieldError-ILxgMZy5.js → FieldError-J1-YPbi6.js} +2 -2
- package/dist/{FocusScope-B9b0VMib.js → FocusScope-Bw-IatMO.js} +79 -153
- package/dist/{GridList-CzpWxJsS.js → GridList-CEzzyr-l.js} +62 -90
- package/dist/{Group-Dkdm2-E7.js → Group-D3Qa6PrV.js} +3 -3
- package/dist/{Input-BJA4rmIo.js → Input-CX_rocyZ.js} +8 -8
- package/dist/{Label-9x5iLJ-Y.js → Label-Bg5O81Wb.js} +1 -1
- package/dist/{ListBox-D3Vr4vvC.js → ListBox-CCWXTj0t.js} +391 -598
- package/dist/{LiveAnnouncer-IsokfWQ5.js → LiveAnnouncer-D8h-3GrG.js} +12 -22
- package/dist/{NumberFormatter-LzoKy975.js → NumberFormatter-U_Gx0UDq.js} +26 -44
- package/dist/{Select-49a62830.esm-CKPmlkza.js → Select-49a62830.esm-BnlXlUnT.js} +92 -166
- package/dist/{SelectionManager-sedvcM-1.js → SelectionManager-XOAt-Ekx.js} +219 -401
- package/dist/{Separator-B6rnDabE.js → Separator-DZeg0KOr.js} +41 -72
- package/dist/{Slider-C5U5N7uM.js → Slider-fULMI0gI.js} +51 -82
- package/dist/{Text-Cyxp9ewv.js → Text-WqetJduR.js} +1 -1
- package/dist/{VisuallyHidden-BPJVSUyp.js → VisuallyHidden-Di1zXprL.js} +8 -11
- package/dist/{ariaHideOutside-ByKBPHmX.js → ariaHideOutside-Zn64-frS.js} +20 -36
- package/dist/assets/style.css +1 -1
- package/dist/assets/wp-font-enhancements.css +1 -1
- package/dist/assets/wp-ui-enhancements.css +1 -1
- package/dist/{button-idVI4jmd.js → button-CD8Q1eok.js} +17 -29
- package/dist/components/animated-visibility/animated-visibility.js +125 -113
- package/dist/components/base-control/base-control.js +3 -9
- package/dist/components/breakpoint-preview/breakpoint-preview.js +51 -108
- package/dist/components/button/button.js +6 -6
- package/dist/components/checkbox/checkbox.js +2 -2
- package/dist/components/color-pickers/color-picker.js +2 -2
- package/dist/components/color-pickers/color-swatch.js +5 -9
- package/dist/components/color-pickers/gradient-editor.js +15 -29
- package/dist/components/color-pickers/solid-color-picker.js +81 -128
- package/dist/components/component-toggle/component-toggle.js +4 -4
- package/dist/components/container-panel/container-panel.js +4 -11
- package/dist/components/draggable-list/draggable-list-item.js +4 -4
- package/dist/components/draggable-list/draggable-list.js +5 -5
- package/dist/components/expandable/expandable.js +45 -57
- package/dist/components/index.js +3 -3
- package/dist/components/input-field/input-field.js +11 -26
- package/dist/components/layout/hstack.js +2 -12
- package/dist/components/layout/vstack.js +2 -12
- package/dist/components/link-input/link-input.js +36 -53
- package/dist/components/list-box/list-box.js +4 -4
- package/dist/components/matrix-align/matrix-align.js +6 -10
- package/dist/components/menu/menu.js +101 -170
- package/dist/components/notice/notice.js +1 -1
- package/dist/components/number-picker/number-picker.js +15 -15
- package/dist/components/option-select/option-select.js +48 -64
- package/dist/components/options-panel/options-panel.js +3 -3
- package/dist/components/placeholders/file-placeholder.js +2 -2
- package/dist/components/placeholders/image-placeholder.js +1 -1
- package/dist/components/placeholders/media-placeholder.js +1 -1
- package/dist/components/popover/popover.js +4 -4
- package/dist/components/radio/radio.js +25 -38
- package/dist/components/repeater/repeater-item.js +6 -17
- package/dist/components/repeater/repeater.js +6 -7
- package/dist/components/responsive/responsive-legacy.js +6 -12
- package/dist/components/responsive/responsive.js +21 -48
- package/dist/components/responsive-preview/responsive-preview.js +1 -1
- package/dist/components/rich-label/rich-label.js +2 -8
- package/dist/components/select/async-multi-select.js +3 -3
- package/dist/components/select/async-single-select.js +2 -2
- package/dist/components/select/custom-select-default-components.js +2 -2
- package/dist/components/select/multi-select-components.js +2 -2
- package/dist/components/select/multi-select.js +3 -3
- package/dist/components/select/react-select-component-wrappers.js +9 -9
- package/dist/components/select/single-select.js +2 -2
- package/dist/components/select/styles.js +3 -10
- package/dist/components/slider/column-config-slider.js +4 -4
- package/dist/components/slider/slider.js +5 -8
- package/dist/components/slider/utils.js +2 -6
- package/dist/components/spacer/spacer.js +2 -7
- package/dist/components/tabs/tabs.js +29 -50
- package/dist/components/toggle/switch.js +8 -8
- package/dist/components/toggle/toggle.js +1 -1
- package/dist/components/toggle-button/toggle-button.js +8 -22
- package/dist/components/tooltip/tooltip.js +4 -4
- package/dist/{context-BAcFg5GO.js → context-4oSz1ItD.js} +10 -16
- package/dist/{default-i18n-Bk1GxDHz.js → default-i18n-BqwLkgZv.js} +21 -22
- package/dist/{filterDOMProps-DG2RfOUr.js → filterDOMProps-EDDcM64A.js} +1 -3
- package/dist/{focusSafely-B0hyd-S4.js → focusSafely-BS4dllCW.js} +85 -143
- package/dist/icons/generic-color-swatch.js +105 -13
- package/dist/icons/icons.js +31010 -3447
- package/dist/icons/jsx-svg.js +591 -953
- package/dist/{index-BDk0TPWz.js → index-CAPcSs9K.js} +1504 -2087
- package/dist/{index-a301f526.esm-BzTuHLdr.js → index-a301f526.esm-ByOfDxiG.js} +111 -183
- package/dist/index.js +3 -3
- package/dist/{intlStrings-Ctkp0HDc.js → intlStrings-Dxaeitoh.js} +35 -60
- package/dist/{isScrollable-PcyglExV.js → isScrollable-Dh9D9IOd.js} +1 -2
- package/dist/lite-DVmmD_-j.js +7 -0
- package/dist/{multi-select-components-nORKdJ-2.js → multi-select-components-7vKCF8dG.js} +3 -3
- package/dist/{number-rWqELA8W.js → number-CHmNj-oR.js} +3 -6
- package/dist/{popover-o2Q28Ljn.js → popover-Dk2o4S7K.js} +70 -112
- package/dist/{react-select-async.esm-CLj9uZTq.js → react-select-async.esm-5zW9Dv9E.js} +7 -11
- package/dist/{react-select.esm-3tyTZmrx.js → react-select.esm-Bi6uzjbT.js} +3 -3
- package/dist/{textSelection-BRZdHY-4.js → textSelection-exP_9srp.js} +5 -9
- package/dist/{tooltip-T6H9uF-Z.js → tooltip-BRQ4tvZL.js} +64 -111
- package/dist/{useButton-D-xACzEY.js → useButton-DbjDV_33.js} +19 -22
- package/dist/{useEvent-XlYPKgwX.js → useEvent-zvxfEnmK.js} +2 -3
- package/dist/{useFocusRing-CRx_hYC4.js → useFocusRing-SPRI0-SN.js} +1 -1
- package/dist/{useFocusable-CHfpEdlE.js → useFocusable-CLmhO94g.js} +5 -8
- package/dist/{useFormReset-aHn6-wRk.js → useFormReset-BVWgcyGO.js} +2 -3
- package/dist/{useFormValidationState-CdYmOaXI.js → useFormValidationState-CthG9Fbc.js} +20 -38
- package/dist/{useHasTabbableChild-domoFB7A.js → useHasTabbableChild--gkWUICh.js} +2 -2
- package/dist/{useLabel-DVhXVhtH.js → useLabel-g836T8kL.js} +3 -4
- package/dist/{useLabels-C7E5SkOi.js → useLabels-CfOtyOe2.js} +3 -5
- package/dist/{useListData-BelKu4kx.js → useListData-BpYQj7kK.js} +18 -32
- package/dist/{useListState-BRsq7O1C.js → useListState-DnWZa__1.js} +6 -12
- package/dist/{useLocalizedStringFormatter-WsEL47qR.js → useLocalizedStringFormatter-BQCMno9k.js} +12 -21
- package/dist/{useNumberFieldState-ZH2Qyyxh.js → useNumberFieldState-BegO5X6F.js} +75 -132
- package/dist/{useNumberFormatter-mhdYLxWQ.js → useNumberFormatter-DhOGEsEK.js} +2 -2
- package/dist/{usePress-B42RawCH.js → usePress-CScNeV3V.js} +92 -175
- package/dist/{useToggle-CExfZM8x.js → useToggle-6LnpaJ7-.js} +6 -7
- package/dist/{useToggleState-DghG5ImG.js → useToggleState-Cymkpac8.js} +3 -5
- package/dist/utilities/array-helpers.js +1 -1
- package/dist/utilities/index.js +1 -1
- package/dist/utilities/text-helpers.js +20 -20
- package/dist/{utils-DIBzm1e4.js → utils-Dc35LwuT.js} +49 -90
- package/package.json +96 -90
- package/dist/lite-pbIeT7tm.js +0 -8
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { useEffect, createContext, useMemo, useContext, useState, useRef } from "react";
|
|
2
|
-
import { i as $507fabe10e71c6fb$export$8397ddfc504fdb9a } from "./focusSafely-
|
|
3
|
-
import { g as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, f as $8ae05eaa5c114e9c$export$7f54fc3180508a52 } from "./utils-
|
|
2
|
+
import { i as $507fabe10e71c6fb$export$8397ddfc504fdb9a } from "./focusSafely-BS4dllCW.js";
|
|
3
|
+
import { g as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, f as $8ae05eaa5c114e9c$export$7f54fc3180508a52 } from "./utils-Dc35LwuT.js";
|
|
4
4
|
function $e93e671b31057976$export$b8473d3665f3a75a(props, state, ref) {
|
|
5
5
|
let { validationBehavior, focus } = props;
|
|
6
6
|
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
7
7
|
if (validationBehavior === "native" && (ref === null || ref === void 0 ? void 0 : ref.current)) {
|
|
8
8
|
let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(" ") || "Invalid value." : "";
|
|
9
9
|
ref.current.setCustomValidity(errorMessage);
|
|
10
|
-
if (!ref.current.hasAttribute("title"))
|
|
11
|
-
|
|
12
|
-
if (!state.realtimeValidation.isInvalid)
|
|
13
|
-
state.updateValidation($e93e671b31057976$var$getNativeValidity(ref.current));
|
|
10
|
+
if (!ref.current.hasAttribute("title")) ref.current.title = "";
|
|
11
|
+
if (!state.realtimeValidation.isInvalid) state.updateValidation($e93e671b31057976$var$getNativeValidity(ref.current));
|
|
14
12
|
}
|
|
15
13
|
});
|
|
16
14
|
let onReset = $8ae05eaa5c114e9c$export$7f54fc3180508a52(() => {
|
|
@@ -18,15 +16,12 @@ function $e93e671b31057976$export$b8473d3665f3a75a(props, state, ref) {
|
|
|
18
16
|
});
|
|
19
17
|
let onInvalid = $8ae05eaa5c114e9c$export$7f54fc3180508a52((e) => {
|
|
20
18
|
var _ref_current;
|
|
21
|
-
if (!state.displayValidation.isInvalid)
|
|
22
|
-
state.commitValidation();
|
|
19
|
+
if (!state.displayValidation.isInvalid) state.commitValidation();
|
|
23
20
|
let form = ref === null || ref === void 0 ? void 0 : (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.form;
|
|
24
21
|
if (!e.defaultPrevented && ref && form && $e93e671b31057976$var$getFirstInvalidInput(form) === ref.current) {
|
|
25
22
|
var _ref_current1;
|
|
26
|
-
if (focus)
|
|
27
|
-
|
|
28
|
-
else
|
|
29
|
-
(_ref_current1 = ref.current) === null || _ref_current1 === void 0 ? void 0 : _ref_current1.focus();
|
|
23
|
+
if (focus) focus();
|
|
24
|
+
else (_ref_current1 = ref.current) === null || _ref_current1 === void 0 ? void 0 : _ref_current1.focus();
|
|
30
25
|
$507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard");
|
|
31
26
|
}
|
|
32
27
|
e.preventDefault();
|
|
@@ -36,8 +31,7 @@ function $e93e671b31057976$export$b8473d3665f3a75a(props, state, ref) {
|
|
|
36
31
|
});
|
|
37
32
|
useEffect(() => {
|
|
38
33
|
let input = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
39
|
-
if (!input)
|
|
40
|
-
return;
|
|
34
|
+
if (!input) return;
|
|
41
35
|
let form = input.form;
|
|
42
36
|
input.addEventListener("invalid", onInvalid);
|
|
43
37
|
input.addEventListener("change", onChange);
|
|
@@ -83,8 +77,7 @@ function $e93e671b31057976$var$getNativeValidity(input) {
|
|
|
83
77
|
function $e93e671b31057976$var$getFirstInvalidInput(form) {
|
|
84
78
|
for (let i = 0; i < form.elements.length; i++) {
|
|
85
79
|
let element = form.elements[i];
|
|
86
|
-
if (!element.validity.valid)
|
|
87
|
-
return element;
|
|
80
|
+
if (!element.validity.valid) return element;
|
|
88
81
|
}
|
|
89
82
|
return null;
|
|
90
83
|
}
|
|
@@ -128,8 +121,7 @@ function $e5be200c675c3b3a$export$fc1a364ae1f3ff10(props) {
|
|
|
128
121
|
}
|
|
129
122
|
function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
|
|
130
123
|
let { isInvalid, validationState, name, value, builtinValidation, validate, validationBehavior = "aria" } = props;
|
|
131
|
-
if (validationState)
|
|
132
|
-
isInvalid || (isInvalid = validationState === "invalid");
|
|
124
|
+
if (validationState) isInvalid || (isInvalid = validationState === "invalid");
|
|
133
125
|
let controlledError = isInvalid !== void 0 ? {
|
|
134
126
|
isInvalid,
|
|
135
127
|
validationErrors: [],
|
|
@@ -139,12 +131,10 @@ function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
|
|
|
139
131
|
validate,
|
|
140
132
|
value
|
|
141
133
|
]);
|
|
142
|
-
if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid)
|
|
143
|
-
builtinValidation = null;
|
|
134
|
+
if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid) builtinValidation = null;
|
|
144
135
|
let serverErrors = useContext($e5be200c675c3b3a$export$571b5131b7e65c11);
|
|
145
136
|
let serverErrorMessages = useMemo(() => {
|
|
146
|
-
if (name)
|
|
147
|
-
return Array.isArray(name) ? name.flatMap((name2) => $e5be200c675c3b3a$var$asArray(serverErrors[name2])) : $e5be200c675c3b3a$var$asArray(serverErrors[name]);
|
|
137
|
+
if (name) return Array.isArray(name) ? name.flatMap((name2) => $e5be200c675c3b3a$var$asArray(serverErrors[name2])) : $e5be200c675c3b3a$var$asArray(serverErrors[name]);
|
|
148
138
|
return [];
|
|
149
139
|
}, [
|
|
150
140
|
serverErrors,
|
|
@@ -164,8 +154,7 @@ function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
|
|
|
164
154
|
let [currentValidity, setCurrentValidity] = useState($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
165
155
|
let lastError = useRef($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
166
156
|
let commitValidation = () => {
|
|
167
|
-
if (!commitQueued)
|
|
168
|
-
return;
|
|
157
|
+
if (!commitQueued) return;
|
|
169
158
|
setCommitQueued(false);
|
|
170
159
|
let error = clientError || builtinValidation || nextValidation.current;
|
|
171
160
|
if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
|
|
@@ -181,10 +170,8 @@ function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
|
|
|
181
170
|
realtimeValidation,
|
|
182
171
|
displayValidation,
|
|
183
172
|
updateValidation(value2) {
|
|
184
|
-
if (validationBehavior === "aria" && !$e5be200c675c3b3a$var$isEqualValidation(currentValidity, value2))
|
|
185
|
-
|
|
186
|
-
else
|
|
187
|
-
nextValidation.current = value2;
|
|
173
|
+
if (validationBehavior === "aria" && !$e5be200c675c3b3a$var$isEqualValidation(currentValidity, value2)) setCurrentValidity(value2);
|
|
174
|
+
else nextValidation.current = value2;
|
|
188
175
|
},
|
|
189
176
|
resetValidation() {
|
|
190
177
|
let error = $e5be200c675c3b3a$export$dad6ae84456c676a;
|
|
@@ -192,20 +179,17 @@ function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
|
|
|
192
179
|
lastError.current = error;
|
|
193
180
|
setCurrentValidity(error);
|
|
194
181
|
}
|
|
195
|
-
if (validationBehavior === "native")
|
|
196
|
-
setCommitQueued(false);
|
|
182
|
+
if (validationBehavior === "native") setCommitQueued(false);
|
|
197
183
|
setServerErrorCleared(true);
|
|
198
184
|
},
|
|
199
185
|
commitValidation() {
|
|
200
|
-
if (validationBehavior === "native")
|
|
201
|
-
setCommitQueued(true);
|
|
186
|
+
if (validationBehavior === "native") setCommitQueued(true);
|
|
202
187
|
setServerErrorCleared(true);
|
|
203
188
|
}
|
|
204
189
|
};
|
|
205
190
|
}
|
|
206
191
|
function $e5be200c675c3b3a$var$asArray(v) {
|
|
207
|
-
if (!v)
|
|
208
|
-
return [];
|
|
192
|
+
if (!v) return [];
|
|
209
193
|
return Array.isArray(v) ? v : [
|
|
210
194
|
v
|
|
211
195
|
];
|
|
@@ -213,8 +197,7 @@ function $e5be200c675c3b3a$var$asArray(v) {
|
|
|
213
197
|
function $e5be200c675c3b3a$var$runValidate(validate, value) {
|
|
214
198
|
if (typeof validate === "function") {
|
|
215
199
|
let e = validate(value);
|
|
216
|
-
if (e && typeof e !== "boolean")
|
|
217
|
-
return $e5be200c675c3b3a$var$asArray(e);
|
|
200
|
+
if (e && typeof e !== "boolean") return $e5be200c675c3b3a$var$asArray(e);
|
|
218
201
|
}
|
|
219
202
|
return [];
|
|
220
203
|
}
|
|
@@ -226,8 +209,7 @@ function $e5be200c675c3b3a$var$getValidationResult(errors) {
|
|
|
226
209
|
} : null;
|
|
227
210
|
}
|
|
228
211
|
function $e5be200c675c3b3a$var$isEqualValidation(a, b) {
|
|
229
|
-
if (a === b)
|
|
230
|
-
return true;
|
|
212
|
+
if (a === b) return true;
|
|
231
213
|
return a && b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a2, i) => a2 === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v]) => b.validationDetails[k] === v);
|
|
232
214
|
}
|
|
233
215
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as $9bf71ea28793e738$export$2d6ec8fc375ceafa } from "./FocusScope-
|
|
1
|
+
import { a as $9bf71ea28793e738$export$2d6ec8fc375ceafa } from "./FocusScope-Bw-IatMO.js";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import { g as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c } from "./utils-
|
|
3
|
+
import { g as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c } from "./utils-Dc35LwuT.js";
|
|
4
4
|
function $83013635b024ae3d$export$eac1895992b9f3d6(ref, options) {
|
|
5
5
|
let isDisabled = options === null || options === void 0 ? void 0 : options.isDisabled;
|
|
6
6
|
let [hasTabbableChild, setHasTabbableChild] = useState(false);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as $bdb11010cef70236$export$f680877a34711e37 } from "./utils-
|
|
2
|
-
import { $ as $313b98861ee5dd6c$export$d6875122194c7b44 } from "./useLabels-
|
|
1
|
+
import { e as $bdb11010cef70236$export$f680877a34711e37 } from "./utils-Dc35LwuT.js";
|
|
2
|
+
import { $ as $313b98861ee5dd6c$export$d6875122194c7b44 } from "./useLabels-CfOtyOe2.js";
|
|
3
3
|
function $d191a55c9702f145$export$8467354a121f1b9f(props) {
|
|
4
4
|
let { id, label, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, labelElementType = "label" } = props;
|
|
5
5
|
id = $bdb11010cef70236$export$f680877a34711e37(id);
|
|
@@ -11,8 +11,7 @@ function $d191a55c9702f145$export$8467354a121f1b9f(props) {
|
|
|
11
11
|
id: labelId,
|
|
12
12
|
htmlFor: labelElementType === "label" ? id : void 0
|
|
13
13
|
};
|
|
14
|
-
} else if (!ariaLabelledby && !ariaLabel)
|
|
15
|
-
console.warn("If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility");
|
|
14
|
+
} else if (!ariaLabelledby && !ariaLabel) console.warn("If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility");
|
|
16
15
|
let fieldProps = $313b98861ee5dd6c$export$d6875122194c7b44({
|
|
17
16
|
id,
|
|
18
17
|
"aria-label": ariaLabel,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as $bdb11010cef70236$export$f680877a34711e37 } from "./utils-
|
|
1
|
+
import { e as $bdb11010cef70236$export$f680877a34711e37 } from "./utils-Dc35LwuT.js";
|
|
2
2
|
function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
|
|
3
3
|
let { id, "aria-label": label, "aria-labelledby": labelledBy } = props;
|
|
4
4
|
id = $bdb11010cef70236$export$f680877a34711e37(id);
|
|
@@ -10,10 +10,8 @@ function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
|
|
|
10
10
|
labelledBy = [
|
|
11
11
|
...ids
|
|
12
12
|
].join(" ");
|
|
13
|
-
} else if (labelledBy)
|
|
14
|
-
|
|
15
|
-
if (!label && !labelledBy && defaultLabel)
|
|
16
|
-
label = defaultLabel;
|
|
13
|
+
} else if (labelledBy) labelledBy = labelledBy.trim().split(/\s+/).join(" ");
|
|
14
|
+
if (!label && !labelledBy && defaultLabel) label = defaultLabel;
|
|
17
15
|
return {
|
|
18
16
|
id,
|
|
19
17
|
"aria-label": label,
|
|
@@ -44,10 +44,8 @@ function $0d86e9c8f07f9a7b$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
44
44
|
dispatch((state) => {
|
|
45
45
|
let index = state.items.findIndex((item) => getKey(item) === key);
|
|
46
46
|
if (index === -1) {
|
|
47
|
-
if (state.items.length === 0)
|
|
48
|
-
|
|
49
|
-
else
|
|
50
|
-
return state;
|
|
47
|
+
if (state.items.length === 0) index = 0;
|
|
48
|
+
else return state;
|
|
51
49
|
}
|
|
52
50
|
return $0d86e9c8f07f9a7b$var$insert(state, index, ...values);
|
|
53
51
|
});
|
|
@@ -56,10 +54,8 @@ function $0d86e9c8f07f9a7b$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
56
54
|
dispatch((state) => {
|
|
57
55
|
let index = state.items.findIndex((item) => getKey(item) === key);
|
|
58
56
|
if (index === -1) {
|
|
59
|
-
if (state.items.length === 0)
|
|
60
|
-
|
|
61
|
-
else
|
|
62
|
-
return state;
|
|
57
|
+
if (state.items.length === 0) index = 0;
|
|
58
|
+
else return state;
|
|
63
59
|
}
|
|
64
60
|
return $0d86e9c8f07f9a7b$var$insert(state, index + 1, ...values);
|
|
65
61
|
});
|
|
@@ -77,11 +73,9 @@ function $0d86e9c8f07f9a7b$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
77
73
|
let selection = "all";
|
|
78
74
|
if (state.selectedKeys !== "all") {
|
|
79
75
|
selection = new Set(state.selectedKeys);
|
|
80
|
-
for (let key of keys)
|
|
81
|
-
selection.delete(key);
|
|
76
|
+
for (let key of keys) selection.delete(key);
|
|
82
77
|
}
|
|
83
|
-
if (cursor == null && items.length === 0)
|
|
84
|
-
selection = /* @__PURE__ */ new Set();
|
|
78
|
+
if (cursor == null && items.length === 0) selection = /* @__PURE__ */ new Set();
|
|
85
79
|
return {
|
|
86
80
|
...state,
|
|
87
81
|
items,
|
|
@@ -91,12 +85,11 @@ function $0d86e9c8f07f9a7b$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
91
85
|
},
|
|
92
86
|
removeSelectedItems() {
|
|
93
87
|
dispatch((state) => {
|
|
94
|
-
if (state.selectedKeys === "all")
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
};
|
|
88
|
+
if (state.selectedKeys === "all") return {
|
|
89
|
+
...state,
|
|
90
|
+
items: [],
|
|
91
|
+
selectedKeys: /* @__PURE__ */ new Set()
|
|
92
|
+
};
|
|
100
93
|
let selectedKeys = state.selectedKeys;
|
|
101
94
|
let items = state.items.filter((item) => !selectedKeys.has(getKey(item)));
|
|
102
95
|
return {
|
|
@@ -109,8 +102,7 @@ function $0d86e9c8f07f9a7b$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
109
102
|
move(key, toIndex) {
|
|
110
103
|
dispatch((state) => {
|
|
111
104
|
let index = state.items.findIndex((item2) => getKey(item2) === key);
|
|
112
|
-
if (index === -1)
|
|
113
|
-
return state;
|
|
105
|
+
if (index === -1) return state;
|
|
114
106
|
let copy = state.items.slice();
|
|
115
107
|
let [item] = copy.splice(index, 1);
|
|
116
108
|
copy.splice(toIndex, 0, item);
|
|
@@ -123,8 +115,7 @@ function $0d86e9c8f07f9a7b$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
123
115
|
moveBefore(key, keys) {
|
|
124
116
|
dispatch((state) => {
|
|
125
117
|
let toIndex = state.items.findIndex((item) => getKey(item) === key);
|
|
126
|
-
if (toIndex === -1)
|
|
127
|
-
return state;
|
|
118
|
+
if (toIndex === -1) return state;
|
|
128
119
|
let keyArray = Array.isArray(keys) ? keys : [
|
|
129
120
|
...keys
|
|
130
121
|
];
|
|
@@ -135,8 +126,7 @@ function $0d86e9c8f07f9a7b$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
135
126
|
moveAfter(key, keys) {
|
|
136
127
|
dispatch((state) => {
|
|
137
128
|
let toIndex = state.items.findIndex((item) => getKey(item) === key);
|
|
138
|
-
if (toIndex === -1)
|
|
139
|
-
return state;
|
|
129
|
+
if (toIndex === -1) return state;
|
|
140
130
|
let keyArray = Array.isArray(keys) ? keys : [
|
|
141
131
|
...keys
|
|
142
132
|
];
|
|
@@ -147,8 +137,7 @@ function $0d86e9c8f07f9a7b$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
147
137
|
update(key, newValue) {
|
|
148
138
|
dispatch((state) => {
|
|
149
139
|
let index = state.items.findIndex((item) => getKey(item) === key);
|
|
150
|
-
if (index === -1)
|
|
151
|
-
return state;
|
|
140
|
+
if (index === -1) return state;
|
|
152
141
|
return {
|
|
153
142
|
...state,
|
|
154
143
|
items: [
|
|
@@ -181,18 +170,15 @@ function $0d86e9c8f07f9a7b$var$move(state, indices, toIndex) {
|
|
|
181
170
|
let a = moves[i].from;
|
|
182
171
|
for (let j = i; j < moves.length; j++) {
|
|
183
172
|
let b = moves[j].from;
|
|
184
|
-
if (b > a)
|
|
185
|
-
moves[j].from--;
|
|
173
|
+
if (b > a) moves[j].from--;
|
|
186
174
|
}
|
|
187
175
|
}
|
|
188
176
|
for (let i = 0; i < moves.length; i++) {
|
|
189
177
|
let a = moves[i];
|
|
190
178
|
for (let j = moves.length - 1; j > i; j--) {
|
|
191
179
|
let b = moves[j];
|
|
192
|
-
if (b.from < a.to)
|
|
193
|
-
|
|
194
|
-
else
|
|
195
|
-
b.from++;
|
|
180
|
+
if (b.from < a.to) a.to++;
|
|
181
|
+
else b.from++;
|
|
196
182
|
}
|
|
197
183
|
}
|
|
198
184
|
let copy = state.items.slice();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as $7af3f5b51489e0b5$export$253fe78d46329472, a as $7613b1592d41b092$export$6cd28814d92fa9c9, b as $d496c0a20b6e58ec$export$6c8a5aaad13c9852 } from "./SelectionManager-
|
|
1
|
+
import { $ as $7af3f5b51489e0b5$export$253fe78d46329472, a as $7613b1592d41b092$export$6cd28814d92fa9c9, b as $d496c0a20b6e58ec$export$6c8a5aaad13c9852 } from "./SelectionManager-XOAt-Ekx.js";
|
|
2
2
|
import { useMemo, useCallback, useRef, useEffect } from "react";
|
|
3
3
|
class $a02d57049d202695$export$d085fb9e920b5ca7 {
|
|
4
4
|
*[Symbol.iterator]() {
|
|
@@ -42,12 +42,9 @@ class $a02d57049d202695$export$d085fb9e920b5ca7 {
|
|
|
42
42
|
this.iterable = nodes;
|
|
43
43
|
let visit = (node) => {
|
|
44
44
|
this.keyMap.set(node.key, node);
|
|
45
|
-
if (node.childNodes && node.type === "section")
|
|
46
|
-
for (let child of node.childNodes)
|
|
47
|
-
visit(child);
|
|
45
|
+
if (node.childNodes && node.type === "section") for (let child of node.childNodes) visit(child);
|
|
48
46
|
};
|
|
49
|
-
for (let node of nodes)
|
|
50
|
-
visit(node);
|
|
47
|
+
for (let node of nodes) visit(node);
|
|
51
48
|
let last;
|
|
52
49
|
let index = 0;
|
|
53
50
|
for (let [key, node] of this.keyMap) {
|
|
@@ -58,8 +55,7 @@ class $a02d57049d202695$export$d085fb9e920b5ca7 {
|
|
|
58
55
|
this.firstKey = key;
|
|
59
56
|
node.prevKey = void 0;
|
|
60
57
|
}
|
|
61
|
-
if (node.type === "item")
|
|
62
|
-
node.index = index++;
|
|
58
|
+
if (node.type === "item") node.index = index++;
|
|
63
59
|
last = node;
|
|
64
60
|
last.nextKey = void 0;
|
|
65
61
|
}
|
|
@@ -109,11 +105,9 @@ function $e72dd72e1c76a225$export$2f645645f7bca764(props) {
|
|
|
109
105
|
newNode = itemNodes[index];
|
|
110
106
|
break;
|
|
111
107
|
}
|
|
112
|
-
if (index < itemNodes.length - 1)
|
|
113
|
-
index++;
|
|
108
|
+
if (index < itemNodes.length - 1) index++;
|
|
114
109
|
else {
|
|
115
|
-
if (index > startItem.index)
|
|
116
|
-
index = startItem.index;
|
|
110
|
+
if (index > startItem.index) index = startItem.index;
|
|
117
111
|
index--;
|
|
118
112
|
}
|
|
119
113
|
}
|
package/dist/{useLocalizedStringFormatter-WsEL47qR.js → useLocalizedStringFormatter-BQCMno9k.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-
|
|
1
|
+
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-4oSz1ItD.js";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
const $5b160d28a433310d$var$localeSymbol = Symbol.for("react-aria.i18n.locale");
|
|
4
4
|
const $5b160d28a433310d$var$stringsSymbol = Symbol.for("react-aria.i18n.strings");
|
|
@@ -8,8 +8,7 @@ class $5b160d28a433310d$export$c17fa47878dc55b6 {
|
|
|
8
8
|
getStringForLocale(key, locale) {
|
|
9
9
|
let strings = this.getStringsForLocale(locale);
|
|
10
10
|
let string = strings[key];
|
|
11
|
-
if (!string)
|
|
12
|
-
throw new Error(`Could not find intl message ${key} in ${locale} locale`);
|
|
11
|
+
if (!string) throw new Error(`Could not find intl message ${key} in ${locale} locale`);
|
|
13
12
|
return string;
|
|
14
13
|
}
|
|
15
14
|
/** Returns all localized strings for the given locale. */
|
|
@@ -22,22 +21,18 @@ class $5b160d28a433310d$export$c17fa47878dc55b6 {
|
|
|
22
21
|
return strings;
|
|
23
22
|
}
|
|
24
23
|
static getGlobalDictionaryForPackage(packageName) {
|
|
25
|
-
if (typeof window === "undefined")
|
|
26
|
-
return null;
|
|
24
|
+
if (typeof window === "undefined") return null;
|
|
27
25
|
let locale = window[$5b160d28a433310d$var$localeSymbol];
|
|
28
26
|
if ($5b160d28a433310d$var$cachedGlobalStrings === void 0) {
|
|
29
27
|
let globalStrings = window[$5b160d28a433310d$var$stringsSymbol];
|
|
30
|
-
if (!globalStrings)
|
|
31
|
-
return null;
|
|
28
|
+
if (!globalStrings) return null;
|
|
32
29
|
$5b160d28a433310d$var$cachedGlobalStrings = {};
|
|
33
|
-
for (let pkg in globalStrings)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, locale);
|
|
30
|
+
for (let pkg in globalStrings) $5b160d28a433310d$var$cachedGlobalStrings[pkg] = new $5b160d28a433310d$export$c17fa47878dc55b6({
|
|
31
|
+
[locale]: globalStrings[pkg]
|
|
32
|
+
}, locale);
|
|
37
33
|
}
|
|
38
34
|
let dictionary = $5b160d28a433310d$var$cachedGlobalStrings === null || $5b160d28a433310d$var$cachedGlobalStrings === void 0 ? void 0 : $5b160d28a433310d$var$cachedGlobalStrings[packageName];
|
|
39
|
-
if (!dictionary)
|
|
40
|
-
throw new Error(`Strings for package "${packageName}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);
|
|
35
|
+
if (!dictionary) throw new Error(`Strings for package "${packageName}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);
|
|
41
36
|
return dictionary;
|
|
42
37
|
}
|
|
43
38
|
constructor(messages, defaultLocale = "en-US") {
|
|
@@ -46,14 +41,11 @@ class $5b160d28a433310d$export$c17fa47878dc55b6 {
|
|
|
46
41
|
}
|
|
47
42
|
}
|
|
48
43
|
function $5b160d28a433310d$var$getStringsForLocale(locale, strings, defaultLocale = "en-US") {
|
|
49
|
-
if (strings[locale])
|
|
50
|
-
return strings[locale];
|
|
44
|
+
if (strings[locale]) return strings[locale];
|
|
51
45
|
let language = $5b160d28a433310d$var$getLanguage(locale);
|
|
52
|
-
if (strings[language])
|
|
53
|
-
return strings[language];
|
|
46
|
+
if (strings[language]) return strings[language];
|
|
54
47
|
for (let key in strings) {
|
|
55
|
-
if (key.startsWith(language + "-"))
|
|
56
|
-
return strings[key];
|
|
48
|
+
if (key.startsWith(language + "-")) return strings[key];
|
|
57
49
|
}
|
|
58
50
|
return strings[defaultLocale];
|
|
59
51
|
}
|
|
@@ -72,8 +64,7 @@ class $6db58dc88e78b024$export$2f817fcdc4b89ae0 {
|
|
|
72
64
|
}
|
|
73
65
|
plural(count, options, type = "cardinal") {
|
|
74
66
|
let opt = options["=" + count];
|
|
75
|
-
if (opt)
|
|
76
|
-
return typeof opt === "function" ? opt() : opt;
|
|
67
|
+
if (opt) return typeof opt === "function" ? opt() : opt;
|
|
77
68
|
let key = this.locale + ":" + type;
|
|
78
69
|
let pluralRules = $6db58dc88e78b024$var$pluralRulesCache.get(key);
|
|
79
70
|
if (!pluralRules) {
|