@eightshift/ui-components 5.0.0 → 5.0.1
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-wERNNG0T.js +185 -0
- package/dist/Collection-CKsHTyhc.js +2363 -0
- package/dist/Color-BhgbJF5x.js +2452 -0
- package/dist/ColorSwatch-Bcn6oRSg.js +64 -0
- package/dist/ComboBox-D1LPUwWP.js +1906 -0
- package/dist/Dialog-D190gMbE.js +2298 -0
- package/dist/FieldError-DeUh5Wkw.js +42 -0
- package/dist/FocusScope-C-plSxbS.js +831 -0
- package/dist/Form-Cq3fu75_.js +5 -0
- package/dist/Group-C5iZpSAM.js +48 -0
- package/dist/Heading-D-Pboe4p.js +16 -0
- package/dist/Hidden-rE6uR-lr.js +41 -0
- package/dist/Input--mF4XVE1.js +133 -0
- package/dist/Label-Fp6AwSRn.js +17 -0
- package/dist/List-CZMUbkFU.js +593 -0
- package/dist/ListBox-4oW9kh3R.js +582 -0
- package/dist/NumberFormatter-DA8u1Ot7.js +140 -0
- package/dist/OverlayArrow-BpB9uB_I.js +637 -0
- package/dist/RSPContexts-2lR5GG9p.js +14 -0
- package/dist/Select-aab027f3.esm-BKIJGje-.js +2469 -0
- package/dist/Separator-B88tj5YD.js +323 -0
- package/dist/Slider-CyJzC1bp.js +853 -0
- package/dist/Text-DRpwWot2.js +16 -0
- package/dist/VisuallyHidden-DsKYcRQ_.js +48 -0
- package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
- package/dist/assets/index.css +57 -0
- package/dist/assets/style-admin.css +5864 -0
- package/dist/assets/style-editor.css +5864 -0
- package/dist/assets/style.css +5870 -0
- package/dist/assets/wp-font-enhancements.css +8 -0
- package/dist/assets/wp-ui-enhancements.css +377 -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 +320 -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 +6979 -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 +291 -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 +579 -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 +991 -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 +704 -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-BYWrbm1z.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 +30371 -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-CFozsmNS.js +28321 -0
- package/dist/index-wl5606BX.js +44 -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-CCcyjiRP.js +46 -0
- package/dist/useButton-BOHxkGQF.js +50 -0
- package/dist/useEvent-D5o_CqDH.js +23 -0
- package/dist/useFocusRing-nMG2uzxS.js +107 -0
- package/dist/useFormReset-DlmRL87g.js +22 -0
- package/dist/useFormValidation-D0_aaK-e.js +224 -0
- package/dist/useHover-VO5tcIli.js +890 -0
- package/dist/useLabel-BKH4fVA4.js +27 -0
- package/dist/useLabels-ntF3rFY0.js +23 -0
- package/dist/useListState-Cq2Nvr-v.js +161 -0
- package/dist/useLocalizedStringFormatter-CGzwx1a0.js +121 -0
- package/dist/useNumberField-C9dmERhP.js +1207 -0
- package/dist/useNumberFormatter-MrRLgvhj.js +13 -0
- package/dist/usePress-DjNo5790.js +677 -0
- package/dist/useSingleSelectListState--r3AAhRj.js +38 -0
- package/dist/useToggle-CQaXLe-O.js +59 -0
- package/dist/useToggleState-C3DLdez5.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-B94NDG0v.js +370 -0
- package/dist/wp/wp-font-enhancements.js +1 -0
- package/dist/wp/wp-ui-enhancements.js +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c as $96b38030c423d352$export$9fc1347d4195ccb3, $ as $fc909762b330b746$export$61c6a8c84e605fb6, a as $d3f049242431219c$export$45fda7c47f93fd48, d as $2a41e45df1593e64$export$d39e1813b3bdd0e1, b as $d3f049242431219c$export$6d3443f2c48bfc20, e as $44f671af83e7d9e0$export$2de4954e8ae13b9f, f as $44f671af83e7d9e0$export$746d02f47f4d381 } from "../../OverlayArrow-BpB9uB_I.js";
|
|
3
|
+
import { n as $b5e257d569688ac6$export$535bd6ca7f90a273, d as $3ef42575df84b30b$export$9d1611c77c2fe928, e as $bdb11010cef70236$export$f680877a34711e37, i as $64fa3d84918910a7$export$2881499e37b75b9a, a as $64fa3d84918910a7$export$29f1550f4b0d4415, k as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, b as $64fa3d84918910a7$export$4d86445c2cf5e3 } from "../../utils-B94NDG0v.js";
|
|
4
|
+
import { $ as $6179b936705e76d3$export$ae780daf29e6d456, a as $f645667febf57a63$export$4c014de7c8940b4c, x as $507fabe10e71c6fb$export$630ff653c5ada6a9, n as $507fabe10e71c6fb$export$b9b3dfddab17db27, y as $f645667febf57a63$export$13f3202a3e5ddd5 } from "../../useHover-VO5tcIli.js";
|
|
5
|
+
import React__default, { useContext, useState, useMemo, useRef, useEffect, forwardRef, createContext } from "react";
|
|
6
|
+
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-EDDcM64A.js";
|
|
7
|
+
import { $ as $dbSRa$reactdom } from "../../index-CFozsmNS.js";
|
|
8
|
+
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
9
|
+
const $f57aed4a881a3485$var$Context = /* @__PURE__ */ React__default.createContext(null);
|
|
10
|
+
function $f57aed4a881a3485$export$178405afcd8c5eb(props) {
|
|
11
|
+
let { children } = props;
|
|
12
|
+
let parent = useContext($f57aed4a881a3485$var$Context);
|
|
13
|
+
let [modalCount, setModalCount] = useState(0);
|
|
14
|
+
let context = useMemo(() => ({
|
|
15
|
+
parent,
|
|
16
|
+
modalCount,
|
|
17
|
+
addModal() {
|
|
18
|
+
setModalCount((count) => count + 1);
|
|
19
|
+
if (parent) parent.addModal();
|
|
20
|
+
},
|
|
21
|
+
removeModal() {
|
|
22
|
+
setModalCount((count) => count - 1);
|
|
23
|
+
if (parent) parent.removeModal();
|
|
24
|
+
}
|
|
25
|
+
}), [
|
|
26
|
+
parent,
|
|
27
|
+
modalCount
|
|
28
|
+
]);
|
|
29
|
+
return /* @__PURE__ */ React__default.createElement($f57aed4a881a3485$var$Context.Provider, {
|
|
30
|
+
value: context
|
|
31
|
+
}, children);
|
|
32
|
+
}
|
|
33
|
+
function $f57aed4a881a3485$export$d9aaed4c3ece1bc0() {
|
|
34
|
+
let context = useContext($f57aed4a881a3485$var$Context);
|
|
35
|
+
return {
|
|
36
|
+
modalProviderProps: {
|
|
37
|
+
"aria-hidden": context && context.modalCount > 0 ? true : void 0
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function $f57aed4a881a3485$var$OverlayContainerDOM(props) {
|
|
42
|
+
let { modalProviderProps } = $f57aed4a881a3485$export$d9aaed4c3ece1bc0();
|
|
43
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
44
|
+
"data-overlay-container": true,
|
|
45
|
+
...props,
|
|
46
|
+
...modalProviderProps
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function $f57aed4a881a3485$export$bf688221f59024e5(props) {
|
|
50
|
+
return /* @__PURE__ */ React__default.createElement($f57aed4a881a3485$export$178405afcd8c5eb, null, /* @__PURE__ */ React__default.createElement($f57aed4a881a3485$var$OverlayContainerDOM, props));
|
|
51
|
+
}
|
|
52
|
+
function $f57aed4a881a3485$export$b47c3594eab58386(props) {
|
|
53
|
+
let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273();
|
|
54
|
+
let { portalContainer = isSSR ? null : document.body, ...rest } = props;
|
|
55
|
+
let { getContainer } = $96b38030c423d352$export$9fc1347d4195ccb3();
|
|
56
|
+
if (!props.portalContainer && getContainer) portalContainer = getContainer();
|
|
57
|
+
React__default.useEffect(() => {
|
|
58
|
+
if (portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.closest("[data-overlay-container]")) throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
|
|
59
|
+
}, [
|
|
60
|
+
portalContainer
|
|
61
|
+
]);
|
|
62
|
+
if (!portalContainer) return null;
|
|
63
|
+
let contents = /* @__PURE__ */ React__default.createElement($f57aed4a881a3485$export$bf688221f59024e5, rest);
|
|
64
|
+
return /* @__PURE__ */ $dbSRa$reactdom.createPortal(contents, portalContainer);
|
|
65
|
+
}
|
|
66
|
+
function $326e436e94273fe1$export$1c4b08e0eca38426(props, state) {
|
|
67
|
+
let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
|
|
68
|
+
labelable: true
|
|
69
|
+
});
|
|
70
|
+
let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456({
|
|
71
|
+
onHoverStart: () => state === null || state === void 0 ? void 0 : state.open(true),
|
|
72
|
+
onHoverEnd: () => state === null || state === void 0 ? void 0 : state.close()
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
tooltipProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, hoverProps, {
|
|
76
|
+
role: "tooltip"
|
|
77
|
+
})
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function $4e1b34546679e357$export$a6da6c504e4bba8b(props, state, ref) {
|
|
81
|
+
let { isDisabled, trigger } = props;
|
|
82
|
+
let tooltipId = $bdb11010cef70236$export$f680877a34711e37();
|
|
83
|
+
let isHovered = useRef(false);
|
|
84
|
+
let isFocused = useRef(false);
|
|
85
|
+
let handleShow = () => {
|
|
86
|
+
if (isHovered.current || isFocused.current) state.open(isFocused.current);
|
|
87
|
+
};
|
|
88
|
+
let handleHide = (immediate) => {
|
|
89
|
+
if (!isHovered.current && !isFocused.current) state.close(immediate);
|
|
90
|
+
};
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
let onKeyDown = (e) => {
|
|
93
|
+
if (ref && ref.current) {
|
|
94
|
+
if (e.key === "Escape") {
|
|
95
|
+
e.stopPropagation();
|
|
96
|
+
state.close(true);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
if (state.isOpen) {
|
|
101
|
+
document.addEventListener("keydown", onKeyDown, true);
|
|
102
|
+
return () => {
|
|
103
|
+
document.removeEventListener("keydown", onKeyDown, true);
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}, [
|
|
107
|
+
ref,
|
|
108
|
+
state
|
|
109
|
+
]);
|
|
110
|
+
let onHoverStart = () => {
|
|
111
|
+
if (trigger === "focus") return;
|
|
112
|
+
if ($507fabe10e71c6fb$export$630ff653c5ada6a9() === "pointer") isHovered.current = true;
|
|
113
|
+
else isHovered.current = false;
|
|
114
|
+
handleShow();
|
|
115
|
+
};
|
|
116
|
+
let onHoverEnd = () => {
|
|
117
|
+
if (trigger === "focus") return;
|
|
118
|
+
isFocused.current = false;
|
|
119
|
+
isHovered.current = false;
|
|
120
|
+
handleHide();
|
|
121
|
+
};
|
|
122
|
+
let onPressStart = () => {
|
|
123
|
+
isFocused.current = false;
|
|
124
|
+
isHovered.current = false;
|
|
125
|
+
handleHide(true);
|
|
126
|
+
};
|
|
127
|
+
let onFocus = () => {
|
|
128
|
+
let isVisible = $507fabe10e71c6fb$export$b9b3dfddab17db27();
|
|
129
|
+
if (isVisible) {
|
|
130
|
+
isFocused.current = true;
|
|
131
|
+
handleShow();
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
let onBlur = () => {
|
|
135
|
+
isFocused.current = false;
|
|
136
|
+
isHovered.current = false;
|
|
137
|
+
handleHide(true);
|
|
138
|
+
};
|
|
139
|
+
let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456({
|
|
140
|
+
isDisabled,
|
|
141
|
+
onHoverStart,
|
|
142
|
+
onHoverEnd
|
|
143
|
+
});
|
|
144
|
+
let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c({
|
|
145
|
+
isDisabled,
|
|
146
|
+
onFocus,
|
|
147
|
+
onBlur
|
|
148
|
+
}, ref);
|
|
149
|
+
return {
|
|
150
|
+
triggerProps: {
|
|
151
|
+
"aria-describedby": state.isOpen ? tooltipId : void 0,
|
|
152
|
+
...$3ef42575df84b30b$export$9d1611c77c2fe928(focusableProps, hoverProps, {
|
|
153
|
+
onPointerDown: onPressStart,
|
|
154
|
+
onKeyDown: onPressStart,
|
|
155
|
+
tabIndex: void 0
|
|
156
|
+
})
|
|
157
|
+
},
|
|
158
|
+
tooltipProps: {
|
|
159
|
+
id: tooltipId
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
const $8796f90736e175cb$var$TOOLTIP_DELAY = 1500;
|
|
164
|
+
const $8796f90736e175cb$var$TOOLTIP_COOLDOWN = 500;
|
|
165
|
+
let $8796f90736e175cb$var$tooltips = {};
|
|
166
|
+
let $8796f90736e175cb$var$tooltipId = 0;
|
|
167
|
+
let $8796f90736e175cb$var$globalWarmedUp = false;
|
|
168
|
+
let $8796f90736e175cb$var$globalWarmUpTimeout = null;
|
|
169
|
+
let $8796f90736e175cb$var$globalCooldownTimeout = null;
|
|
170
|
+
function $8796f90736e175cb$export$4d40659c25ecb50b(props = {}) {
|
|
171
|
+
let { delay = $8796f90736e175cb$var$TOOLTIP_DELAY, closeDelay = $8796f90736e175cb$var$TOOLTIP_COOLDOWN } = props;
|
|
172
|
+
let { isOpen, open, close } = $fc909762b330b746$export$61c6a8c84e605fb6(props);
|
|
173
|
+
let id = useMemo(() => `${++$8796f90736e175cb$var$tooltipId}`, []);
|
|
174
|
+
let closeTimeout = useRef(null);
|
|
175
|
+
let closeCallback = useRef(close);
|
|
176
|
+
let ensureTooltipEntry = () => {
|
|
177
|
+
$8796f90736e175cb$var$tooltips[id] = hideTooltip;
|
|
178
|
+
};
|
|
179
|
+
let closeOpenTooltips = () => {
|
|
180
|
+
for (let hideTooltipId in $8796f90736e175cb$var$tooltips) if (hideTooltipId !== id) {
|
|
181
|
+
$8796f90736e175cb$var$tooltips[hideTooltipId](true);
|
|
182
|
+
delete $8796f90736e175cb$var$tooltips[hideTooltipId];
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
let showTooltip = () => {
|
|
186
|
+
if (closeTimeout.current) clearTimeout(closeTimeout.current);
|
|
187
|
+
closeTimeout.current = null;
|
|
188
|
+
closeOpenTooltips();
|
|
189
|
+
ensureTooltipEntry();
|
|
190
|
+
$8796f90736e175cb$var$globalWarmedUp = true;
|
|
191
|
+
open();
|
|
192
|
+
if ($8796f90736e175cb$var$globalWarmUpTimeout) {
|
|
193
|
+
clearTimeout($8796f90736e175cb$var$globalWarmUpTimeout);
|
|
194
|
+
$8796f90736e175cb$var$globalWarmUpTimeout = null;
|
|
195
|
+
}
|
|
196
|
+
if ($8796f90736e175cb$var$globalCooldownTimeout) {
|
|
197
|
+
clearTimeout($8796f90736e175cb$var$globalCooldownTimeout);
|
|
198
|
+
$8796f90736e175cb$var$globalCooldownTimeout = null;
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
let hideTooltip = (immediate) => {
|
|
202
|
+
if (immediate || closeDelay <= 0) {
|
|
203
|
+
if (closeTimeout.current) clearTimeout(closeTimeout.current);
|
|
204
|
+
closeTimeout.current = null;
|
|
205
|
+
closeCallback.current();
|
|
206
|
+
} else if (!closeTimeout.current) closeTimeout.current = setTimeout(() => {
|
|
207
|
+
closeTimeout.current = null;
|
|
208
|
+
closeCallback.current();
|
|
209
|
+
}, closeDelay);
|
|
210
|
+
if ($8796f90736e175cb$var$globalWarmUpTimeout) {
|
|
211
|
+
clearTimeout($8796f90736e175cb$var$globalWarmUpTimeout);
|
|
212
|
+
$8796f90736e175cb$var$globalWarmUpTimeout = null;
|
|
213
|
+
}
|
|
214
|
+
if ($8796f90736e175cb$var$globalWarmedUp) {
|
|
215
|
+
if ($8796f90736e175cb$var$globalCooldownTimeout) clearTimeout($8796f90736e175cb$var$globalCooldownTimeout);
|
|
216
|
+
$8796f90736e175cb$var$globalCooldownTimeout = setTimeout(() => {
|
|
217
|
+
delete $8796f90736e175cb$var$tooltips[id];
|
|
218
|
+
$8796f90736e175cb$var$globalCooldownTimeout = null;
|
|
219
|
+
$8796f90736e175cb$var$globalWarmedUp = false;
|
|
220
|
+
}, Math.max($8796f90736e175cb$var$TOOLTIP_COOLDOWN, closeDelay));
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
let warmupTooltip = () => {
|
|
224
|
+
closeOpenTooltips();
|
|
225
|
+
ensureTooltipEntry();
|
|
226
|
+
if (!isOpen && !$8796f90736e175cb$var$globalWarmUpTimeout && !$8796f90736e175cb$var$globalWarmedUp) $8796f90736e175cb$var$globalWarmUpTimeout = setTimeout(() => {
|
|
227
|
+
$8796f90736e175cb$var$globalWarmUpTimeout = null;
|
|
228
|
+
$8796f90736e175cb$var$globalWarmedUp = true;
|
|
229
|
+
showTooltip();
|
|
230
|
+
}, delay);
|
|
231
|
+
else if (!isOpen) showTooltip();
|
|
232
|
+
};
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
closeCallback.current = close;
|
|
235
|
+
}, [
|
|
236
|
+
close
|
|
237
|
+
]);
|
|
238
|
+
useEffect(() => {
|
|
239
|
+
return () => {
|
|
240
|
+
if (closeTimeout.current) clearTimeout(closeTimeout.current);
|
|
241
|
+
let tooltip = $8796f90736e175cb$var$tooltips[id];
|
|
242
|
+
if (tooltip) delete $8796f90736e175cb$var$tooltips[id];
|
|
243
|
+
};
|
|
244
|
+
}, [
|
|
245
|
+
id
|
|
246
|
+
]);
|
|
247
|
+
return {
|
|
248
|
+
isOpen,
|
|
249
|
+
open: (immediate) => {
|
|
250
|
+
if (!immediate && delay > 0 && !closeTimeout.current) warmupTooltip();
|
|
251
|
+
else showTooltip();
|
|
252
|
+
},
|
|
253
|
+
close: hideTooltip
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
const $4e3b923658d69c60$export$7a7623236eec67fa = /* @__PURE__ */ createContext(null);
|
|
257
|
+
const $4e3b923658d69c60$export$39ae08fa83328b12 = /* @__PURE__ */ createContext(null);
|
|
258
|
+
function $4e3b923658d69c60$export$8c610744efcf8a1d(props) {
|
|
259
|
+
let state = $8796f90736e175cb$export$4d40659c25ecb50b(props);
|
|
260
|
+
let ref = useRef(null);
|
|
261
|
+
let { triggerProps, tooltipProps } = $4e1b34546679e357$export$a6da6c504e4bba8b(props, state, ref);
|
|
262
|
+
return /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
|
|
263
|
+
values: [
|
|
264
|
+
[
|
|
265
|
+
$4e3b923658d69c60$export$7a7623236eec67fa,
|
|
266
|
+
state
|
|
267
|
+
],
|
|
268
|
+
[
|
|
269
|
+
$4e3b923658d69c60$export$39ae08fa83328b12,
|
|
270
|
+
{
|
|
271
|
+
...tooltipProps,
|
|
272
|
+
triggerRef: ref
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
]
|
|
276
|
+
}, /* @__PURE__ */ React__default.createElement($f645667febf57a63$export$13f3202a3e5ddd5, {
|
|
277
|
+
...triggerProps,
|
|
278
|
+
ref
|
|
279
|
+
}, props.children));
|
|
280
|
+
}
|
|
281
|
+
const $4e3b923658d69c60$export$28c660c63b792dea = /* @__PURE__ */ forwardRef(function Tooltip({ UNSTABLE_portalContainer, ...props }, ref) {
|
|
282
|
+
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $4e3b923658d69c60$export$39ae08fa83328b12);
|
|
283
|
+
let contextState = useContext($4e3b923658d69c60$export$7a7623236eec67fa);
|
|
284
|
+
let localState = $8796f90736e175cb$export$4d40659c25ecb50b(props);
|
|
285
|
+
let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;
|
|
286
|
+
let isExiting = $d3f049242431219c$export$45fda7c47f93fd48(ref, state.isOpen) || props.isExiting || false;
|
|
287
|
+
if (!state.isOpen && !isExiting) return null;
|
|
288
|
+
return /* @__PURE__ */ React__default.createElement($f57aed4a881a3485$export$b47c3594eab58386, {
|
|
289
|
+
portalContainer: UNSTABLE_portalContainer
|
|
290
|
+
}, /* @__PURE__ */ React__default.createElement($4e3b923658d69c60$var$TooltipInner, {
|
|
291
|
+
...props,
|
|
292
|
+
tooltipRef: ref,
|
|
293
|
+
isExiting
|
|
294
|
+
}));
|
|
295
|
+
});
|
|
296
|
+
function $4e3b923658d69c60$var$TooltipInner(props) {
|
|
297
|
+
let state = useContext($4e3b923658d69c60$export$7a7623236eec67fa);
|
|
298
|
+
let arrowRef = useRef(null);
|
|
299
|
+
let [arrowWidth, setArrowWidth] = useState(0);
|
|
300
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
301
|
+
if (arrowRef.current && state.isOpen) setArrowWidth(arrowRef.current.getBoundingClientRect().width);
|
|
302
|
+
}, [
|
|
303
|
+
state.isOpen,
|
|
304
|
+
arrowRef
|
|
305
|
+
]);
|
|
306
|
+
let { overlayProps, arrowProps, placement } = $2a41e45df1593e64$export$d39e1813b3bdd0e1({
|
|
307
|
+
placement: props.placement || "top",
|
|
308
|
+
targetRef: props.triggerRef,
|
|
309
|
+
overlayRef: props.tooltipRef,
|
|
310
|
+
offset: props.offset,
|
|
311
|
+
crossOffset: props.crossOffset,
|
|
312
|
+
isOpen: state.isOpen,
|
|
313
|
+
arrowSize: arrowWidth,
|
|
314
|
+
arrowBoundaryOffset: props.arrowBoundaryOffset,
|
|
315
|
+
shouldFlip: props.shouldFlip,
|
|
316
|
+
onClose: () => state.close(true)
|
|
317
|
+
});
|
|
318
|
+
let isEntering = $d3f049242431219c$export$6d3443f2c48bfc20(props.tooltipRef, !!placement) || props.isEntering || false;
|
|
319
|
+
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
320
|
+
...props,
|
|
321
|
+
defaultClassName: "react-aria-Tooltip",
|
|
322
|
+
values: {
|
|
323
|
+
placement,
|
|
324
|
+
isEntering,
|
|
325
|
+
isExiting: props.isExiting,
|
|
326
|
+
state
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
props = $3ef42575df84b30b$export$9d1611c77c2fe928(props, overlayProps);
|
|
330
|
+
let { tooltipProps } = $326e436e94273fe1$export$1c4b08e0eca38426(props, state);
|
|
331
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
332
|
+
...tooltipProps,
|
|
333
|
+
ref: props.tooltipRef,
|
|
334
|
+
...renderProps,
|
|
335
|
+
style: {
|
|
336
|
+
...overlayProps.style,
|
|
337
|
+
...renderProps.style
|
|
338
|
+
},
|
|
339
|
+
"data-placement": placement !== null && placement !== void 0 ? placement : void 0,
|
|
340
|
+
"data-entering": isEntering || void 0,
|
|
341
|
+
"data-exiting": props.isExiting || void 0
|
|
342
|
+
}, /* @__PURE__ */ React__default.createElement($44f671af83e7d9e0$export$2de4954e8ae13b9f.Provider, {
|
|
343
|
+
value: {
|
|
344
|
+
...arrowProps,
|
|
345
|
+
placement,
|
|
346
|
+
ref: arrowRef
|
|
347
|
+
}
|
|
348
|
+
}, renderProps.children));
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* A simple tooltip component.
|
|
352
|
+
*
|
|
353
|
+
* It can be used in two modes:
|
|
354
|
+
* - **Controlled mode**: You can control the tooltip with the `open` prop.
|
|
355
|
+
* - **Uncontrolled mode**: The tooltip will be open by default with the `defaultOpen` prop.
|
|
356
|
+
*
|
|
357
|
+
* @component
|
|
358
|
+
* @param {Object} props - Component props.
|
|
359
|
+
* @param {string|JSX.Element} props.text - The text to display in the tooltip.
|
|
360
|
+
* @param {TooltipTheme} [props.theme='dark'] - The theme of the tooltip.
|
|
361
|
+
* @param {number} [props.offset=0] - Additional offset between the tooltip and the element on the main axis (same axis as element).
|
|
362
|
+
* @param {number} [props.crossOffset=0] - Additional offset between the tooltip and the element on the cross axis (opposite axis as element).
|
|
363
|
+
* @param {number} [props.containerPadding=12] - Space that should be left between the tooltip and the main containing element (usually browser window).
|
|
364
|
+
* @param {number} [props.openDelay=1500] - Duration before the tooltip is shown, in milliseconds.
|
|
365
|
+
* @param {number} [props.closeDelay=500] - Duration before the tooltip is hidden, in milliseconds.
|
|
366
|
+
* @param {boolean} [props.shouldFlip=true] - If `false`, the tooltip will not flip to the opposite side if there is not enough space.
|
|
367
|
+
* @param {boolean} [props.defaultOpen] - (**Uncontrolled mode**) Whether the tooltip is initially open.
|
|
368
|
+
* @param {boolean} [props.open] - (**Controlled mode**) Whether the tooltip is open.
|
|
369
|
+
* @param {Function} [props.onOpenChange] - (**Controlled mode**) Function to run when the tooltip is opened or closed.
|
|
370
|
+
* @param {TooltipPlacement} [props.placement] - The side of the trigger element where the tooltip will be displayed.
|
|
371
|
+
* @param {string} [props.className] - Classes to pass to the tooltip.
|
|
372
|
+
* @param {RefObject<Element>} [props.triggerRef] - Ref to anchor the tooltip to. If not provided, the tooltip will be anchored to the trigger element.
|
|
373
|
+
* @param {boolean} [props.arrow] - If `true`, an arrow is shown on the tooltip.
|
|
374
|
+
*
|
|
375
|
+
* @returns {JSX.Element} The Tooltip component.
|
|
376
|
+
*
|
|
377
|
+
* @typedef {'light' | 'dark'} TooltipTheme
|
|
378
|
+
* @typedef {'bottom' | 'bottom left' | 'bottom right' | 'bottom start' | 'bottom end' | 'top' | 'top left' | 'top right' | 'top start' | 'top end' | 'left' | 'left top' | 'left bottom' | 'start' | 'start top' | 'start bottom' | 'right' | 'right top' | 'right bottom' | 'end' | 'end top' | 'end bottom'} TooltipPlacement
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* <Tooltip text='My tooltip'>
|
|
382
|
+
* <Button>Hover me</Button>
|
|
383
|
+
* </Tooltip>
|
|
384
|
+
*
|
|
385
|
+
* @preserve
|
|
386
|
+
*/
|
|
387
|
+
const Tooltip2 = (props) => {
|
|
388
|
+
const {
|
|
389
|
+
children,
|
|
390
|
+
text,
|
|
391
|
+
theme = "dark",
|
|
392
|
+
offset = 0,
|
|
393
|
+
crossOffset = 0,
|
|
394
|
+
containerPadding = 12,
|
|
395
|
+
openDelay = 1500,
|
|
396
|
+
closeDelay = 500,
|
|
397
|
+
shouldFlip = true,
|
|
398
|
+
arrow,
|
|
399
|
+
open,
|
|
400
|
+
defaultOpen,
|
|
401
|
+
onOpenChange,
|
|
402
|
+
placement,
|
|
403
|
+
className,
|
|
404
|
+
triggerRef,
|
|
405
|
+
disabled
|
|
406
|
+
} = props;
|
|
407
|
+
return /* @__PURE__ */ jsxs(
|
|
408
|
+
$4e3b923658d69c60$export$8c610744efcf8a1d,
|
|
409
|
+
{
|
|
410
|
+
delay: openDelay,
|
|
411
|
+
closeDelay,
|
|
412
|
+
isDisabled: disabled,
|
|
413
|
+
isOpen: open,
|
|
414
|
+
onOpenChange,
|
|
415
|
+
defaultOpen,
|
|
416
|
+
children: [
|
|
417
|
+
children,
|
|
418
|
+
/* @__PURE__ */ jsxs(
|
|
419
|
+
$4e3b923658d69c60$export$28c660c63b792dea,
|
|
420
|
+
{
|
|
421
|
+
containerPadding,
|
|
422
|
+
placement,
|
|
423
|
+
shouldFlip,
|
|
424
|
+
triggerRef,
|
|
425
|
+
offset,
|
|
426
|
+
crossOffset,
|
|
427
|
+
className: ({ isEntering, isExiting }) => clsx(
|
|
428
|
+
"es:group es:pointer-events-none",
|
|
429
|
+
"es:z-20 es:select-none es:rounded-md es:border es:px-1.5 es:py-0.5 es:text-sm es:shadow es:backdrop-blur-3xl es:will-change-[transform,opacity] es:fill-mode-forwards",
|
|
430
|
+
theme === "light" && "es:border-secondary-200 es:bg-white/90 es:text-secondary-700",
|
|
431
|
+
theme === "dark" && "es:border-secondary-600 es:bg-black/80 es:text-secondary-100",
|
|
432
|
+
isEntering && "es:motion-opacity-in es:motion-duration-300 es:motion-safe:data-[placement=left]:motion-translate-x-in-[5%] es:motion-safe:data-[placement=right]:-motion-translate-x-in-[5%] es:motion-safe:data-[placement=top]:motion-translate-y-in-[5%] es:motion-safe:data-[placement=bottom]:-motion-translate-y-in-[5%] es:motion-ease-spring-smooth es:motion-ease-linear/opacity",
|
|
433
|
+
isExiting && "es:motion-opacity-out es:motion-duration-200 es:motion-safe:data-[placement=left]:motion-translate-x-out-[12.5%] es:motion-safe:data-[placement=right]:motion-translate-x-out-[-12.5%] es:motion-safe:data-[placement=top]:motion-translate-y-out-[12.5%] es:motion-safe:data-[placement=bottom]:motion-translate-y-out-[-12.5%] es:motion-ease-spring-smooth es:motion-ease-linear/opacity",
|
|
434
|
+
className
|
|
435
|
+
),
|
|
436
|
+
children: [
|
|
437
|
+
arrow && /* @__PURE__ */ jsx($44f671af83e7d9e0$export$746d02f47f4d381, { children: /* @__PURE__ */ jsx(
|
|
438
|
+
"svg",
|
|
439
|
+
{
|
|
440
|
+
width: 8,
|
|
441
|
+
height: 8,
|
|
442
|
+
viewBox: "0 0 8 8",
|
|
443
|
+
className: clsx(
|
|
444
|
+
"es:m-px es:stroke-none es:drop-shadow-sm",
|
|
445
|
+
"es:pointer-events-none",
|
|
446
|
+
theme === "light" && "es:fill-secondary-200",
|
|
447
|
+
theme === "dark" && "es:fill-secondary-600",
|
|
448
|
+
"es:group-data-[placement=left]:-rotate-90 es:group-data-[placement=right]:rotate-90 es:group-data-[placement=bottom]:rotate-180",
|
|
449
|
+
"es:forced-colors:fill-[Canvas] es:forced-colors:stroke-[ButtonBorder]"
|
|
450
|
+
),
|
|
451
|
+
children: /* @__PURE__ */ jsx("path", { d: "M0 0 L4 4 L8 0" })
|
|
452
|
+
}
|
|
453
|
+
) }),
|
|
454
|
+
text
|
|
455
|
+
]
|
|
456
|
+
}
|
|
457
|
+
)
|
|
458
|
+
]
|
|
459
|
+
}
|
|
460
|
+
);
|
|
461
|
+
};
|
|
462
|
+
/**
|
|
463
|
+
* A "decorative" tooltip than can be used with element that usually don't support tooltips.
|
|
464
|
+
* Usually the only elements that support tooltips are interactive elements like buttons or links.
|
|
465
|
+
*
|
|
466
|
+
* This component will wrap the element and add the tooltip functionality to it.
|
|
467
|
+
* The tooltip will be shown when the element is hovered or anything within is focused.
|
|
468
|
+
*
|
|
469
|
+
* **Note**: This is not officially supported by the ARIA spec, so use with caution.
|
|
470
|
+
*
|
|
471
|
+
* @see {@link Tooltip} before using this component.
|
|
472
|
+
*
|
|
473
|
+
* @component
|
|
474
|
+
* @param {Object} props - Component props.
|
|
475
|
+
* @param {string|JSX.Element} props.text - The text to display in the tooltip.
|
|
476
|
+
* @param {TooltipTheme} [props.theme='dark'] - The theme of the tooltip.
|
|
477
|
+
* @param {number} [props.offset=0] - Additional offset between the tooltip and the element on the main axis (same axis as element).
|
|
478
|
+
* @param {number} [props.crossOffset=0] - Additional offset between the tooltip and the element on the cross axis (opposite axis as element).
|
|
479
|
+
* @param {number} [props.containerPadding=12] - Space that should be left between the tooltip and the main containing element (usually browser window).
|
|
480
|
+
* @param {number} [props.openDelay=1500] - Duration before the tooltip is shown, in milliseconds.
|
|
481
|
+
* @param {number} [props.closeDelay=500] - Duration before the tooltip is hidden, in milliseconds.
|
|
482
|
+
* @param {boolean} [props.shouldFlip=true] - If `false`, the tooltip will not flip to the opposite side if there is not enough space.
|
|
483
|
+
* @param {TooltipPlacement} [props.placement] - The side of the trigger element where the tooltip will be displayed.
|
|
484
|
+
* @param {string} [props.className] - Classes to pass to the tooltip.
|
|
485
|
+
* @param {string} [props.wrapperClassName] - Classes to pass to the tooltip wrapper (if `doNotReplaceChild` is `false`).
|
|
486
|
+
* @param {boolean} [props.arrow] - If `true`, an arrow is shown on the tooltip.
|
|
487
|
+
*
|
|
488
|
+
* @returns {JSX.Element} The DecorativeTooltip component.
|
|
489
|
+
*
|
|
490
|
+
* @typedef {'light' | 'dark'} TooltipTheme
|
|
491
|
+
* @typedef {'bottom' | 'bottom left' | 'bottom right' | 'bottom start' | 'bottom end' | 'top' | 'top left' | 'top right' | 'top start' | 'top end' | 'left' | 'left top' | 'left bottom' | 'start' | 'start top' | 'start bottom' | 'right' | 'right top' | 'right bottom' | 'end' | 'end top' | 'end bottom'} TooltipPlacement
|
|
492
|
+
*
|
|
493
|
+
* @example
|
|
494
|
+
* <DecorativeTooltip text='My tooltip'>
|
|
495
|
+
* <span>Hover me</span>
|
|
496
|
+
* </DecorativeTooltip>
|
|
497
|
+
*
|
|
498
|
+
* @preserve
|
|
499
|
+
*/
|
|
500
|
+
const DecorativeTooltip = (props) => {
|
|
501
|
+
const { openDelay, closeDelay, children, text, wrapperClassName, ...rest } = props;
|
|
502
|
+
const state = $8796f90736e175cb$export$4d40659c25ecb50b(props);
|
|
503
|
+
const ref = useRef(null);
|
|
504
|
+
const { triggerProps } = $4e1b34546679e357$export$a6da6c504e4bba8b(props, state, ref);
|
|
505
|
+
return /* @__PURE__ */ jsx(
|
|
506
|
+
Tooltip2,
|
|
507
|
+
{
|
|
508
|
+
triggerRef: ref,
|
|
509
|
+
text,
|
|
510
|
+
open: state.isOpen,
|
|
511
|
+
...rest,
|
|
512
|
+
children: /* @__PURE__ */ jsx(
|
|
513
|
+
"div",
|
|
514
|
+
{
|
|
515
|
+
ref,
|
|
516
|
+
...triggerProps,
|
|
517
|
+
className: wrapperClassName,
|
|
518
|
+
children
|
|
519
|
+
}
|
|
520
|
+
)
|
|
521
|
+
}
|
|
522
|
+
);
|
|
523
|
+
};
|
|
524
|
+
export {
|
|
525
|
+
DecorativeTooltip,
|
|
526
|
+
Tooltip2 as Tooltip
|
|
527
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React__default, { useState, useEffect, useContext } from "react";
|
|
2
|
+
import { n as $b5e257d569688ac6$export$535bd6ca7f90a273 } from "./utils-B94NDG0v.js";
|
|
3
|
+
const $148a7a147e38ea7f$var$RTL_SCRIPTS = /* @__PURE__ */ new Set([
|
|
4
|
+
"Arab",
|
|
5
|
+
"Syrc",
|
|
6
|
+
"Samr",
|
|
7
|
+
"Mand",
|
|
8
|
+
"Thaa",
|
|
9
|
+
"Mend",
|
|
10
|
+
"Nkoo",
|
|
11
|
+
"Adlm",
|
|
12
|
+
"Rohg",
|
|
13
|
+
"Hebr"
|
|
14
|
+
]);
|
|
15
|
+
const $148a7a147e38ea7f$var$RTL_LANGS = /* @__PURE__ */ new Set([
|
|
16
|
+
"ae",
|
|
17
|
+
"ar",
|
|
18
|
+
"arc",
|
|
19
|
+
"bcc",
|
|
20
|
+
"bqi",
|
|
21
|
+
"ckb",
|
|
22
|
+
"dv",
|
|
23
|
+
"fa",
|
|
24
|
+
"glk",
|
|
25
|
+
"he",
|
|
26
|
+
"ku",
|
|
27
|
+
"mzn",
|
|
28
|
+
"nqo",
|
|
29
|
+
"pnb",
|
|
30
|
+
"ps",
|
|
31
|
+
"sd",
|
|
32
|
+
"ug",
|
|
33
|
+
"ur",
|
|
34
|
+
"yi"
|
|
35
|
+
]);
|
|
36
|
+
function $148a7a147e38ea7f$export$702d680b21cbd764(localeString) {
|
|
37
|
+
if (Intl.Locale) {
|
|
38
|
+
let locale = new Intl.Locale(localeString).maximize();
|
|
39
|
+
let textInfo = typeof locale.getTextInfo === "function" ? locale.getTextInfo() : locale.textInfo;
|
|
40
|
+
if (textInfo) return textInfo.direction === "rtl";
|
|
41
|
+
if (locale.script) return $148a7a147e38ea7f$var$RTL_SCRIPTS.has(locale.script);
|
|
42
|
+
}
|
|
43
|
+
let lang = localeString.split("-")[0];
|
|
44
|
+
return $148a7a147e38ea7f$var$RTL_LANGS.has(lang);
|
|
45
|
+
}
|
|
46
|
+
const $1e5a04cdaf7d1af8$var$localeSymbol = Symbol.for("react-aria.i18n.locale");
|
|
47
|
+
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5() {
|
|
48
|
+
let locale = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
|
|
49
|
+
try {
|
|
50
|
+
Intl.DateTimeFormat.supportedLocalesOf([
|
|
51
|
+
locale
|
|
52
|
+
]);
|
|
53
|
+
} catch {
|
|
54
|
+
locale = "en-US";
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
locale,
|
|
58
|
+
direction: $148a7a147e38ea7f$export$702d680b21cbd764(locale) ? "rtl" : "ltr"
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
let $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
|
|
62
|
+
let $1e5a04cdaf7d1af8$var$listeners = /* @__PURE__ */ new Set();
|
|
63
|
+
function $1e5a04cdaf7d1af8$var$updateLocale() {
|
|
64
|
+
$1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
|
|
65
|
+
for (let listener of $1e5a04cdaf7d1af8$var$listeners) listener($1e5a04cdaf7d1af8$var$currentLocale);
|
|
66
|
+
}
|
|
67
|
+
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a() {
|
|
68
|
+
let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273();
|
|
69
|
+
let [defaultLocale, setDefaultLocale] = useState($1e5a04cdaf7d1af8$var$currentLocale);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
|
|
72
|
+
$1e5a04cdaf7d1af8$var$listeners.add(setDefaultLocale);
|
|
73
|
+
return () => {
|
|
74
|
+
$1e5a04cdaf7d1af8$var$listeners.delete(setDefaultLocale);
|
|
75
|
+
if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
|
|
76
|
+
};
|
|
77
|
+
}, []);
|
|
78
|
+
if (isSSR) return {
|
|
79
|
+
locale: "en-US",
|
|
80
|
+
direction: "ltr"
|
|
81
|
+
};
|
|
82
|
+
return defaultLocale;
|
|
83
|
+
}
|
|
84
|
+
const $18f2051aff69b9bf$var$I18nContext = /* @__PURE__ */ React__default.createContext(null);
|
|
85
|
+
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7() {
|
|
86
|
+
let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a();
|
|
87
|
+
let context = useContext($18f2051aff69b9bf$var$I18nContext);
|
|
88
|
+
return context || defaultLocale;
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
$18f2051aff69b9bf$export$43bb16f9c6d9e3f7 as $
|
|
92
|
+
};
|