@wix/editor-react-components 1.2774.0 → 1.2776.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/site/components/AudioPlayer/component.js +5 -4
- package/dist/site/components/Breadcrumbs/component.js +1 -1
- package/dist/site/components/Button/component.js +1 -1
- package/dist/site/components/Checkbox/component.js +1 -1
- package/dist/site/components/CheckboxGroup/component.js +1 -1
- package/dist/site/components/CollapsibleText/component.js +1 -1
- package/dist/site/components/DatePicker/component.js +622 -7
- package/dist/site/components/Lottie/component.js +1 -1
- package/dist/site/components/Menu/component.js +1 -1
- package/dist/site/components/RadioButtons/component.js +1 -1
- package/dist/site/components/Slideshow/component.js +1 -1
- package/dist/site/components/TextBox/component.js +1 -1
- package/dist/site/components/TextInput/component.js +3 -2
- package/dist/site/components/TextMarquee/component.js +6 -6
- package/dist/site/components/TimePicker/TimePicker.types.d.ts +14 -39
- package/dist/site/components/TimePicker/component.js +81 -547
- package/dist/site/components/TimePicker/component.preview.d.ts +7 -2
- package/dist/site/components/TimePicker/components/TimePickerField.d.ts +1 -2
- package/dist/site/components/TimePicker/constants.d.ts +35 -68
- package/dist/site/components/TimePicker/css.css +17 -169
- package/dist/site/components/TimePicker/hooks/useTimePickerValue.d.ts +3 -5
- package/dist/site/components/TimePicker/manifest.js +246 -152
- package/dist/site/components/TimePicker/timePickerUtils.d.ts +8 -8
- package/dist/site/components/chunks/Button.js +466 -1055
- package/dist/site/components/chunks/Button2.js +284 -471
- package/dist/site/components/chunks/DateField.js +51 -673
- package/dist/site/components/chunks/Group.js +46 -160
- package/dist/site/components/chunks/I18nProvider.js +1 -1
- package/dist/site/components/chunks/Input.js +2 -2
- package/dist/site/components/chunks/constants2.js +40 -70
- package/dist/site/components/chunks/constants27.js +1 -1
- package/dist/site/components/chunks/filterDOMProps.js +13 -13
- package/dist/site/components/chunks/useFocusable.js +70 -0
- package/dist/site/components/chunks/usePress.js +825 -0
- package/package.json +2 -2
- package/dist/site/components/TimePicker/hooks/useTimeConstraints.d.ts +0 -8
- package/dist/site/components/chunks/VisuallyHidden.js +0 -47
- package/dist/site/components/chunks/{RequiredIndicator.js → useValidatedField.js} +19 -19
|
@@ -1,557 +1,135 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import React__default, { useContext, useState, useMemo, useRef, useEffect, forwardRef, createContext } from "react";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
2
|
import { c as clsx } from "../chunks/clsx.js";
|
|
5
|
-
import { $ as $
|
|
6
|
-
import { $ as $72abaeab4d80592f$export$9fc1347d4195ccb3, a as $f11fb0bcf1b2687a$export$61c6a8c84e605fb6, b as $d3f049242431219c$export$45fda7c47f93fd48, c as $b3526bc71400be8d$export$d39e1813b3bdd0e1, d as $d3f049242431219c$export$6d3443f2c48bfc20, e as $44f671af83e7d9e0$export$2de4954e8ae13b9f, f as $58246871e4652552$export$c9698ec7f05a07e1, g as $40825cdb76e74f70$export$7edc06cf1783b30f, h as $40825cdb76e74f70$export$336ab7fa954c4b5f, i as $40825cdb76e74f70$export$5eaee2322dd727eb } from "../chunks/DateField.js";
|
|
3
|
+
import { $ as $58246871e4652552$export$c9698ec7f05a07e1, a as $40825cdb76e74f70$export$7edc06cf1783b30f, b as $40825cdb76e74f70$export$336ab7fa954c4b5f, c as $40825cdb76e74f70$export$5eaee2322dd727eb } from "../chunks/DateField.js";
|
|
7
4
|
import { $ as $514c0188e459b4c0$export$5f1af8db9871e1d6, a as $ee014567cb39d3f0$export$f551688fc98f2e09 } from "../chunks/Input.js";
|
|
8
|
-
import { $ as $
|
|
9
|
-
import { $ as $c7eafbbe1ea5834e$export$535bd6ca7f90a273, a as $8e9d2fae0ecb9001$export$457c3d6518dd4c6f, b as $64fa3d84918910a7$export$2881499e37b75b9a, c as $64fa3d84918910a7$export$29f1550f4b0d4415, d as $64fa3d84918910a7$export$4d86445c2cf5e3, e as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../chunks/filterDOMProps.js";
|
|
10
|
-
import __rspack_external_react_dom_7136dc57__default from "react-dom";
|
|
5
|
+
import { $ as $a049562f99e7db0e$export$eb2fcfdbd7ba97d4, a as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../chunks/Group.js";
|
|
11
6
|
import { $ as $2eb8e6d23f3d0cb0$export$a54013f0d02a8f82 } from "../chunks/I18nProvider.js";
|
|
12
7
|
import { useService } from "@wix/services-manager-react";
|
|
13
8
|
import { E as EnvironmentDefinition } from "../chunks/index2.js";
|
|
14
9
|
import { T as TranslationsDefinition } from "../chunks/index4.js";
|
|
15
10
|
import { a as getDataAttributes } from "../chunks/dataUtils.js";
|
|
16
|
-
import { g as getTranslation } from "../chunks/getTranslation.js";
|
|
17
11
|
import { d as directionStyles } from "../chunks/direction.module.js";
|
|
18
12
|
import { p as presetWrapperStyles } from "../chunks/presetWrapper.module.js";
|
|
19
|
-
import {
|
|
20
|
-
import { u as useValidatedField, R as RequiredIndicator, I as InfoCircleSmall_default } from "../chunks/RequiredIndicator.js";
|
|
21
|
-
const $c07df45195231803$var$Context = /* @__PURE__ */ React__default.createContext(null);
|
|
22
|
-
function $c07df45195231803$export$178405afcd8c5eb(props) {
|
|
23
|
-
let { children } = props;
|
|
24
|
-
let parent = useContext($c07df45195231803$var$Context);
|
|
25
|
-
let [modalCount, setModalCount] = useState(0);
|
|
26
|
-
let context = useMemo(() => ({
|
|
27
|
-
parent,
|
|
28
|
-
modalCount,
|
|
29
|
-
addModal() {
|
|
30
|
-
setModalCount((count) => count + 1);
|
|
31
|
-
if (parent) parent.addModal();
|
|
32
|
-
},
|
|
33
|
-
removeModal() {
|
|
34
|
-
setModalCount((count) => count - 1);
|
|
35
|
-
if (parent) parent.removeModal();
|
|
36
|
-
}
|
|
37
|
-
}), [
|
|
38
|
-
parent,
|
|
39
|
-
modalCount
|
|
40
|
-
]);
|
|
41
|
-
return /* @__PURE__ */ React__default.createElement($c07df45195231803$var$Context.Provider, {
|
|
42
|
-
value: context
|
|
43
|
-
}, children);
|
|
44
|
-
}
|
|
45
|
-
function $c07df45195231803$export$d9aaed4c3ece1bc0() {
|
|
46
|
-
let context = useContext($c07df45195231803$var$Context);
|
|
47
|
-
return {
|
|
48
|
-
modalProviderProps: {
|
|
49
|
-
"aria-hidden": context && context.modalCount > 0 ? true : void 0
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function $c07df45195231803$var$OverlayContainerDOM(props) {
|
|
54
|
-
let { modalProviderProps } = $c07df45195231803$export$d9aaed4c3ece1bc0();
|
|
55
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
|
56
|
-
"data-overlay-container": true,
|
|
57
|
-
...props,
|
|
58
|
-
...modalProviderProps
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
function $c07df45195231803$export$bf688221f59024e5(props) {
|
|
62
|
-
return /* @__PURE__ */ React__default.createElement($c07df45195231803$export$178405afcd8c5eb, null, /* @__PURE__ */ React__default.createElement($c07df45195231803$var$OverlayContainerDOM, props));
|
|
63
|
-
}
|
|
64
|
-
function $c07df45195231803$export$b47c3594eab58386(props) {
|
|
65
|
-
let isSSR = $c7eafbbe1ea5834e$export$535bd6ca7f90a273();
|
|
66
|
-
let { portalContainer = isSSR ? null : document.body, ...rest } = props;
|
|
67
|
-
let { getContainer } = $72abaeab4d80592f$export$9fc1347d4195ccb3();
|
|
68
|
-
if (!props.portalContainer && getContainer) portalContainer = getContainer();
|
|
69
|
-
React__default.useEffect(() => {
|
|
70
|
-
if (portalContainer == null ? void 0 : portalContainer.closest("[data-overlay-container]")) throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
|
|
71
|
-
}, [
|
|
72
|
-
portalContainer
|
|
73
|
-
]);
|
|
74
|
-
if (!portalContainer) return null;
|
|
75
|
-
let contents = /* @__PURE__ */ React__default.createElement($c07df45195231803$export$bf688221f59024e5, rest);
|
|
76
|
-
return /* @__PURE__ */ __rspack_external_react_dom_7136dc57__default.createPortal(contents, portalContainer);
|
|
77
|
-
}
|
|
78
|
-
function $8c383cffc84c9982$export$1c4b08e0eca38426(props, state) {
|
|
79
|
-
let domProps = $8e9d2fae0ecb9001$export$457c3d6518dd4c6f(props, {
|
|
80
|
-
labelable: true
|
|
81
|
-
});
|
|
82
|
-
let { hoverProps } = $e969f22b6713ca4a$export$ae780daf29e6d456({
|
|
83
|
-
onHoverStart: () => state == null ? void 0 : state.open(true),
|
|
84
|
-
onHoverEnd: () => state == null ? void 0 : state.close()
|
|
85
|
-
});
|
|
86
|
-
return {
|
|
87
|
-
tooltipProps: $bbaa08b3cd72f041$export$9d1611c77c2fe928(domProps, hoverProps, {
|
|
88
|
-
role: "tooltip"
|
|
89
|
-
})
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
function $85908aa8a35f0fac$export$a6da6c504e4bba8b(props, state, ref) {
|
|
93
|
-
let { isDisabled, trigger, shouldCloseOnPress = true } = props;
|
|
94
|
-
let tooltipId = $390e54f620492c70$export$f680877a34711e37();
|
|
95
|
-
let isHovered = useRef(false);
|
|
96
|
-
let isFocused = useRef(false);
|
|
97
|
-
let handleShow = () => {
|
|
98
|
-
if (isHovered.current || isFocused.current) state.open(isFocused.current);
|
|
99
|
-
};
|
|
100
|
-
let handleHide = (immediate) => {
|
|
101
|
-
if (!isHovered.current && !isFocused.current) state.close(immediate);
|
|
102
|
-
};
|
|
103
|
-
useEffect(() => {
|
|
104
|
-
let onKeyDown = (e) => {
|
|
105
|
-
if (ref && ref.current) {
|
|
106
|
-
if (e.key === "Escape") {
|
|
107
|
-
e.stopPropagation();
|
|
108
|
-
state.close(true);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
if (state.isOpen) {
|
|
113
|
-
document.addEventListener("keydown", onKeyDown, true);
|
|
114
|
-
return () => {
|
|
115
|
-
document.removeEventListener("keydown", onKeyDown, true);
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
}, [
|
|
119
|
-
ref,
|
|
120
|
-
state
|
|
121
|
-
]);
|
|
122
|
-
let onHoverStart = () => {
|
|
123
|
-
if (trigger === "focus") return;
|
|
124
|
-
if ($8f5a2122b0992be3$export$630ff653c5ada6a9() === "pointer") isHovered.current = true;
|
|
125
|
-
else isHovered.current = false;
|
|
126
|
-
handleShow();
|
|
127
|
-
};
|
|
128
|
-
let onHoverEnd = () => {
|
|
129
|
-
if (trigger === "focus") return;
|
|
130
|
-
isFocused.current = false;
|
|
131
|
-
isHovered.current = false;
|
|
132
|
-
handleHide();
|
|
133
|
-
};
|
|
134
|
-
let onPressStart = () => {
|
|
135
|
-
if (!shouldCloseOnPress) return;
|
|
136
|
-
isFocused.current = false;
|
|
137
|
-
isHovered.current = false;
|
|
138
|
-
handleHide(true);
|
|
139
|
-
};
|
|
140
|
-
let onFocus = () => {
|
|
141
|
-
let isVisible = $8f5a2122b0992be3$export$b9b3dfddab17db27();
|
|
142
|
-
if (isVisible) {
|
|
143
|
-
isFocused.current = true;
|
|
144
|
-
handleShow();
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
let onBlur = () => {
|
|
148
|
-
isFocused.current = false;
|
|
149
|
-
isHovered.current = false;
|
|
150
|
-
handleHide(true);
|
|
151
|
-
};
|
|
152
|
-
let { hoverProps } = $e969f22b6713ca4a$export$ae780daf29e6d456({
|
|
153
|
-
isDisabled,
|
|
154
|
-
onHoverStart,
|
|
155
|
-
onHoverEnd
|
|
156
|
-
});
|
|
157
|
-
let { focusableProps } = $d1116acdf220c2da$export$4c014de7c8940b4c({
|
|
158
|
-
isDisabled,
|
|
159
|
-
onFocus,
|
|
160
|
-
onBlur
|
|
161
|
-
}, ref);
|
|
162
|
-
return {
|
|
163
|
-
triggerProps: {
|
|
164
|
-
"aria-describedby": state.isOpen ? tooltipId : void 0,
|
|
165
|
-
...$bbaa08b3cd72f041$export$9d1611c77c2fe928(focusableProps, hoverProps, {
|
|
166
|
-
onPointerDown: onPressStart,
|
|
167
|
-
onKeyDown: onPressStart
|
|
168
|
-
}),
|
|
169
|
-
tabIndex: void 0
|
|
170
|
-
},
|
|
171
|
-
tooltipProps: {
|
|
172
|
-
id: tooltipId
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
const $3834487504f4fc00$var$TOOLTIP_DELAY = 1500;
|
|
177
|
-
const $3834487504f4fc00$var$TOOLTIP_COOLDOWN = 500;
|
|
178
|
-
let $3834487504f4fc00$var$tooltips = {};
|
|
179
|
-
let $3834487504f4fc00$var$tooltipId = 0;
|
|
180
|
-
let $3834487504f4fc00$var$globalWarmedUp = false;
|
|
181
|
-
let $3834487504f4fc00$var$globalWarmUpTimeout = null;
|
|
182
|
-
let $3834487504f4fc00$var$globalCooldownTimeout = null;
|
|
183
|
-
function $3834487504f4fc00$export$4d40659c25ecb50b(props = {}) {
|
|
184
|
-
let { delay = $3834487504f4fc00$var$TOOLTIP_DELAY, closeDelay = $3834487504f4fc00$var$TOOLTIP_COOLDOWN } = props;
|
|
185
|
-
let { isOpen, open, close } = $f11fb0bcf1b2687a$export$61c6a8c84e605fb6(props);
|
|
186
|
-
let id = useMemo(() => `${++$3834487504f4fc00$var$tooltipId}`, []);
|
|
187
|
-
let closeTimeout = useRef(null);
|
|
188
|
-
let closeCallback = useRef(close);
|
|
189
|
-
let ensureTooltipEntry = () => {
|
|
190
|
-
$3834487504f4fc00$var$tooltips[id] = hideTooltip;
|
|
191
|
-
};
|
|
192
|
-
let closeOpenTooltips = () => {
|
|
193
|
-
for (let hideTooltipId in $3834487504f4fc00$var$tooltips) if (hideTooltipId !== id) {
|
|
194
|
-
$3834487504f4fc00$var$tooltips[hideTooltipId](true);
|
|
195
|
-
delete $3834487504f4fc00$var$tooltips[hideTooltipId];
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
let showTooltip = () => {
|
|
199
|
-
if (closeTimeout.current) clearTimeout(closeTimeout.current);
|
|
200
|
-
closeTimeout.current = null;
|
|
201
|
-
closeOpenTooltips();
|
|
202
|
-
ensureTooltipEntry();
|
|
203
|
-
$3834487504f4fc00$var$globalWarmedUp = true;
|
|
204
|
-
open();
|
|
205
|
-
if ($3834487504f4fc00$var$globalWarmUpTimeout) {
|
|
206
|
-
clearTimeout($3834487504f4fc00$var$globalWarmUpTimeout);
|
|
207
|
-
$3834487504f4fc00$var$globalWarmUpTimeout = null;
|
|
208
|
-
}
|
|
209
|
-
if ($3834487504f4fc00$var$globalCooldownTimeout) {
|
|
210
|
-
clearTimeout($3834487504f4fc00$var$globalCooldownTimeout);
|
|
211
|
-
$3834487504f4fc00$var$globalCooldownTimeout = null;
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
let hideTooltip = (immediate) => {
|
|
215
|
-
if (immediate || closeDelay <= 0) {
|
|
216
|
-
if (closeTimeout.current) clearTimeout(closeTimeout.current);
|
|
217
|
-
closeTimeout.current = null;
|
|
218
|
-
closeCallback.current();
|
|
219
|
-
} else if (!closeTimeout.current) closeTimeout.current = setTimeout(() => {
|
|
220
|
-
closeTimeout.current = null;
|
|
221
|
-
closeCallback.current();
|
|
222
|
-
}, closeDelay);
|
|
223
|
-
if ($3834487504f4fc00$var$globalWarmUpTimeout) {
|
|
224
|
-
clearTimeout($3834487504f4fc00$var$globalWarmUpTimeout);
|
|
225
|
-
$3834487504f4fc00$var$globalWarmUpTimeout = null;
|
|
226
|
-
}
|
|
227
|
-
if ($3834487504f4fc00$var$globalWarmedUp) {
|
|
228
|
-
if ($3834487504f4fc00$var$globalCooldownTimeout) clearTimeout($3834487504f4fc00$var$globalCooldownTimeout);
|
|
229
|
-
$3834487504f4fc00$var$globalCooldownTimeout = setTimeout(() => {
|
|
230
|
-
delete $3834487504f4fc00$var$tooltips[id];
|
|
231
|
-
$3834487504f4fc00$var$globalCooldownTimeout = null;
|
|
232
|
-
$3834487504f4fc00$var$globalWarmedUp = false;
|
|
233
|
-
}, Math.max($3834487504f4fc00$var$TOOLTIP_COOLDOWN, closeDelay));
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
let warmupTooltip = () => {
|
|
237
|
-
closeOpenTooltips();
|
|
238
|
-
ensureTooltipEntry();
|
|
239
|
-
if (!isOpen && !$3834487504f4fc00$var$globalWarmedUp) {
|
|
240
|
-
if ($3834487504f4fc00$var$globalWarmUpTimeout) clearTimeout($3834487504f4fc00$var$globalWarmUpTimeout);
|
|
241
|
-
$3834487504f4fc00$var$globalWarmUpTimeout = setTimeout(() => {
|
|
242
|
-
$3834487504f4fc00$var$globalWarmUpTimeout = null;
|
|
243
|
-
$3834487504f4fc00$var$globalWarmedUp = true;
|
|
244
|
-
showTooltip();
|
|
245
|
-
}, delay);
|
|
246
|
-
} else if (!isOpen) showTooltip();
|
|
247
|
-
};
|
|
248
|
-
useEffect(() => {
|
|
249
|
-
closeCallback.current = close;
|
|
250
|
-
}, [
|
|
251
|
-
close
|
|
252
|
-
]);
|
|
253
|
-
useEffect(() => {
|
|
254
|
-
return () => {
|
|
255
|
-
if (closeTimeout.current) clearTimeout(closeTimeout.current);
|
|
256
|
-
let tooltip2 = $3834487504f4fc00$var$tooltips[id];
|
|
257
|
-
if (tooltip2) delete $3834487504f4fc00$var$tooltips[id];
|
|
258
|
-
};
|
|
259
|
-
}, [
|
|
260
|
-
id
|
|
261
|
-
]);
|
|
262
|
-
return {
|
|
263
|
-
isOpen,
|
|
264
|
-
open: (immediate) => {
|
|
265
|
-
if (!immediate && delay > 0 && !closeTimeout.current) warmupTooltip();
|
|
266
|
-
else showTooltip();
|
|
267
|
-
},
|
|
268
|
-
close: hideTooltip
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
const $4e3b923658d69c60$export$7a7623236eec67fa = /* @__PURE__ */ createContext(null);
|
|
272
|
-
const $4e3b923658d69c60$export$39ae08fa83328b12 = /* @__PURE__ */ createContext(null);
|
|
273
|
-
function $4e3b923658d69c60$export$8c610744efcf8a1d(props) {
|
|
274
|
-
let state = $3834487504f4fc00$export$4d40659c25ecb50b(props);
|
|
275
|
-
let ref = useRef(null);
|
|
276
|
-
let { triggerProps, tooltipProps } = $85908aa8a35f0fac$export$a6da6c504e4bba8b(props, state, ref);
|
|
277
|
-
return /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
|
|
278
|
-
values: [
|
|
279
|
-
[
|
|
280
|
-
$4e3b923658d69c60$export$7a7623236eec67fa,
|
|
281
|
-
state
|
|
282
|
-
],
|
|
283
|
-
[
|
|
284
|
-
$4e3b923658d69c60$export$39ae08fa83328b12,
|
|
285
|
-
{
|
|
286
|
-
...tooltipProps,
|
|
287
|
-
triggerRef: ref
|
|
288
|
-
}
|
|
289
|
-
]
|
|
290
|
-
]
|
|
291
|
-
}, /* @__PURE__ */ React__default.createElement($d1116acdf220c2da$export$13f3202a3e5ddd5, {
|
|
292
|
-
...triggerProps,
|
|
293
|
-
ref
|
|
294
|
-
}, props.children));
|
|
295
|
-
}
|
|
296
|
-
const $4e3b923658d69c60$export$28c660c63b792dea = /* @__PURE__ */ forwardRef(function Tooltip({ UNSTABLE_portalContainer, ...props }, ref) {
|
|
297
|
-
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $4e3b923658d69c60$export$39ae08fa83328b12);
|
|
298
|
-
let contextState = useContext($4e3b923658d69c60$export$7a7623236eec67fa);
|
|
299
|
-
let localState = $3834487504f4fc00$export$4d40659c25ecb50b(props);
|
|
300
|
-
let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;
|
|
301
|
-
let isExiting = $d3f049242431219c$export$45fda7c47f93fd48(ref, state.isOpen) || props.isExiting || false;
|
|
302
|
-
if (!state.isOpen && !isExiting) return null;
|
|
303
|
-
return /* @__PURE__ */ React__default.createElement($c07df45195231803$export$b47c3594eab58386, {
|
|
304
|
-
portalContainer: UNSTABLE_portalContainer
|
|
305
|
-
}, /* @__PURE__ */ React__default.createElement($4e3b923658d69c60$var$TooltipInner, {
|
|
306
|
-
...props,
|
|
307
|
-
tooltipRef: ref,
|
|
308
|
-
isExiting
|
|
309
|
-
}));
|
|
310
|
-
});
|
|
311
|
-
function $4e3b923658d69c60$var$TooltipInner(props) {
|
|
312
|
-
let state = useContext($4e3b923658d69c60$export$7a7623236eec67fa);
|
|
313
|
-
let arrowRef = useRef(null);
|
|
314
|
-
let { overlayProps, arrowProps, placement, triggerAnchorPoint } = $b3526bc71400be8d$export$d39e1813b3bdd0e1({
|
|
315
|
-
placement: props.placement || "top",
|
|
316
|
-
targetRef: props.triggerRef,
|
|
317
|
-
overlayRef: props.tooltipRef,
|
|
318
|
-
arrowRef,
|
|
319
|
-
offset: props.offset,
|
|
320
|
-
crossOffset: props.crossOffset,
|
|
321
|
-
isOpen: state.isOpen,
|
|
322
|
-
arrowBoundaryOffset: props.arrowBoundaryOffset,
|
|
323
|
-
shouldFlip: props.shouldFlip,
|
|
324
|
-
containerPadding: props.containerPadding,
|
|
325
|
-
onClose: () => state.close(true)
|
|
326
|
-
});
|
|
327
|
-
let isEntering = $d3f049242431219c$export$6d3443f2c48bfc20(props.tooltipRef, !!placement) || props.isEntering || false;
|
|
328
|
-
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
329
|
-
...props,
|
|
330
|
-
defaultClassName: "react-aria-Tooltip",
|
|
331
|
-
values: {
|
|
332
|
-
placement,
|
|
333
|
-
isEntering,
|
|
334
|
-
isExiting: props.isExiting,
|
|
335
|
-
state
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
props = $bbaa08b3cd72f041$export$9d1611c77c2fe928(props, overlayProps);
|
|
339
|
-
let { tooltipProps } = $8c383cffc84c9982$export$1c4b08e0eca38426(props, state);
|
|
340
|
-
let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
|
|
341
|
-
global: true
|
|
342
|
-
});
|
|
343
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
|
344
|
-
...$bbaa08b3cd72f041$export$9d1611c77c2fe928(DOMProps, renderProps, tooltipProps),
|
|
345
|
-
ref: props.tooltipRef,
|
|
346
|
-
style: {
|
|
347
|
-
...overlayProps.style,
|
|
348
|
-
"--trigger-anchor-point": triggerAnchorPoint ? `${triggerAnchorPoint.x}px ${triggerAnchorPoint.y}px` : void 0,
|
|
349
|
-
...renderProps.style
|
|
350
|
-
},
|
|
351
|
-
"data-placement": placement !== null && placement !== void 0 ? placement : void 0,
|
|
352
|
-
"data-entering": isEntering || void 0,
|
|
353
|
-
"data-exiting": props.isExiting || void 0
|
|
354
|
-
}, /* @__PURE__ */ React__default.createElement($44f671af83e7d9e0$export$2de4954e8ae13b9f.Provider, {
|
|
355
|
-
value: {
|
|
356
|
-
...arrowProps,
|
|
357
|
-
placement,
|
|
358
|
-
ref: arrowRef
|
|
359
|
-
}
|
|
360
|
-
}, renderProps.children));
|
|
361
|
-
}
|
|
362
|
-
const DismissSmall = ({ size, ...props }) => /* @__PURE__ */ React.createElement("svg", { viewBox: "0 0 18 18", fill: "currentColor", width: size || "18", height: size || "18", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M8.43933983,9.5 L6,7.06066017 C5.70710678,6.76776695 5.70710678,6.29289322 6,6 C6.29289322,5.70710678 6.76776695,5.70710678 7.06066017,6 L9.5,8.43933983 L11.9393398,6 C12.232233,5.70710678 12.7071068,5.70710678 13,6 C13.2928932,6.29289322 13.2928932,6.76776695 13,7.06066017 L10.5606602,9.5 L13,11.9393398 C13.2928932,12.232233 13.2928932,12.7071068 13,13 C12.7071068,13.2928932 12.232233,13.2928932 11.9393398,13 L9.5,10.5606602 L7.06066017,13 C6.76776695,13.2928932 6.29289322,13.2928932 6,13 C5.70710678,12.7071068 5.70710678,12.232233 6,11.9393398 L8.43933983,9.5 Z" }));
|
|
363
|
-
DismissSmall.displayName = "DismissSmall";
|
|
364
|
-
var DismissSmall_default = DismissSmall;
|
|
13
|
+
import { s as selectors, T as TestIds, D as DesignStates, a as DEFAULT_LOCALE, A as AriaLabels } from "../chunks/constants2.js";
|
|
365
14
|
const root = "root__dzkbY";
|
|
366
15
|
const timePicker = "timePicker__j78My";
|
|
367
|
-
const labelRow = "labelRow__qoC8g";
|
|
368
16
|
const label = "label__THO5j";
|
|
369
|
-
const tooltipButton = "tooltipButton__ISWIR";
|
|
370
|
-
const tooltip = "tooltip__FTZhM";
|
|
371
|
-
const group = "group__6HZy7";
|
|
372
|
-
const field = "field__mnQwh";
|
|
373
17
|
const description = "description__ePprf";
|
|
374
18
|
const errorMessage = "errorMessage__zxbOJ";
|
|
19
|
+
const group = "group__6HZy7";
|
|
20
|
+
const field = "field__mnQwh";
|
|
375
21
|
const segment = "segment__OtazP";
|
|
376
|
-
const clearButton = "clearButton__Bto7s";
|
|
377
|
-
const clearIcon = "clearIcon__x11eI";
|
|
378
22
|
const styles = {
|
|
379
23
|
root,
|
|
380
24
|
timePicker,
|
|
381
|
-
labelRow,
|
|
382
25
|
label,
|
|
383
|
-
tooltipButton,
|
|
384
|
-
tooltip,
|
|
385
|
-
group,
|
|
386
|
-
field,
|
|
387
26
|
description,
|
|
388
27
|
errorMessage,
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
28
|
+
group,
|
|
29
|
+
field,
|
|
30
|
+
segment
|
|
392
31
|
};
|
|
393
|
-
const
|
|
32
|
+
const readText = (prop, fallback) => typeof prop === "string" ? prop : fallback;
|
|
394
33
|
const readBool = (prop, fallback) => typeof prop === "boolean" ? prop : fallback;
|
|
395
|
-
const toTimeValue = (
|
|
396
|
-
if (!
|
|
34
|
+
const toTimeValue = (localTime) => {
|
|
35
|
+
if (!localTime) {
|
|
397
36
|
return null;
|
|
398
37
|
}
|
|
399
38
|
try {
|
|
400
|
-
return $58246871e4652552$export$c9698ec7f05a07e1(
|
|
39
|
+
return $58246871e4652552$export$c9698ec7f05a07e1(localTime.replace(/Z$/, ""));
|
|
401
40
|
} catch {
|
|
402
41
|
return null;
|
|
403
42
|
}
|
|
404
43
|
};
|
|
405
44
|
const pad = (n) => String(n).padStart(2, "0");
|
|
406
|
-
const
|
|
45
|
+
const toLocalTime = (time) => {
|
|
407
46
|
if (!time) {
|
|
408
|
-
return
|
|
47
|
+
return void 0;
|
|
409
48
|
}
|
|
410
49
|
const hoursAndMinutes = `${pad(time.hour)}:${pad(time.minute)}`;
|
|
411
|
-
return
|
|
50
|
+
return hoursAndMinutes;
|
|
412
51
|
};
|
|
413
52
|
const useTimePickerValue = (params) => {
|
|
414
|
-
const { value,
|
|
415
|
-
const
|
|
416
|
-
const [timeValue, setTimeValue] = useState(
|
|
417
|
-
() => toTimeValue(valueStr)
|
|
418
|
-
);
|
|
419
|
-
const syncSignature = `${valueStr}::${granularity}`;
|
|
420
|
-
const [prevSignature, setPrevSignature] = useState(syncSignature);
|
|
421
|
-
if (prevSignature !== syncSignature) {
|
|
422
|
-
setPrevSignature(syncSignature);
|
|
423
|
-
setTimeValue(toTimeValue(valueStr));
|
|
424
|
-
}
|
|
53
|
+
const { value, onValueChange } = params;
|
|
54
|
+
const timeValue = toTimeValue(value);
|
|
425
55
|
const handleChange = (next) => {
|
|
426
|
-
|
|
427
|
-
onChange(toIso(next, granularity));
|
|
56
|
+
onValueChange(toLocalTime(next));
|
|
428
57
|
};
|
|
429
58
|
return {
|
|
430
59
|
timeValue,
|
|
431
|
-
handleChange
|
|
432
|
-
// Key off the live parsed value, not the raw prop — a standalone picker
|
|
433
|
-
// updates `timeValue` internally while `props.value` may stay stale, so a
|
|
434
|
-
// prop-based check would keep the clear control / required error out of sync.
|
|
435
|
-
hasValue: Boolean(timeValue)
|
|
60
|
+
handleChange
|
|
436
61
|
};
|
|
437
62
|
};
|
|
438
|
-
const useTimeConstraints = (params) => {
|
|
439
|
-
const minTimeStr = readString(params.minTime);
|
|
440
|
-
const maxTimeStr = readString(params.maxTime);
|
|
441
|
-
return useMemo(
|
|
442
|
-
() => ({
|
|
443
|
-
minValue: toTimeValue(minTimeStr) ?? void 0,
|
|
444
|
-
maxValue: toTimeValue(maxTimeStr) ?? void 0
|
|
445
|
-
}),
|
|
446
|
-
[minTimeStr, maxTimeStr]
|
|
447
|
-
);
|
|
448
|
-
};
|
|
449
63
|
const TimePickerField = ({
|
|
450
|
-
clearButton: clearButton2,
|
|
451
64
|
elementProps
|
|
452
65
|
}) => {
|
|
453
|
-
var _a
|
|
66
|
+
var _a;
|
|
454
67
|
const segmentClassName = clsx(
|
|
455
68
|
styles.segment,
|
|
456
69
|
selectors.segment,
|
|
457
70
|
(_a = elementProps == null ? void 0 : elementProps.segment) == null ? void 0 : _a.className
|
|
458
71
|
);
|
|
459
|
-
const renderSegments = (seg) => /* @__PURE__ */ jsx(
|
|
460
|
-
|
|
72
|
+
const renderSegments = (seg) => /* @__PURE__ */ jsx(
|
|
73
|
+
$40825cdb76e74f70$export$336ab7fa954c4b5f,
|
|
74
|
+
{
|
|
75
|
+
segment: seg,
|
|
76
|
+
className: ({ isFocused }) => clsx(segmentClassName, {
|
|
77
|
+
[DesignStates.segment.focus.className]: isFocused
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
return /* @__PURE__ */ jsx(
|
|
461
82
|
$a049562f99e7db0e$export$eb2fcfdbd7ba97d4,
|
|
462
83
|
{
|
|
463
|
-
className:
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
84
|
+
className: ({ isHovered, isFocusWithin, isInvalid, isDisabled }) => {
|
|
85
|
+
var _a2;
|
|
86
|
+
return clsx(
|
|
87
|
+
styles.group,
|
|
88
|
+
selectors.group,
|
|
89
|
+
(_a2 = elementProps == null ? void 0 : elementProps.timeInput) == null ? void 0 : _a2.className,
|
|
90
|
+
{
|
|
91
|
+
[DesignStates.timeInput.hover.className]: isHovered && !isDisabled,
|
|
92
|
+
[DesignStates.timeInput.focus.className]: isFocusWithin,
|
|
93
|
+
[DesignStates.timeInput.error.className]: isInvalid,
|
|
94
|
+
[DesignStates.timeInput.disabled.className]: isDisabled
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
},
|
|
468
98
|
"data-testid": TestIds.group,
|
|
469
|
-
children:
|
|
470
|
-
/* @__PURE__ */ jsx($40825cdb76e74f70$export$7edc06cf1783b30f, { className: styles.field, "data-testid": TestIds.field, children: renderSegments }),
|
|
471
|
-
clearButton2
|
|
472
|
-
]
|
|
99
|
+
children: /* @__PURE__ */ jsx($40825cdb76e74f70$export$7edc06cf1783b30f, { className: styles.field, "data-testid": TestIds.field, children: renderSegments })
|
|
473
100
|
}
|
|
474
101
|
);
|
|
475
102
|
};
|
|
476
103
|
const noop = () => {
|
|
477
104
|
};
|
|
478
105
|
function TimePicker(props) {
|
|
479
|
-
var _a, _b;
|
|
106
|
+
var _a, _b, _c;
|
|
480
107
|
const environmentService = useService(EnvironmentDefinition);
|
|
481
108
|
const { translate } = useService(TranslationsDefinition);
|
|
482
|
-
const
|
|
483
|
-
const t = (key) => getTranslation(translateByKey, key, TranslationKeys, DefaultTranslations);
|
|
109
|
+
const locale = environmentService.language || DEFAULT_LOCALE;
|
|
484
110
|
const {
|
|
485
111
|
id,
|
|
486
112
|
className = "",
|
|
487
|
-
|
|
488
|
-
hourCycle = defaultValues.hourCycle,
|
|
489
|
-
shouldForceLeadingZeros = defaultValues.shouldForceLeadingZeros,
|
|
490
|
-
readOnly = defaultValues.readOnly,
|
|
491
|
-
clearable = defaultValues.clearable,
|
|
113
|
+
readOnly = false,
|
|
492
114
|
direction,
|
|
493
115
|
a11y,
|
|
494
|
-
|
|
495
|
-
onFocus = noop,
|
|
496
|
-
onBlur = noop,
|
|
497
|
-
fieldValidity,
|
|
498
|
-
showValidityIndication,
|
|
499
|
-
onValidate,
|
|
500
|
-
onValidityChange,
|
|
116
|
+
onValueChange = noop,
|
|
501
117
|
wix,
|
|
502
118
|
elementProps
|
|
503
119
|
} = props;
|
|
504
|
-
const label2 =
|
|
505
|
-
const
|
|
506
|
-
const
|
|
507
|
-
const
|
|
508
|
-
const
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
const { timeValue, handleChange, hasValue } = useTimePickerValue({
|
|
512
|
-
value: sourceValue,
|
|
513
|
-
onChange,
|
|
514
|
-
granularity
|
|
515
|
-
});
|
|
516
|
-
const intrinsic = isRequired && !hasValue ? { valid: false, validationMessage: VALUE_MISSING_MESSAGE } : { valid: true, validationMessage: "" };
|
|
517
|
-
const {
|
|
518
|
-
validity,
|
|
519
|
-
showValidityIndication: showIndication,
|
|
520
|
-
handleBlur: validateOnBlur
|
|
521
|
-
} = useValidatedField({
|
|
522
|
-
value: readString(props.value),
|
|
523
|
-
intrinsic,
|
|
524
|
-
fieldValidity,
|
|
525
|
-
showValidityIndication,
|
|
526
|
-
onValidate,
|
|
527
|
-
onValidityChange
|
|
120
|
+
const label2 = readText(props.label, "");
|
|
121
|
+
const helperText = readText(props.helperText, "");
|
|
122
|
+
const errorMessage2 = readText(props.errorMessage, "");
|
|
123
|
+
const disabled = readBool(props.disabled, false);
|
|
124
|
+
const { timeValue, handleChange } = useTimePickerValue({
|
|
125
|
+
value: props.value,
|
|
126
|
+
onValueChange
|
|
528
127
|
});
|
|
529
|
-
const isInvalid =
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
}
|
|
534
|
-
const { minValue, maxValue } = useTimeConstraints({
|
|
535
|
-
minTime: props.minTime,
|
|
536
|
-
maxTime: props.maxTime
|
|
537
|
-
});
|
|
538
|
-
const [portalContainer, setPortalContainer] = useState(
|
|
539
|
-
null
|
|
540
|
-
);
|
|
541
|
-
const locale = environmentService.language || "en-US";
|
|
542
|
-
const ariaLabel = (a11y == null ? void 0 : a11y.ariaLabel) || label2 || t("ariaLabel");
|
|
543
|
-
const showClear = clearable && hasValue && !isDisabled && !readOnly;
|
|
544
|
-
const clearButton2 = showClear ? /* @__PURE__ */ jsx(
|
|
545
|
-
"button",
|
|
546
|
-
{
|
|
547
|
-
type: "button",
|
|
548
|
-
className: styles.clearButton,
|
|
549
|
-
"data-testid": TestIds.clearButton,
|
|
550
|
-
"aria-label": t("clearButton"),
|
|
551
|
-
onClick: () => handleChange(null),
|
|
552
|
-
children: /* @__PURE__ */ jsx(DismissSmall_default, { "aria-hidden": true, className: styles.clearIcon })
|
|
553
|
-
}
|
|
554
|
-
) : null;
|
|
128
|
+
const isInvalid = Boolean(errorMessage2);
|
|
129
|
+
let ariaLabel = a11y == null ? void 0 : a11y.ariaLabel;
|
|
130
|
+
if (!ariaLabel && !label2) {
|
|
131
|
+
ariaLabel = translate("ariaLabels")(AriaLabels.root.key) || AriaLabels.root.default;
|
|
132
|
+
}
|
|
555
133
|
return /* @__PURE__ */ jsx(
|
|
556
134
|
"div",
|
|
557
135
|
{
|
|
@@ -561,7 +139,6 @@ function TimePicker(props) {
|
|
|
561
139
|
"div",
|
|
562
140
|
{
|
|
563
141
|
id,
|
|
564
|
-
ref: setPortalContainer,
|
|
565
142
|
...getDataAttributes(props),
|
|
566
143
|
className: clsx(
|
|
567
144
|
className,
|
|
@@ -578,89 +155,46 @@ function TimePicker(props) {
|
|
|
578
155
|
className: styles.timePicker,
|
|
579
156
|
value: timeValue,
|
|
580
157
|
onChange: handleChange,
|
|
581
|
-
granularity,
|
|
582
|
-
|
|
583
|
-
shouldForceLeadingZeros: shouldForceLeadingZeros || void 0,
|
|
584
|
-
minValue,
|
|
585
|
-
maxValue,
|
|
586
|
-
isDisabled,
|
|
158
|
+
granularity: "minute",
|
|
159
|
+
isDisabled: disabled,
|
|
587
160
|
isReadOnly: readOnly,
|
|
588
|
-
isRequired,
|
|
589
161
|
isInvalid,
|
|
590
162
|
"aria-label": ariaLabel,
|
|
591
|
-
onFocus,
|
|
592
|
-
onBlur: handleBlur,
|
|
593
163
|
children: [
|
|
594
|
-
label2
|
|
595
|
-
|
|
596
|
-
$01b77f81d0f07f68$export$b04be29aa201d4f5,
|
|
597
|
-
{
|
|
598
|
-
className: clsx(
|
|
599
|
-
styles.label,
|
|
600
|
-
selectors.label,
|
|
601
|
-
(_a = elementProps == null ? void 0 : elementProps.label) == null ? void 0 : _a.className
|
|
602
|
-
),
|
|
603
|
-
children: [
|
|
604
|
-
label2,
|
|
605
|
-
isRequired && /* @__PURE__ */ jsx(
|
|
606
|
-
RequiredIndicator,
|
|
607
|
-
{
|
|
608
|
-
className: selectors.requiredIndicator,
|
|
609
|
-
"data-testid": TestIds.requiredIndicator
|
|
610
|
-
}
|
|
611
|
-
)
|
|
612
|
-
]
|
|
613
|
-
}
|
|
614
|
-
) : null,
|
|
615
|
-
tooltip2 ? /* @__PURE__ */ jsxs($4e3b923658d69c60$export$8c610744efcf8a1d, { delay: 0, children: [
|
|
616
|
-
/* @__PURE__ */ jsx(
|
|
617
|
-
$d2b4bc8c273e7be6$export$353f5b6fc5456de1,
|
|
618
|
-
{
|
|
619
|
-
className: styles.tooltipButton,
|
|
620
|
-
"data-testid": TestIds.tooltipButton,
|
|
621
|
-
"aria-label": tooltip2,
|
|
622
|
-
children: /* @__PURE__ */ jsx(InfoCircleSmall_default, { "aria-hidden": "true" })
|
|
623
|
-
}
|
|
624
|
-
),
|
|
625
|
-
/* @__PURE__ */ jsx(
|
|
626
|
-
$4e3b923658d69c60$export$28c660c63b792dea,
|
|
627
|
-
{
|
|
628
|
-
className: styles.tooltip,
|
|
629
|
-
offset: 6,
|
|
630
|
-
UNSTABLE_portalContainer: portalContainer ?? void 0,
|
|
631
|
-
children: tooltip2
|
|
632
|
-
}
|
|
633
|
-
)
|
|
634
|
-
] }) : null
|
|
635
|
-
] }) : null,
|
|
636
|
-
/* @__PURE__ */ jsx(
|
|
637
|
-
TimePickerField,
|
|
164
|
+
label2 ? /* @__PURE__ */ jsx(
|
|
165
|
+
$01b77f81d0f07f68$export$b04be29aa201d4f5,
|
|
638
166
|
{
|
|
639
|
-
|
|
640
|
-
|
|
167
|
+
className: clsx(
|
|
168
|
+
styles.label,
|
|
169
|
+
selectors.label,
|
|
170
|
+
(_a = elementProps == null ? void 0 : elementProps.label) == null ? void 0 : _a.className
|
|
171
|
+
),
|
|
172
|
+
children: label2
|
|
641
173
|
}
|
|
642
|
-
),
|
|
643
|
-
|
|
174
|
+
) : null,
|
|
175
|
+
/* @__PURE__ */ jsx(TimePickerField, { elementProps }),
|
|
176
|
+
helperText ? /* @__PURE__ */ jsx(
|
|
644
177
|
$514c0188e459b4c0$export$5f1af8db9871e1d6,
|
|
645
178
|
{
|
|
646
179
|
slot: "description",
|
|
647
180
|
className: clsx(
|
|
648
181
|
styles.description,
|
|
649
182
|
selectors.description,
|
|
650
|
-
(_b = elementProps == null ? void 0 : elementProps.
|
|
183
|
+
(_b = elementProps == null ? void 0 : elementProps.helperText) == null ? void 0 : _b.className
|
|
651
184
|
),
|
|
652
|
-
children:
|
|
185
|
+
children: helperText
|
|
653
186
|
}
|
|
654
187
|
) : null,
|
|
655
|
-
|
|
188
|
+
errorMessage2 ? /* @__PURE__ */ jsx(
|
|
656
189
|
$ee014567cb39d3f0$export$f551688fc98f2e09,
|
|
657
190
|
{
|
|
658
191
|
className: clsx(
|
|
659
192
|
styles.errorMessage,
|
|
660
|
-
selectors.errorMessage
|
|
193
|
+
selectors.errorMessage,
|
|
194
|
+
(_c = elementProps == null ? void 0 : elementProps.errorMessage) == null ? void 0 : _c.className
|
|
661
195
|
),
|
|
662
196
|
"data-testid": TestIds.errorMessage,
|
|
663
|
-
children:
|
|
197
|
+
children: errorMessage2
|
|
664
198
|
}
|
|
665
199
|
) : null
|
|
666
200
|
]
|