@eightshift/ui-components 7.2.1 → 7.3.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-pLMPWMFq.js +451 -0
- package/dist/Button-Biwg7zwt.js +223 -0
- package/dist/Dialog-C1sh8jbh.js +2474 -0
- package/dist/{Disclosure-NYWFw9RJ.js → Disclosure-B_SHgiUz.js} +50 -51
- package/dist/FocusScope-lGkM8AO8.js +734 -0
- package/dist/Form-BxIJCHYd.js +5 -0
- package/dist/Heading-B2EsUuu6.js +16 -0
- package/dist/{Hidden-8TB37dpK.js → Hidden-DYY00jLm.js} +10 -10
- package/dist/I18nProvider-Cm6dj5jY.js +93 -0
- package/dist/Label-B1TkoVOG.js +17 -0
- package/dist/ListBox-BquE0m8z.js +584 -0
- package/dist/{NumberFormatter-m5VW6MTK.js → NumberFormatter-JHF0Tadk.js} +24 -26
- package/dist/PortalProvider-BYcv24il.js +13 -0
- package/dist/RadioGroup-BxjLooWU.js +324 -0
- package/dist/SearchField-BkAU0HLm.js +322 -0
- package/dist/SelectionIndicator-Bx_EYBXD.js +13 -0
- package/dist/{Slider-DW1RuMVp.js → Slider-DSv6fyZ6.js} +321 -363
- package/dist/Text-C8pfwn0W.js +16 -0
- package/dist/{VisuallyHidden-CfsnJHZb.js → VisuallyHidden-KcXlGa5p.js} +12 -12
- package/dist/{animation-Bd2peown.js → animation-BJ-2VKdB.js} +12 -12
- 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-D9cbyHeZ.js → button-CawAzlko.js} +21 -73
- package/dist/{checkbox-BO5RZmO8.js → checkbox-t7VrqXv2.js} +59 -62
- package/dist/{color-swatch-D2ZBkuTt.js → color-swatch-gU09x9Ga.js} +417 -414
- package/dist/components/base-control/base-control.js +2 -2
- package/dist/components/base-control/container.js +1 -1
- 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 +2 -2
- 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 +4 -4
- package/dist/components/container-panel/container-panel.js +5 -5
- package/dist/components/draggable/draggable-handle.js +1 -1
- package/dist/components/draggable/draggable.js +1 -1
- package/dist/components/draggable-list/draggable-list-item.js +1 -1
- package/dist/components/draggable-list/draggable-list.js +2 -2
- package/dist/components/expandable/expandable.js +7 -7
- package/dist/components/index.js +15 -15
- package/dist/components/input-field/input-field.js +1 -1
- package/dist/components/item-collection/item-collection.js +1 -1
- package/dist/components/link-input/link-input.js +1 -1
- package/dist/components/matrix-align/matrix-align.js +5 -5
- package/dist/components/menu/menu.js +11 -11
- package/dist/components/modal/modal.js +1 -1
- package/dist/components/number-picker/number-picker.js +1 -1
- package/dist/components/option-select/option-select.js +3 -3
- package/dist/components/options-panel/options-panel.js +3 -3
- package/dist/components/placeholders/file-picker-shell.js +1 -1
- package/dist/components/placeholders/file-placeholder.js +1 -1
- package/dist/components/popover/popover.js +6 -6
- package/dist/components/portal-provider/portal-provider.js +2 -2
- package/dist/components/radio/radio.js +9 -9
- package/dist/components/repeater/repeater-item.js +2 -2
- package/dist/components/repeater/repeater.js +3 -3
- package/dist/components/responsive/mini-responsive.js +6 -6
- package/dist/components/responsive/responsive-legacy.js +5 -5
- package/dist/components/responsive/responsive.js +5 -5
- package/dist/components/responsive-preview/responsive-preview.js +2 -2
- package/dist/components/select/async-multi-select.js +27 -26
- package/dist/components/select/async-select.js +27 -26
- package/dist/components/select/multi-select.js +33 -32
- package/dist/components/select/shared.js +1 -1
- package/dist/components/select/single-select.js +33 -32
- package/dist/components/select/styles.js +1 -1
- package/dist/components/slider/column-config-slider.js +8 -8
- package/dist/components/slider/slider.js +8 -8
- package/dist/components/slider/utils.js +1 -1
- package/dist/components/smart-image/smart-image.js +1 -1
- package/dist/components/tabs/tabs.js +1 -1
- package/dist/components/toggle/switch.js +1 -1
- package/dist/components/toggle/toggle.js +3 -3
- package/dist/components/toggle-button/toggle-button.js +1 -1
- package/dist/components/tooltip/tooltip.js +1 -1
- package/dist/{draggable-CTDVJ4zd.js → draggable-Cxv-OueQ.js} +1 -1
- package/dist/filterDOMProps-BfW758QC.js +69 -0
- package/dist/{gradient-editor-CD5Sho6A.js → gradient-editor-CInqVF8v.js} +6 -6
- package/dist/icons/index.js +1 -1
- package/dist/icons/jsx-svg.js +1 -1
- package/dist/index.js +15 -15
- package/dist/{input-field-_OCWbftf.js → input-field-BdFrxQ-R.js} +46 -47
- package/dist/keyboard-CT41mQzR.js +55 -0
- package/dist/{link-input-BnjtzMbF.js → link-input-BDFhSSvH.js} +324 -356
- package/dist/{modal-snrElwty.js → modal-CJDaBdPh.js} +100 -92
- package/dist/{number-ZZIxJukn.js → number-MWRvGfyE.js} +10 -10
- package/dist/{number-picker-Dhtx4409.js → number-picker-BrxrB-xq.js} +43 -42
- package/dist/{shared-BpAYSi3F.js → shared-CI4kcnm8.js} +482 -502
- package/dist/{smart-image-CBNbxJ57.js → smart-image-eGdMu9s9.js} +2 -2
- package/dist/{solid-color-picker-DukArNH-.js → solid-color-picker-DXgX-OAm.js} +926 -935
- package/dist/{switch-DmsvyQPa.js → switch-DNHFoCCx.js} +28 -28
- package/dist/{tabs-Cy6gB0RL.js → tabs-C2tPOEYr.js} +145 -149
- package/dist/textSelection-BhX_2zV9.js +45 -0
- package/dist/{toggle-button-BlzUGfGy.js → toggle-button-DYDp11rq.js} +35 -35
- package/dist/{tooltip-BzJzYlcc.js → tooltip-C-hT6tN9.js} +162 -162
- package/dist/{useAsyncList-BNzwKoX4.js → useAsyncList-DsOh1xIx.js} +54 -74
- package/dist/{useButton-ra1ZSZ4z.js → useButton-BMZc4fTX.js} +11 -11
- package/dist/{SelectionManager-B8lLv6Ue.js → useCollection-CBVYSuGz.js} +1689 -1777
- package/dist/{useEvent-DkZVfgsS.js → useEvent-ypAU33vv.js} +5 -5
- package/dist/useField-BXf__jxy.js +32 -0
- package/dist/{useFilter-OiMnf6sb.js → useFilter-CfKEbIwL.js} +5 -5
- package/dist/{useFocusRing-DuYL4cdO.js → useFocusRing-BgYY-7ko.js} +23 -23
- package/dist/useFormReset-BuMc_O4y.js +17 -0
- package/dist/{FieldError-BWDbP5Db.js → useFormValidation-BcME9D0E.js} +63 -66
- package/dist/useHover-lyApu3ba.js +975 -0
- package/dist/{useLabel-2EohW5l6.js → useLabel-Rv8cIIKk.js} +8 -8
- package/dist/{useLabels-B2p7RXi5.js → useLabels-xOYtkA8o.js} +5 -5
- package/dist/useListState-u6DfeXHi.js +135 -0
- package/dist/{useLocalizedStringFormatter-Dv2diN3k.js → useLocalizedStringFormatter-CR-bmorj.js} +45 -45
- package/dist/{useNumberField-2xbi3jRV.js → useNumberFieldState-xL-ecwNz.js} +665 -619
- package/dist/useNumberFormatter-CR1PAFPG.js +10 -0
- package/dist/useOverlayTriggerState-AeCx45Gv.js +551 -0
- package/dist/usePress-Dnx5rBoD.js +593 -0
- package/dist/useTextField-BW3ZwGyz.js +159 -0
- package/dist/{useToggle-ecIirvIM.js → useToggle-BF5wptMP.js} +19 -20
- package/dist/useToggleState-D5P01lch.js +22 -0
- package/dist/useToolbar-BT25-MJg.js +55 -0
- package/dist/utilities/debounce-throttle.js +1 -1
- package/dist/utilities/es-dash.js +1 -1
- package/dist/utilities/index.js +3 -3
- package/dist/{utils-B_uiqNa4.js → utils-JFcCNFzy.js} +121 -122
- package/package.json +13 -13
- package/dist/Button-h6xF_WrP.js +0 -225
- package/dist/Dialog-i5VLQw1o.js +0 -2488
- package/dist/FocusScope-CgwbGOBB.js +0 -746
- package/dist/Form-DTMkbrQY.js +0 -5
- package/dist/Heading-Hol-wS_B.js +0 -16
- package/dist/Input-BURqyJXW.js +0 -161
- package/dist/Label-DFXXxMKY.js +0 -17
- package/dist/ListBox-BHUJxpwh.js +0 -600
- package/dist/OverlayArrow-BoloUPQM.js +0 -573
- package/dist/PortalProvider-DinZZCKX.js +0 -14
- package/dist/RSPContexts-C_z0bI8W.js +0 -12
- package/dist/RadioGroup-BwlGtCja.js +0 -329
- package/dist/SearchField-Cm1i5mLj.js +0 -764
- package/dist/SelectionIndicator-31L6EI9F.js +0 -13
- package/dist/Text-O6VBBDlP.js +0 -16
- package/dist/context-C-XNeJ_l.js +0 -93
- package/dist/filterDOMProps-_2_3GD-K.js +0 -69
- package/dist/textSelection-Dv6WPj0Z.js +0 -45
- package/dist/useField-D0WrzR2F.js +0 -32
- package/dist/useFormReset-DdkykzAn.js +0 -18
- package/dist/useHover-qaMm3XFO.js +0 -982
- package/dist/useListState-CD_5vfyy.js +0 -147
- package/dist/useNumberFormatter-C2Cm2mNj.js +0 -10
- package/dist/usePress-ZP1TjkFf.js +0 -678
- package/dist/useToggleState-IIDbiKPl.js +0 -23
- /package/dist/{List-DWlgW2Ex.js → List---tsVJlI.js} +0 -0
- /package/dist/{build-module-Bsx62nlm.js → build-module-K6vi4xE0.js} +0 -0
- /package/dist/{debounce-throttle-DXxSAKpq.js → debounce-throttle-LSPAPFtq.js} +0 -0
- /package/dist/{dist-2gkv7_1U.js → dist-jw8wvxoG.js} +0 -0
- /package/dist/{es-dash-HqXWZZ3_.js → es-dash-BuShf_ht.js} +0 -0
- /package/dist/{jsx-svg-DgKbriN1.js → jsx-svg-DT1SBWuP.js} +0 -0
- /package/dist/{utilities-lwX686oD.js → utilities-DV0KKJNR.js} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as $
|
|
3
|
-
//#region node_modules
|
|
4
|
-
function $
|
|
1
|
+
import { p as $390e54f620492c70$export$f680877a34711e37 } from "./utils-JFcCNFzy.js";
|
|
2
|
+
import { t as $e8ac3c3f5d4bae7f$export$d6875122194c7b44 } from "./useLabels-xOYtkA8o.js";
|
|
3
|
+
//#region node_modules/react-aria/dist/private/label/useLabel.mjs
|
|
4
|
+
function $0beb20c9744a2065$export$8467354a121f1b9f(props) {
|
|
5
5
|
let { id, label, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, labelElementType = "label" } = props;
|
|
6
|
-
id = $
|
|
7
|
-
let labelId = $
|
|
6
|
+
id = $390e54f620492c70$export$f680877a34711e37(id);
|
|
7
|
+
let labelId = $390e54f620492c70$export$f680877a34711e37();
|
|
8
8
|
let labelProps = {};
|
|
9
9
|
if (label) {
|
|
10
10
|
ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;
|
|
@@ -13,7 +13,7 @@ function $d191a55c9702f145$export$8467354a121f1b9f(props) {
|
|
|
13
13
|
htmlFor: labelElementType === "label" ? id : void 0
|
|
14
14
|
};
|
|
15
15
|
} else if (!ariaLabelledby && !ariaLabel && process.env.NODE_ENV !== "production") console.warn("If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility");
|
|
16
|
-
let fieldProps = $
|
|
16
|
+
let fieldProps = $e8ac3c3f5d4bae7f$export$d6875122194c7b44({
|
|
17
17
|
id,
|
|
18
18
|
"aria-label": ariaLabel,
|
|
19
19
|
"aria-labelledby": ariaLabelledby
|
|
@@ -24,4 +24,4 @@ function $d191a55c9702f145$export$8467354a121f1b9f(props) {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
|
-
export { $
|
|
27
|
+
export { $0beb20c9744a2065$export$8467354a121f1b9f as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region node_modules
|
|
3
|
-
function $
|
|
1
|
+
import { p as $390e54f620492c70$export$f680877a34711e37 } from "./utils-JFcCNFzy.js";
|
|
2
|
+
//#region node_modules/react-aria/dist/private/utils/useLabels.mjs
|
|
3
|
+
function $e8ac3c3f5d4bae7f$export$d6875122194c7b44(props, defaultLabel) {
|
|
4
4
|
let { id, "aria-label": label, "aria-labelledby": labelledBy } = props;
|
|
5
|
-
id = $
|
|
5
|
+
id = $390e54f620492c70$export$f680877a34711e37(id);
|
|
6
6
|
if (labelledBy && label) labelledBy = [...new Set([id, ...labelledBy.trim().split(/\s+/)])].join(" ");
|
|
7
7
|
else if (labelledBy) labelledBy = labelledBy.trim().split(/\s+/).join(" ");
|
|
8
8
|
if (!label && !labelledBy && defaultLabel) label = defaultLabel;
|
|
@@ -13,4 +13,4 @@ function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
|
-
export { $
|
|
16
|
+
export { $e8ac3c3f5d4bae7f$export$d6875122194c7b44 as t };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { n as $4a07ac835f260f78$export$6c8a5aaad13c9852, r as $60f19cefd567a3e4$export$253fe78d46329472, t as $d03379b88399b8c5$export$6cd28814d92fa9c9 } from "./useCollection-CBVYSuGz.js";
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, version } from "react";
|
|
3
|
+
//#region node_modules/react-aria/dist/private/utils/inertValue.mjs
|
|
4
|
+
function $b24d1bc31a0f941d$export$a9d04c5684123369(value) {
|
|
5
|
+
const pieces = version.split(".");
|
|
6
|
+
if (parseInt(pieces[0], 10) >= 19) return value;
|
|
7
|
+
return value ? "true" : void 0;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region node_modules/react-stately/dist/private/list/ListCollection.mjs
|
|
11
|
+
var $f664a81d022446b5$export$d085fb9e920b5ca7 = class {
|
|
12
|
+
constructor(nodes) {
|
|
13
|
+
this.keyMap = new Map();
|
|
14
|
+
this.firstKey = null;
|
|
15
|
+
this.lastKey = null;
|
|
16
|
+
this.iterable = nodes;
|
|
17
|
+
let visit = (node) => {
|
|
18
|
+
this.keyMap.set(node.key, node);
|
|
19
|
+
if (node.childNodes && node.type === "section") for (let child of node.childNodes) visit(child);
|
|
20
|
+
};
|
|
21
|
+
for (let node of nodes) visit(node);
|
|
22
|
+
let last = null;
|
|
23
|
+
let index = 0;
|
|
24
|
+
let size = 0;
|
|
25
|
+
for (let [key, node] of this.keyMap) {
|
|
26
|
+
if (last) {
|
|
27
|
+
last.nextKey = key;
|
|
28
|
+
node.prevKey = last.key;
|
|
29
|
+
} else {
|
|
30
|
+
this.firstKey = key;
|
|
31
|
+
node.prevKey = void 0;
|
|
32
|
+
}
|
|
33
|
+
if (node.type === "item") node.index = index++;
|
|
34
|
+
if (node.type === "section" || node.type === "item") size++;
|
|
35
|
+
last = node;
|
|
36
|
+
last.nextKey = void 0;
|
|
37
|
+
}
|
|
38
|
+
this._size = size;
|
|
39
|
+
this.lastKey = last?.key ?? null;
|
|
40
|
+
}
|
|
41
|
+
*[Symbol.iterator]() {
|
|
42
|
+
yield* this.iterable;
|
|
43
|
+
}
|
|
44
|
+
get size() {
|
|
45
|
+
return this._size;
|
|
46
|
+
}
|
|
47
|
+
getKeys() {
|
|
48
|
+
return this.keyMap.keys();
|
|
49
|
+
}
|
|
50
|
+
getKeyBefore(key) {
|
|
51
|
+
let node = this.keyMap.get(key);
|
|
52
|
+
return node ? node.prevKey ?? null : null;
|
|
53
|
+
}
|
|
54
|
+
getKeyAfter(key) {
|
|
55
|
+
let node = this.keyMap.get(key);
|
|
56
|
+
return node ? node.nextKey ?? null : null;
|
|
57
|
+
}
|
|
58
|
+
getFirstKey() {
|
|
59
|
+
return this.firstKey;
|
|
60
|
+
}
|
|
61
|
+
getLastKey() {
|
|
62
|
+
return this.lastKey;
|
|
63
|
+
}
|
|
64
|
+
getItem(key) {
|
|
65
|
+
return this.keyMap.get(key) ?? null;
|
|
66
|
+
}
|
|
67
|
+
at(idx) {
|
|
68
|
+
const keys = [...this.getKeys()];
|
|
69
|
+
return this.getItem(keys[idx]);
|
|
70
|
+
}
|
|
71
|
+
getChildren(key) {
|
|
72
|
+
return this.keyMap.get(key)?.childNodes || [];
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region node_modules/react-stately/dist/private/list/useListState.mjs
|
|
77
|
+
function $b14b6f590b50af39$export$2f645645f7bca764(props) {
|
|
78
|
+
let { filter, layoutDelegate } = props;
|
|
79
|
+
let selectionState = $60f19cefd567a3e4$export$253fe78d46329472(props);
|
|
80
|
+
let disabledKeys = useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : new Set(), [props.disabledKeys]);
|
|
81
|
+
let collection = $d03379b88399b8c5$export$6cd28814d92fa9c9(props, useCallback((nodes) => filter ? new $f664a81d022446b5$export$d085fb9e920b5ca7(filter(nodes)) : new $f664a81d022446b5$export$d085fb9e920b5ca7(nodes), [filter]), useMemo(() => ({ suppressTextValueWarning: props.suppressTextValueWarning }), [props.suppressTextValueWarning]));
|
|
82
|
+
let selectionManager = useMemo(() => new $4a07ac835f260f78$export$6c8a5aaad13c9852(collection, selectionState, { layoutDelegate }), [
|
|
83
|
+
collection,
|
|
84
|
+
selectionState,
|
|
85
|
+
layoutDelegate
|
|
86
|
+
]);
|
|
87
|
+
$b14b6f590b50af39$var$useFocusedKeyReset(collection, selectionManager);
|
|
88
|
+
return {
|
|
89
|
+
collection,
|
|
90
|
+
disabledKeys,
|
|
91
|
+
selectionManager
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function $b14b6f590b50af39$export$ba9d38c0f1bf2b36(state, filterFn) {
|
|
95
|
+
let collection = useMemo(() => filterFn ? state.collection.filter(filterFn) : state.collection, [state.collection, filterFn]);
|
|
96
|
+
let selectionManager = state.selectionManager.withCollection(collection);
|
|
97
|
+
$b14b6f590b50af39$var$useFocusedKeyReset(collection, selectionManager);
|
|
98
|
+
return {
|
|
99
|
+
collection,
|
|
100
|
+
selectionManager,
|
|
101
|
+
disabledKeys: state.disabledKeys
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function $b14b6f590b50af39$var$useFocusedKeyReset(collection, selectionManager) {
|
|
105
|
+
const cachedCollection = useRef(null);
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (selectionManager.focusedKey != null && !collection.getItem(selectionManager.focusedKey) && cachedCollection.current) {
|
|
108
|
+
let key = cachedCollection.current.getKeyAfter(selectionManager.focusedKey);
|
|
109
|
+
let nextFocusedKey = null;
|
|
110
|
+
while (key != null) {
|
|
111
|
+
let node = collection.getItem(key);
|
|
112
|
+
if (node && node.type === "item" && !selectionManager.isDisabled(key)) {
|
|
113
|
+
nextFocusedKey = key;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
key = cachedCollection.current.getKeyAfter(key);
|
|
117
|
+
}
|
|
118
|
+
if (nextFocusedKey == null) {
|
|
119
|
+
key = cachedCollection.current.getKeyBefore(selectionManager.focusedKey);
|
|
120
|
+
while (key != null) {
|
|
121
|
+
let node = collection.getItem(key);
|
|
122
|
+
if (node && node.type === "item" && !selectionManager.isDisabled(key)) {
|
|
123
|
+
nextFocusedKey = key;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
key = cachedCollection.current.getKeyBefore(key);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
selectionManager.setFocusedKey(nextFocusedKey);
|
|
130
|
+
}
|
|
131
|
+
cachedCollection.current = collection;
|
|
132
|
+
}, [collection, selectionManager]);
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
export { $b24d1bc31a0f941d$export$a9d04c5684123369 as i, $b14b6f590b50af39$export$ba9d38c0f1bf2b36 as n, $f664a81d022446b5$export$d085fb9e920b5ca7 as r, $b14b6f590b50af39$export$2f645645f7bca764 as t };
|
package/dist/{useLocalizedStringFormatter-Dv2diN3k.js → useLocalizedStringFormatter-CR-bmorj.js}
RENAMED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { t as $
|
|
1
|
+
import { t as $2eb8e6d23f3d0cb0$export$43bb16f9c6d9e3f7 } from "./I18nProvider-Cm6dj5jY.js";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
//#region node_modules/@internationalized/string/dist/LocalizedStringDictionary.mjs
|
|
4
|
-
var $
|
|
5
|
-
var $
|
|
6
|
-
var $
|
|
7
|
-
var $
|
|
3
|
+
//#region node_modules/@internationalized/string/dist/private/LocalizedStringDictionary.mjs
|
|
4
|
+
var $a747a10fe70a57da$var$localeSymbol = Symbol.for("react-aria.i18n.locale");
|
|
5
|
+
var $a747a10fe70a57da$var$stringsSymbol = Symbol.for("react-aria.i18n.strings");
|
|
6
|
+
var $a747a10fe70a57da$var$cachedGlobalStrings = void 0;
|
|
7
|
+
var $a747a10fe70a57da$export$c17fa47878dc55b6 = class $a747a10fe70a57da$export$c17fa47878dc55b6 {
|
|
8
|
+
constructor(messages, defaultLocale = "en-US") {
|
|
9
|
+
this.strings = Object.fromEntries(Object.entries(messages).filter(([, v]) => v));
|
|
10
|
+
this.defaultLocale = defaultLocale;
|
|
11
|
+
}
|
|
8
12
|
/** Returns a localized string for the given key and locale. */ getStringForLocale(key, locale) {
|
|
9
13
|
let string = this.getStringsForLocale(locale)[key];
|
|
10
14
|
if (!string) throw new Error(`Could not find intl message ${key} in ${locale} locale`);
|
|
@@ -13,45 +17,45 @@ var $5b160d28a433310d$export$c17fa47878dc55b6 = class $5b160d28a433310d$export$c
|
|
|
13
17
|
/** Returns all localized strings for the given locale. */ getStringsForLocale(locale) {
|
|
14
18
|
let strings = this.strings[locale];
|
|
15
19
|
if (!strings) {
|
|
16
|
-
strings = $
|
|
20
|
+
strings = $a747a10fe70a57da$var$getStringsForLocale(locale, this.strings, this.defaultLocale);
|
|
17
21
|
this.strings[locale] = strings;
|
|
18
22
|
}
|
|
19
23
|
return strings;
|
|
20
24
|
}
|
|
21
25
|
static getGlobalDictionaryForPackage(packageName) {
|
|
22
26
|
if (typeof window === "undefined") return null;
|
|
23
|
-
let locale = window[$
|
|
24
|
-
if ($
|
|
25
|
-
let globalStrings = window[$
|
|
27
|
+
let locale = window[$a747a10fe70a57da$var$localeSymbol];
|
|
28
|
+
if ($a747a10fe70a57da$var$cachedGlobalStrings === void 0) {
|
|
29
|
+
let globalStrings = window[$a747a10fe70a57da$var$stringsSymbol];
|
|
26
30
|
if (!globalStrings) return null;
|
|
27
|
-
$
|
|
28
|
-
for (let pkg in globalStrings) $
|
|
31
|
+
$a747a10fe70a57da$var$cachedGlobalStrings = {};
|
|
32
|
+
for (let pkg in globalStrings) $a747a10fe70a57da$var$cachedGlobalStrings[pkg] = new $a747a10fe70a57da$export$c17fa47878dc55b6({ [locale]: globalStrings[pkg] }, locale);
|
|
29
33
|
}
|
|
30
|
-
let dictionary = $
|
|
34
|
+
let dictionary = $a747a10fe70a57da$var$cachedGlobalStrings?.[packageName];
|
|
31
35
|
if (!dictionary) throw new Error(`Strings for package "${packageName}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);
|
|
32
36
|
return dictionary;
|
|
33
37
|
}
|
|
34
|
-
constructor(messages, defaultLocale = "en-US") {
|
|
35
|
-
this.strings = Object.fromEntries(Object.entries(messages).filter(([, v]) => v));
|
|
36
|
-
this.defaultLocale = defaultLocale;
|
|
37
|
-
}
|
|
38
38
|
};
|
|
39
|
-
function $
|
|
39
|
+
function $a747a10fe70a57da$var$getStringsForLocale(locale, strings, defaultLocale = "en-US") {
|
|
40
40
|
if (strings[locale]) return strings[locale];
|
|
41
|
-
let language = $
|
|
41
|
+
let language = $a747a10fe70a57da$var$getLanguage(locale);
|
|
42
42
|
if (strings[language]) return strings[language];
|
|
43
43
|
for (let key in strings) if (key.startsWith(language + "-")) return strings[key];
|
|
44
44
|
return strings[defaultLocale];
|
|
45
45
|
}
|
|
46
|
-
function $
|
|
46
|
+
function $a747a10fe70a57da$var$getLanguage(locale) {
|
|
47
47
|
if (Intl.Locale) return new Intl.Locale(locale).language;
|
|
48
48
|
return locale.split("-")[0];
|
|
49
49
|
}
|
|
50
50
|
//#endregion
|
|
51
|
-
//#region node_modules/@internationalized/string/dist/LocalizedStringFormatter.mjs
|
|
52
|
-
var $
|
|
53
|
-
var $
|
|
54
|
-
var $
|
|
51
|
+
//#region node_modules/@internationalized/string/dist/private/LocalizedStringFormatter.mjs
|
|
52
|
+
var $b27c684a33948c64$var$pluralRulesCache = new Map();
|
|
53
|
+
var $b27c684a33948c64$var$numberFormatCache = new Map();
|
|
54
|
+
var $b27c684a33948c64$export$2f817fcdc4b89ae0 = class {
|
|
55
|
+
constructor(locale, strings) {
|
|
56
|
+
this.locale = locale;
|
|
57
|
+
this.strings = strings;
|
|
58
|
+
}
|
|
55
59
|
/** Formats a localized string for the given key with the provided variables. */ format(key, variables) {
|
|
56
60
|
let message = this.strings.getStringForLocale(key, this.locale);
|
|
57
61
|
return typeof message === "function" ? message(variables, this) : message;
|
|
@@ -60,19 +64,19 @@ var $6db58dc88e78b024$export$2f817fcdc4b89ae0 = class {
|
|
|
60
64
|
let opt = options["=" + count];
|
|
61
65
|
if (opt) return typeof opt === "function" ? opt() : opt;
|
|
62
66
|
let key = this.locale + ":" + type;
|
|
63
|
-
let pluralRules = $
|
|
67
|
+
let pluralRules = $b27c684a33948c64$var$pluralRulesCache.get(key);
|
|
64
68
|
if (!pluralRules) {
|
|
65
69
|
pluralRules = new Intl.PluralRules(this.locale, { type });
|
|
66
|
-
$
|
|
70
|
+
$b27c684a33948c64$var$pluralRulesCache.set(key, pluralRules);
|
|
67
71
|
}
|
|
68
72
|
opt = options[pluralRules.select(count)] || options.other;
|
|
69
73
|
return typeof opt === "function" ? opt() : opt;
|
|
70
74
|
}
|
|
71
75
|
number(value) {
|
|
72
|
-
let numberFormat = $
|
|
76
|
+
let numberFormat = $b27c684a33948c64$var$numberFormatCache.get(this.locale);
|
|
73
77
|
if (!numberFormat) {
|
|
74
78
|
numberFormat = new Intl.NumberFormat(this.locale);
|
|
75
|
-
$
|
|
79
|
+
$b27c684a33948c64$var$numberFormatCache.set(this.locale, numberFormat);
|
|
76
80
|
}
|
|
77
81
|
return numberFormat.format(value);
|
|
78
82
|
}
|
|
@@ -80,29 +84,25 @@ var $6db58dc88e78b024$export$2f817fcdc4b89ae0 = class {
|
|
|
80
84
|
let opt = options[value] || options.other;
|
|
81
85
|
return typeof opt === "function" ? opt() : opt;
|
|
82
86
|
}
|
|
83
|
-
constructor(locale, strings) {
|
|
84
|
-
this.locale = locale;
|
|
85
|
-
this.strings = strings;
|
|
86
|
-
}
|
|
87
87
|
};
|
|
88
88
|
//#endregion
|
|
89
|
-
//#region node_modules
|
|
90
|
-
var $
|
|
91
|
-
function $
|
|
92
|
-
let dictionary = $
|
|
89
|
+
//#region node_modules/react-aria/dist/private/i18n/useLocalizedStringFormatter.mjs
|
|
90
|
+
var $cf2482eff2eeeec2$var$cache = new WeakMap();
|
|
91
|
+
function $cf2482eff2eeeec2$var$getCachedDictionary(strings) {
|
|
92
|
+
let dictionary = $cf2482eff2eeeec2$var$cache.get(strings);
|
|
93
93
|
if (!dictionary) {
|
|
94
|
-
dictionary = new $
|
|
95
|
-
$
|
|
94
|
+
dictionary = new $a747a10fe70a57da$export$c17fa47878dc55b6(strings);
|
|
95
|
+
$cf2482eff2eeeec2$var$cache.set(strings, dictionary);
|
|
96
96
|
}
|
|
97
97
|
return dictionary;
|
|
98
98
|
}
|
|
99
|
-
function $
|
|
100
|
-
return packageName && $
|
|
99
|
+
function $cf2482eff2eeeec2$export$87b761675e8eaa10(strings, packageName) {
|
|
100
|
+
return packageName && $a747a10fe70a57da$export$c17fa47878dc55b6.getGlobalDictionaryForPackage(packageName) || $cf2482eff2eeeec2$var$getCachedDictionary(strings);
|
|
101
101
|
}
|
|
102
|
-
function $
|
|
103
|
-
let { locale } = $
|
|
104
|
-
let dictionary = $
|
|
105
|
-
return useMemo(() => new $
|
|
102
|
+
function $cf2482eff2eeeec2$export$f12b703ca79dfbb1(strings, packageName) {
|
|
103
|
+
let { locale } = $2eb8e6d23f3d0cb0$export$43bb16f9c6d9e3f7();
|
|
104
|
+
let dictionary = $cf2482eff2eeeec2$export$87b761675e8eaa10(strings, packageName);
|
|
105
|
+
return useMemo(() => new $b27c684a33948c64$export$2f817fcdc4b89ae0(locale, dictionary), [locale, dictionary]);
|
|
106
106
|
}
|
|
107
107
|
//#endregion
|
|
108
|
-
export { $
|
|
108
|
+
export { $b27c684a33948c64$export$2f817fcdc4b89ae0 as n, $a747a10fe70a57da$export$c17fa47878dc55b6 as r, $cf2482eff2eeeec2$export$f12b703ca79dfbb1 as t };
|