@charcoal-ui/react 2.2.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.story.d.ts.map +1 -1
- package/dist/components/DropdownSelector/DropdownPopover.d.ts +13 -0
- package/dist/components/DropdownSelector/DropdownPopover.d.ts.map +1 -0
- package/dist/components/DropdownSelector/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/index.story.d.ts +3 -0
- package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts +5 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/core/CharcoalProvider.d.ts +12 -0
- package/dist/core/CharcoalProvider.d.ts.map +1 -0
- package/dist/core/ComponentAbstraction.d.ts +1 -1
- package/dist/core/ComponentAbstraction.d.ts.map +1 -1
- package/dist/index.cjs.js +2157 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +2118 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/styled.d.ts +3 -3
- package/package.json +23 -22
- package/src/components/Checkbox/index.story.tsx +29 -11
- package/src/components/Checkbox/index.tsx +16 -6
- package/src/components/DropdownSelector/DropdownPopover.tsx +72 -0
- package/src/components/DropdownSelector/Listbox.tsx +15 -13
- package/src/components/DropdownSelector/index.story.tsx +123 -45
- package/src/components/DropdownSelector/index.tsx +8 -11
- package/src/components/Modal/index.tsx +6 -6
- package/src/components/Switch/index.tsx +7 -3
- package/src/core/CharcoalProvider.tsx +35 -0
- package/src/core/ComponentAbstraction.tsx +1 -1
- package/src/index.ts +4 -0
- package/dist/components/DropdownSelector/Popover.d.ts +0 -10
- package/dist/components/DropdownSelector/Popover.d.ts.map +0 -1
- package/dist/index.cjs +0 -4446
- package/dist/index.cjs.map +0 -1
- package/dist/index.js +0 -4409
- package/dist/index.js.map +0 -1
- package/src/components/DropdownSelector/Popover.tsx +0 -46
package/dist/index.js
DELETED
|
@@ -1,4409 +0,0 @@
|
|
|
1
|
-
// src/core/ComponentAbstraction.tsx
|
|
2
|
-
import React, { useContext } from "react";
|
|
3
|
-
var DefaultLink = React.forwardRef(
|
|
4
|
-
function DefaultLink2({ to, children, ...rest }, ref) {
|
|
5
|
-
return /* @__PURE__ */ React.createElement("a", { href: to, ref, ...rest }, children);
|
|
6
|
-
}
|
|
7
|
-
);
|
|
8
|
-
var DefaultValue = {
|
|
9
|
-
Link: DefaultLink
|
|
10
|
-
};
|
|
11
|
-
var ComponentAbstractionContext = React.createContext(DefaultValue);
|
|
12
|
-
function ComponentAbstraction({ children, components }) {
|
|
13
|
-
return /* @__PURE__ */ React.createElement(
|
|
14
|
-
ComponentAbstractionContext.Provider,
|
|
15
|
-
{
|
|
16
|
-
value: { ...DefaultValue, ...components }
|
|
17
|
-
},
|
|
18
|
-
children
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
function useComponentAbstraction() {
|
|
22
|
-
return useContext(ComponentAbstractionContext);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// src/core/SSRProvider.tsx
|
|
26
|
-
import { SSRProvider } from "@react-aria/ssr";
|
|
27
|
-
|
|
28
|
-
// src/core/OverlayProvider.tsx
|
|
29
|
-
import { OverlayProvider } from "@react-aria/overlays";
|
|
30
|
-
|
|
31
|
-
// src/components/Button/index.tsx
|
|
32
|
-
import React3 from "react";
|
|
33
|
-
import styled3 from "styled-components";
|
|
34
|
-
|
|
35
|
-
// src/_lib/index.ts
|
|
36
|
-
function unreachable(value) {
|
|
37
|
-
throw new Error(
|
|
38
|
-
arguments.length === 0 ? "unreachable" : `unreachable (${JSON.stringify(value)})`
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// src/styled.ts
|
|
43
|
-
import styled from "styled-components";
|
|
44
|
-
import { createTheme } from "@charcoal-ui/styled";
|
|
45
|
-
var theme = createTheme(styled);
|
|
46
|
-
|
|
47
|
-
// src/components/Clickable/index.tsx
|
|
48
|
-
import React2 from "react";
|
|
49
|
-
import styled2, { css } from "styled-components";
|
|
50
|
-
import { disabledSelector } from "@charcoal-ui/utils";
|
|
51
|
-
var Clickable = React2.forwardRef(
|
|
52
|
-
function Clickable2(props, ref) {
|
|
53
|
-
const { Link } = useComponentAbstraction();
|
|
54
|
-
if ("to" in props) {
|
|
55
|
-
const { onClick, disabled = false, ...rest } = props;
|
|
56
|
-
return /* @__PURE__ */ React2.createElement(
|
|
57
|
-
A,
|
|
58
|
-
{
|
|
59
|
-
...rest,
|
|
60
|
-
as: disabled ? void 0 : Link,
|
|
61
|
-
onClick: disabled ? void 0 : onClick,
|
|
62
|
-
"aria-disabled": disabled,
|
|
63
|
-
ref
|
|
64
|
-
}
|
|
65
|
-
);
|
|
66
|
-
} else {
|
|
67
|
-
return /* @__PURE__ */ React2.createElement(Button, { ...props, ref });
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
var Clickable_default = Clickable;
|
|
72
|
-
var clickableCss = css`
|
|
73
|
-
/* Clickable style */
|
|
74
|
-
cursor: pointer;
|
|
75
|
-
|
|
76
|
-
${disabledSelector} {
|
|
77
|
-
cursor: default;
|
|
78
|
-
}
|
|
79
|
-
`;
|
|
80
|
-
var Button = styled2.button`
|
|
81
|
-
/* Reset button appearance */
|
|
82
|
-
appearance: none;
|
|
83
|
-
background: transparent;
|
|
84
|
-
padding: 0;
|
|
85
|
-
border-style: none;
|
|
86
|
-
outline: none;
|
|
87
|
-
color: inherit;
|
|
88
|
-
text-rendering: inherit;
|
|
89
|
-
letter-spacing: inherit;
|
|
90
|
-
word-spacing: inherit;
|
|
91
|
-
|
|
92
|
-
&:focus {
|
|
93
|
-
outline: none;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/* Change the font styles in all browsers. */
|
|
97
|
-
font: inherit;
|
|
98
|
-
|
|
99
|
-
/* Remove the margin in Firefox and Safari. */
|
|
100
|
-
margin: 0;
|
|
101
|
-
|
|
102
|
-
/* Show the overflow in Edge. */
|
|
103
|
-
overflow: visible;
|
|
104
|
-
|
|
105
|
-
/* Remove the inheritance of text transform in Firefox. */
|
|
106
|
-
text-transform: none;
|
|
107
|
-
|
|
108
|
-
/* Remove the inner border and padding in Firefox. */
|
|
109
|
-
&::-moz-focus-inner {
|
|
110
|
-
border-style: none;
|
|
111
|
-
padding: 0;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
${clickableCss}
|
|
115
|
-
`;
|
|
116
|
-
var A = styled2.span`
|
|
117
|
-
/* Reset a-tag appearance */
|
|
118
|
-
color: inherit;
|
|
119
|
-
|
|
120
|
-
&:focus {
|
|
121
|
-
outline: none;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.text {
|
|
125
|
-
top: calc(1em + 2em);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
${clickableCss}
|
|
129
|
-
`;
|
|
130
|
-
|
|
131
|
-
// src/components/Button/index.tsx
|
|
132
|
-
var Button2 = React3.forwardRef(function Button3({
|
|
133
|
-
children,
|
|
134
|
-
variant = "Default",
|
|
135
|
-
size = "M",
|
|
136
|
-
fixed = false,
|
|
137
|
-
disabled = false,
|
|
138
|
-
...rest
|
|
139
|
-
}, ref) {
|
|
140
|
-
return /* @__PURE__ */ React3.createElement(
|
|
141
|
-
StyledButton,
|
|
142
|
-
{
|
|
143
|
-
...rest,
|
|
144
|
-
disabled,
|
|
145
|
-
variant,
|
|
146
|
-
size,
|
|
147
|
-
fixed,
|
|
148
|
-
ref
|
|
149
|
-
},
|
|
150
|
-
children
|
|
151
|
-
);
|
|
152
|
-
});
|
|
153
|
-
var Button_default = Button2;
|
|
154
|
-
var StyledButton = styled3(Clickable_default).withConfig({
|
|
155
|
-
shouldForwardProp(prop) {
|
|
156
|
-
return prop !== "fixed";
|
|
157
|
-
}
|
|
158
|
-
}).attrs(styledProps)`
|
|
159
|
-
width: ${(p) => p.fixed ? "stretch" : "min-content"};
|
|
160
|
-
display: inline-grid;
|
|
161
|
-
align-items: center;
|
|
162
|
-
justify-content: center;
|
|
163
|
-
cursor: pointer;
|
|
164
|
-
user-select: none;
|
|
165
|
-
white-space: nowrap;
|
|
166
|
-
|
|
167
|
-
${(p) => theme((o) => [
|
|
168
|
-
o.font[p.font].hover.press,
|
|
169
|
-
o.bg[p.background].hover.press,
|
|
170
|
-
o.typography(14).bold.preserveHalfLeading,
|
|
171
|
-
o.padding.horizontal(p.padding),
|
|
172
|
-
o.disabled,
|
|
173
|
-
o.borderRadius("oval"),
|
|
174
|
-
o.outline.default.focus
|
|
175
|
-
])}
|
|
176
|
-
|
|
177
|
-
/* よく考えたらheight=32って定義が存在しないな... */
|
|
178
|
-
height: ${(p) => p.height}px;
|
|
179
|
-
`;
|
|
180
|
-
function styledProps(props) {
|
|
181
|
-
return {
|
|
182
|
-
...props,
|
|
183
|
-
...variantToProps(props.variant),
|
|
184
|
-
...sizeToProps(props.size)
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
function variantToProps(variant) {
|
|
188
|
-
switch (variant) {
|
|
189
|
-
case "Overlay":
|
|
190
|
-
return { font: "text5", background: "surface4" };
|
|
191
|
-
case "Default":
|
|
192
|
-
return { font: "text2", background: "surface3" };
|
|
193
|
-
case "Primary":
|
|
194
|
-
return { font: "text5", background: "brand" };
|
|
195
|
-
case "Navigation":
|
|
196
|
-
return { font: "text5", background: "surface6" };
|
|
197
|
-
case "Danger":
|
|
198
|
-
return { font: "text5", background: "assertive" };
|
|
199
|
-
default:
|
|
200
|
-
return unreachable(variant);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
function sizeToProps(size) {
|
|
204
|
-
switch (size) {
|
|
205
|
-
case "S":
|
|
206
|
-
return {
|
|
207
|
-
height: 32,
|
|
208
|
-
padding: 16
|
|
209
|
-
};
|
|
210
|
-
case "M":
|
|
211
|
-
return {
|
|
212
|
-
height: 40,
|
|
213
|
-
padding: 24
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// src/components/IconButton/index.tsx
|
|
219
|
-
import React4 from "react";
|
|
220
|
-
import styled4 from "styled-components";
|
|
221
|
-
var IconButton = React4.forwardRef(
|
|
222
|
-
function IconButtonInner({ variant = "Default", size = "M", icon, ...rest }, ref) {
|
|
223
|
-
validateIconSize(size, icon);
|
|
224
|
-
return /* @__PURE__ */ React4.createElement(StyledIconButton, { ...rest, ref, variant, size }, /* @__PURE__ */ React4.createElement("pixiv-icon", { name: icon }));
|
|
225
|
-
}
|
|
226
|
-
);
|
|
227
|
-
var IconButton_default = IconButton;
|
|
228
|
-
var StyledIconButton = styled4(Clickable_default).attrs(styledProps2)`
|
|
229
|
-
user-select: none;
|
|
230
|
-
|
|
231
|
-
width: ${(p) => p.width}px;
|
|
232
|
-
height: ${(p) => p.height}px;
|
|
233
|
-
display: flex;
|
|
234
|
-
align-items: center;
|
|
235
|
-
justify-content: center;
|
|
236
|
-
|
|
237
|
-
${({ font, background }) => theme((o) => [
|
|
238
|
-
o.font[font],
|
|
239
|
-
o.bg[background].hover.press,
|
|
240
|
-
o.disabled,
|
|
241
|
-
o.borderRadius("oval"),
|
|
242
|
-
o.outline.default.focus
|
|
243
|
-
])}
|
|
244
|
-
`;
|
|
245
|
-
function styledProps2(props) {
|
|
246
|
-
return {
|
|
247
|
-
...props,
|
|
248
|
-
...variantToProps2(props.variant),
|
|
249
|
-
...sizeToProps2(props.size)
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
function variantToProps2(variant) {
|
|
253
|
-
switch (variant) {
|
|
254
|
-
case "Default":
|
|
255
|
-
return { font: "text3", background: "transparent" };
|
|
256
|
-
case "Overlay":
|
|
257
|
-
return { font: "text5", background: "surface4" };
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
function sizeToProps2(size) {
|
|
261
|
-
switch (size) {
|
|
262
|
-
case "XS":
|
|
263
|
-
return {
|
|
264
|
-
width: 20,
|
|
265
|
-
height: 20
|
|
266
|
-
};
|
|
267
|
-
case "S":
|
|
268
|
-
return {
|
|
269
|
-
width: 32,
|
|
270
|
-
height: 32
|
|
271
|
-
};
|
|
272
|
-
case "M":
|
|
273
|
-
return {
|
|
274
|
-
width: 40,
|
|
275
|
-
height: 40
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
function validateIconSize(size, icon) {
|
|
280
|
-
let requiredIconSize;
|
|
281
|
-
switch (size) {
|
|
282
|
-
case "XS":
|
|
283
|
-
requiredIconSize = "16";
|
|
284
|
-
break;
|
|
285
|
-
case "S":
|
|
286
|
-
case "M":
|
|
287
|
-
requiredIconSize = "24";
|
|
288
|
-
break;
|
|
289
|
-
}
|
|
290
|
-
const result = /^\d*/u.exec(icon);
|
|
291
|
-
if (result == null) {
|
|
292
|
-
throw new Error("Invalid icon name");
|
|
293
|
-
}
|
|
294
|
-
const [iconSize] = result;
|
|
295
|
-
if (iconSize !== requiredIconSize) {
|
|
296
|
-
console.warn(
|
|
297
|
-
`IconButton with size "${size}" expect icon size "${requiredIconSize}, but got "${iconSize}"`
|
|
298
|
-
);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// src/components/Radio/index.tsx
|
|
303
|
-
import React5, { useCallback, useContext as useContext2 } from "react";
|
|
304
|
-
import styled5 from "styled-components";
|
|
305
|
-
import warning from "warning";
|
|
306
|
-
import { px } from "@charcoal-ui/utils";
|
|
307
|
-
function Radio({
|
|
308
|
-
value,
|
|
309
|
-
forceChecked = false,
|
|
310
|
-
disabled = false,
|
|
311
|
-
children
|
|
312
|
-
}) {
|
|
313
|
-
const {
|
|
314
|
-
name,
|
|
315
|
-
selected,
|
|
316
|
-
disabled: isParentDisabled,
|
|
317
|
-
readonly,
|
|
318
|
-
hasError,
|
|
319
|
-
onChange
|
|
320
|
-
} = useContext2(RadioGroupContext);
|
|
321
|
-
warning(
|
|
322
|
-
name !== void 0,
|
|
323
|
-
`"name" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`
|
|
324
|
-
);
|
|
325
|
-
const isSelected = value === selected;
|
|
326
|
-
const isDisabled = disabled || isParentDisabled;
|
|
327
|
-
const isReadonly = readonly && !isSelected;
|
|
328
|
-
const handleChange = useCallback(
|
|
329
|
-
(e) => {
|
|
330
|
-
onChange(e.currentTarget.value);
|
|
331
|
-
},
|
|
332
|
-
[onChange]
|
|
333
|
-
);
|
|
334
|
-
return /* @__PURE__ */ React5.createElement(RadioRoot, { "aria-disabled": isDisabled || isReadonly }, /* @__PURE__ */ React5.createElement(
|
|
335
|
-
RadioInput,
|
|
336
|
-
{
|
|
337
|
-
name,
|
|
338
|
-
value,
|
|
339
|
-
checked: forceChecked || isSelected,
|
|
340
|
-
hasError,
|
|
341
|
-
onChange: handleChange,
|
|
342
|
-
disabled: isDisabled || isReadonly
|
|
343
|
-
}
|
|
344
|
-
), children != null && /* @__PURE__ */ React5.createElement(RadioLabel, null, children));
|
|
345
|
-
}
|
|
346
|
-
var RadioRoot = styled5.label`
|
|
347
|
-
display: grid;
|
|
348
|
-
grid-template-columns: auto 1fr;
|
|
349
|
-
grid-gap: ${({ theme: theme4 }) => px(theme4.spacing[4])};
|
|
350
|
-
align-items: center;
|
|
351
|
-
cursor: pointer;
|
|
352
|
-
|
|
353
|
-
${theme((o) => [o.disabled])}
|
|
354
|
-
`;
|
|
355
|
-
var RadioInput = styled5.input.attrs({ type: "radio" })`
|
|
356
|
-
/** Make prior to browser default style */
|
|
357
|
-
&[type='radio'] {
|
|
358
|
-
appearance: none;
|
|
359
|
-
display: block;
|
|
360
|
-
box-sizing: border-box;
|
|
361
|
-
|
|
362
|
-
margin: 0;
|
|
363
|
-
padding: 6px;
|
|
364
|
-
|
|
365
|
-
width: 20px;
|
|
366
|
-
height: 20px;
|
|
367
|
-
|
|
368
|
-
${({ hasError = false }) => theme((o) => [
|
|
369
|
-
o.borderRadius("oval"),
|
|
370
|
-
o.bg.surface1.hover.press,
|
|
371
|
-
hasError && o.outline.assertive
|
|
372
|
-
])};
|
|
373
|
-
|
|
374
|
-
&:not(:checked) {
|
|
375
|
-
border-width: 2px;
|
|
376
|
-
border-style: solid;
|
|
377
|
-
border-color: ${({ theme: theme4 }) => theme4.color.text3};
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
&:checked {
|
|
381
|
-
${theme((o) => o.bg.brand.hover.press)}
|
|
382
|
-
|
|
383
|
-
&::after {
|
|
384
|
-
content: '';
|
|
385
|
-
display: block;
|
|
386
|
-
width: 8px;
|
|
387
|
-
height: 8px;
|
|
388
|
-
pointer-events: none;
|
|
389
|
-
|
|
390
|
-
${theme((o) => [o.bg.text5.hover.press, o.borderRadius("oval")])}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
${theme((o) => o.outline.default.focus)}
|
|
395
|
-
}
|
|
396
|
-
`;
|
|
397
|
-
var RadioLabel = styled5.div`
|
|
398
|
-
${theme((o) => [o.typography(14), o.font.text2])}
|
|
399
|
-
`;
|
|
400
|
-
var StyledRadioGroup = styled5.div`
|
|
401
|
-
display: grid;
|
|
402
|
-
grid-template-columns: 1fr;
|
|
403
|
-
grid-gap: ${({ theme: theme4 }) => px(theme4.spacing[8])};
|
|
404
|
-
`;
|
|
405
|
-
var RadioGroupContext = React5.createContext({
|
|
406
|
-
name: void 0,
|
|
407
|
-
selected: void 0,
|
|
408
|
-
disabled: false,
|
|
409
|
-
readonly: false,
|
|
410
|
-
hasError: false,
|
|
411
|
-
onChange() {
|
|
412
|
-
throw new Error(
|
|
413
|
-
"Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?"
|
|
414
|
-
);
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
function RadioGroup({
|
|
418
|
-
className,
|
|
419
|
-
value,
|
|
420
|
-
label,
|
|
421
|
-
name,
|
|
422
|
-
onChange,
|
|
423
|
-
disabled,
|
|
424
|
-
readonly,
|
|
425
|
-
hasError,
|
|
426
|
-
children
|
|
427
|
-
}) {
|
|
428
|
-
const handleChange = useCallback(
|
|
429
|
-
(next) => {
|
|
430
|
-
onChange(next);
|
|
431
|
-
},
|
|
432
|
-
[onChange]
|
|
433
|
-
);
|
|
434
|
-
return /* @__PURE__ */ React5.createElement(
|
|
435
|
-
RadioGroupContext.Provider,
|
|
436
|
-
{
|
|
437
|
-
value: {
|
|
438
|
-
name,
|
|
439
|
-
selected: value,
|
|
440
|
-
disabled: disabled ?? false,
|
|
441
|
-
readonly: readonly ?? false,
|
|
442
|
-
hasError: hasError ?? false,
|
|
443
|
-
onChange: handleChange
|
|
444
|
-
}
|
|
445
|
-
},
|
|
446
|
-
/* @__PURE__ */ React5.createElement(
|
|
447
|
-
StyledRadioGroup,
|
|
448
|
-
{
|
|
449
|
-
role: "radiogroup",
|
|
450
|
-
"aria-orientation": "vertical",
|
|
451
|
-
"aria-label": label,
|
|
452
|
-
"aria-invalid": hasError,
|
|
453
|
-
className
|
|
454
|
-
},
|
|
455
|
-
children
|
|
456
|
-
)
|
|
457
|
-
);
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
// src/components/MultiSelect/index.tsx
|
|
461
|
-
import React6, { useCallback as useCallback2, useContext as useContext3 } from "react";
|
|
462
|
-
import styled6, { css as css2 } from "styled-components";
|
|
463
|
-
import warning2 from "warning";
|
|
464
|
-
import { disabledSelector as disabledSelector2, px as px2 } from "@charcoal-ui/utils";
|
|
465
|
-
|
|
466
|
-
// src/components/MultiSelect/context.ts
|
|
467
|
-
import { createContext } from "react";
|
|
468
|
-
var MultiSelectGroupContext = createContext({
|
|
469
|
-
name: void 0,
|
|
470
|
-
selected: [],
|
|
471
|
-
disabled: false,
|
|
472
|
-
readonly: false,
|
|
473
|
-
hasError: false,
|
|
474
|
-
onChange() {
|
|
475
|
-
throw new Error(
|
|
476
|
-
"Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<MultiSelectGroup />` ?"
|
|
477
|
-
);
|
|
478
|
-
}
|
|
479
|
-
});
|
|
480
|
-
|
|
481
|
-
// src/components/MultiSelect/index.tsx
|
|
482
|
-
function MultiSelect({
|
|
483
|
-
value,
|
|
484
|
-
forceChecked = false,
|
|
485
|
-
disabled = false,
|
|
486
|
-
onChange,
|
|
487
|
-
variant = "default",
|
|
488
|
-
children
|
|
489
|
-
}) {
|
|
490
|
-
const {
|
|
491
|
-
name,
|
|
492
|
-
selected,
|
|
493
|
-
disabled: parentDisabled,
|
|
494
|
-
readonly,
|
|
495
|
-
hasError,
|
|
496
|
-
onChange: parentOnChange
|
|
497
|
-
} = useContext3(MultiSelectGroupContext);
|
|
498
|
-
warning2(
|
|
499
|
-
name !== void 0,
|
|
500
|
-
`"name" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`
|
|
501
|
-
);
|
|
502
|
-
const isSelected = selected.includes(value) || forceChecked;
|
|
503
|
-
const isDisabled = disabled || parentDisabled || readonly;
|
|
504
|
-
const handleChange = useCallback2(
|
|
505
|
-
(event) => {
|
|
506
|
-
if (!(event.currentTarget instanceof HTMLInputElement)) {
|
|
507
|
-
return;
|
|
508
|
-
}
|
|
509
|
-
if (onChange)
|
|
510
|
-
onChange({ value, selected: event.currentTarget.checked });
|
|
511
|
-
parentOnChange({ value, selected: event.currentTarget.checked });
|
|
512
|
-
},
|
|
513
|
-
[onChange, parentOnChange, value]
|
|
514
|
-
);
|
|
515
|
-
return /* @__PURE__ */ React6.createElement(MultiSelectRoot, { "aria-disabled": isDisabled }, /* @__PURE__ */ React6.createElement(
|
|
516
|
-
MultiSelectInput,
|
|
517
|
-
{
|
|
518
|
-
...{
|
|
519
|
-
name,
|
|
520
|
-
value,
|
|
521
|
-
hasError
|
|
522
|
-
},
|
|
523
|
-
checked: isSelected,
|
|
524
|
-
disabled: isDisabled,
|
|
525
|
-
onChange: handleChange,
|
|
526
|
-
overlay: variant === "overlay",
|
|
527
|
-
"aria-invalid": hasError
|
|
528
|
-
}
|
|
529
|
-
), /* @__PURE__ */ React6.createElement(
|
|
530
|
-
MultiSelectInputOverlay,
|
|
531
|
-
{
|
|
532
|
-
overlay: variant === "overlay",
|
|
533
|
-
hasError,
|
|
534
|
-
"aria-hidden": true
|
|
535
|
-
},
|
|
536
|
-
/* @__PURE__ */ React6.createElement("pixiv-icon", { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 })
|
|
537
|
-
), Boolean(children) && /* @__PURE__ */ React6.createElement(MultiSelectLabel, null, children));
|
|
538
|
-
}
|
|
539
|
-
var MultiSelectRoot = styled6.label`
|
|
540
|
-
display: grid;
|
|
541
|
-
grid-template-columns: auto 1fr;
|
|
542
|
-
align-items: center;
|
|
543
|
-
position: relative;
|
|
544
|
-
cursor: pointer;
|
|
545
|
-
${disabledSelector2} {
|
|
546
|
-
cursor: default;
|
|
547
|
-
}
|
|
548
|
-
gap: ${({ theme: theme4 }) => px2(theme4.spacing[4])};
|
|
549
|
-
${theme((o) => o.disabled)}
|
|
550
|
-
`;
|
|
551
|
-
var MultiSelectLabel = styled6.div`
|
|
552
|
-
display: flex;
|
|
553
|
-
align-items: center;
|
|
554
|
-
${theme((o) => [o.typography(14), o.font.text2])}
|
|
555
|
-
`;
|
|
556
|
-
var MultiSelectInput = styled6.input.attrs({ type: "checkbox" })`
|
|
557
|
-
&[type='checkbox'] {
|
|
558
|
-
appearance: none;
|
|
559
|
-
display: block;
|
|
560
|
-
width: 20px;
|
|
561
|
-
height: 20px;
|
|
562
|
-
margin: 0;
|
|
563
|
-
|
|
564
|
-
&:checked {
|
|
565
|
-
${theme((o) => o.bg.brand.hover.press)}
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
${({ hasError, overlay }) => theme((o) => [
|
|
569
|
-
o.bg.text3.hover.press,
|
|
570
|
-
o.borderRadius("oval"),
|
|
571
|
-
hasError && !overlay && o.outline.assertive,
|
|
572
|
-
overlay && o.bg.surface4
|
|
573
|
-
])};
|
|
574
|
-
}
|
|
575
|
-
`;
|
|
576
|
-
var MultiSelectInputOverlay = styled6.div`
|
|
577
|
-
position: absolute;
|
|
578
|
-
top: -2px;
|
|
579
|
-
left: -2px;
|
|
580
|
-
box-sizing: border-box;
|
|
581
|
-
display: flex;
|
|
582
|
-
align-items: center;
|
|
583
|
-
justify-content: center;
|
|
584
|
-
|
|
585
|
-
${({ hasError, overlay }) => theme((o) => [
|
|
586
|
-
o.width.px(24),
|
|
587
|
-
o.height.px(24),
|
|
588
|
-
o.borderRadius("oval"),
|
|
589
|
-
o.font.text5,
|
|
590
|
-
hasError && overlay && o.outline.assertive
|
|
591
|
-
])}
|
|
592
|
-
|
|
593
|
-
${({ overlay }) => overlay && css2`
|
|
594
|
-
border-color: ${({ theme: theme4 }) => theme4.color.text5};
|
|
595
|
-
border-width: 2px;
|
|
596
|
-
border-style: solid;
|
|
597
|
-
`}
|
|
598
|
-
`;
|
|
599
|
-
function MultiSelectGroup({
|
|
600
|
-
className,
|
|
601
|
-
name,
|
|
602
|
-
ariaLabel,
|
|
603
|
-
selected,
|
|
604
|
-
onChange,
|
|
605
|
-
disabled = false,
|
|
606
|
-
readonly = false,
|
|
607
|
-
hasError = false,
|
|
608
|
-
children
|
|
609
|
-
}) {
|
|
610
|
-
const handleChange = useCallback2(
|
|
611
|
-
(payload) => {
|
|
612
|
-
const index = selected.indexOf(payload.value);
|
|
613
|
-
if (payload.selected) {
|
|
614
|
-
if (index < 0) {
|
|
615
|
-
onChange([...selected, payload.value]);
|
|
616
|
-
}
|
|
617
|
-
} else {
|
|
618
|
-
if (index >= 0) {
|
|
619
|
-
onChange([...selected.slice(0, index), ...selected.slice(index + 1)]);
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
},
|
|
623
|
-
[onChange, selected]
|
|
624
|
-
);
|
|
625
|
-
return /* @__PURE__ */ React6.createElement(
|
|
626
|
-
MultiSelectGroupContext.Provider,
|
|
627
|
-
{
|
|
628
|
-
value: {
|
|
629
|
-
name,
|
|
630
|
-
selected: Array.from(new Set(selected)),
|
|
631
|
-
disabled,
|
|
632
|
-
readonly,
|
|
633
|
-
hasError,
|
|
634
|
-
onChange: handleChange
|
|
635
|
-
}
|
|
636
|
-
},
|
|
637
|
-
/* @__PURE__ */ React6.createElement(
|
|
638
|
-
"div",
|
|
639
|
-
{
|
|
640
|
-
className,
|
|
641
|
-
"aria-label": ariaLabel,
|
|
642
|
-
"data-testid": "SelectGroup"
|
|
643
|
-
},
|
|
644
|
-
children
|
|
645
|
-
)
|
|
646
|
-
);
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
// src/components/Switch/index.tsx
|
|
650
|
-
import { useSwitch } from "@react-aria/switch";
|
|
651
|
-
import React7, { useRef, useMemo } from "react";
|
|
652
|
-
import { useToggleState } from "react-stately";
|
|
653
|
-
import styled7 from "styled-components";
|
|
654
|
-
import { disabledSelector as disabledSelector3, px as px3 } from "@charcoal-ui/utils";
|
|
655
|
-
function SwitchCheckbox(props) {
|
|
656
|
-
const { disabled, className } = props;
|
|
657
|
-
const ariaSwitchProps = useMemo(
|
|
658
|
-
() => ({
|
|
659
|
-
...props,
|
|
660
|
-
"aria-label": "children" in props ? void 0 : props.label,
|
|
661
|
-
isDisabled: props.disabled,
|
|
662
|
-
isSelected: props.checked
|
|
663
|
-
}),
|
|
664
|
-
[props]
|
|
665
|
-
);
|
|
666
|
-
const state = useToggleState(ariaSwitchProps);
|
|
667
|
-
const ref = useRef(null);
|
|
668
|
-
const {
|
|
669
|
-
inputProps: { className: _className, type: _type, ...rest }
|
|
670
|
-
} = useSwitch(ariaSwitchProps, state, ref);
|
|
671
|
-
return /* @__PURE__ */ React7.createElement(Label, { className, "aria-disabled": disabled }, /* @__PURE__ */ React7.createElement(SwitchInput, { ...rest, ref }), "children" in props ? /* @__PURE__ */ React7.createElement(LabelInner, null, props.children) : void 0);
|
|
672
|
-
}
|
|
673
|
-
var Label = styled7.label`
|
|
674
|
-
display: inline-grid;
|
|
675
|
-
grid-template-columns: auto 1fr;
|
|
676
|
-
align-items: center;
|
|
677
|
-
gap: ${({ theme: theme4 }) => px3(theme4.spacing[4])};
|
|
678
|
-
cursor: pointer;
|
|
679
|
-
outline: 0;
|
|
680
|
-
|
|
681
|
-
${theme((o) => o.disabled)}
|
|
682
|
-
|
|
683
|
-
${disabledSelector3} {
|
|
684
|
-
cursor: default;
|
|
685
|
-
}
|
|
686
|
-
`;
|
|
687
|
-
var LabelInner = styled7.div`
|
|
688
|
-
${theme((o) => [o.typography(14), o.font.text2])}
|
|
689
|
-
`;
|
|
690
|
-
var SwitchInput = styled7.input.attrs({
|
|
691
|
-
type: "checkbox"
|
|
692
|
-
})`
|
|
693
|
-
&[type='checkbox'] {
|
|
694
|
-
appearance: none;
|
|
695
|
-
display: inline-flex;
|
|
696
|
-
position: relative;
|
|
697
|
-
box-sizing: border-box;
|
|
698
|
-
width: 28px;
|
|
699
|
-
border: 2px solid transparent;
|
|
700
|
-
transition: box-shadow 0.2s, background-color 0.2s;
|
|
701
|
-
cursor: inherit;
|
|
702
|
-
${theme((o) => [
|
|
703
|
-
o.borderRadius(16),
|
|
704
|
-
o.height.px(16),
|
|
705
|
-
o.bg.text4.hover.press,
|
|
706
|
-
o.outline.default.focus
|
|
707
|
-
])}
|
|
708
|
-
|
|
709
|
-
&::after {
|
|
710
|
-
content: '';
|
|
711
|
-
position: absolute;
|
|
712
|
-
display: block;
|
|
713
|
-
top: 0;
|
|
714
|
-
left: 0;
|
|
715
|
-
width: 12px;
|
|
716
|
-
height: 12px;
|
|
717
|
-
transform: translateX(0);
|
|
718
|
-
transition: transform 0.2s;
|
|
719
|
-
${theme((o) => [o.bg.text5.hover.press, o.borderRadius("oval")])}
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
&:checked {
|
|
723
|
-
${theme((o) => o.bg.brand.hover.press)}
|
|
724
|
-
|
|
725
|
-
&::after {
|
|
726
|
-
transform: translateX(12px);
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
`;
|
|
731
|
-
|
|
732
|
-
// src/components/TextField/index.tsx
|
|
733
|
-
import { useTextField } from "@react-aria/textfield";
|
|
734
|
-
import { useVisuallyHidden } from "@react-aria/visually-hidden";
|
|
735
|
-
import React9, {
|
|
736
|
-
useCallback as useCallback3,
|
|
737
|
-
useEffect,
|
|
738
|
-
useRef as useRef2,
|
|
739
|
-
useState
|
|
740
|
-
} from "react";
|
|
741
|
-
import styled9, { css as css3 } from "styled-components";
|
|
742
|
-
|
|
743
|
-
// src/components/FieldLabel/index.tsx
|
|
744
|
-
import React8 from "react";
|
|
745
|
-
import styled8 from "styled-components";
|
|
746
|
-
import { createTheme as createTheme2 } from "@charcoal-ui/styled";
|
|
747
|
-
var FieldLabel = React8.forwardRef(
|
|
748
|
-
function FieldLabel2({
|
|
749
|
-
style,
|
|
750
|
-
className,
|
|
751
|
-
label,
|
|
752
|
-
required = false,
|
|
753
|
-
requiredText,
|
|
754
|
-
subLabel,
|
|
755
|
-
...labelProps
|
|
756
|
-
}, ref) {
|
|
757
|
-
return /* @__PURE__ */ React8.createElement(FieldLabelWrapper, { style, className }, /* @__PURE__ */ React8.createElement(Label2, { ref, ...labelProps }, label), required && /* @__PURE__ */ React8.createElement(RequiredText, null, requiredText), /* @__PURE__ */ React8.createElement(SubLabelClickable, null, /* @__PURE__ */ React8.createElement("span", null, subLabel)));
|
|
758
|
-
}
|
|
759
|
-
);
|
|
760
|
-
var FieldLabel_default = FieldLabel;
|
|
761
|
-
var theme2 = createTheme2(styled8);
|
|
762
|
-
var Label2 = styled8.label`
|
|
763
|
-
${theme2((o) => [o.typography(14).bold, o.font.text1])}
|
|
764
|
-
`;
|
|
765
|
-
var RequiredText = styled8.span`
|
|
766
|
-
${theme2((o) => [o.typography(14), o.font.text3])}
|
|
767
|
-
`;
|
|
768
|
-
var SubLabelClickable = styled8.div`
|
|
769
|
-
${theme2((o) => [
|
|
770
|
-
o.typography(14),
|
|
771
|
-
o.font.text3.hover.press,
|
|
772
|
-
o.outline.default.focus
|
|
773
|
-
])}
|
|
774
|
-
`;
|
|
775
|
-
var FieldLabelWrapper = styled8.div`
|
|
776
|
-
display: inline-flex;
|
|
777
|
-
align-items: center;
|
|
778
|
-
|
|
779
|
-
> ${RequiredText} {
|
|
780
|
-
${theme2((o) => o.margin.left(4))}
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
> ${SubLabelClickable} {
|
|
784
|
-
${theme2((o) => o.margin.left("auto"))}
|
|
785
|
-
}
|
|
786
|
-
`;
|
|
787
|
-
|
|
788
|
-
// src/components/TextField/index.tsx
|
|
789
|
-
import { createTheme as createTheme3 } from "@charcoal-ui/styled";
|
|
790
|
-
var theme3 = createTheme3(styled9);
|
|
791
|
-
function mergeRefs(...refs) {
|
|
792
|
-
return (value) => {
|
|
793
|
-
for (const ref of refs) {
|
|
794
|
-
if (typeof ref === "function") {
|
|
795
|
-
ref(value);
|
|
796
|
-
} else if (ref !== null) {
|
|
797
|
-
;
|
|
798
|
-
ref.current = value;
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
};
|
|
802
|
-
}
|
|
803
|
-
function countCodePointsInString(string) {
|
|
804
|
-
return Array.from(string).length;
|
|
805
|
-
}
|
|
806
|
-
var TextField = React9.forwardRef(
|
|
807
|
-
function TextField2(props, ref) {
|
|
808
|
-
return props.multiline !== void 0 && props.multiline ? /* @__PURE__ */ React9.createElement(MultiLineTextField, { ref, ...props }) : /* @__PURE__ */ React9.createElement(SingleLineTextField, { ref, ...props });
|
|
809
|
-
}
|
|
810
|
-
);
|
|
811
|
-
var TextField_default = TextField;
|
|
812
|
-
var SingleLineTextField = React9.forwardRef(function SingleLineTextFieldInner({ onChange, ...props }, forwardRef4) {
|
|
813
|
-
const {
|
|
814
|
-
className,
|
|
815
|
-
showLabel = false,
|
|
816
|
-
showCount = false,
|
|
817
|
-
label,
|
|
818
|
-
requiredText,
|
|
819
|
-
subLabel,
|
|
820
|
-
disabled = false,
|
|
821
|
-
required,
|
|
822
|
-
invalid = false,
|
|
823
|
-
assistiveText,
|
|
824
|
-
maxLength,
|
|
825
|
-
prefix = null,
|
|
826
|
-
suffix = null
|
|
827
|
-
} = props;
|
|
828
|
-
const { visuallyHiddenProps } = useVisuallyHidden();
|
|
829
|
-
const ariaRef = useRef2(null);
|
|
830
|
-
const prefixRef = useRef2(null);
|
|
831
|
-
const suffixRef = useRef2(null);
|
|
832
|
-
const [count, setCount] = useState(countCodePointsInString(props.value ?? ""));
|
|
833
|
-
const [prefixWidth, setPrefixWidth] = useState(0);
|
|
834
|
-
const [suffixWidth, setSuffixWidth] = useState(0);
|
|
835
|
-
const nonControlled = props.value === void 0;
|
|
836
|
-
const handleChange = useCallback3(
|
|
837
|
-
(value) => {
|
|
838
|
-
const count2 = countCodePointsInString(value);
|
|
839
|
-
if (maxLength !== void 0 && count2 > maxLength) {
|
|
840
|
-
return;
|
|
841
|
-
}
|
|
842
|
-
if (nonControlled) {
|
|
843
|
-
setCount(count2);
|
|
844
|
-
}
|
|
845
|
-
onChange?.(value);
|
|
846
|
-
},
|
|
847
|
-
[maxLength, nonControlled, onChange]
|
|
848
|
-
);
|
|
849
|
-
useEffect(() => {
|
|
850
|
-
setCount(countCodePointsInString(props.value ?? ""));
|
|
851
|
-
}, [props.value]);
|
|
852
|
-
const { inputProps, labelProps, descriptionProps, errorMessageProps } = useTextField(
|
|
853
|
-
{
|
|
854
|
-
inputElementType: "input",
|
|
855
|
-
isDisabled: disabled,
|
|
856
|
-
isRequired: required,
|
|
857
|
-
validationState: invalid ? "invalid" : "valid",
|
|
858
|
-
description: !invalid && assistiveText,
|
|
859
|
-
errorMessage: invalid && assistiveText,
|
|
860
|
-
onChange: handleChange,
|
|
861
|
-
...props
|
|
862
|
-
},
|
|
863
|
-
ariaRef
|
|
864
|
-
);
|
|
865
|
-
useEffect(() => {
|
|
866
|
-
const prefixObserver = new ResizeObserver((entries) => {
|
|
867
|
-
setPrefixWidth(entries[0].contentRect.width);
|
|
868
|
-
});
|
|
869
|
-
const suffixObserver = new ResizeObserver((entries) => {
|
|
870
|
-
setSuffixWidth(entries[0].contentRect.width);
|
|
871
|
-
});
|
|
872
|
-
if (prefixRef.current !== null) {
|
|
873
|
-
prefixObserver.observe(prefixRef.current);
|
|
874
|
-
}
|
|
875
|
-
if (suffixRef.current !== null) {
|
|
876
|
-
suffixObserver.observe(suffixRef.current);
|
|
877
|
-
}
|
|
878
|
-
return () => {
|
|
879
|
-
suffixObserver.disconnect();
|
|
880
|
-
prefixObserver.disconnect();
|
|
881
|
-
};
|
|
882
|
-
}, []);
|
|
883
|
-
return /* @__PURE__ */ React9.createElement(TextFieldRoot, { className, isDisabled: disabled }, /* @__PURE__ */ React9.createElement(
|
|
884
|
-
TextFieldLabel,
|
|
885
|
-
{
|
|
886
|
-
label,
|
|
887
|
-
requiredText,
|
|
888
|
-
required,
|
|
889
|
-
subLabel,
|
|
890
|
-
...labelProps,
|
|
891
|
-
...!showLabel ? visuallyHiddenProps : {}
|
|
892
|
-
}
|
|
893
|
-
), /* @__PURE__ */ React9.createElement(StyledInputContainer, null, /* @__PURE__ */ React9.createElement(PrefixContainer, { ref: prefixRef }, /* @__PURE__ */ React9.createElement(Affix, null, prefix)), /* @__PURE__ */ React9.createElement(
|
|
894
|
-
StyledInput,
|
|
895
|
-
{
|
|
896
|
-
ref: mergeRefs(forwardRef4, ariaRef),
|
|
897
|
-
invalid,
|
|
898
|
-
extraLeftPadding: prefixWidth,
|
|
899
|
-
extraRightPadding: suffixWidth,
|
|
900
|
-
...inputProps
|
|
901
|
-
}
|
|
902
|
-
), /* @__PURE__ */ React9.createElement(SuffixContainer, { ref: suffixRef }, /* @__PURE__ */ React9.createElement(Affix, null, suffix), showCount && /* @__PURE__ */ React9.createElement(SingleLineCounter, null, maxLength !== void 0 ? `${count}/${maxLength}` : count))), assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ React9.createElement(
|
|
903
|
-
AssistiveText,
|
|
904
|
-
{
|
|
905
|
-
invalid,
|
|
906
|
-
...invalid ? errorMessageProps : descriptionProps
|
|
907
|
-
},
|
|
908
|
-
assistiveText
|
|
909
|
-
));
|
|
910
|
-
});
|
|
911
|
-
var MultiLineTextField = React9.forwardRef(function MultiLineTextFieldInner({ onChange, ...props }, forwardRef4) {
|
|
912
|
-
const {
|
|
913
|
-
className,
|
|
914
|
-
showCount = false,
|
|
915
|
-
showLabel = false,
|
|
916
|
-
label,
|
|
917
|
-
requiredText,
|
|
918
|
-
subLabel,
|
|
919
|
-
disabled = false,
|
|
920
|
-
required,
|
|
921
|
-
invalid = false,
|
|
922
|
-
assistiveText,
|
|
923
|
-
maxLength,
|
|
924
|
-
autoHeight = false,
|
|
925
|
-
rows: initialRows = 4
|
|
926
|
-
} = props;
|
|
927
|
-
const { visuallyHiddenProps } = useVisuallyHidden();
|
|
928
|
-
const textareaRef = useRef2(null);
|
|
929
|
-
const ariaRef = useRef2(null);
|
|
930
|
-
const [count, setCount] = useState(countCodePointsInString(props.value ?? ""));
|
|
931
|
-
const [rows, setRows] = useState(initialRows);
|
|
932
|
-
const syncHeight = useCallback3(
|
|
933
|
-
(textarea) => {
|
|
934
|
-
const rows2 = (`${textarea.value}
|
|
935
|
-
`.match(/\n/gu)?.length ?? 0) || 1;
|
|
936
|
-
setRows(initialRows <= rows2 ? rows2 : initialRows);
|
|
937
|
-
},
|
|
938
|
-
[initialRows]
|
|
939
|
-
);
|
|
940
|
-
const nonControlled = props.value === void 0;
|
|
941
|
-
const handleChange = useCallback3(
|
|
942
|
-
(value) => {
|
|
943
|
-
const count2 = countCodePointsInString(value);
|
|
944
|
-
if (maxLength !== void 0 && count2 > maxLength) {
|
|
945
|
-
return;
|
|
946
|
-
}
|
|
947
|
-
if (nonControlled) {
|
|
948
|
-
setCount(count2);
|
|
949
|
-
}
|
|
950
|
-
if (autoHeight && textareaRef.current !== null) {
|
|
951
|
-
syncHeight(textareaRef.current);
|
|
952
|
-
}
|
|
953
|
-
onChange?.(value);
|
|
954
|
-
},
|
|
955
|
-
[autoHeight, maxLength, nonControlled, onChange, syncHeight]
|
|
956
|
-
);
|
|
957
|
-
useEffect(() => {
|
|
958
|
-
setCount(countCodePointsInString(props.value ?? ""));
|
|
959
|
-
}, [props.value]);
|
|
960
|
-
const { inputProps, labelProps, descriptionProps, errorMessageProps } = useTextField(
|
|
961
|
-
{
|
|
962
|
-
inputElementType: "textarea",
|
|
963
|
-
isDisabled: disabled,
|
|
964
|
-
isRequired: required,
|
|
965
|
-
validationState: invalid ? "invalid" : "valid",
|
|
966
|
-
description: !invalid && assistiveText,
|
|
967
|
-
errorMessage: invalid && assistiveText,
|
|
968
|
-
onChange: handleChange,
|
|
969
|
-
...props
|
|
970
|
-
},
|
|
971
|
-
ariaRef
|
|
972
|
-
);
|
|
973
|
-
useEffect(() => {
|
|
974
|
-
if (autoHeight && textareaRef.current !== null) {
|
|
975
|
-
syncHeight(textareaRef.current);
|
|
976
|
-
}
|
|
977
|
-
}, [autoHeight, syncHeight]);
|
|
978
|
-
return /* @__PURE__ */ React9.createElement(TextFieldRoot, { className, isDisabled: disabled }, /* @__PURE__ */ React9.createElement(
|
|
979
|
-
TextFieldLabel,
|
|
980
|
-
{
|
|
981
|
-
label,
|
|
982
|
-
requiredText,
|
|
983
|
-
required,
|
|
984
|
-
subLabel,
|
|
985
|
-
...labelProps,
|
|
986
|
-
...!showLabel ? visuallyHiddenProps : {}
|
|
987
|
-
}
|
|
988
|
-
), /* @__PURE__ */ React9.createElement(
|
|
989
|
-
StyledTextareaContainer,
|
|
990
|
-
{
|
|
991
|
-
invalid,
|
|
992
|
-
rows: showCount ? rows + 1 : rows
|
|
993
|
-
},
|
|
994
|
-
/* @__PURE__ */ React9.createElement(
|
|
995
|
-
StyledTextarea,
|
|
996
|
-
{
|
|
997
|
-
ref: mergeRefs(textareaRef, forwardRef4, ariaRef),
|
|
998
|
-
rows,
|
|
999
|
-
noBottomPadding: showCount,
|
|
1000
|
-
...inputProps
|
|
1001
|
-
}
|
|
1002
|
-
),
|
|
1003
|
-
showCount && /* @__PURE__ */ React9.createElement(MultiLineCounter, null, maxLength !== void 0 ? `${count}/${maxLength}` : count)
|
|
1004
|
-
), assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ React9.createElement(
|
|
1005
|
-
AssistiveText,
|
|
1006
|
-
{
|
|
1007
|
-
invalid,
|
|
1008
|
-
...invalid ? errorMessageProps : descriptionProps
|
|
1009
|
-
},
|
|
1010
|
-
assistiveText
|
|
1011
|
-
));
|
|
1012
|
-
});
|
|
1013
|
-
var TextFieldRoot = styled9.div`
|
|
1014
|
-
display: flex;
|
|
1015
|
-
flex-direction: column;
|
|
1016
|
-
|
|
1017
|
-
${(p) => p.isDisabled && { opacity: p.theme.elementEffect.disabled.opacity }}
|
|
1018
|
-
`;
|
|
1019
|
-
var TextFieldLabel = styled9(FieldLabel_default)`
|
|
1020
|
-
${theme3((o) => o.margin.bottom(8))}
|
|
1021
|
-
`;
|
|
1022
|
-
var StyledInputContainer = styled9.div`
|
|
1023
|
-
height: 40px;
|
|
1024
|
-
display: grid;
|
|
1025
|
-
position: relative;
|
|
1026
|
-
`;
|
|
1027
|
-
var PrefixContainer = styled9.span`
|
|
1028
|
-
position: absolute;
|
|
1029
|
-
top: 50%;
|
|
1030
|
-
left: 8px;
|
|
1031
|
-
transform: translateY(-50%);
|
|
1032
|
-
`;
|
|
1033
|
-
var SuffixContainer = styled9.span`
|
|
1034
|
-
position: absolute;
|
|
1035
|
-
top: 50%;
|
|
1036
|
-
right: 8px;
|
|
1037
|
-
transform: translateY(-50%);
|
|
1038
|
-
|
|
1039
|
-
display: flex;
|
|
1040
|
-
gap: 8px;
|
|
1041
|
-
`;
|
|
1042
|
-
var Affix = styled9.span`
|
|
1043
|
-
user-select: none;
|
|
1044
|
-
|
|
1045
|
-
${theme3((o) => [o.typography(14).preserveHalfLeading, o.font.text2])}
|
|
1046
|
-
`;
|
|
1047
|
-
var StyledInput = styled9.input`
|
|
1048
|
-
border: none;
|
|
1049
|
-
box-sizing: border-box;
|
|
1050
|
-
outline: none;
|
|
1051
|
-
font-family: inherit;
|
|
1052
|
-
|
|
1053
|
-
/* Prevent zooming for iOS Safari */
|
|
1054
|
-
transform-origin: top left;
|
|
1055
|
-
transform: scale(0.875);
|
|
1056
|
-
width: calc(100% / 0.875);
|
|
1057
|
-
height: calc(100% / 0.875);
|
|
1058
|
-
font-size: calc(14px / 0.875);
|
|
1059
|
-
line-height: calc(22px / 0.875);
|
|
1060
|
-
padding-left: calc((8px + ${(p) => p.extraLeftPadding}px) / 0.875);
|
|
1061
|
-
padding-right: calc((8px + ${(p) => p.extraRightPadding}px) / 0.875);
|
|
1062
|
-
border-radius: calc(4px / 0.875);
|
|
1063
|
-
|
|
1064
|
-
/* Display box-shadow for iOS Safari */
|
|
1065
|
-
appearance: none;
|
|
1066
|
-
|
|
1067
|
-
${(p) => theme3((o) => [
|
|
1068
|
-
o.bg.surface3.hover,
|
|
1069
|
-
o.outline.default.focus,
|
|
1070
|
-
p.invalid && o.outline.assertive,
|
|
1071
|
-
o.font.text2
|
|
1072
|
-
])}
|
|
1073
|
-
|
|
1074
|
-
&::placeholder {
|
|
1075
|
-
${theme3((o) => o.font.text3)}
|
|
1076
|
-
}
|
|
1077
|
-
`;
|
|
1078
|
-
var StyledTextareaContainer = styled9.div`
|
|
1079
|
-
position: relative;
|
|
1080
|
-
overflow: hidden;
|
|
1081
|
-
padding: 0 8px;
|
|
1082
|
-
|
|
1083
|
-
${(p) => theme3((o) => [
|
|
1084
|
-
o.bg.surface3.hover,
|
|
1085
|
-
p.invalid && o.outline.assertive,
|
|
1086
|
-
o.font.text2,
|
|
1087
|
-
o.borderRadius(4)
|
|
1088
|
-
])}
|
|
1089
|
-
|
|
1090
|
-
&:focus-within {
|
|
1091
|
-
${(p) => theme3((o) => p.invalid ? o.outline.assertive : o.outline.default)}
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
${({ rows }) => css3`
|
|
1095
|
-
height: calc(22px * ${rows} + 18px);
|
|
1096
|
-
`};
|
|
1097
|
-
`;
|
|
1098
|
-
var StyledTextarea = styled9.textarea`
|
|
1099
|
-
border: none;
|
|
1100
|
-
outline: none;
|
|
1101
|
-
resize: none;
|
|
1102
|
-
font-family: inherit;
|
|
1103
|
-
color: inherit;
|
|
1104
|
-
|
|
1105
|
-
/* Prevent zooming for iOS Safari */
|
|
1106
|
-
transform-origin: top left;
|
|
1107
|
-
transform: scale(0.875);
|
|
1108
|
-
width: calc(100% / 0.875);
|
|
1109
|
-
font-size: calc(14px / 0.875);
|
|
1110
|
-
line-height: calc(22px / 0.875);
|
|
1111
|
-
padding: calc(9px / 0.875) 0 ${(p) => p.noBottomPadding ? 0 : ""};
|
|
1112
|
-
|
|
1113
|
-
${({ rows = 1 }) => css3`
|
|
1114
|
-
height: calc(22px / 0.875 * ${rows});
|
|
1115
|
-
`};
|
|
1116
|
-
|
|
1117
|
-
/* Display box-shadow for iOS Safari */
|
|
1118
|
-
appearance: none;
|
|
1119
|
-
|
|
1120
|
-
background: none;
|
|
1121
|
-
|
|
1122
|
-
&::placeholder {
|
|
1123
|
-
${theme3((o) => o.font.text3)}
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
/* Hide scrollbar for Chrome, Safari and Opera */
|
|
1127
|
-
&::-webkit-scrollbar {
|
|
1128
|
-
display: none;
|
|
1129
|
-
}
|
|
1130
|
-
/* Hide scrollbar for IE, Edge and Firefox */
|
|
1131
|
-
-ms-overflow-style: none; /* IE and Edge */
|
|
1132
|
-
scrollbar-width: none; /* Firefox */
|
|
1133
|
-
`;
|
|
1134
|
-
var SingleLineCounter = styled9.span`
|
|
1135
|
-
${theme3((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}
|
|
1136
|
-
`;
|
|
1137
|
-
var MultiLineCounter = styled9.span`
|
|
1138
|
-
position: absolute;
|
|
1139
|
-
bottom: 9px;
|
|
1140
|
-
right: 8px;
|
|
1141
|
-
|
|
1142
|
-
${theme3((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}
|
|
1143
|
-
`;
|
|
1144
|
-
var AssistiveText = styled9.p`
|
|
1145
|
-
${(p) => theme3((o) => [
|
|
1146
|
-
o.typography(14),
|
|
1147
|
-
o.margin.top(8),
|
|
1148
|
-
o.margin.bottom(0),
|
|
1149
|
-
o.font[p.invalid ? "assertive" : "text1"]
|
|
1150
|
-
])}
|
|
1151
|
-
`;
|
|
1152
|
-
|
|
1153
|
-
// src/components/Icon/index.tsx
|
|
1154
|
-
import React10 from "react";
|
|
1155
|
-
import "@charcoal-ui/icons";
|
|
1156
|
-
var Icon = React10.forwardRef(function IconInner({ name, scale, unsafeNonGuidelineScale, className, ...rest }, ref) {
|
|
1157
|
-
return /* @__PURE__ */ React10.createElement(
|
|
1158
|
-
"pixiv-icon",
|
|
1159
|
-
{
|
|
1160
|
-
ref,
|
|
1161
|
-
name,
|
|
1162
|
-
scale,
|
|
1163
|
-
"unsafe-non-guideline-scale": unsafeNonGuidelineScale,
|
|
1164
|
-
class: className,
|
|
1165
|
-
...rest
|
|
1166
|
-
}
|
|
1167
|
-
);
|
|
1168
|
-
});
|
|
1169
|
-
var Icon_default = Icon;
|
|
1170
|
-
|
|
1171
|
-
// src/components/Modal/index.tsx
|
|
1172
|
-
import React11, { useContext as useContext4, useRef as useRef3 } from "react";
|
|
1173
|
-
import {
|
|
1174
|
-
Overlay,
|
|
1175
|
-
useModalOverlay,
|
|
1176
|
-
useOverlay,
|
|
1177
|
-
usePreventScroll
|
|
1178
|
-
} from "@react-aria/overlays";
|
|
1179
|
-
import styled10, { css as css4, useTheme } from "styled-components";
|
|
1180
|
-
import { FocusScope } from "@react-aria/focus";
|
|
1181
|
-
import { useDialog } from "@react-aria/dialog";
|
|
1182
|
-
|
|
1183
|
-
// ../foundation/src/grid.ts
|
|
1184
|
-
var COLUMN_UNIT = 80;
|
|
1185
|
-
var GUTTER_UNIT = 24;
|
|
1186
|
-
function columnSystem(span, column, gutter) {
|
|
1187
|
-
return span * column + (span - 1) * gutter;
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
// src/components/Modal/index.tsx
|
|
1191
|
-
import { maxWidth } from "@charcoal-ui/utils";
|
|
1192
|
-
import { useMedia } from "@charcoal-ui/styled";
|
|
1193
|
-
import { animated, useTransition, easings } from "react-spring";
|
|
1194
|
-
var DEFAULT_Z_INDEX = 10;
|
|
1195
|
-
function Modal({
|
|
1196
|
-
children,
|
|
1197
|
-
zIndex = DEFAULT_Z_INDEX,
|
|
1198
|
-
portalContainer,
|
|
1199
|
-
...props
|
|
1200
|
-
}) {
|
|
1201
|
-
const {
|
|
1202
|
-
title,
|
|
1203
|
-
size = "M",
|
|
1204
|
-
bottomSheet = false,
|
|
1205
|
-
isDismissable,
|
|
1206
|
-
onClose,
|
|
1207
|
-
isOpen = false
|
|
1208
|
-
} = props;
|
|
1209
|
-
const ref = useRef3(null);
|
|
1210
|
-
const { overlayProps, underlayProps } = useOverlay(props, ref);
|
|
1211
|
-
usePreventScroll();
|
|
1212
|
-
const { modalProps } = useModalOverlay(
|
|
1213
|
-
props,
|
|
1214
|
-
{
|
|
1215
|
-
close: onClose,
|
|
1216
|
-
isOpen,
|
|
1217
|
-
open: () => {
|
|
1218
|
-
},
|
|
1219
|
-
setOpen: () => {
|
|
1220
|
-
},
|
|
1221
|
-
toggle: () => {
|
|
1222
|
-
}
|
|
1223
|
-
},
|
|
1224
|
-
ref
|
|
1225
|
-
);
|
|
1226
|
-
const { dialogProps, titleProps } = useDialog(props, ref);
|
|
1227
|
-
const theme4 = useTheme();
|
|
1228
|
-
const isMobile = useMedia(maxWidth(theme4.breakpoint.screen1)) ?? false;
|
|
1229
|
-
const transitionEnabled = isMobile && bottomSheet !== false;
|
|
1230
|
-
const transition = useTransition(isOpen, {
|
|
1231
|
-
from: {
|
|
1232
|
-
transform: "translateY(100%)",
|
|
1233
|
-
backgroundColor: "rgba(0, 0, 0, 0)"
|
|
1234
|
-
},
|
|
1235
|
-
enter: {
|
|
1236
|
-
transform: "translateY(0%)",
|
|
1237
|
-
backgroundColor: "rgba(0, 0, 0, 0.4)"
|
|
1238
|
-
},
|
|
1239
|
-
leave: {
|
|
1240
|
-
transform: "translateY(100%)",
|
|
1241
|
-
backgroundColor: "rgba(0, 0, 0, 0)"
|
|
1242
|
-
},
|
|
1243
|
-
config: transitionEnabled ? { duration: 400, easing: easings.easeOutQuart } : { duration: 0 }
|
|
1244
|
-
});
|
|
1245
|
-
const showDismiss = !isMobile || bottomSheet !== true;
|
|
1246
|
-
return transition(
|
|
1247
|
-
({ backgroundColor, transform }, item) => item && /* @__PURE__ */ React11.createElement(Overlay, null, /* @__PURE__ */ React11.createElement(
|
|
1248
|
-
ModalBackground,
|
|
1249
|
-
{
|
|
1250
|
-
zIndex,
|
|
1251
|
-
...underlayProps,
|
|
1252
|
-
style: transitionEnabled ? { backgroundColor } : {}
|
|
1253
|
-
},
|
|
1254
|
-
/* @__PURE__ */ React11.createElement(FocusScope, { contain: true, restoreFocus: true, autoFocus: true }, /* @__PURE__ */ React11.createElement(
|
|
1255
|
-
ModalDialog,
|
|
1256
|
-
{
|
|
1257
|
-
ref,
|
|
1258
|
-
...overlayProps,
|
|
1259
|
-
...modalProps,
|
|
1260
|
-
...dialogProps,
|
|
1261
|
-
style: transitionEnabled ? { transform } : {},
|
|
1262
|
-
size,
|
|
1263
|
-
bottomSheet
|
|
1264
|
-
},
|
|
1265
|
-
/* @__PURE__ */ React11.createElement(
|
|
1266
|
-
ModalContext.Provider,
|
|
1267
|
-
{
|
|
1268
|
-
value: { titleProps, title, close: onClose, showDismiss }
|
|
1269
|
-
},
|
|
1270
|
-
children,
|
|
1271
|
-
isDismissable === true && /* @__PURE__ */ React11.createElement(
|
|
1272
|
-
ModalCrossButton,
|
|
1273
|
-
{
|
|
1274
|
-
size: "S",
|
|
1275
|
-
icon: "24/Close",
|
|
1276
|
-
onClick: onClose
|
|
1277
|
-
}
|
|
1278
|
-
)
|
|
1279
|
-
)
|
|
1280
|
-
))
|
|
1281
|
-
))
|
|
1282
|
-
);
|
|
1283
|
-
}
|
|
1284
|
-
var ModalContext = React11.createContext({
|
|
1285
|
-
titleProps: {},
|
|
1286
|
-
title: "",
|
|
1287
|
-
close: void 0,
|
|
1288
|
-
showDismiss: true
|
|
1289
|
-
});
|
|
1290
|
-
var ModalBackground = animated(styled10.div`
|
|
1291
|
-
z-index: ${({ zIndex }) => zIndex};
|
|
1292
|
-
position: fixed;
|
|
1293
|
-
top: 0;
|
|
1294
|
-
left: 0;
|
|
1295
|
-
width: 100%;
|
|
1296
|
-
height: 100%;
|
|
1297
|
-
|
|
1298
|
-
${theme((o) => [o.bg.surface4])}
|
|
1299
|
-
`);
|
|
1300
|
-
var ModalDialog = animated(styled10.div`
|
|
1301
|
-
position: absolute;
|
|
1302
|
-
top: 50%;
|
|
1303
|
-
left: 50%;
|
|
1304
|
-
transform: translate(-50%, -50%);
|
|
1305
|
-
width: ${(p) => p.size === "S" ? columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2 : p.size === "M" ? columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2 : p.size === "L" ? columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2 : unreachable(p.size)}px;
|
|
1306
|
-
|
|
1307
|
-
${theme((o) => [o.bg.background1, o.borderRadius(24)])}
|
|
1308
|
-
|
|
1309
|
-
@media ${({ theme: theme4 }) => maxWidth(theme4.breakpoint.screen1)} {
|
|
1310
|
-
${(p) => p.bottomSheet === "full" ? css4`
|
|
1311
|
-
top: auto;
|
|
1312
|
-
bottom: 0;
|
|
1313
|
-
left: 0;
|
|
1314
|
-
transform: none;
|
|
1315
|
-
border-radius: 0;
|
|
1316
|
-
width: 100%;
|
|
1317
|
-
height: 100%;
|
|
1318
|
-
` : p.bottomSheet ? css4`
|
|
1319
|
-
top: auto;
|
|
1320
|
-
bottom: 0;
|
|
1321
|
-
left: 0;
|
|
1322
|
-
transform: none;
|
|
1323
|
-
border-radius: 0;
|
|
1324
|
-
width: 100%;
|
|
1325
|
-
` : css4`
|
|
1326
|
-
width: calc(100% - 48px);
|
|
1327
|
-
`}
|
|
1328
|
-
}
|
|
1329
|
-
`);
|
|
1330
|
-
var ModalCrossButton = styled10(IconButton_default)`
|
|
1331
|
-
position: absolute;
|
|
1332
|
-
top: 8px;
|
|
1333
|
-
right: 8px;
|
|
1334
|
-
|
|
1335
|
-
${theme((o) => [o.font.text3.hover.press])}
|
|
1336
|
-
`;
|
|
1337
|
-
function ModalTitle(props) {
|
|
1338
|
-
const { titleProps, title } = useContext4(ModalContext);
|
|
1339
|
-
return /* @__PURE__ */ React11.createElement(ModalHeading, { ...titleProps, ...props }, title);
|
|
1340
|
-
}
|
|
1341
|
-
var ModalHeading = styled10.h3`
|
|
1342
|
-
margin: 0;
|
|
1343
|
-
font-weight: inherit;
|
|
1344
|
-
font-size: inherit;
|
|
1345
|
-
`;
|
|
1346
|
-
|
|
1347
|
-
// src/components/Modal/ModalPlumbing.tsx
|
|
1348
|
-
import React12 from "react";
|
|
1349
|
-
import styled11 from "styled-components";
|
|
1350
|
-
import { maxWidth as maxWidth2 } from "@charcoal-ui/utils";
|
|
1351
|
-
function ModalHeader() {
|
|
1352
|
-
return /* @__PURE__ */ React12.createElement(ModalHeaderRoot, null, /* @__PURE__ */ React12.createElement(StyledModalTitle, null));
|
|
1353
|
-
}
|
|
1354
|
-
var ModalHeaderRoot = styled11.div`
|
|
1355
|
-
height: 64px;
|
|
1356
|
-
display: grid;
|
|
1357
|
-
align-content: center;
|
|
1358
|
-
justify-content: center;
|
|
1359
|
-
`;
|
|
1360
|
-
var StyledModalTitle = styled11(ModalTitle)`
|
|
1361
|
-
${theme((o) => [o.font.text1, o.typography(16).bold])}
|
|
1362
|
-
`;
|
|
1363
|
-
var ModalAlign = styled11.div`
|
|
1364
|
-
${theme((o) => [o.padding.horizontal(24)])}
|
|
1365
|
-
|
|
1366
|
-
@media ${({ theme: theme4 }) => maxWidth2(theme4.breakpoint.screen1)} {
|
|
1367
|
-
${theme((o) => [o.padding.horizontal(16)])}
|
|
1368
|
-
}
|
|
1369
|
-
`;
|
|
1370
|
-
var ModalBody = styled11.div`
|
|
1371
|
-
${theme((o) => [o.padding.bottom(40)])}
|
|
1372
|
-
`;
|
|
1373
|
-
var ModalButtons = styled11.div`
|
|
1374
|
-
display: grid;
|
|
1375
|
-
grid-auto-flow: row;
|
|
1376
|
-
grid-row-gap: 8px;
|
|
1377
|
-
${theme((o) => [o.padding.horizontal(24).top(16)])}
|
|
1378
|
-
|
|
1379
|
-
@media ${({ theme: theme4 }) => maxWidth2(theme4.breakpoint.screen1)} {
|
|
1380
|
-
${theme((o) => [o.padding.horizontal(16)])}
|
|
1381
|
-
}
|
|
1382
|
-
`;
|
|
1383
|
-
|
|
1384
|
-
// src/components/LoadingSpinner/index.tsx
|
|
1385
|
-
import React13, { useImperativeHandle, useRef as useRef4 } from "react";
|
|
1386
|
-
import styled12, { keyframes } from "styled-components";
|
|
1387
|
-
function LoadingSpinner({
|
|
1388
|
-
size = 48,
|
|
1389
|
-
padding = 16,
|
|
1390
|
-
transparent = false
|
|
1391
|
-
}) {
|
|
1392
|
-
return /* @__PURE__ */ React13.createElement(LoadingSpinnerRoot, { size, padding, transparent }, /* @__PURE__ */ React13.createElement(LoadingSpinnerIcon, null));
|
|
1393
|
-
}
|
|
1394
|
-
var LoadingSpinnerRoot = styled12.div.attrs({ role: "progressbar" })`
|
|
1395
|
-
margin: auto;
|
|
1396
|
-
padding: ${(props) => props.padding}px;
|
|
1397
|
-
border-radius: 8px;
|
|
1398
|
-
font-size: ${(props) => props.size}px;
|
|
1399
|
-
width: ${(props) => props.size}px;
|
|
1400
|
-
height: ${(props) => props.size}px;
|
|
1401
|
-
opacity: 0.84;
|
|
1402
|
-
${({ transparent }) => theme((o) => [
|
|
1403
|
-
o.font.text4,
|
|
1404
|
-
transparent ? o.bg.transparent : o.bg.background1
|
|
1405
|
-
])}
|
|
1406
|
-
`;
|
|
1407
|
-
var scaleout = keyframes`
|
|
1408
|
-
from {
|
|
1409
|
-
transform: scale(0);
|
|
1410
|
-
opacity: 1;
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1413
|
-
to {
|
|
1414
|
-
transform: scale(1);
|
|
1415
|
-
opacity: 0;
|
|
1416
|
-
}
|
|
1417
|
-
`;
|
|
1418
|
-
var Icon2 = styled12.div.attrs({ role: "presentation" })`
|
|
1419
|
-
width: 1em;
|
|
1420
|
-
height: 1em;
|
|
1421
|
-
border-radius: 1em;
|
|
1422
|
-
background-color: currentColor;
|
|
1423
|
-
animation: ${scaleout} 1s both ease-out;
|
|
1424
|
-
animation-iteration-count: ${(p) => p.once ? 1 : "infinite"};
|
|
1425
|
-
|
|
1426
|
-
&[data-reset-animation] {
|
|
1427
|
-
animation: none;
|
|
1428
|
-
}
|
|
1429
|
-
`;
|
|
1430
|
-
var LoadingSpinnerIcon = React13.forwardRef(function LoadingSpinnerIcon2({ once = false }, ref) {
|
|
1431
|
-
const iconRef = useRef4(null);
|
|
1432
|
-
useImperativeHandle(ref, () => ({
|
|
1433
|
-
restart: () => {
|
|
1434
|
-
if (!iconRef.current) {
|
|
1435
|
-
return;
|
|
1436
|
-
}
|
|
1437
|
-
iconRef.current.dataset.resetAnimation = "true";
|
|
1438
|
-
void iconRef.current.offsetWidth;
|
|
1439
|
-
delete iconRef.current.dataset.resetAnimation;
|
|
1440
|
-
}
|
|
1441
|
-
}));
|
|
1442
|
-
return /* @__PURE__ */ React13.createElement(Icon2, { ref: iconRef, once });
|
|
1443
|
-
});
|
|
1444
|
-
|
|
1445
|
-
// src/components/DropdownSelector/index.tsx
|
|
1446
|
-
import React16, { useMemo as useMemo4, useRef as useRef7 } from "react";
|
|
1447
|
-
import styled14 from "styled-components";
|
|
1448
|
-
import { Item, useSelectState } from "react-stately";
|
|
1449
|
-
import { disabledSelector as disabledSelector4 } from "@charcoal-ui/utils";
|
|
1450
|
-
import { useVisuallyHidden as useVisuallyHidden2 } from "@react-aria/visually-hidden";
|
|
1451
|
-
import { useSelect, HiddenSelect } from "@react-aria/select";
|
|
1452
|
-
import { useButton } from "@react-aria/button";
|
|
1453
|
-
|
|
1454
|
-
// src/components/DropdownSelector/Listbox.tsx
|
|
1455
|
-
import React14, { memo, useRef as useRef5, Fragment, useMemo as useMemo2 } from "react";
|
|
1456
|
-
import styled13, { css as css5 } from "styled-components";
|
|
1457
|
-
|
|
1458
|
-
// ../../node_modules/@react-aria/utils/dist/module.js
|
|
1459
|
-
import $12uGp$react, { useState as $12uGp$useState, useRef as $12uGp$useRef, useCallback as $12uGp$useCallback, useEffect as $12uGp$useEffect } from "react";
|
|
1460
|
-
import { useSSRSafeId as $12uGp$useSSRSafeId } from "@react-aria/ssr";
|
|
1461
|
-
|
|
1462
|
-
// ../../node_modules/clsx/dist/clsx.m.js
|
|
1463
|
-
function toVal(mix) {
|
|
1464
|
-
var k, y, str = "";
|
|
1465
|
-
if (typeof mix === "string" || typeof mix === "number") {
|
|
1466
|
-
str += mix;
|
|
1467
|
-
} else if (typeof mix === "object") {
|
|
1468
|
-
if (Array.isArray(mix)) {
|
|
1469
|
-
for (k = 0; k < mix.length; k++) {
|
|
1470
|
-
if (mix[k]) {
|
|
1471
|
-
if (y = toVal(mix[k])) {
|
|
1472
|
-
str && (str += " ");
|
|
1473
|
-
str += y;
|
|
1474
|
-
}
|
|
1475
|
-
}
|
|
1476
|
-
}
|
|
1477
|
-
} else {
|
|
1478
|
-
for (k in mix) {
|
|
1479
|
-
if (mix[k]) {
|
|
1480
|
-
str && (str += " ");
|
|
1481
|
-
str += k;
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
return str;
|
|
1487
|
-
}
|
|
1488
|
-
function clsx_m_default() {
|
|
1489
|
-
var i = 0, tmp, x, str = "";
|
|
1490
|
-
while (i < arguments.length) {
|
|
1491
|
-
if (tmp = arguments[i++]) {
|
|
1492
|
-
if (x = toVal(tmp)) {
|
|
1493
|
-
str && (str += " ");
|
|
1494
|
-
str += x;
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
return str;
|
|
1499
|
-
}
|
|
1500
|
-
|
|
1501
|
-
// ../../node_modules/@react-aria/utils/dist/module.js
|
|
1502
|
-
var $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof window !== "undefined" ? $12uGp$react.useLayoutEffect : () => {
|
|
1503
|
-
};
|
|
1504
|
-
var $bdb11010cef70236$var$idsUpdaterMap = /* @__PURE__ */ new Map();
|
|
1505
|
-
function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
|
|
1506
|
-
let [value, setValue] = $12uGp$useState(defaultId);
|
|
1507
|
-
let nextId = $12uGp$useRef(null);
|
|
1508
|
-
let res = $12uGp$useSSRSafeId(value);
|
|
1509
|
-
let updateValue = $12uGp$useCallback((val) => {
|
|
1510
|
-
nextId.current = val;
|
|
1511
|
-
}, []);
|
|
1512
|
-
$bdb11010cef70236$var$idsUpdaterMap.set(res, updateValue);
|
|
1513
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
1514
|
-
let r = res;
|
|
1515
|
-
return () => {
|
|
1516
|
-
$bdb11010cef70236$var$idsUpdaterMap.delete(r);
|
|
1517
|
-
};
|
|
1518
|
-
}, [
|
|
1519
|
-
res
|
|
1520
|
-
]);
|
|
1521
|
-
$12uGp$useEffect(() => {
|
|
1522
|
-
let newId = nextId.current;
|
|
1523
|
-
if (newId) {
|
|
1524
|
-
nextId.current = null;
|
|
1525
|
-
setValue(newId);
|
|
1526
|
-
}
|
|
1527
|
-
});
|
|
1528
|
-
return res;
|
|
1529
|
-
}
|
|
1530
|
-
function $bdb11010cef70236$export$cd8c9cb68f842629(idA, idB) {
|
|
1531
|
-
if (idA === idB)
|
|
1532
|
-
return idA;
|
|
1533
|
-
let setIdA = $bdb11010cef70236$var$idsUpdaterMap.get(idA);
|
|
1534
|
-
if (setIdA) {
|
|
1535
|
-
setIdA(idB);
|
|
1536
|
-
return idB;
|
|
1537
|
-
}
|
|
1538
|
-
let setIdB = $bdb11010cef70236$var$idsUpdaterMap.get(idB);
|
|
1539
|
-
if (setIdB) {
|
|
1540
|
-
setIdB(idA);
|
|
1541
|
-
return idA;
|
|
1542
|
-
}
|
|
1543
|
-
return idB;
|
|
1544
|
-
}
|
|
1545
|
-
function $bdb11010cef70236$export$b4cc09c592e8fdb8(depArray = []) {
|
|
1546
|
-
let id = $bdb11010cef70236$export$f680877a34711e37();
|
|
1547
|
-
let [resolvedId, setResolvedId] = $1dbecbe27a04f9af$export$14d238f342723f25(id);
|
|
1548
|
-
let updateId = $12uGp$useCallback(() => {
|
|
1549
|
-
setResolvedId(function* () {
|
|
1550
|
-
yield id;
|
|
1551
|
-
yield document.getElementById(id) ? id : void 0;
|
|
1552
|
-
});
|
|
1553
|
-
}, [
|
|
1554
|
-
id,
|
|
1555
|
-
setResolvedId
|
|
1556
|
-
]);
|
|
1557
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(updateId, [
|
|
1558
|
-
id,
|
|
1559
|
-
updateId,
|
|
1560
|
-
...depArray
|
|
1561
|
-
]);
|
|
1562
|
-
return resolvedId;
|
|
1563
|
-
}
|
|
1564
|
-
function $ff5963eb1fccf552$export$e08e3b67e392101e(...callbacks) {
|
|
1565
|
-
return (...args) => {
|
|
1566
|
-
for (let callback of callbacks)
|
|
1567
|
-
if (typeof callback === "function")
|
|
1568
|
-
callback(...args);
|
|
1569
|
-
};
|
|
1570
|
-
}
|
|
1571
|
-
function $3ef42575df84b30b$export$9d1611c77c2fe928(...args) {
|
|
1572
|
-
let result = {
|
|
1573
|
-
...args[0]
|
|
1574
|
-
};
|
|
1575
|
-
for (let i = 1; i < args.length; i++) {
|
|
1576
|
-
let props = args[i];
|
|
1577
|
-
for (let key in props) {
|
|
1578
|
-
let a = result[key];
|
|
1579
|
-
let b = props[key];
|
|
1580
|
-
if (typeof a === "function" && typeof b === "function" && key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= 65 && key.charCodeAt(2) <= 90)
|
|
1581
|
-
result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e(a, b);
|
|
1582
|
-
else if ((key === "className" || key === "UNSAFE_className") && typeof a === "string" && typeof b === "string")
|
|
1583
|
-
result[key] = clsx_m_default(a, b);
|
|
1584
|
-
else if (key === "id" && a && b)
|
|
1585
|
-
result.id = $bdb11010cef70236$export$cd8c9cb68f842629(a, b);
|
|
1586
|
-
else
|
|
1587
|
-
result[key] = b !== void 0 ? b : a;
|
|
1588
|
-
}
|
|
1589
|
-
}
|
|
1590
|
-
return result;
|
|
1591
|
-
}
|
|
1592
|
-
var $65484d02dcb7eb3e$var$DOMPropNames = /* @__PURE__ */ new Set([
|
|
1593
|
-
"id"
|
|
1594
|
-
]);
|
|
1595
|
-
var $65484d02dcb7eb3e$var$labelablePropNames = /* @__PURE__ */ new Set([
|
|
1596
|
-
"aria-label",
|
|
1597
|
-
"aria-labelledby",
|
|
1598
|
-
"aria-describedby",
|
|
1599
|
-
"aria-details"
|
|
1600
|
-
]);
|
|
1601
|
-
var $65484d02dcb7eb3e$var$propRe = /^(data-.*)$/;
|
|
1602
|
-
function $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, opts = {}) {
|
|
1603
|
-
let { labelable, propNames } = opts;
|
|
1604
|
-
let filteredProps = {};
|
|
1605
|
-
for (const prop in props)
|
|
1606
|
-
if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe.test(prop)))
|
|
1607
|
-
filteredProps[prop] = props[prop];
|
|
1608
|
-
return filteredProps;
|
|
1609
|
-
}
|
|
1610
|
-
function $7215afc6de606d6b$export$de79e2c695e052f3(element) {
|
|
1611
|
-
if ($7215afc6de606d6b$var$supportsPreventScroll())
|
|
1612
|
-
element.focus({
|
|
1613
|
-
preventScroll: true
|
|
1614
|
-
});
|
|
1615
|
-
else {
|
|
1616
|
-
let scrollableElements = $7215afc6de606d6b$var$getScrollableElements(element);
|
|
1617
|
-
element.focus();
|
|
1618
|
-
$7215afc6de606d6b$var$restoreScrollPosition(scrollableElements);
|
|
1619
|
-
}
|
|
1620
|
-
}
|
|
1621
|
-
var $7215afc6de606d6b$var$supportsPreventScrollCached = null;
|
|
1622
|
-
function $7215afc6de606d6b$var$supportsPreventScroll() {
|
|
1623
|
-
if ($7215afc6de606d6b$var$supportsPreventScrollCached == null) {
|
|
1624
|
-
$7215afc6de606d6b$var$supportsPreventScrollCached = false;
|
|
1625
|
-
try {
|
|
1626
|
-
var focusElem = document.createElement("div");
|
|
1627
|
-
focusElem.focus({
|
|
1628
|
-
get preventScroll() {
|
|
1629
|
-
$7215afc6de606d6b$var$supportsPreventScrollCached = true;
|
|
1630
|
-
return true;
|
|
1631
|
-
}
|
|
1632
|
-
});
|
|
1633
|
-
} catch (e) {
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
return $7215afc6de606d6b$var$supportsPreventScrollCached;
|
|
1637
|
-
}
|
|
1638
|
-
function $7215afc6de606d6b$var$getScrollableElements(element) {
|
|
1639
|
-
var parent = element.parentNode;
|
|
1640
|
-
var scrollableElements = [];
|
|
1641
|
-
var rootScrollingElement = document.scrollingElement || document.documentElement;
|
|
1642
|
-
while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
|
|
1643
|
-
if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
|
|
1644
|
-
scrollableElements.push({
|
|
1645
|
-
element: parent,
|
|
1646
|
-
scrollTop: parent.scrollTop,
|
|
1647
|
-
scrollLeft: parent.scrollLeft
|
|
1648
|
-
});
|
|
1649
|
-
parent = parent.parentNode;
|
|
1650
|
-
}
|
|
1651
|
-
if (rootScrollingElement instanceof HTMLElement)
|
|
1652
|
-
scrollableElements.push({
|
|
1653
|
-
element: rootScrollingElement,
|
|
1654
|
-
scrollTop: rootScrollingElement.scrollTop,
|
|
1655
|
-
scrollLeft: rootScrollingElement.scrollLeft
|
|
1656
|
-
});
|
|
1657
|
-
return scrollableElements;
|
|
1658
|
-
}
|
|
1659
|
-
function $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements) {
|
|
1660
|
-
for (let { element, scrollTop, scrollLeft } of scrollableElements) {
|
|
1661
|
-
element.scrollTop = scrollTop;
|
|
1662
|
-
element.scrollLeft = scrollLeft;
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
var $bbed8b41f857bcc0$var$transitionsByElement = /* @__PURE__ */ new Map();
|
|
1666
|
-
var $bbed8b41f857bcc0$var$transitionCallbacks = /* @__PURE__ */ new Set();
|
|
1667
|
-
function $bbed8b41f857bcc0$var$setupGlobalEvents() {
|
|
1668
|
-
if (typeof window === "undefined")
|
|
1669
|
-
return;
|
|
1670
|
-
let onTransitionStart = (e) => {
|
|
1671
|
-
let transitions = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
|
|
1672
|
-
if (!transitions) {
|
|
1673
|
-
transitions = /* @__PURE__ */ new Set();
|
|
1674
|
-
$bbed8b41f857bcc0$var$transitionsByElement.set(e.target, transitions);
|
|
1675
|
-
e.target.addEventListener("transitioncancel", onTransitionEnd);
|
|
1676
|
-
}
|
|
1677
|
-
transitions.add(e.propertyName);
|
|
1678
|
-
};
|
|
1679
|
-
let onTransitionEnd = (e) => {
|
|
1680
|
-
let properties = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
|
|
1681
|
-
if (!properties)
|
|
1682
|
-
return;
|
|
1683
|
-
properties.delete(e.propertyName);
|
|
1684
|
-
if (properties.size === 0) {
|
|
1685
|
-
e.target.removeEventListener("transitioncancel", onTransitionEnd);
|
|
1686
|
-
$bbed8b41f857bcc0$var$transitionsByElement.delete(e.target);
|
|
1687
|
-
}
|
|
1688
|
-
if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) {
|
|
1689
|
-
for (let cb of $bbed8b41f857bcc0$var$transitionCallbacks)
|
|
1690
|
-
cb();
|
|
1691
|
-
$bbed8b41f857bcc0$var$transitionCallbacks.clear();
|
|
1692
|
-
}
|
|
1693
|
-
};
|
|
1694
|
-
document.body.addEventListener("transitionrun", onTransitionStart);
|
|
1695
|
-
document.body.addEventListener("transitionend", onTransitionEnd);
|
|
1696
|
-
}
|
|
1697
|
-
if (typeof document !== "undefined") {
|
|
1698
|
-
if (document.readyState !== "loading")
|
|
1699
|
-
$bbed8b41f857bcc0$var$setupGlobalEvents();
|
|
1700
|
-
else
|
|
1701
|
-
document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents);
|
|
1702
|
-
}
|
|
1703
|
-
function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
|
|
1704
|
-
requestAnimationFrame(() => {
|
|
1705
|
-
if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0)
|
|
1706
|
-
fn();
|
|
1707
|
-
else
|
|
1708
|
-
$bbed8b41f857bcc0$var$transitionCallbacks.add(fn);
|
|
1709
|
-
});
|
|
1710
|
-
}
|
|
1711
|
-
function $03deb23ff14920c4$export$4eaf04e54aa8eed6() {
|
|
1712
|
-
let globalListeners = $12uGp$useRef(/* @__PURE__ */ new Map());
|
|
1713
|
-
let addGlobalListener = $12uGp$useCallback((eventTarget, type, listener, options) => {
|
|
1714
|
-
let fn = (options === null || options === void 0 ? void 0 : options.once) ? (...args) => {
|
|
1715
|
-
globalListeners.current.delete(listener);
|
|
1716
|
-
listener(...args);
|
|
1717
|
-
} : listener;
|
|
1718
|
-
globalListeners.current.set(listener, {
|
|
1719
|
-
type,
|
|
1720
|
-
eventTarget,
|
|
1721
|
-
fn,
|
|
1722
|
-
options
|
|
1723
|
-
});
|
|
1724
|
-
eventTarget.addEventListener(type, listener, options);
|
|
1725
|
-
}, []);
|
|
1726
|
-
let removeGlobalListener = $12uGp$useCallback((eventTarget, type, listener, options) => {
|
|
1727
|
-
var ref;
|
|
1728
|
-
let fn = ((ref = globalListeners.current.get(listener)) === null || ref === void 0 ? void 0 : ref.fn) || listener;
|
|
1729
|
-
eventTarget.removeEventListener(type, fn, options);
|
|
1730
|
-
globalListeners.current.delete(listener);
|
|
1731
|
-
}, []);
|
|
1732
|
-
let removeAllGlobalListeners = $12uGp$useCallback(() => {
|
|
1733
|
-
globalListeners.current.forEach((value, key) => {
|
|
1734
|
-
removeGlobalListener(value.eventTarget, value.type, key, value.options);
|
|
1735
|
-
});
|
|
1736
|
-
}, [
|
|
1737
|
-
removeGlobalListener
|
|
1738
|
-
]);
|
|
1739
|
-
$12uGp$useEffect(() => {
|
|
1740
|
-
return removeAllGlobalListeners;
|
|
1741
|
-
}, [
|
|
1742
|
-
removeAllGlobalListeners
|
|
1743
|
-
]);
|
|
1744
|
-
return {
|
|
1745
|
-
addGlobalListener,
|
|
1746
|
-
removeGlobalListener,
|
|
1747
|
-
removeAllGlobalListeners
|
|
1748
|
-
};
|
|
1749
|
-
}
|
|
1750
|
-
function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
|
|
1751
|
-
let { id, "aria-label": label, "aria-labelledby": labelledBy } = props;
|
|
1752
|
-
id = $bdb11010cef70236$export$f680877a34711e37(id);
|
|
1753
|
-
if (labelledBy && label) {
|
|
1754
|
-
let ids = /* @__PURE__ */ new Set([
|
|
1755
|
-
...labelledBy.trim().split(/\s+/),
|
|
1756
|
-
id
|
|
1757
|
-
]);
|
|
1758
|
-
labelledBy = [
|
|
1759
|
-
...ids
|
|
1760
|
-
].join(" ");
|
|
1761
|
-
} else if (labelledBy)
|
|
1762
|
-
labelledBy = labelledBy.trim().split(/\s+/).join(" ");
|
|
1763
|
-
if (!label && !labelledBy && defaultLabel)
|
|
1764
|
-
label = defaultLabel;
|
|
1765
|
-
return {
|
|
1766
|
-
id,
|
|
1767
|
-
"aria-label": label,
|
|
1768
|
-
"aria-labelledby": labelledBy
|
|
1769
|
-
};
|
|
1770
|
-
}
|
|
1771
|
-
function $df56164dff5785e2$export$4338b53315abf666(forwardedRef) {
|
|
1772
|
-
const objRef = $12uGp$useRef();
|
|
1773
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
1774
|
-
if (!forwardedRef)
|
|
1775
|
-
return;
|
|
1776
|
-
if (typeof forwardedRef === "function")
|
|
1777
|
-
forwardedRef(objRef.current);
|
|
1778
|
-
else
|
|
1779
|
-
forwardedRef.current = objRef.current;
|
|
1780
|
-
}, [
|
|
1781
|
-
forwardedRef
|
|
1782
|
-
]);
|
|
1783
|
-
return objRef;
|
|
1784
|
-
}
|
|
1785
|
-
function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
|
|
1786
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
1787
|
-
if (context && context.ref && ref) {
|
|
1788
|
-
context.ref.current = ref.current;
|
|
1789
|
-
return () => {
|
|
1790
|
-
context.ref.current = null;
|
|
1791
|
-
};
|
|
1792
|
-
}
|
|
1793
|
-
}, [
|
|
1794
|
-
context,
|
|
1795
|
-
ref
|
|
1796
|
-
]);
|
|
1797
|
-
}
|
|
1798
|
-
var $5df64b3807dc15ee$var$visualViewport = typeof window !== "undefined" && window.visualViewport;
|
|
1799
|
-
var $ef06256079686ba0$var$descriptionId = 0;
|
|
1800
|
-
var $ef06256079686ba0$var$descriptionNodes = /* @__PURE__ */ new Map();
|
|
1801
|
-
function $ef06256079686ba0$export$f8aeda7b10753fa1(description) {
|
|
1802
|
-
let [id1, setId] = $12uGp$useState(void 0);
|
|
1803
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
1804
|
-
if (!description)
|
|
1805
|
-
return;
|
|
1806
|
-
let desc = $ef06256079686ba0$var$descriptionNodes.get(description);
|
|
1807
|
-
if (!desc) {
|
|
1808
|
-
let id = `react-aria-description-${$ef06256079686ba0$var$descriptionId++}`;
|
|
1809
|
-
setId(id);
|
|
1810
|
-
let node = document.createElement("div");
|
|
1811
|
-
node.id = id;
|
|
1812
|
-
node.style.display = "none";
|
|
1813
|
-
node.textContent = description;
|
|
1814
|
-
document.body.appendChild(node);
|
|
1815
|
-
desc = {
|
|
1816
|
-
refCount: 0,
|
|
1817
|
-
element: node
|
|
1818
|
-
};
|
|
1819
|
-
$ef06256079686ba0$var$descriptionNodes.set(description, desc);
|
|
1820
|
-
} else
|
|
1821
|
-
setId(desc.element.id);
|
|
1822
|
-
desc.refCount++;
|
|
1823
|
-
return () => {
|
|
1824
|
-
if (--desc.refCount === 0) {
|
|
1825
|
-
desc.element.remove();
|
|
1826
|
-
$ef06256079686ba0$var$descriptionNodes.delete(description);
|
|
1827
|
-
}
|
|
1828
|
-
};
|
|
1829
|
-
}, [
|
|
1830
|
-
description
|
|
1831
|
-
]);
|
|
1832
|
-
return {
|
|
1833
|
-
"aria-describedby": description ? id1 : void 0
|
|
1834
|
-
};
|
|
1835
|
-
}
|
|
1836
|
-
function $c87311424ea30a05$var$testUserAgent(re) {
|
|
1837
|
-
var ref;
|
|
1838
|
-
if (typeof window === "undefined" || window.navigator == null)
|
|
1839
|
-
return false;
|
|
1840
|
-
return ((ref = window.navigator["userAgentData"]) === null || ref === void 0 ? void 0 : ref.brands.some(
|
|
1841
|
-
(brand) => re.test(brand.brand)
|
|
1842
|
-
)) || re.test(window.navigator.userAgent);
|
|
1843
|
-
}
|
|
1844
|
-
function $c87311424ea30a05$var$testPlatform(re) {
|
|
1845
|
-
var ref;
|
|
1846
|
-
return typeof window !== "undefined" && window.navigator != null ? re.test(((ref = window.navigator["userAgentData"]) === null || ref === void 0 ? void 0 : ref.platform) || window.navigator.platform) : false;
|
|
1847
|
-
}
|
|
1848
|
-
function $c87311424ea30a05$export$9ac100e40613ea10() {
|
|
1849
|
-
return $c87311424ea30a05$var$testPlatform(/^Mac/i);
|
|
1850
|
-
}
|
|
1851
|
-
function $c87311424ea30a05$export$186c6964ca17d99() {
|
|
1852
|
-
return $c87311424ea30a05$var$testPlatform(/^iPhone/i);
|
|
1853
|
-
}
|
|
1854
|
-
function $c87311424ea30a05$export$7bef049ce92e4224() {
|
|
1855
|
-
return $c87311424ea30a05$var$testPlatform(/^iPad/i) || $c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
|
|
1856
|
-
}
|
|
1857
|
-
function $c87311424ea30a05$export$fedb369cb70207f1() {
|
|
1858
|
-
return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
|
|
1859
|
-
}
|
|
1860
|
-
function $c87311424ea30a05$export$e1865c3bedcd822b() {
|
|
1861
|
-
return $c87311424ea30a05$export$9ac100e40613ea10() || $c87311424ea30a05$export$fedb369cb70207f1();
|
|
1862
|
-
}
|
|
1863
|
-
function $c87311424ea30a05$export$78551043582a6a98() {
|
|
1864
|
-
return $c87311424ea30a05$var$testUserAgent(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e();
|
|
1865
|
-
}
|
|
1866
|
-
function $c87311424ea30a05$export$6446a186d09e379e() {
|
|
1867
|
-
return $c87311424ea30a05$var$testUserAgent(/Chrome/i);
|
|
1868
|
-
}
|
|
1869
|
-
function $c87311424ea30a05$export$a11b0059900ceec8() {
|
|
1870
|
-
return $c87311424ea30a05$var$testUserAgent(/Android/i);
|
|
1871
|
-
}
|
|
1872
|
-
function $e9faafb641e167db$export$90fc3a17d93f704c(ref, event, handler1, options) {
|
|
1873
|
-
let handlerRef = $12uGp$useRef(handler1);
|
|
1874
|
-
handlerRef.current = handler1;
|
|
1875
|
-
let isDisabled = handler1 == null;
|
|
1876
|
-
$12uGp$useEffect(() => {
|
|
1877
|
-
if (isDisabled)
|
|
1878
|
-
return;
|
|
1879
|
-
let element = ref.current;
|
|
1880
|
-
let handler = (e) => handlerRef.current.call(this, e);
|
|
1881
|
-
element.addEventListener(event, handler, options);
|
|
1882
|
-
return () => {
|
|
1883
|
-
element.removeEventListener(event, handler, options);
|
|
1884
|
-
};
|
|
1885
|
-
}, [
|
|
1886
|
-
ref,
|
|
1887
|
-
event,
|
|
1888
|
-
options,
|
|
1889
|
-
isDisabled
|
|
1890
|
-
]);
|
|
1891
|
-
}
|
|
1892
|
-
function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue) {
|
|
1893
|
-
let [value, setValue] = $12uGp$useState(defaultValue);
|
|
1894
|
-
let valueRef = $12uGp$useRef(value);
|
|
1895
|
-
let effect = $12uGp$useRef(null);
|
|
1896
|
-
valueRef.current = value;
|
|
1897
|
-
let nextRef = $12uGp$useRef(null);
|
|
1898
|
-
nextRef.current = () => {
|
|
1899
|
-
let newValue = effect.current.next();
|
|
1900
|
-
if (newValue.done) {
|
|
1901
|
-
effect.current = null;
|
|
1902
|
-
return;
|
|
1903
|
-
}
|
|
1904
|
-
if (value === newValue.value)
|
|
1905
|
-
nextRef.current();
|
|
1906
|
-
else
|
|
1907
|
-
setValue(newValue.value);
|
|
1908
|
-
};
|
|
1909
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
1910
|
-
if (effect.current)
|
|
1911
|
-
nextRef.current();
|
|
1912
|
-
});
|
|
1913
|
-
let queue = $12uGp$useCallback((fn) => {
|
|
1914
|
-
effect.current = fn(valueRef.current);
|
|
1915
|
-
nextRef.current();
|
|
1916
|
-
}, [
|
|
1917
|
-
effect,
|
|
1918
|
-
nextRef
|
|
1919
|
-
]);
|
|
1920
|
-
return [
|
|
1921
|
-
value,
|
|
1922
|
-
queue
|
|
1923
|
-
];
|
|
1924
|
-
}
|
|
1925
|
-
function $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element) {
|
|
1926
|
-
let offsetX = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, "left");
|
|
1927
|
-
let offsetY = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, "top");
|
|
1928
|
-
let width = element.offsetWidth;
|
|
1929
|
-
let height = element.offsetHeight;
|
|
1930
|
-
let x = scrollView.scrollLeft;
|
|
1931
|
-
let y = scrollView.scrollTop;
|
|
1932
|
-
let maxX = x + scrollView.offsetWidth;
|
|
1933
|
-
let maxY = y + scrollView.offsetHeight;
|
|
1934
|
-
if (offsetX <= x)
|
|
1935
|
-
x = offsetX;
|
|
1936
|
-
else if (offsetX + width > maxX)
|
|
1937
|
-
x += offsetX + width - maxX;
|
|
1938
|
-
if (offsetY <= y)
|
|
1939
|
-
y = offsetY;
|
|
1940
|
-
else if (offsetY + height > maxY)
|
|
1941
|
-
y += offsetY + height - maxY;
|
|
1942
|
-
scrollView.scrollLeft = x;
|
|
1943
|
-
scrollView.scrollTop = y;
|
|
1944
|
-
}
|
|
1945
|
-
function $2f04cbc44ee30ce0$var$relativeOffset(ancestor, child, axis) {
|
|
1946
|
-
const prop = axis === "left" ? "offsetLeft" : "offsetTop";
|
|
1947
|
-
let sum = 0;
|
|
1948
|
-
while (child.offsetParent) {
|
|
1949
|
-
sum += child[prop];
|
|
1950
|
-
if (child.offsetParent === ancestor)
|
|
1951
|
-
break;
|
|
1952
|
-
else if (child.offsetParent.contains(ancestor)) {
|
|
1953
|
-
sum -= ancestor[prop];
|
|
1954
|
-
break;
|
|
1955
|
-
}
|
|
1956
|
-
child = child.offsetParent;
|
|
1957
|
-
}
|
|
1958
|
-
return sum;
|
|
1959
|
-
}
|
|
1960
|
-
function $6a7db85432448f7f$export$60278871457622de(event) {
|
|
1961
|
-
if (event.mozInputSource === 0 && event.isTrusted)
|
|
1962
|
-
return true;
|
|
1963
|
-
if ($c87311424ea30a05$export$a11b0059900ceec8() && event.pointerType)
|
|
1964
|
-
return event.type === "click" && event.buttons === 1;
|
|
1965
|
-
return event.detail === 0 && !event.pointerType;
|
|
1966
|
-
}
|
|
1967
|
-
function $6a7db85432448f7f$export$29bf1b5f2c56cf63(event) {
|
|
1968
|
-
return event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
|
|
1969
|
-
}
|
|
1970
|
-
|
|
1971
|
-
// ../../node_modules/@react-aria/interactions/dist/module.js
|
|
1972
|
-
import $bx7SL$react, { useRef as $bx7SL$useRef, useContext as $bx7SL$useContext, useState as $bx7SL$useState, useMemo as $bx7SL$useMemo, useEffect as $bx7SL$useEffect, useCallback as $bx7SL$useCallback } from "react";
|
|
1973
|
-
var $14c0b72509d70225$var$state = "default";
|
|
1974
|
-
var $14c0b72509d70225$var$savedUserSelect = "";
|
|
1975
|
-
var $14c0b72509d70225$var$modifiedElementMap = /* @__PURE__ */ new WeakMap();
|
|
1976
|
-
function $14c0b72509d70225$export$16a4697467175487(target) {
|
|
1977
|
-
if ($c87311424ea30a05$export$fedb369cb70207f1()) {
|
|
1978
|
-
if ($14c0b72509d70225$var$state === "default") {
|
|
1979
|
-
$14c0b72509d70225$var$savedUserSelect = document.documentElement.style.webkitUserSelect;
|
|
1980
|
-
document.documentElement.style.webkitUserSelect = "none";
|
|
1981
|
-
}
|
|
1982
|
-
$14c0b72509d70225$var$state = "disabled";
|
|
1983
|
-
} else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
1984
|
-
$14c0b72509d70225$var$modifiedElementMap.set(target, target.style.userSelect);
|
|
1985
|
-
target.style.userSelect = "none";
|
|
1986
|
-
}
|
|
1987
|
-
}
|
|
1988
|
-
function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
|
|
1989
|
-
if ($c87311424ea30a05$export$fedb369cb70207f1()) {
|
|
1990
|
-
if ($14c0b72509d70225$var$state !== "disabled")
|
|
1991
|
-
return;
|
|
1992
|
-
$14c0b72509d70225$var$state = "restoring";
|
|
1993
|
-
setTimeout(() => {
|
|
1994
|
-
$bbed8b41f857bcc0$export$24490316f764c430(() => {
|
|
1995
|
-
if ($14c0b72509d70225$var$state === "restoring") {
|
|
1996
|
-
if (document.documentElement.style.webkitUserSelect === "none")
|
|
1997
|
-
document.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || "";
|
|
1998
|
-
$14c0b72509d70225$var$savedUserSelect = "";
|
|
1999
|
-
$14c0b72509d70225$var$state = "default";
|
|
2000
|
-
}
|
|
2001
|
-
});
|
|
2002
|
-
}, 300);
|
|
2003
|
-
} else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
2004
|
-
if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
|
|
2005
|
-
let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
|
|
2006
|
-
if (target.style.userSelect === "none")
|
|
2007
|
-
target.style.userSelect = targetOldUserSelect;
|
|
2008
|
-
if (target.getAttribute("style") === "")
|
|
2009
|
-
target.removeAttribute("style");
|
|
2010
|
-
$14c0b72509d70225$var$modifiedElementMap.delete(target);
|
|
2011
|
-
}
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
var $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = $bx7SL$react.createContext(null);
|
|
2015
|
-
$ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = "PressResponderContext";
|
|
2016
|
-
function $f6c31cce2adf654f$var$usePressResponderContext(props) {
|
|
2017
|
-
let context = $bx7SL$useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5);
|
|
2018
|
-
if (context) {
|
|
2019
|
-
let { register, ...contextProps } = context;
|
|
2020
|
-
props = $3ef42575df84b30b$export$9d1611c77c2fe928(contextProps, props);
|
|
2021
|
-
register();
|
|
2022
|
-
}
|
|
2023
|
-
$e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, props.ref);
|
|
2024
|
-
return props;
|
|
2025
|
-
}
|
|
2026
|
-
function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
2027
|
-
let {
|
|
2028
|
-
onPress: onPress1,
|
|
2029
|
-
onPressChange: onPressChange1,
|
|
2030
|
-
onPressStart: onPressStart1,
|
|
2031
|
-
onPressEnd: onPressEnd1,
|
|
2032
|
-
onPressUp: onPressUp1,
|
|
2033
|
-
isDisabled: isDisabled1,
|
|
2034
|
-
isPressed: isPressedProp,
|
|
2035
|
-
preventFocusOnPress,
|
|
2036
|
-
shouldCancelOnPointerExit,
|
|
2037
|
-
allowTextSelectionOnPress,
|
|
2038
|
-
ref: _,
|
|
2039
|
-
...domProps
|
|
2040
|
-
} = $f6c31cce2adf654f$var$usePressResponderContext(props);
|
|
2041
|
-
let propsRef = $bx7SL$useRef(null);
|
|
2042
|
-
propsRef.current = {
|
|
2043
|
-
onPress: onPress1,
|
|
2044
|
-
onPressChange: onPressChange1,
|
|
2045
|
-
onPressStart: onPressStart1,
|
|
2046
|
-
onPressEnd: onPressEnd1,
|
|
2047
|
-
onPressUp: onPressUp1,
|
|
2048
|
-
isDisabled: isDisabled1,
|
|
2049
|
-
shouldCancelOnPointerExit
|
|
2050
|
-
};
|
|
2051
|
-
let [isPressed, setPressed] = $bx7SL$useState(false);
|
|
2052
|
-
let ref = $bx7SL$useRef({
|
|
2053
|
-
isPressed: false,
|
|
2054
|
-
ignoreEmulatedMouseEvents: false,
|
|
2055
|
-
ignoreClickAfterPress: false,
|
|
2056
|
-
didFirePressStart: false,
|
|
2057
|
-
activePointerId: null,
|
|
2058
|
-
target: null,
|
|
2059
|
-
isOverTarget: false,
|
|
2060
|
-
pointerType: null
|
|
2061
|
-
});
|
|
2062
|
-
let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6();
|
|
2063
|
-
let pressProps1 = $bx7SL$useMemo(() => {
|
|
2064
|
-
let state = ref.current;
|
|
2065
|
-
let triggerPressStart = (originalEvent, pointerType) => {
|
|
2066
|
-
let { onPressStart, onPressChange, isDisabled } = propsRef.current;
|
|
2067
|
-
if (isDisabled || state.didFirePressStart)
|
|
2068
|
-
return;
|
|
2069
|
-
if (onPressStart)
|
|
2070
|
-
onPressStart({
|
|
2071
|
-
type: "pressstart",
|
|
2072
|
-
pointerType,
|
|
2073
|
-
target: originalEvent.currentTarget,
|
|
2074
|
-
shiftKey: originalEvent.shiftKey,
|
|
2075
|
-
metaKey: originalEvent.metaKey,
|
|
2076
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
2077
|
-
altKey: originalEvent.altKey
|
|
2078
|
-
});
|
|
2079
|
-
if (onPressChange)
|
|
2080
|
-
onPressChange(true);
|
|
2081
|
-
state.didFirePressStart = true;
|
|
2082
|
-
setPressed(true);
|
|
2083
|
-
};
|
|
2084
|
-
let triggerPressEnd = (originalEvent, pointerType, wasPressed = true) => {
|
|
2085
|
-
let { onPressEnd, onPressChange, onPress, isDisabled } = propsRef.current;
|
|
2086
|
-
if (!state.didFirePressStart)
|
|
2087
|
-
return;
|
|
2088
|
-
state.ignoreClickAfterPress = true;
|
|
2089
|
-
state.didFirePressStart = false;
|
|
2090
|
-
if (onPressEnd)
|
|
2091
|
-
onPressEnd({
|
|
2092
|
-
type: "pressend",
|
|
2093
|
-
pointerType,
|
|
2094
|
-
target: originalEvent.currentTarget,
|
|
2095
|
-
shiftKey: originalEvent.shiftKey,
|
|
2096
|
-
metaKey: originalEvent.metaKey,
|
|
2097
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
2098
|
-
altKey: originalEvent.altKey
|
|
2099
|
-
});
|
|
2100
|
-
if (onPressChange)
|
|
2101
|
-
onPressChange(false);
|
|
2102
|
-
setPressed(false);
|
|
2103
|
-
if (onPress && wasPressed && !isDisabled)
|
|
2104
|
-
onPress({
|
|
2105
|
-
type: "press",
|
|
2106
|
-
pointerType,
|
|
2107
|
-
target: originalEvent.currentTarget,
|
|
2108
|
-
shiftKey: originalEvent.shiftKey,
|
|
2109
|
-
metaKey: originalEvent.metaKey,
|
|
2110
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
2111
|
-
altKey: originalEvent.altKey
|
|
2112
|
-
});
|
|
2113
|
-
};
|
|
2114
|
-
let triggerPressUp = (originalEvent, pointerType) => {
|
|
2115
|
-
let { onPressUp, isDisabled } = propsRef.current;
|
|
2116
|
-
if (isDisabled)
|
|
2117
|
-
return;
|
|
2118
|
-
if (onPressUp)
|
|
2119
|
-
onPressUp({
|
|
2120
|
-
type: "pressup",
|
|
2121
|
-
pointerType,
|
|
2122
|
-
target: originalEvent.currentTarget,
|
|
2123
|
-
shiftKey: originalEvent.shiftKey,
|
|
2124
|
-
metaKey: originalEvent.metaKey,
|
|
2125
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
2126
|
-
altKey: originalEvent.altKey
|
|
2127
|
-
});
|
|
2128
|
-
};
|
|
2129
|
-
let cancel = (e) => {
|
|
2130
|
-
if (state.isPressed) {
|
|
2131
|
-
if (state.isOverTarget)
|
|
2132
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
|
2133
|
-
state.isPressed = false;
|
|
2134
|
-
state.isOverTarget = false;
|
|
2135
|
-
state.activePointerId = null;
|
|
2136
|
-
state.pointerType = null;
|
|
2137
|
-
removeAllGlobalListeners();
|
|
2138
|
-
if (!allowTextSelectionOnPress)
|
|
2139
|
-
$14c0b72509d70225$export$b0d6fa1ab32e3295(state.target);
|
|
2140
|
-
}
|
|
2141
|
-
};
|
|
2142
|
-
let pressProps = {
|
|
2143
|
-
onKeyDown(e) {
|
|
2144
|
-
if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && e.currentTarget.contains(e.target)) {
|
|
2145
|
-
if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(e.target, e.key))
|
|
2146
|
-
e.preventDefault();
|
|
2147
|
-
e.stopPropagation();
|
|
2148
|
-
if (!state.isPressed && !e.repeat) {
|
|
2149
|
-
state.target = e.currentTarget;
|
|
2150
|
-
state.isPressed = true;
|
|
2151
|
-
triggerPressStart(e, "keyboard");
|
|
2152
|
-
addGlobalListener(document, "keyup", onKeyUp, false);
|
|
2153
|
-
}
|
|
2154
|
-
} else if (e.key === "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink(e.currentTarget))
|
|
2155
|
-
e.stopPropagation();
|
|
2156
|
-
},
|
|
2157
|
-
onKeyUp(e) {
|
|
2158
|
-
if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && !e.repeat && e.currentTarget.contains(e.target))
|
|
2159
|
-
triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e), "keyboard");
|
|
2160
|
-
},
|
|
2161
|
-
onClick(e) {
|
|
2162
|
-
if (e && !e.currentTarget.contains(e.target))
|
|
2163
|
-
return;
|
|
2164
|
-
if (e && e.button === 0) {
|
|
2165
|
-
e.stopPropagation();
|
|
2166
|
-
if (isDisabled1)
|
|
2167
|
-
e.preventDefault();
|
|
2168
|
-
if (!state.ignoreClickAfterPress && !state.ignoreEmulatedMouseEvents && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de(e.nativeEvent))) {
|
|
2169
|
-
if (!isDisabled1 && !preventFocusOnPress)
|
|
2170
|
-
$7215afc6de606d6b$export$de79e2c695e052f3(e.currentTarget);
|
|
2171
|
-
triggerPressStart(e, "virtual");
|
|
2172
|
-
triggerPressUp(e, "virtual");
|
|
2173
|
-
triggerPressEnd(e, "virtual");
|
|
2174
|
-
}
|
|
2175
|
-
state.ignoreEmulatedMouseEvents = false;
|
|
2176
|
-
state.ignoreClickAfterPress = false;
|
|
2177
|
-
}
|
|
2178
|
-
}
|
|
2179
|
-
};
|
|
2180
|
-
let onKeyUp = (e) => {
|
|
2181
|
-
if (state.isPressed && $f6c31cce2adf654f$var$isValidKeyboardEvent(e, state.target)) {
|
|
2182
|
-
if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(e.target, e.key))
|
|
2183
|
-
e.preventDefault();
|
|
2184
|
-
e.stopPropagation();
|
|
2185
|
-
state.isPressed = false;
|
|
2186
|
-
let target = e.target;
|
|
2187
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), "keyboard", state.target.contains(target));
|
|
2188
|
-
removeAllGlobalListeners();
|
|
2189
|
-
if (state.target instanceof HTMLElement && state.target.contains(target) && ($f6c31cce2adf654f$var$isHTMLAnchorLink(state.target) || state.target.getAttribute("role") === "link"))
|
|
2190
|
-
state.target.click();
|
|
2191
|
-
}
|
|
2192
|
-
};
|
|
2193
|
-
if (typeof PointerEvent !== "undefined") {
|
|
2194
|
-
pressProps.onPointerDown = (e) => {
|
|
2195
|
-
if (e.button !== 0 || !e.currentTarget.contains(e.target))
|
|
2196
|
-
return;
|
|
2197
|
-
if ($6a7db85432448f7f$export$29bf1b5f2c56cf63(e.nativeEvent)) {
|
|
2198
|
-
state.pointerType = "virtual";
|
|
2199
|
-
return;
|
|
2200
|
-
}
|
|
2201
|
-
if ($f6c31cce2adf654f$var$shouldPreventDefault(e.currentTarget))
|
|
2202
|
-
e.preventDefault();
|
|
2203
|
-
state.pointerType = e.pointerType;
|
|
2204
|
-
e.stopPropagation();
|
|
2205
|
-
if (!state.isPressed) {
|
|
2206
|
-
state.isPressed = true;
|
|
2207
|
-
state.isOverTarget = true;
|
|
2208
|
-
state.activePointerId = e.pointerId;
|
|
2209
|
-
state.target = e.currentTarget;
|
|
2210
|
-
if (!isDisabled1 && !preventFocusOnPress)
|
|
2211
|
-
$7215afc6de606d6b$export$de79e2c695e052f3(e.currentTarget);
|
|
2212
|
-
if (!allowTextSelectionOnPress)
|
|
2213
|
-
$14c0b72509d70225$export$16a4697467175487(state.target);
|
|
2214
|
-
triggerPressStart(e, state.pointerType);
|
|
2215
|
-
addGlobalListener(document, "pointermove", onPointerMove, false);
|
|
2216
|
-
addGlobalListener(document, "pointerup", onPointerUp, false);
|
|
2217
|
-
addGlobalListener(document, "pointercancel", onPointerCancel, false);
|
|
2218
|
-
}
|
|
2219
|
-
};
|
|
2220
|
-
pressProps.onMouseDown = (e) => {
|
|
2221
|
-
if (!e.currentTarget.contains(e.target))
|
|
2222
|
-
return;
|
|
2223
|
-
if (e.button === 0) {
|
|
2224
|
-
if ($f6c31cce2adf654f$var$shouldPreventDefault(e.currentTarget))
|
|
2225
|
-
e.preventDefault();
|
|
2226
|
-
e.stopPropagation();
|
|
2227
|
-
}
|
|
2228
|
-
};
|
|
2229
|
-
pressProps.onPointerUp = (e) => {
|
|
2230
|
-
if (!e.currentTarget.contains(e.target) || state.pointerType === "virtual")
|
|
2231
|
-
return;
|
|
2232
|
-
if (e.button === 0 && $f6c31cce2adf654f$var$isOverTarget(e, e.currentTarget))
|
|
2233
|
-
triggerPressUp(e, state.pointerType || e.pointerType);
|
|
2234
|
-
};
|
|
2235
|
-
let onPointerMove = (e) => {
|
|
2236
|
-
if (e.pointerId !== state.activePointerId)
|
|
2237
|
-
return;
|
|
2238
|
-
if ($f6c31cce2adf654f$var$isOverTarget(e, state.target)) {
|
|
2239
|
-
if (!state.isOverTarget) {
|
|
2240
|
-
state.isOverTarget = true;
|
|
2241
|
-
triggerPressStart($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
|
|
2242
|
-
}
|
|
2243
|
-
} else if (state.isOverTarget) {
|
|
2244
|
-
state.isOverTarget = false;
|
|
2245
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
|
2246
|
-
if (propsRef.current.shouldCancelOnPointerExit)
|
|
2247
|
-
cancel(e);
|
|
2248
|
-
}
|
|
2249
|
-
};
|
|
2250
|
-
let onPointerUp = (e) => {
|
|
2251
|
-
if (e.pointerId === state.activePointerId && state.isPressed && e.button === 0) {
|
|
2252
|
-
if ($f6c31cce2adf654f$var$isOverTarget(e, state.target))
|
|
2253
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
|
|
2254
|
-
else if (state.isOverTarget)
|
|
2255
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
|
2256
|
-
state.isPressed = false;
|
|
2257
|
-
state.isOverTarget = false;
|
|
2258
|
-
state.activePointerId = null;
|
|
2259
|
-
state.pointerType = null;
|
|
2260
|
-
removeAllGlobalListeners();
|
|
2261
|
-
if (!allowTextSelectionOnPress)
|
|
2262
|
-
$14c0b72509d70225$export$b0d6fa1ab32e3295(state.target);
|
|
2263
|
-
}
|
|
2264
|
-
};
|
|
2265
|
-
let onPointerCancel = (e) => {
|
|
2266
|
-
cancel(e);
|
|
2267
|
-
};
|
|
2268
|
-
pressProps.onDragStart = (e) => {
|
|
2269
|
-
if (!e.currentTarget.contains(e.target))
|
|
2270
|
-
return;
|
|
2271
|
-
cancel(e);
|
|
2272
|
-
};
|
|
2273
|
-
} else {
|
|
2274
|
-
pressProps.onMouseDown = (e) => {
|
|
2275
|
-
if (e.button !== 0 || !e.currentTarget.contains(e.target))
|
|
2276
|
-
return;
|
|
2277
|
-
if ($f6c31cce2adf654f$var$shouldPreventDefault(e.currentTarget))
|
|
2278
|
-
e.preventDefault();
|
|
2279
|
-
e.stopPropagation();
|
|
2280
|
-
if (state.ignoreEmulatedMouseEvents)
|
|
2281
|
-
return;
|
|
2282
|
-
state.isPressed = true;
|
|
2283
|
-
state.isOverTarget = true;
|
|
2284
|
-
state.target = e.currentTarget;
|
|
2285
|
-
state.pointerType = $6a7db85432448f7f$export$60278871457622de(e.nativeEvent) ? "virtual" : "mouse";
|
|
2286
|
-
if (!isDisabled1 && !preventFocusOnPress)
|
|
2287
|
-
$7215afc6de606d6b$export$de79e2c695e052f3(e.currentTarget);
|
|
2288
|
-
triggerPressStart(e, state.pointerType);
|
|
2289
|
-
addGlobalListener(document, "mouseup", onMouseUp, false);
|
|
2290
|
-
};
|
|
2291
|
-
pressProps.onMouseEnter = (e) => {
|
|
2292
|
-
if (!e.currentTarget.contains(e.target))
|
|
2293
|
-
return;
|
|
2294
|
-
e.stopPropagation();
|
|
2295
|
-
if (state.isPressed && !state.ignoreEmulatedMouseEvents) {
|
|
2296
|
-
state.isOverTarget = true;
|
|
2297
|
-
triggerPressStart(e, state.pointerType);
|
|
2298
|
-
}
|
|
2299
|
-
};
|
|
2300
|
-
pressProps.onMouseLeave = (e) => {
|
|
2301
|
-
if (!e.currentTarget.contains(e.target))
|
|
2302
|
-
return;
|
|
2303
|
-
e.stopPropagation();
|
|
2304
|
-
if (state.isPressed && !state.ignoreEmulatedMouseEvents) {
|
|
2305
|
-
state.isOverTarget = false;
|
|
2306
|
-
triggerPressEnd(e, state.pointerType, false);
|
|
2307
|
-
if (propsRef.current.shouldCancelOnPointerExit)
|
|
2308
|
-
cancel(e);
|
|
2309
|
-
}
|
|
2310
|
-
};
|
|
2311
|
-
pressProps.onMouseUp = (e) => {
|
|
2312
|
-
if (!e.currentTarget.contains(e.target))
|
|
2313
|
-
return;
|
|
2314
|
-
if (!state.ignoreEmulatedMouseEvents && e.button === 0)
|
|
2315
|
-
triggerPressUp(e, state.pointerType);
|
|
2316
|
-
};
|
|
2317
|
-
let onMouseUp = (e) => {
|
|
2318
|
-
if (e.button !== 0)
|
|
2319
|
-
return;
|
|
2320
|
-
state.isPressed = false;
|
|
2321
|
-
removeAllGlobalListeners();
|
|
2322
|
-
if (state.ignoreEmulatedMouseEvents) {
|
|
2323
|
-
state.ignoreEmulatedMouseEvents = false;
|
|
2324
|
-
return;
|
|
2325
|
-
}
|
|
2326
|
-
if ($f6c31cce2adf654f$var$isOverTarget(e, state.target))
|
|
2327
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
|
|
2328
|
-
else if (state.isOverTarget)
|
|
2329
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
|
2330
|
-
state.isOverTarget = false;
|
|
2331
|
-
};
|
|
2332
|
-
pressProps.onTouchStart = (e) => {
|
|
2333
|
-
if (!e.currentTarget.contains(e.target))
|
|
2334
|
-
return;
|
|
2335
|
-
e.stopPropagation();
|
|
2336
|
-
let touch = $f6c31cce2adf654f$var$getTouchFromEvent(e.nativeEvent);
|
|
2337
|
-
if (!touch)
|
|
2338
|
-
return;
|
|
2339
|
-
state.activePointerId = touch.identifier;
|
|
2340
|
-
state.ignoreEmulatedMouseEvents = true;
|
|
2341
|
-
state.isOverTarget = true;
|
|
2342
|
-
state.isPressed = true;
|
|
2343
|
-
state.target = e.currentTarget;
|
|
2344
|
-
state.pointerType = "touch";
|
|
2345
|
-
if (!isDisabled1 && !preventFocusOnPress)
|
|
2346
|
-
$7215afc6de606d6b$export$de79e2c695e052f3(e.currentTarget);
|
|
2347
|
-
if (!allowTextSelectionOnPress)
|
|
2348
|
-
$14c0b72509d70225$export$16a4697467175487(state.target);
|
|
2349
|
-
triggerPressStart(e, state.pointerType);
|
|
2350
|
-
addGlobalListener(window, "scroll", onScroll, true);
|
|
2351
|
-
};
|
|
2352
|
-
pressProps.onTouchMove = (e) => {
|
|
2353
|
-
if (!e.currentTarget.contains(e.target))
|
|
2354
|
-
return;
|
|
2355
|
-
e.stopPropagation();
|
|
2356
|
-
if (!state.isPressed)
|
|
2357
|
-
return;
|
|
2358
|
-
let touch = $f6c31cce2adf654f$var$getTouchById(e.nativeEvent, state.activePointerId);
|
|
2359
|
-
if (touch && $f6c31cce2adf654f$var$isOverTarget(touch, e.currentTarget)) {
|
|
2360
|
-
if (!state.isOverTarget) {
|
|
2361
|
-
state.isOverTarget = true;
|
|
2362
|
-
triggerPressStart(e, state.pointerType);
|
|
2363
|
-
}
|
|
2364
|
-
} else if (state.isOverTarget) {
|
|
2365
|
-
state.isOverTarget = false;
|
|
2366
|
-
triggerPressEnd(e, state.pointerType, false);
|
|
2367
|
-
if (propsRef.current.shouldCancelOnPointerExit)
|
|
2368
|
-
cancel(e);
|
|
2369
|
-
}
|
|
2370
|
-
};
|
|
2371
|
-
pressProps.onTouchEnd = (e) => {
|
|
2372
|
-
if (!e.currentTarget.contains(e.target))
|
|
2373
|
-
return;
|
|
2374
|
-
e.stopPropagation();
|
|
2375
|
-
if (!state.isPressed)
|
|
2376
|
-
return;
|
|
2377
|
-
let touch = $f6c31cce2adf654f$var$getTouchById(e.nativeEvent, state.activePointerId);
|
|
2378
|
-
if (touch && $f6c31cce2adf654f$var$isOverTarget(touch, e.currentTarget)) {
|
|
2379
|
-
triggerPressUp(e, state.pointerType);
|
|
2380
|
-
triggerPressEnd(e, state.pointerType);
|
|
2381
|
-
} else if (state.isOverTarget)
|
|
2382
|
-
triggerPressEnd(e, state.pointerType, false);
|
|
2383
|
-
state.isPressed = false;
|
|
2384
|
-
state.activePointerId = null;
|
|
2385
|
-
state.isOverTarget = false;
|
|
2386
|
-
state.ignoreEmulatedMouseEvents = true;
|
|
2387
|
-
if (!allowTextSelectionOnPress)
|
|
2388
|
-
$14c0b72509d70225$export$b0d6fa1ab32e3295(state.target);
|
|
2389
|
-
removeAllGlobalListeners();
|
|
2390
|
-
};
|
|
2391
|
-
pressProps.onTouchCancel = (e) => {
|
|
2392
|
-
if (!e.currentTarget.contains(e.target))
|
|
2393
|
-
return;
|
|
2394
|
-
e.stopPropagation();
|
|
2395
|
-
if (state.isPressed)
|
|
2396
|
-
cancel(e);
|
|
2397
|
-
};
|
|
2398
|
-
let onScroll = (e) => {
|
|
2399
|
-
if (state.isPressed && e.target.contains(state.target))
|
|
2400
|
-
cancel({
|
|
2401
|
-
currentTarget: state.target,
|
|
2402
|
-
shiftKey: false,
|
|
2403
|
-
ctrlKey: false,
|
|
2404
|
-
metaKey: false,
|
|
2405
|
-
altKey: false
|
|
2406
|
-
});
|
|
2407
|
-
};
|
|
2408
|
-
pressProps.onDragStart = (e) => {
|
|
2409
|
-
if (!e.currentTarget.contains(e.target))
|
|
2410
|
-
return;
|
|
2411
|
-
cancel(e);
|
|
2412
|
-
};
|
|
2413
|
-
}
|
|
2414
|
-
return pressProps;
|
|
2415
|
-
}, [
|
|
2416
|
-
addGlobalListener,
|
|
2417
|
-
isDisabled1,
|
|
2418
|
-
preventFocusOnPress,
|
|
2419
|
-
removeAllGlobalListeners,
|
|
2420
|
-
allowTextSelectionOnPress
|
|
2421
|
-
]);
|
|
2422
|
-
$bx7SL$useEffect(() => {
|
|
2423
|
-
return () => {
|
|
2424
|
-
if (!allowTextSelectionOnPress)
|
|
2425
|
-
$14c0b72509d70225$export$b0d6fa1ab32e3295(ref.current.target);
|
|
2426
|
-
};
|
|
2427
|
-
}, [
|
|
2428
|
-
allowTextSelectionOnPress
|
|
2429
|
-
]);
|
|
2430
|
-
return {
|
|
2431
|
-
isPressed: isPressedProp || isPressed,
|
|
2432
|
-
pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, pressProps1)
|
|
2433
|
-
};
|
|
2434
|
-
}
|
|
2435
|
-
function $f6c31cce2adf654f$var$isHTMLAnchorLink(target) {
|
|
2436
|
-
return target.tagName === "A" && target.hasAttribute("href");
|
|
2437
|
-
}
|
|
2438
|
-
function $f6c31cce2adf654f$var$isValidKeyboardEvent(event, currentTarget) {
|
|
2439
|
-
const { key, code } = event;
|
|
2440
|
-
const element = currentTarget;
|
|
2441
|
-
const role = element.getAttribute("role");
|
|
2442
|
-
return (key === "Enter" || key === " " || key === "Spacebar" || code === "Space") && !(element instanceof HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey(element, key) || element instanceof HTMLTextAreaElement || element.isContentEditable) && (!$f6c31cce2adf654f$var$isHTMLAnchorLink(element) || role === "button" && key !== "Enter") && !(role === "link" && key !== "Enter");
|
|
2443
|
-
}
|
|
2444
|
-
function $f6c31cce2adf654f$var$getTouchFromEvent(event) {
|
|
2445
|
-
const { targetTouches } = event;
|
|
2446
|
-
if (targetTouches.length > 0)
|
|
2447
|
-
return targetTouches[0];
|
|
2448
|
-
return null;
|
|
2449
|
-
}
|
|
2450
|
-
function $f6c31cce2adf654f$var$getTouchById(event, pointerId) {
|
|
2451
|
-
const changedTouches = event.changedTouches;
|
|
2452
|
-
for (let i = 0; i < changedTouches.length; i++) {
|
|
2453
|
-
const touch = changedTouches[i];
|
|
2454
|
-
if (touch.identifier === pointerId)
|
|
2455
|
-
return touch;
|
|
2456
|
-
}
|
|
2457
|
-
return null;
|
|
2458
|
-
}
|
|
2459
|
-
function $f6c31cce2adf654f$var$createEvent(target, e) {
|
|
2460
|
-
return {
|
|
2461
|
-
currentTarget: target,
|
|
2462
|
-
shiftKey: e.shiftKey,
|
|
2463
|
-
ctrlKey: e.ctrlKey,
|
|
2464
|
-
metaKey: e.metaKey,
|
|
2465
|
-
altKey: e.altKey
|
|
2466
|
-
};
|
|
2467
|
-
}
|
|
2468
|
-
function $f6c31cce2adf654f$var$getPointClientRect(point) {
|
|
2469
|
-
let offsetX = point.width / 2 || point.radiusX || 0;
|
|
2470
|
-
let offsetY = point.height / 2 || point.radiusY || 0;
|
|
2471
|
-
return {
|
|
2472
|
-
top: point.clientY - offsetY,
|
|
2473
|
-
right: point.clientX + offsetX,
|
|
2474
|
-
bottom: point.clientY + offsetY,
|
|
2475
|
-
left: point.clientX - offsetX
|
|
2476
|
-
};
|
|
2477
|
-
}
|
|
2478
|
-
function $f6c31cce2adf654f$var$areRectanglesOverlapping(a, b) {
|
|
2479
|
-
if (a.left > b.right || b.left > a.right)
|
|
2480
|
-
return false;
|
|
2481
|
-
if (a.top > b.bottom || b.top > a.bottom)
|
|
2482
|
-
return false;
|
|
2483
|
-
return true;
|
|
2484
|
-
}
|
|
2485
|
-
function $f6c31cce2adf654f$var$isOverTarget(point, target) {
|
|
2486
|
-
let rect = target.getBoundingClientRect();
|
|
2487
|
-
let pointRect = $f6c31cce2adf654f$var$getPointClientRect(point);
|
|
2488
|
-
return $f6c31cce2adf654f$var$areRectanglesOverlapping(rect, pointRect);
|
|
2489
|
-
}
|
|
2490
|
-
function $f6c31cce2adf654f$var$shouldPreventDefault(target) {
|
|
2491
|
-
return !(target instanceof HTMLElement) || !target.draggable;
|
|
2492
|
-
}
|
|
2493
|
-
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(target, key) {
|
|
2494
|
-
if (target instanceof HTMLInputElement)
|
|
2495
|
-
return !$f6c31cce2adf654f$var$isValidInputKey(target, key);
|
|
2496
|
-
if (target instanceof HTMLButtonElement)
|
|
2497
|
-
return target.type !== "submit";
|
|
2498
|
-
return true;
|
|
2499
|
-
}
|
|
2500
|
-
var $f6c31cce2adf654f$var$nonTextInputTypes = /* @__PURE__ */ new Set([
|
|
2501
|
-
"checkbox",
|
|
2502
|
-
"radio",
|
|
2503
|
-
"range",
|
|
2504
|
-
"color",
|
|
2505
|
-
"file",
|
|
2506
|
-
"image",
|
|
2507
|
-
"button",
|
|
2508
|
-
"submit",
|
|
2509
|
-
"reset"
|
|
2510
|
-
]);
|
|
2511
|
-
function $f6c31cce2adf654f$var$isValidInputKey(target, key) {
|
|
2512
|
-
return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes.has(target.type);
|
|
2513
|
-
}
|
|
2514
|
-
var $8a9cb279dc87e130$export$905e7fc544a71f36 = class {
|
|
2515
|
-
isDefaultPrevented() {
|
|
2516
|
-
return this.nativeEvent.defaultPrevented;
|
|
2517
|
-
}
|
|
2518
|
-
preventDefault() {
|
|
2519
|
-
this.defaultPrevented = true;
|
|
2520
|
-
this.nativeEvent.preventDefault();
|
|
2521
|
-
}
|
|
2522
|
-
stopPropagation() {
|
|
2523
|
-
this.nativeEvent.stopPropagation();
|
|
2524
|
-
this.isPropagationStopped = () => true;
|
|
2525
|
-
}
|
|
2526
|
-
isPropagationStopped() {
|
|
2527
|
-
return false;
|
|
2528
|
-
}
|
|
2529
|
-
persist() {
|
|
2530
|
-
}
|
|
2531
|
-
constructor(type, nativeEvent) {
|
|
2532
|
-
this.nativeEvent = nativeEvent;
|
|
2533
|
-
this.target = nativeEvent.target;
|
|
2534
|
-
this.currentTarget = nativeEvent.currentTarget;
|
|
2535
|
-
this.relatedTarget = nativeEvent.relatedTarget;
|
|
2536
|
-
this.bubbles = nativeEvent.bubbles;
|
|
2537
|
-
this.cancelable = nativeEvent.cancelable;
|
|
2538
|
-
this.defaultPrevented = nativeEvent.defaultPrevented;
|
|
2539
|
-
this.eventPhase = nativeEvent.eventPhase;
|
|
2540
|
-
this.isTrusted = nativeEvent.isTrusted;
|
|
2541
|
-
this.timeStamp = nativeEvent.timeStamp;
|
|
2542
|
-
this.type = type;
|
|
2543
|
-
}
|
|
2544
|
-
};
|
|
2545
|
-
function $8a9cb279dc87e130$export$715c682d09d639cc(onBlur) {
|
|
2546
|
-
let stateRef = $bx7SL$useRef({
|
|
2547
|
-
isFocused: false,
|
|
2548
|
-
onBlur,
|
|
2549
|
-
observer: null
|
|
2550
|
-
});
|
|
2551
|
-
stateRef.current.onBlur = onBlur;
|
|
2552
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
2553
|
-
const state = stateRef.current;
|
|
2554
|
-
return () => {
|
|
2555
|
-
if (state.observer) {
|
|
2556
|
-
state.observer.disconnect();
|
|
2557
|
-
state.observer = null;
|
|
2558
|
-
}
|
|
2559
|
-
};
|
|
2560
|
-
}, []);
|
|
2561
|
-
return $bx7SL$useCallback((e1) => {
|
|
2562
|
-
if (e1.target instanceof HTMLButtonElement || e1.target instanceof HTMLInputElement || e1.target instanceof HTMLTextAreaElement || e1.target instanceof HTMLSelectElement) {
|
|
2563
|
-
stateRef.current.isFocused = true;
|
|
2564
|
-
let target = e1.target;
|
|
2565
|
-
let onBlurHandler = (e) => {
|
|
2566
|
-
var _current, ref;
|
|
2567
|
-
stateRef.current.isFocused = false;
|
|
2568
|
-
if (target.disabled)
|
|
2569
|
-
(ref = (_current = stateRef.current).onBlur) === null || ref === void 0 ? void 0 : ref.call(_current, new $8a9cb279dc87e130$export$905e7fc544a71f36("blur", e));
|
|
2570
|
-
if (stateRef.current.observer) {
|
|
2571
|
-
stateRef.current.observer.disconnect();
|
|
2572
|
-
stateRef.current.observer = null;
|
|
2573
|
-
}
|
|
2574
|
-
};
|
|
2575
|
-
target.addEventListener("focusout", onBlurHandler, {
|
|
2576
|
-
once: true
|
|
2577
|
-
});
|
|
2578
|
-
stateRef.current.observer = new MutationObserver(() => {
|
|
2579
|
-
if (stateRef.current.isFocused && target.disabled) {
|
|
2580
|
-
stateRef.current.observer.disconnect();
|
|
2581
|
-
target.dispatchEvent(new FocusEvent("blur"));
|
|
2582
|
-
target.dispatchEvent(new FocusEvent("focusout", {
|
|
2583
|
-
bubbles: true
|
|
2584
|
-
}));
|
|
2585
|
-
}
|
|
2586
|
-
});
|
|
2587
|
-
stateRef.current.observer.observe(target, {
|
|
2588
|
-
attributes: true,
|
|
2589
|
-
attributeFilter: [
|
|
2590
|
-
"disabled"
|
|
2591
|
-
]
|
|
2592
|
-
});
|
|
2593
|
-
}
|
|
2594
|
-
}, []);
|
|
2595
|
-
}
|
|
2596
|
-
var $507fabe10e71c6fb$var$currentModality = null;
|
|
2597
|
-
var $507fabe10e71c6fb$var$changeHandlers = /* @__PURE__ */ new Set();
|
|
2598
|
-
var $507fabe10e71c6fb$var$hasSetupGlobalListeners = false;
|
|
2599
|
-
var $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
|
2600
|
-
var $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
|
|
2601
|
-
function $507fabe10e71c6fb$var$triggerChangeHandlers(modality, e) {
|
|
2602
|
-
for (let handler of $507fabe10e71c6fb$var$changeHandlers)
|
|
2603
|
-
handler(modality, e);
|
|
2604
|
-
}
|
|
2605
|
-
function $507fabe10e71c6fb$var$isValidKey(e) {
|
|
2606
|
-
return !(e.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
|
|
2607
|
-
}
|
|
2608
|
-
function $507fabe10e71c6fb$var$handleKeyboardEvent(e) {
|
|
2609
|
-
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
|
2610
|
-
if ($507fabe10e71c6fb$var$isValidKey(e)) {
|
|
2611
|
-
$507fabe10e71c6fb$var$currentModality = "keyboard";
|
|
2612
|
-
$507fabe10e71c6fb$var$triggerChangeHandlers("keyboard", e);
|
|
2613
|
-
}
|
|
2614
|
-
}
|
|
2615
|
-
function $507fabe10e71c6fb$var$handlePointerEvent(e) {
|
|
2616
|
-
$507fabe10e71c6fb$var$currentModality = "pointer";
|
|
2617
|
-
if (e.type === "mousedown" || e.type === "pointerdown") {
|
|
2618
|
-
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
|
2619
|
-
$507fabe10e71c6fb$var$triggerChangeHandlers("pointer", e);
|
|
2620
|
-
}
|
|
2621
|
-
}
|
|
2622
|
-
function $507fabe10e71c6fb$var$handleClickEvent(e) {
|
|
2623
|
-
if ($6a7db85432448f7f$export$60278871457622de(e)) {
|
|
2624
|
-
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
|
2625
|
-
$507fabe10e71c6fb$var$currentModality = "virtual";
|
|
2626
|
-
}
|
|
2627
|
-
}
|
|
2628
|
-
function $507fabe10e71c6fb$var$handleFocusEvent(e) {
|
|
2629
|
-
if (e.target === window || e.target === document)
|
|
2630
|
-
return;
|
|
2631
|
-
if (!$507fabe10e71c6fb$var$hasEventBeforeFocus && !$507fabe10e71c6fb$var$hasBlurredWindowRecently) {
|
|
2632
|
-
$507fabe10e71c6fb$var$currentModality = "virtual";
|
|
2633
|
-
$507fabe10e71c6fb$var$triggerChangeHandlers("virtual", e);
|
|
2634
|
-
}
|
|
2635
|
-
$507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
|
2636
|
-
$507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
|
|
2637
|
-
}
|
|
2638
|
-
function $507fabe10e71c6fb$var$handleWindowBlur() {
|
|
2639
|
-
$507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
|
2640
|
-
$507fabe10e71c6fb$var$hasBlurredWindowRecently = true;
|
|
2641
|
-
}
|
|
2642
|
-
function $507fabe10e71c6fb$var$setupGlobalFocusEvents() {
|
|
2643
|
-
if (typeof window === "undefined" || $507fabe10e71c6fb$var$hasSetupGlobalListeners)
|
|
2644
|
-
return;
|
|
2645
|
-
let focus = HTMLElement.prototype.focus;
|
|
2646
|
-
HTMLElement.prototype.focus = function() {
|
|
2647
|
-
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
|
2648
|
-
focus.apply(this, arguments);
|
|
2649
|
-
};
|
|
2650
|
-
document.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
|
2651
|
-
document.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
|
2652
|
-
document.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, true);
|
|
2653
|
-
window.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, true);
|
|
2654
|
-
window.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, false);
|
|
2655
|
-
if (typeof PointerEvent !== "undefined") {
|
|
2656
|
-
document.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
2657
|
-
document.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
2658
|
-
document.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
2659
|
-
} else {
|
|
2660
|
-
document.addEventListener("mousedown", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
2661
|
-
document.addEventListener("mousemove", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
2662
|
-
document.addEventListener("mouseup", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
2663
|
-
}
|
|
2664
|
-
$507fabe10e71c6fb$var$hasSetupGlobalListeners = true;
|
|
2665
|
-
}
|
|
2666
|
-
if (typeof document !== "undefined") {
|
|
2667
|
-
if (document.readyState !== "loading")
|
|
2668
|
-
$507fabe10e71c6fb$var$setupGlobalFocusEvents();
|
|
2669
|
-
else
|
|
2670
|
-
document.addEventListener("DOMContentLoaded", $507fabe10e71c6fb$var$setupGlobalFocusEvents);
|
|
2671
|
-
}
|
|
2672
|
-
function $507fabe10e71c6fb$export$b9b3dfddab17db27() {
|
|
2673
|
-
return $507fabe10e71c6fb$var$currentModality !== "pointer";
|
|
2674
|
-
}
|
|
2675
|
-
function $9ab94262bd0047c7$export$420e68273165f4ec(props) {
|
|
2676
|
-
let { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
|
|
2677
|
-
let state = $bx7SL$useRef({
|
|
2678
|
-
isFocusWithin: false
|
|
2679
|
-
});
|
|
2680
|
-
let onBlur = $bx7SL$useCallback((e) => {
|
|
2681
|
-
if (state.current.isFocusWithin && !e.currentTarget.contains(e.relatedTarget)) {
|
|
2682
|
-
state.current.isFocusWithin = false;
|
|
2683
|
-
if (onBlurWithin)
|
|
2684
|
-
onBlurWithin(e);
|
|
2685
|
-
if (onFocusWithinChange)
|
|
2686
|
-
onFocusWithinChange(false);
|
|
2687
|
-
}
|
|
2688
|
-
}, [
|
|
2689
|
-
onBlurWithin,
|
|
2690
|
-
onFocusWithinChange,
|
|
2691
|
-
state
|
|
2692
|
-
]);
|
|
2693
|
-
let onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc(onBlur);
|
|
2694
|
-
let onFocus = $bx7SL$useCallback((e) => {
|
|
2695
|
-
if (!state.current.isFocusWithin) {
|
|
2696
|
-
if (onFocusWithin)
|
|
2697
|
-
onFocusWithin(e);
|
|
2698
|
-
if (onFocusWithinChange)
|
|
2699
|
-
onFocusWithinChange(true);
|
|
2700
|
-
state.current.isFocusWithin = true;
|
|
2701
|
-
onSyntheticFocus(e);
|
|
2702
|
-
}
|
|
2703
|
-
}, [
|
|
2704
|
-
onFocusWithin,
|
|
2705
|
-
onFocusWithinChange,
|
|
2706
|
-
onSyntheticFocus
|
|
2707
|
-
]);
|
|
2708
|
-
if (isDisabled)
|
|
2709
|
-
return {
|
|
2710
|
-
focusWithinProps: {
|
|
2711
|
-
onFocus: null,
|
|
2712
|
-
onBlur: null
|
|
2713
|
-
}
|
|
2714
|
-
};
|
|
2715
|
-
return {
|
|
2716
|
-
focusWithinProps: {
|
|
2717
|
-
onFocus,
|
|
2718
|
-
onBlur
|
|
2719
|
-
}
|
|
2720
|
-
};
|
|
2721
|
-
}
|
|
2722
|
-
var $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = false;
|
|
2723
|
-
var $6179b936705e76d3$var$hoverCount = 0;
|
|
2724
|
-
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents() {
|
|
2725
|
-
$6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = true;
|
|
2726
|
-
setTimeout(() => {
|
|
2727
|
-
$6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = false;
|
|
2728
|
-
}, 50);
|
|
2729
|
-
}
|
|
2730
|
-
function $6179b936705e76d3$var$handleGlobalPointerEvent(e) {
|
|
2731
|
-
if (e.pointerType === "touch")
|
|
2732
|
-
$6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents();
|
|
2733
|
-
}
|
|
2734
|
-
function $6179b936705e76d3$var$setupGlobalTouchEvents() {
|
|
2735
|
-
if (typeof document === "undefined")
|
|
2736
|
-
return;
|
|
2737
|
-
if (typeof PointerEvent !== "undefined")
|
|
2738
|
-
document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent);
|
|
2739
|
-
else
|
|
2740
|
-
document.addEventListener("touchend", $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents);
|
|
2741
|
-
$6179b936705e76d3$var$hoverCount++;
|
|
2742
|
-
return () => {
|
|
2743
|
-
$6179b936705e76d3$var$hoverCount--;
|
|
2744
|
-
if ($6179b936705e76d3$var$hoverCount > 0)
|
|
2745
|
-
return;
|
|
2746
|
-
if (typeof PointerEvent !== "undefined")
|
|
2747
|
-
document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent);
|
|
2748
|
-
else
|
|
2749
|
-
document.removeEventListener("touchend", $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents);
|
|
2750
|
-
};
|
|
2751
|
-
}
|
|
2752
|
-
function $6179b936705e76d3$export$ae780daf29e6d456(props) {
|
|
2753
|
-
let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
|
|
2754
|
-
let [isHovered, setHovered] = $bx7SL$useState(false);
|
|
2755
|
-
let state = $bx7SL$useRef({
|
|
2756
|
-
isHovered: false,
|
|
2757
|
-
ignoreEmulatedMouseEvents: false,
|
|
2758
|
-
pointerType: "",
|
|
2759
|
-
target: null
|
|
2760
|
-
}).current;
|
|
2761
|
-
$bx7SL$useEffect($6179b936705e76d3$var$setupGlobalTouchEvents, []);
|
|
2762
|
-
let { hoverProps: hoverProps1, triggerHoverEnd: triggerHoverEnd1 } = $bx7SL$useMemo(() => {
|
|
2763
|
-
let triggerHoverStart = (event, pointerType) => {
|
|
2764
|
-
state.pointerType = pointerType;
|
|
2765
|
-
if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
|
|
2766
|
-
return;
|
|
2767
|
-
state.isHovered = true;
|
|
2768
|
-
let target = event.currentTarget;
|
|
2769
|
-
state.target = target;
|
|
2770
|
-
if (onHoverStart)
|
|
2771
|
-
onHoverStart({
|
|
2772
|
-
type: "hoverstart",
|
|
2773
|
-
target,
|
|
2774
|
-
pointerType
|
|
2775
|
-
});
|
|
2776
|
-
if (onHoverChange)
|
|
2777
|
-
onHoverChange(true);
|
|
2778
|
-
setHovered(true);
|
|
2779
|
-
};
|
|
2780
|
-
let triggerHoverEnd = (event, pointerType) => {
|
|
2781
|
-
state.pointerType = "";
|
|
2782
|
-
state.target = null;
|
|
2783
|
-
if (pointerType === "touch" || !state.isHovered)
|
|
2784
|
-
return;
|
|
2785
|
-
state.isHovered = false;
|
|
2786
|
-
let target = event.currentTarget;
|
|
2787
|
-
if (onHoverEnd)
|
|
2788
|
-
onHoverEnd({
|
|
2789
|
-
type: "hoverend",
|
|
2790
|
-
target,
|
|
2791
|
-
pointerType
|
|
2792
|
-
});
|
|
2793
|
-
if (onHoverChange)
|
|
2794
|
-
onHoverChange(false);
|
|
2795
|
-
setHovered(false);
|
|
2796
|
-
};
|
|
2797
|
-
let hoverProps = {};
|
|
2798
|
-
if (typeof PointerEvent !== "undefined") {
|
|
2799
|
-
hoverProps.onPointerEnter = (e) => {
|
|
2800
|
-
if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents && e.pointerType === "mouse")
|
|
2801
|
-
return;
|
|
2802
|
-
triggerHoverStart(e, e.pointerType);
|
|
2803
|
-
};
|
|
2804
|
-
hoverProps.onPointerLeave = (e) => {
|
|
2805
|
-
if (!isDisabled && e.currentTarget.contains(e.target))
|
|
2806
|
-
triggerHoverEnd(e, e.pointerType);
|
|
2807
|
-
};
|
|
2808
|
-
} else {
|
|
2809
|
-
hoverProps.onTouchStart = () => {
|
|
2810
|
-
state.ignoreEmulatedMouseEvents = true;
|
|
2811
|
-
};
|
|
2812
|
-
hoverProps.onMouseEnter = (e) => {
|
|
2813
|
-
if (!state.ignoreEmulatedMouseEvents && !$6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents)
|
|
2814
|
-
triggerHoverStart(e, "mouse");
|
|
2815
|
-
state.ignoreEmulatedMouseEvents = false;
|
|
2816
|
-
};
|
|
2817
|
-
hoverProps.onMouseLeave = (e) => {
|
|
2818
|
-
if (!isDisabled && e.currentTarget.contains(e.target))
|
|
2819
|
-
triggerHoverEnd(e, "mouse");
|
|
2820
|
-
};
|
|
2821
|
-
}
|
|
2822
|
-
return {
|
|
2823
|
-
hoverProps,
|
|
2824
|
-
triggerHoverEnd
|
|
2825
|
-
};
|
|
2826
|
-
}, [
|
|
2827
|
-
onHoverStart,
|
|
2828
|
-
onHoverChange,
|
|
2829
|
-
onHoverEnd,
|
|
2830
|
-
isDisabled,
|
|
2831
|
-
state
|
|
2832
|
-
]);
|
|
2833
|
-
$bx7SL$useEffect(() => {
|
|
2834
|
-
if (isDisabled)
|
|
2835
|
-
triggerHoverEnd1({
|
|
2836
|
-
currentTarget: state.target
|
|
2837
|
-
}, state.pointerType);
|
|
2838
|
-
}, [
|
|
2839
|
-
isDisabled
|
|
2840
|
-
]);
|
|
2841
|
-
return {
|
|
2842
|
-
hoverProps: hoverProps1,
|
|
2843
|
-
isHovered
|
|
2844
|
-
};
|
|
2845
|
-
}
|
|
2846
|
-
var $8a26561d2877236e$var$DEFAULT_THRESHOLD = 500;
|
|
2847
|
-
function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
|
|
2848
|
-
let { isDisabled, onLongPressStart, onLongPressEnd, onLongPress, threshold = $8a26561d2877236e$var$DEFAULT_THRESHOLD, accessibilityDescription } = props;
|
|
2849
|
-
const timeRef = $bx7SL$useRef(null);
|
|
2850
|
-
let { addGlobalListener, removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6();
|
|
2851
|
-
let { pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21({
|
|
2852
|
-
isDisabled,
|
|
2853
|
-
onPressStart(e1) {
|
|
2854
|
-
if (e1.pointerType === "mouse" || e1.pointerType === "touch") {
|
|
2855
|
-
if (onLongPressStart)
|
|
2856
|
-
onLongPressStart({
|
|
2857
|
-
...e1,
|
|
2858
|
-
type: "longpressstart"
|
|
2859
|
-
});
|
|
2860
|
-
timeRef.current = setTimeout(() => {
|
|
2861
|
-
e1.target.dispatchEvent(new PointerEvent("pointercancel", {
|
|
2862
|
-
bubbles: true
|
|
2863
|
-
}));
|
|
2864
|
-
if (onLongPress)
|
|
2865
|
-
onLongPress({
|
|
2866
|
-
...e1,
|
|
2867
|
-
type: "longpress"
|
|
2868
|
-
});
|
|
2869
|
-
timeRef.current = null;
|
|
2870
|
-
}, threshold);
|
|
2871
|
-
if (e1.pointerType === "touch") {
|
|
2872
|
-
let onContextMenu = (e) => {
|
|
2873
|
-
e.preventDefault();
|
|
2874
|
-
};
|
|
2875
|
-
addGlobalListener(e1.target, "contextmenu", onContextMenu, {
|
|
2876
|
-
once: true
|
|
2877
|
-
});
|
|
2878
|
-
addGlobalListener(window, "pointerup", () => {
|
|
2879
|
-
setTimeout(() => {
|
|
2880
|
-
removeGlobalListener(e1.target, "contextmenu", onContextMenu);
|
|
2881
|
-
}, 30);
|
|
2882
|
-
}, {
|
|
2883
|
-
once: true
|
|
2884
|
-
});
|
|
2885
|
-
}
|
|
2886
|
-
}
|
|
2887
|
-
},
|
|
2888
|
-
onPressEnd(e) {
|
|
2889
|
-
if (timeRef.current)
|
|
2890
|
-
clearTimeout(timeRef.current);
|
|
2891
|
-
if (onLongPressEnd && (e.pointerType === "mouse" || e.pointerType === "touch"))
|
|
2892
|
-
onLongPressEnd({
|
|
2893
|
-
...e,
|
|
2894
|
-
type: "longpressend"
|
|
2895
|
-
});
|
|
2896
|
-
}
|
|
2897
|
-
});
|
|
2898
|
-
let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(onLongPress && !isDisabled ? accessibilityDescription : null);
|
|
2899
|
-
return {
|
|
2900
|
-
longPressProps: $3ef42575df84b30b$export$9d1611c77c2fe928(pressProps, descriptionProps)
|
|
2901
|
-
};
|
|
2902
|
-
}
|
|
2903
|
-
|
|
2904
|
-
// ../../node_modules/@react-aria/label/dist/module.js
|
|
2905
|
-
function $d191a55c9702f145$export$8467354a121f1b9f(props) {
|
|
2906
|
-
let { id, label, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, labelElementType = "label" } = props;
|
|
2907
|
-
id = $bdb11010cef70236$export$f680877a34711e37(id);
|
|
2908
|
-
let labelId = $bdb11010cef70236$export$f680877a34711e37();
|
|
2909
|
-
let labelProps = {};
|
|
2910
|
-
if (label) {
|
|
2911
|
-
ariaLabelledby = ariaLabelledby ? `${ariaLabelledby} ${labelId}` : labelId;
|
|
2912
|
-
labelProps = {
|
|
2913
|
-
id: labelId,
|
|
2914
|
-
htmlFor: labelElementType === "label" ? id : void 0
|
|
2915
|
-
};
|
|
2916
|
-
} else if (!ariaLabelledby && !ariaLabel)
|
|
2917
|
-
console.warn("If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility");
|
|
2918
|
-
let fieldProps = $313b98861ee5dd6c$export$d6875122194c7b44({
|
|
2919
|
-
id,
|
|
2920
|
-
"aria-label": ariaLabel,
|
|
2921
|
-
"aria-labelledby": ariaLabelledby
|
|
2922
|
-
});
|
|
2923
|
-
return {
|
|
2924
|
-
labelProps,
|
|
2925
|
-
fieldProps
|
|
2926
|
-
};
|
|
2927
|
-
}
|
|
2928
|
-
|
|
2929
|
-
// ../../node_modules/@react-aria/selection/dist/module.js
|
|
2930
|
-
import { useRef as $eCAIO$useRef, useEffect as $eCAIO$useEffect, useMemo as $eCAIO$useMemo } from "react";
|
|
2931
|
-
import { getFocusableTreeWalker as $eCAIO$getFocusableTreeWalker, focusSafely as $eCAIO$focusSafely } from "@react-aria/focus";
|
|
2932
|
-
|
|
2933
|
-
// ../../node_modules/@react-aria/i18n/dist/real-module.js
|
|
2934
|
-
import $iFADg$react, { useContext as $iFADg$useContext, useState as $iFADg$useState, useEffect as $iFADg$useEffect, useMemo as $iFADg$useMemo, useRef as $iFADg$useRef } from "react";
|
|
2935
|
-
import { useIsSSR as $iFADg$useIsSSR } from "@react-aria/ssr";
|
|
2936
|
-
var $148a7a147e38ea7f$var$RTL_SCRIPTS = /* @__PURE__ */ new Set([
|
|
2937
|
-
"Arab",
|
|
2938
|
-
"Syrc",
|
|
2939
|
-
"Samr",
|
|
2940
|
-
"Mand",
|
|
2941
|
-
"Thaa",
|
|
2942
|
-
"Mend",
|
|
2943
|
-
"Nkoo",
|
|
2944
|
-
"Adlm",
|
|
2945
|
-
"Rohg",
|
|
2946
|
-
"Hebr"
|
|
2947
|
-
]);
|
|
2948
|
-
var $148a7a147e38ea7f$var$RTL_LANGS = /* @__PURE__ */ new Set([
|
|
2949
|
-
"ae",
|
|
2950
|
-
"ar",
|
|
2951
|
-
"arc",
|
|
2952
|
-
"bcc",
|
|
2953
|
-
"bqi",
|
|
2954
|
-
"ckb",
|
|
2955
|
-
"dv",
|
|
2956
|
-
"fa",
|
|
2957
|
-
"glk",
|
|
2958
|
-
"he",
|
|
2959
|
-
"ku",
|
|
2960
|
-
"mzn",
|
|
2961
|
-
"nqo",
|
|
2962
|
-
"pnb",
|
|
2963
|
-
"ps",
|
|
2964
|
-
"sd",
|
|
2965
|
-
"ug",
|
|
2966
|
-
"ur",
|
|
2967
|
-
"yi"
|
|
2968
|
-
]);
|
|
2969
|
-
function $148a7a147e38ea7f$export$702d680b21cbd764(locale) {
|
|
2970
|
-
if (Intl.Locale) {
|
|
2971
|
-
let script = new Intl.Locale(locale).maximize().script;
|
|
2972
|
-
return $148a7a147e38ea7f$var$RTL_SCRIPTS.has(script);
|
|
2973
|
-
}
|
|
2974
|
-
let lang = locale.split("-")[0];
|
|
2975
|
-
return $148a7a147e38ea7f$var$RTL_LANGS.has(lang);
|
|
2976
|
-
}
|
|
2977
|
-
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5() {
|
|
2978
|
-
let locale = typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
|
|
2979
|
-
try {
|
|
2980
|
-
Intl.DateTimeFormat.supportedLocalesOf([
|
|
2981
|
-
locale
|
|
2982
|
-
]);
|
|
2983
|
-
} catch (_err) {
|
|
2984
|
-
locale = "en-US";
|
|
2985
|
-
}
|
|
2986
|
-
return {
|
|
2987
|
-
locale,
|
|
2988
|
-
direction: $148a7a147e38ea7f$export$702d680b21cbd764(locale) ? "rtl" : "ltr"
|
|
2989
|
-
};
|
|
2990
|
-
}
|
|
2991
|
-
var $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
|
|
2992
|
-
var $1e5a04cdaf7d1af8$var$listeners = /* @__PURE__ */ new Set();
|
|
2993
|
-
function $1e5a04cdaf7d1af8$var$updateLocale() {
|
|
2994
|
-
$1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
|
|
2995
|
-
for (let listener of $1e5a04cdaf7d1af8$var$listeners)
|
|
2996
|
-
listener($1e5a04cdaf7d1af8$var$currentLocale);
|
|
2997
|
-
}
|
|
2998
|
-
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a() {
|
|
2999
|
-
let isSSR = $iFADg$useIsSSR();
|
|
3000
|
-
let [defaultLocale, setDefaultLocale] = $iFADg$useState($1e5a04cdaf7d1af8$var$currentLocale);
|
|
3001
|
-
$iFADg$useEffect(() => {
|
|
3002
|
-
if ($1e5a04cdaf7d1af8$var$listeners.size === 0)
|
|
3003
|
-
window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
|
|
3004
|
-
$1e5a04cdaf7d1af8$var$listeners.add(setDefaultLocale);
|
|
3005
|
-
return () => {
|
|
3006
|
-
$1e5a04cdaf7d1af8$var$listeners.delete(setDefaultLocale);
|
|
3007
|
-
if ($1e5a04cdaf7d1af8$var$listeners.size === 0)
|
|
3008
|
-
window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
|
|
3009
|
-
};
|
|
3010
|
-
}, []);
|
|
3011
|
-
if (isSSR)
|
|
3012
|
-
return {
|
|
3013
|
-
locale: "en-US",
|
|
3014
|
-
direction: "ltr"
|
|
3015
|
-
};
|
|
3016
|
-
return defaultLocale;
|
|
3017
|
-
}
|
|
3018
|
-
var $18f2051aff69b9bf$var$I18nContext = /* @__PURE__ */ $iFADg$react.createContext(null);
|
|
3019
|
-
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7() {
|
|
3020
|
-
let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a();
|
|
3021
|
-
let context = $iFADg$useContext($18f2051aff69b9bf$var$I18nContext);
|
|
3022
|
-
return context || defaultLocale;
|
|
3023
|
-
}
|
|
3024
|
-
var $325a3faab7a68acd$var$cache = /* @__PURE__ */ new Map();
|
|
3025
|
-
function $325a3faab7a68acd$export$a16aca283550c30d(options) {
|
|
3026
|
-
let { locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
|
|
3027
|
-
let cacheKey = locale + (options ? Object.entries(options).sort(
|
|
3028
|
-
(a, b) => a[0] < b[0] ? -1 : 1
|
|
3029
|
-
).join() : "");
|
|
3030
|
-
if ($325a3faab7a68acd$var$cache.has(cacheKey))
|
|
3031
|
-
return $325a3faab7a68acd$var$cache.get(cacheKey);
|
|
3032
|
-
let formatter = new Intl.Collator(locale, options);
|
|
3033
|
-
$325a3faab7a68acd$var$cache.set(cacheKey, formatter);
|
|
3034
|
-
return formatter;
|
|
3035
|
-
}
|
|
3036
|
-
|
|
3037
|
-
// ../../node_modules/@react-aria/selection/dist/module.js
|
|
3038
|
-
function $feb5ffebff200149$export$d3e3bd3e26688c04(e) {
|
|
3039
|
-
return $c87311424ea30a05$export$e1865c3bedcd822b() ? e.altKey : e.ctrlKey;
|
|
3040
|
-
}
|
|
3041
|
-
function $feb5ffebff200149$export$16792effe837dba3(e) {
|
|
3042
|
-
if ($c87311424ea30a05$export$9ac100e40613ea10())
|
|
3043
|
-
return e.metaKey;
|
|
3044
|
-
return e.ctrlKey;
|
|
3045
|
-
}
|
|
3046
|
-
var $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS = 1e3;
|
|
3047
|
-
function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
|
|
3048
|
-
let { keyboardDelegate, selectionManager, onTypeSelect } = options;
|
|
3049
|
-
let state = $eCAIO$useRef({
|
|
3050
|
-
search: "",
|
|
3051
|
-
timeout: null
|
|
3052
|
-
}).current;
|
|
3053
|
-
let onKeyDown = (e) => {
|
|
3054
|
-
let character = $fb3050f43d946246$var$getStringForKey(e.key);
|
|
3055
|
-
if (!character || e.ctrlKey || e.metaKey)
|
|
3056
|
-
return;
|
|
3057
|
-
if (character === " " && state.search.trim().length > 0) {
|
|
3058
|
-
e.preventDefault();
|
|
3059
|
-
if (!("continuePropagation" in e))
|
|
3060
|
-
e.stopPropagation();
|
|
3061
|
-
}
|
|
3062
|
-
state.search += character;
|
|
3063
|
-
let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);
|
|
3064
|
-
if (key == null)
|
|
3065
|
-
key = keyboardDelegate.getKeyForSearch(state.search);
|
|
3066
|
-
if (key != null) {
|
|
3067
|
-
selectionManager.setFocusedKey(key);
|
|
3068
|
-
if (onTypeSelect)
|
|
3069
|
-
onTypeSelect(key);
|
|
3070
|
-
}
|
|
3071
|
-
clearTimeout(state.timeout);
|
|
3072
|
-
state.timeout = setTimeout(() => {
|
|
3073
|
-
state.search = "";
|
|
3074
|
-
}, $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS);
|
|
3075
|
-
};
|
|
3076
|
-
return {
|
|
3077
|
-
typeSelectProps: {
|
|
3078
|
-
onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : null
|
|
3079
|
-
}
|
|
3080
|
-
};
|
|
3081
|
-
}
|
|
3082
|
-
function $fb3050f43d946246$var$getStringForKey(key) {
|
|
3083
|
-
if (key.length === 1 || !/^[A-Z]/i.test(key))
|
|
3084
|
-
return key;
|
|
3085
|
-
return "";
|
|
3086
|
-
}
|
|
3087
|
-
function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
3088
|
-
let { selectionManager: manager, keyboardDelegate: delegate, ref, autoFocus = false, shouldFocusWrap = false, disallowEmptySelection = false, disallowSelectAll = false, selectOnFocus = manager.selectionBehavior === "replace", disallowTypeAhead = false, shouldUseVirtualFocus, allowsTabNavigation = false, isVirtualized, scrollRef = ref } = options;
|
|
3089
|
-
let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
|
|
3090
|
-
let onKeyDown = (e) => {
|
|
3091
|
-
if (e.altKey && e.key === "Tab")
|
|
3092
|
-
e.preventDefault();
|
|
3093
|
-
if (!ref.current.contains(e.target))
|
|
3094
|
-
return;
|
|
3095
|
-
const navigateToKey = (key, childFocus) => {
|
|
3096
|
-
if (key != null) {
|
|
3097
|
-
manager.setFocusedKey(key, childFocus);
|
|
3098
|
-
if (e.shiftKey && manager.selectionMode === "multiple")
|
|
3099
|
-
manager.extendSelection(key);
|
|
3100
|
-
else if (selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04(e))
|
|
3101
|
-
manager.replaceSelection(key);
|
|
3102
|
-
}
|
|
3103
|
-
};
|
|
3104
|
-
switch (e.key) {
|
|
3105
|
-
case "ArrowDown":
|
|
3106
|
-
if (delegate.getKeyBelow) {
|
|
3107
|
-
var ref4, ref1;
|
|
3108
|
-
e.preventDefault();
|
|
3109
|
-
let nextKey = manager.focusedKey != null ? delegate.getKeyBelow(manager.focusedKey) : (ref4 = delegate.getFirstKey) === null || ref4 === void 0 ? void 0 : ref4.call(delegate);
|
|
3110
|
-
if (nextKey == null && shouldFocusWrap)
|
|
3111
|
-
nextKey = (ref1 = delegate.getFirstKey) === null || ref1 === void 0 ? void 0 : ref1.call(delegate, manager.focusedKey);
|
|
3112
|
-
navigateToKey(nextKey);
|
|
3113
|
-
}
|
|
3114
|
-
break;
|
|
3115
|
-
case "ArrowUp":
|
|
3116
|
-
if (delegate.getKeyAbove) {
|
|
3117
|
-
var ref2, ref3;
|
|
3118
|
-
e.preventDefault();
|
|
3119
|
-
let nextKey = manager.focusedKey != null ? delegate.getKeyAbove(manager.focusedKey) : (ref2 = delegate.getLastKey) === null || ref2 === void 0 ? void 0 : ref2.call(delegate);
|
|
3120
|
-
if (nextKey == null && shouldFocusWrap)
|
|
3121
|
-
nextKey = (ref3 = delegate.getLastKey) === null || ref3 === void 0 ? void 0 : ref3.call(delegate, manager.focusedKey);
|
|
3122
|
-
navigateToKey(nextKey);
|
|
3123
|
-
}
|
|
3124
|
-
break;
|
|
3125
|
-
case "ArrowLeft":
|
|
3126
|
-
if (delegate.getKeyLeftOf) {
|
|
3127
|
-
e.preventDefault();
|
|
3128
|
-
let nextKey = delegate.getKeyLeftOf(manager.focusedKey);
|
|
3129
|
-
navigateToKey(nextKey, direction === "rtl" ? "first" : "last");
|
|
3130
|
-
}
|
|
3131
|
-
break;
|
|
3132
|
-
case "ArrowRight":
|
|
3133
|
-
if (delegate.getKeyRightOf) {
|
|
3134
|
-
e.preventDefault();
|
|
3135
|
-
let nextKey = delegate.getKeyRightOf(manager.focusedKey);
|
|
3136
|
-
navigateToKey(nextKey, direction === "rtl" ? "last" : "first");
|
|
3137
|
-
}
|
|
3138
|
-
break;
|
|
3139
|
-
case "Home":
|
|
3140
|
-
if (delegate.getFirstKey) {
|
|
3141
|
-
e.preventDefault();
|
|
3142
|
-
let firstKey = delegate.getFirstKey(manager.focusedKey, $feb5ffebff200149$export$16792effe837dba3(e));
|
|
3143
|
-
manager.setFocusedKey(firstKey);
|
|
3144
|
-
if ($feb5ffebff200149$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple")
|
|
3145
|
-
manager.extendSelection(firstKey);
|
|
3146
|
-
else if (selectOnFocus)
|
|
3147
|
-
manager.replaceSelection(firstKey);
|
|
3148
|
-
}
|
|
3149
|
-
break;
|
|
3150
|
-
case "End":
|
|
3151
|
-
if (delegate.getLastKey) {
|
|
3152
|
-
e.preventDefault();
|
|
3153
|
-
let lastKey = delegate.getLastKey(manager.focusedKey, $feb5ffebff200149$export$16792effe837dba3(e));
|
|
3154
|
-
manager.setFocusedKey(lastKey);
|
|
3155
|
-
if ($feb5ffebff200149$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple")
|
|
3156
|
-
manager.extendSelection(lastKey);
|
|
3157
|
-
else if (selectOnFocus)
|
|
3158
|
-
manager.replaceSelection(lastKey);
|
|
3159
|
-
}
|
|
3160
|
-
break;
|
|
3161
|
-
case "PageDown":
|
|
3162
|
-
if (delegate.getKeyPageBelow) {
|
|
3163
|
-
e.preventDefault();
|
|
3164
|
-
let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
|
|
3165
|
-
navigateToKey(nextKey);
|
|
3166
|
-
}
|
|
3167
|
-
break;
|
|
3168
|
-
case "PageUp":
|
|
3169
|
-
if (delegate.getKeyPageAbove) {
|
|
3170
|
-
e.preventDefault();
|
|
3171
|
-
let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
|
|
3172
|
-
navigateToKey(nextKey);
|
|
3173
|
-
}
|
|
3174
|
-
break;
|
|
3175
|
-
case "a":
|
|
3176
|
-
if ($feb5ffebff200149$export$16792effe837dba3(e) && manager.selectionMode === "multiple" && disallowSelectAll !== true) {
|
|
3177
|
-
e.preventDefault();
|
|
3178
|
-
manager.selectAll();
|
|
3179
|
-
}
|
|
3180
|
-
break;
|
|
3181
|
-
case "Escape":
|
|
3182
|
-
e.preventDefault();
|
|
3183
|
-
if (!disallowEmptySelection)
|
|
3184
|
-
manager.clearSelection();
|
|
3185
|
-
break;
|
|
3186
|
-
case "Tab":
|
|
3187
|
-
if (!allowsTabNavigation) {
|
|
3188
|
-
if (e.shiftKey)
|
|
3189
|
-
ref.current.focus();
|
|
3190
|
-
else {
|
|
3191
|
-
let walker = $eCAIO$getFocusableTreeWalker(ref.current, {
|
|
3192
|
-
tabbable: true
|
|
3193
|
-
});
|
|
3194
|
-
let next;
|
|
3195
|
-
let last;
|
|
3196
|
-
do {
|
|
3197
|
-
last = walker.lastChild();
|
|
3198
|
-
if (last)
|
|
3199
|
-
next = last;
|
|
3200
|
-
} while (last);
|
|
3201
|
-
if (next && !next.contains(document.activeElement))
|
|
3202
|
-
$7215afc6de606d6b$export$de79e2c695e052f3(next);
|
|
3203
|
-
}
|
|
3204
|
-
break;
|
|
3205
|
-
}
|
|
3206
|
-
}
|
|
3207
|
-
};
|
|
3208
|
-
let scrollPos = $eCAIO$useRef({
|
|
3209
|
-
top: 0,
|
|
3210
|
-
left: 0
|
|
3211
|
-
});
|
|
3212
|
-
$e9faafb641e167db$export$90fc3a17d93f704c(scrollRef, "scroll", isVirtualized ? null : () => {
|
|
3213
|
-
scrollPos.current = {
|
|
3214
|
-
top: scrollRef.current.scrollTop,
|
|
3215
|
-
left: scrollRef.current.scrollLeft
|
|
3216
|
-
};
|
|
3217
|
-
});
|
|
3218
|
-
let onFocus = (e) => {
|
|
3219
|
-
if (manager.isFocused) {
|
|
3220
|
-
if (!e.currentTarget.contains(e.target))
|
|
3221
|
-
manager.setFocused(false);
|
|
3222
|
-
return;
|
|
3223
|
-
}
|
|
3224
|
-
if (!e.currentTarget.contains(e.target))
|
|
3225
|
-
return;
|
|
3226
|
-
manager.setFocused(true);
|
|
3227
|
-
if (manager.focusedKey == null) {
|
|
3228
|
-
let navigateToFirstKey = (key) => {
|
|
3229
|
-
if (key != null) {
|
|
3230
|
-
manager.setFocusedKey(key);
|
|
3231
|
-
if (selectOnFocus)
|
|
3232
|
-
manager.replaceSelection(key);
|
|
3233
|
-
}
|
|
3234
|
-
};
|
|
3235
|
-
let relatedTarget = e.relatedTarget;
|
|
3236
|
-
var _lastSelectedKey, _firstSelectedKey;
|
|
3237
|
-
if (relatedTarget && e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING)
|
|
3238
|
-
navigateToFirstKey((_lastSelectedKey = manager.lastSelectedKey) !== null && _lastSelectedKey !== void 0 ? _lastSelectedKey : delegate.getLastKey());
|
|
3239
|
-
else
|
|
3240
|
-
navigateToFirstKey((_firstSelectedKey = manager.firstSelectedKey) !== null && _firstSelectedKey !== void 0 ? _firstSelectedKey : delegate.getFirstKey());
|
|
3241
|
-
} else if (!isVirtualized) {
|
|
3242
|
-
scrollRef.current.scrollTop = scrollPos.current.top;
|
|
3243
|
-
scrollRef.current.scrollLeft = scrollPos.current.left;
|
|
3244
|
-
let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`);
|
|
3245
|
-
if (element) {
|
|
3246
|
-
$7215afc6de606d6b$export$de79e2c695e052f3(element);
|
|
3247
|
-
$2f04cbc44ee30ce0$export$53a0910f038337bd(scrollRef.current, element);
|
|
3248
|
-
}
|
|
3249
|
-
}
|
|
3250
|
-
};
|
|
3251
|
-
let onBlur = (e) => {
|
|
3252
|
-
if (!e.currentTarget.contains(e.relatedTarget))
|
|
3253
|
-
manager.setFocused(false);
|
|
3254
|
-
};
|
|
3255
|
-
const autoFocusRef = $eCAIO$useRef(autoFocus);
|
|
3256
|
-
$eCAIO$useEffect(() => {
|
|
3257
|
-
if (autoFocusRef.current) {
|
|
3258
|
-
let focusedKey = null;
|
|
3259
|
-
if (autoFocus === "first")
|
|
3260
|
-
focusedKey = delegate.getFirstKey();
|
|
3261
|
-
if (autoFocus === "last")
|
|
3262
|
-
focusedKey = delegate.getLastKey();
|
|
3263
|
-
let selectedKeys = manager.selectedKeys;
|
|
3264
|
-
if (selectedKeys.size)
|
|
3265
|
-
focusedKey = selectedKeys.values().next().value;
|
|
3266
|
-
manager.setFocused(true);
|
|
3267
|
-
manager.setFocusedKey(focusedKey);
|
|
3268
|
-
if (focusedKey == null && !shouldUseVirtualFocus)
|
|
3269
|
-
$eCAIO$focusSafely(ref.current);
|
|
3270
|
-
}
|
|
3271
|
-
autoFocusRef.current = false;
|
|
3272
|
-
}, []);
|
|
3273
|
-
$eCAIO$useEffect(() => {
|
|
3274
|
-
if (!isVirtualized && manager.focusedKey && (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current)) {
|
|
3275
|
-
let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`);
|
|
3276
|
-
if (element)
|
|
3277
|
-
$2f04cbc44ee30ce0$export$53a0910f038337bd(scrollRef.current, element);
|
|
3278
|
-
}
|
|
3279
|
-
}, [
|
|
3280
|
-
isVirtualized,
|
|
3281
|
-
scrollRef,
|
|
3282
|
-
manager.focusedKey
|
|
3283
|
-
]);
|
|
3284
|
-
let handlers = {
|
|
3285
|
-
onKeyDown,
|
|
3286
|
-
onFocus,
|
|
3287
|
-
onBlur,
|
|
3288
|
-
onMouseDown(e) {
|
|
3289
|
-
if (scrollRef.current === e.target)
|
|
3290
|
-
e.preventDefault();
|
|
3291
|
-
}
|
|
3292
|
-
};
|
|
3293
|
-
let { typeSelectProps } = $fb3050f43d946246$export$e32c88dfddc6e1d8({
|
|
3294
|
-
keyboardDelegate: delegate,
|
|
3295
|
-
selectionManager: manager
|
|
3296
|
-
});
|
|
3297
|
-
if (!disallowTypeAhead)
|
|
3298
|
-
handlers = $3ef42575df84b30b$export$9d1611c77c2fe928(typeSelectProps, handlers);
|
|
3299
|
-
let tabIndex;
|
|
3300
|
-
if (!shouldUseVirtualFocus)
|
|
3301
|
-
tabIndex = manager.focusedKey == null ? 0 : -1;
|
|
3302
|
-
return {
|
|
3303
|
-
collectionProps: {
|
|
3304
|
-
...handlers,
|
|
3305
|
-
tabIndex
|
|
3306
|
-
}
|
|
3307
|
-
};
|
|
3308
|
-
}
|
|
3309
|
-
function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
3310
|
-
let { selectionManager: manager, key, ref, shouldSelectOnPressUp, isVirtualized, shouldUseVirtualFocus, focus, isDisabled, onAction, allowsDifferentPressOrigin } = options;
|
|
3311
|
-
let onSelect = (e) => {
|
|
3312
|
-
if (e.pointerType === "keyboard" && $feb5ffebff200149$export$d3e3bd3e26688c04(e))
|
|
3313
|
-
manager.toggleSelection(key);
|
|
3314
|
-
else {
|
|
3315
|
-
if (manager.selectionMode === "none")
|
|
3316
|
-
return;
|
|
3317
|
-
if (manager.selectionMode === "single") {
|
|
3318
|
-
if (manager.isSelected(key) && !manager.disallowEmptySelection)
|
|
3319
|
-
manager.toggleSelection(key);
|
|
3320
|
-
else
|
|
3321
|
-
manager.replaceSelection(key);
|
|
3322
|
-
} else if (e && e.shiftKey)
|
|
3323
|
-
manager.extendSelection(key);
|
|
3324
|
-
else if (manager.selectionBehavior === "toggle" || e && ($feb5ffebff200149$export$16792effe837dba3(e) || e.pointerType === "touch" || e.pointerType === "virtual"))
|
|
3325
|
-
manager.toggleSelection(key);
|
|
3326
|
-
else
|
|
3327
|
-
manager.replaceSelection(key);
|
|
3328
|
-
}
|
|
3329
|
-
};
|
|
3330
|
-
$eCAIO$useEffect(() => {
|
|
3331
|
-
let isFocused = key === manager.focusedKey;
|
|
3332
|
-
if (isFocused && manager.isFocused && !shouldUseVirtualFocus && document.activeElement !== ref.current) {
|
|
3333
|
-
if (focus)
|
|
3334
|
-
focus();
|
|
3335
|
-
else
|
|
3336
|
-
$eCAIO$focusSafely(ref.current);
|
|
3337
|
-
}
|
|
3338
|
-
}, [
|
|
3339
|
-
ref,
|
|
3340
|
-
key,
|
|
3341
|
-
manager.focusedKey,
|
|
3342
|
-
manager.childFocusStrategy,
|
|
3343
|
-
manager.isFocused,
|
|
3344
|
-
shouldUseVirtualFocus
|
|
3345
|
-
]);
|
|
3346
|
-
isDisabled = isDisabled || manager.isDisabled(key);
|
|
3347
|
-
let itemProps = {};
|
|
3348
|
-
if (!shouldUseVirtualFocus && !isDisabled)
|
|
3349
|
-
itemProps = {
|
|
3350
|
-
tabIndex: key === manager.focusedKey ? 0 : -1,
|
|
3351
|
-
onFocus(e) {
|
|
3352
|
-
if (e.target === ref.current)
|
|
3353
|
-
manager.setFocusedKey(key);
|
|
3354
|
-
}
|
|
3355
|
-
};
|
|
3356
|
-
else if (isDisabled)
|
|
3357
|
-
itemProps.onMouseDown = (e) => {
|
|
3358
|
-
e.preventDefault();
|
|
3359
|
-
};
|
|
3360
|
-
let allowsSelection = !isDisabled && manager.canSelectItem(key);
|
|
3361
|
-
let allowsActions = onAction && !isDisabled;
|
|
3362
|
-
let hasPrimaryAction = allowsActions && (manager.selectionBehavior === "replace" ? !allowsSelection : manager.isEmpty);
|
|
3363
|
-
let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === "replace";
|
|
3364
|
-
let hasAction = hasPrimaryAction || hasSecondaryAction;
|
|
3365
|
-
let modality = $eCAIO$useRef(null);
|
|
3366
|
-
let longPressEnabled = hasAction && allowsSelection;
|
|
3367
|
-
let longPressEnabledOnPressStart = $eCAIO$useRef(false);
|
|
3368
|
-
let hadPrimaryActionOnPressStart = $eCAIO$useRef(false);
|
|
3369
|
-
let itemPressProps = {};
|
|
3370
|
-
if (shouldSelectOnPressUp) {
|
|
3371
|
-
itemPressProps.onPressStart = (e) => {
|
|
3372
|
-
modality.current = e.pointerType;
|
|
3373
|
-
longPressEnabledOnPressStart.current = longPressEnabled;
|
|
3374
|
-
if (e.pointerType === "keyboard" && (!hasAction || $880e95eb8b93ba9a$var$isSelectionKey()))
|
|
3375
|
-
onSelect(e);
|
|
3376
|
-
};
|
|
3377
|
-
if (!allowsDifferentPressOrigin)
|
|
3378
|
-
itemPressProps.onPress = (e) => {
|
|
3379
|
-
if (hasPrimaryAction || hasSecondaryAction && e.pointerType !== "mouse") {
|
|
3380
|
-
if (e.pointerType === "keyboard" && !$880e95eb8b93ba9a$var$isActionKey())
|
|
3381
|
-
return;
|
|
3382
|
-
onAction();
|
|
3383
|
-
} else if (e.pointerType !== "keyboard")
|
|
3384
|
-
onSelect(e);
|
|
3385
|
-
};
|
|
3386
|
-
else {
|
|
3387
|
-
itemPressProps.onPressUp = (e) => {
|
|
3388
|
-
if (e.pointerType !== "keyboard")
|
|
3389
|
-
onSelect(e);
|
|
3390
|
-
};
|
|
3391
|
-
itemPressProps.onPress = hasPrimaryAction ? () => onAction() : null;
|
|
3392
|
-
}
|
|
3393
|
-
} else {
|
|
3394
|
-
itemPressProps.onPressStart = (e) => {
|
|
3395
|
-
modality.current = e.pointerType;
|
|
3396
|
-
longPressEnabledOnPressStart.current = longPressEnabled;
|
|
3397
|
-
hadPrimaryActionOnPressStart.current = hasPrimaryAction;
|
|
3398
|
-
if (e.pointerType === "mouse" && !hasPrimaryAction || e.pointerType === "keyboard" && (!onAction || $880e95eb8b93ba9a$var$isSelectionKey()))
|
|
3399
|
-
onSelect(e);
|
|
3400
|
-
};
|
|
3401
|
-
itemPressProps.onPress = (e) => {
|
|
3402
|
-
if (e.pointerType === "touch" || e.pointerType === "pen" || e.pointerType === "virtual" || e.pointerType === "keyboard" && hasAction && $880e95eb8b93ba9a$var$isActionKey() || e.pointerType === "mouse" && hadPrimaryActionOnPressStart.current) {
|
|
3403
|
-
if (hasAction)
|
|
3404
|
-
onAction();
|
|
3405
|
-
else
|
|
3406
|
-
onSelect(e);
|
|
3407
|
-
}
|
|
3408
|
-
};
|
|
3409
|
-
}
|
|
3410
|
-
if (!isVirtualized)
|
|
3411
|
-
itemProps["data-key"] = key;
|
|
3412
|
-
itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;
|
|
3413
|
-
let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21(itemPressProps);
|
|
3414
|
-
let onDoubleClick = hasSecondaryAction ? (e) => {
|
|
3415
|
-
if (modality.current === "mouse") {
|
|
3416
|
-
e.stopPropagation();
|
|
3417
|
-
e.preventDefault();
|
|
3418
|
-
onAction();
|
|
3419
|
-
}
|
|
3420
|
-
} : void 0;
|
|
3421
|
-
let { longPressProps } = $8a26561d2877236e$export$c24ed0104d07eab9({
|
|
3422
|
-
isDisabled: !longPressEnabled,
|
|
3423
|
-
onLongPress(e) {
|
|
3424
|
-
if (e.pointerType === "touch") {
|
|
3425
|
-
onSelect(e);
|
|
3426
|
-
manager.setSelectionBehavior("toggle");
|
|
3427
|
-
}
|
|
3428
|
-
}
|
|
3429
|
-
});
|
|
3430
|
-
let onDragStartCapture = (e) => {
|
|
3431
|
-
if (modality.current === "touch" && longPressEnabledOnPressStart.current)
|
|
3432
|
-
e.preventDefault();
|
|
3433
|
-
};
|
|
3434
|
-
return {
|
|
3435
|
-
itemProps: $3ef42575df84b30b$export$9d1611c77c2fe928(itemProps, allowsSelection || hasPrimaryAction ? pressProps : {}, longPressEnabled ? longPressProps : {}, {
|
|
3436
|
-
onDoubleClick,
|
|
3437
|
-
onDragStartCapture
|
|
3438
|
-
}),
|
|
3439
|
-
isPressed,
|
|
3440
|
-
isSelected: manager.isSelected(key),
|
|
3441
|
-
isDisabled,
|
|
3442
|
-
allowsSelection,
|
|
3443
|
-
hasAction
|
|
3444
|
-
};
|
|
3445
|
-
}
|
|
3446
|
-
function $880e95eb8b93ba9a$var$isActionKey() {
|
|
3447
|
-
let event = window.event;
|
|
3448
|
-
return (event === null || event === void 0 ? void 0 : event.key) === "Enter";
|
|
3449
|
-
}
|
|
3450
|
-
function $880e95eb8b93ba9a$var$isSelectionKey() {
|
|
3451
|
-
let event = window.event;
|
|
3452
|
-
return (event === null || event === void 0 ? void 0 : event.key) === " " || (event === null || event === void 0 ? void 0 : event.code) === "Space";
|
|
3453
|
-
}
|
|
3454
|
-
var $2a25aae57d74318e$export$a05409b8bb224a5a = class {
|
|
3455
|
-
getKeyBelow(key) {
|
|
3456
|
-
key = this.collection.getKeyAfter(key);
|
|
3457
|
-
while (key != null) {
|
|
3458
|
-
let item = this.collection.getItem(key);
|
|
3459
|
-
if (item.type === "item" && !this.disabledKeys.has(key))
|
|
3460
|
-
return key;
|
|
3461
|
-
key = this.collection.getKeyAfter(key);
|
|
3462
|
-
}
|
|
3463
|
-
}
|
|
3464
|
-
getKeyAbove(key) {
|
|
3465
|
-
key = this.collection.getKeyBefore(key);
|
|
3466
|
-
while (key != null) {
|
|
3467
|
-
let item = this.collection.getItem(key);
|
|
3468
|
-
if (item.type === "item" && !this.disabledKeys.has(key))
|
|
3469
|
-
return key;
|
|
3470
|
-
key = this.collection.getKeyBefore(key);
|
|
3471
|
-
}
|
|
3472
|
-
}
|
|
3473
|
-
getFirstKey() {
|
|
3474
|
-
let key = this.collection.getFirstKey();
|
|
3475
|
-
while (key != null) {
|
|
3476
|
-
let item = this.collection.getItem(key);
|
|
3477
|
-
if (item.type === "item" && !this.disabledKeys.has(key))
|
|
3478
|
-
return key;
|
|
3479
|
-
key = this.collection.getKeyAfter(key);
|
|
3480
|
-
}
|
|
3481
|
-
}
|
|
3482
|
-
getLastKey() {
|
|
3483
|
-
let key = this.collection.getLastKey();
|
|
3484
|
-
while (key != null) {
|
|
3485
|
-
let item = this.collection.getItem(key);
|
|
3486
|
-
if (item.type === "item" && !this.disabledKeys.has(key))
|
|
3487
|
-
return key;
|
|
3488
|
-
key = this.collection.getKeyBefore(key);
|
|
3489
|
-
}
|
|
3490
|
-
}
|
|
3491
|
-
getItem(key) {
|
|
3492
|
-
return this.ref.current.querySelector(`[data-key="${key}"]`);
|
|
3493
|
-
}
|
|
3494
|
-
getKeyPageAbove(key) {
|
|
3495
|
-
let menu = this.ref.current;
|
|
3496
|
-
let item = this.getItem(key);
|
|
3497
|
-
if (!item)
|
|
3498
|
-
return null;
|
|
3499
|
-
let pageY = Math.max(0, item.offsetTop + item.offsetHeight - menu.offsetHeight);
|
|
3500
|
-
while (item && item.offsetTop > pageY) {
|
|
3501
|
-
key = this.getKeyAbove(key);
|
|
3502
|
-
item = this.getItem(key);
|
|
3503
|
-
}
|
|
3504
|
-
return key;
|
|
3505
|
-
}
|
|
3506
|
-
getKeyPageBelow(key) {
|
|
3507
|
-
let menu = this.ref.current;
|
|
3508
|
-
let item = this.getItem(key);
|
|
3509
|
-
if (!item)
|
|
3510
|
-
return null;
|
|
3511
|
-
let pageY = Math.min(menu.scrollHeight, item.offsetTop - item.offsetHeight + menu.offsetHeight);
|
|
3512
|
-
while (item && item.offsetTop < pageY) {
|
|
3513
|
-
key = this.getKeyBelow(key);
|
|
3514
|
-
item = this.getItem(key);
|
|
3515
|
-
}
|
|
3516
|
-
return key;
|
|
3517
|
-
}
|
|
3518
|
-
getKeyForSearch(search, fromKey) {
|
|
3519
|
-
if (!this.collator)
|
|
3520
|
-
return null;
|
|
3521
|
-
let collection = this.collection;
|
|
3522
|
-
let key = fromKey || this.getFirstKey();
|
|
3523
|
-
while (key != null) {
|
|
3524
|
-
let item = collection.getItem(key);
|
|
3525
|
-
let substring = item.textValue.slice(0, search.length);
|
|
3526
|
-
if (item.textValue && this.collator.compare(substring, search) === 0)
|
|
3527
|
-
return key;
|
|
3528
|
-
key = this.getKeyBelow(key);
|
|
3529
|
-
}
|
|
3530
|
-
return null;
|
|
3531
|
-
}
|
|
3532
|
-
constructor(collection, disabledKeys, ref, collator) {
|
|
3533
|
-
this.collection = collection;
|
|
3534
|
-
this.disabledKeys = disabledKeys;
|
|
3535
|
-
this.ref = ref;
|
|
3536
|
-
this.collator = collator;
|
|
3537
|
-
}
|
|
3538
|
-
};
|
|
3539
|
-
function $982254629710d113$export$b95089534ab7c1fd(props) {
|
|
3540
|
-
let { selectionManager, collection, disabledKeys, ref, keyboardDelegate, autoFocus, shouldFocusWrap, isVirtualized, disallowEmptySelection, selectOnFocus = selectionManager.selectionBehavior === "replace", disallowTypeAhead, shouldUseVirtualFocus, allowsTabNavigation } = props;
|
|
3541
|
-
let collator = $325a3faab7a68acd$export$a16aca283550c30d({
|
|
3542
|
-
usage: "search",
|
|
3543
|
-
sensitivity: "base"
|
|
3544
|
-
});
|
|
3545
|
-
let disabledBehavior = selectionManager.disabledBehavior;
|
|
3546
|
-
let delegate = $eCAIO$useMemo(
|
|
3547
|
-
() => keyboardDelegate || new $2a25aae57d74318e$export$a05409b8bb224a5a(collection, disabledBehavior === "selection" ? /* @__PURE__ */ new Set() : disabledKeys, ref, collator),
|
|
3548
|
-
[
|
|
3549
|
-
keyboardDelegate,
|
|
3550
|
-
collection,
|
|
3551
|
-
disabledKeys,
|
|
3552
|
-
ref,
|
|
3553
|
-
collator,
|
|
3554
|
-
disabledBehavior
|
|
3555
|
-
]
|
|
3556
|
-
);
|
|
3557
|
-
let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c({
|
|
3558
|
-
ref,
|
|
3559
|
-
selectionManager,
|
|
3560
|
-
keyboardDelegate: delegate,
|
|
3561
|
-
autoFocus,
|
|
3562
|
-
shouldFocusWrap,
|
|
3563
|
-
disallowEmptySelection,
|
|
3564
|
-
selectOnFocus,
|
|
3565
|
-
disallowTypeAhead,
|
|
3566
|
-
shouldUseVirtualFocus,
|
|
3567
|
-
allowsTabNavigation,
|
|
3568
|
-
isVirtualized,
|
|
3569
|
-
scrollRef: ref
|
|
3570
|
-
});
|
|
3571
|
-
return {
|
|
3572
|
-
listProps: collectionProps
|
|
3573
|
-
};
|
|
3574
|
-
}
|
|
3575
|
-
|
|
3576
|
-
// ../../node_modules/@react-stately/collections/dist/module.js
|
|
3577
|
-
import $tyW6A$react, { useMemo as $tyW6A$useMemo, useRef as $tyW6A$useRef } from "react";
|
|
3578
|
-
function $c1d7fb2ec91bae71$var$Item(props) {
|
|
3579
|
-
return null;
|
|
3580
|
-
}
|
|
3581
|
-
$c1d7fb2ec91bae71$var$Item.getCollectionNode = function* getCollectionNode(props, context) {
|
|
3582
|
-
let { childItems, title, children } = props;
|
|
3583
|
-
let rendered = props.title || props.children;
|
|
3584
|
-
let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"] || "";
|
|
3585
|
-
if (!textValue && !(context === null || context === void 0 ? void 0 : context.suppressTextValueWarning))
|
|
3586
|
-
console.warn("<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop.");
|
|
3587
|
-
yield {
|
|
3588
|
-
type: "item",
|
|
3589
|
-
props,
|
|
3590
|
-
rendered,
|
|
3591
|
-
textValue,
|
|
3592
|
-
"aria-label": props["aria-label"],
|
|
3593
|
-
hasChildNodes: $c1d7fb2ec91bae71$var$hasChildItems(props),
|
|
3594
|
-
*childNodes() {
|
|
3595
|
-
if (childItems)
|
|
3596
|
-
for (let child1 of childItems)
|
|
3597
|
-
yield {
|
|
3598
|
-
type: "item",
|
|
3599
|
-
value: child1
|
|
3600
|
-
};
|
|
3601
|
-
else if (title) {
|
|
3602
|
-
let items = [];
|
|
3603
|
-
$tyW6A$react.Children.forEach(children, (child) => {
|
|
3604
|
-
items.push({
|
|
3605
|
-
type: "item",
|
|
3606
|
-
element: child
|
|
3607
|
-
});
|
|
3608
|
-
});
|
|
3609
|
-
yield* items;
|
|
3610
|
-
}
|
|
3611
|
-
}
|
|
3612
|
-
};
|
|
3613
|
-
};
|
|
3614
|
-
function $c1d7fb2ec91bae71$var$hasChildItems(props) {
|
|
3615
|
-
if (props.hasChildItems != null)
|
|
3616
|
-
return props.hasChildItems;
|
|
3617
|
-
if (props.childItems)
|
|
3618
|
-
return true;
|
|
3619
|
-
if (props.title && $tyW6A$react.Children.count(props.children) > 0)
|
|
3620
|
-
return true;
|
|
3621
|
-
return false;
|
|
3622
|
-
}
|
|
3623
|
-
function $9fc4852771d079eb$var$Section(props) {
|
|
3624
|
-
return null;
|
|
3625
|
-
}
|
|
3626
|
-
$9fc4852771d079eb$var$Section.getCollectionNode = function* getCollectionNode2(props) {
|
|
3627
|
-
let { children, title, items: items1 } = props;
|
|
3628
|
-
yield {
|
|
3629
|
-
type: "section",
|
|
3630
|
-
props,
|
|
3631
|
-
hasChildNodes: true,
|
|
3632
|
-
rendered: title,
|
|
3633
|
-
"aria-label": props["aria-label"],
|
|
3634
|
-
*childNodes() {
|
|
3635
|
-
if (typeof children === "function") {
|
|
3636
|
-
if (!items1)
|
|
3637
|
-
throw new Error("props.children was a function but props.items is missing");
|
|
3638
|
-
for (let item of items1)
|
|
3639
|
-
yield {
|
|
3640
|
-
type: "item",
|
|
3641
|
-
value: item,
|
|
3642
|
-
renderer: children
|
|
3643
|
-
};
|
|
3644
|
-
} else {
|
|
3645
|
-
let items = [];
|
|
3646
|
-
$tyW6A$react.Children.forEach(children, (child) => {
|
|
3647
|
-
items.push({
|
|
3648
|
-
type: "item",
|
|
3649
|
-
element: child
|
|
3650
|
-
});
|
|
3651
|
-
});
|
|
3652
|
-
yield* items;
|
|
3653
|
-
}
|
|
3654
|
-
}
|
|
3655
|
-
};
|
|
3656
|
-
};
|
|
3657
|
-
var $453cc9f0df89c0a5$var$cache = /* @__PURE__ */ new WeakMap();
|
|
3658
|
-
function $453cc9f0df89c0a5$export$77d5aafae4e095b2(collection) {
|
|
3659
|
-
let count = $453cc9f0df89c0a5$var$cache.get(collection);
|
|
3660
|
-
if (count != null)
|
|
3661
|
-
return count;
|
|
3662
|
-
count = 0;
|
|
3663
|
-
for (let item of collection)
|
|
3664
|
-
if (item.type === "section")
|
|
3665
|
-
count += $453cc9f0df89c0a5$export$77d5aafae4e095b2(item.childNodes);
|
|
3666
|
-
else
|
|
3667
|
-
count++;
|
|
3668
|
-
$453cc9f0df89c0a5$var$cache.set(collection, count);
|
|
3669
|
-
return count;
|
|
3670
|
-
}
|
|
3671
|
-
|
|
3672
|
-
// ../../node_modules/@react-aria/listbox/dist/module.js
|
|
3673
|
-
var $b1f0cad8af73213b$export$3585ede4d035bf14 = /* @__PURE__ */ new WeakMap();
|
|
3674
|
-
function $b1f0cad8af73213b$var$normalizeKey(key) {
|
|
3675
|
-
if (typeof key === "string")
|
|
3676
|
-
return key.replace(/\s*/g, "");
|
|
3677
|
-
return "" + key;
|
|
3678
|
-
}
|
|
3679
|
-
function $b1f0cad8af73213b$export$9145995848b05025(state, itemKey) {
|
|
3680
|
-
let data = $b1f0cad8af73213b$export$3585ede4d035bf14.get(state);
|
|
3681
|
-
if (!data)
|
|
3682
|
-
throw new Error("Unknown list");
|
|
3683
|
-
return `${data.id}-option-${$b1f0cad8af73213b$var$normalizeKey(itemKey)}`;
|
|
3684
|
-
}
|
|
3685
|
-
function $c132121280ec012d$export$50eacbbf140a3141(props, state, ref) {
|
|
3686
|
-
let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
|
|
3687
|
-
labelable: true
|
|
3688
|
-
});
|
|
3689
|
-
let { listProps } = $982254629710d113$export$b95089534ab7c1fd({
|
|
3690
|
-
...props,
|
|
3691
|
-
ref,
|
|
3692
|
-
selectionManager: state.selectionManager,
|
|
3693
|
-
collection: state.collection,
|
|
3694
|
-
disabledKeys: state.disabledKeys
|
|
3695
|
-
});
|
|
3696
|
-
let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec({
|
|
3697
|
-
onFocusWithin: props.onFocus,
|
|
3698
|
-
onBlurWithin: props.onBlur,
|
|
3699
|
-
onFocusWithinChange: props.onFocusChange
|
|
3700
|
-
});
|
|
3701
|
-
let id = $bdb11010cef70236$export$f680877a34711e37(props.id);
|
|
3702
|
-
$b1f0cad8af73213b$export$3585ede4d035bf14.set(state, {
|
|
3703
|
-
id,
|
|
3704
|
-
shouldUseVirtualFocus: props.shouldUseVirtualFocus,
|
|
3705
|
-
shouldSelectOnPressUp: props.shouldSelectOnPressUp,
|
|
3706
|
-
shouldFocusOnHover: props.shouldFocusOnHover,
|
|
3707
|
-
isVirtualized: props.isVirtualized,
|
|
3708
|
-
onAction: props.onAction
|
|
3709
|
-
});
|
|
3710
|
-
let { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f({
|
|
3711
|
-
...props,
|
|
3712
|
-
id,
|
|
3713
|
-
labelElementType: "span"
|
|
3714
|
-
});
|
|
3715
|
-
return {
|
|
3716
|
-
labelProps,
|
|
3717
|
-
listBoxProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, focusWithinProps, state.selectionManager.selectionMode === "multiple" ? {
|
|
3718
|
-
"aria-multiselectable": "true"
|
|
3719
|
-
} : {}, {
|
|
3720
|
-
role: "listbox",
|
|
3721
|
-
...$3ef42575df84b30b$export$9d1611c77c2fe928(fieldProps, listProps)
|
|
3722
|
-
})
|
|
3723
|
-
};
|
|
3724
|
-
}
|
|
3725
|
-
function $293f70390ea03370$export$497855f14858aa34(props, state, ref) {
|
|
3726
|
-
let { key } = props;
|
|
3727
|
-
let data = $b1f0cad8af73213b$export$3585ede4d035bf14.get(state);
|
|
3728
|
-
var _isDisabled;
|
|
3729
|
-
let isDisabled = (_isDisabled = props.isDisabled) !== null && _isDisabled !== void 0 ? _isDisabled : state.disabledKeys.has(key);
|
|
3730
|
-
var _isSelected;
|
|
3731
|
-
let isSelected = (_isSelected = props.isSelected) !== null && _isSelected !== void 0 ? _isSelected : state.selectionManager.isSelected(key);
|
|
3732
|
-
let isFocused = state.selectionManager.focusedKey === key;
|
|
3733
|
-
var _shouldSelectOnPressUp;
|
|
3734
|
-
let shouldSelectOnPressUp = (_shouldSelectOnPressUp = props.shouldSelectOnPressUp) !== null && _shouldSelectOnPressUp !== void 0 ? _shouldSelectOnPressUp : data.shouldSelectOnPressUp;
|
|
3735
|
-
var _shouldFocusOnHover;
|
|
3736
|
-
let shouldFocusOnHover = (_shouldFocusOnHover = props.shouldFocusOnHover) !== null && _shouldFocusOnHover !== void 0 ? _shouldFocusOnHover : data.shouldFocusOnHover;
|
|
3737
|
-
var _shouldUseVirtualFocus;
|
|
3738
|
-
let shouldUseVirtualFocus = (_shouldUseVirtualFocus = props.shouldUseVirtualFocus) !== null && _shouldUseVirtualFocus !== void 0 ? _shouldUseVirtualFocus : data.shouldUseVirtualFocus;
|
|
3739
|
-
var _isVirtualized;
|
|
3740
|
-
let isVirtualized = (_isVirtualized = props.isVirtualized) !== null && _isVirtualized !== void 0 ? _isVirtualized : data.isVirtualized;
|
|
3741
|
-
let labelId = $bdb11010cef70236$export$b4cc09c592e8fdb8();
|
|
3742
|
-
let descriptionId = $bdb11010cef70236$export$b4cc09c592e8fdb8();
|
|
3743
|
-
let optionProps = {
|
|
3744
|
-
role: "option",
|
|
3745
|
-
"aria-disabled": isDisabled,
|
|
3746
|
-
"aria-selected": state.selectionManager.selectionMode !== "none" ? isSelected : void 0
|
|
3747
|
-
};
|
|
3748
|
-
if (!($c87311424ea30a05$export$9ac100e40613ea10() && $c87311424ea30a05$export$78551043582a6a98())) {
|
|
3749
|
-
optionProps["aria-label"] = props["aria-label"];
|
|
3750
|
-
optionProps["aria-labelledby"] = labelId;
|
|
3751
|
-
optionProps["aria-describedby"] = descriptionId;
|
|
3752
|
-
}
|
|
3753
|
-
if (isVirtualized) {
|
|
3754
|
-
optionProps["aria-posinset"] = state.collection.getItem(key).index + 1;
|
|
3755
|
-
optionProps["aria-setsize"] = $453cc9f0df89c0a5$export$77d5aafae4e095b2(state.collection);
|
|
3756
|
-
}
|
|
3757
|
-
let { itemProps, isPressed, hasAction, allowsSelection } = $880e95eb8b93ba9a$export$ecf600387e221c37({
|
|
3758
|
-
selectionManager: state.selectionManager,
|
|
3759
|
-
key,
|
|
3760
|
-
ref,
|
|
3761
|
-
shouldSelectOnPressUp,
|
|
3762
|
-
allowsDifferentPressOrigin: shouldSelectOnPressUp && shouldFocusOnHover,
|
|
3763
|
-
isVirtualized,
|
|
3764
|
-
shouldUseVirtualFocus,
|
|
3765
|
-
isDisabled,
|
|
3766
|
-
onAction: data.onAction ? () => data.onAction(key) : void 0
|
|
3767
|
-
});
|
|
3768
|
-
let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456({
|
|
3769
|
-
isDisabled: isDisabled || !shouldFocusOnHover,
|
|
3770
|
-
onHoverStart() {
|
|
3771
|
-
if (!$507fabe10e71c6fb$export$b9b3dfddab17db27()) {
|
|
3772
|
-
state.selectionManager.setFocused(true);
|
|
3773
|
-
state.selectionManager.setFocusedKey(key);
|
|
3774
|
-
}
|
|
3775
|
-
}
|
|
3776
|
-
});
|
|
3777
|
-
return {
|
|
3778
|
-
optionProps: {
|
|
3779
|
-
...optionProps,
|
|
3780
|
-
...$3ef42575df84b30b$export$9d1611c77c2fe928(itemProps, hoverProps),
|
|
3781
|
-
id: $b1f0cad8af73213b$export$9145995848b05025(state, key)
|
|
3782
|
-
},
|
|
3783
|
-
labelProps: {
|
|
3784
|
-
id: labelId
|
|
3785
|
-
},
|
|
3786
|
-
descriptionProps: {
|
|
3787
|
-
id: descriptionId
|
|
3788
|
-
},
|
|
3789
|
-
isFocused,
|
|
3790
|
-
isSelected,
|
|
3791
|
-
isDisabled,
|
|
3792
|
-
isPressed,
|
|
3793
|
-
allowsSelection,
|
|
3794
|
-
hasAction
|
|
3795
|
-
};
|
|
3796
|
-
}
|
|
3797
|
-
|
|
3798
|
-
// src/components/DropdownSelector/Listbox.tsx
|
|
3799
|
-
import { useFocusRing } from "@react-aria/focus";
|
|
3800
|
-
import { px as px4 } from "@charcoal-ui/utils";
|
|
3801
|
-
var Listbox = ({
|
|
3802
|
-
state,
|
|
3803
|
-
mode = "default",
|
|
3804
|
-
...props
|
|
3805
|
-
}) => {
|
|
3806
|
-
const ref = useRef5(null);
|
|
3807
|
-
const { listBoxProps } = $c132121280ec012d$export$50eacbbf140a3141(props, state, ref);
|
|
3808
|
-
const collection = useMemo2(
|
|
3809
|
-
() => [...state.collection].map((node, index, self) => ({
|
|
3810
|
-
node,
|
|
3811
|
-
first: index === 0,
|
|
3812
|
-
last: index === self.length - 1
|
|
3813
|
-
})),
|
|
3814
|
-
[state.collection]
|
|
3815
|
-
);
|
|
3816
|
-
return /* @__PURE__ */ React14.createElement(ListboxRoot, { ref, ...listBoxProps }, collection.map(({ node, last }) => /* @__PURE__ */ React14.createElement(Fragment, { key: node.key }, /* @__PURE__ */ React14.createElement(Option, { item: node, state, mode }), !last && mode === "separator" && /* @__PURE__ */ React14.createElement(Divider, null))));
|
|
3817
|
-
};
|
|
3818
|
-
var Listbox_default = memo(Listbox);
|
|
3819
|
-
var ListboxRoot = styled13.ul`
|
|
3820
|
-
padding-left: 0;
|
|
3821
|
-
margin: 0;
|
|
3822
|
-
box-sizing: border-box;
|
|
3823
|
-
list-style: none;
|
|
3824
|
-
|
|
3825
|
-
${theme((o) => [
|
|
3826
|
-
o.bg.background1,
|
|
3827
|
-
o.border.default,
|
|
3828
|
-
o.borderRadius(8),
|
|
3829
|
-
o.outline.default.focus
|
|
3830
|
-
])}
|
|
3831
|
-
`;
|
|
3832
|
-
var Divider = styled13.div.attrs({ role: "separator" })`
|
|
3833
|
-
display: flex;
|
|
3834
|
-
${theme((o) => [o.padding.horizontal(8)])}
|
|
3835
|
-
|
|
3836
|
-
&:before {
|
|
3837
|
-
content: '';
|
|
3838
|
-
display: block;
|
|
3839
|
-
width: 100%;
|
|
3840
|
-
height: 1px;
|
|
3841
|
-
background: #00000014;
|
|
3842
|
-
}
|
|
3843
|
-
`;
|
|
3844
|
-
var Option = ({ item, state, mode }) => {
|
|
3845
|
-
const ref = useRef5(null);
|
|
3846
|
-
const { optionProps, isSelected } = $293f70390ea03370$export$497855f14858aa34(item, state, ref);
|
|
3847
|
-
const { focusProps } = useFocusRing();
|
|
3848
|
-
return /* @__PURE__ */ React14.createElement(OptionRoot, { ...$3ef42575df84b30b$export$9d1611c77c2fe928(optionProps, focusProps), ref, mode }, /* @__PURE__ */ React14.createElement(OptionCheckIcon, { name: "16/Check", isSelected }), /* @__PURE__ */ React14.createElement(OptionText, null, item.rendered));
|
|
3849
|
-
};
|
|
3850
|
-
var OptionRoot = styled13.li`
|
|
3851
|
-
display: flex;
|
|
3852
|
-
align-items: center;
|
|
3853
|
-
gap: ${({ theme: theme4 }) => px4(theme4.spacing[4])};
|
|
3854
|
-
height: 40px;
|
|
3855
|
-
cursor: pointer;
|
|
3856
|
-
outline: none;
|
|
3857
|
-
|
|
3858
|
-
${({ mode }) => theme((o) => [
|
|
3859
|
-
o.padding.horizontal(8),
|
|
3860
|
-
mode === "separator" && o.padding.vertical(4)
|
|
3861
|
-
])}
|
|
3862
|
-
|
|
3863
|
-
&:focus {
|
|
3864
|
-
${theme((o) => [o.bg.surface3])}
|
|
3865
|
-
}
|
|
3866
|
-
`;
|
|
3867
|
-
var OptionCheckIcon = styled13(Icon_default)`
|
|
3868
|
-
visibility: hidden;
|
|
3869
|
-
${theme((o) => [o.font.text2])}
|
|
3870
|
-
|
|
3871
|
-
${({ isSelected }) => isSelected && css5`
|
|
3872
|
-
visibility: visible;
|
|
3873
|
-
`}
|
|
3874
|
-
`;
|
|
3875
|
-
var OptionText = styled13.span`
|
|
3876
|
-
display: block;
|
|
3877
|
-
${theme((o) => [o.typography(14), o.font.text2])}
|
|
3878
|
-
`;
|
|
3879
|
-
|
|
3880
|
-
// src/components/DropdownSelector/Popover.tsx
|
|
3881
|
-
import { FocusScope as FocusScope2 } from "@react-aria/focus";
|
|
3882
|
-
import { DismissButton, useOverlay as useOverlay2 } from "@react-aria/overlays";
|
|
3883
|
-
import React15, {
|
|
3884
|
-
useRef as useRef6,
|
|
3885
|
-
useMemo as useMemo3,
|
|
3886
|
-
memo as memo2
|
|
3887
|
-
} from "react";
|
|
3888
|
-
var Popover = ({ open, onClose, children, ...props }) => {
|
|
3889
|
-
const ref = useRef6(null);
|
|
3890
|
-
const { overlayProps } = useOverlay2(
|
|
3891
|
-
useMemo3(
|
|
3892
|
-
() => ({
|
|
3893
|
-
isOpen: open,
|
|
3894
|
-
onClose,
|
|
3895
|
-
shouldCloseOnBlur: true,
|
|
3896
|
-
isDismissable: true
|
|
3897
|
-
}),
|
|
3898
|
-
[onClose, open]
|
|
3899
|
-
),
|
|
3900
|
-
ref
|
|
3901
|
-
);
|
|
3902
|
-
return /* @__PURE__ */ React15.createElement(FocusScope2, { restoreFocus: true }, /* @__PURE__ */ React15.createElement("div", { ...$3ef42575df84b30b$export$9d1611c77c2fe928(overlayProps, props), ref }, children, /* @__PURE__ */ React15.createElement(DismissButton, { onDismiss: onClose })));
|
|
3903
|
-
};
|
|
3904
|
-
var Popover_default = memo2(Popover);
|
|
3905
|
-
|
|
3906
|
-
// src/components/DropdownSelector/index.tsx
|
|
3907
|
-
var DropdownSelector = ({
|
|
3908
|
-
open,
|
|
3909
|
-
className,
|
|
3910
|
-
label = "",
|
|
3911
|
-
requiredText = "",
|
|
3912
|
-
subLabel,
|
|
3913
|
-
assertiveText,
|
|
3914
|
-
autoComplete,
|
|
3915
|
-
invalid = false,
|
|
3916
|
-
disabled = false,
|
|
3917
|
-
required = false,
|
|
3918
|
-
showLabel = false,
|
|
3919
|
-
mode = "default",
|
|
3920
|
-
...props
|
|
3921
|
-
}) => {
|
|
3922
|
-
const { visuallyHiddenProps } = useVisuallyHidden2();
|
|
3923
|
-
const triggerRef = useRef7(null);
|
|
3924
|
-
const selectProps = useMemo4(
|
|
3925
|
-
() => ({
|
|
3926
|
-
...props,
|
|
3927
|
-
label,
|
|
3928
|
-
isOpen: open,
|
|
3929
|
-
isDisabled: disabled,
|
|
3930
|
-
isRequired: required,
|
|
3931
|
-
errorMessage: invalid && assertiveText,
|
|
3932
|
-
validationState: invalid ? "invalid" : "valid",
|
|
3933
|
-
onSelectionChange: props.onChange,
|
|
3934
|
-
selectedKey: props.value,
|
|
3935
|
-
defaultSelectedKey: props.defaultValue
|
|
3936
|
-
}),
|
|
3937
|
-
[assertiveText, disabled, invalid, label, open, props, required]
|
|
3938
|
-
);
|
|
3939
|
-
const state = useSelectState(selectProps);
|
|
3940
|
-
const {
|
|
3941
|
-
labelProps,
|
|
3942
|
-
triggerProps,
|
|
3943
|
-
valueProps,
|
|
3944
|
-
menuProps,
|
|
3945
|
-
errorMessageProps,
|
|
3946
|
-
descriptionProps
|
|
3947
|
-
} = useSelect(selectProps, state, triggerRef);
|
|
3948
|
-
const { buttonProps } = useButton(triggerProps, triggerRef);
|
|
3949
|
-
const hasAssertiveText = assertiveText !== void 0 && assertiveText.length > 0;
|
|
3950
|
-
return /* @__PURE__ */ React16.createElement(DropdownSelectorRoot, { "aria-disabled": disabled, className }, /* @__PURE__ */ React16.createElement(
|
|
3951
|
-
DropdownFieldLabel,
|
|
3952
|
-
{
|
|
3953
|
-
label,
|
|
3954
|
-
required,
|
|
3955
|
-
requiredText,
|
|
3956
|
-
subLabel,
|
|
3957
|
-
...labelProps,
|
|
3958
|
-
...!showLabel ? visuallyHiddenProps : {}
|
|
3959
|
-
}
|
|
3960
|
-
), /* @__PURE__ */ React16.createElement(
|
|
3961
|
-
HiddenSelect,
|
|
3962
|
-
{
|
|
3963
|
-
state,
|
|
3964
|
-
triggerRef,
|
|
3965
|
-
label,
|
|
3966
|
-
name: props.name,
|
|
3967
|
-
isDisabled: disabled,
|
|
3968
|
-
autoComplete
|
|
3969
|
-
}
|
|
3970
|
-
), /* @__PURE__ */ React16.createElement(DropdownButtonWrapper, null, /* @__PURE__ */ React16.createElement(DropdownButton, { ...buttonProps, ref: triggerRef, invalid }, /* @__PURE__ */ React16.createElement(DropdownButtonText, { ...valueProps }, state.selectedItem ? state.selectedItem.rendered : props.placeholder), /* @__PURE__ */ React16.createElement(DropdownButtonIcon, { name: "16/Menu" })), state.isOpen && /* @__PURE__ */ React16.createElement(DropdownPopover, { open: state.isOpen, onClose: () => state.close() }, /* @__PURE__ */ React16.createElement(Listbox_default, { ...menuProps, state, mode }))), hasAssertiveText && /* @__PURE__ */ React16.createElement(
|
|
3971
|
-
AssertiveText,
|
|
3972
|
-
{
|
|
3973
|
-
invalid,
|
|
3974
|
-
...invalid ? errorMessageProps : descriptionProps
|
|
3975
|
-
},
|
|
3976
|
-
assertiveText
|
|
3977
|
-
));
|
|
3978
|
-
};
|
|
3979
|
-
var DropdownSelector_default = DropdownSelector;
|
|
3980
|
-
var DropdownSelectorItem = Item;
|
|
3981
|
-
var DropdownSelectorRoot = styled14.div`
|
|
3982
|
-
position: relative;
|
|
3983
|
-
display: inline-block;
|
|
3984
|
-
|
|
3985
|
-
${disabledSelector4} {
|
|
3986
|
-
cursor: default;
|
|
3987
|
-
${theme((o) => o.disabled)}
|
|
3988
|
-
}
|
|
3989
|
-
`;
|
|
3990
|
-
var DropdownFieldLabel = styled14(FieldLabel_default)`
|
|
3991
|
-
width: 100%;
|
|
3992
|
-
|
|
3993
|
-
${theme((o) => o.margin.bottom(8))}
|
|
3994
|
-
`;
|
|
3995
|
-
var DropdownButtonWrapper = styled14.div`
|
|
3996
|
-
position: relative;
|
|
3997
|
-
`;
|
|
3998
|
-
var DropdownButton = styled14.button`
|
|
3999
|
-
display: flex;
|
|
4000
|
-
justify-content: space-between;
|
|
4001
|
-
align-items: center;
|
|
4002
|
-
|
|
4003
|
-
height: 40px;
|
|
4004
|
-
width: 288px;
|
|
4005
|
-
box-sizing: border-box;
|
|
4006
|
-
cursor: pointer;
|
|
4007
|
-
|
|
4008
|
-
${disabledSelector4} {
|
|
4009
|
-
cursor: default;
|
|
4010
|
-
}
|
|
4011
|
-
|
|
4012
|
-
${({ invalid }) => theme((o) => [
|
|
4013
|
-
o.border.default,
|
|
4014
|
-
o.padding.horizontal(8),
|
|
4015
|
-
o.outline.default.focus,
|
|
4016
|
-
o.bg.surface3,
|
|
4017
|
-
o.borderRadius(4),
|
|
4018
|
-
invalid && o.outline.assertive
|
|
4019
|
-
])}
|
|
4020
|
-
`;
|
|
4021
|
-
var DropdownButtonText = styled14.span`
|
|
4022
|
-
text-align: left;
|
|
4023
|
-
|
|
4024
|
-
${theme((o) => [o.typography(14), o.font.text2])}
|
|
4025
|
-
`;
|
|
4026
|
-
var DropdownButtonIcon = styled14(Icon_default)`
|
|
4027
|
-
${theme((o) => [o.font.text2])}
|
|
4028
|
-
`;
|
|
4029
|
-
var AssertiveText = styled14.div`
|
|
4030
|
-
${({ invalid }) => theme((o) => [
|
|
4031
|
-
o.typography(14),
|
|
4032
|
-
o.margin.top(8),
|
|
4033
|
-
invalid ? o.font.assertive : o.font.text2
|
|
4034
|
-
])}
|
|
4035
|
-
`;
|
|
4036
|
-
var DropdownPopover = styled14(Popover_default)`
|
|
4037
|
-
position: absolute;
|
|
4038
|
-
width: 100%;
|
|
4039
|
-
|
|
4040
|
-
top: 100%;
|
|
4041
|
-
margin-top: 2px;
|
|
4042
|
-
`;
|
|
4043
|
-
|
|
4044
|
-
// src/components/SegmentedControl/index.tsx
|
|
4045
|
-
import React18, { forwardRef, memo as memo3, useMemo as useMemo5, useRef as useRef8 } from "react";
|
|
4046
|
-
import { useRadioGroupState } from "react-stately";
|
|
4047
|
-
import {
|
|
4048
|
-
useRadio,
|
|
4049
|
-
useRadioGroup
|
|
4050
|
-
} from "@react-aria/radio";
|
|
4051
|
-
import styled15 from "styled-components";
|
|
4052
|
-
import { disabledSelector as disabledSelector5 } from "@charcoal-ui/utils";
|
|
4053
|
-
|
|
4054
|
-
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
4055
|
-
import React17, { createContext as createContext2, useContext as useContext5 } from "react";
|
|
4056
|
-
var RadioContext = createContext2(null);
|
|
4057
|
-
var RadioProvider = ({
|
|
4058
|
-
value,
|
|
4059
|
-
children
|
|
4060
|
-
}) => {
|
|
4061
|
-
return /* @__PURE__ */ React17.createElement(RadioContext.Provider, { value }, children);
|
|
4062
|
-
};
|
|
4063
|
-
var useRadioContext = () => {
|
|
4064
|
-
const state = useContext5(RadioContext);
|
|
4065
|
-
if (state === null)
|
|
4066
|
-
throw new Error("`<RadioProvider>` is not likely mounted.");
|
|
4067
|
-
return state;
|
|
4068
|
-
};
|
|
4069
|
-
|
|
4070
|
-
// src/components/SegmentedControl/index.tsx
|
|
4071
|
-
var SegmentedControl = forwardRef(
|
|
4072
|
-
function SegmentedControlInner(props, ref) {
|
|
4073
|
-
const ariaRadioGroupProps = useMemo5(
|
|
4074
|
-
() => ({
|
|
4075
|
-
...props,
|
|
4076
|
-
isDisabled: props.disabled,
|
|
4077
|
-
isReadOnly: props.readonly,
|
|
4078
|
-
isRequired: props.required
|
|
4079
|
-
}),
|
|
4080
|
-
[props]
|
|
4081
|
-
);
|
|
4082
|
-
const state = useRadioGroupState(ariaRadioGroupProps);
|
|
4083
|
-
const { radioGroupProps } = useRadioGroup(ariaRadioGroupProps, state);
|
|
4084
|
-
const segmentedControlItems = useMemo5(() => {
|
|
4085
|
-
return props.data.map(
|
|
4086
|
-
(d) => typeof d === "string" ? { value: d, label: d } : d
|
|
4087
|
-
);
|
|
4088
|
-
}, [props.data]);
|
|
4089
|
-
return /* @__PURE__ */ React18.createElement(SegmentedControlRoot, { ref, ...radioGroupProps }, /* @__PURE__ */ React18.createElement(RadioProvider, { value: state }, segmentedControlItems.map((item) => /* @__PURE__ */ React18.createElement(
|
|
4090
|
-
Segmented,
|
|
4091
|
-
{
|
|
4092
|
-
key: item.value,
|
|
4093
|
-
value: item.value,
|
|
4094
|
-
disabled: item.disabled
|
|
4095
|
-
},
|
|
4096
|
-
item.label
|
|
4097
|
-
))));
|
|
4098
|
-
}
|
|
4099
|
-
);
|
|
4100
|
-
var SegmentedControl_default = memo3(SegmentedControl);
|
|
4101
|
-
var Segmented = ({ children, ...props }) => {
|
|
4102
|
-
const state = useRadioContext();
|
|
4103
|
-
const ref = useRef8(null);
|
|
4104
|
-
const ariaRadioProps = useMemo5(
|
|
4105
|
-
() => ({ ...props, isDisabled: props.disabled }),
|
|
4106
|
-
[props]
|
|
4107
|
-
);
|
|
4108
|
-
const { inputProps, isDisabled, isSelected } = useRadio(
|
|
4109
|
-
ariaRadioProps,
|
|
4110
|
-
state,
|
|
4111
|
-
ref
|
|
4112
|
-
);
|
|
4113
|
-
return /* @__PURE__ */ React18.createElement(
|
|
4114
|
-
SegmentedRoot,
|
|
4115
|
-
{
|
|
4116
|
-
"aria-disabled": isDisabled || state.isReadOnly,
|
|
4117
|
-
checked: isSelected
|
|
4118
|
-
},
|
|
4119
|
-
/* @__PURE__ */ React18.createElement(SegmentedInput, { ...inputProps, ref }),
|
|
4120
|
-
/* @__PURE__ */ React18.createElement(RadioLabel2, null, /* @__PURE__ */ React18.createElement(SegmentedLabelInner, null, children))
|
|
4121
|
-
);
|
|
4122
|
-
};
|
|
4123
|
-
var SegmentedControlRoot = styled15.div`
|
|
4124
|
-
display: inline-flex;
|
|
4125
|
-
align-items: center;
|
|
4126
|
-
|
|
4127
|
-
${theme((o) => [o.bg.surface3, o.borderRadius(16)])}
|
|
4128
|
-
`;
|
|
4129
|
-
var SegmentedRoot = styled15.label`
|
|
4130
|
-
position: relative;
|
|
4131
|
-
display: flex;
|
|
4132
|
-
align-items: center;
|
|
4133
|
-
cursor: pointer;
|
|
4134
|
-
height: 32px;
|
|
4135
|
-
|
|
4136
|
-
${disabledSelector5} {
|
|
4137
|
-
cursor: default;
|
|
4138
|
-
}
|
|
4139
|
-
|
|
4140
|
-
${({ checked }) => theme((o) => [
|
|
4141
|
-
o.padding.horizontal(16),
|
|
4142
|
-
o.borderRadius(16),
|
|
4143
|
-
o.disabled,
|
|
4144
|
-
checked === true && o.bg.brand,
|
|
4145
|
-
checked === true ? o.font.text5 : o.font.text2
|
|
4146
|
-
])}
|
|
4147
|
-
`;
|
|
4148
|
-
var SegmentedInput = styled15.input`
|
|
4149
|
-
position: absolute;
|
|
4150
|
-
|
|
4151
|
-
height: 0px;
|
|
4152
|
-
width: 0px;
|
|
4153
|
-
padding: 0;
|
|
4154
|
-
margin: 0;
|
|
4155
|
-
|
|
4156
|
-
appearance: none;
|
|
4157
|
-
box-sizing: border-box;
|
|
4158
|
-
overflow: hidden;
|
|
4159
|
-
white-space: nowrap;
|
|
4160
|
-
opacity: 0;
|
|
4161
|
-
`;
|
|
4162
|
-
var RadioLabel2 = styled15.div`
|
|
4163
|
-
background: transparent;
|
|
4164
|
-
display: flex;
|
|
4165
|
-
align-items: center;
|
|
4166
|
-
height: 22px;
|
|
4167
|
-
`;
|
|
4168
|
-
var SegmentedLabelInner = styled15.div`
|
|
4169
|
-
${theme((o) => [o.typography(14)])}
|
|
4170
|
-
`;
|
|
4171
|
-
|
|
4172
|
-
// src/components/Checkbox/index.tsx
|
|
4173
|
-
import React19, { forwardRef as forwardRef2, memo as memo4, useMemo as useMemo6 } from "react";
|
|
4174
|
-
import styled16, { css as css6 } from "styled-components";
|
|
4175
|
-
import { useCheckbox } from "@react-aria/checkbox";
|
|
4176
|
-
import { useToggleState as useToggleState2 } from "react-stately";
|
|
4177
|
-
import { disabledSelector as disabledSelector6, px as px5 } from "@charcoal-ui/utils";
|
|
4178
|
-
var Checkbox = forwardRef2(
|
|
4179
|
-
function CheckboxInner(props, ref) {
|
|
4180
|
-
const ariaCheckboxProps = useMemo6(
|
|
4181
|
-
() => ({
|
|
4182
|
-
...props,
|
|
4183
|
-
isSelected: props.checked,
|
|
4184
|
-
defaultSelected: props.defaultChecked,
|
|
4185
|
-
"aria-label": "children" in props ? void 0 : props.label,
|
|
4186
|
-
isDisabled: props.disabled
|
|
4187
|
-
}),
|
|
4188
|
-
[props]
|
|
4189
|
-
);
|
|
4190
|
-
const state = useToggleState2(ariaCheckboxProps);
|
|
4191
|
-
const objectRef = $df56164dff5785e2$export$4338b53315abf666(ref);
|
|
4192
|
-
const { inputProps } = useCheckbox(ariaCheckboxProps, state, objectRef);
|
|
4193
|
-
const isDisabled = (props.disabled ?? false) || (props.readonly ?? false);
|
|
4194
|
-
return /* @__PURE__ */ React19.createElement(InputRoot, { "aria-disabled": isDisabled }, /* @__PURE__ */ React19.createElement(CheckboxInput, { type: "checkbox", ...inputProps }), /* @__PURE__ */ React19.createElement(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked }, /* @__PURE__ */ React19.createElement(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 })), "children" in props && /* @__PURE__ */ React19.createElement(InputLabel, null, props.children));
|
|
4195
|
-
}
|
|
4196
|
-
);
|
|
4197
|
-
var Checkbox_default = memo4(Checkbox);
|
|
4198
|
-
var hiddenCss = css6`
|
|
4199
|
-
visibility: hidden;
|
|
4200
|
-
`;
|
|
4201
|
-
var InputRoot = styled16.label`
|
|
4202
|
-
position: relative;
|
|
4203
|
-
display: flex;
|
|
4204
|
-
align-items: center;
|
|
4205
|
-
cursor: pointer;
|
|
4206
|
-
${disabledSelector6} {
|
|
4207
|
-
cursor: default;
|
|
4208
|
-
}
|
|
4209
|
-
|
|
4210
|
-
gap: ${({ theme: theme4 }) => px5(theme4.spacing[4])};
|
|
4211
|
-
${theme((o) => [o.disabled])}
|
|
4212
|
-
`;
|
|
4213
|
-
var CheckboxInput = styled16.input`
|
|
4214
|
-
&[type='checkbox'] {
|
|
4215
|
-
appearance: none;
|
|
4216
|
-
display: block;
|
|
4217
|
-
cursor: pointer;
|
|
4218
|
-
margin: 0;
|
|
4219
|
-
width: 20px;
|
|
4220
|
-
height: 20px;
|
|
4221
|
-
|
|
4222
|
-
&:checked {
|
|
4223
|
-
${theme((o) => o.bg.brand.hover.press)}
|
|
4224
|
-
}
|
|
4225
|
-
&:not(:checked) {
|
|
4226
|
-
border-width: 2px;
|
|
4227
|
-
border-style: solid;
|
|
4228
|
-
border-color: ${({ theme: theme4 }) => theme4.color.text4};
|
|
4229
|
-
}
|
|
4230
|
-
${theme((o) => [o.outline.default.focus, o.borderRadius(4)])}
|
|
4231
|
-
}
|
|
4232
|
-
`;
|
|
4233
|
-
var CheckboxInputOverlay = styled16.div`
|
|
4234
|
-
position: absolute;
|
|
4235
|
-
top: -2px;
|
|
4236
|
-
left: -2px;
|
|
4237
|
-
box-sizing: border-box;
|
|
4238
|
-
display: flex;
|
|
4239
|
-
align-items: center;
|
|
4240
|
-
justify-content: center;
|
|
4241
|
-
|
|
4242
|
-
${theme((o) => [o.width.px(24), o.height.px(24), o.font.text5])}
|
|
4243
|
-
|
|
4244
|
-
${({ checked }) => checked !== true && hiddenCss};
|
|
4245
|
-
`;
|
|
4246
|
-
var InputLabel = styled16.div`
|
|
4247
|
-
${theme((o) => [o.typography(14), o.font.text2])}
|
|
4248
|
-
`;
|
|
4249
|
-
|
|
4250
|
-
// src/components/TagItem/index.tsx
|
|
4251
|
-
import React20, {
|
|
4252
|
-
forwardRef as forwardRef3,
|
|
4253
|
-
memo as memo5,
|
|
4254
|
-
useMemo as useMemo7
|
|
4255
|
-
} from "react";
|
|
4256
|
-
import styled17, { css as css7 } from "styled-components";
|
|
4257
|
-
import { disabledSelector as disabledSelector7, px as px6 } from "@charcoal-ui/utils";
|
|
4258
|
-
import { useButton as useButton2 } from "@react-aria/button";
|
|
4259
|
-
var sizeMap = {
|
|
4260
|
-
S: 32,
|
|
4261
|
-
M: 40
|
|
4262
|
-
};
|
|
4263
|
-
var TagItem = forwardRef3(
|
|
4264
|
-
function TagItemInner({
|
|
4265
|
-
label,
|
|
4266
|
-
translatedLabel,
|
|
4267
|
-
bgColor = "#7ACCB1",
|
|
4268
|
-
bgImage,
|
|
4269
|
-
size = "M",
|
|
4270
|
-
disabled,
|
|
4271
|
-
status = "default",
|
|
4272
|
-
...props
|
|
4273
|
-
}, _ref) {
|
|
4274
|
-
const ref = $df56164dff5785e2$export$4338b53315abf666(_ref);
|
|
4275
|
-
const ariaButtonProps = useMemo7(
|
|
4276
|
-
() => ({
|
|
4277
|
-
elementType: "a",
|
|
4278
|
-
isDisabled: disabled,
|
|
4279
|
-
...props
|
|
4280
|
-
}),
|
|
4281
|
-
[disabled, props]
|
|
4282
|
-
);
|
|
4283
|
-
const { buttonProps } = useButton2(ariaButtonProps, ref);
|
|
4284
|
-
const hasTranslatedLabel = translatedLabel !== void 0 && translatedLabel.length > 0;
|
|
4285
|
-
return /* @__PURE__ */ React20.createElement(
|
|
4286
|
-
TagItemRoot,
|
|
4287
|
-
{
|
|
4288
|
-
ref,
|
|
4289
|
-
size: hasTranslatedLabel ? "M" : size,
|
|
4290
|
-
status,
|
|
4291
|
-
...buttonProps
|
|
4292
|
-
},
|
|
4293
|
-
/* @__PURE__ */ React20.createElement(Background, { bgColor, bgImage }),
|
|
4294
|
-
/* @__PURE__ */ React20.createElement(Inner, null, /* @__PURE__ */ React20.createElement(LabelWrapper, { isTranslate: hasTranslatedLabel }, hasTranslatedLabel && /* @__PURE__ */ React20.createElement(TranslatedLabel, null, /* @__PURE__ */ React20.createElement(Label3, null, translatedLabel)), /* @__PURE__ */ React20.createElement(Label3, null, label)), status === "active" && /* @__PURE__ */ React20.createElement(Icon_default, { name: "16/Remove" }))
|
|
4295
|
-
);
|
|
4296
|
-
}
|
|
4297
|
-
);
|
|
4298
|
-
var TagItem_default = memo5(TagItem);
|
|
4299
|
-
var TagItemRoot = styled17.a`
|
|
4300
|
-
isolation: isolate;
|
|
4301
|
-
position: relative;
|
|
4302
|
-
height: ${({ size }) => sizeMap[size]}px;
|
|
4303
|
-
display: inline-flex;
|
|
4304
|
-
align-items: center;
|
|
4305
|
-
justify-content: center;
|
|
4306
|
-
text-decoration: none;
|
|
4307
|
-
cursor: pointer;
|
|
4308
|
-
overflow: hidden;
|
|
4309
|
-
|
|
4310
|
-
${({ size, status }) => theme((o) => [
|
|
4311
|
-
o.outline.default.focus,
|
|
4312
|
-
o.borderRadius(4),
|
|
4313
|
-
status !== "active" && size === "M" && o.padding.horizontal(24),
|
|
4314
|
-
status !== "active" && size === "S" && o.padding.horizontal(16),
|
|
4315
|
-
status === "inactive" && o.bg.surface3,
|
|
4316
|
-
status === "inactive" ? o.font.text2 : o.font.text5,
|
|
4317
|
-
...status === "active" ? [o.padding.left(16), o.padding.right(8)] : []
|
|
4318
|
-
])}
|
|
4319
|
-
|
|
4320
|
-
${disabledSelector7} {
|
|
4321
|
-
${theme((o) => [o.disabled])}
|
|
4322
|
-
cursor: default;
|
|
4323
|
-
}
|
|
4324
|
-
`;
|
|
4325
|
-
var Background = styled17.div`
|
|
4326
|
-
position: absolute;
|
|
4327
|
-
z-index: 1;
|
|
4328
|
-
top: 0;
|
|
4329
|
-
left: 0;
|
|
4330
|
-
width: 100%;
|
|
4331
|
-
height: 100%;
|
|
4332
|
-
|
|
4333
|
-
background-color: ${({ bgColor }) => bgColor};
|
|
4334
|
-
|
|
4335
|
-
${({ bgImage }) => bgImage !== void 0 && css7`
|
|
4336
|
-
${theme((o) => [o.bg.surface4])}
|
|
4337
|
-
&::before {
|
|
4338
|
-
content: '';
|
|
4339
|
-
position: absolute;
|
|
4340
|
-
top: 0;
|
|
4341
|
-
left: 0;
|
|
4342
|
-
width: 100%;
|
|
4343
|
-
height: 100%;
|
|
4344
|
-
background-position: center;
|
|
4345
|
-
background-size: cover;
|
|
4346
|
-
background-image: url(${bgImage});
|
|
4347
|
-
mix-blend-mode: overlay;
|
|
4348
|
-
}
|
|
4349
|
-
`}
|
|
4350
|
-
`;
|
|
4351
|
-
var Inner = styled17.div`
|
|
4352
|
-
display: inline-flex;
|
|
4353
|
-
gap: ${({ theme: theme4 }) => px6(theme4.spacing[8])};
|
|
4354
|
-
align-items: center;
|
|
4355
|
-
z-index: 2;
|
|
4356
|
-
`;
|
|
4357
|
-
var labelCSS = css7`
|
|
4358
|
-
${theme((o) => [o.typography(14).bold])}
|
|
4359
|
-
`;
|
|
4360
|
-
var translateLabelCSS = css7`
|
|
4361
|
-
display: flex;
|
|
4362
|
-
align-items: center;
|
|
4363
|
-
flex-direction: column;
|
|
4364
|
-
font-size: 10px;
|
|
4365
|
-
`;
|
|
4366
|
-
var LabelWrapper = styled17.div`
|
|
4367
|
-
${({ isTranslate }) => isTranslate ?? false ? translateLabelCSS : labelCSS}
|
|
4368
|
-
`;
|
|
4369
|
-
var Label3 = styled17.span`
|
|
4370
|
-
max-width: 152px;
|
|
4371
|
-
overflow: hidden;
|
|
4372
|
-
text-overflow: ellipsis;
|
|
4373
|
-
white-space: nowrap;
|
|
4374
|
-
font-size: inherit;
|
|
4375
|
-
color: inherit;
|
|
4376
|
-
line-height: inherit;
|
|
4377
|
-
`;
|
|
4378
|
-
var TranslatedLabel = styled17.div`
|
|
4379
|
-
${theme((o) => [o.typography(12).bold])}
|
|
4380
|
-
`;
|
|
4381
|
-
export {
|
|
4382
|
-
Button_default as Button,
|
|
4383
|
-
Checkbox_default as Checkbox,
|
|
4384
|
-
Clickable_default as Clickable,
|
|
4385
|
-
ComponentAbstraction,
|
|
4386
|
-
DropdownSelector_default as DropdownSelector,
|
|
4387
|
-
DropdownSelectorItem,
|
|
4388
|
-
Icon_default as Icon,
|
|
4389
|
-
IconButton_default as IconButton,
|
|
4390
|
-
LoadingSpinner,
|
|
4391
|
-
LoadingSpinnerIcon,
|
|
4392
|
-
Modal,
|
|
4393
|
-
ModalAlign,
|
|
4394
|
-
ModalBody,
|
|
4395
|
-
ModalButtons,
|
|
4396
|
-
ModalHeader,
|
|
4397
|
-
MultiSelect,
|
|
4398
|
-
MultiSelectGroup,
|
|
4399
|
-
OverlayProvider,
|
|
4400
|
-
Radio,
|
|
4401
|
-
RadioGroup,
|
|
4402
|
-
SSRProvider,
|
|
4403
|
-
SegmentedControl_default as SegmentedControl,
|
|
4404
|
-
SwitchCheckbox as Switch,
|
|
4405
|
-
TagItem_default as TagItem,
|
|
4406
|
-
TextField_default as TextField,
|
|
4407
|
-
useComponentAbstraction
|
|
4408
|
-
};
|
|
4409
|
-
//# sourceMappingURL=index.js.map
|