@3gs/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/components/ActionSheet/ActionSheet.d.ts +40 -0
- package/dist/components/ActionSheet/index.d.ts +2 -0
- package/dist/components/Alert/Alert.d.ts +36 -0
- package/dist/components/Alert/index.d.ts +2 -0
- package/dist/components/Badge/Badge.d.ts +13 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Button/Button.d.ts +32 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/DatePicker/DatePicker.d.ts +57 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/HUD/HUD.d.ts +56 -0
- package/dist/components/HUD/index.d.ts +2 -0
- package/dist/components/Icon/Icon.d.ts +27 -0
- package/dist/components/Icon/index.d.ts +2 -0
- package/dist/components/Keyboard/Keyboard.d.ts +38 -0
- package/dist/components/Keyboard/index.d.ts +2 -0
- package/dist/components/List/List.d.ts +55 -0
- package/dist/components/List/index.d.ts +2 -0
- package/dist/components/ModalSheet/ModalSheet.d.ts +36 -0
- package/dist/components/ModalSheet/index.d.ts +2 -0
- package/dist/components/NavigationBar/NavigationBar.d.ts +41 -0
- package/dist/components/NavigationBar/index.d.ts +2 -0
- package/dist/components/NotificationBanner/NotificationBanner.d.ts +50 -0
- package/dist/components/NotificationBanner/index.d.ts +2 -0
- package/dist/components/PageControl/PageControl.d.ts +32 -0
- package/dist/components/PageControl/index.d.ts +2 -0
- package/dist/components/Picker/Picker.d.ts +45 -0
- package/dist/components/Picker/index.d.ts +2 -0
- package/dist/components/Popover/Popover.d.ts +40 -0
- package/dist/components/Popover/index.d.ts +2 -0
- package/dist/components/Progress/Progress.d.ts +37 -0
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/SearchBar/SearchBar.d.ts +61 -0
- package/dist/components/SearchBar/index.d.ts +2 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +50 -0
- package/dist/components/SegmentedControl/index.d.ts +2 -0
- package/dist/components/Slider/Slider.d.ts +39 -0
- package/dist/components/Slider/index.d.ts +2 -0
- package/dist/components/StatusBar/StatusBar.d.ts +24 -0
- package/dist/components/StatusBar/index.d.ts +2 -0
- package/dist/components/Stepper/Stepper.d.ts +55 -0
- package/dist/components/Stepper/index.d.ts +2 -0
- package/dist/components/Switch/Switch.d.ts +26 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/TabBar/TabBar.d.ts +33 -0
- package/dist/components/TabBar/index.d.ts +2 -0
- package/dist/components/TextField/TextField.d.ts +38 -0
- package/dist/components/TextField/index.d.ts +2 -0
- package/dist/components/Toolbar/Toolbar.d.ts +58 -0
- package/dist/components/Toolbar/index.d.ts +2 -0
- package/dist/index.cjs +73 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +2803 -0
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/i18n.d.ts +89 -0
- package/dist/ui.css +1 -0
- package/package.json +73 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2803 @@
|
|
|
1
|
+
import { jsx as n, jsxs as H, Fragment as st } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as V, useContext as ve, useMemo as ue, createContext as He, useState as re, createElement as Be, useRef as U, useImperativeHandle as De, useId as ye, useCallback as ce, Children as nt, isValidElement as at, useEffect as ae, Fragment as bt, useReducer as _t, useLayoutEffect as Oe } from "react";
|
|
3
|
+
import { createPortal as pe } from "react-dom";
|
|
4
|
+
function x(...r) {
|
|
5
|
+
return r.filter(Boolean).join(" ");
|
|
6
|
+
}
|
|
7
|
+
const vt = {
|
|
8
|
+
gloss: "gs-icon-grad-gloss",
|
|
9
|
+
active: "gs-icon-grad-active"
|
|
10
|
+
}, ne = V(function({
|
|
11
|
+
icon: e,
|
|
12
|
+
variant: t = "gloss",
|
|
13
|
+
embossed: s,
|
|
14
|
+
size: c = 24,
|
|
15
|
+
label: a,
|
|
16
|
+
className: i,
|
|
17
|
+
strokeWidth: o = 2.25,
|
|
18
|
+
...f
|
|
19
|
+
}, p) {
|
|
20
|
+
const g = t !== "flat", _ = s ?? g, w = g ? vt[t] : void 0, y = a ? { role: "img", "aria-label": a } : { "aria-hidden": !0 };
|
|
21
|
+
return /* @__PURE__ */ n(
|
|
22
|
+
e,
|
|
23
|
+
{
|
|
24
|
+
ref: p,
|
|
25
|
+
size: c,
|
|
26
|
+
strokeWidth: o,
|
|
27
|
+
className: x(
|
|
28
|
+
"gs-icon",
|
|
29
|
+
`gs-icon--${t}`,
|
|
30
|
+
_ && "gs-icon--embossed",
|
|
31
|
+
i
|
|
32
|
+
),
|
|
33
|
+
stroke: w ? `url(#${w})` : "currentColor",
|
|
34
|
+
...y,
|
|
35
|
+
...f,
|
|
36
|
+
children: w && /* @__PURE__ */ n("defs", { children: /* @__PURE__ */ H("linearGradient", { id: w, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
37
|
+
/* @__PURE__ */ n("stop", { offset: "0%", className: "gs-icon__stop-top" }),
|
|
38
|
+
/* @__PURE__ */ n("stop", { offset: "50%", className: "gs-icon__stop-mid-top" }),
|
|
39
|
+
/* @__PURE__ */ n("stop", { offset: "50.5%", className: "gs-icon__stop-mid-bottom" }),
|
|
40
|
+
/* @__PURE__ */ n("stop", { offset: "100%", className: "gs-icon__stop-bottom" })
|
|
41
|
+
] }) })
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}), ct = V(function({ value: e, max: t = 99, tone: s = "red", className: c, ...a }, i) {
|
|
45
|
+
if (e === void 0 || e === "" || e === 0) return null;
|
|
46
|
+
const o = typeof e == "number" && e > t ? `${t}+` : String(e);
|
|
47
|
+
return /* @__PURE__ */ n("span", { ref: i, className: x("gs-badge", `gs-badge--${s}`, c), ...a, children: o });
|
|
48
|
+
}), yt = { sm: 14, md: 18, lg: 20 }, Yr = V(function({
|
|
49
|
+
variant: e = "default",
|
|
50
|
+
size: t = "md",
|
|
51
|
+
block: s = !1,
|
|
52
|
+
icon: c,
|
|
53
|
+
iconPosition: a = "leading",
|
|
54
|
+
type: i = "button",
|
|
55
|
+
className: o,
|
|
56
|
+
children: f,
|
|
57
|
+
...p
|
|
58
|
+
}, g) {
|
|
59
|
+
const _ = c ? /* @__PURE__ */ n(ne, { icon: c, variant: "flat", size: yt[t], className: "gs-button__icon" }) : null, w = f != null && f !== !1;
|
|
60
|
+
return /* @__PURE__ */ H(
|
|
61
|
+
"button",
|
|
62
|
+
{
|
|
63
|
+
ref: g,
|
|
64
|
+
type: i,
|
|
65
|
+
className: x(
|
|
66
|
+
"gs-button",
|
|
67
|
+
`gs-button--${e}`,
|
|
68
|
+
`gs-button--${t}`,
|
|
69
|
+
s && "gs-button--block",
|
|
70
|
+
o
|
|
71
|
+
),
|
|
72
|
+
...p,
|
|
73
|
+
children: [
|
|
74
|
+
a === "leading" && _,
|
|
75
|
+
w && /* @__PURE__ */ n("span", { className: "gs-button__label", children: f }),
|
|
76
|
+
a === "trailing" && _
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}), kt = {
|
|
81
|
+
cancel: "Cancel",
|
|
82
|
+
done: "Done",
|
|
83
|
+
ok: "OK",
|
|
84
|
+
close: "Close",
|
|
85
|
+
clear: "Clear",
|
|
86
|
+
search: "Search",
|
|
87
|
+
go: "Go",
|
|
88
|
+
send: "Send",
|
|
89
|
+
next: "Next",
|
|
90
|
+
loading: "Loading",
|
|
91
|
+
progress: "Progress",
|
|
92
|
+
actions: "Actions",
|
|
93
|
+
dialog: "Dialog",
|
|
94
|
+
tabs: "Tabs",
|
|
95
|
+
segments: "Segments",
|
|
96
|
+
pages: "Pages",
|
|
97
|
+
pageOf: (r, e) => `Page ${r} of ${e}`,
|
|
98
|
+
toolbar: "Toolbar",
|
|
99
|
+
keyboard: "Keyboard",
|
|
100
|
+
shift: "shift",
|
|
101
|
+
delete: "delete",
|
|
102
|
+
numbers: "numbers",
|
|
103
|
+
symbols: "symbols",
|
|
104
|
+
letters: "letters",
|
|
105
|
+
space: "space",
|
|
106
|
+
return: "return",
|
|
107
|
+
on: "ON",
|
|
108
|
+
off: "OFF",
|
|
109
|
+
date: "Date",
|
|
110
|
+
time: "Time",
|
|
111
|
+
dateTime: "Date and time",
|
|
112
|
+
month: "Month",
|
|
113
|
+
day: "Day",
|
|
114
|
+
year: "Year",
|
|
115
|
+
hour: "Hour",
|
|
116
|
+
minute: "Minute",
|
|
117
|
+
dayPeriod: "AM/PM",
|
|
118
|
+
today: "Today",
|
|
119
|
+
am: "AM",
|
|
120
|
+
pm: "PM"
|
|
121
|
+
}, xe = He({ locale: void 0, strings: kt });
|
|
122
|
+
function wt(r, e) {
|
|
123
|
+
const t = { ...r };
|
|
124
|
+
for (const s of Object.keys(e)) {
|
|
125
|
+
const c = e[s];
|
|
126
|
+
c !== void 0 && (t[s] = c);
|
|
127
|
+
}
|
|
128
|
+
return t;
|
|
129
|
+
}
|
|
130
|
+
function Ur({ locale: r, strings: e, children: t }) {
|
|
131
|
+
const s = ve(xe), c = ue(
|
|
132
|
+
() => ({
|
|
133
|
+
locale: r ?? s.locale,
|
|
134
|
+
strings: e ? wt(s.strings, e) : s.strings
|
|
135
|
+
}),
|
|
136
|
+
[s, r, e]
|
|
137
|
+
);
|
|
138
|
+
return /* @__PURE__ */ n(xe.Provider, { value: c, children: t });
|
|
139
|
+
}
|
|
140
|
+
function ie() {
|
|
141
|
+
return ve(xe).strings;
|
|
142
|
+
}
|
|
143
|
+
function Nt() {
|
|
144
|
+
return ve(xe).locale;
|
|
145
|
+
}
|
|
146
|
+
const Vr = V(function({
|
|
147
|
+
checked: e,
|
|
148
|
+
defaultChecked: t = !1,
|
|
149
|
+
onChange: s,
|
|
150
|
+
disabled: c = !1,
|
|
151
|
+
onLabel: a,
|
|
152
|
+
offLabel: i,
|
|
153
|
+
label: o,
|
|
154
|
+
name: f,
|
|
155
|
+
className: p,
|
|
156
|
+
onClick: g,
|
|
157
|
+
..._
|
|
158
|
+
}, w) {
|
|
159
|
+
const y = ie(), E = e !== void 0, [D, N] = re(t), v = E ? e : D, M = (T) => {
|
|
160
|
+
if (g == null || g(T), T.defaultPrevented || c) return;
|
|
161
|
+
const u = !v;
|
|
162
|
+
E || N(u), s == null || s(u);
|
|
163
|
+
};
|
|
164
|
+
return /* @__PURE__ */ H(st, { children: [
|
|
165
|
+
/* @__PURE__ */ H(
|
|
166
|
+
"button",
|
|
167
|
+
{
|
|
168
|
+
ref: w,
|
|
169
|
+
type: "button",
|
|
170
|
+
role: "switch",
|
|
171
|
+
"aria-checked": v,
|
|
172
|
+
"aria-label": o,
|
|
173
|
+
disabled: c,
|
|
174
|
+
className: x(
|
|
175
|
+
"gs-switch",
|
|
176
|
+
v && "gs-switch--on",
|
|
177
|
+
c && "gs-switch--disabled",
|
|
178
|
+
p
|
|
179
|
+
),
|
|
180
|
+
onClick: M,
|
|
181
|
+
..._,
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ n("span", { className: "gs-switch__track", "aria-hidden": "true", children: /* @__PURE__ */ H("span", { className: "gs-switch__strip", children: [
|
|
184
|
+
/* @__PURE__ */ n("span", { className: "gs-switch__on", children: a ?? y.on }),
|
|
185
|
+
/* @__PURE__ */ n("span", { className: "gs-switch__off", children: i ?? y.off })
|
|
186
|
+
] }) }),
|
|
187
|
+
/* @__PURE__ */ n("span", { className: "gs-switch__knob", "aria-hidden": "true" })
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
f && /* @__PURE__ */ n(
|
|
192
|
+
"input",
|
|
193
|
+
{
|
|
194
|
+
type: "checkbox",
|
|
195
|
+
name: f,
|
|
196
|
+
checked: v,
|
|
197
|
+
disabled: c,
|
|
198
|
+
readOnly: !0,
|
|
199
|
+
hidden: !0,
|
|
200
|
+
tabIndex: -1,
|
|
201
|
+
"aria-hidden": "true"
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
] });
|
|
205
|
+
});
|
|
206
|
+
/**
|
|
207
|
+
* @license lucide-react v0.460.0 - ISC
|
|
208
|
+
*
|
|
209
|
+
* This source code is licensed under the ISC license.
|
|
210
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
211
|
+
*/
|
|
212
|
+
const Tt = (r) => r.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), it = (...r) => r.filter((e, t, s) => !!e && e.trim() !== "" && s.indexOf(e) === t).join(" ").trim();
|
|
213
|
+
/**
|
|
214
|
+
* @license lucide-react v0.460.0 - ISC
|
|
215
|
+
*
|
|
216
|
+
* This source code is licensed under the ISC license.
|
|
217
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
218
|
+
*/
|
|
219
|
+
var St = {
|
|
220
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
221
|
+
width: 24,
|
|
222
|
+
height: 24,
|
|
223
|
+
viewBox: "0 0 24 24",
|
|
224
|
+
fill: "none",
|
|
225
|
+
stroke: "currentColor",
|
|
226
|
+
strokeWidth: 2,
|
|
227
|
+
strokeLinecap: "round",
|
|
228
|
+
strokeLinejoin: "round"
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* @license lucide-react v0.460.0 - ISC
|
|
232
|
+
*
|
|
233
|
+
* This source code is licensed under the ISC license.
|
|
234
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
+
*/
|
|
236
|
+
const Et = V(
|
|
237
|
+
({
|
|
238
|
+
color: r = "currentColor",
|
|
239
|
+
size: e = 24,
|
|
240
|
+
strokeWidth: t = 2,
|
|
241
|
+
absoluteStrokeWidth: s,
|
|
242
|
+
className: c = "",
|
|
243
|
+
children: a,
|
|
244
|
+
iconNode: i,
|
|
245
|
+
...o
|
|
246
|
+
}, f) => Be(
|
|
247
|
+
"svg",
|
|
248
|
+
{
|
|
249
|
+
ref: f,
|
|
250
|
+
...St,
|
|
251
|
+
width: e,
|
|
252
|
+
height: e,
|
|
253
|
+
stroke: r,
|
|
254
|
+
strokeWidth: s ? Number(t) * 24 / Number(e) : t,
|
|
255
|
+
className: it("lucide", c),
|
|
256
|
+
...o
|
|
257
|
+
},
|
|
258
|
+
[
|
|
259
|
+
...i.map(([p, g]) => Be(p, g)),
|
|
260
|
+
...Array.isArray(a) ? a : [a]
|
|
261
|
+
]
|
|
262
|
+
)
|
|
263
|
+
);
|
|
264
|
+
/**
|
|
265
|
+
* @license lucide-react v0.460.0 - ISC
|
|
266
|
+
*
|
|
267
|
+
* This source code is licensed under the ISC license.
|
|
268
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
269
|
+
*/
|
|
270
|
+
const de = (r, e) => {
|
|
271
|
+
const t = V(
|
|
272
|
+
({ className: s, ...c }, a) => Be(Et, {
|
|
273
|
+
ref: a,
|
|
274
|
+
iconNode: e,
|
|
275
|
+
className: it(`lucide-${Tt(r)}`, s),
|
|
276
|
+
...c
|
|
277
|
+
})
|
|
278
|
+
);
|
|
279
|
+
return t.displayName = `${r}`, t;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* @license lucide-react v0.460.0 - ISC
|
|
283
|
+
*
|
|
284
|
+
* This source code is licensed under the ISC license.
|
|
285
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
286
|
+
*/
|
|
287
|
+
const Mt = de("ArrowBigUp", [
|
|
288
|
+
["path", { d: "M9 18v-6H5l7-7 7 7h-4v6H9z", key: "1x06kx" }]
|
|
289
|
+
]);
|
|
290
|
+
/**
|
|
291
|
+
* @license lucide-react v0.460.0 - ISC
|
|
292
|
+
*
|
|
293
|
+
* This source code is licensed under the ISC license.
|
|
294
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
+
*/
|
|
296
|
+
const ot = de("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
297
|
+
/**
|
|
298
|
+
* @license lucide-react v0.460.0 - ISC
|
|
299
|
+
*
|
|
300
|
+
* This source code is licensed under the ISC license.
|
|
301
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
302
|
+
*/
|
|
303
|
+
const xt = de("ChevronRight", [
|
|
304
|
+
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
|
305
|
+
]);
|
|
306
|
+
/**
|
|
307
|
+
* @license lucide-react v0.460.0 - ISC
|
|
308
|
+
*
|
|
309
|
+
* This source code is licensed under the ISC license.
|
|
310
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
311
|
+
*/
|
|
312
|
+
const Dt = de("CircleChevronRight", [
|
|
313
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
314
|
+
["path", { d: "m10 8 4 4-4 4", key: "1wy4r4" }]
|
|
315
|
+
]);
|
|
316
|
+
/**
|
|
317
|
+
* @license lucide-react v0.460.0 - ISC
|
|
318
|
+
*
|
|
319
|
+
* This source code is licensed under the ISC license.
|
|
320
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
321
|
+
*/
|
|
322
|
+
const It = de("CircleX", [
|
|
323
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
324
|
+
["path", { d: "m15 9-6 6", key: "1uzhvr" }],
|
|
325
|
+
["path", { d: "m9 9 6 6", key: "z0biqf" }]
|
|
326
|
+
]);
|
|
327
|
+
/**
|
|
328
|
+
* @license lucide-react v0.460.0 - ISC
|
|
329
|
+
*
|
|
330
|
+
* This source code is licensed under the ISC license.
|
|
331
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
332
|
+
*/
|
|
333
|
+
const At = de("Delete", [
|
|
334
|
+
[
|
|
335
|
+
"path",
|
|
336
|
+
{
|
|
337
|
+
d: "M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",
|
|
338
|
+
key: "1yo7s0"
|
|
339
|
+
}
|
|
340
|
+
],
|
|
341
|
+
["path", { d: "m12 9 6 6", key: "anjzzh" }],
|
|
342
|
+
["path", { d: "m18 9-6 6", key: "1fp51s" }]
|
|
343
|
+
]);
|
|
344
|
+
/**
|
|
345
|
+
* @license lucide-react v0.460.0 - ISC
|
|
346
|
+
*
|
|
347
|
+
* This source code is licensed under the ISC license.
|
|
348
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
349
|
+
*/
|
|
350
|
+
const $t = de("Minus", [["path", { d: "M5 12h14", key: "1ays0h" }]]);
|
|
351
|
+
/**
|
|
352
|
+
* @license lucide-react v0.460.0 - ISC
|
|
353
|
+
*
|
|
354
|
+
* This source code is licensed under the ISC license.
|
|
355
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
356
|
+
*/
|
|
357
|
+
const Lt = de("Plus", [
|
|
358
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
359
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
|
360
|
+
]);
|
|
361
|
+
/**
|
|
362
|
+
* @license lucide-react v0.460.0 - ISC
|
|
363
|
+
*
|
|
364
|
+
* This source code is licensed under the ISC license.
|
|
365
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
366
|
+
*/
|
|
367
|
+
const Pt = de("Search", [
|
|
368
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
369
|
+
["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
|
|
370
|
+
]);
|
|
371
|
+
/**
|
|
372
|
+
* @license lucide-react v0.460.0 - ISC
|
|
373
|
+
*
|
|
374
|
+
* This source code is licensed under the ISC license.
|
|
375
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
376
|
+
*/
|
|
377
|
+
const Rt = de("X", [
|
|
378
|
+
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
379
|
+
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
380
|
+
]), qe = 18, Bt = V(function({
|
|
381
|
+
label: e,
|
|
382
|
+
helper: t,
|
|
383
|
+
error: s,
|
|
384
|
+
clearable: c = !1,
|
|
385
|
+
onClear: a,
|
|
386
|
+
leadingIcon: i,
|
|
387
|
+
size: o = "md",
|
|
388
|
+
wrapperClassName: f,
|
|
389
|
+
className: p,
|
|
390
|
+
id: g,
|
|
391
|
+
value: _,
|
|
392
|
+
defaultValue: w,
|
|
393
|
+
onChange: y,
|
|
394
|
+
disabled: E,
|
|
395
|
+
readOnly: D,
|
|
396
|
+
type: N = "text",
|
|
397
|
+
"aria-describedby": v,
|
|
398
|
+
...M
|
|
399
|
+
}, T) {
|
|
400
|
+
const u = ie(), l = ye(), m = g ?? l, b = `${m}-helper`, A = `${m}-error`, h = U(null);
|
|
401
|
+
De(T, () => h.current, []);
|
|
402
|
+
const S = _ !== void 0, [k, d] = re(() => String(w ?? "")), I = S ? _ : k, $ = I != null && String(I).length > 0, O = c && $ && !E && !D, G = (P) => {
|
|
403
|
+
S || d(P.target.value), y == null || y(P);
|
|
404
|
+
}, Z = () => {
|
|
405
|
+
var ee;
|
|
406
|
+
const P = h.current;
|
|
407
|
+
if (!P) return;
|
|
408
|
+
const X = (ee = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")) == null ? void 0 : ee.set;
|
|
409
|
+
X ? X.call(P, "") : P.value = "", P.dispatchEvent(new Event("input", { bubbles: !0 })), S || d(""), a == null || a(), P.focus();
|
|
410
|
+
}, j = (P) => {
|
|
411
|
+
var X;
|
|
412
|
+
P.target === P.currentTarget && ((X = h.current) == null || X.focus());
|
|
413
|
+
}, W = [v, t ? b : null, s ? A : null].filter(Boolean).join(" ") || void 0;
|
|
414
|
+
return /* @__PURE__ */ H(
|
|
415
|
+
"div",
|
|
416
|
+
{
|
|
417
|
+
className: x(
|
|
418
|
+
"gs-textfield",
|
|
419
|
+
`gs-textfield--${o}`,
|
|
420
|
+
!!s && "gs-textfield--error",
|
|
421
|
+
E && "gs-textfield--disabled",
|
|
422
|
+
f
|
|
423
|
+
),
|
|
424
|
+
children: [
|
|
425
|
+
/* @__PURE__ */ H("div", { className: "gs-textfield__field", onClick: j, children: [
|
|
426
|
+
e && /* @__PURE__ */ n("label", { htmlFor: m, className: "gs-textfield__label", children: e }),
|
|
427
|
+
i && /* @__PURE__ */ n(ne, { icon: i, variant: "flat", size: qe, className: "gs-textfield__icon" }),
|
|
428
|
+
/* @__PURE__ */ n(
|
|
429
|
+
"input",
|
|
430
|
+
{
|
|
431
|
+
ref: h,
|
|
432
|
+
id: m,
|
|
433
|
+
type: N,
|
|
434
|
+
className: x("gs-textfield__input", p),
|
|
435
|
+
value: _,
|
|
436
|
+
defaultValue: w,
|
|
437
|
+
onChange: G,
|
|
438
|
+
disabled: E,
|
|
439
|
+
readOnly: D,
|
|
440
|
+
"aria-invalid": s ? !0 : void 0,
|
|
441
|
+
"aria-describedby": W,
|
|
442
|
+
...M
|
|
443
|
+
}
|
|
444
|
+
),
|
|
445
|
+
O && /* @__PURE__ */ n(
|
|
446
|
+
"button",
|
|
447
|
+
{
|
|
448
|
+
type: "button",
|
|
449
|
+
className: "gs-textfield__clear",
|
|
450
|
+
"aria-label": u.clear,
|
|
451
|
+
onMouseDown: (P) => P.preventDefault(),
|
|
452
|
+
onClick: Z,
|
|
453
|
+
children: /* @__PURE__ */ n(ne, { icon: It, variant: "flat", size: qe, strokeWidth: 2.5 })
|
|
454
|
+
}
|
|
455
|
+
)
|
|
456
|
+
] }),
|
|
457
|
+
t && /* @__PURE__ */ n("div", { id: b, className: "gs-textfield__helper", children: t }),
|
|
458
|
+
s && /* @__PURE__ */ n("div", { id: A, className: "gs-textfield__error", role: "alert", children: s })
|
|
459
|
+
]
|
|
460
|
+
}
|
|
461
|
+
);
|
|
462
|
+
}), Ot = V(function({
|
|
463
|
+
showCancel: e = !1,
|
|
464
|
+
cancelLabel: t,
|
|
465
|
+
onCancel: s,
|
|
466
|
+
wrapperClassName: c,
|
|
467
|
+
placeholder: a,
|
|
468
|
+
clearable: i = !0,
|
|
469
|
+
type: o = "search",
|
|
470
|
+
...f
|
|
471
|
+
}, p) {
|
|
472
|
+
const g = ie(), _ = U(null);
|
|
473
|
+
De(p, () => _.current, []);
|
|
474
|
+
const w = () => {
|
|
475
|
+
var y;
|
|
476
|
+
s == null || s(), (y = _.current) == null || y.blur();
|
|
477
|
+
};
|
|
478
|
+
return /* @__PURE__ */ H("div", { className: x("gs-searchfield", c), children: [
|
|
479
|
+
/* @__PURE__ */ n(
|
|
480
|
+
Bt,
|
|
481
|
+
{
|
|
482
|
+
ref: _,
|
|
483
|
+
wrapperClassName: "gs-searchfield__field",
|
|
484
|
+
leadingIcon: Pt,
|
|
485
|
+
placeholder: a ?? g.search,
|
|
486
|
+
clearable: i,
|
|
487
|
+
type: o,
|
|
488
|
+
enterKeyHint: "search",
|
|
489
|
+
...f
|
|
490
|
+
}
|
|
491
|
+
),
|
|
492
|
+
e && /* @__PURE__ */ n(
|
|
493
|
+
"button",
|
|
494
|
+
{
|
|
495
|
+
type: "button",
|
|
496
|
+
className: "gs-searchfield__cancel",
|
|
497
|
+
onMouseDown: (y) => y.preventDefault(),
|
|
498
|
+
onClick: w,
|
|
499
|
+
children: t ?? g.cancel
|
|
500
|
+
}
|
|
501
|
+
)
|
|
502
|
+
] });
|
|
503
|
+
}), Ft = V(
|
|
504
|
+
function({ title: e, left: t, right: s, tint: c = "black", className: a, ...i }, o) {
|
|
505
|
+
const f = e != null && e !== !1;
|
|
506
|
+
return /* @__PURE__ */ H(
|
|
507
|
+
"div",
|
|
508
|
+
{
|
|
509
|
+
ref: o,
|
|
510
|
+
role: "toolbar",
|
|
511
|
+
"aria-label": typeof e == "string" ? e : void 0,
|
|
512
|
+
className: x("gs-navbar", `gs-navbar--${c}`, a),
|
|
513
|
+
...i,
|
|
514
|
+
children: [
|
|
515
|
+
/* @__PURE__ */ n("div", { className: "gs-navbar__left", children: t }),
|
|
516
|
+
f && /* @__PURE__ */ n("div", { className: "gs-navbar__title", children: e }),
|
|
517
|
+
/* @__PURE__ */ n("div", { className: "gs-navbar__right", children: s })
|
|
518
|
+
]
|
|
519
|
+
}
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
), Ge = V(function({ variant: e = "default", icon: t, type: s = "button", className: c, children: a, ...i }, o) {
|
|
523
|
+
const f = a != null && a !== !1;
|
|
524
|
+
return /* @__PURE__ */ H(
|
|
525
|
+
"button",
|
|
526
|
+
{
|
|
527
|
+
ref: o,
|
|
528
|
+
type: s,
|
|
529
|
+
className: x(
|
|
530
|
+
"gs-barbutton",
|
|
531
|
+
`gs-barbutton--${e}`,
|
|
532
|
+
!f && "gs-barbutton--icon-only",
|
|
533
|
+
c
|
|
534
|
+
),
|
|
535
|
+
...i,
|
|
536
|
+
children: [
|
|
537
|
+
t && /* @__PURE__ */ n(ne, { icon: t, variant: "flat", size: 16, className: "gs-barbutton__icon" }),
|
|
538
|
+
f && /* @__PURE__ */ n("span", { className: "gs-barbutton__label", children: a })
|
|
539
|
+
]
|
|
540
|
+
}
|
|
541
|
+
);
|
|
542
|
+
}), lt = He(null);
|
|
543
|
+
function Ht(r) {
|
|
544
|
+
const e = [];
|
|
545
|
+
return nt.forEach(r, (t) => {
|
|
546
|
+
at(t) && typeof t.props.value == "string" && e.push(t.props.value);
|
|
547
|
+
}), e;
|
|
548
|
+
}
|
|
549
|
+
const qr = V(function({ value: e, defaultValue: t, onChange: s, label: c, className: a, children: i, onKeyDown: o, ...f }, p) {
|
|
550
|
+
const g = ie(), _ = Ht(i), w = e !== void 0, [y, E] = re(() => t ?? _[0]), D = w ? e : y, N = D !== void 0 && _.includes(D) ? D : _[0], v = ce(
|
|
551
|
+
(u) => {
|
|
552
|
+
w || E(u), s == null || s(u);
|
|
553
|
+
},
|
|
554
|
+
[w, s]
|
|
555
|
+
), M = ue(
|
|
556
|
+
() => ({ selected: D, focusable: N, select: v }),
|
|
557
|
+
[D, N, v]
|
|
558
|
+
), T = (u) => {
|
|
559
|
+
if (o == null || o(u), u.defaultPrevented) return;
|
|
560
|
+
const l = Array.from(
|
|
561
|
+
u.currentTarget.querySelectorAll('[role="tab"]')
|
|
562
|
+
).filter((h) => !h.disabled);
|
|
563
|
+
if (l.length === 0) return;
|
|
564
|
+
const m = l.findIndex((h) => h.contains(u.target));
|
|
565
|
+
if (m === -1) return;
|
|
566
|
+
let b;
|
|
567
|
+
switch (u.key) {
|
|
568
|
+
case "ArrowRight":
|
|
569
|
+
b = (m + 1) % l.length;
|
|
570
|
+
break;
|
|
571
|
+
case "ArrowLeft":
|
|
572
|
+
b = (m - 1 + l.length) % l.length;
|
|
573
|
+
break;
|
|
574
|
+
case "Home":
|
|
575
|
+
b = 0;
|
|
576
|
+
break;
|
|
577
|
+
case "End":
|
|
578
|
+
b = l.length - 1;
|
|
579
|
+
break;
|
|
580
|
+
default:
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
u.preventDefault();
|
|
584
|
+
const A = l[b];
|
|
585
|
+
A.focus(), A.click();
|
|
586
|
+
};
|
|
587
|
+
return /* @__PURE__ */ n(lt.Provider, { value: M, children: /* @__PURE__ */ n(
|
|
588
|
+
"div",
|
|
589
|
+
{
|
|
590
|
+
ref: p,
|
|
591
|
+
role: "tablist",
|
|
592
|
+
"aria-label": c ?? g.tabs,
|
|
593
|
+
"aria-orientation": "horizontal",
|
|
594
|
+
className: x("gs-tabbar", a),
|
|
595
|
+
onKeyDown: T,
|
|
596
|
+
...f,
|
|
597
|
+
children: i
|
|
598
|
+
}
|
|
599
|
+
) });
|
|
600
|
+
}), Gr = V(function({ value: e, icon: t, label: s, badge: c, className: a, onClick: i, ...o }, f) {
|
|
601
|
+
const p = ve(lt);
|
|
602
|
+
if (!p)
|
|
603
|
+
throw new Error("<TabBarItem> must be rendered inside a <TabBar>.");
|
|
604
|
+
const g = p.selected === e, _ = p.focusable === void 0 || p.focusable === e ? 0 : -1, w = (y) => {
|
|
605
|
+
i == null || i(y), !(y.defaultPrevented || g) && p.select(e);
|
|
606
|
+
};
|
|
607
|
+
return /* @__PURE__ */ H(
|
|
608
|
+
"button",
|
|
609
|
+
{
|
|
610
|
+
ref: f,
|
|
611
|
+
type: "button",
|
|
612
|
+
role: "tab",
|
|
613
|
+
"aria-selected": g,
|
|
614
|
+
tabIndex: _,
|
|
615
|
+
className: x("gs-tabbar-item", g && "gs-tabbar-item--selected", a),
|
|
616
|
+
onClick: w,
|
|
617
|
+
...o,
|
|
618
|
+
children: [
|
|
619
|
+
/* @__PURE__ */ H("span", { className: "gs-tabbar-item__icon", children: [
|
|
620
|
+
/* @__PURE__ */ n(ne, { icon: t, variant: g ? "active" : "gloss", size: 26 }),
|
|
621
|
+
/* @__PURE__ */ n(ct, { value: c, className: "gs-tabbar-item__badge" })
|
|
622
|
+
] }),
|
|
623
|
+
/* @__PURE__ */ n("span", { className: "gs-tabbar-item__label", children: s })
|
|
624
|
+
]
|
|
625
|
+
}
|
|
626
|
+
);
|
|
627
|
+
}), jr = V(function({ variant: e = "grouped", header: t, footer: s, className: c, children: a, ...i }, o) {
|
|
628
|
+
return /* @__PURE__ */ H("div", { ref: o, className: x("gs-list", `gs-list--${e}`, c), ...i, children: [
|
|
629
|
+
t != null && /* @__PURE__ */ n("div", { className: "gs-list__header", children: t }),
|
|
630
|
+
/* @__PURE__ */ n("div", { className: "gs-list__group", role: "list", children: a }),
|
|
631
|
+
s != null && /* @__PURE__ */ n("div", { className: "gs-list__footer", children: s })
|
|
632
|
+
] });
|
|
633
|
+
});
|
|
634
|
+
function Wt(r) {
|
|
635
|
+
return r === "chevron" || r === "checkmark" || r === "detail" || r === "none";
|
|
636
|
+
}
|
|
637
|
+
function zt(r) {
|
|
638
|
+
if (r == null || r === "none") return null;
|
|
639
|
+
if (!Wt(r)) return r;
|
|
640
|
+
switch (r) {
|
|
641
|
+
case "chevron":
|
|
642
|
+
return /* @__PURE__ */ n(
|
|
643
|
+
ne,
|
|
644
|
+
{
|
|
645
|
+
icon: xt,
|
|
646
|
+
variant: "flat",
|
|
647
|
+
size: 20,
|
|
648
|
+
strokeWidth: 3,
|
|
649
|
+
className: "gs-list-item__accessory-icon gs-list-item__accessory-icon--chevron"
|
|
650
|
+
}
|
|
651
|
+
);
|
|
652
|
+
case "checkmark":
|
|
653
|
+
return /* @__PURE__ */ n(
|
|
654
|
+
ne,
|
|
655
|
+
{
|
|
656
|
+
icon: ot,
|
|
657
|
+
variant: "flat",
|
|
658
|
+
size: 20,
|
|
659
|
+
strokeWidth: 3,
|
|
660
|
+
className: "gs-list-item__accessory-icon gs-list-item__accessory-icon--checkmark"
|
|
661
|
+
}
|
|
662
|
+
);
|
|
663
|
+
case "detail":
|
|
664
|
+
return /* @__PURE__ */ n(
|
|
665
|
+
ne,
|
|
666
|
+
{
|
|
667
|
+
icon: Dt,
|
|
668
|
+
variant: "flat",
|
|
669
|
+
size: 22,
|
|
670
|
+
strokeWidth: 2.25,
|
|
671
|
+
className: "gs-list-item__accessory-icon gs-list-item__accessory-icon--detail"
|
|
672
|
+
}
|
|
673
|
+
);
|
|
674
|
+
default:
|
|
675
|
+
return null;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
const Zr = V(function({
|
|
679
|
+
icon: e,
|
|
680
|
+
iconTile: t = !1,
|
|
681
|
+
iconTint: s = "gray",
|
|
682
|
+
title: c,
|
|
683
|
+
subtitle: a,
|
|
684
|
+
detail: i,
|
|
685
|
+
accessory: o,
|
|
686
|
+
selected: f = !1,
|
|
687
|
+
disabled: p = !1,
|
|
688
|
+
href: g,
|
|
689
|
+
onClick: _,
|
|
690
|
+
className: w,
|
|
691
|
+
...y
|
|
692
|
+
}, E) {
|
|
693
|
+
const D = !!g || !!_, N = a != null && a !== !1, v = i != null && i !== !1, M = zt(o), T = x(
|
|
694
|
+
"gs-list-item",
|
|
695
|
+
D && "gs-list-item--interactive",
|
|
696
|
+
f && "gs-list-item--selected",
|
|
697
|
+
p && "gs-list-item--disabled",
|
|
698
|
+
w
|
|
699
|
+
), u = /* @__PURE__ */ H(st, { children: [
|
|
700
|
+
e != null && /* @__PURE__ */ n(
|
|
701
|
+
"span",
|
|
702
|
+
{
|
|
703
|
+
className: x(
|
|
704
|
+
"gs-list-item__icon",
|
|
705
|
+
t && "gs-list-item__icon--tile",
|
|
706
|
+
t && `gs-list-item__icon--${s}`
|
|
707
|
+
),
|
|
708
|
+
children: e
|
|
709
|
+
}
|
|
710
|
+
),
|
|
711
|
+
/* @__PURE__ */ H("span", { className: "gs-list-item__body", children: [
|
|
712
|
+
/* @__PURE__ */ n("span", { className: "gs-list-item__title", children: c }),
|
|
713
|
+
N && /* @__PURE__ */ n("span", { className: "gs-list-item__subtitle", children: a })
|
|
714
|
+
] }),
|
|
715
|
+
v && /* @__PURE__ */ n("span", { className: "gs-list-item__detail", children: i }),
|
|
716
|
+
M && /* @__PURE__ */ n("span", { className: "gs-list-item__accessory", children: M })
|
|
717
|
+
] }), l = (m) => {
|
|
718
|
+
if (p) {
|
|
719
|
+
m.preventDefault();
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
_ == null || _(m);
|
|
723
|
+
};
|
|
724
|
+
return g ? /* @__PURE__ */ n(
|
|
725
|
+
"a",
|
|
726
|
+
{
|
|
727
|
+
ref: E,
|
|
728
|
+
className: T,
|
|
729
|
+
href: p ? void 0 : g,
|
|
730
|
+
"aria-disabled": p || void 0,
|
|
731
|
+
"aria-current": f || void 0,
|
|
732
|
+
tabIndex: p ? -1 : void 0,
|
|
733
|
+
onClick: l,
|
|
734
|
+
...y,
|
|
735
|
+
children: u
|
|
736
|
+
}
|
|
737
|
+
) : _ ? /* @__PURE__ */ n(
|
|
738
|
+
"button",
|
|
739
|
+
{
|
|
740
|
+
ref: E,
|
|
741
|
+
type: "button",
|
|
742
|
+
className: T,
|
|
743
|
+
disabled: p,
|
|
744
|
+
"aria-current": f || void 0,
|
|
745
|
+
onClick: l,
|
|
746
|
+
...y,
|
|
747
|
+
children: u
|
|
748
|
+
}
|
|
749
|
+
) : /* @__PURE__ */ n(
|
|
750
|
+
"div",
|
|
751
|
+
{
|
|
752
|
+
ref: E,
|
|
753
|
+
role: "listitem",
|
|
754
|
+
className: T,
|
|
755
|
+
"aria-disabled": p || void 0,
|
|
756
|
+
"aria-current": f || void 0,
|
|
757
|
+
...y,
|
|
758
|
+
children: u
|
|
759
|
+
}
|
|
760
|
+
);
|
|
761
|
+
}), je = "button.gs-alert__action:not(:disabled)", Xr = V(function({
|
|
762
|
+
open: e,
|
|
763
|
+
title: t,
|
|
764
|
+
message: s,
|
|
765
|
+
actions: c,
|
|
766
|
+
onClose: a,
|
|
767
|
+
dismissOnBackdrop: i = !1,
|
|
768
|
+
contained: o = !1,
|
|
769
|
+
className: f,
|
|
770
|
+
...p
|
|
771
|
+
}, g) {
|
|
772
|
+
const _ = ye(), w = `${_}-title`, y = `${_}-message`, E = U(null), D = ce(
|
|
773
|
+
(u) => {
|
|
774
|
+
E.current = u, typeof g == "function" ? g(u) : g && (g.current = u);
|
|
775
|
+
},
|
|
776
|
+
[g]
|
|
777
|
+
), N = U(a);
|
|
778
|
+
if (N.current = a, ae(() => {
|
|
779
|
+
if (!e) return;
|
|
780
|
+
const u = document.activeElement, l = E.current, m = (l == null ? void 0 : l.querySelector(".gs-alert__action--primary")) ?? (l == null ? void 0 : l.querySelector(je));
|
|
781
|
+
return m == null || m.focus(), () => {
|
|
782
|
+
u && u.isConnected && typeof u.focus == "function" && u.focus();
|
|
783
|
+
};
|
|
784
|
+
}, [e]), ae(() => {
|
|
785
|
+
if (!e) return;
|
|
786
|
+
const u = (l) => {
|
|
787
|
+
var k;
|
|
788
|
+
if (l.key === "Escape") {
|
|
789
|
+
l.preventDefault(), (k = N.current) == null || k.call(N);
|
|
790
|
+
return;
|
|
791
|
+
}
|
|
792
|
+
if (l.key !== "Tab") return;
|
|
793
|
+
const m = E.current;
|
|
794
|
+
if (!m) return;
|
|
795
|
+
const b = Array.from(m.querySelectorAll(je));
|
|
796
|
+
if (b.length === 0) return;
|
|
797
|
+
l.preventDefault();
|
|
798
|
+
const A = b.indexOf(document.activeElement), h = b.length - 1, S = l.shiftKey ? A <= 0 ? h : A - 1 : A < 0 || A === h ? 0 : A + 1;
|
|
799
|
+
b[S].focus();
|
|
800
|
+
};
|
|
801
|
+
return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
|
|
802
|
+
}, [e]), !e) return null;
|
|
803
|
+
const v = (u) => {
|
|
804
|
+
i && u.target === u.currentTarget && (a == null || a());
|
|
805
|
+
}, M = c.length !== 2, T = /* @__PURE__ */ n(
|
|
806
|
+
"div",
|
|
807
|
+
{
|
|
808
|
+
className: x("gs-alert-backdrop", o && "gs-alert-backdrop--contained"),
|
|
809
|
+
onClick: v,
|
|
810
|
+
children: /* @__PURE__ */ H(
|
|
811
|
+
"div",
|
|
812
|
+
{
|
|
813
|
+
ref: D,
|
|
814
|
+
className: x("gs-alert", f),
|
|
815
|
+
role: "alertdialog",
|
|
816
|
+
"aria-modal": "true",
|
|
817
|
+
"aria-labelledby": w,
|
|
818
|
+
"aria-describedby": s != null ? y : void 0,
|
|
819
|
+
...p,
|
|
820
|
+
children: [
|
|
821
|
+
/* @__PURE__ */ n("div", { id: w, className: "gs-alert__title", children: t }),
|
|
822
|
+
s != null && /* @__PURE__ */ n("div", { id: y, className: "gs-alert__message", children: s }),
|
|
823
|
+
/* @__PURE__ */ n("div", { className: x("gs-alert__actions", M && "gs-alert__actions--stacked"), children: c.map((u, l) => /* @__PURE__ */ n(
|
|
824
|
+
"button",
|
|
825
|
+
{
|
|
826
|
+
type: "button",
|
|
827
|
+
className: x("gs-alert__action", `gs-alert__action--${u.variant ?? "default"}`),
|
|
828
|
+
onClick: () => {
|
|
829
|
+
var m;
|
|
830
|
+
(m = u.onClick) == null || m.call(u), u.keepOpen || a == null || a();
|
|
831
|
+
},
|
|
832
|
+
children: u.label
|
|
833
|
+
},
|
|
834
|
+
l
|
|
835
|
+
)) })
|
|
836
|
+
]
|
|
837
|
+
}
|
|
838
|
+
)
|
|
839
|
+
}
|
|
840
|
+
);
|
|
841
|
+
return o ? T : typeof document > "u" ? null : pe(T, document.body);
|
|
842
|
+
}), ut = He(null);
|
|
843
|
+
function Yt(r) {
|
|
844
|
+
const e = [];
|
|
845
|
+
return nt.forEach(r, (t) => {
|
|
846
|
+
at(t) && typeof t.props.value == "string" && e.push({ value: t.props.value, disabled: t.props.disabled === !0 });
|
|
847
|
+
}), e;
|
|
848
|
+
}
|
|
849
|
+
const Ut = V(
|
|
850
|
+
function({
|
|
851
|
+
value: e,
|
|
852
|
+
defaultValue: t,
|
|
853
|
+
onChange: s,
|
|
854
|
+
size: c = "md",
|
|
855
|
+
tint: a = "dark",
|
|
856
|
+
label: i,
|
|
857
|
+
block: o = !1,
|
|
858
|
+
className: f,
|
|
859
|
+
children: p,
|
|
860
|
+
onKeyDown: g,
|
|
861
|
+
..._
|
|
862
|
+
}, w) {
|
|
863
|
+
var A;
|
|
864
|
+
const y = ie(), E = Yt(p), D = e !== void 0, [N, v] = re(
|
|
865
|
+
() => {
|
|
866
|
+
var h;
|
|
867
|
+
return t ?? ((h = E[0]) == null ? void 0 : h.value);
|
|
868
|
+
}
|
|
869
|
+
), M = D ? e : N, T = E.find((h) => h.value === M), u = T && !T.disabled ? T.value : (A = E.find((h) => !h.disabled)) == null ? void 0 : A.value, l = ce(
|
|
870
|
+
(h) => {
|
|
871
|
+
D || v(h), s == null || s(h);
|
|
872
|
+
},
|
|
873
|
+
[D, s]
|
|
874
|
+
), m = ue(
|
|
875
|
+
() => ({ selected: M, focusable: u, select: l }),
|
|
876
|
+
[M, u, l]
|
|
877
|
+
), b = (h) => {
|
|
878
|
+
if (g == null || g(h), h.defaultPrevented) return;
|
|
879
|
+
const S = Array.from(
|
|
880
|
+
h.currentTarget.querySelectorAll('[role="radio"]')
|
|
881
|
+
).filter(($) => !$.disabled);
|
|
882
|
+
if (S.length === 0) return;
|
|
883
|
+
const k = S.findIndex(($) => $.contains(h.target));
|
|
884
|
+
if (k === -1) return;
|
|
885
|
+
let d;
|
|
886
|
+
switch (h.key) {
|
|
887
|
+
case "ArrowRight":
|
|
888
|
+
d = (k + 1) % S.length;
|
|
889
|
+
break;
|
|
890
|
+
case "ArrowLeft":
|
|
891
|
+
d = (k - 1 + S.length) % S.length;
|
|
892
|
+
break;
|
|
893
|
+
case "Home":
|
|
894
|
+
d = 0;
|
|
895
|
+
break;
|
|
896
|
+
case "End":
|
|
897
|
+
d = S.length - 1;
|
|
898
|
+
break;
|
|
899
|
+
default:
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
h.preventDefault();
|
|
903
|
+
const I = S[d];
|
|
904
|
+
I.focus(), I.click();
|
|
905
|
+
};
|
|
906
|
+
return /* @__PURE__ */ n(ut.Provider, { value: m, children: /* @__PURE__ */ n(
|
|
907
|
+
"div",
|
|
908
|
+
{
|
|
909
|
+
ref: w,
|
|
910
|
+
role: "radiogroup",
|
|
911
|
+
"aria-label": i ?? y.segments,
|
|
912
|
+
className: x(
|
|
913
|
+
"gs-segmented",
|
|
914
|
+
`gs-segmented--${c}`,
|
|
915
|
+
`gs-segmented--${a}`,
|
|
916
|
+
o && "gs-segmented--block",
|
|
917
|
+
f
|
|
918
|
+
),
|
|
919
|
+
onKeyDown: b,
|
|
920
|
+
..._,
|
|
921
|
+
children: p
|
|
922
|
+
}
|
|
923
|
+
) });
|
|
924
|
+
}
|
|
925
|
+
), Vt = V(function({ value: e, icon: t, label: s, disabled: c = !1, className: a, children: i, onClick: o, ...f }, p) {
|
|
926
|
+
const g = ve(ut);
|
|
927
|
+
if (!g)
|
|
928
|
+
throw new Error("<Segment> must be rendered inside a <SegmentedControl>.");
|
|
929
|
+
const _ = g.selected === e, w = g.focusable === void 0 || g.focusable === e ? 0 : -1, y = i ?? (t ? void 0 : s), E = y != null && y !== !1, D = (N) => {
|
|
930
|
+
o == null || o(N), !(N.defaultPrevented || _) && g.select(e);
|
|
931
|
+
};
|
|
932
|
+
return /* @__PURE__ */ H(
|
|
933
|
+
"button",
|
|
934
|
+
{
|
|
935
|
+
ref: p,
|
|
936
|
+
type: "button",
|
|
937
|
+
role: "radio",
|
|
938
|
+
"aria-checked": _,
|
|
939
|
+
"aria-label": E ? void 0 : s,
|
|
940
|
+
tabIndex: w,
|
|
941
|
+
disabled: c,
|
|
942
|
+
className: x(
|
|
943
|
+
"gs-segment",
|
|
944
|
+
_ && "gs-segment--selected",
|
|
945
|
+
c && "gs-segment--disabled",
|
|
946
|
+
a
|
|
947
|
+
),
|
|
948
|
+
onClick: D,
|
|
949
|
+
...f,
|
|
950
|
+
children: [
|
|
951
|
+
t && /* @__PURE__ */ n(ne, { icon: t, variant: "flat", size: 16, className: "gs-segment__icon" }),
|
|
952
|
+
E && /* @__PURE__ */ n("span", { className: "gs-segment__label", children: y })
|
|
953
|
+
]
|
|
954
|
+
}
|
|
955
|
+
);
|
|
956
|
+
}), qt = 16, Gt = 20;
|
|
957
|
+
function Ze(r, e, t) {
|
|
958
|
+
return Math.min(Math.max(r, e), t);
|
|
959
|
+
}
|
|
960
|
+
const Qr = V(function({
|
|
961
|
+
value: e,
|
|
962
|
+
defaultValue: t,
|
|
963
|
+
onChange: s,
|
|
964
|
+
onChangeEnd: c,
|
|
965
|
+
min: a = 0,
|
|
966
|
+
max: i = 100,
|
|
967
|
+
step: o = 1,
|
|
968
|
+
disabled: f = !1,
|
|
969
|
+
label: p,
|
|
970
|
+
minIcon: g,
|
|
971
|
+
maxIcon: _,
|
|
972
|
+
showValue: w = !1,
|
|
973
|
+
wrapperClassName: y,
|
|
974
|
+
className: E,
|
|
975
|
+
...D
|
|
976
|
+
}, N) {
|
|
977
|
+
const v = U(null);
|
|
978
|
+
De(N, () => v.current, []);
|
|
979
|
+
const M = e !== void 0, [T, u] = re(() => Ze(t ?? a, a, i)), l = M ? e : T, m = i - a, b = m > 0 ? Ze((l - a) / m * 100, 0, 100) : 0, A = (S) => {
|
|
980
|
+
const k = Number(S.target.value);
|
|
981
|
+
M || u(k), s == null || s(k);
|
|
982
|
+
}, h = U(c);
|
|
983
|
+
return h.current = c, ae(() => {
|
|
984
|
+
const S = v.current;
|
|
985
|
+
if (!S) return;
|
|
986
|
+
const k = () => {
|
|
987
|
+
var d;
|
|
988
|
+
(d = h.current) == null || d.call(h, Number(S.value));
|
|
989
|
+
};
|
|
990
|
+
return S.addEventListener("change", k), () => S.removeEventListener("change", k);
|
|
991
|
+
}, []), /* @__PURE__ */ H(
|
|
992
|
+
"div",
|
|
993
|
+
{
|
|
994
|
+
className: x("gs-slider", f && "gs-slider--disabled", y),
|
|
995
|
+
style: { "--gs-slider-pct": b },
|
|
996
|
+
children: [
|
|
997
|
+
g && /* @__PURE__ */ n(
|
|
998
|
+
ne,
|
|
999
|
+
{
|
|
1000
|
+
icon: g,
|
|
1001
|
+
variant: "flat",
|
|
1002
|
+
size: qt,
|
|
1003
|
+
className: "gs-slider__icon gs-slider__icon--min"
|
|
1004
|
+
}
|
|
1005
|
+
),
|
|
1006
|
+
/* @__PURE__ */ n(
|
|
1007
|
+
"input",
|
|
1008
|
+
{
|
|
1009
|
+
ref: v,
|
|
1010
|
+
type: "range",
|
|
1011
|
+
className: x("gs-slider__input", E),
|
|
1012
|
+
value: M ? e : void 0,
|
|
1013
|
+
defaultValue: M ? void 0 : T,
|
|
1014
|
+
onChange: A,
|
|
1015
|
+
min: a,
|
|
1016
|
+
max: i,
|
|
1017
|
+
step: o,
|
|
1018
|
+
disabled: f,
|
|
1019
|
+
"aria-label": p,
|
|
1020
|
+
...D
|
|
1021
|
+
}
|
|
1022
|
+
),
|
|
1023
|
+
_ && /* @__PURE__ */ n(
|
|
1024
|
+
ne,
|
|
1025
|
+
{
|
|
1026
|
+
icon: _,
|
|
1027
|
+
variant: "flat",
|
|
1028
|
+
size: Gt,
|
|
1029
|
+
className: "gs-slider__icon gs-slider__icon--max"
|
|
1030
|
+
}
|
|
1031
|
+
),
|
|
1032
|
+
w && /* @__PURE__ */ n("span", { className: "gs-slider__value", children: l })
|
|
1033
|
+
]
|
|
1034
|
+
}
|
|
1035
|
+
);
|
|
1036
|
+
}), Xe = "button.gs-actionsheet__action:not(:disabled)", Jr = V(function({
|
|
1037
|
+
open: e,
|
|
1038
|
+
title: t,
|
|
1039
|
+
actions: s,
|
|
1040
|
+
cancelLabel: c,
|
|
1041
|
+
onClose: a,
|
|
1042
|
+
dismissOnBackdrop: i = !0,
|
|
1043
|
+
contained: o = !1,
|
|
1044
|
+
className: f,
|
|
1045
|
+
...p
|
|
1046
|
+
}, g) {
|
|
1047
|
+
const _ = ie(), w = c === void 0 ? _.cancel : c, E = `${ye()}-title`, D = t != null && t !== !1, N = U(null), v = ce(
|
|
1048
|
+
(l) => {
|
|
1049
|
+
N.current = l, typeof g == "function" ? g(l) : g && (g.current = l);
|
|
1050
|
+
},
|
|
1051
|
+
[g]
|
|
1052
|
+
), M = U(a);
|
|
1053
|
+
if (M.current = a, ae(() => {
|
|
1054
|
+
var m, b;
|
|
1055
|
+
if (!e) return;
|
|
1056
|
+
const l = document.activeElement;
|
|
1057
|
+
return (b = (m = N.current) == null ? void 0 : m.querySelector(Xe)) == null || b.focus(), () => {
|
|
1058
|
+
l && l.isConnected && typeof l.focus == "function" && l.focus();
|
|
1059
|
+
};
|
|
1060
|
+
}, [e]), ae(() => {
|
|
1061
|
+
if (!e) return;
|
|
1062
|
+
const l = (m) => {
|
|
1063
|
+
var d;
|
|
1064
|
+
if (m.key === "Escape") {
|
|
1065
|
+
m.preventDefault(), (d = M.current) == null || d.call(M);
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1068
|
+
if (m.key !== "Tab") return;
|
|
1069
|
+
const b = N.current;
|
|
1070
|
+
if (!b) return;
|
|
1071
|
+
const A = Array.from(b.querySelectorAll(Xe));
|
|
1072
|
+
if (A.length === 0) return;
|
|
1073
|
+
m.preventDefault();
|
|
1074
|
+
const h = A.indexOf(document.activeElement), S = A.length - 1, k = m.shiftKey ? h <= 0 ? S : h - 1 : h < 0 || h === S ? 0 : h + 1;
|
|
1075
|
+
A[k].focus();
|
|
1076
|
+
};
|
|
1077
|
+
return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
|
|
1078
|
+
}, [e]), !e) return null;
|
|
1079
|
+
const T = (l) => {
|
|
1080
|
+
i && l.target === l.currentTarget && (a == null || a());
|
|
1081
|
+
}, u = /* @__PURE__ */ n(
|
|
1082
|
+
"div",
|
|
1083
|
+
{
|
|
1084
|
+
className: x("gs-actionsheet-backdrop", o && "gs-actionsheet-backdrop--contained"),
|
|
1085
|
+
onClick: T,
|
|
1086
|
+
children: /* @__PURE__ */ H(
|
|
1087
|
+
"div",
|
|
1088
|
+
{
|
|
1089
|
+
ref: v,
|
|
1090
|
+
className: x("gs-actionsheet", f),
|
|
1091
|
+
role: "dialog",
|
|
1092
|
+
"aria-modal": "true",
|
|
1093
|
+
"aria-labelledby": D ? E : void 0,
|
|
1094
|
+
"aria-label": D ? void 0 : _.actions,
|
|
1095
|
+
...p,
|
|
1096
|
+
children: [
|
|
1097
|
+
D && /* @__PURE__ */ n("div", { id: E, className: "gs-actionsheet__title", children: t }),
|
|
1098
|
+
/* @__PURE__ */ H("div", { className: "gs-actionsheet__actions", children: [
|
|
1099
|
+
s.map((l, m) => /* @__PURE__ */ n(
|
|
1100
|
+
"button",
|
|
1101
|
+
{
|
|
1102
|
+
type: "button",
|
|
1103
|
+
className: x(
|
|
1104
|
+
"gs-actionsheet__action",
|
|
1105
|
+
`gs-actionsheet__action--${l.variant ?? "default"}`
|
|
1106
|
+
),
|
|
1107
|
+
disabled: l.disabled,
|
|
1108
|
+
onClick: () => {
|
|
1109
|
+
var b;
|
|
1110
|
+
(b = l.onClick) == null || b.call(l), l.keepOpen || a == null || a();
|
|
1111
|
+
},
|
|
1112
|
+
children: l.label
|
|
1113
|
+
},
|
|
1114
|
+
m
|
|
1115
|
+
)),
|
|
1116
|
+
w !== null && /* @__PURE__ */ n(
|
|
1117
|
+
"button",
|
|
1118
|
+
{
|
|
1119
|
+
type: "button",
|
|
1120
|
+
className: "gs-actionsheet__action gs-actionsheet__action--cancel",
|
|
1121
|
+
onClick: () => a == null ? void 0 : a(),
|
|
1122
|
+
children: w
|
|
1123
|
+
}
|
|
1124
|
+
)
|
|
1125
|
+
] })
|
|
1126
|
+
]
|
|
1127
|
+
}
|
|
1128
|
+
)
|
|
1129
|
+
}
|
|
1130
|
+
);
|
|
1131
|
+
return o ? u : typeof document > "u" ? null : pe(u, document.body);
|
|
1132
|
+
}), Ae = 44, jt = 100, Zt = 150, dt = (r, e, t) => Math.min(Math.max(r, e), t);
|
|
1133
|
+
function ft(r) {
|
|
1134
|
+
const e = r.findIndex((t) => !t.disabled);
|
|
1135
|
+
return e === -1 ? 0 : e;
|
|
1136
|
+
}
|
|
1137
|
+
function Xt(r) {
|
|
1138
|
+
for (let e = r.length - 1; e >= 0; e--) if (!r[e].disabled) return e;
|
|
1139
|
+
return r.length - 1;
|
|
1140
|
+
}
|
|
1141
|
+
function Qt(r, e) {
|
|
1142
|
+
if (r.length === 0) return -1;
|
|
1143
|
+
const t = e === void 0 ? -1 : r.findIndex((s) => s.value === e);
|
|
1144
|
+
return t === -1 ? ft(r) : t;
|
|
1145
|
+
}
|
|
1146
|
+
function Jt(r, e, t) {
|
|
1147
|
+
var s;
|
|
1148
|
+
if (!((s = r[e]) != null && s.disabled)) return e;
|
|
1149
|
+
for (let c = 1; c < r.length; c++) {
|
|
1150
|
+
const a = r[e + c * t];
|
|
1151
|
+
if (a && !a.disabled) return e + c * t;
|
|
1152
|
+
const i = r[e - c * t];
|
|
1153
|
+
if (i && !i.disabled) return e - c * t;
|
|
1154
|
+
}
|
|
1155
|
+
return e;
|
|
1156
|
+
}
|
|
1157
|
+
function Te(r, e, t) {
|
|
1158
|
+
const s = r.length - 1, c = t < 0 ? -1 : 1, a = dt(e + t, 0, s);
|
|
1159
|
+
for (let i = a; i >= 0 && i <= s; i += c) if (!r[i].disabled) return i;
|
|
1160
|
+
for (let i = a - c; i !== e && i >= 0 && i <= s; i -= c)
|
|
1161
|
+
if (!r[i].disabled) return i;
|
|
1162
|
+
return e;
|
|
1163
|
+
}
|
|
1164
|
+
function Kt() {
|
|
1165
|
+
return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1166
|
+
}
|
|
1167
|
+
function Ct({ column: r, selectedIndex: e, idPrefix: t, rows: s, disabled: c, onSelect: a }) {
|
|
1168
|
+
const { key: i, options: o, label: f, width: p, align: g = "center" } = r, _ = U(null), w = U(!1), y = U(!1), E = U(void 0), D = U(0), [N, v] = _t((d) => d + 1, 0), M = U({ key: i, options: o, selectedIndex: e, onSelect: a });
|
|
1169
|
+
Oe(() => {
|
|
1170
|
+
M.current = { key: i, options: o, selectedIndex: e, onSelect: a };
|
|
1171
|
+
}), Oe(() => {
|
|
1172
|
+
const d = _.current;
|
|
1173
|
+
if (!d || e < 0) return;
|
|
1174
|
+
const I = e * Ae;
|
|
1175
|
+
if (Math.abs(d.scrollTop - I) < 1) return;
|
|
1176
|
+
window.clearTimeout(E.current), D.current = performance.now() + Zt;
|
|
1177
|
+
const $ = !w.current || Kt();
|
|
1178
|
+
d.scrollTo({ top: I, behavior: $ ? "auto" : "smooth" });
|
|
1179
|
+
}, [e, s, N]);
|
|
1180
|
+
const T = ce(() => {
|
|
1181
|
+
const d = _.current, { key: I, options: $, selectedIndex: O, onSelect: G } = M.current;
|
|
1182
|
+
if (!d || $.length === 0) return;
|
|
1183
|
+
const Z = dt(Math.round(d.scrollTop / Ae), 0, $.length - 1), j = Jt($, Z, Z >= O ? 1 : -1);
|
|
1184
|
+
j !== O && G(I, j), (j !== O || j !== Z || Math.abs(d.scrollTop - j * Ae) >= 1) && v();
|
|
1185
|
+
}, []), u = ce(() => {
|
|
1186
|
+
window.clearTimeout(E.current), E.current = window.setTimeout(T, jt);
|
|
1187
|
+
}, [T]);
|
|
1188
|
+
ae(() => {
|
|
1189
|
+
w.current = !0;
|
|
1190
|
+
const d = _.current, I = () => {
|
|
1191
|
+
y.current || (window.clearTimeout(E.current), T());
|
|
1192
|
+
};
|
|
1193
|
+
return d == null || d.addEventListener("scrollend", I), () => {
|
|
1194
|
+
w.current = !1, window.clearTimeout(E.current), d == null || d.removeEventListener("scrollend", I);
|
|
1195
|
+
};
|
|
1196
|
+
}, [T]);
|
|
1197
|
+
const l = () => {
|
|
1198
|
+
y.current || performance.now() < D.current || u();
|
|
1199
|
+
}, m = () => {
|
|
1200
|
+
y.current = !0, window.clearTimeout(E.current);
|
|
1201
|
+
}, b = () => {
|
|
1202
|
+
y.current = !1, u();
|
|
1203
|
+
}, A = (d) => {
|
|
1204
|
+
window.clearTimeout(E.current), a(i, d);
|
|
1205
|
+
}, h = (d) => {
|
|
1206
|
+
if (c || o.length === 0) return;
|
|
1207
|
+
const I = s - 1;
|
|
1208
|
+
let $;
|
|
1209
|
+
switch (d.key) {
|
|
1210
|
+
case "ArrowDown":
|
|
1211
|
+
$ = Te(o, e, 1);
|
|
1212
|
+
break;
|
|
1213
|
+
case "ArrowUp":
|
|
1214
|
+
$ = Te(o, e, -1);
|
|
1215
|
+
break;
|
|
1216
|
+
case "PageDown":
|
|
1217
|
+
$ = Te(o, e, I);
|
|
1218
|
+
break;
|
|
1219
|
+
case "PageUp":
|
|
1220
|
+
$ = Te(o, e, -I);
|
|
1221
|
+
break;
|
|
1222
|
+
case "Home":
|
|
1223
|
+
$ = ft(o);
|
|
1224
|
+
break;
|
|
1225
|
+
case "End":
|
|
1226
|
+
$ = Xt(o);
|
|
1227
|
+
break;
|
|
1228
|
+
default:
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
d.preventDefault(), $ !== e && A($);
|
|
1232
|
+
}, S = typeof p == "number" ? `${p}px` : p, k = S === void 0 ? void 0 : { flex: `0 1 ${S}` };
|
|
1233
|
+
return /* @__PURE__ */ H("div", { className: x("gs-picker__column", `gs-picker__column--${g}`), style: k, children: [
|
|
1234
|
+
/* @__PURE__ */ H(
|
|
1235
|
+
"div",
|
|
1236
|
+
{
|
|
1237
|
+
ref: _,
|
|
1238
|
+
role: "listbox",
|
|
1239
|
+
tabIndex: c ? -1 : 0,
|
|
1240
|
+
"aria-label": f ?? i,
|
|
1241
|
+
"aria-disabled": c || void 0,
|
|
1242
|
+
"aria-activedescendant": e >= 0 ? `${t}-o${e}` : void 0,
|
|
1243
|
+
className: "gs-picker__drum",
|
|
1244
|
+
onScroll: l,
|
|
1245
|
+
onTouchStart: m,
|
|
1246
|
+
onTouchEnd: b,
|
|
1247
|
+
onTouchCancel: b,
|
|
1248
|
+
onKeyDown: h,
|
|
1249
|
+
children: [
|
|
1250
|
+
/* @__PURE__ */ n("div", { className: "gs-picker__spacer", "aria-hidden": "true" }),
|
|
1251
|
+
o.map((d, I) => {
|
|
1252
|
+
const $ = I === e;
|
|
1253
|
+
return /* @__PURE__ */ n(
|
|
1254
|
+
"div",
|
|
1255
|
+
{
|
|
1256
|
+
id: `${t}-o${I}`,
|
|
1257
|
+
role: "option",
|
|
1258
|
+
"aria-selected": $,
|
|
1259
|
+
"aria-disabled": d.disabled || void 0,
|
|
1260
|
+
className: x(
|
|
1261
|
+
"gs-picker__row",
|
|
1262
|
+
$ && "gs-picker__row--selected",
|
|
1263
|
+
d.disabled && "gs-picker__row--disabled"
|
|
1264
|
+
),
|
|
1265
|
+
onClick: () => {
|
|
1266
|
+
!c && !d.disabled && !$ && A(I);
|
|
1267
|
+
},
|
|
1268
|
+
children: d.label
|
|
1269
|
+
},
|
|
1270
|
+
d.value
|
|
1271
|
+
);
|
|
1272
|
+
}),
|
|
1273
|
+
/* @__PURE__ */ n("div", { className: "gs-picker__spacer", "aria-hidden": "true" })
|
|
1274
|
+
]
|
|
1275
|
+
}
|
|
1276
|
+
),
|
|
1277
|
+
/* @__PURE__ */ n("div", { className: "gs-picker__shade-top", "aria-hidden": "true" }),
|
|
1278
|
+
/* @__PURE__ */ n("div", { className: "gs-picker__shade-bottom", "aria-hidden": "true" }),
|
|
1279
|
+
/* @__PURE__ */ n("div", { className: "gs-picker__selection", "aria-hidden": "true" })
|
|
1280
|
+
] });
|
|
1281
|
+
}
|
|
1282
|
+
const er = V(function({ columns: e, value: t, defaultValue: s, onChange: c, rows: a = 5, label: i, disabled: o = !1, className: f, ...p }, g) {
|
|
1283
|
+
const _ = ye(), w = t !== void 0, [y, E] = re(() => s ?? {}), D = w ? t : y, N = e.map((T) => Qt(T.options, D[T.key])), v = {};
|
|
1284
|
+
e.forEach((T, u) => {
|
|
1285
|
+
const l = T.options[N[u]];
|
|
1286
|
+
l && (v[T.key] = l.value);
|
|
1287
|
+
});
|
|
1288
|
+
const M = (T, u) => {
|
|
1289
|
+
var b;
|
|
1290
|
+
const l = (b = e.find((A) => A.key === T)) == null ? void 0 : b.options[u];
|
|
1291
|
+
if (!l || l.disabled || v[T] === l.value) return;
|
|
1292
|
+
const m = { ...v, [T]: l.value };
|
|
1293
|
+
w || E(m), c == null || c(m, { key: T, value: l.value });
|
|
1294
|
+
};
|
|
1295
|
+
return /* @__PURE__ */ n(
|
|
1296
|
+
"div",
|
|
1297
|
+
{
|
|
1298
|
+
ref: g,
|
|
1299
|
+
role: "group",
|
|
1300
|
+
"aria-label": i,
|
|
1301
|
+
"aria-disabled": o || void 0,
|
|
1302
|
+
className: x(
|
|
1303
|
+
"gs-picker",
|
|
1304
|
+
`gs-picker--rows-${a}`,
|
|
1305
|
+
o && "gs-picker--disabled",
|
|
1306
|
+
f
|
|
1307
|
+
),
|
|
1308
|
+
...p,
|
|
1309
|
+
children: /* @__PURE__ */ n("div", { className: "gs-picker__frame", children: e.map((T, u) => /* @__PURE__ */ H(bt, { children: [
|
|
1310
|
+
u > 0 && /* @__PURE__ */ n("div", { className: "gs-picker__divider", "aria-hidden": "true" }),
|
|
1311
|
+
/* @__PURE__ */ n(
|
|
1312
|
+
Ct,
|
|
1313
|
+
{
|
|
1314
|
+
column: T,
|
|
1315
|
+
selectedIndex: N[u],
|
|
1316
|
+
idPrefix: `${_}-c${u}`,
|
|
1317
|
+
rows: a,
|
|
1318
|
+
disabled: o,
|
|
1319
|
+
onSelect: M
|
|
1320
|
+
}
|
|
1321
|
+
)
|
|
1322
|
+
] }, T.key)) })
|
|
1323
|
+
}
|
|
1324
|
+
);
|
|
1325
|
+
});
|
|
1326
|
+
function tr(r, e, t) {
|
|
1327
|
+
return Math.min(t, Math.max(e, r));
|
|
1328
|
+
}
|
|
1329
|
+
const rr = V(function({ value: e, max: t = 100, size: s = "sm", showValue: c = !1, label: a, tint: i = "blue", className: o, ...f }, p) {
|
|
1330
|
+
const g = e === void 0 || Number.isNaN(e), _ = g ? void 0 : tr(e, 0, t), w = _ === void 0 || t <= 0 ? 0 : _ / t * 100;
|
|
1331
|
+
return /* @__PURE__ */ H(
|
|
1332
|
+
"div",
|
|
1333
|
+
{
|
|
1334
|
+
ref: p,
|
|
1335
|
+
role: "progressbar",
|
|
1336
|
+
"aria-label": a,
|
|
1337
|
+
"aria-valuemin": 0,
|
|
1338
|
+
"aria-valuemax": t,
|
|
1339
|
+
"aria-valuenow": _,
|
|
1340
|
+
"aria-busy": g || void 0,
|
|
1341
|
+
className: x(
|
|
1342
|
+
"gs-progress",
|
|
1343
|
+
`gs-progress--${s}`,
|
|
1344
|
+
`gs-progress--${i}`,
|
|
1345
|
+
g && "gs-progress--indeterminate",
|
|
1346
|
+
o
|
|
1347
|
+
),
|
|
1348
|
+
...f,
|
|
1349
|
+
children: [
|
|
1350
|
+
/* @__PURE__ */ n("span", { className: "gs-progress__track", children: /* @__PURE__ */ n(
|
|
1351
|
+
"span",
|
|
1352
|
+
{
|
|
1353
|
+
className: "gs-progress__fill",
|
|
1354
|
+
style: g ? void 0 : { width: `${w}%`, minWidth: w > 0 ? 6 : 0 }
|
|
1355
|
+
}
|
|
1356
|
+
) }),
|
|
1357
|
+
c && /* @__PURE__ */ n("span", { className: "gs-progress__value", children: g ? "" : `${Math.round(w)} %` })
|
|
1358
|
+
]
|
|
1359
|
+
}
|
|
1360
|
+
);
|
|
1361
|
+
}), sr = Array.from({ length: 12 }, (r, e) => ({
|
|
1362
|
+
angle: e * 30,
|
|
1363
|
+
opacity: 1 - (12 - e) % 12 * 0.065
|
|
1364
|
+
})), nr = V(
|
|
1365
|
+
function({ size: e = 20, tone: t = "white", label: s, animating: c = !0, className: a, ...i }, o) {
|
|
1366
|
+
const f = ie();
|
|
1367
|
+
return c ? /* @__PURE__ */ n(
|
|
1368
|
+
"span",
|
|
1369
|
+
{
|
|
1370
|
+
ref: o,
|
|
1371
|
+
role: "status",
|
|
1372
|
+
"aria-label": s ?? f.loading,
|
|
1373
|
+
className: x("gs-spinner", `gs-spinner--${t}`, a),
|
|
1374
|
+
...i,
|
|
1375
|
+
children: /* @__PURE__ */ n(
|
|
1376
|
+
"svg",
|
|
1377
|
+
{
|
|
1378
|
+
className: "gs-spinner__svg",
|
|
1379
|
+
viewBox: "0 0 40 40",
|
|
1380
|
+
width: e,
|
|
1381
|
+
height: e,
|
|
1382
|
+
"aria-hidden": "true",
|
|
1383
|
+
focusable: "false",
|
|
1384
|
+
children: sr.map(({ angle: p, opacity: g }) => /* @__PURE__ */ n(
|
|
1385
|
+
"rect",
|
|
1386
|
+
{
|
|
1387
|
+
className: "gs-spinner__spoke",
|
|
1388
|
+
x: 18,
|
|
1389
|
+
y: 3,
|
|
1390
|
+
width: 4,
|
|
1391
|
+
height: 10,
|
|
1392
|
+
rx: 2,
|
|
1393
|
+
transform: `rotate(${p} 20 20)`,
|
|
1394
|
+
opacity: g
|
|
1395
|
+
},
|
|
1396
|
+
p
|
|
1397
|
+
))
|
|
1398
|
+
}
|
|
1399
|
+
)
|
|
1400
|
+
}
|
|
1401
|
+
) : null;
|
|
1402
|
+
}
|
|
1403
|
+
), ar = (r, e, t) => Math.min(t, Math.max(e, r)), Kr = V(function({
|
|
1404
|
+
time: e = "3:53 PM",
|
|
1405
|
+
signal: t = 5,
|
|
1406
|
+
network: s = "3G",
|
|
1407
|
+
carrier: c,
|
|
1408
|
+
battery: a = 100,
|
|
1409
|
+
charging: i = !1,
|
|
1410
|
+
bluetooth: o = !0,
|
|
1411
|
+
tint: f = "black",
|
|
1412
|
+
className: p,
|
|
1413
|
+
...g
|
|
1414
|
+
}, _) {
|
|
1415
|
+
const w = ar(a, 0, 100), y = w <= 20 && !i;
|
|
1416
|
+
return /* @__PURE__ */ H(
|
|
1417
|
+
"div",
|
|
1418
|
+
{
|
|
1419
|
+
ref: _,
|
|
1420
|
+
"aria-hidden": "true",
|
|
1421
|
+
className: x("gs-statusbar", `gs-statusbar--${f}`, p),
|
|
1422
|
+
...g,
|
|
1423
|
+
children: [
|
|
1424
|
+
/* @__PURE__ */ H("div", { className: "gs-statusbar__left", children: [
|
|
1425
|
+
/* @__PURE__ */ H("span", { className: "gs-statusbar__signal", "data-bars": t, children: [
|
|
1426
|
+
/* @__PURE__ */ n("i", {}),
|
|
1427
|
+
/* @__PURE__ */ n("i", {}),
|
|
1428
|
+
/* @__PURE__ */ n("i", {}),
|
|
1429
|
+
/* @__PURE__ */ n("i", {}),
|
|
1430
|
+
/* @__PURE__ */ n("i", {})
|
|
1431
|
+
] }),
|
|
1432
|
+
c && /* @__PURE__ */ n("span", { className: "gs-statusbar__carrier", children: c }),
|
|
1433
|
+
s === "wifi" ? /* @__PURE__ */ n("svg", { className: "gs-statusbar__wifi", width: "15", height: "11", viewBox: "0 0 15 11", fill: "currentColor", children: /* @__PURE__ */ n("path", { d: "M7.5 9.2a1.4 1.4 0 1 1 0 2.8 1.4 1.4 0 0 1 0-2.8Zm0-3.4c1.5 0 2.9.6 3.9 1.6l-1.3 1.3a3.7 3.7 0 0 0-5.2 0L3.6 7.4a5.5 5.5 0 0 1 3.9-1.6Zm0-3.4c2.5 0 4.7 1 6.3 2.6l-1.3 1.3A7.1 7.1 0 0 0 7.5 4.2c-2 0-3.7.8-5 2.1L1.2 5A8.9 8.9 0 0 1 7.5 2.4Z" }) }) : s !== "none" ? /* @__PURE__ */ n("span", { className: "gs-statusbar__net", children: s }) : null
|
|
1434
|
+
] }),
|
|
1435
|
+
/* @__PURE__ */ n("div", { className: "gs-statusbar__time", children: e }),
|
|
1436
|
+
/* @__PURE__ */ H("div", { className: "gs-statusbar__right", children: [
|
|
1437
|
+
o && /* @__PURE__ */ n("svg", { className: "gs-statusbar__bt", width: "8", height: "12", viewBox: "0 0 8 12", fill: "none", stroke: "currentColor", strokeWidth: "1.2", strokeLinejoin: "round", children: /* @__PURE__ */ n("path", { d: "M1 3l6 6-3 2.5V0.5l3 2.5-6 6" }) }),
|
|
1438
|
+
/* @__PURE__ */ H(
|
|
1439
|
+
"span",
|
|
1440
|
+
{
|
|
1441
|
+
className: x("gs-statusbar__battery", y && "gs-statusbar__battery--low", i && "gs-statusbar__battery--charging"),
|
|
1442
|
+
style: { "--gs-battery": `${w}%` },
|
|
1443
|
+
children: [
|
|
1444
|
+
/* @__PURE__ */ n("i", {}),
|
|
1445
|
+
i && /* @__PURE__ */ n("svg", { className: "gs-statusbar__bolt", width: "7", height: "10", viewBox: "0 0 7 10", fill: "#fff", stroke: "rgba(0,0,0,.6)", strokeWidth: ".6", children: /* @__PURE__ */ n("path", { d: "M4.2 0.5 0.8 5.6h2.3L2.6 9.5 6.2 4.2H3.9z" }) })
|
|
1446
|
+
]
|
|
1447
|
+
}
|
|
1448
|
+
)
|
|
1449
|
+
] })
|
|
1450
|
+
]
|
|
1451
|
+
}
|
|
1452
|
+
);
|
|
1453
|
+
}), Cr = V(function({ tint: e = "black", position: t = "bottom", label: s, className: c, children: a, ...i }, o) {
|
|
1454
|
+
const f = ie();
|
|
1455
|
+
return /* @__PURE__ */ n(
|
|
1456
|
+
"div",
|
|
1457
|
+
{
|
|
1458
|
+
ref: o,
|
|
1459
|
+
role: "toolbar",
|
|
1460
|
+
"aria-label": s ?? f.toolbar,
|
|
1461
|
+
className: x("gs-toolbar", `gs-toolbar--${e}`, `gs-toolbar--${t}`, c),
|
|
1462
|
+
...i,
|
|
1463
|
+
children: a
|
|
1464
|
+
}
|
|
1465
|
+
);
|
|
1466
|
+
});
|
|
1467
|
+
function es() {
|
|
1468
|
+
return /* @__PURE__ */ n("span", { "aria-hidden": !0, className: "gs-toolbar__spacer" });
|
|
1469
|
+
}
|
|
1470
|
+
const ts = V(
|
|
1471
|
+
function({ icon: e, label: t, active: s = !1, badge: c, type: a = "button", disabled: i, className: o, ...f }, p) {
|
|
1472
|
+
return /* @__PURE__ */ n(
|
|
1473
|
+
"button",
|
|
1474
|
+
{
|
|
1475
|
+
ref: p,
|
|
1476
|
+
type: a,
|
|
1477
|
+
"aria-label": t,
|
|
1478
|
+
title: t,
|
|
1479
|
+
disabled: i,
|
|
1480
|
+
className: x(
|
|
1481
|
+
"gs-toolbar-button",
|
|
1482
|
+
s && "gs-toolbar-button--active",
|
|
1483
|
+
i && "gs-toolbar-button--disabled",
|
|
1484
|
+
o
|
|
1485
|
+
),
|
|
1486
|
+
...f,
|
|
1487
|
+
children: /* @__PURE__ */ H("span", { className: "gs-toolbar-button__icon", children: [
|
|
1488
|
+
/* @__PURE__ */ n(ne, { icon: e, size: 24, variant: s ? "active" : "gloss" }),
|
|
1489
|
+
/* @__PURE__ */ n(ct, { value: c, className: "gs-toolbar-button__badge" })
|
|
1490
|
+
] })
|
|
1491
|
+
}
|
|
1492
|
+
);
|
|
1493
|
+
}
|
|
1494
|
+
), rs = V(function({ children: e, subtitle: t, className: s, ...c }, a) {
|
|
1495
|
+
const i = t != null && t !== !1;
|
|
1496
|
+
return /* @__PURE__ */ H(
|
|
1497
|
+
"div",
|
|
1498
|
+
{
|
|
1499
|
+
ref: a,
|
|
1500
|
+
className: x("gs-toolbar__title", i && "gs-toolbar__title--stacked", s),
|
|
1501
|
+
...c,
|
|
1502
|
+
children: [
|
|
1503
|
+
/* @__PURE__ */ n("span", { className: "gs-toolbar__title-main", children: e }),
|
|
1504
|
+
i && /* @__PURE__ */ n("span", { className: "gs-toolbar__title-sub", children: t })
|
|
1505
|
+
]
|
|
1506
|
+
}
|
|
1507
|
+
);
|
|
1508
|
+
});
|
|
1509
|
+
function Qe(r, e) {
|
|
1510
|
+
return !Number.isFinite(r) || e <= 0 ? 0 : Math.min(Math.max(Math.trunc(r), 0), e - 1);
|
|
1511
|
+
}
|
|
1512
|
+
const ss = V(function({
|
|
1513
|
+
count: e,
|
|
1514
|
+
value: t,
|
|
1515
|
+
defaultValue: s = 0,
|
|
1516
|
+
onChange: c,
|
|
1517
|
+
label: a,
|
|
1518
|
+
hideForSinglePage: i = !0,
|
|
1519
|
+
size: o = "sm",
|
|
1520
|
+
className: f,
|
|
1521
|
+
onClick: p,
|
|
1522
|
+
onKeyDown: g,
|
|
1523
|
+
..._
|
|
1524
|
+
}, w) {
|
|
1525
|
+
const y = ie(), E = t !== void 0, [D, N] = re(s), v = Qe(E ? t : D, e), M = ce(
|
|
1526
|
+
(m) => {
|
|
1527
|
+
const b = Qe(m, e);
|
|
1528
|
+
b !== v && (E || N(b), c == null || c(b));
|
|
1529
|
+
},
|
|
1530
|
+
[e, v, E, c]
|
|
1531
|
+
), T = (m) => {
|
|
1532
|
+
if (p == null || p(m), m.defaultPrevented || m.target.closest(".gs-pagecontrol__page")) return;
|
|
1533
|
+
const { left: b, width: A } = m.currentTarget.getBoundingClientRect(), h = m.clientX >= b + A / 2;
|
|
1534
|
+
M(v + (h ? 1 : -1));
|
|
1535
|
+
}, u = (m) => {
|
|
1536
|
+
var h;
|
|
1537
|
+
if (g == null || g(m), m.defaultPrevented || e <= 0) return;
|
|
1538
|
+
let b;
|
|
1539
|
+
switch (m.key) {
|
|
1540
|
+
case "ArrowRight":
|
|
1541
|
+
b = (v + 1) % e;
|
|
1542
|
+
break;
|
|
1543
|
+
case "ArrowLeft":
|
|
1544
|
+
b = (v - 1 + e) % e;
|
|
1545
|
+
break;
|
|
1546
|
+
case "Home":
|
|
1547
|
+
b = 0;
|
|
1548
|
+
break;
|
|
1549
|
+
case "End":
|
|
1550
|
+
b = e - 1;
|
|
1551
|
+
break;
|
|
1552
|
+
default:
|
|
1553
|
+
return;
|
|
1554
|
+
}
|
|
1555
|
+
m.preventDefault(), (h = m.currentTarget.querySelectorAll('[role="tab"]')[b]) == null || h.focus(), M(b);
|
|
1556
|
+
};
|
|
1557
|
+
if (i && e <= 1) return null;
|
|
1558
|
+
const l = Array.from({ length: Math.max(0, Math.trunc(e)) }, (m, b) => b);
|
|
1559
|
+
return /* @__PURE__ */ n(
|
|
1560
|
+
"div",
|
|
1561
|
+
{
|
|
1562
|
+
ref: w,
|
|
1563
|
+
role: "tablist",
|
|
1564
|
+
"aria-label": a ?? y.pages,
|
|
1565
|
+
"aria-orientation": "horizontal",
|
|
1566
|
+
className: x("gs-pagecontrol", `gs-pagecontrol--${o}`, f),
|
|
1567
|
+
onClick: T,
|
|
1568
|
+
onKeyDown: u,
|
|
1569
|
+
..._,
|
|
1570
|
+
children: l.map((m) => {
|
|
1571
|
+
const b = m === v;
|
|
1572
|
+
return /* @__PURE__ */ n(
|
|
1573
|
+
"button",
|
|
1574
|
+
{
|
|
1575
|
+
type: "button",
|
|
1576
|
+
role: "tab",
|
|
1577
|
+
"aria-selected": b,
|
|
1578
|
+
"aria-label": y.pageOf(m + 1, l.length),
|
|
1579
|
+
tabIndex: b ? 0 : -1,
|
|
1580
|
+
className: x("gs-pagecontrol__page", b && "gs-pagecontrol__page--current"),
|
|
1581
|
+
onClick: () => M(m),
|
|
1582
|
+
children: /* @__PURE__ */ n("span", { className: "gs-pagecontrol__dot" })
|
|
1583
|
+
},
|
|
1584
|
+
m
|
|
1585
|
+
);
|
|
1586
|
+
})
|
|
1587
|
+
}
|
|
1588
|
+
);
|
|
1589
|
+
}), cr = 8, gt = 8, ir = 12, or = 8, le = or + gt, Se = 20, Je = {
|
|
1590
|
+
top: "bottom",
|
|
1591
|
+
bottom: "top",
|
|
1592
|
+
left: "right",
|
|
1593
|
+
right: "left"
|
|
1594
|
+
};
|
|
1595
|
+
function lr() {
|
|
1596
|
+
return { top: 0, left: 0, width: window.innerWidth, height: window.innerHeight };
|
|
1597
|
+
}
|
|
1598
|
+
function Ee(r, e, t) {
|
|
1599
|
+
return Math.min(Math.max(r, e), Math.max(e, t));
|
|
1600
|
+
}
|
|
1601
|
+
function ur(r, e) {
|
|
1602
|
+
return r.side === e.side && r.top === e.top && r.left === e.left && r.arrowOffset === e.arrowOffset && r.maxWidth === e.maxWidth && r.maxHeight === e.maxHeight;
|
|
1603
|
+
}
|
|
1604
|
+
const ns = V(function({
|
|
1605
|
+
open: e,
|
|
1606
|
+
anchor: t,
|
|
1607
|
+
onClose: s,
|
|
1608
|
+
placement: c = "bottom",
|
|
1609
|
+
width: a = 240,
|
|
1610
|
+
contained: i = !1,
|
|
1611
|
+
dismissOnOutside: o = !0,
|
|
1612
|
+
label: f,
|
|
1613
|
+
className: p,
|
|
1614
|
+
style: g,
|
|
1615
|
+
children: _,
|
|
1616
|
+
...w
|
|
1617
|
+
}, y) {
|
|
1618
|
+
const E = ie(), D = U(null), N = ce(
|
|
1619
|
+
(k) => {
|
|
1620
|
+
D.current = k, typeof y == "function" ? y(k) : y && (y.current = k);
|
|
1621
|
+
},
|
|
1622
|
+
[y]
|
|
1623
|
+
), [v, M] = re(null), T = U(s);
|
|
1624
|
+
T.current = s;
|
|
1625
|
+
const u = ce(() => {
|
|
1626
|
+
const k = D.current;
|
|
1627
|
+
if (!k) return;
|
|
1628
|
+
let d = lr();
|
|
1629
|
+
if (i) {
|
|
1630
|
+
const W = k.offsetParent;
|
|
1631
|
+
if (W) {
|
|
1632
|
+
const P = W.getBoundingClientRect();
|
|
1633
|
+
d = { top: P.top, left: P.left, width: P.width, height: P.height };
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
const I = parseFloat(getComputedStyle(k).getPropertyValue("--gs-popover-gap")), O = (Number.isFinite(I) ? I : cr) + gt + ir, G = k.offsetWidth, Z = k.offsetHeight;
|
|
1637
|
+
let j;
|
|
1638
|
+
if (t) {
|
|
1639
|
+
const W = t.getBoundingClientRect(), P = W.top - d.top, X = W.left - d.left, ee = P + W.height, q = X + W.width, te = X + W.width / 2, Q = P + W.height / 2, J = {
|
|
1640
|
+
top: P,
|
|
1641
|
+
bottom: d.height - ee,
|
|
1642
|
+
left: X,
|
|
1643
|
+
right: d.width - q
|
|
1644
|
+
};
|
|
1645
|
+
let K = c;
|
|
1646
|
+
const oe = K === "top" || K === "bottom", L = O + (oe ? Z : G) + le;
|
|
1647
|
+
J[K] < L && J[Je[K]] > J[K] && (K = Je[K]);
|
|
1648
|
+
const B = Math.max(0, oe ? d.width - 2 * le : J[K] - O - le), z = Math.max(0, oe ? J[K] - O - le : d.height - 2 * le), Y = Math.min(G, B), C = Math.min(Z, z);
|
|
1649
|
+
let he, fe, F;
|
|
1650
|
+
oe ? (he = K === "top" ? P - O - C : ee + O, fe = Ee(te - Y / 2, le, d.width - le - Y), F = Ee(te - fe, Se, Y - Se)) : (fe = K === "left" ? X - O - Y : q + O, he = Ee(Q - C / 2, le, d.height - le - C), F = Ee(Q - he, Se, C - Se)), j = {
|
|
1651
|
+
side: K,
|
|
1652
|
+
top: Math.round(he),
|
|
1653
|
+
left: Math.round(fe),
|
|
1654
|
+
arrowOffset: Math.round(F),
|
|
1655
|
+
maxWidth: B,
|
|
1656
|
+
maxHeight: z
|
|
1657
|
+
};
|
|
1658
|
+
} else {
|
|
1659
|
+
const W = Math.max(0, d.width - 2 * le), P = Math.max(0, d.height - 2 * le), X = Math.min(G, W), ee = Math.min(Z, P);
|
|
1660
|
+
j = {
|
|
1661
|
+
side: c,
|
|
1662
|
+
top: Math.round((d.height - ee) / 2),
|
|
1663
|
+
left: Math.round((d.width - X) / 2),
|
|
1664
|
+
arrowOffset: null,
|
|
1665
|
+
maxWidth: W,
|
|
1666
|
+
maxHeight: P
|
|
1667
|
+
};
|
|
1668
|
+
}
|
|
1669
|
+
M((W) => W && ur(W, j) ? W : j);
|
|
1670
|
+
}, [t, c, i]);
|
|
1671
|
+
Oe(() => {
|
|
1672
|
+
if (!e) {
|
|
1673
|
+
M(null);
|
|
1674
|
+
return;
|
|
1675
|
+
}
|
|
1676
|
+
u(), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0);
|
|
1677
|
+
const k = D.current, d = k && typeof ResizeObserver < "u" ? new ResizeObserver(() => u()) : null;
|
|
1678
|
+
return k && (d == null || d.observe(k)), () => {
|
|
1679
|
+
window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), d == null || d.disconnect();
|
|
1680
|
+
};
|
|
1681
|
+
}, [e, u]);
|
|
1682
|
+
const l = v !== null;
|
|
1683
|
+
if (ae(() => {
|
|
1684
|
+
var d;
|
|
1685
|
+
if (!e || !l) return;
|
|
1686
|
+
const k = document.activeElement;
|
|
1687
|
+
return (d = D.current) == null || d.focus({ preventScroll: !0 }), () => {
|
|
1688
|
+
k && k.isConnected && typeof k.focus == "function" && k.focus({ preventScroll: !0 });
|
|
1689
|
+
};
|
|
1690
|
+
}, [e, l]), ae(() => {
|
|
1691
|
+
if (!e) return;
|
|
1692
|
+
const k = (d) => {
|
|
1693
|
+
var I;
|
|
1694
|
+
d.key === "Escape" && (d.preventDefault(), (I = T.current) == null || I.call(T));
|
|
1695
|
+
};
|
|
1696
|
+
return document.addEventListener("keydown", k), () => document.removeEventListener("keydown", k);
|
|
1697
|
+
}, [e]), !e) return null;
|
|
1698
|
+
const m = (k) => {
|
|
1699
|
+
o && k.target === k.currentTarget && (s == null || s());
|
|
1700
|
+
}, b = (v == null ? void 0 : v.side) ?? c, A = v === null || v.arrowOffset !== null, h = {
|
|
1701
|
+
...g,
|
|
1702
|
+
width: a,
|
|
1703
|
+
top: v == null ? void 0 : v.top,
|
|
1704
|
+
left: v == null ? void 0 : v.left,
|
|
1705
|
+
maxWidth: v == null ? void 0 : v.maxWidth,
|
|
1706
|
+
maxHeight: v == null ? void 0 : v.maxHeight,
|
|
1707
|
+
"--gs-popover-arrow-offset": v && v.arrowOffset !== null ? `${v.arrowOffset}px` : void 0
|
|
1708
|
+
}, S = /* @__PURE__ */ n(
|
|
1709
|
+
"div",
|
|
1710
|
+
{
|
|
1711
|
+
className: x(
|
|
1712
|
+
"gs-popover-backdrop",
|
|
1713
|
+
i && "gs-popover-backdrop--contained",
|
|
1714
|
+
!o && "gs-popover-backdrop--passthrough"
|
|
1715
|
+
),
|
|
1716
|
+
onClick: m,
|
|
1717
|
+
children: /* @__PURE__ */ H(
|
|
1718
|
+
"div",
|
|
1719
|
+
{
|
|
1720
|
+
ref: N,
|
|
1721
|
+
className: x("gs-popover", `gs-popover--${b}`, l && "gs-popover--ready", p),
|
|
1722
|
+
role: "dialog",
|
|
1723
|
+
"aria-modal": "false",
|
|
1724
|
+
"aria-label": f ?? E.dialog,
|
|
1725
|
+
tabIndex: -1,
|
|
1726
|
+
style: h,
|
|
1727
|
+
...w,
|
|
1728
|
+
children: [
|
|
1729
|
+
A && /* @__PURE__ */ n("div", { className: "gs-popover__arrow", "aria-hidden": "true" }),
|
|
1730
|
+
/* @__PURE__ */ n("div", { className: "gs-popover__content", children: _ })
|
|
1731
|
+
]
|
|
1732
|
+
}
|
|
1733
|
+
)
|
|
1734
|
+
}
|
|
1735
|
+
);
|
|
1736
|
+
return i ? S : typeof document > "u" ? null : pe(S, document.body);
|
|
1737
|
+
});
|
|
1738
|
+
function $e(r) {
|
|
1739
|
+
return r != null && r !== !1 && r !== "";
|
|
1740
|
+
}
|
|
1741
|
+
const as = V(function({
|
|
1742
|
+
open: e,
|
|
1743
|
+
kind: t = "loading",
|
|
1744
|
+
title: s,
|
|
1745
|
+
message: c,
|
|
1746
|
+
progress: a,
|
|
1747
|
+
icon: i,
|
|
1748
|
+
duration: o,
|
|
1749
|
+
onClose: f,
|
|
1750
|
+
position: p = "center",
|
|
1751
|
+
blocking: g = !1,
|
|
1752
|
+
contained: _ = !1,
|
|
1753
|
+
className: w,
|
|
1754
|
+
...y
|
|
1755
|
+
}, E) {
|
|
1756
|
+
const D = ie(), N = U(f);
|
|
1757
|
+
if (N.current = f, ae(() => {
|
|
1758
|
+
if (!e || o === void 0) return;
|
|
1759
|
+
const m = window.setTimeout(() => {
|
|
1760
|
+
var b;
|
|
1761
|
+
return (b = N.current) == null ? void 0 : b.call(N);
|
|
1762
|
+
}, o);
|
|
1763
|
+
return () => window.clearTimeout(m);
|
|
1764
|
+
}, [e, o, s, t]), !e) return null;
|
|
1765
|
+
const v = $e(s), M = $e(c), T = t === "loading" || t === "progress" || g;
|
|
1766
|
+
let u = null;
|
|
1767
|
+
switch (t) {
|
|
1768
|
+
case "loading":
|
|
1769
|
+
u = /* @__PURE__ */ n(nr, { size: 37, tone: "white", "aria-hidden": v || void 0 });
|
|
1770
|
+
break;
|
|
1771
|
+
case "progress":
|
|
1772
|
+
u = /* @__PURE__ */ n("div", { className: "gs-hud__progress", children: /* @__PURE__ */ n(
|
|
1773
|
+
rr,
|
|
1774
|
+
{
|
|
1775
|
+
value: a,
|
|
1776
|
+
size: "md",
|
|
1777
|
+
tint: "gray",
|
|
1778
|
+
label: typeof s == "string" ? s : D.progress
|
|
1779
|
+
}
|
|
1780
|
+
) });
|
|
1781
|
+
break;
|
|
1782
|
+
case "success":
|
|
1783
|
+
u = /* @__PURE__ */ n(ne, { icon: ot, variant: "flat", size: 56, strokeWidth: 3 });
|
|
1784
|
+
break;
|
|
1785
|
+
case "error":
|
|
1786
|
+
u = /* @__PURE__ */ n(ne, { icon: Rt, variant: "flat", size: 56, strokeWidth: 3 });
|
|
1787
|
+
break;
|
|
1788
|
+
case "custom":
|
|
1789
|
+
u = $e(i) ? i : null;
|
|
1790
|
+
break;
|
|
1791
|
+
}
|
|
1792
|
+
const l = /* @__PURE__ */ n(
|
|
1793
|
+
"div",
|
|
1794
|
+
{
|
|
1795
|
+
className: x(
|
|
1796
|
+
"gs-hud-backdrop",
|
|
1797
|
+
`gs-hud-backdrop--${p}`,
|
|
1798
|
+
_ && "gs-hud-backdrop--contained",
|
|
1799
|
+
g && "gs-hud-backdrop--blocking"
|
|
1800
|
+
),
|
|
1801
|
+
children: /* @__PURE__ */ H(
|
|
1802
|
+
"div",
|
|
1803
|
+
{
|
|
1804
|
+
ref: E,
|
|
1805
|
+
className: x("gs-hud", `gs-hud--${t}`, w),
|
|
1806
|
+
role: t === "error" ? "alert" : "status",
|
|
1807
|
+
"aria-live": t === "error" ? "assertive" : "polite",
|
|
1808
|
+
"aria-busy": T || void 0,
|
|
1809
|
+
...y,
|
|
1810
|
+
children: [
|
|
1811
|
+
u !== null && /* @__PURE__ */ n("div", { className: "gs-hud__graphic", children: u }),
|
|
1812
|
+
v && /* @__PURE__ */ n("div", { className: "gs-hud__title", children: s }),
|
|
1813
|
+
M && /* @__PURE__ */ n("div", { className: "gs-hud__message", children: c })
|
|
1814
|
+
]
|
|
1815
|
+
}
|
|
1816
|
+
)
|
|
1817
|
+
}
|
|
1818
|
+
);
|
|
1819
|
+
return _ ? l : typeof document > "u" ? null : pe(l, document.body);
|
|
1820
|
+
}), ge = (r) => r.split("").map((e) => ({ kind: "char", value: e })), dr = { kind: "shift" }, Le = { kind: "delete" }, Pe = { kind: "space" }, Re = { kind: "return" }, fr = { kind: "layer", to: "numbers", text: "123" }, gr = { kind: "layer", to: "symbols", text: "#+=" }, Ke = { kind: "layer", to: "letters", text: "ABC", wide: !0 }, hr = { kind: "layer", to: "numbers", text: "123", wide: !0 }, mr = {
|
|
1821
|
+
letters: [
|
|
1822
|
+
ge("qwertyuiop"),
|
|
1823
|
+
ge("asdfghjkl"),
|
|
1824
|
+
[dr, ...ge("zxcvbnm"), Le],
|
|
1825
|
+
[hr, Pe, Re]
|
|
1826
|
+
],
|
|
1827
|
+
numbers: [
|
|
1828
|
+
ge("1234567890"),
|
|
1829
|
+
ge('-/:;()$&@"'),
|
|
1830
|
+
[gr, ...ge(".,?!'"), Le],
|
|
1831
|
+
[Ke, Pe, Re]
|
|
1832
|
+
],
|
|
1833
|
+
symbols: [
|
|
1834
|
+
ge("[]{}#%^*+="),
|
|
1835
|
+
ge("_\\|~<>€£¥•"),
|
|
1836
|
+
[fr, ...ge(".,?!'"), Le],
|
|
1837
|
+
[Ke, Pe, Re]
|
|
1838
|
+
]
|
|
1839
|
+
}, pr = {
|
|
1840
|
+
letters: "letters",
|
|
1841
|
+
numbers: "numbers",
|
|
1842
|
+
symbols: "symbols"
|
|
1843
|
+
}, br = {
|
|
1844
|
+
return: "return",
|
|
1845
|
+
Go: "go",
|
|
1846
|
+
Search: "search",
|
|
1847
|
+
Done: "done",
|
|
1848
|
+
Send: "send",
|
|
1849
|
+
Next: "next"
|
|
1850
|
+
}, _r = 46, vr = 300, yr = 500, kr = 100, Ce = (r) => r.length === 0 || /[.!?]\s+$/.test(r) || /\n\s*$/.test(r), cs = V(function({
|
|
1851
|
+
value: e,
|
|
1852
|
+
onChange: t,
|
|
1853
|
+
onKey: s,
|
|
1854
|
+
onBackspace: c,
|
|
1855
|
+
onReturn: a,
|
|
1856
|
+
returnKey: i = "return",
|
|
1857
|
+
layer: o,
|
|
1858
|
+
onLayerChange: f,
|
|
1859
|
+
defaultShift: p = !1,
|
|
1860
|
+
autoCapitalize: g = !1,
|
|
1861
|
+
disabled: _ = !1,
|
|
1862
|
+
label: w,
|
|
1863
|
+
className: y,
|
|
1864
|
+
...E
|
|
1865
|
+
}, D) {
|
|
1866
|
+
const N = ie(), v = U(null);
|
|
1867
|
+
De(D, () => v.current, []);
|
|
1868
|
+
const [M, T] = re("letters"), u = o ?? M, [l, m] = re(
|
|
1869
|
+
() => p || g && t && Ce(e ?? "") ? "on" : "off"
|
|
1870
|
+
), [b, A] = re(null), h = U({ value: e, onChange: t, onBackspace: c, autoCapitalize: g });
|
|
1871
|
+
h.current = { value: e, onChange: t, onBackspace: c, autoCapitalize: g };
|
|
1872
|
+
const S = U(0), k = U(null), d = U(null), I = U(!1), $ = () => {
|
|
1873
|
+
k.current && clearTimeout(k.current), d.current && clearInterval(d.current), k.current = null, d.current = null;
|
|
1874
|
+
};
|
|
1875
|
+
ae(() => $, []);
|
|
1876
|
+
const O = (L, B) => {
|
|
1877
|
+
const { autoCapitalize: z, onChange: Y } = h.current;
|
|
1878
|
+
m((C) => C === "caps" ? C : z && Y ? Ce(L) ? "on" : "off" : B ? "off" : C);
|
|
1879
|
+
}, G = (L) => {
|
|
1880
|
+
L !== u && (o === void 0 && T(L), f == null || f(L), O(e ?? "", !0));
|
|
1881
|
+
}, Z = (L) => {
|
|
1882
|
+
const B = u === "letters", z = B && l !== "off" ? L.toUpperCase() : L, Y = (e ?? "") + z;
|
|
1883
|
+
s == null || s(z), t == null || t(Y), O(Y, B);
|
|
1884
|
+
}, j = () => {
|
|
1885
|
+
const L = (e ?? "") + " ";
|
|
1886
|
+
s == null || s(" "), t == null || t(L), O(L, !1);
|
|
1887
|
+
}, W = () => {
|
|
1888
|
+
const L = i === "return", B = L ? (e ?? "") + `
|
|
1889
|
+
` : e ?? "";
|
|
1890
|
+
s == null || s(`
|
|
1891
|
+
`), a == null || a(), L && (t == null || t(B)), O(B, !1);
|
|
1892
|
+
}, P = () => {
|
|
1893
|
+
const { value: L, onChange: B, onBackspace: z } = h.current, Y = (L ?? "").slice(0, -1);
|
|
1894
|
+
z == null || z(), B == null || B(Y), O(Y, !1);
|
|
1895
|
+
}, X = () => {
|
|
1896
|
+
const L = Date.now(), B = L - S.current < vr;
|
|
1897
|
+
S.current = L, m((z) => z === "caps" ? "off" : z === "on" ? B ? "caps" : "off" : "on");
|
|
1898
|
+
}, ee = (L) => {
|
|
1899
|
+
const B = v.current;
|
|
1900
|
+
if (!B) return;
|
|
1901
|
+
const z = L.getBoundingClientRect(), Y = B.getBoundingClientRect(), C = (_r - z.width) / 2;
|
|
1902
|
+
if (z.left - C < Y.left) return "left";
|
|
1903
|
+
if (z.right + C > Y.right) return "right";
|
|
1904
|
+
}, q = (L, B) => (z) => {
|
|
1905
|
+
z.preventDefault(), !(z.button !== 0 && z.pointerType === "mouse") && (A({
|
|
1906
|
+
id: L,
|
|
1907
|
+
edge: B.kind === "char" ? ee(z.currentTarget) : void 0
|
|
1908
|
+
}), B.kind === "delete" && ($(), I.current = !1, k.current = setTimeout(() => {
|
|
1909
|
+
I.current = !0, P(), d.current = setInterval(P, kr);
|
|
1910
|
+
}, yr)));
|
|
1911
|
+
}, te = () => {
|
|
1912
|
+
A(null), $();
|
|
1913
|
+
}, Q = (L) => L.preventDefault(), J = (L) => (B) => {
|
|
1914
|
+
switch (L.kind) {
|
|
1915
|
+
case "char":
|
|
1916
|
+
Z(L.value);
|
|
1917
|
+
break;
|
|
1918
|
+
case "space":
|
|
1919
|
+
j();
|
|
1920
|
+
break;
|
|
1921
|
+
case "return":
|
|
1922
|
+
W();
|
|
1923
|
+
break;
|
|
1924
|
+
case "shift":
|
|
1925
|
+
X();
|
|
1926
|
+
break;
|
|
1927
|
+
case "layer":
|
|
1928
|
+
G(L.to);
|
|
1929
|
+
break;
|
|
1930
|
+
case "delete":
|
|
1931
|
+
I.current && B.detail !== 0 ? I.current = !1 : P();
|
|
1932
|
+
break;
|
|
1933
|
+
}
|
|
1934
|
+
}, K = u === "letters" && l !== "off", oe = (L, B) => {
|
|
1935
|
+
const z = (b == null ? void 0 : b.id) === B, Y = {
|
|
1936
|
+
type: "button",
|
|
1937
|
+
disabled: _,
|
|
1938
|
+
onPointerDown: q(B, L),
|
|
1939
|
+
onPointerUp: te,
|
|
1940
|
+
onPointerLeave: te,
|
|
1941
|
+
onPointerCancel: te,
|
|
1942
|
+
onMouseDown: Q,
|
|
1943
|
+
onClick: J(L)
|
|
1944
|
+
};
|
|
1945
|
+
switch (L.kind) {
|
|
1946
|
+
case "char": {
|
|
1947
|
+
const C = K ? L.value.toUpperCase() : L.value;
|
|
1948
|
+
return /* @__PURE__ */ H(
|
|
1949
|
+
"button",
|
|
1950
|
+
{
|
|
1951
|
+
...Y,
|
|
1952
|
+
className: x(
|
|
1953
|
+
"gs-keyboard__key",
|
|
1954
|
+
"gs-keyboard__key--letter",
|
|
1955
|
+
u !== "letters" && "gs-keyboard__key--symbol",
|
|
1956
|
+
z && "gs-keyboard__key--pressed"
|
|
1957
|
+
),
|
|
1958
|
+
children: [
|
|
1959
|
+
C,
|
|
1960
|
+
z && /* @__PURE__ */ n(
|
|
1961
|
+
"span",
|
|
1962
|
+
{
|
|
1963
|
+
"aria-hidden": "true",
|
|
1964
|
+
className: x(
|
|
1965
|
+
"gs-keyboard__popup",
|
|
1966
|
+
(b == null ? void 0 : b.edge) === "left" && "gs-keyboard__popup--left",
|
|
1967
|
+
(b == null ? void 0 : b.edge) === "right" && "gs-keyboard__popup--right"
|
|
1968
|
+
),
|
|
1969
|
+
children: C
|
|
1970
|
+
}
|
|
1971
|
+
)
|
|
1972
|
+
]
|
|
1973
|
+
},
|
|
1974
|
+
B
|
|
1975
|
+
);
|
|
1976
|
+
}
|
|
1977
|
+
case "shift":
|
|
1978
|
+
return /* @__PURE__ */ n(
|
|
1979
|
+
"button",
|
|
1980
|
+
{
|
|
1981
|
+
...Y,
|
|
1982
|
+
"aria-label": N.shift,
|
|
1983
|
+
"aria-pressed": l !== "off",
|
|
1984
|
+
className: x(
|
|
1985
|
+
"gs-keyboard__key",
|
|
1986
|
+
"gs-keyboard__key--fn",
|
|
1987
|
+
"gs-keyboard__key--shift",
|
|
1988
|
+
l === "on" && "gs-keyboard__key--shift-on",
|
|
1989
|
+
l === "caps" && "gs-keyboard__key--caps",
|
|
1990
|
+
z && "gs-keyboard__key--pressed"
|
|
1991
|
+
),
|
|
1992
|
+
children: /* @__PURE__ */ n(
|
|
1993
|
+
ne,
|
|
1994
|
+
{
|
|
1995
|
+
icon: Mt,
|
|
1996
|
+
variant: "flat",
|
|
1997
|
+
size: 22,
|
|
1998
|
+
strokeWidth: 2,
|
|
1999
|
+
fill: l !== "off" ? "currentColor" : "none",
|
|
2000
|
+
className: "gs-keyboard__icon"
|
|
2001
|
+
}
|
|
2002
|
+
)
|
|
2003
|
+
},
|
|
2004
|
+
B
|
|
2005
|
+
);
|
|
2006
|
+
case "delete":
|
|
2007
|
+
return /* @__PURE__ */ n(
|
|
2008
|
+
"button",
|
|
2009
|
+
{
|
|
2010
|
+
...Y,
|
|
2011
|
+
"aria-label": N.delete,
|
|
2012
|
+
className: x(
|
|
2013
|
+
"gs-keyboard__key",
|
|
2014
|
+
"gs-keyboard__key--fn",
|
|
2015
|
+
"gs-keyboard__key--delete",
|
|
2016
|
+
z && "gs-keyboard__key--pressed"
|
|
2017
|
+
),
|
|
2018
|
+
children: /* @__PURE__ */ n(
|
|
2019
|
+
ne,
|
|
2020
|
+
{
|
|
2021
|
+
icon: At,
|
|
2022
|
+
variant: "flat",
|
|
2023
|
+
size: 22,
|
|
2024
|
+
strokeWidth: 2,
|
|
2025
|
+
className: "gs-keyboard__icon"
|
|
2026
|
+
}
|
|
2027
|
+
)
|
|
2028
|
+
},
|
|
2029
|
+
B
|
|
2030
|
+
);
|
|
2031
|
+
case "layer":
|
|
2032
|
+
return /* @__PURE__ */ n(
|
|
2033
|
+
"button",
|
|
2034
|
+
{
|
|
2035
|
+
...Y,
|
|
2036
|
+
"aria-label": N[pr[L.to]],
|
|
2037
|
+
className: x(
|
|
2038
|
+
"gs-keyboard__key",
|
|
2039
|
+
"gs-keyboard__key--fn",
|
|
2040
|
+
L.wide && "gs-keyboard__key--wide",
|
|
2041
|
+
z && "gs-keyboard__key--pressed"
|
|
2042
|
+
),
|
|
2043
|
+
children: L.text
|
|
2044
|
+
},
|
|
2045
|
+
B
|
|
2046
|
+
);
|
|
2047
|
+
case "space":
|
|
2048
|
+
return /* @__PURE__ */ n(
|
|
2049
|
+
"button",
|
|
2050
|
+
{
|
|
2051
|
+
...Y,
|
|
2052
|
+
"aria-label": N.space,
|
|
2053
|
+
className: x(
|
|
2054
|
+
"gs-keyboard__key",
|
|
2055
|
+
"gs-keyboard__key--space",
|
|
2056
|
+
z && "gs-keyboard__key--pressed"
|
|
2057
|
+
),
|
|
2058
|
+
children: N.space
|
|
2059
|
+
},
|
|
2060
|
+
B
|
|
2061
|
+
);
|
|
2062
|
+
case "return": {
|
|
2063
|
+
const C = N[br[i]];
|
|
2064
|
+
return /* @__PURE__ */ n(
|
|
2065
|
+
"button",
|
|
2066
|
+
{
|
|
2067
|
+
...Y,
|
|
2068
|
+
"aria-label": C,
|
|
2069
|
+
className: x(
|
|
2070
|
+
"gs-keyboard__key",
|
|
2071
|
+
"gs-keyboard__key--return",
|
|
2072
|
+
i !== "return" && "gs-keyboard__key--return-blue",
|
|
2073
|
+
z && "gs-keyboard__key--pressed"
|
|
2074
|
+
),
|
|
2075
|
+
children: C
|
|
2076
|
+
},
|
|
2077
|
+
B
|
|
2078
|
+
);
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
};
|
|
2082
|
+
return /* @__PURE__ */ n(
|
|
2083
|
+
"div",
|
|
2084
|
+
{
|
|
2085
|
+
ref: v,
|
|
2086
|
+
role: "group",
|
|
2087
|
+
"aria-label": w ?? N.keyboard,
|
|
2088
|
+
"aria-disabled": _ || void 0,
|
|
2089
|
+
className: x("gs-keyboard", _ && "gs-keyboard--disabled", y),
|
|
2090
|
+
...E,
|
|
2091
|
+
children: mr[u].map((L, B) => /* @__PURE__ */ n(
|
|
2092
|
+
"div",
|
|
2093
|
+
{
|
|
2094
|
+
className: x(
|
|
2095
|
+
"gs-keyboard__row",
|
|
2096
|
+
B === 1 && "gs-keyboard__row--inset",
|
|
2097
|
+
B === 3 && "gs-keyboard__row--bottom"
|
|
2098
|
+
),
|
|
2099
|
+
children: L.map((z, Y) => oe(z, `${B}-${Y}`))
|
|
2100
|
+
},
|
|
2101
|
+
B
|
|
2102
|
+
))
|
|
2103
|
+
}
|
|
2104
|
+
);
|
|
2105
|
+
}), Fe = (r) => String(r).padStart(2, "0");
|
|
2106
|
+
function ht(r, e) {
|
|
2107
|
+
return new Date(e, r, 0).getDate();
|
|
2108
|
+
}
|
|
2109
|
+
function We(r) {
|
|
2110
|
+
return `${r.getFullYear()}-${Fe(r.getMonth() + 1)}-${Fe(r.getDate())}`;
|
|
2111
|
+
}
|
|
2112
|
+
function wr(r) {
|
|
2113
|
+
const [e, t, s] = r.split("-").map(Number);
|
|
2114
|
+
return [e, t, s];
|
|
2115
|
+
}
|
|
2116
|
+
function et(r, e) {
|
|
2117
|
+
const t = new Date(r.getTime());
|
|
2118
|
+
t.setSeconds(0, 0);
|
|
2119
|
+
const s = Math.round(t.getMinutes() / e) * e;
|
|
2120
|
+
return s !== t.getMinutes() && t.setMinutes(s), t;
|
|
2121
|
+
}
|
|
2122
|
+
function tt(r, e) {
|
|
2123
|
+
const t = r.getHours(), s = { minute: String(r.getMinutes()) };
|
|
2124
|
+
return e === "h12" ? (s.hour = String(t % 12 || 12), s.period = t < 12 ? "am" : "pm") : s.hour = String(t), s;
|
|
2125
|
+
}
|
|
2126
|
+
function Nr(r, e, t) {
|
|
2127
|
+
switch (e) {
|
|
2128
|
+
case "date":
|
|
2129
|
+
return {
|
|
2130
|
+
month: String(r.getMonth() + 1),
|
|
2131
|
+
day: String(r.getDate()),
|
|
2132
|
+
year: String(r.getFullYear())
|
|
2133
|
+
};
|
|
2134
|
+
case "time":
|
|
2135
|
+
return tt(r, t);
|
|
2136
|
+
case "dateTime":
|
|
2137
|
+
return { day: We(r), ...tt(r, t) };
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
function Tr(r, e, t, s) {
|
|
2141
|
+
let c = e.getFullYear(), a = e.getMonth() + 1, i = e.getDate(), o = e.getHours(), f = e.getMinutes();
|
|
2142
|
+
t === "date" ? (c = Number(r.year), a = Number(r.month), i = Number(r.day)) : t === "dateTime" && ([c, a, i] = wr(r.day)), t !== "date" && (f = Number(r.minute), o = s === "h12" ? Number(r.hour) % 12 + (r.period === "pm" ? 12 : 0) : Number(r.hour)), i = Math.min(i, ht(a, c));
|
|
2143
|
+
const p = new Date(e.getTime());
|
|
2144
|
+
return p.setFullYear(c, a - 1, i), p.setHours(o, f, 0, 0), p;
|
|
2145
|
+
}
|
|
2146
|
+
function Sr(r) {
|
|
2147
|
+
const e = new Intl.DateTimeFormat(r, { month: "long" });
|
|
2148
|
+
return Array.from({ length: 12 }, (t, s) => ({
|
|
2149
|
+
value: String(s + 1),
|
|
2150
|
+
label: e.format(new Date(2e3, s, 1))
|
|
2151
|
+
}));
|
|
2152
|
+
}
|
|
2153
|
+
function _e(r, e, t = 1, s = !1) {
|
|
2154
|
+
const c = [];
|
|
2155
|
+
for (let a = r; a <= e; a += t) c.push({ value: String(a), label: s ? Fe(a) : String(a) });
|
|
2156
|
+
return c;
|
|
2157
|
+
}
|
|
2158
|
+
function Er(r, e, t) {
|
|
2159
|
+
const s = (c, a) => {
|
|
2160
|
+
var i;
|
|
2161
|
+
try {
|
|
2162
|
+
return ((i = new Intl.DateTimeFormat(r, { hour: "numeric", hour12: !0 }).formatToParts(
|
|
2163
|
+
new Date(2e3, 0, 1, c)
|
|
2164
|
+
).find((f) => f.type === "dayPeriod")) == null ? void 0 : i.value) ?? a;
|
|
2165
|
+
} catch {
|
|
2166
|
+
return a;
|
|
2167
|
+
}
|
|
2168
|
+
};
|
|
2169
|
+
return [
|
|
2170
|
+
{ value: "am", label: s(9, e) },
|
|
2171
|
+
{ value: "pm", label: s(21, t) }
|
|
2172
|
+
];
|
|
2173
|
+
}
|
|
2174
|
+
function Mr(r, e, t, s, c) {
|
|
2175
|
+
const a = new Intl.DateTimeFormat(t, { weekday: "short", month: "short", day: "numeric" }), i = [];
|
|
2176
|
+
for (let o = -e; o <= e; o++) {
|
|
2177
|
+
const f = new Date(r.getFullYear(), r.getMonth(), r.getDate() + o, 12), p = We(f);
|
|
2178
|
+
i.push({ value: p, label: p === s ? c : a.format(f) });
|
|
2179
|
+
}
|
|
2180
|
+
return i;
|
|
2181
|
+
}
|
|
2182
|
+
const is = V(function({
|
|
2183
|
+
mode: e = "date",
|
|
2184
|
+
value: t,
|
|
2185
|
+
defaultValue: s,
|
|
2186
|
+
onChange: c,
|
|
2187
|
+
minuteInterval: a = 1,
|
|
2188
|
+
hourCycle: i = "h12",
|
|
2189
|
+
yearRange: o = [1970, 2037],
|
|
2190
|
+
dayRange: f = 365,
|
|
2191
|
+
locale: p,
|
|
2192
|
+
rows: g,
|
|
2193
|
+
disabled: _,
|
|
2194
|
+
label: w,
|
|
2195
|
+
className: y,
|
|
2196
|
+
...E
|
|
2197
|
+
}, D) {
|
|
2198
|
+
const N = ie(), v = Nt(), M = p ?? v ?? "en-US", T = t !== void 0, [u, l] = re(
|
|
2199
|
+
() => et(s ?? /* @__PURE__ */ new Date(), a)
|
|
2200
|
+
), m = T ? t : u, b = e === "date" ? m : et(m, a), A = Nr(b, e, i), [h, S] = re(() => m), k = Math.round(
|
|
2201
|
+
(new Date(b.getFullYear(), b.getMonth(), b.getDate(), 12).getTime() - new Date(h.getFullYear(), h.getMonth(), h.getDate(), 12).getTime()) / 864e5
|
|
2202
|
+
);
|
|
2203
|
+
e === "dateTime" && Math.abs(k) > f && S(b);
|
|
2204
|
+
const d = Number(A.month), I = Number(A.year), [$, O] = o, G = We(/* @__PURE__ */ new Date()), Z = ue(() => Sr(M), [M]), j = ue(
|
|
2205
|
+
() => e === "date" ? _e(1, ht(d, I)) : [],
|
|
2206
|
+
[e, d, I]
|
|
2207
|
+
), W = ue(() => _e($, O), [$, O]), P = ue(
|
|
2208
|
+
() => i === "h12" ? _e(1, 12) : _e(0, 23),
|
|
2209
|
+
[i]
|
|
2210
|
+
), X = ue(() => _e(0, 59, a, !0), [a]), ee = ue(
|
|
2211
|
+
() => Er(M, N.am, N.pm),
|
|
2212
|
+
[M, N.am, N.pm]
|
|
2213
|
+
), q = ue(
|
|
2214
|
+
() => e === "dateTime" ? Mr(h, f, M, G, N.today) : [],
|
|
2215
|
+
[e, h, f, M, G, N.today]
|
|
2216
|
+
), {
|
|
2217
|
+
month: te,
|
|
2218
|
+
day: Q,
|
|
2219
|
+
year: J,
|
|
2220
|
+
hour: K,
|
|
2221
|
+
minute: oe,
|
|
2222
|
+
dayPeriod: L
|
|
2223
|
+
} = N, B = ue(() => {
|
|
2224
|
+
const Y = i === "h12";
|
|
2225
|
+
switch (e) {
|
|
2226
|
+
case "date":
|
|
2227
|
+
return [
|
|
2228
|
+
{ key: "month", label: te, align: "left", width: "46%", options: Z },
|
|
2229
|
+
{ key: "day", label: Q, align: "right", width: "20%", options: j },
|
|
2230
|
+
{ key: "year", label: J, width: "34%", options: W }
|
|
2231
|
+
];
|
|
2232
|
+
case "time":
|
|
2233
|
+
return [
|
|
2234
|
+
{ key: "hour", label: K, align: "right", width: Y ? "34%" : "50%", options: P },
|
|
2235
|
+
{ key: "minute", label: oe, width: Y ? "33%" : "50%", options: X },
|
|
2236
|
+
...Y ? [{ key: "period", label: L, width: "33%", options: ee }] : []
|
|
2237
|
+
];
|
|
2238
|
+
case "dateTime":
|
|
2239
|
+
return [
|
|
2240
|
+
{ key: "day", label: Q, align: "left", width: Y ? "44%" : "56%", options: q },
|
|
2241
|
+
{ key: "hour", label: K, align: "right", width: Y ? "18%" : "22%", options: P },
|
|
2242
|
+
{ key: "minute", label: oe, width: Y ? "18%" : "22%", options: X },
|
|
2243
|
+
...Y ? [{ key: "period", label: L, width: "20%", options: ee }] : []
|
|
2244
|
+
];
|
|
2245
|
+
}
|
|
2246
|
+
}, [
|
|
2247
|
+
e,
|
|
2248
|
+
i,
|
|
2249
|
+
Z,
|
|
2250
|
+
j,
|
|
2251
|
+
W,
|
|
2252
|
+
P,
|
|
2253
|
+
X,
|
|
2254
|
+
ee,
|
|
2255
|
+
q,
|
|
2256
|
+
te,
|
|
2257
|
+
Q,
|
|
2258
|
+
J,
|
|
2259
|
+
K,
|
|
2260
|
+
oe,
|
|
2261
|
+
L
|
|
2262
|
+
]);
|
|
2263
|
+
return /* @__PURE__ */ n(
|
|
2264
|
+
er,
|
|
2265
|
+
{
|
|
2266
|
+
ref: D,
|
|
2267
|
+
columns: B,
|
|
2268
|
+
value: A,
|
|
2269
|
+
onChange: (Y) => {
|
|
2270
|
+
const C = Tr(Y, m, e, i);
|
|
2271
|
+
T || l(C), c == null || c(C);
|
|
2272
|
+
},
|
|
2273
|
+
rows: g,
|
|
2274
|
+
disabled: _,
|
|
2275
|
+
label: w ?? N[e],
|
|
2276
|
+
className: x("gs-datepicker", `gs-datepicker--${e.toLowerCase()}`, y),
|
|
2277
|
+
...E
|
|
2278
|
+
}
|
|
2279
|
+
);
|
|
2280
|
+
}), xr = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
2281
|
+
function Me(r) {
|
|
2282
|
+
return Array.from(r.querySelectorAll(xr)).filter(
|
|
2283
|
+
(e) => e.tabIndex >= 0 && !e.disabled && e.getClientRects().length > 0
|
|
2284
|
+
);
|
|
2285
|
+
}
|
|
2286
|
+
const os = V(function({
|
|
2287
|
+
open: e,
|
|
2288
|
+
onClose: t,
|
|
2289
|
+
title: s,
|
|
2290
|
+
left: c,
|
|
2291
|
+
right: a,
|
|
2292
|
+
tint: i = "black",
|
|
2293
|
+
background: o = "pinstripe",
|
|
2294
|
+
bodyClassName: f,
|
|
2295
|
+
contained: p = !1,
|
|
2296
|
+
label: g,
|
|
2297
|
+
className: _,
|
|
2298
|
+
children: w,
|
|
2299
|
+
...y
|
|
2300
|
+
}, E) {
|
|
2301
|
+
const D = ie(), v = `${ye()}-title`, M = typeof s == "string", T = U(null), u = ce(
|
|
2302
|
+
(h) => {
|
|
2303
|
+
T.current = h, typeof E == "function" ? E(h) : E && (E.current = h);
|
|
2304
|
+
},
|
|
2305
|
+
[E]
|
|
2306
|
+
), l = U(t);
|
|
2307
|
+
if (l.current = t, ae(() => {
|
|
2308
|
+
if (!e) return;
|
|
2309
|
+
const h = document.activeElement, S = T.current;
|
|
2310
|
+
if (S) {
|
|
2311
|
+
const k = S.querySelector(".gs-modalsheet__body"), d = S.querySelector(".gs-navbar__right");
|
|
2312
|
+
((k && Me(k)[0]) ?? (d && Me(d)[0]) ?? Me(S)[0] ?? S).focus({ preventScroll: !0 });
|
|
2313
|
+
}
|
|
2314
|
+
return () => {
|
|
2315
|
+
h && h.isConnected && typeof h.focus == "function" && h.focus();
|
|
2316
|
+
};
|
|
2317
|
+
}, [e]), ae(() => {
|
|
2318
|
+
if (!e) return;
|
|
2319
|
+
const h = (S) => {
|
|
2320
|
+
var Z;
|
|
2321
|
+
if (S.key === "Escape") {
|
|
2322
|
+
S.preventDefault(), (Z = l.current) == null || Z.call(l);
|
|
2323
|
+
return;
|
|
2324
|
+
}
|
|
2325
|
+
if (S.key !== "Tab") return;
|
|
2326
|
+
const k = T.current;
|
|
2327
|
+
if (!k) return;
|
|
2328
|
+
const d = Me(k);
|
|
2329
|
+
if (d.length === 0) {
|
|
2330
|
+
S.preventDefault(), k.focus();
|
|
2331
|
+
return;
|
|
2332
|
+
}
|
|
2333
|
+
const I = d[0], $ = d[d.length - 1], O = document.activeElement, G = O !== null && k.contains(O);
|
|
2334
|
+
S.shiftKey ? (!G || O === I || O === k) && (S.preventDefault(), $.focus()) : (!G || O === $) && (S.preventDefault(), I.focus());
|
|
2335
|
+
};
|
|
2336
|
+
return document.addEventListener("keydown", h), () => document.removeEventListener("keydown", h);
|
|
2337
|
+
}, [e]), !e) return null;
|
|
2338
|
+
const m = c === void 0 ? /* @__PURE__ */ n(Ge, { onClick: () => t == null ? void 0 : t(), children: D.cancel }) : c, b = a === void 0 ? /* @__PURE__ */ n(Ge, { variant: "done", onClick: () => t == null ? void 0 : t(), children: D.done }) : a, A = /* @__PURE__ */ n("div", { className: x("gs-modalsheet-backdrop", p && "gs-modalsheet-backdrop--contained"), children: /* @__PURE__ */ H(
|
|
2339
|
+
"div",
|
|
2340
|
+
{
|
|
2341
|
+
ref: u,
|
|
2342
|
+
className: x("gs-modalsheet", _),
|
|
2343
|
+
role: "dialog",
|
|
2344
|
+
"aria-modal": "true",
|
|
2345
|
+
"aria-labelledby": M ? v : void 0,
|
|
2346
|
+
"aria-label": M ? void 0 : g ?? D.dialog,
|
|
2347
|
+
tabIndex: -1,
|
|
2348
|
+
...y,
|
|
2349
|
+
children: [
|
|
2350
|
+
/* @__PURE__ */ n(
|
|
2351
|
+
Ft,
|
|
2352
|
+
{
|
|
2353
|
+
className: "gs-modalsheet__bar",
|
|
2354
|
+
tint: i,
|
|
2355
|
+
title: M ? /* @__PURE__ */ n("span", { id: v, children: s }) : s,
|
|
2356
|
+
"aria-label": M ? s : void 0,
|
|
2357
|
+
left: m,
|
|
2358
|
+
right: b
|
|
2359
|
+
}
|
|
2360
|
+
),
|
|
2361
|
+
/* @__PURE__ */ n(
|
|
2362
|
+
"div",
|
|
2363
|
+
{
|
|
2364
|
+
className: x(
|
|
2365
|
+
"gs-modalsheet__body",
|
|
2366
|
+
`gs-modalsheet__body--${o}`,
|
|
2367
|
+
f
|
|
2368
|
+
),
|
|
2369
|
+
children: w
|
|
2370
|
+
}
|
|
2371
|
+
)
|
|
2372
|
+
]
|
|
2373
|
+
}
|
|
2374
|
+
) });
|
|
2375
|
+
return p ? A : typeof document > "u" ? null : pe(A, document.body);
|
|
2376
|
+
}), Dr = 500, Ir = 100, Ar = 50, $r = 2e3;
|
|
2377
|
+
function rt(r) {
|
|
2378
|
+
var t;
|
|
2379
|
+
const e = /(?:\.(\d+))?(?:e-(\d+))?$/.exec(String(r));
|
|
2380
|
+
return (((t = e == null ? void 0 : e[1]) == null ? void 0 : t.length) ?? 0) + Number((e == null ? void 0 : e[2]) ?? 0);
|
|
2381
|
+
}
|
|
2382
|
+
function mt(r, { min: e, max: t }) {
|
|
2383
|
+
return Math.min(t, Math.max(e, r));
|
|
2384
|
+
}
|
|
2385
|
+
function Lr(r, e, t) {
|
|
2386
|
+
const { min: s, max: c, step: a, wraps: i } = t, o = Math.min(20, Math.max(rt(a), rt(s))), f = Number((r + e * a).toFixed(o));
|
|
2387
|
+
return i ? f > c ? s : f < s ? c : f : mt(f, t);
|
|
2388
|
+
}
|
|
2389
|
+
const ls = V(function({
|
|
2390
|
+
value: e,
|
|
2391
|
+
defaultValue: t,
|
|
2392
|
+
onChange: s,
|
|
2393
|
+
min: c = 0,
|
|
2394
|
+
max: a = 100,
|
|
2395
|
+
step: i = 1,
|
|
2396
|
+
wraps: o = !1,
|
|
2397
|
+
autoRepeat: f = !0,
|
|
2398
|
+
showValue: p = !1,
|
|
2399
|
+
formatValue: g,
|
|
2400
|
+
size: _ = "sm",
|
|
2401
|
+
tint: w = "dark",
|
|
2402
|
+
disabled: y = !1,
|
|
2403
|
+
label: E,
|
|
2404
|
+
decrementLabel: D = "Decrease",
|
|
2405
|
+
incrementLabel: N = "Increase",
|
|
2406
|
+
className: v,
|
|
2407
|
+
...M
|
|
2408
|
+
}, T) {
|
|
2409
|
+
const u = { min: c, max: a, step: i, wraps: o }, l = e !== void 0, [m, b] = re(() => mt(t ?? c, u)), A = l ? e : m, h = U({ current: A, config: u, onChange: s, isControlled: l });
|
|
2410
|
+
h.current = { current: A, config: u, onChange: s, isControlled: l };
|
|
2411
|
+
const S = U(null), k = U(!1), d = () => {
|
|
2412
|
+
S.current && clearTimeout(S.current), S.current = null;
|
|
2413
|
+
};
|
|
2414
|
+
ae(() => d, []);
|
|
2415
|
+
const I = (q) => {
|
|
2416
|
+
const { current: te, onChange: Q, isControlled: J } = h.current;
|
|
2417
|
+
return q === te ? !1 : (J || (h.current.current = q, b(q)), Q == null || Q(q), !0);
|
|
2418
|
+
}, $ = (q) => I(Lr(h.current.current, q, h.current.config)), O = (q) => (te) => {
|
|
2419
|
+
if (!f || y || te.button !== 0) return;
|
|
2420
|
+
d(), k.current = !1;
|
|
2421
|
+
const Q = Date.now(), J = () => {
|
|
2422
|
+
if (k.current = !0, !$(q)) {
|
|
2423
|
+
d();
|
|
2424
|
+
return;
|
|
2425
|
+
}
|
|
2426
|
+
const K = Date.now() - Q >= $r;
|
|
2427
|
+
S.current = setTimeout(J, K ? Ar : Ir);
|
|
2428
|
+
};
|
|
2429
|
+
S.current = setTimeout(J, Dr);
|
|
2430
|
+
}, G = (q) => (te) => {
|
|
2431
|
+
if (k.current && te.detail !== 0) {
|
|
2432
|
+
k.current = !1;
|
|
2433
|
+
return;
|
|
2434
|
+
}
|
|
2435
|
+
$(q);
|
|
2436
|
+
}, Z = (q) => {
|
|
2437
|
+
if (!y) {
|
|
2438
|
+
switch (q.key) {
|
|
2439
|
+
case "ArrowUp":
|
|
2440
|
+
case "ArrowRight":
|
|
2441
|
+
$(1);
|
|
2442
|
+
break;
|
|
2443
|
+
case "ArrowDown":
|
|
2444
|
+
case "ArrowLeft":
|
|
2445
|
+
$(-1);
|
|
2446
|
+
break;
|
|
2447
|
+
case "Home":
|
|
2448
|
+
I(c);
|
|
2449
|
+
break;
|
|
2450
|
+
case "End":
|
|
2451
|
+
I(a);
|
|
2452
|
+
break;
|
|
2453
|
+
default:
|
|
2454
|
+
return;
|
|
2455
|
+
}
|
|
2456
|
+
q.preventDefault();
|
|
2457
|
+
}
|
|
2458
|
+
}, j = A <= c, W = A >= a, P = y || !o && j, X = y || !o && W, ee = (q, { text: te, icon: Q, isDisabled: J }) => /* @__PURE__ */ n(
|
|
2459
|
+
"button",
|
|
2460
|
+
{
|
|
2461
|
+
type: "button",
|
|
2462
|
+
"aria-label": te,
|
|
2463
|
+
"aria-disabled": J || void 0,
|
|
2464
|
+
disabled: J,
|
|
2465
|
+
className: x(
|
|
2466
|
+
"gs-stepper__button",
|
|
2467
|
+
q === 1 ? "gs-stepper__button--increment" : "gs-stepper__button--decrement"
|
|
2468
|
+
),
|
|
2469
|
+
onPointerDown: O(q),
|
|
2470
|
+
onPointerUp: d,
|
|
2471
|
+
onPointerLeave: d,
|
|
2472
|
+
onPointerCancel: d,
|
|
2473
|
+
onClick: G(q),
|
|
2474
|
+
onKeyDown: Z,
|
|
2475
|
+
children: /* @__PURE__ */ n(ne, { icon: Q, variant: "flat", size: 16, strokeWidth: 3, className: "gs-stepper__icon" })
|
|
2476
|
+
}
|
|
2477
|
+
);
|
|
2478
|
+
return /* @__PURE__ */ H(
|
|
2479
|
+
"div",
|
|
2480
|
+
{
|
|
2481
|
+
ref: T,
|
|
2482
|
+
role: "group",
|
|
2483
|
+
"aria-label": E,
|
|
2484
|
+
"aria-disabled": y || void 0,
|
|
2485
|
+
className: x(
|
|
2486
|
+
"gs-stepper",
|
|
2487
|
+
`gs-stepper--${_}`,
|
|
2488
|
+
`gs-stepper--${w}`,
|
|
2489
|
+
y && "gs-stepper--disabled",
|
|
2490
|
+
v
|
|
2491
|
+
),
|
|
2492
|
+
...M,
|
|
2493
|
+
children: [
|
|
2494
|
+
p && /* @__PURE__ */ n("span", { className: "gs-stepper__value", "aria-live": "polite", "aria-atomic": "true", children: g ? g(A) : String(A) }),
|
|
2495
|
+
/* @__PURE__ */ H("span", { className: "gs-stepper__buttons", children: [
|
|
2496
|
+
ee(-1, { text: D, icon: $t, isDisabled: P }),
|
|
2497
|
+
ee(1, { text: N, icon: Lt, isDisabled: X })
|
|
2498
|
+
] })
|
|
2499
|
+
]
|
|
2500
|
+
}
|
|
2501
|
+
);
|
|
2502
|
+
}), us = V(function({
|
|
2503
|
+
value: e,
|
|
2504
|
+
defaultValue: t,
|
|
2505
|
+
onChange: s,
|
|
2506
|
+
onSearch: c,
|
|
2507
|
+
onCancel: a,
|
|
2508
|
+
placeholder: i,
|
|
2509
|
+
scopes: o,
|
|
2510
|
+
scope: f,
|
|
2511
|
+
defaultScope: p,
|
|
2512
|
+
onScopeChange: g,
|
|
2513
|
+
showsScopeBar: _ = "always",
|
|
2514
|
+
showsCancel: w = "whileEditing",
|
|
2515
|
+
cancelLabel: y,
|
|
2516
|
+
tint: E = "black",
|
|
2517
|
+
autoFocus: D,
|
|
2518
|
+
disabled: N = !1,
|
|
2519
|
+
label: v,
|
|
2520
|
+
inputProps: M,
|
|
2521
|
+
className: T,
|
|
2522
|
+
onFocus: u,
|
|
2523
|
+
onBlur: l,
|
|
2524
|
+
...m
|
|
2525
|
+
}, b) {
|
|
2526
|
+
const A = ie(), h = U(null), S = e !== void 0, [k, d] = re(t ?? ""), I = S ? e : k, $ = f !== void 0, [O, G] = re(() => {
|
|
2527
|
+
var F;
|
|
2528
|
+
return p ?? ((F = o == null ? void 0 : o[0]) == null ? void 0 : F.value);
|
|
2529
|
+
}), Z = $ ? f : O, [j, W] = re(!1);
|
|
2530
|
+
ae(() => {
|
|
2531
|
+
const F = h.current;
|
|
2532
|
+
F && F.contains(document.activeElement) && W(!0);
|
|
2533
|
+
}, []);
|
|
2534
|
+
const P = j || I.length > 0, X = !!o && o.length > 0, ee = w === "always" || w === "whileEditing" && P && !N, q = X && (_ === "always" || P), te = (F) => {
|
|
2535
|
+
S || d(F), s == null || s(F);
|
|
2536
|
+
}, { onChange: Q, onKeyDown: J, ...K } = M ?? {}, oe = (F) => {
|
|
2537
|
+
Q == null || Q(F), te(F.target.value);
|
|
2538
|
+
}, L = (F) => {
|
|
2539
|
+
J == null || J(F), !F.defaultPrevented && F.key === "Enter" && (c == null || c(I));
|
|
2540
|
+
}, B = () => {
|
|
2541
|
+
var ke;
|
|
2542
|
+
te("");
|
|
2543
|
+
const F = document.activeElement;
|
|
2544
|
+
F instanceof HTMLElement && ((ke = h.current) != null && ke.contains(F)) && F.blur(), a == null || a();
|
|
2545
|
+
}, z = (F) => {
|
|
2546
|
+
u == null || u(F), W(!0);
|
|
2547
|
+
}, Y = (F) => {
|
|
2548
|
+
l == null || l(F), F.currentTarget.contains(F.relatedTarget) || W(!1);
|
|
2549
|
+
}, C = (F) => {
|
|
2550
|
+
$ || G(F), g == null || g(F);
|
|
2551
|
+
}, he = (F) => F.preventDefault(), fe = v ?? A.search;
|
|
2552
|
+
return /* @__PURE__ */ H(
|
|
2553
|
+
"div",
|
|
2554
|
+
{
|
|
2555
|
+
ref: h,
|
|
2556
|
+
role: "search",
|
|
2557
|
+
"aria-label": fe,
|
|
2558
|
+
className: x(
|
|
2559
|
+
"gs-searchbar",
|
|
2560
|
+
`gs-searchbar--${E}`,
|
|
2561
|
+
P && "gs-searchbar--editing",
|
|
2562
|
+
N && "gs-searchbar--disabled",
|
|
2563
|
+
X && "gs-searchbar--has-scopes",
|
|
2564
|
+
ee && "gs-searchbar--show-cancel",
|
|
2565
|
+
q && "gs-searchbar--show-scopes",
|
|
2566
|
+
T
|
|
2567
|
+
),
|
|
2568
|
+
onFocus: z,
|
|
2569
|
+
onBlur: Y,
|
|
2570
|
+
...m,
|
|
2571
|
+
children: [
|
|
2572
|
+
/* @__PURE__ */ n("div", { className: "gs-searchbar__row", children: /* @__PURE__ */ n(
|
|
2573
|
+
Ot,
|
|
2574
|
+
{
|
|
2575
|
+
"aria-label": fe,
|
|
2576
|
+
...K,
|
|
2577
|
+
ref: b,
|
|
2578
|
+
wrapperClassName: "gs-searchbar__field",
|
|
2579
|
+
value: I,
|
|
2580
|
+
onChange: oe,
|
|
2581
|
+
onKeyDown: L,
|
|
2582
|
+
placeholder: i,
|
|
2583
|
+
disabled: N,
|
|
2584
|
+
autoFocus: D,
|
|
2585
|
+
showCancel: w !== "never",
|
|
2586
|
+
cancelLabel: y,
|
|
2587
|
+
onCancel: B
|
|
2588
|
+
}
|
|
2589
|
+
) }),
|
|
2590
|
+
X && /* @__PURE__ */ n("div", { className: "gs-searchbar__scopes", onMouseDown: he, children: /* @__PURE__ */ n("div", { className: "gs-searchbar__scopes-clip", children: /* @__PURE__ */ n(
|
|
2591
|
+
Ut,
|
|
2592
|
+
{
|
|
2593
|
+
className: "gs-searchbar__segments",
|
|
2594
|
+
size: "sm",
|
|
2595
|
+
block: !0,
|
|
2596
|
+
tint: E === "blue" ? "blue" : "dark",
|
|
2597
|
+
value: Z,
|
|
2598
|
+
onChange: C,
|
|
2599
|
+
children: o.map((F) => /* @__PURE__ */ n(Vt, { value: F.value, disabled: N || F.disabled, children: F.label }, F.value))
|
|
2600
|
+
}
|
|
2601
|
+
) }) })
|
|
2602
|
+
]
|
|
2603
|
+
}
|
|
2604
|
+
);
|
|
2605
|
+
});
|
|
2606
|
+
function Pr(r) {
|
|
2607
|
+
return r != null && r !== !1 && r !== "";
|
|
2608
|
+
}
|
|
2609
|
+
function Rr(r) {
|
|
2610
|
+
if (!(r instanceof Element)) return !1;
|
|
2611
|
+
try {
|
|
2612
|
+
return r.matches(":focus-visible");
|
|
2613
|
+
} catch {
|
|
2614
|
+
return !0;
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
const Br = 0.4, Or = 4, Fr = 160, ds = V(
|
|
2618
|
+
function({
|
|
2619
|
+
open: e,
|
|
2620
|
+
title: t,
|
|
2621
|
+
message: s,
|
|
2622
|
+
icon: c,
|
|
2623
|
+
iconTint: a = "gray",
|
|
2624
|
+
actionLabel: i,
|
|
2625
|
+
onAction: o,
|
|
2626
|
+
onClick: f,
|
|
2627
|
+
duration: p = 4e3,
|
|
2628
|
+
onClose: g,
|
|
2629
|
+
dismissOnAction: _ = !0,
|
|
2630
|
+
contained: w = !1,
|
|
2631
|
+
label: y = "Notification",
|
|
2632
|
+
className: E,
|
|
2633
|
+
style: D,
|
|
2634
|
+
onKeyDown: N,
|
|
2635
|
+
onPointerDown: v,
|
|
2636
|
+
onPointerEnter: M,
|
|
2637
|
+
onPointerLeave: T,
|
|
2638
|
+
onFocus: u,
|
|
2639
|
+
onBlur: l,
|
|
2640
|
+
onTransitionEnd: m,
|
|
2641
|
+
...b
|
|
2642
|
+
}, A) {
|
|
2643
|
+
const h = U(g);
|
|
2644
|
+
h.current = g;
|
|
2645
|
+
const S = U(null), k = U(0), d = U(0), I = U(!1), $ = U({ hover: !1, focus: !1, press: !1 }), O = ce(() => {
|
|
2646
|
+
S.current !== null && (window.clearTimeout(S.current), S.current = null);
|
|
2647
|
+
}, []), G = ce(() => {
|
|
2648
|
+
if (!I.current) return;
|
|
2649
|
+
const R = $.current;
|
|
2650
|
+
if (R.hover || R.focus || R.press) {
|
|
2651
|
+
if (S.current === null) return;
|
|
2652
|
+
d.current = Math.max(0, k.current - Date.now()), O();
|
|
2653
|
+
} else S.current === null && (k.current = Date.now() + d.current, S.current = window.setTimeout(() => {
|
|
2654
|
+
var be;
|
|
2655
|
+
S.current = null, I.current = !1, (be = h.current) == null || be.call(h);
|
|
2656
|
+
}, d.current));
|
|
2657
|
+
}, [O]), Z = ce(() => {
|
|
2658
|
+
var R;
|
|
2659
|
+
I.current = !1, O(), (R = h.current) == null || R.call(h);
|
|
2660
|
+
}, [O]), j = U(null), W = U(null), P = U(null), [X, ee] = re(null), [q, te] = re(!1), Q = ce(() => {
|
|
2661
|
+
P.current !== null && (window.clearTimeout(P.current), P.current = null, Z());
|
|
2662
|
+
}, [Z]), J = ce(() => {
|
|
2663
|
+
I.current = !1, O(), ee(null), te(!0), P.current = window.setTimeout(Q, Fr);
|
|
2664
|
+
}, [O, Q]);
|
|
2665
|
+
ae(() => ($.current = { hover: !1, focus: !1, press: !1 }, j.current = null, ee(null), te(!1), () => {
|
|
2666
|
+
var R;
|
|
2667
|
+
(R = W.current) == null || R.call(W), P.current !== null && (window.clearTimeout(P.current), P.current = null);
|
|
2668
|
+
}), [e]), ae(() => {
|
|
2669
|
+
if (!(!e || p <= 0))
|
|
2670
|
+
return I.current = !0, d.current = p, G(), () => {
|
|
2671
|
+
I.current = !1, O();
|
|
2672
|
+
};
|
|
2673
|
+
}, [e, p, t, G, O]);
|
|
2674
|
+
const K = (R) => {
|
|
2675
|
+
var Ve;
|
|
2676
|
+
if (v == null || v(R), R.defaultPrevented || !R.isPrimary || R.button !== 0 || q) return;
|
|
2677
|
+
(Ve = W.current) == null || Ve.call(W);
|
|
2678
|
+
const se = {
|
|
2679
|
+
pointerId: R.pointerId,
|
|
2680
|
+
startY: R.clientY,
|
|
2681
|
+
height: R.currentTarget.offsetHeight || 60,
|
|
2682
|
+
moved: !1
|
|
2683
|
+
};
|
|
2684
|
+
j.current = se, $.current.press = !0, G();
|
|
2685
|
+
const be = (me) => {
|
|
2686
|
+
if (me.pointerId !== se.pointerId) return;
|
|
2687
|
+
const Ne = me.clientY - se.startY;
|
|
2688
|
+
!se.moved && Math.abs(Ne) > Or && (se.moved = !0), se.moved && ee(Math.max(-se.height, Math.min(0, Ne)));
|
|
2689
|
+
}, we = (me) => {
|
|
2690
|
+
if (me.pointerId !== se.pointerId) return;
|
|
2691
|
+
Ie(), $.current.press = !1;
|
|
2692
|
+
const Ne = me.type === "pointercancel" ? 0 : me.clientY - se.startY;
|
|
2693
|
+
se.moved && -Ne > se.height * Br ? J() : (ee(null), G()), se.moved ? window.setTimeout(() => {
|
|
2694
|
+
j.current === se && (j.current = null);
|
|
2695
|
+
}, 0) : j.current = null;
|
|
2696
|
+
}, Ie = () => {
|
|
2697
|
+
window.removeEventListener("pointermove", be), window.removeEventListener("pointerup", we), window.removeEventListener("pointercancel", we), W.current === Ie && (W.current = null);
|
|
2698
|
+
};
|
|
2699
|
+
W.current = Ie, window.addEventListener("pointermove", be), window.addEventListener("pointerup", we), window.addEventListener("pointercancel", we);
|
|
2700
|
+
}, oe = (R) => {
|
|
2701
|
+
var se;
|
|
2702
|
+
(se = j.current) != null && se.moved && (R.stopPropagation(), R.preventDefault());
|
|
2703
|
+
}, L = () => {
|
|
2704
|
+
q || (f == null || f(), _ && Z());
|
|
2705
|
+
}, B = (R) => {
|
|
2706
|
+
R.stopPropagation(), !q && (o == null || o(), _ && Z());
|
|
2707
|
+
}, z = (R) => {
|
|
2708
|
+
N == null || N(R), !R.defaultPrevented && (R.key === "Escape" ? (R.preventDefault(), Z()) : R.key === "Enter" && R.target === R.currentTarget && (R.preventDefault(), L()));
|
|
2709
|
+
}, Y = (R) => {
|
|
2710
|
+
M == null || M(R), $.current.hover = !0, G();
|
|
2711
|
+
}, C = (R) => {
|
|
2712
|
+
T == null || T(R), $.current.hover = !1, G();
|
|
2713
|
+
}, he = (R) => {
|
|
2714
|
+
u == null || u(R), $.current.focus = Rr(R.target), G();
|
|
2715
|
+
}, fe = (R) => {
|
|
2716
|
+
l == null || l(R), !R.currentTarget.contains(R.relatedTarget) && ($.current.focus = !1, G());
|
|
2717
|
+
}, F = (R) => {
|
|
2718
|
+
m == null || m(R), q && R.target === R.currentTarget && R.propertyName === "transform" && Q();
|
|
2719
|
+
};
|
|
2720
|
+
if (!e) return null;
|
|
2721
|
+
const ke = Pr(s), ze = typeof i == "string" && i !== "", Ye = X !== null, pt = Ye ? { ...D, transform: `translateY(${X}px)` } : D, Ue = /* @__PURE__ */ H(
|
|
2722
|
+
"div",
|
|
2723
|
+
{
|
|
2724
|
+
ref: A,
|
|
2725
|
+
className: x(
|
|
2726
|
+
"gs-banner",
|
|
2727
|
+
w && "gs-banner--contained",
|
|
2728
|
+
ze && "gs-banner--has-action",
|
|
2729
|
+
Ye && "gs-banner--dragging",
|
|
2730
|
+
q && "gs-banner--leaving",
|
|
2731
|
+
E
|
|
2732
|
+
),
|
|
2733
|
+
style: pt,
|
|
2734
|
+
role: "status",
|
|
2735
|
+
"aria-live": "polite",
|
|
2736
|
+
"aria-atomic": "true",
|
|
2737
|
+
"aria-label": y,
|
|
2738
|
+
tabIndex: 0,
|
|
2739
|
+
onClick: L,
|
|
2740
|
+
onClickCapture: oe,
|
|
2741
|
+
onKeyDown: z,
|
|
2742
|
+
onPointerDown: K,
|
|
2743
|
+
onPointerEnter: Y,
|
|
2744
|
+
onPointerLeave: C,
|
|
2745
|
+
onFocus: he,
|
|
2746
|
+
onBlur: fe,
|
|
2747
|
+
onTransitionEnd: F,
|
|
2748
|
+
...b,
|
|
2749
|
+
children: [
|
|
2750
|
+
/* @__PURE__ */ n("span", { className: x("gs-banner__tile", `gs-banner__tile--${a}`), "aria-hidden": "true", children: c }),
|
|
2751
|
+
/* @__PURE__ */ H("div", { className: "gs-banner__body", children: [
|
|
2752
|
+
/* @__PURE__ */ n("div", { className: "gs-banner__title", children: t }),
|
|
2753
|
+
ke && /* @__PURE__ */ n("div", { className: "gs-banner__message", children: s })
|
|
2754
|
+
] }),
|
|
2755
|
+
ze && /* @__PURE__ */ n("button", { type: "button", className: "gs-banner__action", onClick: B, children: i }),
|
|
2756
|
+
/* @__PURE__ */ n("span", { className: "gs-banner__grip", "aria-hidden": "true" })
|
|
2757
|
+
]
|
|
2758
|
+
}
|
|
2759
|
+
);
|
|
2760
|
+
return w ? Ue : typeof document > "u" ? null : pe(Ue, document.body);
|
|
2761
|
+
}
|
|
2762
|
+
);
|
|
2763
|
+
export {
|
|
2764
|
+
Jr as ActionSheet,
|
|
2765
|
+
nr as ActivityIndicator,
|
|
2766
|
+
Xr as Alert,
|
|
2767
|
+
ct as Badge,
|
|
2768
|
+
Ge as BarButton,
|
|
2769
|
+
Yr as Button,
|
|
2770
|
+
is as DatePicker,
|
|
2771
|
+
Ur as GsProvider,
|
|
2772
|
+
as as HUD,
|
|
2773
|
+
ne as Icon,
|
|
2774
|
+
cs as Keyboard,
|
|
2775
|
+
jr as List,
|
|
2776
|
+
Zr as ListItem,
|
|
2777
|
+
os as ModalSheet,
|
|
2778
|
+
Ft as NavigationBar,
|
|
2779
|
+
ds as NotificationBanner,
|
|
2780
|
+
ss as PageControl,
|
|
2781
|
+
er as Picker,
|
|
2782
|
+
ns as Popover,
|
|
2783
|
+
rr as ProgressBar,
|
|
2784
|
+
us as SearchBar,
|
|
2785
|
+
Ot as SearchField,
|
|
2786
|
+
Vt as Segment,
|
|
2787
|
+
Ut as SegmentedControl,
|
|
2788
|
+
Qr as Slider,
|
|
2789
|
+
Kr as StatusBar,
|
|
2790
|
+
ls as Stepper,
|
|
2791
|
+
Vr as Switch,
|
|
2792
|
+
qr as TabBar,
|
|
2793
|
+
Gr as TabBarItem,
|
|
2794
|
+
Bt as TextField,
|
|
2795
|
+
Cr as Toolbar,
|
|
2796
|
+
ts as ToolbarButton,
|
|
2797
|
+
es as ToolbarSpacer,
|
|
2798
|
+
rs as ToolbarTitle,
|
|
2799
|
+
x as cn,
|
|
2800
|
+
kt as defaultStrings,
|
|
2801
|
+
Nt as useGsLocale,
|
|
2802
|
+
ie as useGsStrings
|
|
2803
|
+
};
|