@charcoal-ui/react 3.8.0 → 3.9.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/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/useCustomModalOverlay.d.ts +12 -0
- package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -0
- package/dist/components/Radio/index.d.ts.map +1 -1
- package/dist/components/TextArea/index.d.ts.map +1 -1
- package/dist/components/TextField/TextField.story.d.ts +1 -0
- package/dist/components/TextField/TextField.story.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/index.cjs.js +996 -2224
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +990 -2224
- package/dist/index.esm.js.map +1 -1
- package/package.json +7 -6
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +43 -15
- package/src/components/Checkbox/index.tsx +13 -5
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +3 -0
- package/src/components/IconButton/__snapshots__/index.story.storyshot +5 -0
- package/src/components/IconButton/index.tsx +4 -1
- package/src/components/Modal/__snapshots__/index.story.storyshot +12 -0
- package/src/components/Modal/index.tsx +15 -20
- package/src/components/Modal/useCustomModalOverlay.tsx +42 -0
- package/src/components/Radio/__snapshots__/index.story.storyshot +25 -5
- package/src/components/Radio/index.tsx +5 -1
- package/src/components/TextArea/index.tsx +22 -14
- package/src/components/TextField/TextField.story.tsx +20 -0
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +277 -0
- package/src/components/TextField/index.tsx +22 -14
package/dist/index.esm.js
CHANGED
|
@@ -2,23 +2,25 @@
|
|
|
2
2
|
import { useContext } from "react";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
var DefaultLink = React.forwardRef(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
)
|
|
5
|
+
var DefaultLink = React.forwardRef(function DefaultLink2({
|
|
6
|
+
to,
|
|
7
|
+
children,
|
|
8
|
+
...rest
|
|
9
|
+
}, ref) {
|
|
10
|
+
return /* @__PURE__ */ jsx("a", { href: to, ref, ...rest, children });
|
|
11
|
+
});
|
|
10
12
|
var DefaultValue = {
|
|
11
13
|
Link: DefaultLink
|
|
12
14
|
};
|
|
13
15
|
var ComponentAbstractionContext = React.createContext(DefaultValue);
|
|
14
|
-
function ComponentAbstraction({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
);
|
|
16
|
+
function ComponentAbstraction({
|
|
17
|
+
children,
|
|
18
|
+
components
|
|
19
|
+
}) {
|
|
20
|
+
return /* @__PURE__ */ jsx(ComponentAbstractionContext.Provider, { value: {
|
|
21
|
+
...DefaultValue,
|
|
22
|
+
...components
|
|
23
|
+
}, children });
|
|
22
24
|
}
|
|
23
25
|
function useComponentAbstraction() {
|
|
24
26
|
return useContext(ComponentAbstractionContext);
|
|
@@ -53,9 +55,7 @@ import { forwardRef as forwardRef3 } from "react";
|
|
|
53
55
|
|
|
54
56
|
// src/_lib/index.ts
|
|
55
57
|
function unreachable(value) {
|
|
56
|
-
throw new Error(
|
|
57
|
-
arguments.length === 0 ? "unreachable" : `unreachable (${JSON.stringify(value)})`
|
|
58
|
-
);
|
|
58
|
+
throw new Error(arguments.length === 0 ? "unreachable" : `unreachable (${JSON.stringify(value)})`);
|
|
59
59
|
}
|
|
60
60
|
function mergeRefs(...refs) {
|
|
61
61
|
return (value) => {
|
|
@@ -117,124 +117,39 @@ import * as React2 from "react";
|
|
|
117
117
|
import styled from "styled-components";
|
|
118
118
|
import { disabledSelector } from "@charcoal-ui/utils";
|
|
119
119
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
120
|
-
var Clickable = React2.forwardRef(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
...rest,
|
|
135
|
-
ref,
|
|
136
|
-
as,
|
|
137
|
-
"aria-disabled": ariaDisabled
|
|
138
|
-
}
|
|
139
|
-
);
|
|
120
|
+
var Clickable = React2.forwardRef(function Clickable2(props, ref) {
|
|
121
|
+
const {
|
|
122
|
+
Link
|
|
123
|
+
} = useComponentAbstraction();
|
|
124
|
+
const isLink = "to" in props;
|
|
125
|
+
const as = isLink ? Link : "button";
|
|
126
|
+
const ariaDisabled = isLink && props.disabled === true ? true : void 0;
|
|
127
|
+
let rest = props;
|
|
128
|
+
if (isLink) {
|
|
129
|
+
const {
|
|
130
|
+
disabled,
|
|
131
|
+
..._rest
|
|
132
|
+
} = props;
|
|
133
|
+
rest = _rest;
|
|
140
134
|
}
|
|
141
|
-
);
|
|
135
|
+
return /* @__PURE__ */ jsx3(StyledClickableDiv, { ...rest, ref, as, "aria-disabled": ariaDisabled });
|
|
136
|
+
});
|
|
142
137
|
var Clickable_default = Clickable;
|
|
143
|
-
var StyledClickableDiv = styled.div
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
${disabledSelector} {
|
|
147
|
-
cursor: default;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/* Reset button appearance */
|
|
151
|
-
appearance: none;
|
|
152
|
-
background: transparent;
|
|
153
|
-
padding: 0;
|
|
154
|
-
border-style: none;
|
|
155
|
-
outline: none;
|
|
156
|
-
color: inherit;
|
|
157
|
-
text-rendering: inherit;
|
|
158
|
-
letter-spacing: inherit;
|
|
159
|
-
word-spacing: inherit;
|
|
160
|
-
text-decoration: none;
|
|
161
|
-
|
|
162
|
-
&:focus {
|
|
163
|
-
outline: none;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/* Change the font styles in all browsers. */
|
|
167
|
-
font: inherit;
|
|
168
|
-
|
|
169
|
-
/* Remove the margin in Firefox and Safari. */
|
|
170
|
-
margin: 0;
|
|
171
|
-
|
|
172
|
-
/* Show the overflow in Edge. */
|
|
173
|
-
overflow: visible;
|
|
174
|
-
|
|
175
|
-
/* Remove the inheritance of text transform in Firefox. */
|
|
176
|
-
text-transform: none;
|
|
177
|
-
|
|
178
|
-
/* Remove the inner border and padding in Firefox. */
|
|
179
|
-
&::-moz-focus-inner {
|
|
180
|
-
border-style: none;
|
|
181
|
-
padding: 0;
|
|
182
|
-
}
|
|
183
|
-
`;
|
|
138
|
+
var StyledClickableDiv = styled.div.withConfig({
|
|
139
|
+
componentId: "ccl__sc-1lxyknw-0"
|
|
140
|
+
})(["cursor:pointer;", "{cursor:default;}appearance:none;background:transparent;padding:0;border-style:none;outline:none;color:inherit;text-rendering:inherit;letter-spacing:inherit;word-spacing:inherit;text-decoration:none;&:focus{outline:none;}font:inherit;margin:0;overflow:visible;text-transform:none;&::-moz-focus-inner{border-style:none;padding:0;}"], disabledSelector);
|
|
184
141
|
|
|
185
142
|
// src/components/Button/StyledButton.tsx
|
|
186
143
|
import { focusVisibleFocusRingCss } from "@charcoal-ui/styled";
|
|
187
|
-
var horizontalPaddingSmall = css
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
var
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
var
|
|
196
|
-
width: ${(p) => p.$fullWidth ? "stretch" : "min-content"};
|
|
197
|
-
display: inline-grid;
|
|
198
|
-
align-items: center;
|
|
199
|
-
justify-content: center;
|
|
200
|
-
cursor: pointer;
|
|
201
|
-
user-select: none;
|
|
202
|
-
white-space: nowrap;
|
|
203
|
-
border-radius: 999999px;
|
|
204
|
-
font-size: 14px;
|
|
205
|
-
line-height: 22px;
|
|
206
|
-
font-weight: bold;
|
|
207
|
-
|
|
208
|
-
${(p) => p.$size === "M" ? horizontalPaddingMedium : horizontalPaddingSmall}
|
|
209
|
-
color: var(--charcoal-${(p) => p.$color});
|
|
210
|
-
background-color: var(--charcoal-${(p) => p.$background});
|
|
211
|
-
transition: 0.2s color, 0.2s background-color, 0.2s box-shadow;
|
|
212
|
-
|
|
213
|
-
&:not(:disabled):not([aria-disabled]),
|
|
214
|
-
&[aria-disabled='false'] {
|
|
215
|
-
${focusVisibleFocusRingCss}
|
|
216
|
-
|
|
217
|
-
${({ $isActive: $active, $color, $background }) => $active ? css`
|
|
218
|
-
color: var(--charcoal-${$color}-press);
|
|
219
|
-
background-color: var(--charcoal-${$background}-press);
|
|
220
|
-
` : css`
|
|
221
|
-
&:hover {
|
|
222
|
-
color: var(--charcoal-${$color}-hover);
|
|
223
|
-
background-color: var(--charcoal-${$background}-hover);
|
|
224
|
-
}
|
|
225
|
-
&:active {
|
|
226
|
-
color: var(--charcoal-${$color}-press);
|
|
227
|
-
background-color: var(--charcoal-${$background}-press);
|
|
228
|
-
}
|
|
229
|
-
`}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
&:disabled,
|
|
233
|
-
&[aria-disabled]:not([aria-disabled='false']) {
|
|
234
|
-
opacity: 0.32;
|
|
235
|
-
}
|
|
236
|
-
height: ${(p) => p.$size === "M" ? 40 : 32}px;
|
|
237
|
-
`;
|
|
144
|
+
var horizontalPaddingSmall = css(["padding-right:16px;padding-left:16px;"]);
|
|
145
|
+
var horizontalPaddingMedium = css(["padding-right:24px;padding-left:24px;"]);
|
|
146
|
+
var StyledButton = styled2(Clickable_default).withConfig({
|
|
147
|
+
componentId: "ccl__sc-19qkngs-0"
|
|
148
|
+
})(["width:", ";display:inline-grid;align-items:center;justify-content:center;cursor:pointer;user-select:none;white-space:nowrap;border-radius:999999px;font-size:14px;line-height:22px;font-weight:bold;", " color:var(--charcoal-", ");background-color:var(--charcoal-", ");transition:0.2s color,0.2s background-color,0.2s box-shadow;&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{", " ", "}&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;}height:", "px;"], (p) => p.$fullWidth ? "stretch" : "min-content", (p) => p.$size === "M" ? horizontalPaddingMedium : horizontalPaddingSmall, (p) => p.$color, (p) => p.$background, focusVisibleFocusRingCss, ({
|
|
149
|
+
$isActive: $active,
|
|
150
|
+
$color,
|
|
151
|
+
$background
|
|
152
|
+
}) => $active ? css(["color:var(--charcoal-", "-press);background-color:var(--charcoal-", "-press);"], $color, $background) : css(["&:hover{color:var(--charcoal-", "-hover);background-color:var(--charcoal-", "-hover);}&:active{color:var(--charcoal-", "-press);background-color:var(--charcoal-", "-press);}"], $color, $background, $color, $background), (p) => p.$size === "M" ? 40 : 32);
|
|
238
153
|
|
|
239
154
|
// src/components/Button/index.tsx
|
|
240
155
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
@@ -247,20 +162,7 @@ var Button = forwardRef3(function Button2({
|
|
|
247
162
|
isActive = false,
|
|
248
163
|
...rest
|
|
249
164
|
}, ref) {
|
|
250
|
-
return /* @__PURE__ */ jsx4(
|
|
251
|
-
StyledButton,
|
|
252
|
-
{
|
|
253
|
-
...rest,
|
|
254
|
-
disabled,
|
|
255
|
-
$background: variantToBackground(variant),
|
|
256
|
-
$color: variantToFont(variant),
|
|
257
|
-
$size: size,
|
|
258
|
-
$fullWidth: fixed,
|
|
259
|
-
$isActive: isActive,
|
|
260
|
-
ref,
|
|
261
|
-
children
|
|
262
|
-
}
|
|
263
|
-
);
|
|
165
|
+
return /* @__PURE__ */ jsx4(StyledButton, { ...rest, disabled, $background: variantToBackground(variant), $color: variantToFont(variant), $size: size, $fullWidth: fixed, $isActive: isActive, ref, children });
|
|
264
166
|
});
|
|
265
167
|
var Button_default = Button;
|
|
266
168
|
|
|
@@ -269,63 +171,32 @@ import { forwardRef as forwardRef4 } from "react";
|
|
|
269
171
|
import styled3, { css as css2 } from "styled-components";
|
|
270
172
|
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss2 } from "@charcoal-ui/styled";
|
|
271
173
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
272
|
-
var IconButton = forwardRef4(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
StyledIconButton,
|
|
283
|
-
{
|
|
284
|
-
...rest,
|
|
285
|
-
ref,
|
|
286
|
-
$size: size,
|
|
287
|
-
$variant: variant,
|
|
288
|
-
$isActive: isActive,
|
|
289
|
-
children: /* @__PURE__ */ jsx5("pixiv-icon", { name: icon })
|
|
290
|
-
}
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
);
|
|
174
|
+
var IconButton = forwardRef4(function IconButtonInner({
|
|
175
|
+
variant = "Default",
|
|
176
|
+
size = "M",
|
|
177
|
+
icon,
|
|
178
|
+
isActive = false,
|
|
179
|
+
...rest
|
|
180
|
+
}, ref) {
|
|
181
|
+
validateIconSize(size, icon);
|
|
182
|
+
return /* @__PURE__ */ jsx5(StyledIconButton, { ...rest, ref, $size: size, $variant: variant, $isActive: isActive, children: /* @__PURE__ */ jsx5("pixiv-icon", { name: icon }) });
|
|
183
|
+
});
|
|
294
184
|
var IconButton_default = IconButton;
|
|
295
|
-
var StyledIconButton = styled3(Clickable_default).attrs(styledProps)
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
${({ $isActive, $background }) => $isActive ? css2`
|
|
311
|
-
background-color: var(--charcoal-${$background}-press);
|
|
312
|
-
` : css2`
|
|
313
|
-
&:hover {
|
|
314
|
-
background-color: var(--charcoal-${$background}-hover);
|
|
315
|
-
}
|
|
316
|
-
&:active {
|
|
317
|
-
background-color: var(--charcoal-${$background}-press);
|
|
318
|
-
}
|
|
319
|
-
`}
|
|
320
|
-
${focusVisibleFocusRingCss2}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
&:disabled,
|
|
324
|
-
&[aria-disabled]:not([aria-disabled='false']) {
|
|
325
|
-
opacity: 0.32;
|
|
326
|
-
}
|
|
327
|
-
`;
|
|
328
|
-
function styledProps({ $size, $variant }) {
|
|
185
|
+
var StyledIconButton = styled3(Clickable_default).attrs(styledProps).withConfig({
|
|
186
|
+
componentId: "ccl__sc-zssehl-0"
|
|
187
|
+
})(["user-select:none;width:", "px;height:", "px;display:flex;align-items:center;justify-content:center;color:var(", ");background-color:var(", ");border-radius:999999px;transition:0.2s background-color,0.2s box-shadow;&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{", " ", "}&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;}"], (p) => p.$width, (p) => p.$height, ({
|
|
188
|
+
$font
|
|
189
|
+
}) => `--charcoal-${$font}`, ({
|
|
190
|
+
$background
|
|
191
|
+
}) => `--charcoal-${$background}`, ({
|
|
192
|
+
$isActive,
|
|
193
|
+
$background,
|
|
194
|
+
$font
|
|
195
|
+
}) => $isActive ? css2(["color:var(--charcoal-", "-press);background-color:var(--charcoal-", "-press);"], $font, $background) : css2(["&:hover{color:var(--charcoal-", "-hover);background-color:var(--charcoal-", "-hover);}&:active{color:var(--charcoal-", "-press);background-color:var(--charcoal-", "-press);}"], $font, $background, $font, $background), focusVisibleFocusRingCss2);
|
|
196
|
+
function styledProps({
|
|
197
|
+
$size,
|
|
198
|
+
$variant
|
|
199
|
+
}) {
|
|
329
200
|
return {
|
|
330
201
|
...variantToProps($variant),
|
|
331
202
|
...sizeToProps($size)
|
|
@@ -334,9 +205,15 @@ function styledProps({ $size, $variant }) {
|
|
|
334
205
|
function variantToProps(variant) {
|
|
335
206
|
switch (variant) {
|
|
336
207
|
case "Default":
|
|
337
|
-
return {
|
|
208
|
+
return {
|
|
209
|
+
$font: "text3",
|
|
210
|
+
$background: "transparent"
|
|
211
|
+
};
|
|
338
212
|
case "Overlay":
|
|
339
|
-
return {
|
|
213
|
+
return {
|
|
214
|
+
$font: "text5",
|
|
215
|
+
$background: "surface4"
|
|
216
|
+
};
|
|
340
217
|
}
|
|
341
218
|
}
|
|
342
219
|
function sizeToProps(size) {
|
|
@@ -375,9 +252,7 @@ function validateIconSize(size, icon) {
|
|
|
375
252
|
}
|
|
376
253
|
const [iconSize] = result;
|
|
377
254
|
if (iconSize !== requiredIconSize) {
|
|
378
|
-
console.warn(
|
|
379
|
-
`IconButton with size "${size}" expect icon size "${requiredIconSize}, but got "${iconSize}"`
|
|
380
|
-
);
|
|
255
|
+
console.warn(`IconButton with size "${size}" expect icon size "${requiredIconSize}, but got "${iconSize}"`);
|
|
381
256
|
}
|
|
382
257
|
}
|
|
383
258
|
|
|
@@ -388,7 +263,12 @@ import styled4 from "styled-components";
|
|
|
388
263
|
import warning from "warning";
|
|
389
264
|
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss3 } from "@charcoal-ui/styled";
|
|
390
265
|
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
391
|
-
var Radio = forwardRef5(function RadioInner({
|
|
266
|
+
var Radio = forwardRef5(function RadioInner({
|
|
267
|
+
value,
|
|
268
|
+
disabled = false,
|
|
269
|
+
children,
|
|
270
|
+
className
|
|
271
|
+
}, ref) {
|
|
392
272
|
const {
|
|
393
273
|
name,
|
|
394
274
|
selected,
|
|
@@ -404,138 +284,29 @@ var Radio = forwardRef5(function RadioInner({ value, disabled = false, children,
|
|
|
404
284
|
const isSelected = value === selected;
|
|
405
285
|
const isDisabled = disabled || isParentDisabled;
|
|
406
286
|
const isReadonly = readonly && !isSelected;
|
|
407
|
-
const handleChange = useCallback(
|
|
408
|
-
(e)
|
|
409
|
-
|
|
410
|
-
},
|
|
411
|
-
[onChange]
|
|
412
|
-
);
|
|
287
|
+
const handleChange = useCallback((e) => {
|
|
288
|
+
onChange(e.currentTarget.value);
|
|
289
|
+
}, [onChange]);
|
|
413
290
|
return /* @__PURE__ */ jsxs2(RadioRoot, { "aria-disabled": isDisabled || isReadonly, className, children: [
|
|
414
|
-
/* @__PURE__ */ jsx6(
|
|
415
|
-
RadioInput,
|
|
416
|
-
{
|
|
417
|
-
name,
|
|
418
|
-
value,
|
|
419
|
-
checked: isSelected,
|
|
420
|
-
"aria-invalid": invalid,
|
|
421
|
-
onChange: handleChange,
|
|
422
|
-
disabled: isDisabled || isReadonly,
|
|
423
|
-
ref
|
|
424
|
-
}
|
|
425
|
-
),
|
|
291
|
+
/* @__PURE__ */ jsx6(RadioInput, { name, value, checked: isSelected, "aria-invalid": invalid, onChange: handleChange, disabled: isDisabled || isReadonly, ref }),
|
|
426
292
|
children != null && /* @__PURE__ */ jsx6(RadioLabel, { children })
|
|
427
293
|
] });
|
|
428
294
|
});
|
|
429
295
|
var Radio_default = memo(Radio);
|
|
430
|
-
var RadioRoot = styled4.label
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
&[type='radio'] {
|
|
445
|
-
appearance: none;
|
|
446
|
-
display: block;
|
|
447
|
-
box-sizing: border-box;
|
|
448
|
-
|
|
449
|
-
margin: 0;
|
|
450
|
-
padding: 6px;
|
|
451
|
-
|
|
452
|
-
width: 20px;
|
|
453
|
-
height: 20px;
|
|
454
|
-
cursor: pointer;
|
|
455
|
-
border-radius: 999999px;
|
|
456
|
-
background-color: var(--charcoal-surface1);
|
|
457
|
-
transition: 0.2s background-color, 0.2s box-shadow;
|
|
458
|
-
|
|
459
|
-
&:not(:disabled):not([aria-disabled]),
|
|
460
|
-
&[aria-disabled='false'] {
|
|
461
|
-
&:hover {
|
|
462
|
-
background-color: var(--charcoal-surface1-hover);
|
|
463
|
-
}
|
|
464
|
-
&:active {
|
|
465
|
-
background-color: var(--charcoal-surface1-press);
|
|
466
|
-
}
|
|
467
|
-
${focusVisibleFocusRingCss3}
|
|
468
|
-
&[aria-invalid='true'] {
|
|
469
|
-
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
470
|
-
&:focus {
|
|
471
|
-
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
&:not(:checked) {
|
|
477
|
-
border-width: 2px;
|
|
478
|
-
border-style: solid;
|
|
479
|
-
border-color: var(--charcoal-text3);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
&:checked {
|
|
483
|
-
background-color: var(--charcoal-brand);
|
|
484
|
-
&::after {
|
|
485
|
-
content: '';
|
|
486
|
-
display: block;
|
|
487
|
-
width: 8px;
|
|
488
|
-
height: 8px;
|
|
489
|
-
pointer-events: none;
|
|
490
|
-
background-color: var(--charcoal-text5);
|
|
491
|
-
border-radius: 999999px;
|
|
492
|
-
transition: 0.2s background-color, 0.2s box-shadow;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
&:not(:disabled):not([aria-disabled]),
|
|
496
|
-
&[aria-disabled='false'] {
|
|
497
|
-
&:hover {
|
|
498
|
-
background-color: var(--charcoal-brand-hover);
|
|
499
|
-
&::after {
|
|
500
|
-
background-color: var(--charcoal-text5-hover);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
&:active {
|
|
504
|
-
background-color: var(--charcoal-brand-press);
|
|
505
|
-
&::after {
|
|
506
|
-
background-color: var(--charcoal-text5-press);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
`;
|
|
513
|
-
var RadioLabel = styled4.div`
|
|
514
|
-
font-size: 14px;
|
|
515
|
-
line-height: 22px;
|
|
516
|
-
display: flow-root;
|
|
517
|
-
color: var(--charcoal-text2);
|
|
518
|
-
|
|
519
|
-
&::before {
|
|
520
|
-
display: block;
|
|
521
|
-
width: 0;
|
|
522
|
-
height: 0;
|
|
523
|
-
content: '';
|
|
524
|
-
margin-top: -4px;
|
|
525
|
-
}
|
|
526
|
-
&::after {
|
|
527
|
-
display: block;
|
|
528
|
-
width: 0;
|
|
529
|
-
height: 0;
|
|
530
|
-
content: '';
|
|
531
|
-
margin-bottom: -4px;
|
|
532
|
-
}
|
|
533
|
-
`;
|
|
534
|
-
var StyledRadioGroup = styled4.div`
|
|
535
|
-
display: grid;
|
|
536
|
-
grid-template-columns: 1fr;
|
|
537
|
-
grid-gap: 8px;
|
|
538
|
-
`;
|
|
296
|
+
var RadioRoot = styled4.label.withConfig({
|
|
297
|
+
componentId: "ccl__sc-1hitkzn-0"
|
|
298
|
+
})(["display:grid;grid-template-columns:auto 1fr;grid-gap:4px;align-items:center;cursor:pointer;&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}"]);
|
|
299
|
+
var RadioInput = styled4.input.attrs({
|
|
300
|
+
type: "radio"
|
|
301
|
+
}).withConfig({
|
|
302
|
+
componentId: "ccl__sc-1hitkzn-1"
|
|
303
|
+
})(["&[type='radio']{appearance:none;display:block;box-sizing:border-box;margin:0;padding:6px;width:20px;height:20px;cursor:pointer;border-radius:999999px;background-color:var(--charcoal-surface1);transition:0.2s background-color,0.2s box-shadow;:disabled{cursor:default;}&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{&:hover{background-color:var(--charcoal-surface1-hover);}&:active{background-color:var(--charcoal-surface1-press);}", " &[aria-invalid='true']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);&:focus{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}}}&:not(:checked){border-width:2px;border-style:solid;border-color:var(--charcoal-text3);}&:checked{background-color:var(--charcoal-brand);&::after{content:'';display:block;width:8px;height:8px;pointer-events:none;background-color:var(--charcoal-text5);border-radius:999999px;transition:0.2s background-color,0.2s box-shadow;}&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{&:hover{background-color:var(--charcoal-brand-hover);&::after{background-color:var(--charcoal-text5-hover);}}&:active{background-color:var(--charcoal-brand-press);&::after{background-color:var(--charcoal-text5-press);}}}}}"], focusVisibleFocusRingCss3);
|
|
304
|
+
var RadioLabel = styled4.div.withConfig({
|
|
305
|
+
componentId: "ccl__sc-1hitkzn-2"
|
|
306
|
+
})(["font-size:14px;line-height:22px;display:flow-root;color:var(--charcoal-text2);&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
|
|
307
|
+
var StyledRadioGroup = styled4.div.withConfig({
|
|
308
|
+
componentId: "ccl__sc-1hitkzn-3"
|
|
309
|
+
})(["display:grid;grid-template-columns:1fr;grid-gap:8px;"]);
|
|
539
310
|
var RadioGroupContext = React3.createContext({
|
|
540
311
|
name: void 0,
|
|
541
312
|
selected: void 0,
|
|
@@ -543,9 +314,7 @@ var RadioGroupContext = React3.createContext({
|
|
|
543
314
|
readonly: false,
|
|
544
315
|
invalid: false,
|
|
545
316
|
onChange() {
|
|
546
|
-
throw new Error(
|
|
547
|
-
"Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?"
|
|
548
|
-
);
|
|
317
|
+
throw new Error("Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?");
|
|
549
318
|
}
|
|
550
319
|
});
|
|
551
320
|
function RadioGroup({
|
|
@@ -559,36 +328,17 @@ function RadioGroup({
|
|
|
559
328
|
invalid,
|
|
560
329
|
children
|
|
561
330
|
}) {
|
|
562
|
-
const handleChange = useCallback(
|
|
563
|
-
(next)
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
selected: value,
|
|
574
|
-
disabled: disabled ?? false,
|
|
575
|
-
readonly: readonly ?? false,
|
|
576
|
-
invalid: invalid ?? false,
|
|
577
|
-
onChange: handleChange
|
|
578
|
-
},
|
|
579
|
-
children: /* @__PURE__ */ jsx6(
|
|
580
|
-
StyledRadioGroup,
|
|
581
|
-
{
|
|
582
|
-
role: "radiogroup",
|
|
583
|
-
"aria-orientation": "vertical",
|
|
584
|
-
"aria-label": label,
|
|
585
|
-
"aria-invalid": invalid,
|
|
586
|
-
className,
|
|
587
|
-
children
|
|
588
|
-
}
|
|
589
|
-
)
|
|
590
|
-
}
|
|
591
|
-
);
|
|
331
|
+
const handleChange = useCallback((next) => {
|
|
332
|
+
onChange(next);
|
|
333
|
+
}, [onChange]);
|
|
334
|
+
return /* @__PURE__ */ jsx6(RadioGroupContext.Provider, { value: {
|
|
335
|
+
name,
|
|
336
|
+
selected: value,
|
|
337
|
+
disabled: disabled ?? false,
|
|
338
|
+
readonly: readonly ?? false,
|
|
339
|
+
invalid: invalid ?? false,
|
|
340
|
+
onChange: handleChange
|
|
341
|
+
}, children: /* @__PURE__ */ jsx6(StyledRadioGroup, { role: "radiogroup", "aria-orientation": "vertical", "aria-label": label, "aria-invalid": invalid, className, children }) });
|
|
592
342
|
}
|
|
593
343
|
|
|
594
344
|
// src/components/MultiSelect/index.tsx
|
|
@@ -606,197 +356,86 @@ var MultiSelectGroupContext = createContext3({
|
|
|
606
356
|
readonly: false,
|
|
607
357
|
invalid: false,
|
|
608
358
|
onChange() {
|
|
609
|
-
throw new Error(
|
|
610
|
-
"Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<MultiSelectGroup />` ?"
|
|
611
|
-
);
|
|
359
|
+
throw new Error("Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<MultiSelectGroup />` ?");
|
|
612
360
|
}
|
|
613
361
|
});
|
|
614
362
|
|
|
615
363
|
// src/components/MultiSelect/index.tsx
|
|
616
364
|
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss4 } from "@charcoal-ui/styled";
|
|
617
365
|
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
618
|
-
var MultiSelect = forwardRef6(
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
366
|
+
var MultiSelect = forwardRef6(function MultiSelectInner({
|
|
367
|
+
value,
|
|
368
|
+
disabled = false,
|
|
369
|
+
onChange,
|
|
370
|
+
variant = "default",
|
|
371
|
+
className,
|
|
372
|
+
children
|
|
373
|
+
}, ref) {
|
|
374
|
+
const {
|
|
375
|
+
name,
|
|
376
|
+
selected,
|
|
377
|
+
disabled: parentDisabled,
|
|
378
|
+
readonly,
|
|
379
|
+
invalid,
|
|
380
|
+
onChange: parentOnChange
|
|
381
|
+
} = useContext3(MultiSelectGroupContext);
|
|
382
|
+
warning2(
|
|
383
|
+
name !== void 0,
|
|
384
|
+
`"name" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`
|
|
385
|
+
);
|
|
386
|
+
const isSelected = selected.includes(value);
|
|
387
|
+
const isDisabled = disabled || parentDisabled || readonly;
|
|
388
|
+
const handleChange = useCallback2((event) => {
|
|
389
|
+
if (!(event.currentTarget instanceof HTMLInputElement)) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (onChange)
|
|
393
|
+
onChange({
|
|
394
|
+
value,
|
|
395
|
+
selected: event.currentTarget.checked
|
|
396
|
+
});
|
|
397
|
+
parentOnChange({
|
|
398
|
+
value,
|
|
399
|
+
selected: event.currentTarget.checked
|
|
400
|
+
});
|
|
401
|
+
}, [onChange, parentOnChange, value]);
|
|
402
|
+
return /* @__PURE__ */ jsxs3(MultiSelectRoot, { "aria-disabled": isDisabled, className, children: [
|
|
403
|
+
/* @__PURE__ */ jsx7(MultiSelectInput, { ...{
|
|
628
404
|
name,
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
name !== void 0,
|
|
637
|
-
`"name" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`
|
|
638
|
-
);
|
|
639
|
-
const isSelected = selected.includes(value);
|
|
640
|
-
const isDisabled = disabled || parentDisabled || readonly;
|
|
641
|
-
const handleChange = useCallback2(
|
|
642
|
-
(event) => {
|
|
643
|
-
if (!(event.currentTarget instanceof HTMLInputElement)) {
|
|
644
|
-
return;
|
|
645
|
-
}
|
|
646
|
-
if (onChange)
|
|
647
|
-
onChange({ value, selected: event.currentTarget.checked });
|
|
648
|
-
parentOnChange({ value, selected: event.currentTarget.checked });
|
|
649
|
-
},
|
|
650
|
-
[onChange, parentOnChange, value]
|
|
651
|
-
);
|
|
652
|
-
return /* @__PURE__ */ jsxs3(MultiSelectRoot, { "aria-disabled": isDisabled, className, children: [
|
|
653
|
-
/* @__PURE__ */ jsx7(
|
|
654
|
-
MultiSelectInput,
|
|
655
|
-
{
|
|
656
|
-
...{
|
|
657
|
-
name,
|
|
658
|
-
value,
|
|
659
|
-
invalid
|
|
660
|
-
},
|
|
661
|
-
checked: isSelected,
|
|
662
|
-
disabled: isDisabled,
|
|
663
|
-
onChange: handleChange,
|
|
664
|
-
overlay: variant === "overlay",
|
|
665
|
-
"aria-invalid": invalid,
|
|
666
|
-
ref
|
|
667
|
-
}
|
|
668
|
-
),
|
|
669
|
-
/* @__PURE__ */ jsx7(
|
|
670
|
-
MultiSelectInputOverlay,
|
|
671
|
-
{
|
|
672
|
-
overlay: variant === "overlay",
|
|
673
|
-
invalid,
|
|
674
|
-
"aria-hidden": true,
|
|
675
|
-
children: /* @__PURE__ */ jsx7("pixiv-icon", { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 })
|
|
676
|
-
}
|
|
677
|
-
),
|
|
678
|
-
Boolean(children) && /* @__PURE__ */ jsx7(MultiSelectLabel, { children })
|
|
679
|
-
] });
|
|
680
|
-
}
|
|
681
|
-
);
|
|
405
|
+
value,
|
|
406
|
+
invalid
|
|
407
|
+
}, checked: isSelected, disabled: isDisabled, onChange: handleChange, overlay: variant === "overlay", "aria-invalid": invalid, ref }),
|
|
408
|
+
/* @__PURE__ */ jsx7(MultiSelectInputOverlay, { overlay: variant === "overlay", invalid, "aria-hidden": true, children: /* @__PURE__ */ jsx7("pixiv-icon", { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 }) }),
|
|
409
|
+
Boolean(children) && /* @__PURE__ */ jsx7(MultiSelectLabel, { children })
|
|
410
|
+
] });
|
|
411
|
+
});
|
|
682
412
|
var MultiSelect_default = memo2(MultiSelect);
|
|
683
|
-
var MultiSelectRoot = styled5.label
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
margin-top: -4px;
|
|
710
|
-
}
|
|
711
|
-
&::after {
|
|
712
|
-
display: block;
|
|
713
|
-
width: 0;
|
|
714
|
-
height: 0;
|
|
715
|
-
content: '';
|
|
716
|
-
margin-bottom: -4px;
|
|
717
|
-
}
|
|
718
|
-
`;
|
|
719
|
-
var MultiSelectInput = styled5.input.attrs({ type: "checkbox" })`
|
|
720
|
-
&[type='checkbox'] {
|
|
721
|
-
appearance: none;
|
|
722
|
-
display: block;
|
|
723
|
-
width: 20px;
|
|
724
|
-
height: 20px;
|
|
725
|
-
margin: 0;
|
|
726
|
-
background-color: var(--charcoal-text3);
|
|
727
|
-
border-radius: 999999px;
|
|
728
|
-
transition: 0.2s background-color, 0.2s box-shadow;
|
|
729
|
-
|
|
730
|
-
&:checked {
|
|
731
|
-
background-color: var(--charcoal-brand);
|
|
732
|
-
&:hover {
|
|
733
|
-
&:not(:disabled):not([aria-disabled]),
|
|
734
|
-
&[aria-disabled='false'] {
|
|
735
|
-
background-color: var(--charcoal-brand-hover);
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
&:active {
|
|
740
|
-
&:not(:disabled):not([aria-disabled]),
|
|
741
|
-
&[aria-disabled='false'] {
|
|
742
|
-
background-color: var(--charcoal-brand-press);
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
&:hover {
|
|
748
|
-
&:not(:disabled):not([aria-disabled]),
|
|
749
|
-
&[aria-disabled='false'] {
|
|
750
|
-
background-color: var(--charcoal-text3-hover);
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
&:active {
|
|
755
|
-
&:not(:disabled):not([aria-disabled]),
|
|
756
|
-
&[aria-disabled='false'] {
|
|
757
|
-
background-color: var(--charcoal-text3-press);
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
${focusVisibleFocusRingCss4}
|
|
762
|
-
|
|
763
|
-
${({ invalid, overlay }) => invalid && !overlay && css3`
|
|
764
|
-
&:not(:disabled):not([aria-disabled]),
|
|
765
|
-
&[aria-disabled='false'] {
|
|
766
|
-
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
767
|
-
}
|
|
768
|
-
`}
|
|
769
|
-
${({ overlay }) => overlay && css3`
|
|
770
|
-
background-color: var(--charcoal-surface4);
|
|
771
|
-
`}
|
|
772
|
-
}
|
|
773
|
-
`;
|
|
774
|
-
var MultiSelectInputOverlay = styled5.div`
|
|
775
|
-
position: absolute;
|
|
776
|
-
top: -2px;
|
|
777
|
-
left: -2px;
|
|
778
|
-
box-sizing: border-box;
|
|
779
|
-
display: flex;
|
|
780
|
-
align-items: center;
|
|
781
|
-
justify-content: center;
|
|
782
|
-
width: 24px;
|
|
783
|
-
height: 24px;
|
|
784
|
-
border-radius: 999999px;
|
|
785
|
-
color: var(--charcoal-text5);
|
|
786
|
-
transition: 0.2s box-shadow;
|
|
787
|
-
${({ invalid, overlay }) => invalid && overlay && css3`
|
|
788
|
-
&:not(:disabled):not([aria-disabled]),
|
|
789
|
-
&[aria-disabled='false'] {
|
|
790
|
-
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
791
|
-
}
|
|
792
|
-
`}
|
|
793
|
-
|
|
794
|
-
${({ overlay }) => overlay && css3`
|
|
795
|
-
border-color: var(--charcoal-text5);
|
|
796
|
-
border-width: 2px;
|
|
797
|
-
border-style: solid;
|
|
798
|
-
`}
|
|
799
|
-
`;
|
|
413
|
+
var MultiSelectRoot = styled5.label.withConfig({
|
|
414
|
+
componentId: "ccl__sc-wpr5y9-0"
|
|
415
|
+
})(["display:grid;grid-template-columns:auto 1fr;align-items:center;position:relative;cursor:pointer;gap:", ";&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}"], ({
|
|
416
|
+
theme
|
|
417
|
+
}) => px(theme.spacing[4]));
|
|
418
|
+
var MultiSelectLabel = styled5.div.withConfig({
|
|
419
|
+
componentId: "ccl__sc-wpr5y9-1"
|
|
420
|
+
})(["display:flex;align-items:center;font-size:14px;line-height:22px;display:flow-root;color:var(--charcoal-text2);&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
|
|
421
|
+
var MultiSelectInput = styled5.input.attrs({
|
|
422
|
+
type: "checkbox"
|
|
423
|
+
}).withConfig({
|
|
424
|
+
componentId: "ccl__sc-wpr5y9-2"
|
|
425
|
+
})(["&[type='checkbox']{appearance:none;display:block;width:20px;height:20px;margin:0;background-color:var(--charcoal-text3);border-radius:999999px;transition:0.2s background-color,0.2s box-shadow;&:checked{background-color:var(--charcoal-brand);&:hover{&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{background-color:var(--charcoal-brand-hover);}}&:active{&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{background-color:var(--charcoal-brand-press);}}}&:hover{&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{background-color:var(--charcoal-text3-hover);}}&:active{&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{background-color:var(--charcoal-text3-press);}}", " ", " ", "}"], focusVisibleFocusRingCss4, ({
|
|
426
|
+
invalid,
|
|
427
|
+
overlay
|
|
428
|
+
}) => invalid && !overlay && css3(["&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}"]), ({
|
|
429
|
+
overlay
|
|
430
|
+
}) => overlay && css3(["background-color:var(--charcoal-surface4);"]));
|
|
431
|
+
var MultiSelectInputOverlay = styled5.div.withConfig({
|
|
432
|
+
componentId: "ccl__sc-wpr5y9-3"
|
|
433
|
+
})(["position:absolute;top:-2px;left:-2px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:999999px;color:var(--charcoal-text5);transition:0.2s box-shadow;", " ", ""], ({
|
|
434
|
+
invalid,
|
|
435
|
+
overlay
|
|
436
|
+
}) => invalid && overlay && css3(["&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}"]), ({
|
|
437
|
+
overlay
|
|
438
|
+
}) => overlay && css3(["border-color:var(--charcoal-text5);border-width:2px;border-style:solid;"]));
|
|
800
439
|
function MultiSelectGroup({
|
|
801
440
|
className,
|
|
802
441
|
name,
|
|
@@ -808,35 +447,26 @@ function MultiSelectGroup({
|
|
|
808
447
|
invalid = false,
|
|
809
448
|
children
|
|
810
449
|
}) {
|
|
811
|
-
const handleChange = useCallback2(
|
|
812
|
-
(payload)
|
|
813
|
-
|
|
814
|
-
if (
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
onChange([...selected.slice(0, index), ...selected.slice(index + 1)]);
|
|
821
|
-
}
|
|
450
|
+
const handleChange = useCallback2((payload) => {
|
|
451
|
+
const index = selected.indexOf(payload.value);
|
|
452
|
+
if (payload.selected) {
|
|
453
|
+
if (index < 0) {
|
|
454
|
+
onChange([...selected, payload.value]);
|
|
455
|
+
}
|
|
456
|
+
} else {
|
|
457
|
+
if (index >= 0) {
|
|
458
|
+
onChange([...selected.slice(0, index), ...selected.slice(index + 1)]);
|
|
822
459
|
}
|
|
823
|
-
},
|
|
824
|
-
[onChange, selected]
|
|
825
|
-
);
|
|
826
|
-
return /* @__PURE__ */ jsx7(
|
|
827
|
-
MultiSelectGroupContext.Provider,
|
|
828
|
-
{
|
|
829
|
-
value: {
|
|
830
|
-
name,
|
|
831
|
-
selected: Array.from(new Set(selected)),
|
|
832
|
-
disabled,
|
|
833
|
-
readonly,
|
|
834
|
-
invalid,
|
|
835
|
-
onChange: handleChange
|
|
836
|
-
},
|
|
837
|
-
children: /* @__PURE__ */ jsx7("div", { className, "aria-label": label, "data-testid": "SelectGroup", children })
|
|
838
460
|
}
|
|
839
|
-
);
|
|
461
|
+
}, [onChange, selected]);
|
|
462
|
+
return /* @__PURE__ */ jsx7(MultiSelectGroupContext.Provider, { value: {
|
|
463
|
+
name,
|
|
464
|
+
selected: Array.from(new Set(selected)),
|
|
465
|
+
disabled,
|
|
466
|
+
readonly,
|
|
467
|
+
invalid,
|
|
468
|
+
onChange: handleChange
|
|
469
|
+
}, children: /* @__PURE__ */ jsx7("div", { className, "aria-label": label, "data-testid": "SelectGroup", children }) });
|
|
840
470
|
}
|
|
841
471
|
|
|
842
472
|
// src/components/Switch/index.tsx
|
|
@@ -847,108 +477,43 @@ import styled6 from "styled-components";
|
|
|
847
477
|
import { useObjectRef } from "@react-aria/utils";
|
|
848
478
|
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss5 } from "@charcoal-ui/styled";
|
|
849
479
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
850
|
-
var SwitchCheckbox = forwardRef7(
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
/* @__PURE__ */ jsx8(SwitchInput, { ...rest, ref }),
|
|
869
|
-
"children" in props ? /* @__PURE__ */ jsx8(LabelInner, { children: props.children }) : void 0
|
|
870
|
-
] });
|
|
871
|
-
}
|
|
872
|
-
);
|
|
873
|
-
var Switch_default = memo3(SwitchCheckbox);
|
|
874
|
-
var Label = styled6.label`
|
|
875
|
-
display: inline-grid;
|
|
876
|
-
grid-template-columns: auto 1fr;
|
|
877
|
-
align-items: center;
|
|
878
|
-
cursor: pointer;
|
|
879
|
-
outline: 0;
|
|
880
|
-
|
|
881
|
-
&:disabled,
|
|
882
|
-
&[aria-disabled]:not([aria-disabled='false']) {
|
|
883
|
-
opacity: 0.32;
|
|
884
|
-
cursor: default;
|
|
885
|
-
}
|
|
886
|
-
`;
|
|
887
|
-
var LabelInner = styled6.div`
|
|
888
|
-
font-size: 14px;
|
|
889
|
-
line-height: 22px;
|
|
890
|
-
color: var(--charcoal-text2);
|
|
891
|
-
margin-left: 4px;
|
|
892
|
-
`;
|
|
893
|
-
var SwitchInput = styled6.input.attrs({ type: "checkbox" })`
|
|
894
|
-
appearance: none;
|
|
895
|
-
display: inline-flex;
|
|
896
|
-
position: relative;
|
|
897
|
-
box-sizing: border-box;
|
|
898
|
-
width: 28px;
|
|
899
|
-
border: 2px solid transparent;
|
|
900
|
-
|
|
901
|
-
transition-property: background-color, box-shadow;
|
|
902
|
-
transition-duration: 0.2s;
|
|
903
|
-
cursor: inherit;
|
|
904
|
-
|
|
905
|
-
outline: none;
|
|
906
|
-
border-radius: 16px;
|
|
907
|
-
height: 16px;
|
|
908
|
-
margin: 0;
|
|
909
|
-
background-color: var(--charcoal-text4);
|
|
910
|
-
:hover {
|
|
911
|
-
background-color: var(--charcoal-text4-hover);
|
|
912
|
-
}
|
|
913
|
-
:active {
|
|
914
|
-
background-color: var(--charcoal-text4-press);
|
|
915
|
-
}
|
|
916
|
-
${focusVisibleFocusRingCss5}
|
|
917
|
-
|
|
918
|
-
&::after {
|
|
919
|
-
content: '';
|
|
920
|
-
position: absolute;
|
|
921
|
-
display: block;
|
|
922
|
-
top: 0;
|
|
923
|
-
left: 0;
|
|
924
|
-
width: 12px;
|
|
925
|
-
height: 12px;
|
|
926
|
-
transform: translateX(0);
|
|
927
|
-
transition: transform 0.2s;
|
|
928
|
-
border-radius: 1024px;
|
|
929
|
-
background-color: var(--charcoal-text5);
|
|
930
|
-
:hover {
|
|
931
|
-
background-color: var(--charcoal-text5-hover);
|
|
932
|
-
}
|
|
933
|
-
:active {
|
|
934
|
-
background-color: var(--charcoal-text5-press);
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
&:checked {
|
|
939
|
-
background-color: var(--charcoal-brand);
|
|
940
|
-
:hover {
|
|
941
|
-
background-color: var(--charcoal-brand-hover);
|
|
942
|
-
}
|
|
943
|
-
:active {
|
|
944
|
-
background-color: var(--charcoal-brand-press);
|
|
945
|
-
}
|
|
946
|
-
&::after {
|
|
947
|
-
transform: translateX(12px);
|
|
948
|
-
transition: transform 0.2s;
|
|
480
|
+
var SwitchCheckbox = forwardRef7(function SwitchCheckboxInner(props, external) {
|
|
481
|
+
const {
|
|
482
|
+
disabled,
|
|
483
|
+
className
|
|
484
|
+
} = props;
|
|
485
|
+
const ariaSwitchProps = useMemo(() => ({
|
|
486
|
+
...props,
|
|
487
|
+
"aria-label": "children" in props ? void 0 : props.label,
|
|
488
|
+
isDisabled: props.disabled,
|
|
489
|
+
isSelected: props.checked
|
|
490
|
+
}), [props]);
|
|
491
|
+
const state = useToggleState(ariaSwitchProps);
|
|
492
|
+
const ref = useObjectRef(external);
|
|
493
|
+
const {
|
|
494
|
+
inputProps: {
|
|
495
|
+
className: _className,
|
|
496
|
+
type: _type,
|
|
497
|
+
...rest
|
|
949
498
|
}
|
|
950
|
-
}
|
|
951
|
-
|
|
499
|
+
} = useSwitch(ariaSwitchProps, state, ref);
|
|
500
|
+
return /* @__PURE__ */ jsxs4(Label, { className, "aria-disabled": disabled, children: [
|
|
501
|
+
/* @__PURE__ */ jsx8(SwitchInput, { ...rest, ref }),
|
|
502
|
+
"children" in props ? /* @__PURE__ */ jsx8(LabelInner, { children: props.children }) : void 0
|
|
503
|
+
] });
|
|
504
|
+
});
|
|
505
|
+
var Switch_default = memo3(SwitchCheckbox);
|
|
506
|
+
var Label = styled6.label.withConfig({
|
|
507
|
+
componentId: "ccl__sc-1wy6z5h-0"
|
|
508
|
+
})(["display:inline-grid;grid-template-columns:auto 1fr;align-items:center;cursor:pointer;outline:0;&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}"]);
|
|
509
|
+
var LabelInner = styled6.div.withConfig({
|
|
510
|
+
componentId: "ccl__sc-1wy6z5h-1"
|
|
511
|
+
})(["font-size:14px;line-height:22px;color:var(--charcoal-text2);margin-left:4px;"]);
|
|
512
|
+
var SwitchInput = styled6.input.attrs({
|
|
513
|
+
type: "checkbox"
|
|
514
|
+
}).withConfig({
|
|
515
|
+
componentId: "ccl__sc-1wy6z5h-2"
|
|
516
|
+
})(["appearance:none;display:inline-flex;position:relative;box-sizing:border-box;width:28px;border:2px solid transparent;transition-property:background-color,box-shadow;transition-duration:0.2s;cursor:inherit;outline:none;border-radius:16px;height:16px;margin:0;background-color:var(--charcoal-text4);:hover{background-color:var(--charcoal-text4-hover);}:active{background-color:var(--charcoal-text4-press);}", " &::after{content:'';position:absolute;display:block;top:0;left:0;width:12px;height:12px;transform:translateX(0);transition:transform 0.2s;border-radius:1024px;background-color:var(--charcoal-text5);:hover{background-color:var(--charcoal-text5-hover);}:active{background-color:var(--charcoal-text5-press);}}&:checked{background-color:var(--charcoal-brand);:hover{background-color:var(--charcoal-brand-hover);}:active{background-color:var(--charcoal-brand-press);}&::after{transform:translateX(12px);transition:transform 0.2s;}}"], focusVisibleFocusRingCss5);
|
|
952
517
|
|
|
953
518
|
// src/components/TextField/index.tsx
|
|
954
519
|
import { useTextField } from "@react-aria/textfield";
|
|
@@ -961,117 +526,34 @@ import styled8, { css as css4 } from "styled-components";
|
|
|
961
526
|
import * as React4 from "react";
|
|
962
527
|
import styled7 from "styled-components";
|
|
963
528
|
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
964
|
-
var FieldLabel = React4.forwardRef(
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
}
|
|
980
|
-
);
|
|
529
|
+
var FieldLabel = React4.forwardRef(function FieldLabel2({
|
|
530
|
+
style,
|
|
531
|
+
className,
|
|
532
|
+
label,
|
|
533
|
+
required = false,
|
|
534
|
+
requiredText,
|
|
535
|
+
subLabel,
|
|
536
|
+
...labelProps
|
|
537
|
+
}, ref) {
|
|
538
|
+
return /* @__PURE__ */ jsxs5(FieldLabelWrapper, { style, className, children: [
|
|
539
|
+
/* @__PURE__ */ jsx9(Label2, { ref, ...labelProps, children: label }),
|
|
540
|
+
required && /* @__PURE__ */ jsx9(RequiredText, { children: requiredText }),
|
|
541
|
+
/* @__PURE__ */ jsx9(SubLabelClickable, { children: /* @__PURE__ */ jsx9("span", { children: subLabel }) })
|
|
542
|
+
] });
|
|
543
|
+
});
|
|
981
544
|
var FieldLabel_default = FieldLabel;
|
|
982
|
-
var Label2 = styled7.label
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
margin-top: -4px;
|
|
995
|
-
}
|
|
996
|
-
&::after {
|
|
997
|
-
display: block;
|
|
998
|
-
width: 0;
|
|
999
|
-
height: 0;
|
|
1000
|
-
content: '';
|
|
1001
|
-
margin-bottom: -4px;
|
|
1002
|
-
}
|
|
1003
|
-
`;
|
|
1004
|
-
var RequiredText = styled7.span`
|
|
1005
|
-
font-size: 14px;
|
|
1006
|
-
line-height: 22px;
|
|
1007
|
-
display: flow-root;
|
|
1008
|
-
color: var(--charcoal-text2);
|
|
1009
|
-
|
|
1010
|
-
&::before {
|
|
1011
|
-
display: block;
|
|
1012
|
-
width: 0;
|
|
1013
|
-
height: 0;
|
|
1014
|
-
content: '';
|
|
1015
|
-
margin-top: -4px;
|
|
1016
|
-
}
|
|
1017
|
-
&::after {
|
|
1018
|
-
display: block;
|
|
1019
|
-
width: 0;
|
|
1020
|
-
height: 0;
|
|
1021
|
-
content: '';
|
|
1022
|
-
margin-bottom: -4px;
|
|
1023
|
-
}
|
|
1024
|
-
`;
|
|
1025
|
-
var SubLabelClickable = styled7.div`
|
|
1026
|
-
font-size: 14px;
|
|
1027
|
-
line-height: 22px;
|
|
1028
|
-
display: flow-root;
|
|
1029
|
-
color: var(--charcoal-text3);
|
|
1030
|
-
transition: 0.2s color, 0.2s box-shadow;
|
|
1031
|
-
|
|
1032
|
-
&::before {
|
|
1033
|
-
display: block;
|
|
1034
|
-
width: 0;
|
|
1035
|
-
height: 0;
|
|
1036
|
-
content: '';
|
|
1037
|
-
margin-top: -4px;
|
|
1038
|
-
}
|
|
1039
|
-
&::after {
|
|
1040
|
-
display: block;
|
|
1041
|
-
width: 0;
|
|
1042
|
-
height: 0;
|
|
1043
|
-
content: '';
|
|
1044
|
-
margin-bottom: -4px;
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
&:not(:disabled):not([aria-disabled]),
|
|
1048
|
-
&[aria-disabled='false'] {
|
|
1049
|
-
&:hover {
|
|
1050
|
-
color: var(--charcoal-text3-hover);
|
|
1051
|
-
}
|
|
1052
|
-
&:active {
|
|
1053
|
-
color: var(--charcoal-text3-press);
|
|
1054
|
-
}
|
|
1055
|
-
&:active,
|
|
1056
|
-
&:focus,
|
|
1057
|
-
&:focus-visible {
|
|
1058
|
-
outline: none;
|
|
1059
|
-
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
`;
|
|
1063
|
-
var FieldLabelWrapper = styled7.div`
|
|
1064
|
-
display: inline-flex;
|
|
1065
|
-
align-items: center;
|
|
1066
|
-
|
|
1067
|
-
> ${RequiredText} {
|
|
1068
|
-
margin-left: 4px;
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
> ${SubLabelClickable} {
|
|
1072
|
-
margin-left: auto;
|
|
1073
|
-
}
|
|
1074
|
-
`;
|
|
545
|
+
var Label2 = styled7.label.withConfig({
|
|
546
|
+
componentId: "ccl__sc-1iotshb-0"
|
|
547
|
+
})(["font-size:14px;line-height:22px;font-weight:bold;display:flow-root;color:var(--charcoal-text1);&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
|
|
548
|
+
var RequiredText = styled7.span.withConfig({
|
|
549
|
+
componentId: "ccl__sc-1iotshb-1"
|
|
550
|
+
})(["font-size:14px;line-height:22px;display:flow-root;color:var(--charcoal-text2);&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
|
|
551
|
+
var SubLabelClickable = styled7.div.withConfig({
|
|
552
|
+
componentId: "ccl__sc-1iotshb-2"
|
|
553
|
+
})(["font-size:14px;line-height:22px;display:flow-root;color:var(--charcoal-text3);transition:0.2s color,0.2s box-shadow;&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{&:hover{color:var(--charcoal-text3-hover);}&:active{color:var(--charcoal-text3-press);}&:active,&:focus,&:focus-visible{outline:none;box-shadow:0 0 0 4px rgba(0,150,250,0.32);}}"]);
|
|
554
|
+
var FieldLabelWrapper = styled7.div.withConfig({
|
|
555
|
+
componentId: "ccl__sc-1iotshb-3"
|
|
556
|
+
})(["display:inline-flex;align-items:center;> ", "{margin-left:4px;}> ", "{margin-left:auto;}"], RequiredText, SubLabelClickable);
|
|
1075
557
|
|
|
1076
558
|
// src/components/TextField/useFocusWithClick.tsx
|
|
1077
559
|
import { useEffect } from "react";
|
|
@@ -1093,417 +575,234 @@ function useFocusWithClick(containerRef, inputRef) {
|
|
|
1093
575
|
}
|
|
1094
576
|
|
|
1095
577
|
// src/components/TextField/index.tsx
|
|
578
|
+
import { mergeProps } from "@react-aria/utils";
|
|
1096
579
|
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1097
|
-
var TextField = React5.forwardRef(
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
}
|
|
1162
|
-
)
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
invalid,
|
|
1168
|
-
"aria-disabled": disabled === true ? true : void 0,
|
|
1169
|
-
hasPrefix: prefix != null,
|
|
1170
|
-
hasSuffix: suffix != null || showCount,
|
|
1171
|
-
children: [
|
|
1172
|
-
prefix && /* @__PURE__ */ jsx10(PrefixContainer, { children: prefix }),
|
|
1173
|
-
/* @__PURE__ */ jsx10(
|
|
1174
|
-
StyledInput,
|
|
1175
|
-
{
|
|
1176
|
-
ref: mergeRefs(forwardRef18, ariaRef),
|
|
1177
|
-
invalid,
|
|
1178
|
-
...inputProps
|
|
1179
|
-
}
|
|
1180
|
-
),
|
|
1181
|
-
(suffix || showCount) && /* @__PURE__ */ jsxs6(SuffixContainer, { children: [
|
|
1182
|
-
suffix,
|
|
1183
|
-
showCount && /* @__PURE__ */ jsx10(SingleLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
1184
|
-
] })
|
|
1185
|
-
]
|
|
1186
|
-
}
|
|
1187
|
-
),
|
|
1188
|
-
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx10(
|
|
1189
|
-
AssistiveText,
|
|
1190
|
-
{
|
|
1191
|
-
invalid,
|
|
1192
|
-
...invalid ? errorMessageProps : descriptionProps,
|
|
1193
|
-
children: assistiveText
|
|
1194
|
-
}
|
|
1195
|
-
)
|
|
1196
|
-
] });
|
|
1197
|
-
}
|
|
1198
|
-
);
|
|
580
|
+
var TextField = React5.forwardRef(function SingleLineTextFieldInner({
|
|
581
|
+
onChange,
|
|
582
|
+
...props
|
|
583
|
+
}, forwardRef18) {
|
|
584
|
+
const {
|
|
585
|
+
className,
|
|
586
|
+
showLabel = false,
|
|
587
|
+
showCount = false,
|
|
588
|
+
label,
|
|
589
|
+
requiredText,
|
|
590
|
+
subLabel,
|
|
591
|
+
disabled = false,
|
|
592
|
+
required,
|
|
593
|
+
invalid = false,
|
|
594
|
+
assistiveText,
|
|
595
|
+
maxLength,
|
|
596
|
+
prefix = null,
|
|
597
|
+
suffix = null,
|
|
598
|
+
...restProps
|
|
599
|
+
} = props;
|
|
600
|
+
const {
|
|
601
|
+
visuallyHiddenProps
|
|
602
|
+
} = useVisuallyHidden();
|
|
603
|
+
const ariaRef = useRef(null);
|
|
604
|
+
const [count, setCount] = useState(countCodePointsInString(props.value ?? ""));
|
|
605
|
+
const nonControlled = props.value === void 0;
|
|
606
|
+
const handleChange = useCallback3((value) => {
|
|
607
|
+
const count2 = countCodePointsInString(value);
|
|
608
|
+
if (maxLength !== void 0 && count2 > maxLength) {
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
if (nonControlled) {
|
|
612
|
+
setCount(count2);
|
|
613
|
+
}
|
|
614
|
+
onChange?.(value);
|
|
615
|
+
}, [maxLength, nonControlled, onChange]);
|
|
616
|
+
useEffect2(() => {
|
|
617
|
+
setCount(countCodePointsInString(props.value ?? ""));
|
|
618
|
+
}, [props.value]);
|
|
619
|
+
const {
|
|
620
|
+
inputProps: ariaInputProps,
|
|
621
|
+
labelProps,
|
|
622
|
+
descriptionProps,
|
|
623
|
+
errorMessageProps
|
|
624
|
+
} = useTextField({
|
|
625
|
+
inputElementType: "input",
|
|
626
|
+
isDisabled: disabled,
|
|
627
|
+
isRequired: required,
|
|
628
|
+
validationState: invalid ? "invalid" : "valid",
|
|
629
|
+
description: !invalid && assistiveText,
|
|
630
|
+
errorMessage: invalid && assistiveText,
|
|
631
|
+
onChange: handleChange,
|
|
632
|
+
...props
|
|
633
|
+
}, ariaRef);
|
|
634
|
+
const containerRef = useRef(null);
|
|
635
|
+
useFocusWithClick(containerRef, ariaRef);
|
|
636
|
+
const inputProps = mergeProps(restProps, ariaInputProps);
|
|
637
|
+
return /* @__PURE__ */ jsxs6(TextFieldRoot, { className, isDisabled: disabled, children: [
|
|
638
|
+
/* @__PURE__ */ jsx10(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
639
|
+
/* @__PURE__ */ jsxs6(StyledInputContainer, { ref: containerRef, invalid, "aria-disabled": disabled === true ? true : void 0, hasPrefix: prefix != null, hasSuffix: suffix != null || showCount, children: [
|
|
640
|
+
prefix && /* @__PURE__ */ jsx10(PrefixContainer, { children: prefix }),
|
|
641
|
+
/* @__PURE__ */ jsx10(StyledInput, { ref: mergeRefs(forwardRef18, ariaRef), invalid, ...inputProps }),
|
|
642
|
+
(suffix || showCount) && /* @__PURE__ */ jsxs6(SuffixContainer, { children: [
|
|
643
|
+
suffix,
|
|
644
|
+
showCount && /* @__PURE__ */ jsx10(SingleLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
645
|
+
] })
|
|
646
|
+
] }),
|
|
647
|
+
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx10(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
|
|
648
|
+
] });
|
|
649
|
+
});
|
|
1199
650
|
var TextField_default = TextField;
|
|
1200
|
-
var TextFieldRoot = styled8.div
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
:focus-within {
|
|
1228
|
-
outline: none;
|
|
1229
|
-
box-shadow: 0 0 0 4px
|
|
1230
|
-
${(p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`};
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
|
-
${(p) => p.invalid && css4`
|
|
1234
|
-
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
1235
|
-
`}
|
|
1236
|
-
`;
|
|
1237
|
-
var PrefixContainer = styled8.div`
|
|
1238
|
-
display: flex;
|
|
1239
|
-
align-items: center;
|
|
1240
|
-
`;
|
|
1241
|
-
var SuffixContainer = styled8.span`
|
|
1242
|
-
display: flex;
|
|
1243
|
-
align-items: center;
|
|
1244
|
-
gap: 8px;
|
|
1245
|
-
`;
|
|
1246
|
-
var StyledInput = styled8.input`
|
|
1247
|
-
border: none;
|
|
1248
|
-
box-sizing: border-box;
|
|
1249
|
-
outline: none;
|
|
1250
|
-
font-family: inherit;
|
|
1251
|
-
|
|
1252
|
-
/* Prevent zooming for iOS Safari */
|
|
1253
|
-
transform-origin: top left;
|
|
1254
|
-
transform: scale(0.875);
|
|
1255
|
-
width: calc(100% / 0.875);
|
|
1256
|
-
height: calc(100% / 0.875);
|
|
1257
|
-
font-size: calc(14px / 0.875);
|
|
1258
|
-
line-height: calc(22px / 0.875);
|
|
1259
|
-
padding-left: 0;
|
|
1260
|
-
padding-right: 0;
|
|
1261
|
-
border-radius: calc(4px / 0.875);
|
|
1262
|
-
|
|
1263
|
-
/* Display box-shadow for iOS Safari */
|
|
1264
|
-
appearance: none;
|
|
1265
|
-
background: transparent;
|
|
1266
|
-
|
|
1267
|
-
color: var(--charcoal-text2);
|
|
1268
|
-
&::placeholder {
|
|
1269
|
-
color: var(--charcoal-text3);
|
|
1270
|
-
}
|
|
1271
|
-
`;
|
|
1272
|
-
var SingleLineCounter = styled8.span`
|
|
1273
|
-
line-height: 22px;
|
|
1274
|
-
font-size: 14px;
|
|
1275
|
-
color: var(--charcoal-text3);
|
|
1276
|
-
`;
|
|
1277
|
-
var AssistiveText = styled8.p`
|
|
1278
|
-
font-size: 14px;
|
|
1279
|
-
line-height: 22px;
|
|
1280
|
-
margin-top: 4px;
|
|
1281
|
-
margin-bottom: -4px;
|
|
1282
|
-
color: ${(p) => `var(--charcoal-${p.invalid ? `assertive` : `text2`})`};
|
|
1283
|
-
`;
|
|
651
|
+
var TextFieldRoot = styled8.div.withConfig({
|
|
652
|
+
componentId: "ccl__sc-3dd0tt-0"
|
|
653
|
+
})(["display:flex;flex-direction:column;", ""], (p) => p.isDisabled && {
|
|
654
|
+
opacity: p.theme.elementEffect.disabled.opacity
|
|
655
|
+
});
|
|
656
|
+
var TextFieldLabel = styled8(FieldLabel_default).withConfig({
|
|
657
|
+
componentId: "ccl__sc-3dd0tt-1"
|
|
658
|
+
})(["margin-bottom:8px;"]);
|
|
659
|
+
var StyledInputContainer = styled8.div.withConfig({
|
|
660
|
+
componentId: "ccl__sc-3dd0tt-2"
|
|
661
|
+
})(["display:grid;grid-template-columns:", ";height:40px;transition:0.2s background-color,0.2s box-shadow;color:var(--charcoal-text2);background-color:var(--charcoal-surface3);border-radius:4px;gap:4px;padding:0 8px;line-height:22px;font-size:14px;:not(:disabled):not([aria-disabled]):hover,[aria-disabled='false']:hover{background-color:var(--charcoal-surface3-hover);}:focus-within{outline:none;box-shadow:0 0 0 4px ", ";}", ""], (p) => [p.hasPrefix && "auto", "1fr", p.hasSuffix && "auto"].filter(Boolean).join(" "), (p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`, (p) => p.invalid && css4(["box-shadow:0 0 0 4px rgba(255,43,0,0.32);"]));
|
|
662
|
+
var PrefixContainer = styled8.div.withConfig({
|
|
663
|
+
componentId: "ccl__sc-3dd0tt-3"
|
|
664
|
+
})(["display:flex;align-items:center;"]);
|
|
665
|
+
var SuffixContainer = styled8.span.withConfig({
|
|
666
|
+
componentId: "ccl__sc-3dd0tt-4"
|
|
667
|
+
})(["display:flex;align-items:center;gap:8px;"]);
|
|
668
|
+
var StyledInput = styled8.input.withConfig({
|
|
669
|
+
componentId: "ccl__sc-3dd0tt-5"
|
|
670
|
+
})(["border:none;box-sizing:border-box;outline:none;font-family:inherit;transform-origin:top left;transform:scale(0.875);width:calc(100% / 0.875);height:calc(100% / 0.875);font-size:calc(14px / 0.875);line-height:calc(22px / 0.875);padding-left:0;padding-right:0;border-radius:calc(4px / 0.875);appearance:none;background:transparent;color:var(--charcoal-text2);&::placeholder{color:var(--charcoal-text3);}"]);
|
|
671
|
+
var SingleLineCounter = styled8.span.withConfig({
|
|
672
|
+
componentId: "ccl__sc-3dd0tt-6"
|
|
673
|
+
})(["line-height:22px;font-size:14px;color:var(--charcoal-text3);"]);
|
|
674
|
+
var AssistiveText = styled8.p.withConfig({
|
|
675
|
+
componentId: "ccl__sc-3dd0tt-7"
|
|
676
|
+
})(["font-size:14px;line-height:22px;margin-top:4px;margin-bottom:-4px;color:", ";"], (p) => `var(--charcoal-${p.invalid ? `assertive` : `text2`})`);
|
|
1284
677
|
|
|
1285
678
|
// src/components/TextArea/index.tsx
|
|
1286
679
|
import { useTextField as useTextField2 } from "@react-aria/textfield";
|
|
1287
680
|
import { useVisuallyHidden as useVisuallyHidden2 } from "@react-aria/visually-hidden";
|
|
1288
681
|
import { forwardRef as forwardRef10, useCallback as useCallback4, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
|
|
1289
682
|
import styled9, { css as css5 } from "styled-components";
|
|
683
|
+
import { mergeProps as mergeProps2 } from "@react-aria/utils";
|
|
1290
684
|
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1291
|
-
var TextArea = forwardRef10(
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
685
|
+
var TextArea = forwardRef10(function TextAreaInner({
|
|
686
|
+
onChange,
|
|
687
|
+
...props
|
|
688
|
+
}, forwardRef18) {
|
|
689
|
+
const {
|
|
690
|
+
className,
|
|
691
|
+
showCount = false,
|
|
692
|
+
showLabel = false,
|
|
693
|
+
label,
|
|
694
|
+
requiredText,
|
|
695
|
+
subLabel,
|
|
696
|
+
disabled = false,
|
|
697
|
+
required,
|
|
698
|
+
invalid = false,
|
|
699
|
+
assistiveText,
|
|
700
|
+
maxLength,
|
|
701
|
+
autoHeight = false,
|
|
702
|
+
rows: initialRows = 4,
|
|
703
|
+
...restProps
|
|
704
|
+
} = props;
|
|
705
|
+
const {
|
|
706
|
+
visuallyHiddenProps
|
|
707
|
+
} = useVisuallyHidden2();
|
|
708
|
+
const textareaRef = useRef2(null);
|
|
709
|
+
const ariaRef = useRef2(null);
|
|
710
|
+
const [count, setCount] = useState2(countCodePointsInString(props.value ?? ""));
|
|
711
|
+
const [rows, setRows] = useState2(initialRows);
|
|
712
|
+
const syncHeight = useCallback4((textarea) => {
|
|
713
|
+
const rows2 = (`${textarea.value}
|
|
1318
714
|
`.match(/\n/gu)?.length ?? 0) || 1;
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
const
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
/* @__PURE__ */ jsx11(
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
subLabel,
|
|
1371
|
-
...labelProps,
|
|
1372
|
-
...!showLabel ? visuallyHiddenProps : {}
|
|
1373
|
-
}
|
|
1374
|
-
),
|
|
1375
|
-
/* @__PURE__ */ jsxs7(
|
|
1376
|
-
StyledTextareaContainer,
|
|
1377
|
-
{
|
|
1378
|
-
ref: containerRef,
|
|
1379
|
-
invalid,
|
|
1380
|
-
rows: showCount ? rows + 1 : rows,
|
|
1381
|
-
"aria-disabled": disabled === true ? "true" : void 0,
|
|
1382
|
-
children: [
|
|
1383
|
-
/* @__PURE__ */ jsx11(
|
|
1384
|
-
StyledTextarea,
|
|
1385
|
-
{
|
|
1386
|
-
ref: mergeRefs(textareaRef, forwardRef18, ariaRef),
|
|
1387
|
-
rows,
|
|
1388
|
-
noBottomPadding: showCount,
|
|
1389
|
-
...inputProps
|
|
1390
|
-
}
|
|
1391
|
-
),
|
|
1392
|
-
showCount && /* @__PURE__ */ jsx11(MultiLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
1393
|
-
]
|
|
1394
|
-
}
|
|
1395
|
-
),
|
|
1396
|
-
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx11(
|
|
1397
|
-
AssistiveText,
|
|
1398
|
-
{
|
|
1399
|
-
invalid,
|
|
1400
|
-
...invalid ? errorMessageProps : descriptionProps,
|
|
1401
|
-
children: assistiveText
|
|
1402
|
-
}
|
|
1403
|
-
)
|
|
1404
|
-
] });
|
|
1405
|
-
}
|
|
1406
|
-
);
|
|
715
|
+
setRows(initialRows <= rows2 ? rows2 : initialRows);
|
|
716
|
+
}, [initialRows]);
|
|
717
|
+
const nonControlled = props.value === void 0;
|
|
718
|
+
const handleChange = useCallback4((value) => {
|
|
719
|
+
const count2 = countCodePointsInString(value);
|
|
720
|
+
if (maxLength !== void 0 && count2 > maxLength) {
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
if (nonControlled) {
|
|
724
|
+
setCount(count2);
|
|
725
|
+
}
|
|
726
|
+
if (autoHeight && textareaRef.current !== null) {
|
|
727
|
+
syncHeight(textareaRef.current);
|
|
728
|
+
}
|
|
729
|
+
onChange?.(value);
|
|
730
|
+
}, [autoHeight, maxLength, nonControlled, onChange, syncHeight]);
|
|
731
|
+
useEffect3(() => {
|
|
732
|
+
setCount(countCodePointsInString(props.value ?? ""));
|
|
733
|
+
}, [props.value]);
|
|
734
|
+
const {
|
|
735
|
+
inputProps: ariaInputProps,
|
|
736
|
+
labelProps,
|
|
737
|
+
descriptionProps,
|
|
738
|
+
errorMessageProps
|
|
739
|
+
} = useTextField2({
|
|
740
|
+
inputElementType: "textarea",
|
|
741
|
+
isDisabled: disabled,
|
|
742
|
+
isRequired: required,
|
|
743
|
+
validationState: invalid ? "invalid" : "valid",
|
|
744
|
+
description: !invalid && assistiveText,
|
|
745
|
+
errorMessage: invalid && assistiveText,
|
|
746
|
+
onChange: handleChange,
|
|
747
|
+
...props
|
|
748
|
+
}, ariaRef);
|
|
749
|
+
useEffect3(() => {
|
|
750
|
+
if (autoHeight && textareaRef.current !== null) {
|
|
751
|
+
syncHeight(textareaRef.current);
|
|
752
|
+
}
|
|
753
|
+
}, [autoHeight, syncHeight]);
|
|
754
|
+
const containerRef = useRef2(null);
|
|
755
|
+
useFocusWithClick(containerRef, ariaRef);
|
|
756
|
+
const inputProps = mergeProps2(restProps, ariaInputProps);
|
|
757
|
+
return /* @__PURE__ */ jsxs7(TextFieldRoot2, { className, isDisabled: disabled, children: [
|
|
758
|
+
/* @__PURE__ */ jsx11(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
759
|
+
/* @__PURE__ */ jsxs7(StyledTextareaContainer, { ref: containerRef, invalid, rows: showCount ? rows + 1 : rows, "aria-disabled": disabled === true ? "true" : void 0, children: [
|
|
760
|
+
/* @__PURE__ */ jsx11(StyledTextarea, { ref: mergeRefs(textareaRef, forwardRef18, ariaRef), rows, noBottomPadding: showCount, ...inputProps }),
|
|
761
|
+
showCount && /* @__PURE__ */ jsx11(MultiLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
762
|
+
] }),
|
|
763
|
+
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx11(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
|
|
764
|
+
] });
|
|
765
|
+
});
|
|
1407
766
|
var TextArea_default = TextArea;
|
|
1408
|
-
var TextFieldRoot2 = styled9.div
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
:not([aria-disabled]):hover,
|
|
1428
|
-
[aria-disabled='false']:hover {
|
|
1429
|
-
background-color: var(--charcoal-surface3-hover);
|
|
1430
|
-
}
|
|
1431
|
-
:focus-within {
|
|
1432
|
-
outline: none;
|
|
1433
|
-
box-shadow: 0 0 0 4px
|
|
1434
|
-
${(p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`};
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
${(p) => p.invalid && css5`
|
|
1438
|
-
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
1439
|
-
`}
|
|
1440
|
-
`;
|
|
1441
|
-
var StyledTextarea = styled9.textarea`
|
|
1442
|
-
border: none;
|
|
1443
|
-
outline: none;
|
|
1444
|
-
resize: none;
|
|
1445
|
-
font-family: inherit;
|
|
1446
|
-
color: inherit;
|
|
1447
|
-
box-sizing: border-box;
|
|
1448
|
-
|
|
1449
|
-
/* Prevent zooming for iOS Safari */
|
|
1450
|
-
transform-origin: top left;
|
|
1451
|
-
transform: scale(0.875);
|
|
1452
|
-
width: calc(100% / 0.875);
|
|
1453
|
-
font-size: calc(14px / 0.875);
|
|
1454
|
-
line-height: calc(22px / 0.875);
|
|
1455
|
-
padding: calc(9px / 0.875) calc(8px / 0.875)
|
|
1456
|
-
${(p) => p.noBottomPadding ? 0 : ""};
|
|
1457
|
-
|
|
1458
|
-
${({ rows = 1, noBottomPadding }) => css5`
|
|
1459
|
-
height: calc(22px / 0.875 * ${rows} + ${noBottomPadding ? 9 : 20}px);
|
|
1460
|
-
`};
|
|
1461
|
-
|
|
1462
|
-
/* Display box-shadow for iOS Safari */
|
|
1463
|
-
appearance: none;
|
|
1464
|
-
|
|
1465
|
-
background: none;
|
|
1466
|
-
|
|
1467
|
-
&::placeholder {
|
|
1468
|
-
color: var(--charcoal-text3);
|
|
1469
|
-
}
|
|
1470
|
-
`;
|
|
1471
|
-
var MultiLineCounter = styled9.span`
|
|
1472
|
-
position: absolute;
|
|
1473
|
-
bottom: 9px;
|
|
1474
|
-
right: 8px;
|
|
1475
|
-
|
|
1476
|
-
line-height: 22px;
|
|
1477
|
-
font-size: 14px;
|
|
1478
|
-
color: var(--charcoal-text3);
|
|
1479
|
-
`;
|
|
767
|
+
var TextFieldRoot2 = styled9.div.withConfig({
|
|
768
|
+
componentId: "ccl__sc-58waht-0"
|
|
769
|
+
})(["display:flex;flex-direction:column;", ""], (p) => p.isDisabled && {
|
|
770
|
+
opacity: p.theme.elementEffect.disabled.opacity
|
|
771
|
+
});
|
|
772
|
+
var StyledTextareaContainer = styled9.div.withConfig({
|
|
773
|
+
componentId: "ccl__sc-58waht-1"
|
|
774
|
+
})(["position:relative;overflow:hidden;color:var(--charcoal-text2);background-color:var(--charcoal-surface3);border-radius:4px;transition:0.2s background-color,0.2s box-shadow;", ";:not([aria-disabled]):hover,[aria-disabled='false']:hover{background-color:var(--charcoal-surface3-hover);}:focus-within{outline:none;box-shadow:0 0 0 4px ", ";}", ""], ({
|
|
775
|
+
rows
|
|
776
|
+
}) => css5(["height:calc(22px * ", " + 18px);"], rows), (p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`, (p) => p.invalid && css5(["box-shadow:0 0 0 4px rgba(255,43,0,0.32);"]));
|
|
777
|
+
var StyledTextarea = styled9.textarea.withConfig({
|
|
778
|
+
componentId: "ccl__sc-58waht-2"
|
|
779
|
+
})(["border:none;outline:none;resize:none;font-family:inherit;color:inherit;box-sizing:border-box;transform-origin:top left;transform:scale(0.875);width:calc(100% / 0.875);font-size:calc(14px / 0.875);line-height:calc(22px / 0.875);padding:calc(9px / 0.875) calc(8px / 0.875) ", ";", ";appearance:none;background:none;&::placeholder{color:var(--charcoal-text3);}"], (p) => p.noBottomPadding ? 0 : "", ({
|
|
780
|
+
rows = 1,
|
|
781
|
+
noBottomPadding
|
|
782
|
+
}) => css5(["height:calc(22px / 0.875 * ", " + ", "px);"], rows, noBottomPadding ? 9 : 20));
|
|
783
|
+
var MultiLineCounter = styled9.span.withConfig({
|
|
784
|
+
componentId: "ccl__sc-58waht-3"
|
|
785
|
+
})(["position:absolute;bottom:9px;right:8px;line-height:22px;font-size:14px;color:var(--charcoal-text3);"]);
|
|
1480
786
|
|
|
1481
787
|
// src/components/Icon/index.tsx
|
|
1482
788
|
import * as React6 from "react";
|
|
1483
789
|
import "@charcoal-ui/icons";
|
|
1484
790
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1485
|
-
var Icon = React6.forwardRef(function IconInner({
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
class: className,
|
|
1494
|
-
...rest
|
|
1495
|
-
}
|
|
1496
|
-
);
|
|
791
|
+
var Icon = React6.forwardRef(function IconInner({
|
|
792
|
+
name,
|
|
793
|
+
scale,
|
|
794
|
+
unsafeNonGuidelineScale,
|
|
795
|
+
className,
|
|
796
|
+
...rest
|
|
797
|
+
}, ref) {
|
|
798
|
+
return /* @__PURE__ */ jsx12("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
|
|
1497
799
|
});
|
|
1498
800
|
var Icon_default = Icon;
|
|
1499
801
|
|
|
1500
802
|
// src/components/Modal/index.tsx
|
|
1501
803
|
import { useContext as useContext4, forwardRef as forwardRef13, memo as memo4 } from "react";
|
|
1502
|
-
import * as
|
|
1503
|
-
import {
|
|
1504
|
-
Overlay,
|
|
1505
|
-
useModalOverlay
|
|
1506
|
-
} from "@react-aria/overlays";
|
|
804
|
+
import * as React10 from "react";
|
|
805
|
+
import { Overlay } from "@react-aria/overlays";
|
|
1507
806
|
import styled11, { css as css7, useTheme } from "styled-components";
|
|
1508
807
|
import { maxWidth as maxWidth2 } from "@charcoal-ui/utils";
|
|
1509
808
|
import { useMedia } from "@charcoal-ui/styled";
|
|
@@ -1546,29 +845,16 @@ function useForwardedRef(ref) {
|
|
|
1546
845
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1547
846
|
var Dialog = forwardRef12(function Dialog2(props, forwardRef18) {
|
|
1548
847
|
const ref = useForwardedRef(forwardRef18);
|
|
1549
|
-
const {
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
);
|
|
1555
|
-
return /* @__PURE__ */ jsx13(
|
|
1556
|
-
AnimatedStyledDialogDiv,
|
|
1557
|
-
{
|
|
1558
|
-
...props,
|
|
1559
|
-
role: dialogProps.role,
|
|
1560
|
-
tabIndex: dialogProps.tabIndex,
|
|
1561
|
-
"aria-labelledby": dialogProps["aria-labelledby"],
|
|
1562
|
-
onBlur: dialogProps.onBlur,
|
|
1563
|
-
ref
|
|
1564
|
-
}
|
|
1565
|
-
);
|
|
848
|
+
const {
|
|
849
|
+
dialogProps
|
|
850
|
+
} = useDialog({
|
|
851
|
+
role: "dialog"
|
|
852
|
+
}, ref);
|
|
853
|
+
return /* @__PURE__ */ jsx13(AnimatedStyledDialogDiv, { ...props, role: dialogProps.role, tabIndex: dialogProps.tabIndex, "aria-labelledby": dialogProps["aria-labelledby"], onBlur: dialogProps.onBlur, ref });
|
|
1566
854
|
});
|
|
1567
|
-
var AnimatedStyledDialogDiv = animated(styled10.div
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
height: fit-content;
|
|
1571
|
-
width: ${(p) => {
|
|
855
|
+
var AnimatedStyledDialogDiv = animated(styled10.div.withConfig({
|
|
856
|
+
componentId: "ccl__sc-1ep4f6v-0"
|
|
857
|
+
})(["margin:auto;position:relative;height:fit-content;width:", "px;background-color:var(--charcoal-surface1);border-radius:24px;@media ", "{max-width:440px;width:calc(100% - 48px);", "}:focus{outline:none;}"], (p) => {
|
|
1572
858
|
switch (p.size) {
|
|
1573
859
|
case "S": {
|
|
1574
860
|
return columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
|
|
@@ -1583,39 +869,48 @@ var AnimatedStyledDialogDiv = animated(styled10.div`
|
|
|
1583
869
|
return unreachable(p.size);
|
|
1584
870
|
}
|
|
1585
871
|
}
|
|
1586
|
-
}
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
border-radius: 24px;
|
|
1590
|
-
|
|
1591
|
-
@media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {
|
|
1592
|
-
max-width: 440px;
|
|
1593
|
-
width: calc(100% - 48px);
|
|
1594
|
-
${(p) => p.bottomSheet !== false && css6`
|
|
1595
|
-
max-width: unset;
|
|
1596
|
-
width: 100%;
|
|
1597
|
-
border-radius: 0;
|
|
1598
|
-
margin: auto 0 0 0;
|
|
1599
|
-
${p.bottomSheet === "full" && css6`
|
|
1600
|
-
min-height: 100%;
|
|
1601
|
-
`}
|
|
1602
|
-
`}
|
|
1603
|
-
}
|
|
1604
|
-
:focus {
|
|
1605
|
-
outline: none;
|
|
1606
|
-
}
|
|
1607
|
-
`);
|
|
872
|
+
}, ({
|
|
873
|
+
theme
|
|
874
|
+
}) => maxWidth(theme.breakpoint.screen1), (p) => p.bottomSheet !== false && css6(["max-width:unset;width:100%;border-radius:0;margin:auto 0 0 0;", ""], p.bottomSheet === "full" && css6(["min-height:100%;"]))));
|
|
1608
875
|
|
|
1609
876
|
// src/components/Modal/ModalBackgroundContext.tsx
|
|
1610
877
|
import * as React8 from "react";
|
|
1611
|
-
var ModalBackgroundContext = React8.createContext(
|
|
1612
|
-
|
|
1613
|
-
|
|
878
|
+
var ModalBackgroundContext = React8.createContext(null);
|
|
879
|
+
|
|
880
|
+
// src/components/Modal/useCustomModalOverlay.tsx
|
|
881
|
+
import * as React9 from "react";
|
|
882
|
+
import { ariaHideOutside, useOverlay, useOverlayFocusContain } from "@react-aria/overlays";
|
|
883
|
+
function useCharcoalModalOverlay(props, state, ref) {
|
|
884
|
+
const {
|
|
885
|
+
overlayProps,
|
|
886
|
+
underlayProps
|
|
887
|
+
} = useOverlay({
|
|
888
|
+
...props,
|
|
889
|
+
isOpen: state.isOpen,
|
|
890
|
+
onClose: state.onClose,
|
|
891
|
+
shouldCloseOnInteractOutside: () => false
|
|
892
|
+
}, ref);
|
|
893
|
+
useOverlayFocusContain();
|
|
894
|
+
React9.useEffect(() => {
|
|
895
|
+
if (state.isOpen && ref.current) {
|
|
896
|
+
return ariaHideOutside([ref.current]);
|
|
897
|
+
}
|
|
898
|
+
}, [state.isOpen, ref]);
|
|
899
|
+
return {
|
|
900
|
+
modalProps: overlayProps,
|
|
901
|
+
underlayProps
|
|
902
|
+
};
|
|
903
|
+
}
|
|
1614
904
|
|
|
1615
905
|
// src/components/Modal/index.tsx
|
|
1616
906
|
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1617
907
|
var DEFAULT_Z_INDEX = 10;
|
|
1618
|
-
var Modal = forwardRef13(function ModalInner({
|
|
908
|
+
var Modal = forwardRef13(function ModalInner({
|
|
909
|
+
children,
|
|
910
|
+
zIndex = DEFAULT_Z_INDEX,
|
|
911
|
+
portalContainer,
|
|
912
|
+
...props
|
|
913
|
+
}, external) {
|
|
1619
914
|
const {
|
|
1620
915
|
title,
|
|
1621
916
|
size = "M",
|
|
@@ -1626,23 +921,16 @@ var Modal = forwardRef13(function ModalInner({ children, zIndex = DEFAULT_Z_INDE
|
|
|
1626
921
|
isOpen = false
|
|
1627
922
|
} = props;
|
|
1628
923
|
const ref = useObjectRef2(external);
|
|
1629
|
-
const {
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
setOpen: () => {
|
|
1640
|
-
},
|
|
1641
|
-
toggle: () => {
|
|
1642
|
-
}
|
|
1643
|
-
},
|
|
1644
|
-
ref
|
|
1645
|
-
);
|
|
924
|
+
const {
|
|
925
|
+
modalProps,
|
|
926
|
+
underlayProps
|
|
927
|
+
} = useCharcoalModalOverlay({
|
|
928
|
+
...props,
|
|
929
|
+
isKeyboardDismissDisabled: isDismissable === void 0 || isDismissable === false
|
|
930
|
+
}, {
|
|
931
|
+
onClose,
|
|
932
|
+
isOpen
|
|
933
|
+
}, ref);
|
|
1646
934
|
const theme = useTheme();
|
|
1647
935
|
const isMobile = useMedia(maxWidth2(theme.breakpoint.screen1)) ?? false;
|
|
1648
936
|
const transitionEnabled = isMobile && bottomSheet !== false;
|
|
@@ -1665,113 +953,67 @@ var Modal = forwardRef13(function ModalInner({ children, zIndex = DEFAULT_Z_INDE
|
|
|
1665
953
|
backgroundColor: "rgba(0, 0, 0, 0)",
|
|
1666
954
|
overflow: "hidden"
|
|
1667
955
|
},
|
|
1668
|
-
config: transitionEnabled ? {
|
|
956
|
+
config: transitionEnabled ? {
|
|
957
|
+
duration: 400,
|
|
958
|
+
easing: easings.easeOutQuart
|
|
959
|
+
} : {
|
|
960
|
+
duration: 0
|
|
961
|
+
}
|
|
1669
962
|
});
|
|
1670
|
-
const bgRef =
|
|
1671
|
-
|
|
1672
|
-
(
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
close: onClose,
|
|
1696
|
-
showDismiss,
|
|
1697
|
-
bottomSheet
|
|
1698
|
-
},
|
|
1699
|
-
children: [
|
|
1700
|
-
children,
|
|
1701
|
-
isDismissable === true && /* @__PURE__ */ jsx14(
|
|
1702
|
-
ModalCrossButton,
|
|
1703
|
-
{
|
|
1704
|
-
size: "S",
|
|
1705
|
-
icon: "24/Close",
|
|
1706
|
-
onClick: onClose
|
|
1707
|
-
}
|
|
1708
|
-
)
|
|
1709
|
-
]
|
|
1710
|
-
}
|
|
1711
|
-
)
|
|
1712
|
-
}
|
|
1713
|
-
) })
|
|
1714
|
-
}
|
|
1715
|
-
) })
|
|
1716
|
-
);
|
|
963
|
+
const bgRef = React10.useRef(null);
|
|
964
|
+
const handleClick = React10.useCallback((e) => {
|
|
965
|
+
if (e.currentTarget === e.target) {
|
|
966
|
+
onClose();
|
|
967
|
+
}
|
|
968
|
+
}, [onClose]);
|
|
969
|
+
return transition(({
|
|
970
|
+
backgroundColor,
|
|
971
|
+
overflow,
|
|
972
|
+
transform
|
|
973
|
+
}, item) => item && /* @__PURE__ */ jsx14(Overlay, { portalContainer, children: /* @__PURE__ */ jsx14(ModalBackground, { ref: bgRef, zIndex, ...underlayProps, style: transitionEnabled ? {
|
|
974
|
+
backgroundColor,
|
|
975
|
+
overflow
|
|
976
|
+
} : {}, $bottomSheet: bottomSheet, onClick: handleClick, children: /* @__PURE__ */ jsx14(ModalBackgroundContext.Provider, { value: bgRef.current, children: /* @__PURE__ */ jsx14(Dialog, { ref, ...modalProps, style: transitionEnabled ? {
|
|
977
|
+
transform
|
|
978
|
+
} : {}, size, bottomSheet, className, children: /* @__PURE__ */ jsxs8(ModalContext.Provider, { value: {
|
|
979
|
+
titleProps: {},
|
|
980
|
+
title,
|
|
981
|
+
close: onClose,
|
|
982
|
+
showDismiss,
|
|
983
|
+
bottomSheet
|
|
984
|
+
}, children: [
|
|
985
|
+
children,
|
|
986
|
+
isDismissable === true && /* @__PURE__ */ jsx14(ModalCrossButton, { size: "S", icon: "24/Close", onClick: onClose })
|
|
987
|
+
] }) }) }) }) }));
|
|
1717
988
|
});
|
|
1718
989
|
var Modal_default = memo4(Modal);
|
|
1719
|
-
var ModalContext =
|
|
990
|
+
var ModalContext = React10.createContext({
|
|
1720
991
|
titleProps: {},
|
|
1721
992
|
title: "",
|
|
1722
993
|
close: void 0,
|
|
1723
994
|
showDismiss: true,
|
|
1724
995
|
bottomSheet: false
|
|
1725
996
|
});
|
|
1726
|
-
var ModalBackground = animated2(styled11.div
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
justify-content: center;
|
|
1737
|
-
padding: 40px 0;
|
|
1738
|
-
box-sizing: border-box;
|
|
1739
|
-
|
|
1740
|
-
background-color: var(--charcoal-surface4);
|
|
1741
|
-
|
|
1742
|
-
@media ${({ theme }) => maxWidth2(theme.breakpoint.screen1)} {
|
|
1743
|
-
${(p) => p.$bottomSheet !== false && css7`
|
|
1744
|
-
padding: 0;
|
|
1745
|
-
`}
|
|
1746
|
-
}
|
|
1747
|
-
`);
|
|
1748
|
-
var ModalCrossButton = styled11(IconButton_default)`
|
|
1749
|
-
position: absolute;
|
|
1750
|
-
top: 8px;
|
|
1751
|
-
right: 8px;
|
|
1752
|
-
|
|
1753
|
-
color: var(--charcoal-text3);
|
|
1754
|
-
transition: 0.2s color;
|
|
1755
|
-
|
|
1756
|
-
&:not(:disabled):not([aria-disabled]),
|
|
1757
|
-
&[aria-disabled='false'] {
|
|
1758
|
-
&:hover {
|
|
1759
|
-
color: var(--charcoal-text3-hover);
|
|
1760
|
-
}
|
|
1761
|
-
&:active {
|
|
1762
|
-
color: var(--charcoal-text3-press);
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
`;
|
|
997
|
+
var ModalBackground = animated2(styled11.div.withConfig({
|
|
998
|
+
componentId: "ccl__sc-h2bc55-0"
|
|
999
|
+
})(["z-index:", ";overflow:auto;display:flex;position:fixed;top:0;left:0;width:-webkit-fill-available;width:-moz-available;height:100%;justify-content:center;padding:40px 0;box-sizing:border-box;background-color:var(--charcoal-surface4);@media ", "{", "}"], ({
|
|
1000
|
+
zIndex
|
|
1001
|
+
}) => zIndex, ({
|
|
1002
|
+
theme
|
|
1003
|
+
}) => maxWidth2(theme.breakpoint.screen1), (p) => p.$bottomSheet !== false && css7(["padding:0;"])));
|
|
1004
|
+
var ModalCrossButton = styled11(IconButton_default).withConfig({
|
|
1005
|
+
componentId: "ccl__sc-h2bc55-1"
|
|
1006
|
+
})(["position:absolute;top:8px;right:8px;color:var(--charcoal-text3);transition:0.2s color;&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{&:hover{color:var(--charcoal-text3-hover);}&:active{color:var(--charcoal-text3-press);}}"]);
|
|
1766
1007
|
function ModalTitle(props) {
|
|
1767
|
-
const {
|
|
1008
|
+
const {
|
|
1009
|
+
titleProps,
|
|
1010
|
+
title
|
|
1011
|
+
} = useContext4(ModalContext);
|
|
1768
1012
|
return /* @__PURE__ */ jsx14(ModalHeading, { ...titleProps, ...props, children: title });
|
|
1769
1013
|
}
|
|
1770
|
-
var ModalHeading = styled11.h3
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
font-size: inherit;
|
|
1774
|
-
`;
|
|
1014
|
+
var ModalHeading = styled11.h3.withConfig({
|
|
1015
|
+
componentId: "ccl__sc-h2bc55-2"
|
|
1016
|
+
})(["margin:0;font-weight:inherit;font-size:inherit;"]);
|
|
1775
1017
|
|
|
1776
1018
|
// src/components/Modal/ModalPlumbing.tsx
|
|
1777
1019
|
import styled12, { css as css8 } from "styled-components";
|
|
@@ -1782,127 +1024,66 @@ function ModalHeader() {
|
|
|
1782
1024
|
const modalCtx = useContext5(ModalContext);
|
|
1783
1025
|
return /* @__PURE__ */ jsx15(ModalHeaderRoot, { $bottomSheet: modalCtx.bottomSheet, children: /* @__PURE__ */ jsx15(StyledModalTitle, {}) });
|
|
1784
1026
|
}
|
|
1785
|
-
var ModalHeaderRoot = styled12.div
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
var
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
&::before {
|
|
1804
|
-
display: block;
|
|
1805
|
-
width: 0;
|
|
1806
|
-
height: 0;
|
|
1807
|
-
content: '';
|
|
1808
|
-
margin-top: -4px;
|
|
1809
|
-
}
|
|
1810
|
-
&::after {
|
|
1811
|
-
display: block;
|
|
1812
|
-
width: 0;
|
|
1813
|
-
height: 0;
|
|
1814
|
-
content: '';
|
|
1815
|
-
margin-bottom: -4px;
|
|
1816
|
-
}
|
|
1817
|
-
`;
|
|
1818
|
-
var ModalAlign = styled12.div`
|
|
1819
|
-
padding-left: 16px;
|
|
1820
|
-
padding-right: 16px;
|
|
1821
|
-
`;
|
|
1822
|
-
var ModalBody = styled12.div`
|
|
1823
|
-
padding-bottom: 40px;
|
|
1824
|
-
`;
|
|
1825
|
-
var ModalButtons = styled12.div`
|
|
1826
|
-
display: grid;
|
|
1827
|
-
grid-auto-flow: row;
|
|
1828
|
-
grid-row-gap: 8px;
|
|
1829
|
-
|
|
1830
|
-
padding-top: 16px;
|
|
1831
|
-
padding-left: 16px;
|
|
1832
|
-
padding-right: 16px;
|
|
1833
|
-
`;
|
|
1027
|
+
var ModalHeaderRoot = styled12.div.withConfig({
|
|
1028
|
+
componentId: "ccl__sc-1k33wze-0"
|
|
1029
|
+
})(["height:64px;display:grid;align-content:center;justify-content:center;@media ", "{", "}"], ({
|
|
1030
|
+
theme
|
|
1031
|
+
}) => maxWidth3(theme.breakpoint.screen1), (p) => p.$bottomSheet !== false && css8(["height:48px;"]));
|
|
1032
|
+
var StyledModalTitle = styled12(ModalTitle).withConfig({
|
|
1033
|
+
componentId: "ccl__sc-1k33wze-1"
|
|
1034
|
+
})(["color:var(--charcoal-text1);font-size:16px;line-height:24px;font-weight:bold;display:flow-root;&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
|
|
1035
|
+
var ModalAlign = styled12.div.withConfig({
|
|
1036
|
+
componentId: "ccl__sc-1k33wze-2"
|
|
1037
|
+
})(["padding-left:16px;padding-right:16px;"]);
|
|
1038
|
+
var ModalBody = styled12.div.withConfig({
|
|
1039
|
+
componentId: "ccl__sc-1k33wze-3"
|
|
1040
|
+
})(["padding-bottom:40px;"]);
|
|
1041
|
+
var ModalButtons = styled12.div.withConfig({
|
|
1042
|
+
componentId: "ccl__sc-1k33wze-4"
|
|
1043
|
+
})(["display:grid;grid-auto-flow:row;grid-row-gap:8px;padding-top:16px;padding-left:16px;padding-right:16px;"]);
|
|
1834
1044
|
|
|
1835
1045
|
// src/components/LoadingSpinner/index.tsx
|
|
1836
1046
|
import { forwardRef as forwardRef14, useImperativeHandle, useRef as useRef5, memo as memo5 } from "react";
|
|
1837
1047
|
import styled13, { keyframes } from "styled-components";
|
|
1838
1048
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1839
|
-
var LoadingSpinner = forwardRef14(
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
className,
|
|
1848
|
-
ref,
|
|
1849
|
-
children: /* @__PURE__ */ jsx16(LoadingSpinnerIcon, {})
|
|
1850
|
-
}
|
|
1851
|
-
);
|
|
1852
|
-
}
|
|
1853
|
-
);
|
|
1049
|
+
var LoadingSpinner = forwardRef14(function LoadingSpinnerInner({
|
|
1050
|
+
size = 48,
|
|
1051
|
+
padding = 16,
|
|
1052
|
+
transparent = false,
|
|
1053
|
+
className
|
|
1054
|
+
}, ref) {
|
|
1055
|
+
return /* @__PURE__ */ jsx16(LoadingSpinnerRoot, { size, padding, transparent, className, ref, children: /* @__PURE__ */ jsx16(LoadingSpinnerIcon, {}) });
|
|
1056
|
+
});
|
|
1854
1057
|
var LoadingSpinner_default = memo5(LoadingSpinner);
|
|
1855
|
-
var LoadingSpinnerRoot = styled13.div.attrs({
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
}
|
|
1877
|
-
`;
|
|
1878
|
-
var Icon2 = styled13.div.attrs({ role: "presentation" })`
|
|
1879
|
-
width: 1em;
|
|
1880
|
-
height: 1em;
|
|
1881
|
-
border-radius: 1em;
|
|
1882
|
-
background-color: currentColor;
|
|
1883
|
-
animation: ${scaleOut} 1s both ease-out;
|
|
1884
|
-
animation-iteration-count: ${(p) => p.once ? 1 : "infinite"};
|
|
1885
|
-
|
|
1886
|
-
&[data-reset-animation] {
|
|
1887
|
-
animation: none;
|
|
1888
|
-
}
|
|
1889
|
-
`;
|
|
1890
|
-
var LoadingSpinnerIcon = forwardRef14(
|
|
1891
|
-
function LoadingSpinnerIcon2({ once = false }, ref) {
|
|
1892
|
-
const iconRef = useRef5(null);
|
|
1893
|
-
useImperativeHandle(ref, () => ({
|
|
1894
|
-
restart: () => {
|
|
1895
|
-
if (!iconRef.current) {
|
|
1896
|
-
return;
|
|
1897
|
-
}
|
|
1898
|
-
iconRef.current.dataset.resetAnimation = "true";
|
|
1899
|
-
void iconRef.current.offsetWidth;
|
|
1900
|
-
delete iconRef.current.dataset.resetAnimation;
|
|
1058
|
+
var LoadingSpinnerRoot = styled13.div.attrs({
|
|
1059
|
+
role: "progressbar"
|
|
1060
|
+
}).withConfig({
|
|
1061
|
+
componentId: "ccl__sc-1id6yz4-0"
|
|
1062
|
+
})(["box-sizing:content-box;margin:auto;padding:", "px;border-radius:8px;font-size:", "px;width:", "px;height:", "px;opacity:0.84;color:var(--charcoal-text4);background-color:", ";"], (props) => props.padding, (props) => props.size, (props) => props.size, (props) => props.size, ({
|
|
1063
|
+
transparent
|
|
1064
|
+
}) => `var(--charcoal-${transparent ? "transparent" : "background1"})`);
|
|
1065
|
+
var scaleOut = keyframes(["from{transform:scale(0);opacity:1;}to{transform:scale(1);opacity:0;}"]);
|
|
1066
|
+
var Icon2 = styled13.div.attrs({
|
|
1067
|
+
role: "presentation"
|
|
1068
|
+
}).withConfig({
|
|
1069
|
+
componentId: "ccl__sc-1id6yz4-1"
|
|
1070
|
+
})(["width:1em;height:1em;border-radius:1em;background-color:currentColor;animation:", " 1s both ease-out;animation-iteration-count:", ";&[data-reset-animation]{animation:none;}"], scaleOut, (p) => p.once ? 1 : "infinite");
|
|
1071
|
+
var LoadingSpinnerIcon = forwardRef14(function LoadingSpinnerIcon2({
|
|
1072
|
+
once = false
|
|
1073
|
+
}, ref) {
|
|
1074
|
+
const iconRef = useRef5(null);
|
|
1075
|
+
useImperativeHandle(ref, () => ({
|
|
1076
|
+
restart: () => {
|
|
1077
|
+
if (!iconRef.current) {
|
|
1078
|
+
return;
|
|
1901
1079
|
}
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1080
|
+
iconRef.current.dataset.resetAnimation = "true";
|
|
1081
|
+
void iconRef.current.offsetWidth;
|
|
1082
|
+
delete iconRef.current.dataset.resetAnimation;
|
|
1083
|
+
}
|
|
1084
|
+
}));
|
|
1085
|
+
return /* @__PURE__ */ jsx16(Icon2, { ref: iconRef, once });
|
|
1086
|
+
});
|
|
1906
1087
|
|
|
1907
1088
|
// src/components/DropdownSelector/index.tsx
|
|
1908
1089
|
import { useState as useState3, useRef as useRef9 } from "react";
|
|
@@ -1910,7 +1091,7 @@ import styled16, { css as css9 } from "styled-components";
|
|
|
1910
1091
|
import { disabledSelector as disabledSelector2 } from "@charcoal-ui/utils";
|
|
1911
1092
|
|
|
1912
1093
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
1913
|
-
import { useEffect as
|
|
1094
|
+
import { useEffect as useEffect7, useRef as useRef7 } from "react";
|
|
1914
1095
|
|
|
1915
1096
|
// src/components/DropdownSelector/Popover/index.tsx
|
|
1916
1097
|
import { useContext as useContext6, useRef as useRef6 } from "react";
|
|
@@ -1918,9 +1099,9 @@ import { DismissButton, Overlay as Overlay2, usePopover } from "@react-aria/over
|
|
|
1918
1099
|
import styled14 from "styled-components";
|
|
1919
1100
|
|
|
1920
1101
|
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
1921
|
-
import { useEffect as
|
|
1102
|
+
import { useEffect as useEffect6 } from "react";
|
|
1922
1103
|
function usePreventScroll(element, isOpen) {
|
|
1923
|
-
|
|
1104
|
+
useEffect6(() => {
|
|
1924
1105
|
if (isOpen && element) {
|
|
1925
1106
|
const defaultPaddingRight = element.style.paddingRight;
|
|
1926
1107
|
const defaultOverflow = element.style.overflow;
|
|
@@ -1940,36 +1121,30 @@ var _empty = () => null;
|
|
|
1940
1121
|
function Popover(props) {
|
|
1941
1122
|
const defaultPopoverRef = useRef6(null);
|
|
1942
1123
|
const finalPopoverRef = props.popoverRef === void 0 ? defaultPopoverRef : props.popoverRef;
|
|
1943
|
-
const {
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
);
|
|
1124
|
+
const {
|
|
1125
|
+
popoverProps,
|
|
1126
|
+
underlayProps
|
|
1127
|
+
} = usePopover({
|
|
1128
|
+
triggerRef: props.triggerRef,
|
|
1129
|
+
popoverRef: finalPopoverRef,
|
|
1130
|
+
containerPadding: 16
|
|
1131
|
+
}, {
|
|
1132
|
+
close: props.onClose,
|
|
1133
|
+
isOpen: props.isOpen,
|
|
1134
|
+
open: _empty,
|
|
1135
|
+
setOpen: _empty,
|
|
1136
|
+
toggle: _empty
|
|
1137
|
+
});
|
|
1957
1138
|
const modalBackground = useContext6(ModalBackgroundContext);
|
|
1958
1139
|
usePreventScroll(modalBackground, props.isOpen);
|
|
1959
1140
|
if (!props.isOpen)
|
|
1960
1141
|
return null;
|
|
1961
1142
|
return /* @__PURE__ */ jsxs9(Overlay2, { portalContainer: document.body, children: [
|
|
1962
|
-
/* @__PURE__ */ jsx17(
|
|
1963
|
-
"
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
position: "fixed",
|
|
1968
|
-
zIndex: typeof popoverProps.style?.zIndex === "number" ? popoverProps.style.zIndex - 1 : 99999,
|
|
1969
|
-
inset: 0
|
|
1970
|
-
}
|
|
1971
|
-
}
|
|
1972
|
-
),
|
|
1143
|
+
/* @__PURE__ */ jsx17("div", { ...underlayProps, style: {
|
|
1144
|
+
position: "fixed",
|
|
1145
|
+
zIndex: typeof popoverProps.style?.zIndex === "number" ? popoverProps.style.zIndex - 1 : 99999,
|
|
1146
|
+
inset: 0
|
|
1147
|
+
} }),
|
|
1973
1148
|
/* @__PURE__ */ jsxs9(DropdownPopoverDiv, { ...popoverProps, ref: finalPopoverRef, children: [
|
|
1974
1149
|
/* @__PURE__ */ jsx17(DismissButton, { onDismiss: () => props.onClose() }),
|
|
1975
1150
|
props.children,
|
|
@@ -1977,57 +1152,41 @@ function Popover(props) {
|
|
|
1977
1152
|
] })
|
|
1978
1153
|
] });
|
|
1979
1154
|
}
|
|
1980
|
-
var DropdownPopoverDiv = styled14.div
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
overflow: auto;
|
|
1984
|
-
max-height: inherit;
|
|
1985
|
-
background-color: var(--charcoal-background1);
|
|
1986
|
-
border: solid 1px var(--charcoal-border-default);
|
|
1987
|
-
border-radius: 8px;
|
|
1988
|
-
padding-top: 8px;
|
|
1989
|
-
padding-bottom: 8px;
|
|
1990
|
-
`;
|
|
1155
|
+
var DropdownPopoverDiv = styled14.div.withConfig({
|
|
1156
|
+
componentId: "ccl__sc-jwnoy6-0"
|
|
1157
|
+
})(["margin:4px 0;list-style:none;overflow:auto;max-height:inherit;background-color:var(--charcoal-background1);border:solid 1px var(--charcoal-border-default);border-radius:8px;padding-top:8px;padding-bottom:8px;"]);
|
|
1991
1158
|
|
|
1992
1159
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
1993
1160
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1994
|
-
function DropdownPopover({
|
|
1161
|
+
function DropdownPopover({
|
|
1162
|
+
children,
|
|
1163
|
+
...props
|
|
1164
|
+
}) {
|
|
1995
1165
|
const ref = useRef7(null);
|
|
1996
|
-
|
|
1166
|
+
useEffect7(() => {
|
|
1997
1167
|
if (props.isOpen && ref.current && props.triggerRef.current) {
|
|
1998
1168
|
ref.current.style.width = `${props.triggerRef.current.clientWidth}px`;
|
|
1999
1169
|
}
|
|
2000
1170
|
}, [props.triggerRef, props.isOpen]);
|
|
2001
|
-
|
|
1171
|
+
useEffect7(() => {
|
|
2002
1172
|
if (props.isOpen && props.value !== void 0) {
|
|
2003
1173
|
const windowScrollY = window.scrollY;
|
|
2004
1174
|
const windowScrollX = window.scrollX;
|
|
2005
|
-
const selectedElement = document.querySelector(
|
|
2006
|
-
`[data-key="${props.value.toString()}"]`
|
|
2007
|
-
);
|
|
1175
|
+
const selectedElement = document.querySelector(`[data-key="${props.value.toString()}"]`);
|
|
2008
1176
|
selectedElement?.focus();
|
|
2009
1177
|
window.scrollTo(windowScrollX, windowScrollY);
|
|
2010
1178
|
}
|
|
2011
1179
|
}, [props.value, props.isOpen]);
|
|
2012
|
-
return /* @__PURE__ */ jsx18(
|
|
2013
|
-
Popover,
|
|
2014
|
-
{
|
|
2015
|
-
isOpen: props.isOpen,
|
|
2016
|
-
onClose: props.onClose,
|
|
2017
|
-
popoverRef: ref,
|
|
2018
|
-
triggerRef: props.triggerRef,
|
|
2019
|
-
children
|
|
2020
|
-
}
|
|
2021
|
-
);
|
|
1180
|
+
return /* @__PURE__ */ jsx18(Popover, { isOpen: props.isOpen, onClose: props.onClose, popoverRef: ref, triggerRef: props.triggerRef, children });
|
|
2022
1181
|
}
|
|
2023
1182
|
|
|
2024
1183
|
// src/components/DropdownSelector/utils/findPreviewRecursive.tsx
|
|
2025
|
-
import * as
|
|
1184
|
+
import * as React11 from "react";
|
|
2026
1185
|
function findPreviewRecursive(children, value) {
|
|
2027
|
-
const childArray =
|
|
1186
|
+
const childArray = React11.Children.toArray(children);
|
|
2028
1187
|
for (let i = 0; i < childArray.length; i++) {
|
|
2029
1188
|
const child = childArray[i];
|
|
2030
|
-
if (
|
|
1189
|
+
if (React11.isValidElement(child)) {
|
|
2031
1190
|
if ("value" in child.props) {
|
|
2032
1191
|
const childValue = child.props.value;
|
|
2033
1192
|
if (childValue === value && "children" in child.props) {
|
|
@@ -2036,10 +1195,7 @@ function findPreviewRecursive(children, value) {
|
|
|
2036
1195
|
}
|
|
2037
1196
|
}
|
|
2038
1197
|
if ("children" in child.props) {
|
|
2039
|
-
const children2 = findPreviewRecursive(
|
|
2040
|
-
child.props.children,
|
|
2041
|
-
value
|
|
2042
|
-
);
|
|
1198
|
+
const children2 = findPreviewRecursive(child.props.children, value);
|
|
2043
1199
|
if (children2 !== void 0) {
|
|
2044
1200
|
return children2;
|
|
2045
1201
|
}
|
|
@@ -2063,12 +1219,12 @@ var MenuListContext = createContext6({
|
|
|
2063
1219
|
});
|
|
2064
1220
|
|
|
2065
1221
|
// src/components/DropdownSelector/MenuList/internals/getValuesRecursive.tsx
|
|
2066
|
-
import * as
|
|
1222
|
+
import * as React12 from "react";
|
|
2067
1223
|
function getValuesRecursive(children, values = []) {
|
|
2068
|
-
const childArray =
|
|
1224
|
+
const childArray = React12.Children.toArray(children);
|
|
2069
1225
|
for (let i = 0; i < childArray.length; i++) {
|
|
2070
1226
|
const child = childArray[i];
|
|
2071
|
-
if (
|
|
1227
|
+
if (React12.isValidElement(child)) {
|
|
2072
1228
|
const props = child.props;
|
|
2073
1229
|
if ("value" in props && typeof props.value === "string") {
|
|
2074
1230
|
const childValue = props.value;
|
|
@@ -2087,25 +1243,18 @@ function MenuList(props) {
|
|
|
2087
1243
|
const root = useRef8(null);
|
|
2088
1244
|
const values = [];
|
|
2089
1245
|
getValuesRecursive(props.children, values);
|
|
2090
|
-
return /* @__PURE__ */ jsx19(StyledUl, { ref: root, children: /* @__PURE__ */ jsx19(
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
values,
|
|
2097
|
-
setValue: (v) => {
|
|
2098
|
-
props.onChange?.(v);
|
|
2099
|
-
}
|
|
2100
|
-
},
|
|
2101
|
-
children: props.children
|
|
1246
|
+
return /* @__PURE__ */ jsx19(StyledUl, { ref: root, children: /* @__PURE__ */ jsx19(MenuListContext.Provider, { value: {
|
|
1247
|
+
value: props.value ?? "",
|
|
1248
|
+
root,
|
|
1249
|
+
values,
|
|
1250
|
+
setValue: (v) => {
|
|
1251
|
+
props.onChange?.(v);
|
|
2102
1252
|
}
|
|
2103
|
-
) });
|
|
1253
|
+
}, children: props.children }) });
|
|
2104
1254
|
}
|
|
2105
|
-
var StyledUl = styled15.ul
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
`;
|
|
1255
|
+
var StyledUl = styled15.ul.withConfig({
|
|
1256
|
+
componentId: "ccl__sc-1y72v02-0"
|
|
1257
|
+
})(["padding:0;margin:0;"]);
|
|
2109
1258
|
|
|
2110
1259
|
// src/components/DropdownSelector/index.tsx
|
|
2111
1260
|
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss6 } from "@charcoal-ui/styled";
|
|
@@ -2116,153 +1265,46 @@ function DropdownSelector(props) {
|
|
|
2116
1265
|
const [isOpen, setIsOpen] = useState3(false);
|
|
2117
1266
|
const preview = findPreviewRecursive(props.children, props.value);
|
|
2118
1267
|
return /* @__PURE__ */ jsxs10(DropdownSelectorRoot, { "aria-disabled": props.disabled, children: [
|
|
2119
|
-
props.showLabel === true && /* @__PURE__ */ jsx20(
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
}
|
|
2127
|
-
),
|
|
2128
|
-
/* @__PURE__ */
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
disabled: props.disabled,
|
|
2133
|
-
onClick: () => {
|
|
2134
|
-
if (props.disabled === true)
|
|
2135
|
-
return;
|
|
2136
|
-
setIsOpen(true);
|
|
2137
|
-
},
|
|
2138
|
-
ref: triggerRef,
|
|
2139
|
-
type: "button",
|
|
2140
|
-
$active: isOpen,
|
|
2141
|
-
children: [
|
|
2142
|
-
/* @__PURE__ */ jsx20(DropdownButtonText, { children: props.placeholder !== void 0 && preview === void 0 ? props.placeholder : preview }),
|
|
2143
|
-
/* @__PURE__ */ jsx20(DropdownButtonIcon, { name: "16/Menu" })
|
|
2144
|
-
]
|
|
2145
|
-
}
|
|
2146
|
-
),
|
|
2147
|
-
isOpen && /* @__PURE__ */ jsx20(
|
|
2148
|
-
DropdownPopover,
|
|
2149
|
-
{
|
|
2150
|
-
isOpen,
|
|
2151
|
-
onClose: () => setIsOpen(false),
|
|
2152
|
-
triggerRef,
|
|
2153
|
-
value: props.value,
|
|
2154
|
-
children: /* @__PURE__ */ jsx20(
|
|
2155
|
-
MenuList,
|
|
2156
|
-
{
|
|
2157
|
-
value: props.value,
|
|
2158
|
-
onChange: (v) => {
|
|
2159
|
-
props.onChange(v);
|
|
2160
|
-
setIsOpen(false);
|
|
2161
|
-
},
|
|
2162
|
-
children: props.children
|
|
2163
|
-
}
|
|
2164
|
-
)
|
|
2165
|
-
}
|
|
2166
|
-
),
|
|
1268
|
+
props.showLabel === true && /* @__PURE__ */ jsx20(DropdownFieldLabel, { label: props.label, required: props.required, requiredText: props.requiredText ?? defaultRequiredText, subLabel: props.subLabel }),
|
|
1269
|
+
/* @__PURE__ */ jsxs10(DropdownButton, { invalid: props.invalid, disabled: props.disabled, onClick: () => {
|
|
1270
|
+
if (props.disabled === true)
|
|
1271
|
+
return;
|
|
1272
|
+
setIsOpen(true);
|
|
1273
|
+
}, ref: triggerRef, type: "button", $active: isOpen, children: [
|
|
1274
|
+
/* @__PURE__ */ jsx20(DropdownButtonText, { children: props.placeholder !== void 0 && preview === void 0 ? props.placeholder : preview }),
|
|
1275
|
+
/* @__PURE__ */ jsx20(DropdownButtonIcon, { name: "16/Menu" })
|
|
1276
|
+
] }),
|
|
1277
|
+
isOpen && /* @__PURE__ */ jsx20(DropdownPopover, { isOpen, onClose: () => setIsOpen(false), triggerRef, value: props.value, children: /* @__PURE__ */ jsx20(MenuList, { value: props.value, onChange: (v) => {
|
|
1278
|
+
props.onChange(v);
|
|
1279
|
+
setIsOpen(false);
|
|
1280
|
+
}, children: props.children }) }),
|
|
2167
1281
|
props.assistiveText !== void 0 && /* @__PURE__ */ jsx20(AssertiveText, { invalid: props.invalid, children: props.assistiveText })
|
|
2168
1282
|
] });
|
|
2169
1283
|
}
|
|
2170
|
-
var DropdownSelectorRoot = styled16.div
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
var
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
${disabledSelector2} {
|
|
2196
|
-
cursor: default;
|
|
2197
|
-
}
|
|
2198
|
-
|
|
2199
|
-
padding-right: 8px;
|
|
2200
|
-
padding-left: 8px;
|
|
2201
|
-
background-color: var(--charcoal-surface3);
|
|
2202
|
-
border-radius: 4px;
|
|
2203
|
-
|
|
2204
|
-
transition: 0.2s box-shadow, 0.2s background-color;
|
|
2205
|
-
|
|
2206
|
-
&:not(:disabled):not([aria-disabled]),
|
|
2207
|
-
&[aria-disabled='false'] {
|
|
2208
|
-
${focusVisibleFocusRingCss6}
|
|
2209
|
-
${({ $active }) => $active === true ? css9`
|
|
2210
|
-
background-color: var(--charcoal-surface3-press);
|
|
2211
|
-
` : css9`
|
|
2212
|
-
&:hover {
|
|
2213
|
-
background-color: var(--charcoal-surface3-hover);
|
|
2214
|
-
}
|
|
2215
|
-
&:active {
|
|
2216
|
-
background-color: var(--charcoal-surface3-press);
|
|
2217
|
-
}
|
|
2218
|
-
`}
|
|
2219
|
-
}
|
|
2220
|
-
|
|
2221
|
-
${({ invalid }) => invalid === true && css9`
|
|
2222
|
-
&:not(:disabled):not([aria-disabled]),
|
|
2223
|
-
&[aria-disabled='false'] {
|
|
2224
|
-
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
2225
|
-
}
|
|
2226
|
-
`}
|
|
2227
|
-
`;
|
|
2228
|
-
var DropdownButtonText = styled16.span`
|
|
2229
|
-
text-align: left;
|
|
2230
|
-
font-size: 14px;
|
|
2231
|
-
line-height: 22px;
|
|
2232
|
-
display: flow-root;
|
|
2233
|
-
color: var(--charcoal-text2);
|
|
2234
|
-
overflow: hidden;
|
|
2235
|
-
text-overflow: ellipsis;
|
|
2236
|
-
white-space: nowrap;
|
|
2237
|
-
`;
|
|
2238
|
-
var DropdownButtonIcon = styled16(Icon_default)`
|
|
2239
|
-
color: var(--charcoal-text2);
|
|
2240
|
-
`;
|
|
2241
|
-
var AssertiveText = styled16.div`
|
|
2242
|
-
margin-top: 8px;
|
|
2243
|
-
font-size: 14px;
|
|
2244
|
-
color: var(--charcoal-text2);
|
|
2245
|
-
line-height: 22px;
|
|
2246
|
-
display: flow-root;
|
|
2247
|
-
&::before {
|
|
2248
|
-
display: block;
|
|
2249
|
-
width: 0;
|
|
2250
|
-
height: 0;
|
|
2251
|
-
content: '';
|
|
2252
|
-
margin-top: -4px;
|
|
2253
|
-
}
|
|
2254
|
-
&::after {
|
|
2255
|
-
display: block;
|
|
2256
|
-
width: 0;
|
|
2257
|
-
height: 0;
|
|
2258
|
-
content: '';
|
|
2259
|
-
margin-bottom: -4px;
|
|
2260
|
-
}
|
|
2261
|
-
|
|
2262
|
-
${({ invalid }) => invalid === true && css9`
|
|
2263
|
-
color: var(--charcoal-assertive);
|
|
2264
|
-
`}
|
|
2265
|
-
`;
|
|
1284
|
+
var DropdownSelectorRoot = styled16.div.withConfig({
|
|
1285
|
+
componentId: "ccl__sc-1vnxmc8-0"
|
|
1286
|
+
})(["display:inline-block;width:100%;", "{cursor:default;opacity:0.32;}"], disabledSelector2);
|
|
1287
|
+
var DropdownFieldLabel = styled16(FieldLabel_default).withConfig({
|
|
1288
|
+
componentId: "ccl__sc-1vnxmc8-1"
|
|
1289
|
+
})(["width:100%;margin-bottom:8px;"]);
|
|
1290
|
+
var DropdownButton = styled16.button.withConfig({
|
|
1291
|
+
componentId: "ccl__sc-1vnxmc8-2"
|
|
1292
|
+
})(["display:flex;justify-content:space-between;align-items:center;height:40px;width:100%;box-sizing:border-box;border:none;cursor:pointer;gap:4px;", "{cursor:default;}padding-right:8px;padding-left:8px;background-color:var(--charcoal-surface3);border-radius:4px;transition:0.2s box-shadow,0.2s background-color;&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{", " ", "}", ""], disabledSelector2, focusVisibleFocusRingCss6, ({
|
|
1293
|
+
$active
|
|
1294
|
+
}) => $active === true ? css9(["background-color:var(--charcoal-surface3-press);"]) : css9(["&:hover{background-color:var(--charcoal-surface3-hover);}&:active{background-color:var(--charcoal-surface3-press);}"]), ({
|
|
1295
|
+
invalid
|
|
1296
|
+
}) => invalid === true && css9(["&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}"]));
|
|
1297
|
+
var DropdownButtonText = styled16.span.withConfig({
|
|
1298
|
+
componentId: "ccl__sc-1vnxmc8-3"
|
|
1299
|
+
})(["text-align:left;font-size:14px;line-height:22px;display:flow-root;color:var(--charcoal-text2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"]);
|
|
1300
|
+
var DropdownButtonIcon = styled16(Icon_default).withConfig({
|
|
1301
|
+
componentId: "ccl__sc-1vnxmc8-4"
|
|
1302
|
+
})(["color:var(--charcoal-text2);"]);
|
|
1303
|
+
var AssertiveText = styled16.div.withConfig({
|
|
1304
|
+
componentId: "ccl__sc-1vnxmc8-5"
|
|
1305
|
+
})(["margin-top:8px;font-size:14px;color:var(--charcoal-text2);line-height:22px;display:flow-root;&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}", ""], ({
|
|
1306
|
+
invalid
|
|
1307
|
+
}) => invalid === true && css9(["color:var(--charcoal-assertive);"]));
|
|
2266
1308
|
|
|
2267
1309
|
// src/components/DropdownSelector/DropdownMenuItem.tsx
|
|
2268
1310
|
import styled18 from "styled-components";
|
|
@@ -2271,37 +1313,21 @@ import styled18 from "styled-components";
|
|
|
2271
1313
|
import styled17 from "styled-components";
|
|
2272
1314
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2273
1315
|
function ListItem(props) {
|
|
2274
|
-
const {
|
|
1316
|
+
const {
|
|
1317
|
+
children,
|
|
1318
|
+
...rest
|
|
1319
|
+
} = props;
|
|
2275
1320
|
return /* @__PURE__ */ jsx21(StyledLi, { role: "option", children: /* @__PURE__ */ jsx21(ItemDiv, { ...rest, children: props.children }) });
|
|
2276
1321
|
}
|
|
2277
|
-
var StyledLi = styled17.li
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
var ItemDiv = styled17.div
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
min-height: 40px;
|
|
2284
|
-
cursor: pointer;
|
|
2285
|
-
outline: none;
|
|
2286
|
-
|
|
2287
|
-
padding-right: 16px;
|
|
2288
|
-
padding-left: 16px;
|
|
2289
|
-
|
|
2290
|
-
&:disabled,
|
|
2291
|
-
&[aria-disabled]:not([aria-disabled='false']) {
|
|
2292
|
-
opacity: 0.32;
|
|
2293
|
-
cursor: default;
|
|
2294
|
-
}
|
|
2295
|
-
|
|
2296
|
-
:hover,
|
|
2297
|
-
:focus,
|
|
2298
|
-
:focus-within {
|
|
2299
|
-
background-color: var(--charcoal-surface3);
|
|
2300
|
-
}
|
|
2301
|
-
`;
|
|
1322
|
+
var StyledLi = styled17.li.withConfig({
|
|
1323
|
+
componentId: "ccl__sc-p1vs75-0"
|
|
1324
|
+
})(["list-style:none;"]);
|
|
1325
|
+
var ItemDiv = styled17.div.withConfig({
|
|
1326
|
+
componentId: "ccl__sc-p1vs75-1"
|
|
1327
|
+
})(["display:flex;align-items:center;min-height:40px;cursor:pointer;outline:none;padding-right:16px;padding-left:16px;&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}:hover,:focus,:focus-within{background-color:var(--charcoal-surface3);}"]);
|
|
2302
1328
|
|
|
2303
1329
|
// src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
|
|
2304
|
-
import { useCallback as
|
|
1330
|
+
import { useCallback as useCallback6, useContext as useContext7 } from "react";
|
|
2305
1331
|
|
|
2306
1332
|
// src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx
|
|
2307
1333
|
function handleFocusByKeyBoard(element, parent) {
|
|
@@ -2334,84 +1360,77 @@ function scrollIfNeeded(element) {
|
|
|
2334
1360
|
|
|
2335
1361
|
// src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
|
|
2336
1362
|
function useMenuItemHandleKeyDown(value) {
|
|
2337
|
-
const {
|
|
2338
|
-
|
|
1363
|
+
const {
|
|
1364
|
+
setValue,
|
|
1365
|
+
root,
|
|
1366
|
+
values
|
|
1367
|
+
} = useContext7(MenuListContext);
|
|
1368
|
+
const setContextValue = useCallback6(() => {
|
|
2339
1369
|
if (value !== void 0)
|
|
2340
1370
|
setValue(value);
|
|
2341
1371
|
}, [value, setValue]);
|
|
2342
|
-
const handleKeyDown =
|
|
2343
|
-
(e)
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
1372
|
+
const handleKeyDown = useCallback6((e) => {
|
|
1373
|
+
if (e.key === "Enter") {
|
|
1374
|
+
setContextValue();
|
|
1375
|
+
} else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
1376
|
+
e.preventDefault();
|
|
1377
|
+
if (!values || value === void 0)
|
|
1378
|
+
return;
|
|
1379
|
+
const index = values.indexOf(value);
|
|
1380
|
+
if (index === -1)
|
|
1381
|
+
return;
|
|
1382
|
+
const focusValue = e.key === "ArrowUp" ? index - 1 < 0 ? values[values.length - 1] : values[index - 1] : index + 1 >= values.length ? values[0] : values[index + 1];
|
|
1383
|
+
const next = root?.current?.querySelector(`[data-key='${focusValue}']`);
|
|
1384
|
+
if (next instanceof HTMLElement) {
|
|
1385
|
+
next.focus({
|
|
1386
|
+
preventScroll: true
|
|
1387
|
+
});
|
|
1388
|
+
if (root?.current?.parentElement) {
|
|
1389
|
+
handleFocusByKeyBoard(next, root.current.parentElement);
|
|
2360
1390
|
}
|
|
2361
1391
|
}
|
|
2362
|
-
}
|
|
2363
|
-
|
|
2364
|
-
);
|
|
1392
|
+
}
|
|
1393
|
+
}, [setContextValue, value, root, values]);
|
|
2365
1394
|
return [handleKeyDown, setContextValue];
|
|
2366
1395
|
}
|
|
2367
1396
|
|
|
2368
1397
|
// src/components/DropdownSelector/MenuItem/index.tsx
|
|
2369
1398
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2370
1399
|
function MenuItem(props) {
|
|
2371
|
-
const {
|
|
1400
|
+
const {
|
|
1401
|
+
children,
|
|
1402
|
+
as,
|
|
1403
|
+
...rest
|
|
1404
|
+
} = props;
|
|
2372
1405
|
const [handleKeyDown, setContextValue] = useMenuItemHandleKeyDown(props.value);
|
|
2373
|
-
return /* @__PURE__ */ jsx22(
|
|
2374
|
-
ListItem,
|
|
2375
|
-
{
|
|
2376
|
-
...rest,
|
|
2377
|
-
as,
|
|
2378
|
-
"data-key": props.value,
|
|
2379
|
-
onKeyDown: handleKeyDown,
|
|
2380
|
-
onClick: props.disabled === true ? void 0 : setContextValue,
|
|
2381
|
-
tabIndex: -1,
|
|
2382
|
-
"aria-disabled": props.disabled,
|
|
2383
|
-
children: props.children
|
|
2384
|
-
}
|
|
2385
|
-
);
|
|
1406
|
+
return /* @__PURE__ */ jsx22(ListItem, { ...rest, as, "data-key": props.value, onKeyDown: handleKeyDown, onClick: props.disabled === true ? void 0 : setContextValue, tabIndex: -1, "aria-disabled": props.disabled, children: props.children });
|
|
2386
1407
|
}
|
|
2387
1408
|
|
|
2388
1409
|
// src/components/DropdownSelector/DropdownMenuItem.tsx
|
|
2389
1410
|
import { useContext as useContext8 } from "react";
|
|
2390
1411
|
import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2391
1412
|
function DropdownMenuItem(props) {
|
|
2392
|
-
const {
|
|
1413
|
+
const {
|
|
1414
|
+
value: ctxValue
|
|
1415
|
+
} = useContext8(MenuListContext);
|
|
2393
1416
|
const isSelected = props.value === ctxValue;
|
|
2394
|
-
const {
|
|
1417
|
+
const {
|
|
1418
|
+
children,
|
|
1419
|
+
...rest
|
|
1420
|
+
} = props;
|
|
2395
1421
|
return /* @__PURE__ */ jsxs11(MenuItem, { ...rest, children: [
|
|
2396
1422
|
isSelected && /* @__PURE__ */ jsx23(Text2ColorIcon, { name: "16/Check" }),
|
|
2397
1423
|
/* @__PURE__ */ jsx23(StyledSpan, { isSelected, children: props.children })
|
|
2398
1424
|
] });
|
|
2399
1425
|
}
|
|
2400
|
-
var StyledSpan = styled18.span
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
width: 100%;
|
|
2409
|
-
margin-left: ${({ isSelected }) => isSelected === true ? 0 : 20}px;
|
|
2410
|
-
`;
|
|
2411
|
-
var Text2ColorIcon = styled18(Icon_default)`
|
|
2412
|
-
color: var(--charcoal-text2);
|
|
2413
|
-
padding-right: 4px;
|
|
2414
|
-
`;
|
|
1426
|
+
var StyledSpan = styled18.span.withConfig({
|
|
1427
|
+
componentId: "ccl__sc-108wg2j-0"
|
|
1428
|
+
})(["font-size:14px;line-height:22px;color:var(--charcoal-text2);padding:9px 0;display:flex;align-items:center;width:100%;margin-left:", "px;"], ({
|
|
1429
|
+
isSelected
|
|
1430
|
+
}) => isSelected === true ? 0 : 20);
|
|
1431
|
+
var Text2ColorIcon = styled18(Icon_default).withConfig({
|
|
1432
|
+
componentId: "ccl__sc-108wg2j-1"
|
|
1433
|
+
})(["color:var(--charcoal-text2);padding-right:4px;"]);
|
|
2415
1434
|
|
|
2416
1435
|
// src/components/DropdownSelector/MenuItemGroup/index.tsx
|
|
2417
1436
|
import styled19 from "styled-components";
|
|
@@ -2422,23 +1441,15 @@ function MenuItemGroup(props) {
|
|
|
2422
1441
|
/* @__PURE__ */ jsx24(StyledUl2, { role: "group", children: props.children })
|
|
2423
1442
|
] });
|
|
2424
1443
|
}
|
|
2425
|
-
var TextSpan = styled19.span
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
margin: 0;
|
|
2435
|
-
box-sizing: border-box;
|
|
2436
|
-
list-style: none;
|
|
2437
|
-
overflow: hidden;
|
|
2438
|
-
`;
|
|
2439
|
-
var StyledLi2 = styled19.li`
|
|
2440
|
-
display: block;
|
|
2441
|
-
`;
|
|
1444
|
+
var TextSpan = styled19.span.withConfig({
|
|
1445
|
+
componentId: "ccl__sc-1ubjfz7-0"
|
|
1446
|
+
})(["display:block;color:var(--charcoal-text3);font-size:12px;font-weight:bold;padding:12px 0 8px 16px;"]);
|
|
1447
|
+
var StyledUl2 = styled19.ul.withConfig({
|
|
1448
|
+
componentId: "ccl__sc-1ubjfz7-1"
|
|
1449
|
+
})(["padding-left:0;margin:0;box-sizing:border-box;list-style:none;overflow:hidden;"]);
|
|
1450
|
+
var StyledLi2 = styled19.li.withConfig({
|
|
1451
|
+
componentId: "ccl__sc-1ubjfz7-2"
|
|
1452
|
+
})(["display:block;"]);
|
|
2442
1453
|
|
|
2443
1454
|
// src/components/SegmentedControl/index.tsx
|
|
2444
1455
|
import { forwardRef as forwardRef15, memo as memo6, useMemo as useMemo2, useRef as useRef10 } from "react";
|
|
@@ -2472,7 +1483,13 @@ var $e5be200c675c3b3a$export$571b5131b7e65c11 = (0, $jcIOw$createContext)({});
|
|
|
2472
1483
|
var $e5be200c675c3b3a$export$a763b9476acd3eb = "__formValidationState" + Date.now();
|
|
2473
1484
|
function $e5be200c675c3b3a$export$fc1a364ae1f3ff10(props) {
|
|
2474
1485
|
if (props[$e5be200c675c3b3a$export$a763b9476acd3eb]) {
|
|
2475
|
-
let {
|
|
1486
|
+
let {
|
|
1487
|
+
realtimeValidation,
|
|
1488
|
+
displayValidation,
|
|
1489
|
+
updateValidation,
|
|
1490
|
+
resetValidation,
|
|
1491
|
+
commitValidation
|
|
1492
|
+
} = props[$e5be200c675c3b3a$export$a763b9476acd3eb];
|
|
2476
1493
|
return {
|
|
2477
1494
|
realtimeValidation,
|
|
2478
1495
|
displayValidation,
|
|
@@ -2484,7 +1501,15 @@ function $e5be200c675c3b3a$export$fc1a364ae1f3ff10(props) {
|
|
|
2484
1501
|
return $e5be200c675c3b3a$var$useFormValidationStateImpl(props);
|
|
2485
1502
|
}
|
|
2486
1503
|
function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
|
|
2487
|
-
let {
|
|
1504
|
+
let {
|
|
1505
|
+
isInvalid,
|
|
1506
|
+
validationState,
|
|
1507
|
+
name,
|
|
1508
|
+
value,
|
|
1509
|
+
builtinValidation,
|
|
1510
|
+
validate,
|
|
1511
|
+
validationBehavior = "aria"
|
|
1512
|
+
} = props;
|
|
2488
1513
|
if (validationState)
|
|
2489
1514
|
isInvalid || (isInvalid = validationState === "invalid");
|
|
2490
1515
|
let controlledError = isInvalid ? {
|
|
@@ -2492,10 +1517,7 @@ function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
|
|
|
2492
1517
|
validationErrors: [],
|
|
2493
1518
|
validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
|
|
2494
1519
|
} : null;
|
|
2495
|
-
let clientError = (0, $jcIOw$useMemo)(() => $e5be200c675c3b3a$var$getValidationResult($e5be200c675c3b3a$var$runValidate(validate, value)), [
|
|
2496
|
-
validate,
|
|
2497
|
-
value
|
|
2498
|
-
]);
|
|
1520
|
+
let clientError = (0, $jcIOw$useMemo)(() => $e5be200c675c3b3a$var$getValidationResult($e5be200c675c3b3a$var$runValidate(validate, value)), [validate, value]);
|
|
2499
1521
|
if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid)
|
|
2500
1522
|
builtinValidation = null;
|
|
2501
1523
|
let serverErrors = (0, $jcIOw$useContext)($e5be200c675c3b3a$export$571b5131b7e65c11);
|
|
@@ -2503,20 +1525,14 @@ function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
|
|
|
2503
1525
|
if (name)
|
|
2504
1526
|
return Array.isArray(name) ? name.flatMap((name2) => $e5be200c675c3b3a$var$asArray(serverErrors[name2])) : $e5be200c675c3b3a$var$asArray(serverErrors[name]);
|
|
2505
1527
|
return [];
|
|
2506
|
-
}, [
|
|
2507
|
-
serverErrors,
|
|
2508
|
-
name
|
|
2509
|
-
]);
|
|
1528
|
+
}, [serverErrors, name]);
|
|
2510
1529
|
let [lastServerErrors, setLastServerErrors] = (0, $jcIOw$useState)(serverErrors);
|
|
2511
1530
|
let [isServerErrorCleared, setServerErrorCleared] = (0, $jcIOw$useState)(false);
|
|
2512
1531
|
if (serverErrors !== lastServerErrors) {
|
|
2513
1532
|
setLastServerErrors(serverErrors);
|
|
2514
1533
|
setServerErrorCleared(false);
|
|
2515
1534
|
}
|
|
2516
|
-
let serverError = (0, $jcIOw$useMemo)(() => $e5be200c675c3b3a$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [
|
|
2517
|
-
isServerErrorCleared,
|
|
2518
|
-
serverErrorMessages
|
|
2519
|
-
]);
|
|
1535
|
+
let serverError = (0, $jcIOw$useMemo)(() => $e5be200c675c3b3a$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [isServerErrorCleared, serverErrorMessages]);
|
|
2520
1536
|
let nextValidation = (0, $jcIOw$useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
2521
1537
|
let [currentValidity, setCurrentValidity] = (0, $jcIOw$useState)($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
2522
1538
|
let lastError = (0, $jcIOw$useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
@@ -2563,9 +1579,7 @@ function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
|
|
|
2563
1579
|
function $e5be200c675c3b3a$var$asArray(v) {
|
|
2564
1580
|
if (!v)
|
|
2565
1581
|
return [];
|
|
2566
|
-
return Array.isArray(v) ? v : [
|
|
2567
|
-
v
|
|
2568
|
-
];
|
|
1582
|
+
return Array.isArray(v) ? v : [v];
|
|
2569
1583
|
}
|
|
2570
1584
|
function $e5be200c675c3b3a$var$runValidate(validate, value) {
|
|
2571
1585
|
if (typeof validate === "function") {
|
|
@@ -2599,9 +1613,7 @@ function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange
|
|
|
2599
1613
|
if (wasControlled !== isControlled)
|
|
2600
1614
|
console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
|
|
2601
1615
|
isControlledRef.current = isControlled;
|
|
2602
|
-
}, [
|
|
2603
|
-
isControlled
|
|
2604
|
-
]);
|
|
1616
|
+
}, [isControlled]);
|
|
2605
1617
|
let currentValue = isControlled ? value : stateValue;
|
|
2606
1618
|
let setValue = (0, $6imuh$useCallback)((value2, ...args) => {
|
|
2607
1619
|
let onChangeCaller = (value3, ...onChangeArgs) => {
|
|
@@ -2627,15 +1639,8 @@ function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange
|
|
|
2627
1639
|
setStateValue(value2);
|
|
2628
1640
|
onChangeCaller(value2, ...args);
|
|
2629
1641
|
}
|
|
2630
|
-
}, [
|
|
2631
|
-
|
|
2632
|
-
currentValue,
|
|
2633
|
-
onChange
|
|
2634
|
-
]);
|
|
2635
|
-
return [
|
|
2636
|
-
currentValue,
|
|
2637
|
-
setValue
|
|
2638
|
-
];
|
|
1642
|
+
}, [isControlled, currentValue, onChange]);
|
|
1643
|
+
return [currentValue, setValue];
|
|
2639
1644
|
}
|
|
2640
1645
|
|
|
2641
1646
|
// ../../node_modules/@react-stately/radio/dist/import.mjs
|
|
@@ -2643,9 +1648,7 @@ import { useMemo as $fQ2SF$useMemo, useState as $fQ2SF$useState } from "react";
|
|
|
2643
1648
|
var $a54cdc5c1942b639$var$instance = Math.round(Math.random() * 1e10);
|
|
2644
1649
|
var $a54cdc5c1942b639$var$i = 0;
|
|
2645
1650
|
function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
|
|
2646
|
-
let name = (0, $fQ2SF$useMemo)(() => props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [
|
|
2647
|
-
props.name
|
|
2648
|
-
]);
|
|
1651
|
+
let name = (0, $fQ2SF$useMemo)(() => props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [props.name]);
|
|
2649
1652
|
var _props_defaultValue;
|
|
2650
1653
|
let [selectedValue, setSelected] = (0, $458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
|
|
2651
1654
|
let [lastFocusedValue, setLastFocusedValue] = (0, $fQ2SF$useState)(null);
|
|
@@ -2676,10 +1679,7 @@ function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
|
|
|
2676
1679
|
}
|
|
2677
1680
|
|
|
2678
1681
|
// src/components/SegmentedControl/index.tsx
|
|
2679
|
-
import {
|
|
2680
|
-
useRadio,
|
|
2681
|
-
useRadioGroup
|
|
2682
|
-
} from "@react-aria/radio";
|
|
1682
|
+
import { useRadio, useRadioGroup } from "@react-aria/radio";
|
|
2683
1683
|
import styled20, { css as css10 } from "styled-components";
|
|
2684
1684
|
|
|
2685
1685
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
@@ -2701,142 +1701,62 @@ var useRadioContext = () => {
|
|
|
2701
1701
|
|
|
2702
1702
|
// src/components/SegmentedControl/index.tsx
|
|
2703
1703
|
import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2704
|
-
var SegmentedControl = forwardRef15(
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
SegmentedControlRoot,
|
|
2725
|
-
{
|
|
2726
|
-
ref,
|
|
2727
|
-
...radioGroupProps,
|
|
2728
|
-
className: props.className,
|
|
2729
|
-
children: /* @__PURE__ */ jsx26(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ jsx26(
|
|
2730
|
-
Segmented,
|
|
2731
|
-
{
|
|
2732
|
-
value: item.value,
|
|
2733
|
-
disabled: item.disabled,
|
|
2734
|
-
children: item.label
|
|
2735
|
-
},
|
|
2736
|
-
item.value
|
|
2737
|
-
)) })
|
|
2738
|
-
}
|
|
2739
|
-
);
|
|
2740
|
-
}
|
|
2741
|
-
);
|
|
1704
|
+
var SegmentedControl = forwardRef15(function SegmentedControlInner(props, ref) {
|
|
1705
|
+
const ariaRadioGroupProps = useMemo2(() => ({
|
|
1706
|
+
...props,
|
|
1707
|
+
isDisabled: props.disabled,
|
|
1708
|
+
isReadOnly: props.readonly,
|
|
1709
|
+
isRequired: props.required,
|
|
1710
|
+
"aria-label": props.name
|
|
1711
|
+
}), [props]);
|
|
1712
|
+
const state = $a54cdc5c1942b639$export$bca9d026f8e704eb(ariaRadioGroupProps);
|
|
1713
|
+
const {
|
|
1714
|
+
radioGroupProps
|
|
1715
|
+
} = useRadioGroup(ariaRadioGroupProps, state);
|
|
1716
|
+
const segmentedControlItems = useMemo2(() => {
|
|
1717
|
+
return props.data.map((d) => typeof d === "string" ? {
|
|
1718
|
+
value: d,
|
|
1719
|
+
label: d
|
|
1720
|
+
} : d);
|
|
1721
|
+
}, [props.data]);
|
|
1722
|
+
return /* @__PURE__ */ jsx26(SegmentedControlRoot, { ref, ...radioGroupProps, className: props.className, children: /* @__PURE__ */ jsx26(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ jsx26(Segmented, { value: item.value, disabled: item.disabled, children: item.label }, item.value)) }) });
|
|
1723
|
+
});
|
|
2742
1724
|
var SegmentedControl_default = memo6(SegmentedControl);
|
|
2743
1725
|
var Segmented = (props) => {
|
|
2744
1726
|
const state = useRadioContext();
|
|
2745
1727
|
const ref = useRef10(null);
|
|
2746
|
-
const ariaRadioProps = useMemo2(
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
ref
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
SegmentedRoot,
|
|
2761
|
-
{
|
|
2762
|
-
"aria-disabled": isDisabled || state.isReadOnly,
|
|
2763
|
-
checked: isSelected,
|
|
2764
|
-
children: [
|
|
2765
|
-
/* @__PURE__ */ jsx26(SegmentedInput, { ...inputProps, ref }),
|
|
2766
|
-
/* @__PURE__ */ jsx26(RadioLabel2, { children: /* @__PURE__ */ jsx26(SegmentedLabelInner, { children: props.children }) })
|
|
2767
|
-
]
|
|
2768
|
-
}
|
|
2769
|
-
);
|
|
1728
|
+
const ariaRadioProps = useMemo2(() => ({
|
|
1729
|
+
value: props.value,
|
|
1730
|
+
isDisabled: props.disabled,
|
|
1731
|
+
children: props.children
|
|
1732
|
+
}), [props]);
|
|
1733
|
+
const {
|
|
1734
|
+
inputProps,
|
|
1735
|
+
isDisabled,
|
|
1736
|
+
isSelected
|
|
1737
|
+
} = useRadio(ariaRadioProps, state, ref);
|
|
1738
|
+
return /* @__PURE__ */ jsxs13(SegmentedRoot, { "aria-disabled": isDisabled || state.isReadOnly, checked: isSelected, children: [
|
|
1739
|
+
/* @__PURE__ */ jsx26(SegmentedInput, { ...inputProps, ref }),
|
|
1740
|
+
/* @__PURE__ */ jsx26(RadioLabel2, { children: /* @__PURE__ */ jsx26(SegmentedLabelInner, { children: props.children }) })
|
|
1741
|
+
] });
|
|
2770
1742
|
};
|
|
2771
|
-
var SegmentedControlRoot = styled20.div
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
&:disabled,
|
|
2789
|
-
&[aria-disabled]:not([aria-disabled='false']) {
|
|
2790
|
-
cursor: default;
|
|
2791
|
-
opacity: 0.32;
|
|
2792
|
-
}
|
|
2793
|
-
color: var(--charcoal-text2);
|
|
2794
|
-
|
|
2795
|
-
${({ checked = false }) => checked && css10`
|
|
2796
|
-
background-color: var(--charcoal-brand);
|
|
2797
|
-
color: var(--charcoal-text5);
|
|
2798
|
-
`}
|
|
2799
|
-
`;
|
|
2800
|
-
var SegmentedInput = styled20.input`
|
|
2801
|
-
position: absolute;
|
|
2802
|
-
|
|
2803
|
-
height: 0px;
|
|
2804
|
-
width: 0px;
|
|
2805
|
-
padding: 0;
|
|
2806
|
-
margin: 0;
|
|
2807
|
-
|
|
2808
|
-
appearance: none;
|
|
2809
|
-
box-sizing: border-box;
|
|
2810
|
-
overflow: hidden;
|
|
2811
|
-
white-space: nowrap;
|
|
2812
|
-
opacity: 0;
|
|
2813
|
-
`;
|
|
2814
|
-
var RadioLabel2 = styled20.div`
|
|
2815
|
-
background: transparent;
|
|
2816
|
-
display: flex;
|
|
2817
|
-
align-items: center;
|
|
2818
|
-
height: 22px;
|
|
2819
|
-
`;
|
|
2820
|
-
var SegmentedLabelInner = styled20.div`
|
|
2821
|
-
font-size: 14px;
|
|
2822
|
-
line-height: 22px;
|
|
2823
|
-
display: flow-root;
|
|
2824
|
-
|
|
2825
|
-
&::before {
|
|
2826
|
-
display: block;
|
|
2827
|
-
width: 0;
|
|
2828
|
-
height: 0;
|
|
2829
|
-
content: '';
|
|
2830
|
-
margin-top: -4px;
|
|
2831
|
-
}
|
|
2832
|
-
&::after {
|
|
2833
|
-
display: block;
|
|
2834
|
-
width: 0;
|
|
2835
|
-
height: 0;
|
|
2836
|
-
content: '';
|
|
2837
|
-
margin-bottom: -4px;
|
|
2838
|
-
}
|
|
2839
|
-
`;
|
|
1743
|
+
var SegmentedControlRoot = styled20.div.withConfig({
|
|
1744
|
+
componentId: "ccl__sc-1xmkkqt-0"
|
|
1745
|
+
})(["display:inline-flex;align-items:center;background-color:var(--charcoal-surface3);border-radius:16px;"]);
|
|
1746
|
+
var SegmentedRoot = styled20.label.withConfig({
|
|
1747
|
+
componentId: "ccl__sc-1xmkkqt-1"
|
|
1748
|
+
})(["position:relative;display:flex;align-items:center;cursor:pointer;height:32px;padding-right:16px;padding-left:16px;border-radius:16px;&:disabled,&[aria-disabled]:not([aria-disabled='false']){cursor:default;opacity:0.32;}color:var(--charcoal-text2);", ""], ({
|
|
1749
|
+
checked = false
|
|
1750
|
+
}) => checked && css10(["background-color:var(--charcoal-brand);color:var(--charcoal-text5);"]));
|
|
1751
|
+
var SegmentedInput = styled20.input.withConfig({
|
|
1752
|
+
componentId: "ccl__sc-1xmkkqt-2"
|
|
1753
|
+
})(["position:absolute;height:0px;width:0px;padding:0;margin:0;appearance:none;box-sizing:border-box;overflow:hidden;white-space:nowrap;opacity:0;"]);
|
|
1754
|
+
var RadioLabel2 = styled20.div.withConfig({
|
|
1755
|
+
componentId: "ccl__sc-1xmkkqt-3"
|
|
1756
|
+
})(["background:transparent;display:flex;align-items:center;height:22px;"]);
|
|
1757
|
+
var SegmentedLabelInner = styled20.div.withConfig({
|
|
1758
|
+
componentId: "ccl__sc-1xmkkqt-4"
|
|
1759
|
+
})(["font-size:14px;line-height:22px;display:flow-root;&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
|
|
2840
1760
|
|
|
2841
1761
|
// src/components/Checkbox/index.tsx
|
|
2842
1762
|
import { forwardRef as forwardRef16, memo as memo7, useMemo as useMemo3 } from "react";
|
|
@@ -2844,118 +1764,54 @@ import styled21, { css as css11 } from "styled-components";
|
|
|
2844
1764
|
import { useCheckbox } from "@react-aria/checkbox";
|
|
2845
1765
|
import { useObjectRef as useObjectRef3 } from "@react-aria/utils";
|
|
2846
1766
|
import { useToggleState as useToggleState2 } from "react-stately";
|
|
2847
|
-
import { disabledSelector as disabledSelector3 } from "@charcoal-ui/utils";
|
|
2848
1767
|
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss7 } from "@charcoal-ui/styled";
|
|
2849
1768
|
import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2850
|
-
var Checkbox = forwardRef16(
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
}
|
|
2876
|
-
);
|
|
1769
|
+
var Checkbox = forwardRef16(function CheckboxInner({
|
|
1770
|
+
invalid = false,
|
|
1771
|
+
...props
|
|
1772
|
+
}, ref) {
|
|
1773
|
+
const ariaCheckboxProps = useMemo3(() => ({
|
|
1774
|
+
...props,
|
|
1775
|
+
isInValid: invalid,
|
|
1776
|
+
isSelected: props.checked,
|
|
1777
|
+
defaultSelected: props.defaultChecked,
|
|
1778
|
+
validationState: invalid ? "invalid" : "valid",
|
|
1779
|
+
"aria-label": "children" in props ? void 0 : props.label,
|
|
1780
|
+
isDisabled: props.disabled
|
|
1781
|
+
}), [invalid, props]);
|
|
1782
|
+
const state = useToggleState2(ariaCheckboxProps);
|
|
1783
|
+
const objectRef = useObjectRef3(ref);
|
|
1784
|
+
const {
|
|
1785
|
+
inputProps
|
|
1786
|
+
} = useCheckbox(ariaCheckboxProps, state, objectRef);
|
|
1787
|
+
const isDisabled = (props.disabled ?? false) || (props.readonly ?? false);
|
|
1788
|
+
return /* @__PURE__ */ jsxs14(InputRoot, { "aria-disabled": isDisabled, className: props.className, children: [
|
|
1789
|
+
/* @__PURE__ */ jsxs14(CheckboxRoot, { children: [
|
|
1790
|
+
/* @__PURE__ */ jsx27(CheckboxInput, { type: "checkbox", ...inputProps, readOnly: props.readonly }),
|
|
1791
|
+
/* @__PURE__ */ jsx27(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked, children: /* @__PURE__ */ jsx27(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }) })
|
|
1792
|
+
] }),
|
|
1793
|
+
"children" in props && /* @__PURE__ */ jsx27(InputLabel, { children: props.children })
|
|
1794
|
+
] });
|
|
1795
|
+
});
|
|
2877
1796
|
var Checkbox_default = memo7(Checkbox);
|
|
2878
|
-
var hiddenCss = css11
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
var CheckboxRoot = styled21.div`
|
|
2897
|
-
position: relative;
|
|
2898
|
-
`;
|
|
2899
|
-
var CheckboxInput = styled21.input`
|
|
2900
|
-
&[type='checkbox'] {
|
|
2901
|
-
appearance: none;
|
|
2902
|
-
display: block;
|
|
2903
|
-
cursor: pointer;
|
|
2904
|
-
margin: 0;
|
|
2905
|
-
width: 20px;
|
|
2906
|
-
height: 20px;
|
|
2907
|
-
border-radius: 4px;
|
|
2908
|
-
transition: 0.2s box-shadow, 0.2s background-color;
|
|
2909
|
-
|
|
2910
|
-
&:checked {
|
|
2911
|
-
background-color: var(--charcoal-brand);
|
|
2912
|
-
|
|
2913
|
-
&:not(:disabled):not([aria-disabled]),
|
|
2914
|
-
&[aria-disabled='false'] {
|
|
2915
|
-
&:hover {
|
|
2916
|
-
background-color: var(--charcoal-brand-hover);
|
|
2917
|
-
}
|
|
2918
|
-
&:active {
|
|
2919
|
-
background-color: var(--charcoal-brand-press);
|
|
2920
|
-
}
|
|
2921
|
-
}
|
|
2922
|
-
}
|
|
2923
|
-
|
|
2924
|
-
&:not(:disabled):not([aria-disabled]),
|
|
2925
|
-
&[aria-disabled='false'] {
|
|
2926
|
-
${focusVisibleFocusRingCss7}
|
|
2927
|
-
&[aria-invalid='true'] {
|
|
2928
|
-
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
2929
|
-
}
|
|
2930
|
-
}
|
|
2931
|
-
|
|
2932
|
-
&:not(:checked) {
|
|
2933
|
-
border-width: 2px;
|
|
2934
|
-
border-style: solid;
|
|
2935
|
-
border-color: var(--charcoal-text4);
|
|
2936
|
-
}
|
|
2937
|
-
}
|
|
2938
|
-
`;
|
|
2939
|
-
var CheckboxInputOverlay = styled21.div`
|
|
2940
|
-
position: absolute;
|
|
2941
|
-
top: -2px;
|
|
2942
|
-
left: -2px;
|
|
2943
|
-
box-sizing: border-box;
|
|
2944
|
-
display: flex;
|
|
2945
|
-
align-items: center;
|
|
2946
|
-
justify-content: center;
|
|
2947
|
-
width: 24px;
|
|
2948
|
-
height: 24px;
|
|
2949
|
-
color: var(--charcoal-text5);
|
|
2950
|
-
|
|
2951
|
-
${({ checked }) => checked !== true && hiddenCss};
|
|
2952
|
-
`;
|
|
2953
|
-
var InputLabel = styled21.div`
|
|
2954
|
-
color: var(--charcoal-text2);
|
|
2955
|
-
font-size: 14px;
|
|
2956
|
-
/** checkbox の height が 20px なのでcheckbox と text が揃っているように見せるために行ボックスの高さを 20px にしている */
|
|
2957
|
-
line-height: 20px;
|
|
2958
|
-
`;
|
|
1797
|
+
var hiddenCss = css11(["visibility:hidden;"]);
|
|
1798
|
+
var InputRoot = styled21.label.withConfig({
|
|
1799
|
+
componentId: "ccl__sc-wrdmwj-0"
|
|
1800
|
+
})(["position:relative;display:flex;cursor:pointer;gap:4px;&:disabled,&[aria-disabled]:not([aria-disabled='false']){cursor:default;opacity:0.32;}"]);
|
|
1801
|
+
var CheckboxRoot = styled21.div.withConfig({
|
|
1802
|
+
componentId: "ccl__sc-wrdmwj-1"
|
|
1803
|
+
})(["position:relative;"]);
|
|
1804
|
+
var CheckboxInput = styled21.input.withConfig({
|
|
1805
|
+
componentId: "ccl__sc-wrdmwj-2"
|
|
1806
|
+
})(["&[type='checkbox']{appearance:none;display:block;cursor:pointer;margin:0;width:20px;height:20px;border-radius:4px;transition:0.2s box-shadow,0.2s background-color;&:disabled{cursor:default;}&:read-only{cursor:default;}&:checked{background-color:var(--charcoal-brand);&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{&:hover{background-color:var(--charcoal-brand-hover);}&:active{background-color:var(--charcoal-brand-press);}}}&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{", " &[aria-invalid='true']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}}&:not(:checked){border-width:2px;border-style:solid;border-color:var(--charcoal-text4);}}"], focusVisibleFocusRingCss7);
|
|
1807
|
+
var CheckboxInputOverlay = styled21.div.withConfig({
|
|
1808
|
+
componentId: "ccl__sc-wrdmwj-3"
|
|
1809
|
+
})(["position:absolute;top:-2px;left:-2px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:24px;height:24px;color:var(--charcoal-text5);", ";"], ({
|
|
1810
|
+
checked
|
|
1811
|
+
}) => checked !== true && hiddenCss);
|
|
1812
|
+
var InputLabel = styled21.div.withConfig({
|
|
1813
|
+
componentId: "ccl__sc-wrdmwj-4"
|
|
1814
|
+
})(["color:var(--charcoal-text2);font-size:14px;line-height:20px;"]);
|
|
2959
1815
|
|
|
2960
1816
|
// src/components/TagItem/index.tsx
|
|
2961
1817
|
import { forwardRef as forwardRef17, memo as memo8, useMemo as useMemo4 } from "react";
|
|
@@ -2969,188 +1825,98 @@ var sizeMap = {
|
|
|
2969
1825
|
S: 32,
|
|
2970
1826
|
M: 40
|
|
2971
1827
|
};
|
|
2972
|
-
var TagItem = forwardRef17(
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
1828
|
+
var TagItem = forwardRef17(function TagItemInner({
|
|
1829
|
+
label,
|
|
1830
|
+
translatedLabel,
|
|
1831
|
+
bgColor = "#7ACCB1",
|
|
1832
|
+
bgImage,
|
|
1833
|
+
size = "M",
|
|
1834
|
+
disabled,
|
|
1835
|
+
status = "default",
|
|
1836
|
+
className,
|
|
1837
|
+
...props
|
|
1838
|
+
}, _ref) {
|
|
1839
|
+
const ref = useObjectRef4(_ref);
|
|
1840
|
+
const ariaButtonProps = useMemo4(() => ({
|
|
1841
|
+
elementType: "a",
|
|
1842
|
+
isDisabled: disabled,
|
|
2982
1843
|
...props
|
|
2983
|
-
},
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
size: hasTranslatedLabel ? "M" : size,
|
|
3000
|
-
status,
|
|
3001
|
-
...buttonProps,
|
|
3002
|
-
className,
|
|
3003
|
-
children: [
|
|
3004
|
-
/* @__PURE__ */ jsx28(Background, { bgColor, bgImage, status }),
|
|
3005
|
-
/* @__PURE__ */ jsxs15(Inner, { children: [
|
|
3006
|
-
/* @__PURE__ */ jsxs15(LabelWrapper, { isTranslate: hasTranslatedLabel, children: [
|
|
3007
|
-
hasTranslatedLabel && /* @__PURE__ */ jsx28(TranslatedLabel, { children: /* @__PURE__ */ jsx28(Label3, { children: translatedLabel }) }),
|
|
3008
|
-
/* @__PURE__ */ jsx28(Label3, { children: label })
|
|
3009
|
-
] }),
|
|
3010
|
-
status === "active" && /* @__PURE__ */ jsx28(Icon_default, { name: "16/Remove" })
|
|
3011
|
-
] })
|
|
3012
|
-
]
|
|
3013
|
-
}
|
|
3014
|
-
);
|
|
3015
|
-
}
|
|
3016
|
-
);
|
|
1844
|
+
}), [disabled, props]);
|
|
1845
|
+
const {
|
|
1846
|
+
buttonProps
|
|
1847
|
+
} = useButton(ariaButtonProps, ref);
|
|
1848
|
+
const hasTranslatedLabel = translatedLabel !== void 0 && translatedLabel.length > 0;
|
|
1849
|
+
return /* @__PURE__ */ jsxs15(TagItemRoot, { ref, size: hasTranslatedLabel ? "M" : size, status, ...buttonProps, className, children: [
|
|
1850
|
+
/* @__PURE__ */ jsx28(Background, { bgColor, bgImage, status }),
|
|
1851
|
+
/* @__PURE__ */ jsxs15(Inner, { children: [
|
|
1852
|
+
/* @__PURE__ */ jsxs15(LabelWrapper, { isTranslate: hasTranslatedLabel, children: [
|
|
1853
|
+
hasTranslatedLabel && /* @__PURE__ */ jsx28(TranslatedLabel, { children: /* @__PURE__ */ jsx28(Label3, { children: translatedLabel }) }),
|
|
1854
|
+
/* @__PURE__ */ jsx28(Label3, { children: label })
|
|
1855
|
+
] }),
|
|
1856
|
+
status === "active" && /* @__PURE__ */ jsx28(Icon_default, { name: "16/Remove" })
|
|
1857
|
+
] })
|
|
1858
|
+
] });
|
|
1859
|
+
});
|
|
3017
1860
|
var TagItem_default = memo8(TagItem);
|
|
3018
|
-
var horizontalPadding = ({
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
1861
|
+
var horizontalPadding = ({
|
|
1862
|
+
left,
|
|
1863
|
+
right
|
|
1864
|
+
}) => css12(["padding-right:", ";padding-left:", ";"], px2(right), px2(left));
|
|
3022
1865
|
var tagItemRootSize = (size) => {
|
|
3023
1866
|
switch (size) {
|
|
3024
1867
|
case "M":
|
|
3025
|
-
return horizontalPadding({
|
|
1868
|
+
return horizontalPadding({
|
|
1869
|
+
left: 24,
|
|
1870
|
+
right: 24
|
|
1871
|
+
});
|
|
3026
1872
|
case "S":
|
|
3027
|
-
return horizontalPadding({
|
|
1873
|
+
return horizontalPadding({
|
|
1874
|
+
left: 16,
|
|
1875
|
+
right: 16
|
|
1876
|
+
});
|
|
3028
1877
|
}
|
|
3029
1878
|
};
|
|
3030
|
-
var activeTagItemRoot = horizontalPadding({
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
var
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
${({ bgImage }) => bgImage !== void 0 && css12`
|
|
3073
|
-
background-color: var(--charcoal-surface4);
|
|
3074
|
-
|
|
3075
|
-
&::before {
|
|
3076
|
-
content: '';
|
|
3077
|
-
position: absolute;
|
|
3078
|
-
top: 0;
|
|
3079
|
-
left: 0;
|
|
3080
|
-
width: 100%;
|
|
3081
|
-
height: 100%;
|
|
3082
|
-
background-position: center;
|
|
3083
|
-
background-size: cover;
|
|
3084
|
-
background-image: url(${bgImage});
|
|
3085
|
-
mix-blend-mode: overlay;
|
|
3086
|
-
}
|
|
3087
|
-
`}
|
|
3088
|
-
`;
|
|
3089
|
-
var Inner = styled22.div`
|
|
3090
|
-
display: inline-flex;
|
|
3091
|
-
gap: 8px;
|
|
3092
|
-
align-items: center;
|
|
3093
|
-
z-index: 2;
|
|
3094
|
-
`;
|
|
3095
|
-
var labelCSS = css12`
|
|
3096
|
-
font-size: 14px;
|
|
3097
|
-
line-height: 22px;
|
|
3098
|
-
font-weight: bold;
|
|
3099
|
-
display: flow-root;
|
|
3100
|
-
|
|
3101
|
-
&::before {
|
|
3102
|
-
display: block;
|
|
3103
|
-
width: 0;
|
|
3104
|
-
height: 0;
|
|
3105
|
-
content: '';
|
|
3106
|
-
margin-top: -4px;
|
|
3107
|
-
}
|
|
3108
|
-
&::after {
|
|
3109
|
-
display: block;
|
|
3110
|
-
width: 0;
|
|
3111
|
-
height: 0;
|
|
3112
|
-
content: '';
|
|
3113
|
-
margin-bottom: -4px;
|
|
3114
|
-
}
|
|
3115
|
-
`;
|
|
3116
|
-
var translateLabelCSS = css12`
|
|
3117
|
-
display: flex;
|
|
3118
|
-
align-items: center;
|
|
3119
|
-
flex-direction: column;
|
|
3120
|
-
font-size: 10px;
|
|
3121
|
-
`;
|
|
3122
|
-
var LabelWrapper = styled22.div`
|
|
3123
|
-
${({ isTranslate }) => isTranslate ?? false ? translateLabelCSS : labelCSS}
|
|
3124
|
-
`;
|
|
3125
|
-
var Label3 = styled22.span`
|
|
3126
|
-
max-width: 152px;
|
|
3127
|
-
overflow: hidden;
|
|
3128
|
-
text-overflow: ellipsis;
|
|
3129
|
-
white-space: nowrap;
|
|
3130
|
-
font-size: inherit;
|
|
3131
|
-
color: inherit;
|
|
3132
|
-
line-height: inherit;
|
|
3133
|
-
`;
|
|
3134
|
-
var TranslatedLabel = styled22.div`
|
|
3135
|
-
font-size: 12px;
|
|
3136
|
-
line-height: 20px;
|
|
3137
|
-
font-weight: bold;
|
|
3138
|
-
display: flow-root;
|
|
3139
|
-
&::before {
|
|
3140
|
-
display: block;
|
|
3141
|
-
width: 0;
|
|
3142
|
-
height: 0;
|
|
3143
|
-
content: '';
|
|
3144
|
-
margin-top: -4px;
|
|
3145
|
-
}
|
|
3146
|
-
&::after {
|
|
3147
|
-
display: block;
|
|
3148
|
-
width: 0;
|
|
3149
|
-
height: 0;
|
|
3150
|
-
content: '';
|
|
3151
|
-
margin-bottom: -4px;
|
|
3152
|
-
}
|
|
3153
|
-
`;
|
|
1879
|
+
var activeTagItemRoot = horizontalPadding({
|
|
1880
|
+
left: 16,
|
|
1881
|
+
right: 8
|
|
1882
|
+
});
|
|
1883
|
+
var TagItemRoot = styled22.a.withConfig({
|
|
1884
|
+
componentId: "ccl__sc-11j9pu2-0"
|
|
1885
|
+
})(["isolation:isolate;position:relative;height:", "px;display:inline-flex;align-items:center;justify-content:center;text-decoration:none;cursor:pointer;overflow:hidden;border-radius:4px;", " ", " color:", ";transition:0.2s box-shadow;&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{", "}&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}"], ({
|
|
1886
|
+
size
|
|
1887
|
+
}) => sizeMap[size], ({
|
|
1888
|
+
size,
|
|
1889
|
+
status
|
|
1890
|
+
}) => status !== "active" && tagItemRootSize(size), ({
|
|
1891
|
+
status
|
|
1892
|
+
}) => status === "active" && activeTagItemRoot, ({
|
|
1893
|
+
status
|
|
1894
|
+
}) => status === "inactive" ? "var(--charcoal-text2)" : "var(--charcoal-text5)", focusVisibleFocusRingCss8);
|
|
1895
|
+
var Background = styled22.div.withConfig({
|
|
1896
|
+
componentId: "ccl__sc-11j9pu2-1"
|
|
1897
|
+
})(["position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;background-color:", ";", " ", ""], ({
|
|
1898
|
+
bgColor
|
|
1899
|
+
}) => bgColor, ({
|
|
1900
|
+
status
|
|
1901
|
+
}) => status === "inactive" && css12(["background-color:var(--charcoal-surface3);"]), ({
|
|
1902
|
+
bgImage
|
|
1903
|
+
}) => bgImage !== void 0 && css12(["background-color:var(--charcoal-surface4);&::before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-size:cover;background-image:url(", ");mix-blend-mode:overlay;}"], bgImage));
|
|
1904
|
+
var Inner = styled22.div.withConfig({
|
|
1905
|
+
componentId: "ccl__sc-11j9pu2-2"
|
|
1906
|
+
})(["display:inline-flex;gap:8px;align-items:center;z-index:2;"]);
|
|
1907
|
+
var labelCSS = css12(["font-size:14px;line-height:22px;font-weight:bold;display:flow-root;&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
|
|
1908
|
+
var translateLabelCSS = css12(["display:flex;align-items:center;flex-direction:column;font-size:10px;"]);
|
|
1909
|
+
var LabelWrapper = styled22.div.withConfig({
|
|
1910
|
+
componentId: "ccl__sc-11j9pu2-3"
|
|
1911
|
+
})(["", ""], ({
|
|
1912
|
+
isTranslate
|
|
1913
|
+
}) => isTranslate ?? false ? translateLabelCSS : labelCSS);
|
|
1914
|
+
var Label3 = styled22.span.withConfig({
|
|
1915
|
+
componentId: "ccl__sc-11j9pu2-4"
|
|
1916
|
+
})(["max-width:152px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:inherit;color:inherit;line-height:inherit;"]);
|
|
1917
|
+
var TranslatedLabel = styled22.div.withConfig({
|
|
1918
|
+
componentId: "ccl__sc-11j9pu2-5"
|
|
1919
|
+
})(["font-size:12px;line-height:20px;font-weight:bold;display:flow-root;&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
|
|
3154
1920
|
export {
|
|
3155
1921
|
Button_default as Button,
|
|
3156
1922
|
CharcoalProvider,
|