@charcoal-ui/react 3.4.0 → 3.6.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/Button/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.story.d.ts +1 -0
- package/dist/components/Checkbox/index.story.d.ts.map +1 -1
- package/dist/components/DropdownSelector/DropdownMenuItem.d.ts.map +1 -1
- package/dist/components/DropdownSelector/ListItem/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/index.d.ts.map +1 -1
- package/dist/components/FieldLabel/index.d.ts.map +1 -1
- package/dist/components/IconButton/index.d.ts.map +1 -1
- package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
- package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.story.d.ts +1 -0
- package/dist/components/Modal/index.story.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.story.d.ts +2 -0
- package/dist/components/MultiSelect/index.story.d.ts.map +1 -1
- package/dist/components/Radio/index.d.ts.map +1 -1
- package/dist/components/SegmentedControl/index.d.ts.map +1 -1
- package/dist/components/Switch/index.d.ts.map +1 -1
- package/dist/components/TagItem/index.d.ts.map +1 -1
- package/dist/components/TextArea/index.d.ts.map +1 -1
- package/dist/components/TextField/TextField.story.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts +4 -0
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/components/TextField/useFocusWithClick.d.ts +3 -0
- package/dist/components/TextField/useFocusWithClick.d.ts.map +1 -0
- package/dist/index.cjs.js +935 -494
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +863 -422
- package/dist/index.esm.js.map +1 -1
- package/dist/styled.d.ts +4 -4
- package/package.json +9 -9
- package/src/components/Button/__snapshots__/index.story.storyshot +312 -592
- package/src/components/Button/index.tsx +50 -14
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +209 -40
- package/src/components/Checkbox/__snapshots__/snapshot.test.tsx.snap +410 -80
- package/src/components/Checkbox/index.story.tsx +24 -0
- package/src/components/Checkbox/index.tsx +47 -17
- package/src/components/Clickable/__snapshots__/index.story.storyshot +4 -0
- package/src/components/Clickable/index.tsx +1 -0
- package/src/components/DropdownSelector/DropdownMenuItem.tsx +19 -3
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +3 -10
- package/src/components/DropdownSelector/ListItem/index.tsx +6 -4
- package/src/components/DropdownSelector/MenuItemGroup/index.tsx +1 -1
- package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +4 -13
- package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +20 -37
- package/src/components/DropdownSelector/Popover/index.tsx +5 -8
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +60 -191
- package/src/components/DropdownSelector/index.tsx +70 -20
- package/src/components/FieldLabel/index.tsx +77 -12
- package/src/components/IconButton/__snapshots__/index.story.storyshot +30 -54
- package/src/components/IconButton/index.tsx +51 -26
- package/src/components/LoadingSpinner/index.tsx +3 -6
- package/src/components/Modal/Dialog/index.tsx +1 -1
- package/src/components/Modal/ModalPlumbing.tsx +26 -5
- package/src/components/Modal/__snapshots__/index.story.storyshot +2454 -108
- package/src/components/Modal/index.story.tsx +27 -0
- package/src/components/Modal/index.tsx +19 -4
- package/src/components/MultiSelect/__snapshots__/index.story.storyshot +528 -25
- package/src/components/MultiSelect/index.story.tsx +60 -0
- package/src/components/MultiSelect/index.tsx +82 -22
- package/src/components/Radio/__snapshots__/index.story.storyshot +32 -49
- package/src/components/Radio/index.tsx +71 -23
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +18 -19
- package/src/components/SegmentedControl/index.tsx +35 -15
- package/src/components/Switch/__snapshots__/index.story.storyshot +6 -18
- package/src/components/Switch/index.tsx +10 -15
- package/src/components/TagItem/__snapshots__/index.story.storyshot +39 -158
- package/src/components/TagItem/index.tsx +84 -19
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +126 -321
- package/src/components/TextArea/index.tsx +38 -43
- package/src/components/TextField/TextField.story.tsx +35 -19
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +309 -563
- package/src/components/TextField/index.tsx +85 -84
- package/src/components/TextField/useFocusWithClick.tsx +22 -0
package/dist/index.esm.js
CHANGED
|
@@ -50,7 +50,7 @@ function CharcoalProvider({
|
|
|
50
50
|
|
|
51
51
|
// src/components/Button/index.tsx
|
|
52
52
|
import { forwardRef as forwardRef3 } from "react";
|
|
53
|
-
import
|
|
53
|
+
import styled2, { css } from "styled-components";
|
|
54
54
|
|
|
55
55
|
// src/_lib/index.ts
|
|
56
56
|
function unreachable(value) {
|
|
@@ -74,14 +74,9 @@ function countCodePointsInString(string) {
|
|
|
74
74
|
return Array.from(string).length;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
// src/styled.ts
|
|
78
|
-
import styled from "styled-components";
|
|
79
|
-
import { createTheme } from "@charcoal-ui/styled";
|
|
80
|
-
var theme = createTheme(styled);
|
|
81
|
-
|
|
82
77
|
// src/components/Clickable/index.tsx
|
|
83
78
|
import * as React2 from "react";
|
|
84
|
-
import
|
|
79
|
+
import styled from "styled-components";
|
|
85
80
|
import { disabledSelector } from "@charcoal-ui/utils";
|
|
86
81
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
87
82
|
var Clickable = React2.forwardRef(
|
|
@@ -107,7 +102,7 @@ var Clickable = React2.forwardRef(
|
|
|
107
102
|
}
|
|
108
103
|
);
|
|
109
104
|
var Clickable_default = Clickable;
|
|
110
|
-
var StyledClickableDiv =
|
|
105
|
+
var StyledClickableDiv = styled.div`
|
|
111
106
|
cursor: pointer;
|
|
112
107
|
|
|
113
108
|
${disabledSelector} {
|
|
@@ -124,6 +119,7 @@ var StyledClickableDiv = styled2.div`
|
|
|
124
119
|
text-rendering: inherit;
|
|
125
120
|
letter-spacing: inherit;
|
|
126
121
|
word-spacing: inherit;
|
|
122
|
+
text-decoration: none;
|
|
127
123
|
|
|
128
124
|
&:focus {
|
|
129
125
|
outline: none;
|
|
@@ -163,7 +159,8 @@ var Button = forwardRef3(function Button2({
|
|
|
163
159
|
{
|
|
164
160
|
...rest,
|
|
165
161
|
disabled,
|
|
166
|
-
$
|
|
162
|
+
$background: variantToBackground(variant),
|
|
163
|
+
$color: variantToFont(variant),
|
|
167
164
|
$size: size,
|
|
168
165
|
$fullWidth: fixed,
|
|
169
166
|
ref,
|
|
@@ -172,7 +169,15 @@ var Button = forwardRef3(function Button2({
|
|
|
172
169
|
);
|
|
173
170
|
});
|
|
174
171
|
var Button_default = Button;
|
|
175
|
-
var
|
|
172
|
+
var horizontalPaddingSmall = css`
|
|
173
|
+
padding-right: 16px;
|
|
174
|
+
padding-left: 16px;
|
|
175
|
+
`;
|
|
176
|
+
var horizontalPaddingMedium = css`
|
|
177
|
+
padding-right: 24px;
|
|
178
|
+
padding-left: 24px;
|
|
179
|
+
`;
|
|
180
|
+
var StyledButton = styled2(Clickable_default)`
|
|
176
181
|
width: ${(p) => p.$fullWidth ? "stretch" : "min-content"};
|
|
177
182
|
display: inline-grid;
|
|
178
183
|
align-items: center;
|
|
@@ -180,16 +185,40 @@ var StyledButton = styled3(Clickable_default)`
|
|
|
180
185
|
cursor: pointer;
|
|
181
186
|
user-select: none;
|
|
182
187
|
white-space: nowrap;
|
|
188
|
+
border-radius: 999999px;
|
|
189
|
+
font-size: 14px;
|
|
190
|
+
line-height: 22px;
|
|
191
|
+
font-weight: bold;
|
|
183
192
|
|
|
184
|
-
${(p) =>
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
${(p) => p.$size === "M" ? horizontalPaddingMedium : horizontalPaddingSmall}
|
|
194
|
+
|
|
195
|
+
color: var(--charcoal-${(p) => p.$color});
|
|
196
|
+
background-color: var(--charcoal-${(p) => p.$background});
|
|
197
|
+
transition: 0.2s color, 0.2s background-color, 0.2s box-shadow;
|
|
198
|
+
|
|
199
|
+
&:not(:disabled):not([aria-disabled]),
|
|
200
|
+
&[aria-disabled='false'] {
|
|
201
|
+
&:active,
|
|
202
|
+
&:focus,
|
|
203
|
+
&:focus-visible {
|
|
204
|
+
outline: none;
|
|
205
|
+
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
&:hover {
|
|
209
|
+
color: var(--charcoal-${(p) => p.$color}-hover);
|
|
210
|
+
background-color: var(--charcoal-${(p) => p.$background}-hover);
|
|
211
|
+
}
|
|
212
|
+
&:active {
|
|
213
|
+
color: var(--charcoal-${(p) => p.$color}-press);
|
|
214
|
+
background-color: var(--charcoal-${(p) => p.$background}-press);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
&:disabled,
|
|
219
|
+
&[aria-disabled]:not([aria-disabled='false']) {
|
|
220
|
+
opacity: 0.32;
|
|
221
|
+
}
|
|
193
222
|
|
|
194
223
|
/* よく考えたらheight=32って定義が存在しないな... */
|
|
195
224
|
height: ${(p) => p.$size === "M" ? 40 : 32}px;
|
|
@@ -229,63 +258,83 @@ function variantToFont(variant) {
|
|
|
229
258
|
|
|
230
259
|
// src/components/IconButton/index.tsx
|
|
231
260
|
import { forwardRef as forwardRef4 } from "react";
|
|
232
|
-
import
|
|
261
|
+
import styled3 from "styled-components";
|
|
233
262
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
234
263
|
var IconButton = forwardRef4(
|
|
235
264
|
function IconButtonInner({ variant = "Default", size = "M", icon, ...rest }, ref) {
|
|
236
265
|
validateIconSize(size, icon);
|
|
237
|
-
return /* @__PURE__ */ jsx5(StyledIconButton, { ...rest, ref,
|
|
266
|
+
return /* @__PURE__ */ jsx5(StyledIconButton, { ...rest, ref, $size: size, $variant: variant, children: /* @__PURE__ */ jsx5("pixiv-icon", { name: icon }) });
|
|
238
267
|
}
|
|
239
268
|
);
|
|
240
269
|
var IconButton_default = IconButton;
|
|
241
|
-
var StyledIconButton =
|
|
270
|
+
var StyledIconButton = styled3(Clickable_default).attrs(styledProps)`
|
|
242
271
|
user-select: none;
|
|
243
272
|
|
|
244
|
-
width: ${(p) => p
|
|
245
|
-
height: ${(p) => p
|
|
273
|
+
width: ${(p) => p.$width}px;
|
|
274
|
+
height: ${(p) => p.$height}px;
|
|
246
275
|
display: flex;
|
|
247
276
|
align-items: center;
|
|
248
277
|
justify-content: center;
|
|
278
|
+
color: var(${({ $font }) => `--charcoal-${$font}`});
|
|
279
|
+
background-color: var(${({ $background }) => `--charcoal-${$background}`});
|
|
280
|
+
border-radius: 999999px;
|
|
281
|
+
transition: 0.2s background-color, 0.2s box-shadow;
|
|
282
|
+
|
|
283
|
+
&:not(:disabled):not([aria-disabled]),
|
|
284
|
+
&[aria-disabled='false'] {
|
|
285
|
+
&:hover {
|
|
286
|
+
background-color: var(
|
|
287
|
+
${({ $background }) => `--charcoal-${$background}-hover`}
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
&:active {
|
|
291
|
+
background-color: var(
|
|
292
|
+
${({ $background }) => `--charcoal-${$background}-press`}
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
&:focus,
|
|
296
|
+
&:active,
|
|
297
|
+
&:focus-visible {
|
|
298
|
+
outline: none;
|
|
299
|
+
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
249
302
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
o.borderRadius("oval"),
|
|
255
|
-
o.outline.default.focus
|
|
256
|
-
])}
|
|
303
|
+
&:disabled,
|
|
304
|
+
&[aria-disabled]:not([aria-disabled='false']) {
|
|
305
|
+
opacity: 0.32;
|
|
306
|
+
}
|
|
257
307
|
`;
|
|
258
|
-
function styledProps(
|
|
308
|
+
function styledProps({ $size, $variant }) {
|
|
259
309
|
return {
|
|
260
|
-
...
|
|
261
|
-
...
|
|
262
|
-
...sizeToProps(props.size)
|
|
310
|
+
...variantToProps($variant),
|
|
311
|
+
...sizeToProps($size)
|
|
263
312
|
};
|
|
264
313
|
}
|
|
265
314
|
function variantToProps(variant) {
|
|
266
315
|
switch (variant) {
|
|
267
316
|
case "Default":
|
|
268
|
-
return { font: "text3", background: "transparent" };
|
|
317
|
+
return { $font: "text3", $background: "transparent" };
|
|
269
318
|
case "Overlay":
|
|
270
|
-
return { font: "text5", background: "surface4" };
|
|
319
|
+
return { $font: "text5", $background: "surface4" };
|
|
271
320
|
}
|
|
272
321
|
}
|
|
273
322
|
function sizeToProps(size) {
|
|
274
323
|
switch (size) {
|
|
275
324
|
case "XS":
|
|
276
325
|
return {
|
|
277
|
-
width: 20,
|
|
278
|
-
height: 20
|
|
326
|
+
$width: 20,
|
|
327
|
+
$height: 20
|
|
279
328
|
};
|
|
280
329
|
case "S":
|
|
281
330
|
return {
|
|
282
|
-
width: 32,
|
|
283
|
-
height: 32
|
|
331
|
+
$width: 32,
|
|
332
|
+
$height: 32
|
|
284
333
|
};
|
|
285
334
|
case "M":
|
|
286
335
|
return {
|
|
287
|
-
width: 40,
|
|
288
|
-
height: 40
|
|
336
|
+
$width: 40,
|
|
337
|
+
$height: 40
|
|
289
338
|
};
|
|
290
339
|
}
|
|
291
340
|
}
|
|
@@ -315,9 +364,8 @@ function validateIconSize(size, icon) {
|
|
|
315
364
|
// src/components/Radio/index.tsx
|
|
316
365
|
import { memo, forwardRef as forwardRef5, useCallback, useContext as useContext2 } from "react";
|
|
317
366
|
import * as React3 from "react";
|
|
318
|
-
import
|
|
367
|
+
import styled4, { css as css2 } from "styled-components";
|
|
319
368
|
import warning from "warning";
|
|
320
|
-
import { px } from "@charcoal-ui/utils";
|
|
321
369
|
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
322
370
|
var Radio = forwardRef5(function RadioInner({ value, disabled = false, children, className }, ref) {
|
|
323
371
|
const {
|
|
@@ -358,16 +406,19 @@ var Radio = forwardRef5(function RadioInner({ value, disabled = false, children,
|
|
|
358
406
|
] });
|
|
359
407
|
});
|
|
360
408
|
var Radio_default = memo(Radio);
|
|
361
|
-
var RadioRoot =
|
|
409
|
+
var RadioRoot = styled4.label`
|
|
362
410
|
display: grid;
|
|
363
411
|
grid-template-columns: auto 1fr;
|
|
364
|
-
grid-gap:
|
|
412
|
+
grid-gap: 4px;
|
|
365
413
|
align-items: center;
|
|
366
414
|
cursor: pointer;
|
|
367
415
|
|
|
368
|
-
|
|
416
|
+
&:disabled,
|
|
417
|
+
&[aria-disabled]:not([aria-disabled='false']) {
|
|
418
|
+
opacity: 0.32;
|
|
419
|
+
}
|
|
369
420
|
`;
|
|
370
|
-
var RadioInput =
|
|
421
|
+
var RadioInput = styled4.input.attrs({ type: "radio" })`
|
|
371
422
|
/** Make prior to browser default style */
|
|
372
423
|
&[type='radio'] {
|
|
373
424
|
appearance: none;
|
|
@@ -380,46 +431,92 @@ var RadioInput = styled5.input.attrs({ type: "radio" })`
|
|
|
380
431
|
width: 20px;
|
|
381
432
|
height: 20px;
|
|
382
433
|
cursor: pointer;
|
|
434
|
+
border-radius: 999999px;
|
|
435
|
+
background-color: var(--charcoal-surface1);
|
|
436
|
+
transition: 0.2s background-color, 0.2s box-shadow;
|
|
437
|
+
|
|
438
|
+
&:not(:disabled):not([aria-disabled]),
|
|
439
|
+
&[aria-disabled='false'] {
|
|
440
|
+
${({ invalid = false }) => invalid && css2`
|
|
441
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
442
|
+
`}
|
|
383
443
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
444
|
+
&:hover {
|
|
445
|
+
background-color: var(--charcoal-surface1-hover);
|
|
446
|
+
}
|
|
447
|
+
&:active {
|
|
448
|
+
background-color: var(--charcoal-surface1-press);
|
|
449
|
+
}
|
|
450
|
+
&:focus,
|
|
451
|
+
&:active,
|
|
452
|
+
&:focus-visible {
|
|
453
|
+
outline: none;
|
|
454
|
+
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
389
457
|
|
|
390
458
|
&:not(:checked) {
|
|
391
459
|
border-width: 2px;
|
|
392
460
|
border-style: solid;
|
|
393
|
-
border-color:
|
|
461
|
+
border-color: var(--charcoal-text3);
|
|
394
462
|
}
|
|
395
463
|
|
|
396
464
|
&:checked {
|
|
397
|
-
|
|
398
|
-
|
|
465
|
+
background-color: var(--charcoal-brand);
|
|
399
466
|
&::after {
|
|
400
467
|
content: '';
|
|
401
468
|
display: block;
|
|
402
469
|
width: 8px;
|
|
403
470
|
height: 8px;
|
|
404
471
|
pointer-events: none;
|
|
472
|
+
background-color: var(--charcoal-text5);
|
|
473
|
+
border-radius: 999999px;
|
|
474
|
+
transition: 0.2s background-color, 0.2s box-shadow;
|
|
475
|
+
}
|
|
405
476
|
|
|
406
|
-
|
|
477
|
+
&:not(:disabled):not([aria-disabled]),
|
|
478
|
+
&[aria-disabled='false'] {
|
|
479
|
+
&:hover {
|
|
480
|
+
background-color: var(--charcoal-brand-hover);
|
|
481
|
+
&::after {
|
|
482
|
+
background-color: var(--charcoal-text5-hover);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
&:active {
|
|
486
|
+
background-color: var(--charcoal-brand-press);
|
|
487
|
+
&::after {
|
|
488
|
+
background-color: var(--charcoal-text5-press);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
407
491
|
}
|
|
408
492
|
}
|
|
409
|
-
|
|
410
|
-
${theme((o) => o.outline.default.focus)}
|
|
411
|
-
|
|
412
|
-
/* FIXME: o.outline.default.focus の transition に o.bg.brand の transition が打ち消されてしまう */
|
|
413
|
-
transition: all 0.2s !important;
|
|
414
493
|
}
|
|
415
494
|
`;
|
|
416
|
-
var RadioLabel =
|
|
417
|
-
|
|
495
|
+
var RadioLabel = styled4.div`
|
|
496
|
+
font-size: 14px;
|
|
497
|
+
line-height: 22px;
|
|
498
|
+
display: flow-root;
|
|
499
|
+
color: var(--charcoal-text2);
|
|
500
|
+
|
|
501
|
+
&::before {
|
|
502
|
+
display: block;
|
|
503
|
+
width: 0;
|
|
504
|
+
height: 0;
|
|
505
|
+
content: '';
|
|
506
|
+
margin-top: -4px;
|
|
507
|
+
}
|
|
508
|
+
&::after {
|
|
509
|
+
display: block;
|
|
510
|
+
width: 0;
|
|
511
|
+
height: 0;
|
|
512
|
+
content: '';
|
|
513
|
+
margin-bottom: -4px;
|
|
514
|
+
}
|
|
418
515
|
`;
|
|
419
|
-
var StyledRadioGroup =
|
|
516
|
+
var StyledRadioGroup = styled4.div`
|
|
420
517
|
display: grid;
|
|
421
518
|
grid-template-columns: 1fr;
|
|
422
|
-
grid-gap:
|
|
519
|
+
grid-gap: 8px;
|
|
423
520
|
`;
|
|
424
521
|
var RadioGroupContext = React3.createContext({
|
|
425
522
|
name: void 0,
|
|
@@ -478,9 +575,9 @@ function RadioGroup({
|
|
|
478
575
|
|
|
479
576
|
// src/components/MultiSelect/index.tsx
|
|
480
577
|
import { useCallback as useCallback2, useContext as useContext3, forwardRef as forwardRef6, memo as memo2 } from "react";
|
|
481
|
-
import
|
|
578
|
+
import styled5, { css as css3 } from "styled-components";
|
|
482
579
|
import warning2 from "warning";
|
|
483
|
-
import {
|
|
580
|
+
import { px } from "@charcoal-ui/utils";
|
|
484
581
|
|
|
485
582
|
// src/components/MultiSelect/context.ts
|
|
486
583
|
import { createContext as createContext3 } from "react";
|
|
@@ -564,44 +661,96 @@ var MultiSelect = forwardRef6(
|
|
|
564
661
|
}
|
|
565
662
|
);
|
|
566
663
|
var MultiSelect_default = memo2(MultiSelect);
|
|
567
|
-
var MultiSelectRoot =
|
|
664
|
+
var MultiSelectRoot = styled5.label`
|
|
568
665
|
display: grid;
|
|
569
666
|
grid-template-columns: auto 1fr;
|
|
570
667
|
align-items: center;
|
|
571
668
|
position: relative;
|
|
572
669
|
cursor: pointer;
|
|
573
|
-
${
|
|
670
|
+
gap: ${({ theme }) => px(theme.spacing[4])};
|
|
671
|
+
&:disabled,
|
|
672
|
+
&[aria-disabled]:not([aria-disabled='false']) {
|
|
673
|
+
opacity: 0.32;
|
|
574
674
|
cursor: default;
|
|
575
675
|
}
|
|
576
|
-
gap: ${({ theme: theme3 }) => px2(theme3.spacing[4])};
|
|
577
|
-
${theme((o) => o.disabled)}
|
|
578
676
|
`;
|
|
579
|
-
var MultiSelectLabel =
|
|
677
|
+
var MultiSelectLabel = styled5.div`
|
|
580
678
|
display: flex;
|
|
581
679
|
align-items: center;
|
|
582
|
-
|
|
680
|
+
font-size: 14px;
|
|
681
|
+
line-height: 22px;
|
|
682
|
+
display: flow-root;
|
|
683
|
+
color: var(--charcoal-text2);
|
|
684
|
+
|
|
685
|
+
&::before {
|
|
686
|
+
display: block;
|
|
687
|
+
width: 0;
|
|
688
|
+
height: 0;
|
|
689
|
+
content: '';
|
|
690
|
+
margin-top: -4px;
|
|
691
|
+
}
|
|
692
|
+
&::after {
|
|
693
|
+
display: block;
|
|
694
|
+
width: 0;
|
|
695
|
+
height: 0;
|
|
696
|
+
content: '';
|
|
697
|
+
margin-bottom: -4px;
|
|
698
|
+
}
|
|
583
699
|
`;
|
|
584
|
-
var MultiSelectInput =
|
|
700
|
+
var MultiSelectInput = styled5.input.attrs({ type: "checkbox" })`
|
|
585
701
|
&[type='checkbox'] {
|
|
586
702
|
appearance: none;
|
|
587
703
|
display: block;
|
|
588
704
|
width: 20px;
|
|
589
705
|
height: 20px;
|
|
590
706
|
margin: 0;
|
|
707
|
+
background-color: var(--charcoal-text3);
|
|
708
|
+
border-radius: 999999px;
|
|
709
|
+
transition: 0.2s background-color, 0.2s box-shadow;
|
|
591
710
|
|
|
592
711
|
&:checked {
|
|
593
|
-
|
|
712
|
+
background-color: var(--charcoal-brand);
|
|
713
|
+
&:hover {
|
|
714
|
+
&:not(:disabled):not([aria-disabled]),
|
|
715
|
+
&[aria-disabled='false'] {
|
|
716
|
+
background-color: var(--charcoal-brand-hover);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
&:active {
|
|
721
|
+
&:not(:disabled):not([aria-disabled]),
|
|
722
|
+
&[aria-disabled='false'] {
|
|
723
|
+
background-color: var(--charcoal-brand-press);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
&:hover {
|
|
729
|
+
&:not(:disabled):not([aria-disabled]),
|
|
730
|
+
&[aria-disabled='false'] {
|
|
731
|
+
background-color: var(--charcoal-text3-hover);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
&:active {
|
|
736
|
+
&:not(:disabled):not([aria-disabled]),
|
|
737
|
+
&[aria-disabled='false'] {
|
|
738
|
+
background-color: var(--charcoal-text3-press);
|
|
739
|
+
}
|
|
594
740
|
}
|
|
595
741
|
|
|
596
|
-
${({ invalid, overlay }) =>
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
742
|
+
${({ invalid, overlay }) => invalid && !overlay && css3`
|
|
743
|
+
&:not(:disabled):not([aria-disabled]),
|
|
744
|
+
&[aria-disabled='false'] {
|
|
745
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
746
|
+
}
|
|
747
|
+
`}
|
|
748
|
+
${({ overlay }) => overlay && css3`
|
|
749
|
+
background-color: var(--charcoal-surface4);
|
|
750
|
+
`}
|
|
602
751
|
}
|
|
603
752
|
`;
|
|
604
|
-
var MultiSelectInputOverlay =
|
|
753
|
+
var MultiSelectInputOverlay = styled5.div`
|
|
605
754
|
position: absolute;
|
|
606
755
|
top: -2px;
|
|
607
756
|
left: -2px;
|
|
@@ -609,17 +758,20 @@ var MultiSelectInputOverlay = styled6.div`
|
|
|
609
758
|
display: flex;
|
|
610
759
|
align-items: center;
|
|
611
760
|
justify-content: center;
|
|
761
|
+
width: 24px;
|
|
762
|
+
height: 24px;
|
|
763
|
+
border-radius: 999999px;
|
|
764
|
+
color: var(--charcoal-text5);
|
|
765
|
+
transition: 0.2s box-shadow;
|
|
766
|
+
${({ invalid, overlay }) => invalid && overlay && css3`
|
|
767
|
+
&:not(:disabled):not([aria-disabled]),
|
|
768
|
+
&[aria-disabled='false'] {
|
|
769
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
770
|
+
}
|
|
771
|
+
`}
|
|
612
772
|
|
|
613
|
-
${({
|
|
614
|
-
|
|
615
|
-
o.height.px(24),
|
|
616
|
-
o.borderRadius("oval"),
|
|
617
|
-
o.font.text5,
|
|
618
|
-
invalid && overlay && o.outline.assertive
|
|
619
|
-
])}
|
|
620
|
-
|
|
621
|
-
${({ overlay }) => overlay && css`
|
|
622
|
-
border-color: ${({ theme: theme3 }) => theme3.color.text5};
|
|
773
|
+
${({ overlay }) => overlay && css3`
|
|
774
|
+
border-color: var(--charcoal-text5);
|
|
623
775
|
border-width: 2px;
|
|
624
776
|
border-style: solid;
|
|
625
777
|
`}
|
|
@@ -670,8 +822,7 @@ function MultiSelectGroup({
|
|
|
670
822
|
import { useSwitch } from "@react-aria/switch";
|
|
671
823
|
import { useMemo, memo as memo3, forwardRef as forwardRef7 } from "react";
|
|
672
824
|
import { useToggleState } from "react-stately";
|
|
673
|
-
import
|
|
674
|
-
import { disabledSelector as disabledSelector3 } from "@charcoal-ui/utils";
|
|
825
|
+
import styled6 from "styled-components";
|
|
675
826
|
import { useObjectRef } from "@react-aria/utils";
|
|
676
827
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
677
828
|
var SwitchCheckbox = forwardRef7(
|
|
@@ -698,33 +849,30 @@ var SwitchCheckbox = forwardRef7(
|
|
|
698
849
|
}
|
|
699
850
|
);
|
|
700
851
|
var Switch_default = memo3(SwitchCheckbox);
|
|
701
|
-
var Label =
|
|
852
|
+
var Label = styled6.label`
|
|
702
853
|
display: inline-grid;
|
|
703
854
|
grid-template-columns: auto 1fr;
|
|
704
855
|
align-items: center;
|
|
705
856
|
cursor: pointer;
|
|
706
857
|
outline: 0;
|
|
707
858
|
|
|
708
|
-
|
|
859
|
+
&:disabled,
|
|
860
|
+
&[aria-disabled]:not([aria-disabled='false']) {
|
|
861
|
+
opacity: 0.32;
|
|
862
|
+
cursor: default;
|
|
863
|
+
}
|
|
709
864
|
|
|
710
865
|
:active > input {
|
|
711
866
|
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
712
867
|
}
|
|
713
|
-
|
|
714
|
-
${disabledSelector3} {
|
|
715
|
-
cursor: default;
|
|
716
|
-
}
|
|
717
868
|
`;
|
|
718
|
-
var LabelInner =
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
])}
|
|
869
|
+
var LabelInner = styled6.div`
|
|
870
|
+
font-size: 14px;
|
|
871
|
+
line-height: 22px;
|
|
872
|
+
color: var(--charcoal-text2);
|
|
873
|
+
margin-left: 4px;
|
|
724
874
|
`;
|
|
725
|
-
var SwitchInput =
|
|
726
|
-
type: "checkbox"
|
|
727
|
-
})`
|
|
875
|
+
var SwitchInput = styled6.input.attrs({ type: "checkbox" })`
|
|
728
876
|
appearance: none;
|
|
729
877
|
display: inline-flex;
|
|
730
878
|
position: relative;
|
|
@@ -789,14 +937,13 @@ var SwitchInput = styled7.input.attrs({
|
|
|
789
937
|
// src/components/TextField/index.tsx
|
|
790
938
|
import { useTextField } from "@react-aria/textfield";
|
|
791
939
|
import { useVisuallyHidden } from "@react-aria/visually-hidden";
|
|
792
|
-
import { useCallback as useCallback3, useEffect, useRef, useState } from "react";
|
|
940
|
+
import { useCallback as useCallback3, useEffect as useEffect2, useRef, useState } from "react";
|
|
793
941
|
import * as React5 from "react";
|
|
794
|
-
import
|
|
942
|
+
import styled8, { css as css4 } from "styled-components";
|
|
795
943
|
|
|
796
944
|
// src/components/FieldLabel/index.tsx
|
|
797
945
|
import * as React4 from "react";
|
|
798
|
-
import
|
|
799
|
-
import { createTheme as createTheme2 } from "@charcoal-ui/styled";
|
|
946
|
+
import styled7 from "styled-components";
|
|
800
947
|
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
801
948
|
var FieldLabel = React4.forwardRef(
|
|
802
949
|
function FieldLabel2({
|
|
@@ -816,33 +963,119 @@ var FieldLabel = React4.forwardRef(
|
|
|
816
963
|
}
|
|
817
964
|
);
|
|
818
965
|
var FieldLabel_default = FieldLabel;
|
|
819
|
-
var
|
|
820
|
-
|
|
821
|
-
|
|
966
|
+
var Label2 = styled7.label`
|
|
967
|
+
font-size: 14px;
|
|
968
|
+
line-height: 22px;
|
|
969
|
+
font-weight: bold;
|
|
970
|
+
display: flow-root;
|
|
971
|
+
color: var(--charcoal-text1);
|
|
972
|
+
|
|
973
|
+
&::before {
|
|
974
|
+
display: block;
|
|
975
|
+
width: 0;
|
|
976
|
+
height: 0;
|
|
977
|
+
content: '';
|
|
978
|
+
margin-top: -4px;
|
|
979
|
+
}
|
|
980
|
+
&::after {
|
|
981
|
+
display: block;
|
|
982
|
+
width: 0;
|
|
983
|
+
height: 0;
|
|
984
|
+
content: '';
|
|
985
|
+
margin-bottom: -4px;
|
|
986
|
+
}
|
|
822
987
|
`;
|
|
823
|
-
var RequiredText =
|
|
824
|
-
|
|
988
|
+
var RequiredText = styled7.span`
|
|
989
|
+
font-size: 14px;
|
|
990
|
+
line-height: 22px;
|
|
991
|
+
display: flow-root;
|
|
992
|
+
color: var(--charcoal-text2);
|
|
993
|
+
|
|
994
|
+
&::before {
|
|
995
|
+
display: block;
|
|
996
|
+
width: 0;
|
|
997
|
+
height: 0;
|
|
998
|
+
content: '';
|
|
999
|
+
margin-top: -4px;
|
|
1000
|
+
}
|
|
1001
|
+
&::after {
|
|
1002
|
+
display: block;
|
|
1003
|
+
width: 0;
|
|
1004
|
+
height: 0;
|
|
1005
|
+
content: '';
|
|
1006
|
+
margin-bottom: -4px;
|
|
1007
|
+
}
|
|
825
1008
|
`;
|
|
826
|
-
var SubLabelClickable =
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
1009
|
+
var SubLabelClickable = styled7.div`
|
|
1010
|
+
font-size: 14px;
|
|
1011
|
+
line-height: 22px;
|
|
1012
|
+
display: flow-root;
|
|
1013
|
+
color: var(--charcoal-text3);
|
|
1014
|
+
transition: 0.2s color, 0.2s box-shadow;
|
|
1015
|
+
|
|
1016
|
+
&::before {
|
|
1017
|
+
display: block;
|
|
1018
|
+
width: 0;
|
|
1019
|
+
height: 0;
|
|
1020
|
+
content: '';
|
|
1021
|
+
margin-top: -4px;
|
|
1022
|
+
}
|
|
1023
|
+
&::after {
|
|
1024
|
+
display: block;
|
|
1025
|
+
width: 0;
|
|
1026
|
+
height: 0;
|
|
1027
|
+
content: '';
|
|
1028
|
+
margin-bottom: -4px;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
&:not(:disabled):not([aria-disabled]),
|
|
1032
|
+
&[aria-disabled='false'] {
|
|
1033
|
+
&:hover {
|
|
1034
|
+
color: var(--charcoal-text3-hover);
|
|
1035
|
+
}
|
|
1036
|
+
&:active {
|
|
1037
|
+
color: var(--charcoal-text3-press);
|
|
1038
|
+
}
|
|
1039
|
+
&:active,
|
|
1040
|
+
&:focus,
|
|
1041
|
+
&:focus-visible {
|
|
1042
|
+
outline: none;
|
|
1043
|
+
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
832
1046
|
`;
|
|
833
|
-
var FieldLabelWrapper =
|
|
1047
|
+
var FieldLabelWrapper = styled7.div`
|
|
834
1048
|
display: inline-flex;
|
|
835
1049
|
align-items: center;
|
|
836
1050
|
|
|
837
1051
|
> ${RequiredText} {
|
|
838
|
-
|
|
1052
|
+
margin-left: 4px;
|
|
839
1053
|
}
|
|
840
1054
|
|
|
841
1055
|
> ${SubLabelClickable} {
|
|
842
|
-
|
|
1056
|
+
margin-left: auto;
|
|
843
1057
|
}
|
|
844
1058
|
`;
|
|
845
1059
|
|
|
1060
|
+
// src/components/TextField/useFocusWithClick.tsx
|
|
1061
|
+
import { useEffect } from "react";
|
|
1062
|
+
function useFocusWithClick(containerRef, inputRef) {
|
|
1063
|
+
useEffect(() => {
|
|
1064
|
+
const el = containerRef.current;
|
|
1065
|
+
if (el) {
|
|
1066
|
+
const handleDown = (e) => {
|
|
1067
|
+
if (e.target !== inputRef.current) {
|
|
1068
|
+
inputRef.current?.focus();
|
|
1069
|
+
}
|
|
1070
|
+
};
|
|
1071
|
+
el.addEventListener("click", handleDown);
|
|
1072
|
+
return () => {
|
|
1073
|
+
el.removeEventListener("click", handleDown);
|
|
1074
|
+
};
|
|
1075
|
+
}
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
|
|
846
1079
|
// src/components/TextField/index.tsx
|
|
847
1080
|
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
848
1081
|
var TextField = React5.forwardRef(
|
|
@@ -864,13 +1097,9 @@ var TextField = React5.forwardRef(
|
|
|
864
1097
|
} = props;
|
|
865
1098
|
const { visuallyHiddenProps } = useVisuallyHidden();
|
|
866
1099
|
const ariaRef = useRef(null);
|
|
867
|
-
const prefixRef = useRef(null);
|
|
868
|
-
const suffixRef = useRef(null);
|
|
869
1100
|
const [count, setCount] = useState(
|
|
870
1101
|
countCodePointsInString(props.value ?? "")
|
|
871
1102
|
);
|
|
872
|
-
const [prefixWidth, setPrefixWidth] = useState(0);
|
|
873
|
-
const [suffixWidth, setSuffixWidth] = useState(0);
|
|
874
1103
|
const nonControlled = props.value === void 0;
|
|
875
1104
|
const handleChange = useCallback3(
|
|
876
1105
|
(value) => {
|
|
@@ -885,7 +1114,7 @@ var TextField = React5.forwardRef(
|
|
|
885
1114
|
},
|
|
886
1115
|
[maxLength, nonControlled, onChange]
|
|
887
1116
|
);
|
|
888
|
-
|
|
1117
|
+
useEffect2(() => {
|
|
889
1118
|
setCount(countCodePointsInString(props.value ?? ""));
|
|
890
1119
|
}, [props.value]);
|
|
891
1120
|
const { inputProps, labelProps, descriptionProps, errorMessageProps } = useTextField(
|
|
@@ -901,24 +1130,8 @@ var TextField = React5.forwardRef(
|
|
|
901
1130
|
},
|
|
902
1131
|
ariaRef
|
|
903
1132
|
);
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
setPrefixWidth(entries[0].contentRect.width);
|
|
907
|
-
});
|
|
908
|
-
const suffixObserver = new ResizeObserver((entries) => {
|
|
909
|
-
setSuffixWidth(entries[0].contentRect.width);
|
|
910
|
-
});
|
|
911
|
-
if (prefixRef.current !== null) {
|
|
912
|
-
prefixObserver.observe(prefixRef.current);
|
|
913
|
-
}
|
|
914
|
-
if (suffixRef.current !== null) {
|
|
915
|
-
suffixObserver.observe(suffixRef.current);
|
|
916
|
-
}
|
|
917
|
-
return () => {
|
|
918
|
-
suffixObserver.disconnect();
|
|
919
|
-
prefixObserver.disconnect();
|
|
920
|
-
};
|
|
921
|
-
}, []);
|
|
1133
|
+
const containerRef = useRef(null);
|
|
1134
|
+
useFocusWithClick(containerRef, ariaRef);
|
|
922
1135
|
return /* @__PURE__ */ jsxs6(TextFieldRoot, { className, isDisabled: disabled, children: [
|
|
923
1136
|
/* @__PURE__ */ jsx10(
|
|
924
1137
|
TextFieldLabel,
|
|
@@ -931,23 +1144,31 @@ var TextField = React5.forwardRef(
|
|
|
931
1144
|
...!showLabel ? visuallyHiddenProps : {}
|
|
932
1145
|
}
|
|
933
1146
|
),
|
|
934
|
-
/* @__PURE__ */ jsxs6(
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
1147
|
+
/* @__PURE__ */ jsxs6(
|
|
1148
|
+
StyledInputContainer,
|
|
1149
|
+
{
|
|
1150
|
+
ref: containerRef,
|
|
1151
|
+
invalid,
|
|
1152
|
+
"aria-disabled": disabled === true ? true : void 0,
|
|
1153
|
+
hasPrefix: prefix != null,
|
|
1154
|
+
hasSuffix: suffix != null || showCount,
|
|
1155
|
+
children: [
|
|
1156
|
+
prefix && /* @__PURE__ */ jsx10(PrefixContainer, { children: prefix }),
|
|
1157
|
+
/* @__PURE__ */ jsx10(
|
|
1158
|
+
StyledInput,
|
|
1159
|
+
{
|
|
1160
|
+
ref: mergeRefs(forwardRef18, ariaRef),
|
|
1161
|
+
invalid,
|
|
1162
|
+
...inputProps
|
|
1163
|
+
}
|
|
1164
|
+
),
|
|
1165
|
+
(suffix || showCount) && /* @__PURE__ */ jsxs6(SuffixContainer, { children: [
|
|
1166
|
+
suffix,
|
|
1167
|
+
showCount && /* @__PURE__ */ jsx10(SingleLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
1168
|
+
] })
|
|
1169
|
+
]
|
|
1170
|
+
}
|
|
1171
|
+
),
|
|
951
1172
|
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx10(
|
|
952
1173
|
AssistiveText,
|
|
953
1174
|
{
|
|
@@ -960,42 +1181,60 @@ var TextField = React5.forwardRef(
|
|
|
960
1181
|
}
|
|
961
1182
|
);
|
|
962
1183
|
var TextField_default = TextField;
|
|
963
|
-
var TextFieldRoot =
|
|
1184
|
+
var TextFieldRoot = styled8.div`
|
|
964
1185
|
display: flex;
|
|
965
1186
|
flex-direction: column;
|
|
966
1187
|
|
|
967
1188
|
${(p) => p.isDisabled && { opacity: p.theme.elementEffect.disabled.opacity }}
|
|
968
1189
|
`;
|
|
969
|
-
var TextFieldLabel =
|
|
970
|
-
|
|
1190
|
+
var TextFieldLabel = styled8(FieldLabel_default)`
|
|
1191
|
+
margin-bottom: 8px;
|
|
971
1192
|
`;
|
|
972
|
-
var StyledInputContainer =
|
|
973
|
-
height: 40px;
|
|
1193
|
+
var StyledInputContainer = styled8.div`
|
|
974
1194
|
display: grid;
|
|
975
|
-
|
|
1195
|
+
grid-template-columns: ${(p) => [p.hasPrefix && "auto", "1fr", p.hasSuffix && "auto"].filter(Boolean).join(" ")};
|
|
1196
|
+
height: 40px;
|
|
1197
|
+
transition: 0.2s background-color, 0.2s box-shadow;
|
|
1198
|
+
color: var(--charcoal-text2);
|
|
1199
|
+
background-color: var(--charcoal-surface3);
|
|
1200
|
+
border-radius: 4px;
|
|
1201
|
+
gap: 4px;
|
|
1202
|
+
padding: 0 8px;
|
|
1203
|
+
line-height: 22px;
|
|
1204
|
+
font-size: 14px;
|
|
1205
|
+
|
|
1206
|
+
:not(:disabled):not([aria-disabled]):hover,
|
|
1207
|
+
[aria-disabled='false']:hover {
|
|
1208
|
+
background-color: var(--charcoal-surface3-hover);
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
:not(:disabled):not([aria-disabled]):active,
|
|
1212
|
+
[aria-disabled='false']:active {
|
|
1213
|
+
outline: none;
|
|
1214
|
+
box-shadow: 0 0 0 4px
|
|
1215
|
+
${(p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`};
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
:focus-within {
|
|
1219
|
+
outline: none;
|
|
1220
|
+
box-shadow: 0 0 0 4px
|
|
1221
|
+
${(p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`};
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
${(p) => p.invalid && css4`
|
|
1225
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
1226
|
+
`}
|
|
976
1227
|
`;
|
|
977
|
-
var PrefixContainer =
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
left: 8px;
|
|
981
|
-
transform: translateY(-50%);
|
|
982
|
-
z-index: 1;
|
|
1228
|
+
var PrefixContainer = styled8.div`
|
|
1229
|
+
display: flex;
|
|
1230
|
+
align-items: center;
|
|
983
1231
|
`;
|
|
984
|
-
var SuffixContainer =
|
|
985
|
-
position: absolute;
|
|
986
|
-
top: 50%;
|
|
987
|
-
right: 8px;
|
|
988
|
-
transform: translateY(-50%);
|
|
989
|
-
|
|
1232
|
+
var SuffixContainer = styled8.span`
|
|
990
1233
|
display: flex;
|
|
1234
|
+
align-items: center;
|
|
991
1235
|
gap: 8px;
|
|
992
1236
|
`;
|
|
993
|
-
var
|
|
994
|
-
user-select: none;
|
|
995
|
-
|
|
996
|
-
${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text2])}
|
|
997
|
-
`;
|
|
998
|
-
var StyledInput = styled9.input`
|
|
1237
|
+
var StyledInput = styled8.input`
|
|
999
1238
|
border: none;
|
|
1000
1239
|
box-sizing: border-box;
|
|
1001
1240
|
outline: none;
|
|
@@ -1008,41 +1247,37 @@ var StyledInput = styled9.input`
|
|
|
1008
1247
|
height: calc(100% / 0.875);
|
|
1009
1248
|
font-size: calc(14px / 0.875);
|
|
1010
1249
|
line-height: calc(22px / 0.875);
|
|
1011
|
-
padding-left:
|
|
1012
|
-
padding-right:
|
|
1250
|
+
padding-left: 0;
|
|
1251
|
+
padding-right: 0;
|
|
1013
1252
|
border-radius: calc(4px / 0.875);
|
|
1014
1253
|
|
|
1015
1254
|
/* Display box-shadow for iOS Safari */
|
|
1016
1255
|
appearance: none;
|
|
1256
|
+
background: transparent;
|
|
1017
1257
|
|
|
1018
|
-
|
|
1019
|
-
o.bg.surface3.hover,
|
|
1020
|
-
o.outline.default.focus,
|
|
1021
|
-
p.invalid && o.outline.assertive,
|
|
1022
|
-
o.font.text2
|
|
1023
|
-
])}
|
|
1024
|
-
|
|
1258
|
+
color: var(--charcoal-text2);
|
|
1025
1259
|
&::placeholder {
|
|
1026
|
-
|
|
1260
|
+
color: var(--charcoal-text3);
|
|
1027
1261
|
}
|
|
1028
1262
|
`;
|
|
1029
|
-
var SingleLineCounter =
|
|
1030
|
-
|
|
1263
|
+
var SingleLineCounter = styled8.span`
|
|
1264
|
+
line-height: 22px;
|
|
1265
|
+
font-size: 14px;
|
|
1266
|
+
color: var(--charcoal-text3);
|
|
1031
1267
|
`;
|
|
1032
|
-
var AssistiveText =
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
])}
|
|
1268
|
+
var AssistiveText = styled8.p`
|
|
1269
|
+
font-size: 14px;
|
|
1270
|
+
line-height: 22px;
|
|
1271
|
+
margin-top: 4px;
|
|
1272
|
+
margin-bottom: -4px;
|
|
1273
|
+
color: ${(p) => `var(--charcoal-${p.invalid ? `assertive` : `text2`})`};
|
|
1039
1274
|
`;
|
|
1040
1275
|
|
|
1041
1276
|
// src/components/TextArea/index.tsx
|
|
1042
1277
|
import { useTextField as useTextField2 } from "@react-aria/textfield";
|
|
1043
1278
|
import { useVisuallyHidden as useVisuallyHidden2 } from "@react-aria/visually-hidden";
|
|
1044
|
-
import { forwardRef as forwardRef10, useCallback as useCallback4, useEffect as
|
|
1045
|
-
import
|
|
1279
|
+
import { forwardRef as forwardRef10, useCallback as useCallback4, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
|
|
1280
|
+
import styled9, { css as css5 } from "styled-components";
|
|
1046
1281
|
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1047
1282
|
var TextArea = forwardRef10(
|
|
1048
1283
|
function TextAreaInner({ onChange, ...props }, forwardRef18) {
|
|
@@ -1093,7 +1328,7 @@ var TextArea = forwardRef10(
|
|
|
1093
1328
|
},
|
|
1094
1329
|
[autoHeight, maxLength, nonControlled, onChange, syncHeight]
|
|
1095
1330
|
);
|
|
1096
|
-
|
|
1331
|
+
useEffect3(() => {
|
|
1097
1332
|
setCount(countCodePointsInString(props.value ?? ""));
|
|
1098
1333
|
}, [props.value]);
|
|
1099
1334
|
const { inputProps, labelProps, descriptionProps, errorMessageProps } = useTextField2(
|
|
@@ -1109,14 +1344,16 @@ var TextArea = forwardRef10(
|
|
|
1109
1344
|
},
|
|
1110
1345
|
ariaRef
|
|
1111
1346
|
);
|
|
1112
|
-
|
|
1347
|
+
useEffect3(() => {
|
|
1113
1348
|
if (autoHeight && textareaRef.current !== null) {
|
|
1114
1349
|
syncHeight(textareaRef.current);
|
|
1115
1350
|
}
|
|
1116
1351
|
}, [autoHeight, syncHeight]);
|
|
1352
|
+
const containerRef = useRef2(null);
|
|
1353
|
+
useFocusWithClick(containerRef, ariaRef);
|
|
1117
1354
|
return /* @__PURE__ */ jsxs7(TextFieldRoot2, { className, isDisabled: disabled, children: [
|
|
1118
1355
|
/* @__PURE__ */ jsx11(
|
|
1119
|
-
|
|
1356
|
+
TextFieldLabel,
|
|
1120
1357
|
{
|
|
1121
1358
|
label,
|
|
1122
1359
|
requiredText,
|
|
@@ -1129,8 +1366,10 @@ var TextArea = forwardRef10(
|
|
|
1129
1366
|
/* @__PURE__ */ jsxs7(
|
|
1130
1367
|
StyledTextareaContainer,
|
|
1131
1368
|
{
|
|
1369
|
+
ref: containerRef,
|
|
1132
1370
|
invalid,
|
|
1133
1371
|
rows: showCount ? rows + 1 : rows,
|
|
1372
|
+
"aria-disabled": disabled === true ? "true" : void 0,
|
|
1134
1373
|
children: [
|
|
1135
1374
|
/* @__PURE__ */ jsx11(
|
|
1136
1375
|
StyledTextarea,
|
|
@@ -1146,7 +1385,7 @@ var TextArea = forwardRef10(
|
|
|
1146
1385
|
}
|
|
1147
1386
|
),
|
|
1148
1387
|
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx11(
|
|
1149
|
-
|
|
1388
|
+
AssistiveText,
|
|
1150
1389
|
{
|
|
1151
1390
|
invalid,
|
|
1152
1391
|
...invalid ? errorMessageProps : descriptionProps,
|
|
@@ -1157,42 +1396,46 @@ var TextArea = forwardRef10(
|
|
|
1157
1396
|
}
|
|
1158
1397
|
);
|
|
1159
1398
|
var TextArea_default = TextArea;
|
|
1160
|
-
var TextFieldRoot2 =
|
|
1399
|
+
var TextFieldRoot2 = styled9.div`
|
|
1161
1400
|
display: flex;
|
|
1162
1401
|
flex-direction: column;
|
|
1163
1402
|
|
|
1164
1403
|
${(p) => p.isDisabled && { opacity: p.theme.elementEffect.disabled.opacity }}
|
|
1165
1404
|
`;
|
|
1166
|
-
var
|
|
1167
|
-
${theme((o) => o.margin.bottom(8))}
|
|
1168
|
-
`;
|
|
1169
|
-
var StyledTextareaContainer = styled10.div`
|
|
1405
|
+
var StyledTextareaContainer = styled9.div`
|
|
1170
1406
|
position: relative;
|
|
1171
1407
|
overflow: hidden;
|
|
1172
|
-
padding: 0 8px;
|
|
1173
1408
|
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
o.font.text2,
|
|
1179
|
-
o.borderRadius(4)
|
|
1180
|
-
])}
|
|
1409
|
+
color: var(--charcoal-text2);
|
|
1410
|
+
background-color: var(--charcoal-surface3);
|
|
1411
|
+
border-radius: 4px;
|
|
1412
|
+
transition: 0.2s background-color, 0.2s box-shadow;
|
|
1181
1413
|
|
|
1182
|
-
|
|
1183
|
-
${(p) => theme((o) => p.invalid ? o.outline.assertive : o.outline.default)}
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
${({ rows }) => css2`
|
|
1414
|
+
${({ rows }) => css5`
|
|
1187
1415
|
height: calc(22px * ${rows} + 18px);
|
|
1188
1416
|
`};
|
|
1417
|
+
|
|
1418
|
+
:not([aria-disabled]):hover,
|
|
1419
|
+
[aria-disabled='false']:hover {
|
|
1420
|
+
background-color: var(--charcoal-surface3-hover);
|
|
1421
|
+
}
|
|
1422
|
+
:focus-within {
|
|
1423
|
+
outline: none;
|
|
1424
|
+
box-shadow: 0 0 0 4px
|
|
1425
|
+
${(p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`};
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
${(p) => p.invalid && css5`
|
|
1429
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
1430
|
+
`}
|
|
1189
1431
|
`;
|
|
1190
|
-
var StyledTextarea =
|
|
1432
|
+
var StyledTextarea = styled9.textarea`
|
|
1191
1433
|
border: none;
|
|
1192
1434
|
outline: none;
|
|
1193
1435
|
resize: none;
|
|
1194
1436
|
font-family: inherit;
|
|
1195
1437
|
color: inherit;
|
|
1438
|
+
box-sizing: border-box;
|
|
1196
1439
|
|
|
1197
1440
|
/* Prevent zooming for iOS Safari */
|
|
1198
1441
|
transform-origin: top left;
|
|
@@ -1200,10 +1443,11 @@ var StyledTextarea = styled10.textarea`
|
|
|
1200
1443
|
width: calc(100% / 0.875);
|
|
1201
1444
|
font-size: calc(14px / 0.875);
|
|
1202
1445
|
line-height: calc(22px / 0.875);
|
|
1203
|
-
padding: calc(9px / 0.875)
|
|
1446
|
+
padding: calc(9px / 0.875) calc(8px / 0.875)
|
|
1447
|
+
${(p) => p.noBottomPadding ? 0 : ""};
|
|
1204
1448
|
|
|
1205
|
-
${({ rows = 1 }) =>
|
|
1206
|
-
height: calc(22px / 0.875 * ${rows});
|
|
1449
|
+
${({ rows = 1, noBottomPadding }) => css5`
|
|
1450
|
+
height: calc(22px / 0.875 * ${rows} + ${noBottomPadding ? 9 : 20}px);
|
|
1207
1451
|
`};
|
|
1208
1452
|
|
|
1209
1453
|
/* Display box-shadow for iOS Safari */
|
|
@@ -1212,31 +1456,17 @@ var StyledTextarea = styled10.textarea`
|
|
|
1212
1456
|
background: none;
|
|
1213
1457
|
|
|
1214
1458
|
&::placeholder {
|
|
1215
|
-
|
|
1459
|
+
color: var(--charcoal-text3);
|
|
1216
1460
|
}
|
|
1217
|
-
|
|
1218
|
-
/* Hide scrollbar for Chrome, Safari and Opera */
|
|
1219
|
-
&::-webkit-scrollbar {
|
|
1220
|
-
display: none;
|
|
1221
|
-
}
|
|
1222
|
-
/* Hide scrollbar for IE, Edge and Firefox */
|
|
1223
|
-
-ms-overflow-style: none; /* IE and Edge */
|
|
1224
|
-
scrollbar-width: none; /* Firefox */
|
|
1225
1461
|
`;
|
|
1226
|
-
var MultiLineCounter =
|
|
1462
|
+
var MultiLineCounter = styled9.span`
|
|
1227
1463
|
position: absolute;
|
|
1228
1464
|
bottom: 9px;
|
|
1229
1465
|
right: 8px;
|
|
1230
1466
|
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
var
|
|
1234
|
-
${(p) => theme((o) => [
|
|
1235
|
-
o.typography(14),
|
|
1236
|
-
o.margin.top(8),
|
|
1237
|
-
o.margin.bottom(0),
|
|
1238
|
-
o.font[p.invalid ? "assertive" : "text1"]
|
|
1239
|
-
])}
|
|
1467
|
+
line-height: 22px;
|
|
1468
|
+
font-size: 14px;
|
|
1469
|
+
color: var(--charcoal-text3);
|
|
1240
1470
|
`;
|
|
1241
1471
|
|
|
1242
1472
|
// src/components/Icon/index.tsx
|
|
@@ -1265,7 +1495,7 @@ import {
|
|
|
1265
1495
|
Overlay,
|
|
1266
1496
|
useModalOverlay
|
|
1267
1497
|
} from "@react-aria/overlays";
|
|
1268
|
-
import
|
|
1498
|
+
import styled11, { css as css7, useTheme } from "styled-components";
|
|
1269
1499
|
import { maxWidth as maxWidth2 } from "@charcoal-ui/utils";
|
|
1270
1500
|
import { useMedia } from "@charcoal-ui/styled";
|
|
1271
1501
|
import { animated as animated2, useTransition, easings } from "react-spring";
|
|
@@ -1273,7 +1503,7 @@ import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
|
|
|
1273
1503
|
|
|
1274
1504
|
// src/components/Modal/Dialog/index.tsx
|
|
1275
1505
|
import { forwardRef as forwardRef12 } from "react";
|
|
1276
|
-
import
|
|
1506
|
+
import styled10, { css as css6 } from "styled-components";
|
|
1277
1507
|
import { useDialog } from "@react-aria/dialog";
|
|
1278
1508
|
|
|
1279
1509
|
// ../foundation/src/grid.ts
|
|
@@ -1325,7 +1555,7 @@ var Dialog = forwardRef12(function Dialog2(props, forwardRef18) {
|
|
|
1325
1555
|
}
|
|
1326
1556
|
);
|
|
1327
1557
|
});
|
|
1328
|
-
var AnimatedStyledDialogDiv = animated(
|
|
1558
|
+
var AnimatedStyledDialogDiv = animated(styled10.div`
|
|
1329
1559
|
margin: auto;
|
|
1330
1560
|
position: relative;
|
|
1331
1561
|
height: fit-content;
|
|
@@ -1346,18 +1576,18 @@ var AnimatedStyledDialogDiv = animated(styled11.div`
|
|
|
1346
1576
|
}
|
|
1347
1577
|
}}px;
|
|
1348
1578
|
|
|
1349
|
-
background-color:
|
|
1579
|
+
background-color: var(--charcoal-surface1);
|
|
1350
1580
|
border-radius: 24px;
|
|
1351
1581
|
|
|
1352
|
-
@media ${({ theme
|
|
1582
|
+
@media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {
|
|
1353
1583
|
max-width: 440px;
|
|
1354
1584
|
width: calc(100% - 48px);
|
|
1355
|
-
${(p) => p.bottomSheet !== false &&
|
|
1585
|
+
${(p) => p.bottomSheet !== false && css6`
|
|
1356
1586
|
max-width: unset;
|
|
1357
1587
|
width: 100%;
|
|
1358
1588
|
border-radius: 0;
|
|
1359
1589
|
margin: auto 0 0 0;
|
|
1360
|
-
${p.bottomSheet === "full" &&
|
|
1590
|
+
${p.bottomSheet === "full" && css6`
|
|
1361
1591
|
min-height: 100%;
|
|
1362
1592
|
`}
|
|
1363
1593
|
`}
|
|
@@ -1388,7 +1618,10 @@ var Modal = forwardRef13(function ModalInner({ children, zIndex = DEFAULT_Z_INDE
|
|
|
1388
1618
|
} = props;
|
|
1389
1619
|
const ref = useObjectRef2(external);
|
|
1390
1620
|
const { modalProps, underlayProps } = useModalOverlay(
|
|
1391
|
-
|
|
1621
|
+
{
|
|
1622
|
+
...props,
|
|
1623
|
+
isKeyboardDismissDisabled: isDismissable === void 0 || isDismissable === false
|
|
1624
|
+
},
|
|
1392
1625
|
{
|
|
1393
1626
|
close: onClose,
|
|
1394
1627
|
isOpen,
|
|
@@ -1401,8 +1634,8 @@ var Modal = forwardRef13(function ModalInner({ children, zIndex = DEFAULT_Z_INDE
|
|
|
1401
1634
|
},
|
|
1402
1635
|
ref
|
|
1403
1636
|
);
|
|
1404
|
-
const
|
|
1405
|
-
const isMobile = useMedia(maxWidth2(
|
|
1637
|
+
const theme = useTheme();
|
|
1638
|
+
const isMobile = useMedia(maxWidth2(theme.breakpoint.screen1)) ?? false;
|
|
1406
1639
|
const transitionEnabled = isMobile && bottomSheet !== false;
|
|
1407
1640
|
const showDismiss = !isMobile || bottomSheet !== true;
|
|
1408
1641
|
const transition = useTransition(isOpen, {
|
|
@@ -1481,7 +1714,7 @@ var ModalContext = React9.createContext({
|
|
|
1481
1714
|
showDismiss: true,
|
|
1482
1715
|
bottomSheet: false
|
|
1483
1716
|
});
|
|
1484
|
-
var ModalBackground = animated2(
|
|
1717
|
+
var ModalBackground = animated2(styled11.div`
|
|
1485
1718
|
z-index: ${({ zIndex }) => zIndex};
|
|
1486
1719
|
overflow: auto;
|
|
1487
1720
|
display: flex;
|
|
@@ -1495,33 +1728,44 @@ var ModalBackground = animated2(styled12.div`
|
|
|
1495
1728
|
padding: 40px 0;
|
|
1496
1729
|
box-sizing: border-box;
|
|
1497
1730
|
|
|
1498
|
-
background-color:
|
|
1731
|
+
background-color: var(--charcoal-surface4);
|
|
1499
1732
|
|
|
1500
|
-
@media ${({ theme
|
|
1501
|
-
${(p) => p.$bottomSheet !== false &&
|
|
1733
|
+
@media ${({ theme }) => maxWidth2(theme.breakpoint.screen1)} {
|
|
1734
|
+
${(p) => p.$bottomSheet !== false && css7`
|
|
1502
1735
|
padding: 0;
|
|
1503
1736
|
`}
|
|
1504
1737
|
}
|
|
1505
1738
|
`);
|
|
1506
|
-
var ModalCrossButton =
|
|
1739
|
+
var ModalCrossButton = styled11(IconButton_default)`
|
|
1507
1740
|
position: absolute;
|
|
1508
1741
|
top: 8px;
|
|
1509
1742
|
right: 8px;
|
|
1510
1743
|
|
|
1511
|
-
|
|
1744
|
+
color: var(--charcoal-text3);
|
|
1745
|
+
transition: 0.2s color;
|
|
1746
|
+
|
|
1747
|
+
&:not(:disabled):not([aria-disabled]),
|
|
1748
|
+
&[aria-disabled='false'] {
|
|
1749
|
+
&:hover {
|
|
1750
|
+
color: var(--charcoal-text3-hover);
|
|
1751
|
+
}
|
|
1752
|
+
&:active {
|
|
1753
|
+
color: var(--charcoal-text3-press);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1512
1756
|
`;
|
|
1513
1757
|
function ModalTitle(props) {
|
|
1514
1758
|
const { titleProps, title } = useContext4(ModalContext);
|
|
1515
1759
|
return /* @__PURE__ */ jsx14(ModalHeading, { ...titleProps, ...props, children: title });
|
|
1516
1760
|
}
|
|
1517
|
-
var ModalHeading =
|
|
1761
|
+
var ModalHeading = styled11.h3`
|
|
1518
1762
|
margin: 0;
|
|
1519
1763
|
font-weight: inherit;
|
|
1520
1764
|
font-size: inherit;
|
|
1521
1765
|
`;
|
|
1522
1766
|
|
|
1523
1767
|
// src/components/Modal/ModalPlumbing.tsx
|
|
1524
|
-
import
|
|
1768
|
+
import styled12, { css as css8 } from "styled-components";
|
|
1525
1769
|
import { useContext as useContext5 } from "react";
|
|
1526
1770
|
import { maxWidth as maxWidth3 } from "@charcoal-ui/utils";
|
|
1527
1771
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
@@ -1529,37 +1773,59 @@ function ModalHeader() {
|
|
|
1529
1773
|
const modalCtx = useContext5(ModalContext);
|
|
1530
1774
|
return /* @__PURE__ */ jsx15(ModalHeaderRoot, { $bottomSheet: modalCtx.bottomSheet, children: /* @__PURE__ */ jsx15(StyledModalTitle, {}) });
|
|
1531
1775
|
}
|
|
1532
|
-
var ModalHeaderRoot =
|
|
1776
|
+
var ModalHeaderRoot = styled12.div`
|
|
1533
1777
|
height: 64px;
|
|
1534
1778
|
display: grid;
|
|
1535
1779
|
align-content: center;
|
|
1536
1780
|
justify-content: center;
|
|
1537
|
-
@media ${({ theme
|
|
1538
|
-
${(p) => p.$bottomSheet !== false &&
|
|
1781
|
+
@media ${({ theme }) => maxWidth3(theme.breakpoint.screen1)} {
|
|
1782
|
+
${(p) => p.$bottomSheet !== false && css8`
|
|
1539
1783
|
height: 48px;
|
|
1540
1784
|
`}
|
|
1541
1785
|
}
|
|
1542
1786
|
`;
|
|
1543
|
-
var StyledModalTitle =
|
|
1544
|
-
|
|
1787
|
+
var StyledModalTitle = styled12(ModalTitle)`
|
|
1788
|
+
color: var(--charcoal-text1);
|
|
1789
|
+
font-size: 16px;
|
|
1790
|
+
line-height: 24px;
|
|
1791
|
+
font-weight: bold;
|
|
1792
|
+
display: flow-root;
|
|
1793
|
+
|
|
1794
|
+
&::before {
|
|
1795
|
+
display: block;
|
|
1796
|
+
width: 0;
|
|
1797
|
+
height: 0;
|
|
1798
|
+
content: '';
|
|
1799
|
+
margin-top: -4px;
|
|
1800
|
+
}
|
|
1801
|
+
&::after {
|
|
1802
|
+
display: block;
|
|
1803
|
+
width: 0;
|
|
1804
|
+
height: 0;
|
|
1805
|
+
content: '';
|
|
1806
|
+
margin-bottom: -4px;
|
|
1807
|
+
}
|
|
1545
1808
|
`;
|
|
1546
|
-
var ModalAlign =
|
|
1547
|
-
|
|
1809
|
+
var ModalAlign = styled12.div`
|
|
1810
|
+
padding-left: 16px;
|
|
1811
|
+
padding-right: 16px;
|
|
1548
1812
|
`;
|
|
1549
|
-
var ModalBody =
|
|
1550
|
-
|
|
1813
|
+
var ModalBody = styled12.div`
|
|
1814
|
+
padding-bottom: 40px;
|
|
1551
1815
|
`;
|
|
1552
|
-
var ModalButtons =
|
|
1816
|
+
var ModalButtons = styled12.div`
|
|
1553
1817
|
display: grid;
|
|
1554
1818
|
grid-auto-flow: row;
|
|
1555
1819
|
grid-row-gap: 8px;
|
|
1556
1820
|
|
|
1557
|
-
|
|
1821
|
+
padding-top: 16px;
|
|
1822
|
+
padding-left: 16px;
|
|
1823
|
+
padding-right: 16px;
|
|
1558
1824
|
`;
|
|
1559
1825
|
|
|
1560
1826
|
// src/components/LoadingSpinner/index.tsx
|
|
1561
1827
|
import { forwardRef as forwardRef14, useImperativeHandle, useRef as useRef5, memo as memo5 } from "react";
|
|
1562
|
-
import
|
|
1828
|
+
import styled13, { keyframes } from "styled-components";
|
|
1563
1829
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1564
1830
|
var LoadingSpinner = forwardRef14(
|
|
1565
1831
|
function LoadingSpinnerInner({ size = 48, padding = 16, transparent = false, className }, ref) {
|
|
@@ -1577,7 +1843,7 @@ var LoadingSpinner = forwardRef14(
|
|
|
1577
1843
|
}
|
|
1578
1844
|
);
|
|
1579
1845
|
var LoadingSpinner_default = memo5(LoadingSpinner);
|
|
1580
|
-
var LoadingSpinnerRoot =
|
|
1846
|
+
var LoadingSpinnerRoot = styled13.div.attrs({ role: "progressbar" })`
|
|
1581
1847
|
box-sizing: content-box;
|
|
1582
1848
|
margin: auto;
|
|
1583
1849
|
padding: ${(props) => props.padding}px;
|
|
@@ -1586,10 +1852,8 @@ var LoadingSpinnerRoot = styled14.div.attrs({ role: "progressbar" })`
|
|
|
1586
1852
|
width: ${(props) => props.size}px;
|
|
1587
1853
|
height: ${(props) => props.size}px;
|
|
1588
1854
|
opacity: 0.84;
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
transparent ? o.bg.transparent : o.bg.background1
|
|
1592
|
-
])}
|
|
1855
|
+
color: var(--charcoal-text4);
|
|
1856
|
+
background-color: ${({ transparent }) => `var(--charcoal-${transparent ? "transparent" : "background1"})`};
|
|
1593
1857
|
`;
|
|
1594
1858
|
var scaleOut = keyframes`
|
|
1595
1859
|
from {
|
|
@@ -1602,7 +1866,7 @@ var scaleOut = keyframes`
|
|
|
1602
1866
|
opacity: 0;
|
|
1603
1867
|
}
|
|
1604
1868
|
`;
|
|
1605
|
-
var Icon2 =
|
|
1869
|
+
var Icon2 = styled13.div.attrs({ role: "presentation" })`
|
|
1606
1870
|
width: 1em;
|
|
1607
1871
|
height: 1em;
|
|
1608
1872
|
border-radius: 1em;
|
|
@@ -1633,21 +1897,21 @@ var LoadingSpinnerIcon = forwardRef14(
|
|
|
1633
1897
|
|
|
1634
1898
|
// src/components/DropdownSelector/index.tsx
|
|
1635
1899
|
import { useState as useState3, useRef as useRef9 } from "react";
|
|
1636
|
-
import
|
|
1637
|
-
import { disabledSelector as
|
|
1900
|
+
import styled16, { css as css9 } from "styled-components";
|
|
1901
|
+
import { disabledSelector as disabledSelector2 } from "@charcoal-ui/utils";
|
|
1638
1902
|
|
|
1639
1903
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
1640
|
-
import { useEffect as
|
|
1904
|
+
import { useEffect as useEffect6, useRef as useRef7 } from "react";
|
|
1641
1905
|
|
|
1642
1906
|
// src/components/DropdownSelector/Popover/index.tsx
|
|
1643
1907
|
import { useContext as useContext6, useRef as useRef6 } from "react";
|
|
1644
1908
|
import { DismissButton, Overlay as Overlay2, usePopover } from "@react-aria/overlays";
|
|
1645
|
-
import
|
|
1909
|
+
import styled14 from "styled-components";
|
|
1646
1910
|
|
|
1647
1911
|
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
1648
|
-
import { useEffect as
|
|
1912
|
+
import { useEffect as useEffect5 } from "react";
|
|
1649
1913
|
function usePreventScroll(element, isOpen) {
|
|
1650
|
-
|
|
1914
|
+
useEffect5(() => {
|
|
1651
1915
|
if (isOpen && element) {
|
|
1652
1916
|
const defaultPaddingRight = element.style.paddingRight;
|
|
1653
1917
|
const defaultOverflow = element.style.overflow;
|
|
@@ -1704,30 +1968,28 @@ function Popover(props) {
|
|
|
1704
1968
|
] })
|
|
1705
1969
|
] });
|
|
1706
1970
|
}
|
|
1707
|
-
var DropdownPopoverDiv =
|
|
1971
|
+
var DropdownPopoverDiv = styled14.div`
|
|
1708
1972
|
margin: 4px 0;
|
|
1709
1973
|
list-style: none;
|
|
1710
1974
|
overflow: auto;
|
|
1711
1975
|
max-height: inherit;
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
o.padding.vertical(8)
|
|
1718
|
-
])}
|
|
1976
|
+
background-color: var(--charcoal-background1);
|
|
1977
|
+
border: solid 1px var(--charcoal-border-default);
|
|
1978
|
+
border-radius: 8px;
|
|
1979
|
+
padding-top: 8px;
|
|
1980
|
+
padding-bottom: 8px;
|
|
1719
1981
|
`;
|
|
1720
1982
|
|
|
1721
1983
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
1722
1984
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1723
1985
|
function DropdownPopover({ children, ...props }) {
|
|
1724
1986
|
const ref = useRef7(null);
|
|
1725
|
-
|
|
1987
|
+
useEffect6(() => {
|
|
1726
1988
|
if (props.isOpen && ref.current && props.triggerRef.current) {
|
|
1727
1989
|
ref.current.style.width = `${props.triggerRef.current.clientWidth}px`;
|
|
1728
1990
|
}
|
|
1729
1991
|
}, [props.triggerRef, props.isOpen]);
|
|
1730
|
-
|
|
1992
|
+
useEffect6(() => {
|
|
1731
1993
|
if (props.isOpen && props.value !== void 0) {
|
|
1732
1994
|
const windowScrollY = window.scrollY;
|
|
1733
1995
|
const windowScrollX = window.scrollX;
|
|
@@ -1779,7 +2041,7 @@ function findPreviewRecursive(children, value) {
|
|
|
1779
2041
|
|
|
1780
2042
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
1781
2043
|
import { useRef as useRef8 } from "react";
|
|
1782
|
-
import
|
|
2044
|
+
import styled15 from "styled-components";
|
|
1783
2045
|
|
|
1784
2046
|
// src/components/DropdownSelector/MenuList/MenuListContext.ts
|
|
1785
2047
|
import { createContext as createContext6 } from "react";
|
|
@@ -1831,7 +2093,7 @@ function MenuList(props) {
|
|
|
1831
2093
|
}
|
|
1832
2094
|
) });
|
|
1833
2095
|
}
|
|
1834
|
-
var StyledUl =
|
|
2096
|
+
var StyledUl = styled15.ul`
|
|
1835
2097
|
padding: 0;
|
|
1836
2098
|
margin: 0;
|
|
1837
2099
|
`;
|
|
@@ -1894,21 +2156,20 @@ function DropdownSelector(props) {
|
|
|
1894
2156
|
props.assistiveText !== void 0 && /* @__PURE__ */ jsx20(AssertiveText, { invalid: props.invalid, children: props.assistiveText })
|
|
1895
2157
|
] });
|
|
1896
2158
|
}
|
|
1897
|
-
var DropdownSelectorRoot =
|
|
2159
|
+
var DropdownSelectorRoot = styled16.div`
|
|
1898
2160
|
display: inline-block;
|
|
1899
2161
|
width: 100%;
|
|
1900
2162
|
|
|
1901
|
-
${
|
|
2163
|
+
${disabledSelector2} {
|
|
1902
2164
|
cursor: default;
|
|
1903
|
-
|
|
2165
|
+
opacity: 0.32;
|
|
1904
2166
|
}
|
|
1905
2167
|
`;
|
|
1906
|
-
var DropdownFieldLabel =
|
|
2168
|
+
var DropdownFieldLabel = styled16(FieldLabel_default)`
|
|
1907
2169
|
width: 100%;
|
|
1908
|
-
|
|
1909
|
-
${theme((o) => o.margin.bottom(8))}
|
|
2170
|
+
margin-bottom: 8px;
|
|
1910
2171
|
`;
|
|
1911
|
-
var DropdownButton =
|
|
2172
|
+
var DropdownButton = styled16.button`
|
|
1912
2173
|
display: flex;
|
|
1913
2174
|
justify-content: space-between;
|
|
1914
2175
|
align-items: center;
|
|
@@ -1919,64 +2180,117 @@ var DropdownButton = styled17.button`
|
|
|
1919
2180
|
border: none;
|
|
1920
2181
|
cursor: pointer;
|
|
1921
2182
|
|
|
1922
|
-
${
|
|
2183
|
+
${disabledSelector2} {
|
|
1923
2184
|
cursor: default;
|
|
1924
2185
|
}
|
|
1925
2186
|
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
2187
|
+
padding-right: 8px;
|
|
2188
|
+
padding-left: 8px;
|
|
2189
|
+
background-color: var(--charcoal-surface3);
|
|
2190
|
+
border-radius: 4px;
|
|
2191
|
+
|
|
2192
|
+
transition: 0.2s box-shadow;
|
|
2193
|
+
|
|
2194
|
+
&:not(:disabled):not([aria-disabled]),
|
|
2195
|
+
&[aria-disabled='false'] {
|
|
2196
|
+
&:focus,
|
|
2197
|
+
&:active,
|
|
2198
|
+
&:focus-visible {
|
|
2199
|
+
outline: none;
|
|
2200
|
+
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
${({ invalid }) => invalid === true && css9`
|
|
2205
|
+
&:not(:disabled):not([aria-disabled]),
|
|
2206
|
+
&[aria-disabled='false'] {
|
|
2207
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
2208
|
+
}
|
|
2209
|
+
`}
|
|
1933
2210
|
`;
|
|
1934
|
-
var DropdownButtonText =
|
|
2211
|
+
var DropdownButtonText = styled16.span`
|
|
1935
2212
|
text-align: left;
|
|
1936
|
-
|
|
1937
|
-
|
|
2213
|
+
font-size: 14px;
|
|
2214
|
+
line-height: 22px;
|
|
2215
|
+
display: flow-root;
|
|
2216
|
+
color: var(--charcoal-text2);
|
|
2217
|
+
&::before {
|
|
2218
|
+
display: block;
|
|
2219
|
+
width: 0;
|
|
2220
|
+
height: 0;
|
|
2221
|
+
content: '';
|
|
2222
|
+
margin-top: -4px;
|
|
2223
|
+
}
|
|
2224
|
+
&::after {
|
|
2225
|
+
display: block;
|
|
2226
|
+
width: 0;
|
|
2227
|
+
height: 0;
|
|
2228
|
+
content: '';
|
|
2229
|
+
margin-bottom: -4px;
|
|
2230
|
+
}
|
|
1938
2231
|
`;
|
|
1939
|
-
var DropdownButtonIcon =
|
|
1940
|
-
|
|
2232
|
+
var DropdownButtonIcon = styled16(Icon_default)`
|
|
2233
|
+
color: var(--charcoal-text2);
|
|
1941
2234
|
`;
|
|
1942
|
-
var AssertiveText =
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
2235
|
+
var AssertiveText = styled16.div`
|
|
2236
|
+
margin-top: 8px;
|
|
2237
|
+
font-size: 14px;
|
|
2238
|
+
color: var(--charcoal-text2);
|
|
2239
|
+
line-height: 22px;
|
|
2240
|
+
display: flow-root;
|
|
2241
|
+
&::before {
|
|
2242
|
+
display: block;
|
|
2243
|
+
width: 0;
|
|
2244
|
+
height: 0;
|
|
2245
|
+
content: '';
|
|
2246
|
+
margin-top: -4px;
|
|
2247
|
+
}
|
|
2248
|
+
&::after {
|
|
2249
|
+
display: block;
|
|
2250
|
+
width: 0;
|
|
2251
|
+
height: 0;
|
|
2252
|
+
content: '';
|
|
2253
|
+
margin-bottom: -4px;
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
${({ invalid }) => invalid === true && css9`
|
|
2257
|
+
color: var(--charcoal-assertive);
|
|
2258
|
+
`}
|
|
1948
2259
|
`;
|
|
1949
2260
|
|
|
1950
2261
|
// src/components/DropdownSelector/DropdownMenuItem.tsx
|
|
1951
|
-
import
|
|
2262
|
+
import styled18 from "styled-components";
|
|
1952
2263
|
|
|
1953
2264
|
// src/components/DropdownSelector/ListItem/index.tsx
|
|
1954
|
-
import
|
|
2265
|
+
import styled17 from "styled-components";
|
|
1955
2266
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1956
2267
|
function ListItem(props) {
|
|
1957
2268
|
const { children, ...rest } = props;
|
|
1958
2269
|
return /* @__PURE__ */ jsx21(StyledLi, { role: "option", children: /* @__PURE__ */ jsx21(ItemDiv, { ...rest, children: props.children }) });
|
|
1959
2270
|
}
|
|
1960
|
-
var StyledLi =
|
|
2271
|
+
var StyledLi = styled17.li`
|
|
1961
2272
|
list-style: none;
|
|
1962
2273
|
`;
|
|
1963
|
-
var ItemDiv =
|
|
2274
|
+
var ItemDiv = styled17.div`
|
|
1964
2275
|
display: flex;
|
|
1965
2276
|
align-items: center;
|
|
1966
2277
|
min-height: 40px;
|
|
1967
2278
|
cursor: pointer;
|
|
1968
2279
|
outline: none;
|
|
1969
2280
|
|
|
1970
|
-
|
|
2281
|
+
padding-right: 16px;
|
|
2282
|
+
padding-left: 16px;
|
|
1971
2283
|
|
|
1972
|
-
|
|
2284
|
+
&:disabled,
|
|
2285
|
+
&[aria-disabled]:not([aria-disabled='false']) {
|
|
2286
|
+
opacity: 0.32;
|
|
1973
2287
|
cursor: default;
|
|
1974
2288
|
}
|
|
1975
2289
|
|
|
1976
2290
|
:hover,
|
|
1977
2291
|
:focus,
|
|
1978
2292
|
:focus-within {
|
|
1979
|
-
|
|
2293
|
+
background-color: var(--charcoal-surface3);
|
|
1980
2294
|
}
|
|
1981
2295
|
`;
|
|
1982
2296
|
|
|
@@ -2077,20 +2391,37 @@ function DropdownMenuItem(props) {
|
|
|
2077
2391
|
/* @__PURE__ */ jsx23(StyledSpan, { isSelected, children: props.children })
|
|
2078
2392
|
] });
|
|
2079
2393
|
}
|
|
2080
|
-
var StyledSpan =
|
|
2081
|
-
|
|
2394
|
+
var StyledSpan = styled18.span`
|
|
2395
|
+
font-size: 14px;
|
|
2396
|
+
line-height: 22px;
|
|
2397
|
+
color: var(--charcoal-text2);
|
|
2398
|
+
&::before {
|
|
2399
|
+
display: block;
|
|
2400
|
+
width: 0;
|
|
2401
|
+
height: 0;
|
|
2402
|
+
content: '';
|
|
2403
|
+
margin-top: -4px;
|
|
2404
|
+
}
|
|
2405
|
+
&::after {
|
|
2406
|
+
display: block;
|
|
2407
|
+
width: 0;
|
|
2408
|
+
height: 0;
|
|
2409
|
+
content: '';
|
|
2410
|
+
margin-bottom: -4px;
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2082
2413
|
display: flex;
|
|
2083
2414
|
align-items: center;
|
|
2084
2415
|
width: 100%;
|
|
2085
2416
|
margin-left: ${({ isSelected }) => isSelected === true ? 0 : 20}px;
|
|
2086
2417
|
`;
|
|
2087
|
-
var Text2ColorIcon =
|
|
2088
|
-
|
|
2418
|
+
var Text2ColorIcon = styled18(Icon_default)`
|
|
2419
|
+
color: var(--charcoal-text2);
|
|
2089
2420
|
padding-right: 4px;
|
|
2090
2421
|
`;
|
|
2091
2422
|
|
|
2092
2423
|
// src/components/DropdownSelector/MenuItemGroup/index.tsx
|
|
2093
|
-
import
|
|
2424
|
+
import styled19 from "styled-components";
|
|
2094
2425
|
import { jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2095
2426
|
function MenuItemGroup(props) {
|
|
2096
2427
|
return /* @__PURE__ */ jsxs12(StyledLi2, { role: "presentation", children: [
|
|
@@ -2098,21 +2429,21 @@ function MenuItemGroup(props) {
|
|
|
2098
2429
|
/* @__PURE__ */ jsx24(StyledUl2, { role: "group", children: props.children })
|
|
2099
2430
|
] });
|
|
2100
2431
|
}
|
|
2101
|
-
var TextSpan =
|
|
2432
|
+
var TextSpan = styled19.span`
|
|
2102
2433
|
display: block;
|
|
2103
|
-
color:
|
|
2434
|
+
color: var(--charcoal-text3);
|
|
2104
2435
|
font-size: 12px;
|
|
2105
2436
|
font-weight: bold;
|
|
2106
2437
|
padding: 12px 0 8px 16px;
|
|
2107
2438
|
`;
|
|
2108
|
-
var StyledUl2 =
|
|
2439
|
+
var StyledUl2 = styled19.ul`
|
|
2109
2440
|
padding-left: 0;
|
|
2110
2441
|
margin: 0;
|
|
2111
2442
|
box-sizing: border-box;
|
|
2112
2443
|
list-style: none;
|
|
2113
2444
|
overflow: hidden;
|
|
2114
2445
|
`;
|
|
2115
|
-
var StyledLi2 =
|
|
2446
|
+
var StyledLi2 = styled19.li`
|
|
2116
2447
|
display: block;
|
|
2117
2448
|
`;
|
|
2118
2449
|
|
|
@@ -2123,8 +2454,7 @@ import {
|
|
|
2123
2454
|
useRadio,
|
|
2124
2455
|
useRadioGroup
|
|
2125
2456
|
} from "@react-aria/radio";
|
|
2126
|
-
import
|
|
2127
|
-
import { disabledSelector as disabledSelector5 } from "@charcoal-ui/utils";
|
|
2457
|
+
import styled20, { css as css10 } from "styled-components";
|
|
2128
2458
|
|
|
2129
2459
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
2130
2460
|
import { createContext as createContext7, useContext as useContext9 } from "react";
|
|
@@ -2212,32 +2542,36 @@ var Segmented = (props) => {
|
|
|
2212
2542
|
}
|
|
2213
2543
|
);
|
|
2214
2544
|
};
|
|
2215
|
-
var SegmentedControlRoot =
|
|
2545
|
+
var SegmentedControlRoot = styled20.div`
|
|
2216
2546
|
display: inline-flex;
|
|
2217
2547
|
align-items: center;
|
|
2218
2548
|
|
|
2219
|
-
|
|
2549
|
+
background-color: var(--charcoal-surface3);
|
|
2550
|
+
border-radius: 16px;
|
|
2220
2551
|
`;
|
|
2221
|
-
var SegmentedRoot =
|
|
2552
|
+
var SegmentedRoot = styled20.label`
|
|
2222
2553
|
position: relative;
|
|
2223
2554
|
display: flex;
|
|
2224
2555
|
align-items: center;
|
|
2225
2556
|
cursor: pointer;
|
|
2226
2557
|
height: 32px;
|
|
2227
2558
|
|
|
2228
|
-
|
|
2559
|
+
padding-right: 16px;
|
|
2560
|
+
padding-left: 16px;
|
|
2561
|
+
border-radius: 16px;
|
|
2562
|
+
&:disabled,
|
|
2563
|
+
&[aria-disabled]:not([aria-disabled='false']) {
|
|
2229
2564
|
cursor: default;
|
|
2565
|
+
opacity: 0.32;
|
|
2230
2566
|
}
|
|
2567
|
+
color: var(--charcoal-text2);
|
|
2231
2568
|
|
|
2232
|
-
${({ checked }) =>
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
checked === true && o.bg.brand,
|
|
2237
|
-
checked === true ? o.font.text5 : o.font.text2
|
|
2238
|
-
])}
|
|
2569
|
+
${({ checked = false }) => checked && css10`
|
|
2570
|
+
background-color: var(--charcoal-brand);
|
|
2571
|
+
color: var(--charcoal-text5);
|
|
2572
|
+
`}
|
|
2239
2573
|
`;
|
|
2240
|
-
var SegmentedInput =
|
|
2574
|
+
var SegmentedInput = styled20.input`
|
|
2241
2575
|
position: absolute;
|
|
2242
2576
|
|
|
2243
2577
|
height: 0px;
|
|
@@ -2251,29 +2585,47 @@ var SegmentedInput = styled21.input`
|
|
|
2251
2585
|
white-space: nowrap;
|
|
2252
2586
|
opacity: 0;
|
|
2253
2587
|
`;
|
|
2254
|
-
var RadioLabel2 =
|
|
2588
|
+
var RadioLabel2 = styled20.div`
|
|
2255
2589
|
background: transparent;
|
|
2256
2590
|
display: flex;
|
|
2257
2591
|
align-items: center;
|
|
2258
2592
|
height: 22px;
|
|
2259
2593
|
`;
|
|
2260
|
-
var SegmentedLabelInner =
|
|
2261
|
-
|
|
2594
|
+
var SegmentedLabelInner = styled20.div`
|
|
2595
|
+
font-size: 14px;
|
|
2596
|
+
line-height: 22px;
|
|
2597
|
+
display: flow-root;
|
|
2598
|
+
|
|
2599
|
+
&::before {
|
|
2600
|
+
display: block;
|
|
2601
|
+
width: 0;
|
|
2602
|
+
height: 0;
|
|
2603
|
+
content: '';
|
|
2604
|
+
margin-top: -4px;
|
|
2605
|
+
}
|
|
2606
|
+
&::after {
|
|
2607
|
+
display: block;
|
|
2608
|
+
width: 0;
|
|
2609
|
+
height: 0;
|
|
2610
|
+
content: '';
|
|
2611
|
+
margin-bottom: -4px;
|
|
2612
|
+
}
|
|
2262
2613
|
`;
|
|
2263
2614
|
|
|
2264
2615
|
// src/components/Checkbox/index.tsx
|
|
2265
2616
|
import { forwardRef as forwardRef16, memo as memo7, useMemo as useMemo3 } from "react";
|
|
2266
|
-
import
|
|
2617
|
+
import styled21, { css as css11 } from "styled-components";
|
|
2267
2618
|
import { useCheckbox } from "@react-aria/checkbox";
|
|
2268
2619
|
import { useObjectRef as useObjectRef3 } from "@react-aria/utils";
|
|
2269
2620
|
import { useToggleState as useToggleState2 } from "react-stately";
|
|
2270
|
-
import { disabledSelector as
|
|
2621
|
+
import { disabledSelector as disabledSelector3 } from "@charcoal-ui/utils";
|
|
2271
2622
|
import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2272
2623
|
var Checkbox = forwardRef16(
|
|
2273
2624
|
function CheckboxInner({ invalid = false, ...props }, ref) {
|
|
2274
2625
|
const ariaCheckboxProps = useMemo3(
|
|
2275
2626
|
() => ({
|
|
2276
2627
|
...props,
|
|
2628
|
+
isInValid: invalid,
|
|
2277
2629
|
isSelected: props.checked,
|
|
2278
2630
|
defaultSelected: props.defaultChecked,
|
|
2279
2631
|
validationState: invalid ? "invalid" : "valid",
|
|
@@ -2288,7 +2640,7 @@ var Checkbox = forwardRef16(
|
|
|
2288
2640
|
const isDisabled = (props.disabled ?? false) || (props.readonly ?? false);
|
|
2289
2641
|
return /* @__PURE__ */ jsxs14(InputRoot, { "aria-disabled": isDisabled, className: props.className, children: [
|
|
2290
2642
|
/* @__PURE__ */ jsxs14(CheckboxRoot, { children: [
|
|
2291
|
-
/* @__PURE__ */ jsx27(CheckboxInput, { type: "checkbox", ...inputProps
|
|
2643
|
+
/* @__PURE__ */ jsx27(CheckboxInput, { type: "checkbox", ...inputProps }),
|
|
2292
2644
|
/* @__PURE__ */ jsx27(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked, children: /* @__PURE__ */ jsx27(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }) })
|
|
2293
2645
|
] }),
|
|
2294
2646
|
"children" in props && /* @__PURE__ */ jsx27(InputLabel, { children: props.children })
|
|
@@ -2296,25 +2648,28 @@ var Checkbox = forwardRef16(
|
|
|
2296
2648
|
}
|
|
2297
2649
|
);
|
|
2298
2650
|
var Checkbox_default = memo7(Checkbox);
|
|
2299
|
-
var hiddenCss =
|
|
2651
|
+
var hiddenCss = css11`
|
|
2300
2652
|
visibility: hidden;
|
|
2301
2653
|
`;
|
|
2302
|
-
var InputRoot =
|
|
2654
|
+
var InputRoot = styled21.label`
|
|
2303
2655
|
position: relative;
|
|
2304
2656
|
display: flex;
|
|
2305
2657
|
|
|
2306
2658
|
cursor: pointer;
|
|
2307
|
-
${
|
|
2659
|
+
${disabledSelector3} {
|
|
2308
2660
|
cursor: default;
|
|
2309
2661
|
}
|
|
2310
2662
|
|
|
2311
|
-
gap:
|
|
2312
|
-
|
|
2663
|
+
gap: 4px;
|
|
2664
|
+
&:disabled,
|
|
2665
|
+
&[aria-disabled]:not([aria-disabled='false']) {
|
|
2666
|
+
opacity: 0.32;
|
|
2667
|
+
}
|
|
2313
2668
|
`;
|
|
2314
|
-
var CheckboxRoot =
|
|
2669
|
+
var CheckboxRoot = styled21.div`
|
|
2315
2670
|
position: relative;
|
|
2316
2671
|
`;
|
|
2317
|
-
var CheckboxInput =
|
|
2672
|
+
var CheckboxInput = styled21.input`
|
|
2318
2673
|
&[type='checkbox'] {
|
|
2319
2674
|
appearance: none;
|
|
2320
2675
|
display: block;
|
|
@@ -2322,23 +2677,50 @@ var CheckboxInput = styled22.input`
|
|
|
2322
2677
|
margin: 0;
|
|
2323
2678
|
width: 20px;
|
|
2324
2679
|
height: 20px;
|
|
2680
|
+
border-radius: 4px;
|
|
2681
|
+
transition: 0.2s box-shadow, 0.2s background-color;
|
|
2325
2682
|
|
|
2326
2683
|
&:checked {
|
|
2327
|
-
|
|
2684
|
+
background-color: var(--charcoal-brand);
|
|
2685
|
+
|
|
2686
|
+
&:not(:disabled):not([aria-disabled]),
|
|
2687
|
+
&[aria-disabled='false'] {
|
|
2688
|
+
&:hover {
|
|
2689
|
+
background-color: var(--charcoal-brand-hover);
|
|
2690
|
+
}
|
|
2691
|
+
&:active {
|
|
2692
|
+
background-color: var(--charcoal-brand-press);
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2328
2695
|
}
|
|
2696
|
+
|
|
2697
|
+
&:not(:disabled):not([aria-disabled]),
|
|
2698
|
+
&[aria-disabled='false'] {
|
|
2699
|
+
&:focus,
|
|
2700
|
+
&:active {
|
|
2701
|
+
outline: none;
|
|
2702
|
+
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
2703
|
+
&:not(:focus-visible) {
|
|
2704
|
+
outline: none;
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
&:focus-visible {
|
|
2708
|
+
outline: none;
|
|
2709
|
+
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
2710
|
+
}
|
|
2711
|
+
&[aria-invalid='true'] {
|
|
2712
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2329
2716
|
&:not(:checked) {
|
|
2330
2717
|
border-width: 2px;
|
|
2331
2718
|
border-style: solid;
|
|
2332
|
-
border-color:
|
|
2719
|
+
border-color: var(--charcoal-text4);
|
|
2333
2720
|
}
|
|
2334
|
-
${theme((o) => [o.outline.default.focus, o.borderRadius(4)])}
|
|
2335
|
-
${(p) => p.invalid && theme((o) => [o.outline.assertive])}
|
|
2336
|
-
|
|
2337
|
-
/* FIXME: o.outline.default.focus の transition に o.bg.brand の transition が打ち消されてしまう */
|
|
2338
|
-
transition: all 0.2s !important;
|
|
2339
2721
|
}
|
|
2340
2722
|
`;
|
|
2341
|
-
var CheckboxInputOverlay =
|
|
2723
|
+
var CheckboxInputOverlay = styled21.div`
|
|
2342
2724
|
position: absolute;
|
|
2343
2725
|
top: -2px;
|
|
2344
2726
|
left: -2px;
|
|
@@ -2346,14 +2728,14 @@ var CheckboxInputOverlay = styled22.div`
|
|
|
2346
2728
|
display: flex;
|
|
2347
2729
|
align-items: center;
|
|
2348
2730
|
justify-content: center;
|
|
2349
|
-
|
|
2350
|
-
|
|
2731
|
+
width: 24px;
|
|
2732
|
+
height: 24px;
|
|
2733
|
+
color: var(--charcoal-text5);
|
|
2351
2734
|
|
|
2352
2735
|
${({ checked }) => checked !== true && hiddenCss};
|
|
2353
2736
|
`;
|
|
2354
|
-
var InputLabel =
|
|
2355
|
-
|
|
2356
|
-
|
|
2737
|
+
var InputLabel = styled21.div`
|
|
2738
|
+
color: var(--charcoal-text2);
|
|
2357
2739
|
font-size: 14px;
|
|
2358
2740
|
/** checkbox の height が 20px なのでcheckbox と text が揃っているように見せるために行ボックスの高さを 20px にしている */
|
|
2359
2741
|
line-height: 20px;
|
|
@@ -2362,8 +2744,8 @@ var InputLabel = styled22.div`
|
|
|
2362
2744
|
// src/components/TagItem/index.tsx
|
|
2363
2745
|
import { forwardRef as forwardRef17, memo as memo8, useMemo as useMemo4 } from "react";
|
|
2364
2746
|
import { useObjectRef as useObjectRef4 } from "@react-aria/utils";
|
|
2365
|
-
import
|
|
2366
|
-
import {
|
|
2747
|
+
import styled22, { css as css12 } from "styled-components";
|
|
2748
|
+
import { px as px2 } from "@charcoal-ui/utils";
|
|
2367
2749
|
import { useButton } from "@react-aria/button";
|
|
2368
2750
|
import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2369
2751
|
var sizeMap = {
|
|
@@ -2416,7 +2798,20 @@ var TagItem = forwardRef17(
|
|
|
2416
2798
|
}
|
|
2417
2799
|
);
|
|
2418
2800
|
var TagItem_default = memo8(TagItem);
|
|
2419
|
-
var
|
|
2801
|
+
var horizontalPadding = ({ left, right }) => css12`
|
|
2802
|
+
padding-right: ${px2(right)};
|
|
2803
|
+
padding-left: ${px2(left)};
|
|
2804
|
+
`;
|
|
2805
|
+
var tagItemRootSize = (size) => {
|
|
2806
|
+
switch (size) {
|
|
2807
|
+
case "M":
|
|
2808
|
+
return horizontalPadding({ left: 24, right: 24 });
|
|
2809
|
+
case "S":
|
|
2810
|
+
return horizontalPadding({ left: 16, right: 16 });
|
|
2811
|
+
}
|
|
2812
|
+
};
|
|
2813
|
+
var activeTagItemRoot = horizontalPadding({ left: 16, right: 8 });
|
|
2814
|
+
var TagItemRoot = styled22.a`
|
|
2420
2815
|
isolation: isolate;
|
|
2421
2816
|
position: relative;
|
|
2422
2817
|
height: ${({ size }) => sizeMap[size]}px;
|
|
@@ -2426,22 +2821,30 @@ var TagItemRoot = styled23.a`
|
|
|
2426
2821
|
text-decoration: none;
|
|
2427
2822
|
cursor: pointer;
|
|
2428
2823
|
overflow: hidden;
|
|
2824
|
+
border-radius: 4px;
|
|
2825
|
+
${({ size, status }) => status !== "active" && tagItemRootSize(size)}
|
|
2826
|
+
${({ status }) => status === "active" && activeTagItemRoot}
|
|
2827
|
+
color: ${({ status }) => status === "inactive" ? "var(--charcoal-text2)" : "var(--charcoal-text5)"};
|
|
2828
|
+
|
|
2829
|
+
transition: 0.2s box-shadow;
|
|
2830
|
+
|
|
2831
|
+
&:not(:disabled):not([aria-disabled]),
|
|
2832
|
+
&[aria-disabled='false'] {
|
|
2833
|
+
&:focus,
|
|
2834
|
+
&:active,
|
|
2835
|
+
&:focus-visible {
|
|
2836
|
+
outline: none;
|
|
2837
|
+
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2429
2840
|
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
status !== "active" && size === "M" && o.padding.horizontal(24),
|
|
2434
|
-
status !== "active" && size === "S" && o.padding.horizontal(16),
|
|
2435
|
-
status === "inactive" ? o.font.text2 : o.font.text5,
|
|
2436
|
-
...status === "active" ? [o.padding.left(16), o.padding.right(8)] : []
|
|
2437
|
-
])}
|
|
2438
|
-
|
|
2439
|
-
${disabledSelector7} {
|
|
2440
|
-
${theme((o) => [o.disabled])}
|
|
2841
|
+
&:disabled,
|
|
2842
|
+
&[aria-disabled]:not([aria-disabled='false']) {
|
|
2843
|
+
opacity: 0.32;
|
|
2441
2844
|
cursor: default;
|
|
2442
2845
|
}
|
|
2443
2846
|
`;
|
|
2444
|
-
var Background =
|
|
2847
|
+
var Background = styled22.div`
|
|
2445
2848
|
position: absolute;
|
|
2446
2849
|
z-index: 1;
|
|
2447
2850
|
top: 0;
|
|
@@ -2450,10 +2853,13 @@ var Background = styled23.div`
|
|
|
2450
2853
|
height: 100%;
|
|
2451
2854
|
|
|
2452
2855
|
background-color: ${({ bgColor }) => bgColor};
|
|
2453
|
-
${({ status }) => status === "inactive" &&
|
|
2856
|
+
${({ status }) => status === "inactive" && css12`
|
|
2857
|
+
background-color: var(--charcoal-surface3);
|
|
2858
|
+
`}
|
|
2859
|
+
|
|
2860
|
+
${({ bgImage }) => bgImage !== void 0 && css12`
|
|
2861
|
+
background-color: var(--charcoal-surface4);
|
|
2454
2862
|
|
|
2455
|
-
${({ bgImage }) => bgImage !== void 0 && css7`
|
|
2456
|
-
${theme((o) => [o.bg.surface4])}
|
|
2457
2863
|
&::before {
|
|
2458
2864
|
content: '';
|
|
2459
2865
|
position: absolute;
|
|
@@ -2468,25 +2874,43 @@ var Background = styled23.div`
|
|
|
2468
2874
|
}
|
|
2469
2875
|
`}
|
|
2470
2876
|
`;
|
|
2471
|
-
var Inner =
|
|
2877
|
+
var Inner = styled22.div`
|
|
2472
2878
|
display: inline-flex;
|
|
2473
|
-
gap:
|
|
2879
|
+
gap: 8px;
|
|
2474
2880
|
align-items: center;
|
|
2475
2881
|
z-index: 2;
|
|
2476
2882
|
`;
|
|
2477
|
-
var labelCSS =
|
|
2478
|
-
|
|
2883
|
+
var labelCSS = css12`
|
|
2884
|
+
font-size: 14px;
|
|
2885
|
+
line-height: 22px;
|
|
2886
|
+
font-weight: bold;
|
|
2887
|
+
display: flow-root;
|
|
2888
|
+
|
|
2889
|
+
&::before {
|
|
2890
|
+
display: block;
|
|
2891
|
+
width: 0;
|
|
2892
|
+
height: 0;
|
|
2893
|
+
content: '';
|
|
2894
|
+
margin-top: -4px;
|
|
2895
|
+
}
|
|
2896
|
+
&::after {
|
|
2897
|
+
display: block;
|
|
2898
|
+
width: 0;
|
|
2899
|
+
height: 0;
|
|
2900
|
+
content: '';
|
|
2901
|
+
margin-bottom: -4px;
|
|
2902
|
+
}
|
|
2479
2903
|
`;
|
|
2480
|
-
var translateLabelCSS =
|
|
2904
|
+
var translateLabelCSS = css12`
|
|
2481
2905
|
display: flex;
|
|
2482
2906
|
align-items: center;
|
|
2483
2907
|
flex-direction: column;
|
|
2484
2908
|
font-size: 10px;
|
|
2485
2909
|
`;
|
|
2486
|
-
var LabelWrapper =
|
|
2910
|
+
var LabelWrapper = styled22.div`
|
|
2487
2911
|
${({ isTranslate }) => isTranslate ?? false ? translateLabelCSS : labelCSS}
|
|
2488
2912
|
`;
|
|
2489
|
-
var Label3 =
|
|
2913
|
+
var Label3 = styled22.span`
|
|
2490
2914
|
max-width: 152px;
|
|
2491
2915
|
overflow: hidden;
|
|
2492
2916
|
text-overflow: ellipsis;
|
|
@@ -2495,8 +2919,25 @@ var Label3 = styled23.span`
|
|
|
2495
2919
|
color: inherit;
|
|
2496
2920
|
line-height: inherit;
|
|
2497
2921
|
`;
|
|
2498
|
-
var TranslatedLabel =
|
|
2499
|
-
|
|
2922
|
+
var TranslatedLabel = styled22.div`
|
|
2923
|
+
font-size: 12px;
|
|
2924
|
+
line-height: 20px;
|
|
2925
|
+
font-weight: bold;
|
|
2926
|
+
display: flow-root;
|
|
2927
|
+
&::before {
|
|
2928
|
+
display: block;
|
|
2929
|
+
width: 0;
|
|
2930
|
+
height: 0;
|
|
2931
|
+
content: '';
|
|
2932
|
+
margin-top: -4px;
|
|
2933
|
+
}
|
|
2934
|
+
&::after {
|
|
2935
|
+
display: block;
|
|
2936
|
+
width: 0;
|
|
2937
|
+
height: 0;
|
|
2938
|
+
content: '';
|
|
2939
|
+
margin-bottom: -4px;
|
|
2940
|
+
}
|
|
2500
2941
|
`;
|
|
2501
2942
|
export {
|
|
2502
2943
|
Button_default as Button,
|