@charcoal-ui/react 3.10.1-beta.1 → 4.0.0-beta.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/_lib/useClassNames.d.ts +5 -0
- package/dist/_lib/useClassNames.d.ts.map +1 -0
- package/dist/components/Button/index.d.ts +13 -10
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.story.d.ts +9 -4
- package/dist/components/Button/index.story.d.ts.map +1 -1
- package/dist/index.cjs.js +314 -357
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +118 -0
- package/dist/index.css.map +1 -0
- package/dist/index.esm.js +208 -251
- package/dist/index.esm.js.map +1 -1
- package/dist/styled.d.ts +4 -4
- package/package.json +17 -11
- package/src/_lib/useClassNames.ts +14 -0
- package/src/components/Button/__snapshots__/index.story.storyshot +22 -1754
- package/src/components/Button/index.css +125 -0
- package/src/components/Button/index.story.tsx +1 -95
- package/src/components/Button/index.tsx +36 -42
- package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +4 -111
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +2 -105
- package/src/components/Modal/__snapshots__/index.story.storyshot +569 -1621
- package/dist/components/Button/StyledButton.d.ts +0 -13
- package/dist/components/Button/StyledButton.d.ts.map +0 -1
- package/dist/components/Button/lib/variantToBackground.d.ts +0 -3
- package/dist/components/Button/lib/variantToBackground.d.ts.map +0 -1
- package/dist/components/Button/lib/variantToFont.d.ts +0 -3
- package/dist/components/Button/lib/variantToFont.d.ts.map +0 -1
- package/src/components/Button/StyledButton.tsx +0 -71
- package/src/components/Button/lib/variantToBackground.tsx +0 -19
- package/src/components/Button/lib/variantToFont.tsx +0 -19
package/dist/index.esm.js
CHANGED
|
@@ -51,73 +51,37 @@ function CharcoalProvider({
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
// src/components/Button/index.tsx
|
|
54
|
-
import { forwardRef as
|
|
54
|
+
import { forwardRef as forwardRef2, useMemo as useMemo2 } from "react";
|
|
55
55
|
|
|
56
|
-
// src/_lib/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
function mergeRefs(...refs) {
|
|
61
|
-
return (value) => {
|
|
62
|
-
for (const ref of refs) {
|
|
63
|
-
if (typeof ref === "function") {
|
|
64
|
-
ref(value);
|
|
65
|
-
} else if (ref !== null) {
|
|
66
|
-
;
|
|
67
|
-
ref.current = value;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function countCodePointsInString(string) {
|
|
73
|
-
return Array.from(string).length;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// src/components/Button/lib/variantToFont.tsx
|
|
77
|
-
function variantToFont(variant) {
|
|
78
|
-
switch (variant) {
|
|
79
|
-
case "Overlay":
|
|
80
|
-
return "text5";
|
|
81
|
-
case "Default":
|
|
82
|
-
return "text2";
|
|
83
|
-
case "Primary":
|
|
84
|
-
return "text5";
|
|
85
|
-
case "Navigation":
|
|
86
|
-
return "text5";
|
|
87
|
-
case "Danger":
|
|
88
|
-
return "text5";
|
|
89
|
-
default:
|
|
90
|
-
return unreachable(variant);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// src/components/Button/lib/variantToBackground.tsx
|
|
95
|
-
function variantToBackground(variant) {
|
|
96
|
-
switch (variant) {
|
|
97
|
-
case "Overlay":
|
|
98
|
-
return "surface4";
|
|
99
|
-
case "Default":
|
|
100
|
-
return "surface3";
|
|
101
|
-
case "Primary":
|
|
102
|
-
return "brand";
|
|
103
|
-
case "Navigation":
|
|
104
|
-
return "surface6";
|
|
105
|
-
case "Danger":
|
|
106
|
-
return "assertive";
|
|
107
|
-
default:
|
|
108
|
-
return unreachable(variant);
|
|
109
|
-
}
|
|
56
|
+
// src/_lib/useClassNames.ts
|
|
57
|
+
import { useMemo } from "react";
|
|
58
|
+
function useClassNames(defaultClassName, propsClassName) {
|
|
59
|
+
return useMemo(() => [defaultClassName, propsClassName].filter((v) => v).join(" "), [defaultClassName, propsClassName]);
|
|
110
60
|
}
|
|
111
61
|
|
|
112
|
-
// src/components/Button/
|
|
113
|
-
import
|
|
62
|
+
// src/components/Button/index.tsx
|
|
63
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
64
|
+
var Button = forwardRef2(function Button2({
|
|
65
|
+
variant,
|
|
66
|
+
fullWidth,
|
|
67
|
+
size,
|
|
68
|
+
className,
|
|
69
|
+
as,
|
|
70
|
+
isActive,
|
|
71
|
+
...props
|
|
72
|
+
}, ref) {
|
|
73
|
+
const Component = useMemo2(() => as ?? "button", [as]);
|
|
74
|
+
const classNames = useClassNames("charcoal-button", className);
|
|
75
|
+
return /* @__PURE__ */ jsx3(Component, { ...props, className: classNames, "data-variant": variant, "data-size": size, "data-full-width": fullWidth, "data-active": isActive, ref });
|
|
76
|
+
});
|
|
77
|
+
var Button_default = Button;
|
|
114
78
|
|
|
115
79
|
// src/components/Clickable/index.tsx
|
|
116
|
-
import * as
|
|
80
|
+
import * as React3 from "react";
|
|
117
81
|
import styled from "styled-components";
|
|
118
82
|
import { disabledSelector } from "@charcoal-ui/utils";
|
|
119
|
-
import { jsx as
|
|
120
|
-
var Clickable =
|
|
83
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
84
|
+
var Clickable = React3.forwardRef(function Clickable2(props, ref) {
|
|
121
85
|
const {
|
|
122
86
|
Link
|
|
123
87
|
} = useComponentAbstraction();
|
|
@@ -132,44 +96,17 @@ var Clickable = React2.forwardRef(function Clickable2(props, ref) {
|
|
|
132
96
|
} = props;
|
|
133
97
|
rest = _rest;
|
|
134
98
|
}
|
|
135
|
-
return /* @__PURE__ */
|
|
99
|
+
return /* @__PURE__ */ jsx4(StyledClickableDiv, { ...rest, ref, as, "aria-disabled": ariaDisabled });
|
|
136
100
|
});
|
|
137
101
|
var Clickable_default = Clickable;
|
|
138
102
|
var StyledClickableDiv = styled.div.withConfig({
|
|
139
103
|
componentId: "ccl__sc-1lxyknw-0"
|
|
140
104
|
})(["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);
|
|
141
105
|
|
|
142
|
-
// src/components/Button/StyledButton.tsx
|
|
143
|
-
import { focusVisibleFocusRingCss } from "@charcoal-ui/styled";
|
|
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);
|
|
153
|
-
|
|
154
|
-
// src/components/Button/index.tsx
|
|
155
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
156
|
-
var Button = forwardRef3(function Button2({
|
|
157
|
-
children,
|
|
158
|
-
variant = "Default",
|
|
159
|
-
size = "M",
|
|
160
|
-
fullWidth: fixed = false,
|
|
161
|
-
disabled = false,
|
|
162
|
-
isActive = false,
|
|
163
|
-
...rest
|
|
164
|
-
}, ref) {
|
|
165
|
-
return /* @__PURE__ */ jsx4(StyledButton, { ...rest, disabled, $background: variantToBackground(variant), $color: variantToFont(variant), $size: size, $fullWidth: fixed, $isActive: isActive, ref, children });
|
|
166
|
-
});
|
|
167
|
-
var Button_default = Button;
|
|
168
|
-
|
|
169
106
|
// src/components/IconButton/index.tsx
|
|
170
107
|
import { forwardRef as forwardRef4 } from "react";
|
|
171
|
-
import
|
|
172
|
-
import { focusVisibleFocusRingCss
|
|
108
|
+
import styled2, { css } from "styled-components";
|
|
109
|
+
import { focusVisibleFocusRingCss } from "@charcoal-ui/styled";
|
|
173
110
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
174
111
|
var IconButton = forwardRef4(function IconButtonInner({
|
|
175
112
|
variant = "Default",
|
|
@@ -182,7 +119,7 @@ var IconButton = forwardRef4(function IconButtonInner({
|
|
|
182
119
|
return /* @__PURE__ */ jsx5(StyledIconButton, { ...rest, ref, $size: size, $variant: variant, $isActive: isActive, children: /* @__PURE__ */ jsx5("pixiv-icon", { name: icon }) });
|
|
183
120
|
});
|
|
184
121
|
var IconButton_default = IconButton;
|
|
185
|
-
var StyledIconButton =
|
|
122
|
+
var StyledIconButton = styled2(Clickable_default).attrs(styledProps).withConfig({
|
|
186
123
|
componentId: "ccl__sc-zssehl-0"
|
|
187
124
|
})(["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
125
|
$font
|
|
@@ -192,7 +129,7 @@ var StyledIconButton = styled3(Clickable_default).attrs(styledProps).withConfig(
|
|
|
192
129
|
$isActive,
|
|
193
130
|
$background,
|
|
194
131
|
$font
|
|
195
|
-
}) => $isActive ?
|
|
132
|
+
}) => $isActive ? css(["color:var(--charcoal-", "-press);background-color:var(--charcoal-", "-press);"], $font, $background) : css(["&:hover{color:var(--charcoal-", "-hover);background-color:var(--charcoal-", "-hover);}&:active{color:var(--charcoal-", "-press);background-color:var(--charcoal-", "-press);}"], $font, $background, $font, $background), focusVisibleFocusRingCss);
|
|
196
133
|
function styledProps({
|
|
197
134
|
$size,
|
|
198
135
|
$variant
|
|
@@ -258,10 +195,10 @@ function validateIconSize(size, icon) {
|
|
|
258
195
|
|
|
259
196
|
// src/components/Radio/index.tsx
|
|
260
197
|
import { memo, forwardRef as forwardRef5, useCallback, useContext as useContext2 } from "react";
|
|
261
|
-
import * as
|
|
262
|
-
import
|
|
198
|
+
import * as React4 from "react";
|
|
199
|
+
import styled3 from "styled-components";
|
|
263
200
|
import warning from "warning";
|
|
264
|
-
import { focusVisibleFocusRingCss as
|
|
201
|
+
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss2 } from "@charcoal-ui/styled";
|
|
265
202
|
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
266
203
|
var Radio = forwardRef5(function RadioInner({
|
|
267
204
|
value,
|
|
@@ -293,21 +230,21 @@ var Radio = forwardRef5(function RadioInner({
|
|
|
293
230
|
] });
|
|
294
231
|
});
|
|
295
232
|
var Radio_default = memo(Radio);
|
|
296
|
-
var RadioRoot =
|
|
233
|
+
var RadioRoot = styled3.label.withConfig({
|
|
297
234
|
componentId: "ccl__sc-1hitkzn-0"
|
|
298
235
|
})(["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 =
|
|
236
|
+
var RadioInput = styled3.input.attrs({
|
|
300
237
|
type: "radio"
|
|
301
238
|
}).withConfig({
|
|
302
239
|
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);}}}}}"],
|
|
304
|
-
var RadioLabel =
|
|
240
|
+
})(["&[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);}}}}}"], focusVisibleFocusRingCss2);
|
|
241
|
+
var RadioLabel = styled3.div.withConfig({
|
|
305
242
|
componentId: "ccl__sc-1hitkzn-2"
|
|
306
243
|
})(["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 =
|
|
244
|
+
var StyledRadioGroup = styled3.div.withConfig({
|
|
308
245
|
componentId: "ccl__sc-1hitkzn-3"
|
|
309
246
|
})(["display:grid;grid-template-columns:1fr;grid-gap:8px;"]);
|
|
310
|
-
var RadioGroupContext =
|
|
247
|
+
var RadioGroupContext = React4.createContext({
|
|
311
248
|
name: void 0,
|
|
312
249
|
selected: void 0,
|
|
313
250
|
disabled: false,
|
|
@@ -343,7 +280,7 @@ function RadioGroup({
|
|
|
343
280
|
|
|
344
281
|
// src/components/MultiSelect/index.tsx
|
|
345
282
|
import { useCallback as useCallback2, useContext as useContext3, forwardRef as forwardRef6, memo as memo2 } from "react";
|
|
346
|
-
import
|
|
283
|
+
import styled4, { css as css2 } from "styled-components";
|
|
347
284
|
import warning2 from "warning";
|
|
348
285
|
import { px } from "@charcoal-ui/utils";
|
|
349
286
|
|
|
@@ -361,7 +298,7 @@ var MultiSelectGroupContext = createContext3({
|
|
|
361
298
|
});
|
|
362
299
|
|
|
363
300
|
// src/components/MultiSelect/index.tsx
|
|
364
|
-
import { focusVisibleFocusRingCss as
|
|
301
|
+
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss3 } from "@charcoal-ui/styled";
|
|
365
302
|
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
366
303
|
var MultiSelect = forwardRef6(function MultiSelectInner({
|
|
367
304
|
value,
|
|
@@ -410,32 +347,32 @@ var MultiSelect = forwardRef6(function MultiSelectInner({
|
|
|
410
347
|
] });
|
|
411
348
|
});
|
|
412
349
|
var MultiSelect_default = memo2(MultiSelect);
|
|
413
|
-
var MultiSelectRoot =
|
|
350
|
+
var MultiSelectRoot = styled4.label.withConfig({
|
|
414
351
|
componentId: "ccl__sc-wpr5y9-0"
|
|
415
352
|
})(["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
353
|
theme
|
|
417
354
|
}) => px(theme.spacing[4]));
|
|
418
|
-
var MultiSelectLabel =
|
|
355
|
+
var MultiSelectLabel = styled4.div.withConfig({
|
|
419
356
|
componentId: "ccl__sc-wpr5y9-1"
|
|
420
357
|
})(["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 =
|
|
358
|
+
var MultiSelectInput = styled4.input.attrs({
|
|
422
359
|
type: "checkbox"
|
|
423
360
|
}).withConfig({
|
|
424
361
|
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);}}", " ", " ", "}"],
|
|
362
|
+
})(["&[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);}}", " ", " ", "}"], focusVisibleFocusRingCss3, ({
|
|
426
363
|
invalid,
|
|
427
364
|
overlay
|
|
428
|
-
}) => invalid && !overlay &&
|
|
365
|
+
}) => invalid && !overlay && css2(["&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}"]), ({
|
|
429
366
|
overlay
|
|
430
|
-
}) => overlay &&
|
|
431
|
-
var MultiSelectInputOverlay =
|
|
367
|
+
}) => overlay && css2(["background-color:var(--charcoal-surface4);"]));
|
|
368
|
+
var MultiSelectInputOverlay = styled4.div.withConfig({
|
|
432
369
|
componentId: "ccl__sc-wpr5y9-3"
|
|
433
370
|
})(["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
371
|
invalid,
|
|
435
372
|
overlay
|
|
436
|
-
}) => invalid && overlay &&
|
|
373
|
+
}) => invalid && overlay && css2(["&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}"]), ({
|
|
437
374
|
overlay
|
|
438
|
-
}) => overlay &&
|
|
375
|
+
}) => overlay && css2(["border-color:var(--charcoal-text5);border-width:2px;border-style:solid;"]));
|
|
439
376
|
function MultiSelectGroup({
|
|
440
377
|
className,
|
|
441
378
|
name,
|
|
@@ -471,18 +408,18 @@ function MultiSelectGroup({
|
|
|
471
408
|
|
|
472
409
|
// src/components/Switch/index.tsx
|
|
473
410
|
import { useSwitch } from "@react-aria/switch";
|
|
474
|
-
import { useMemo, memo as memo3, forwardRef as forwardRef7 } from "react";
|
|
411
|
+
import { useMemo as useMemo3, memo as memo3, forwardRef as forwardRef7 } from "react";
|
|
475
412
|
import { useToggleState } from "react-stately";
|
|
476
|
-
import
|
|
413
|
+
import styled5 from "styled-components";
|
|
477
414
|
import { useObjectRef } from "@react-aria/utils";
|
|
478
|
-
import { focusVisibleFocusRingCss as
|
|
415
|
+
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss4 } from "@charcoal-ui/styled";
|
|
479
416
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
480
417
|
var SwitchCheckbox = forwardRef7(function SwitchCheckboxInner(props, external) {
|
|
481
418
|
const {
|
|
482
419
|
disabled,
|
|
483
420
|
className
|
|
484
421
|
} = props;
|
|
485
|
-
const ariaSwitchProps =
|
|
422
|
+
const ariaSwitchProps = useMemo3(() => ({
|
|
486
423
|
...props,
|
|
487
424
|
"aria-label": "children" in props ? void 0 : props.label,
|
|
488
425
|
isDisabled: props.disabled,
|
|
@@ -503,30 +440,30 @@ var SwitchCheckbox = forwardRef7(function SwitchCheckboxInner(props, external) {
|
|
|
503
440
|
] });
|
|
504
441
|
});
|
|
505
442
|
var Switch_default = memo3(SwitchCheckbox);
|
|
506
|
-
var Label =
|
|
443
|
+
var Label = styled5.label.withConfig({
|
|
507
444
|
componentId: "ccl__sc-1wy6z5h-0"
|
|
508
445
|
})(["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 =
|
|
446
|
+
var LabelInner = styled5.div.withConfig({
|
|
510
447
|
componentId: "ccl__sc-1wy6z5h-1"
|
|
511
448
|
})(["font-size:14px;line-height:22px;color:var(--charcoal-text2);margin-left:4px;"]);
|
|
512
|
-
var SwitchInput =
|
|
449
|
+
var SwitchInput = styled5.input.attrs({
|
|
513
450
|
type: "checkbox"
|
|
514
451
|
}).withConfig({
|
|
515
452
|
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;}}"],
|
|
453
|
+
})(["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;}}"], focusVisibleFocusRingCss4);
|
|
517
454
|
|
|
518
455
|
// src/components/TextField/index.tsx
|
|
519
456
|
import { useTextField } from "@react-aria/textfield";
|
|
520
457
|
import { useVisuallyHidden } from "@react-aria/visually-hidden";
|
|
521
458
|
import { useCallback as useCallback3, useEffect as useEffect2, useRef, useState } from "react";
|
|
522
|
-
import * as
|
|
523
|
-
import
|
|
459
|
+
import * as React6 from "react";
|
|
460
|
+
import styled7, { css as css3 } from "styled-components";
|
|
524
461
|
|
|
525
462
|
// src/components/FieldLabel/index.tsx
|
|
526
|
-
import * as
|
|
527
|
-
import
|
|
463
|
+
import * as React5 from "react";
|
|
464
|
+
import styled6 from "styled-components";
|
|
528
465
|
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
529
|
-
var FieldLabel =
|
|
466
|
+
var FieldLabel = React5.forwardRef(function FieldLabel2({
|
|
530
467
|
style,
|
|
531
468
|
className,
|
|
532
469
|
label,
|
|
@@ -542,19 +479,39 @@ var FieldLabel = React4.forwardRef(function FieldLabel2({
|
|
|
542
479
|
] });
|
|
543
480
|
});
|
|
544
481
|
var FieldLabel_default = FieldLabel;
|
|
545
|
-
var Label2 =
|
|
482
|
+
var Label2 = styled6.label.withConfig({
|
|
546
483
|
componentId: "ccl__sc-1iotshb-0"
|
|
547
484
|
})(["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 =
|
|
485
|
+
var RequiredText = styled6.span.withConfig({
|
|
549
486
|
componentId: "ccl__sc-1iotshb-1"
|
|
550
487
|
})(["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 =
|
|
488
|
+
var SubLabelClickable = styled6.div.withConfig({
|
|
552
489
|
componentId: "ccl__sc-1iotshb-2"
|
|
553
490
|
})(["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 =
|
|
491
|
+
var FieldLabelWrapper = styled6.div.withConfig({
|
|
555
492
|
componentId: "ccl__sc-1iotshb-3"
|
|
556
493
|
})(["display:inline-flex;align-items:center;> ", "{margin-left:4px;}> ", "{margin-left:auto;}"], RequiredText, SubLabelClickable);
|
|
557
494
|
|
|
495
|
+
// src/_lib/index.ts
|
|
496
|
+
function unreachable(value) {
|
|
497
|
+
throw new Error(arguments.length === 0 ? "unreachable" : `unreachable (${JSON.stringify(value)})`);
|
|
498
|
+
}
|
|
499
|
+
function mergeRefs(...refs) {
|
|
500
|
+
return (value) => {
|
|
501
|
+
for (const ref of refs) {
|
|
502
|
+
if (typeof ref === "function") {
|
|
503
|
+
ref(value);
|
|
504
|
+
} else if (ref !== null) {
|
|
505
|
+
;
|
|
506
|
+
ref.current = value;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
function countCodePointsInString(string) {
|
|
512
|
+
return Array.from(string).length;
|
|
513
|
+
}
|
|
514
|
+
|
|
558
515
|
// src/components/TextField/useFocusWithClick.tsx
|
|
559
516
|
import { useEffect } from "react";
|
|
560
517
|
function useFocusWithClick(containerRef, inputRef) {
|
|
@@ -577,7 +534,7 @@ function useFocusWithClick(containerRef, inputRef) {
|
|
|
577
534
|
// src/components/TextField/index.tsx
|
|
578
535
|
import { mergeProps } from "@react-aria/utils";
|
|
579
536
|
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
580
|
-
var TextField =
|
|
537
|
+
var TextField = React6.forwardRef(function SingleLineTextFieldInner({
|
|
581
538
|
onChange,
|
|
582
539
|
...props
|
|
583
540
|
}, forwardRef18) {
|
|
@@ -648,30 +605,30 @@ var TextField = React5.forwardRef(function SingleLineTextFieldInner({
|
|
|
648
605
|
] });
|
|
649
606
|
});
|
|
650
607
|
var TextField_default = TextField;
|
|
651
|
-
var TextFieldRoot =
|
|
608
|
+
var TextFieldRoot = styled7.div.withConfig({
|
|
652
609
|
componentId: "ccl__sc-3dd0tt-0"
|
|
653
610
|
})(["display:flex;flex-direction:column;", ""], (p) => p.isDisabled && {
|
|
654
611
|
opacity: p.theme.elementEffect.disabled.opacity
|
|
655
612
|
});
|
|
656
|
-
var TextFieldLabel =
|
|
613
|
+
var TextFieldLabel = styled7(FieldLabel_default).withConfig({
|
|
657
614
|
componentId: "ccl__sc-3dd0tt-1"
|
|
658
615
|
})(["margin-bottom:8px;"]);
|
|
659
|
-
var StyledInputContainer =
|
|
616
|
+
var StyledInputContainer = styled7.div.withConfig({
|
|
660
617
|
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 &&
|
|
662
|
-
var PrefixContainer =
|
|
618
|
+
})(["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 && css3(["box-shadow:0 0 0 4px rgba(255,43,0,0.32);"]));
|
|
619
|
+
var PrefixContainer = styled7.div.withConfig({
|
|
663
620
|
componentId: "ccl__sc-3dd0tt-3"
|
|
664
621
|
})(["display:flex;align-items:center;"]);
|
|
665
|
-
var SuffixContainer =
|
|
622
|
+
var SuffixContainer = styled7.span.withConfig({
|
|
666
623
|
componentId: "ccl__sc-3dd0tt-4"
|
|
667
624
|
})(["display:flex;align-items:center;gap:8px;"]);
|
|
668
|
-
var StyledInput =
|
|
625
|
+
var StyledInput = styled7.input.withConfig({
|
|
669
626
|
componentId: "ccl__sc-3dd0tt-5"
|
|
670
627
|
})(["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 =
|
|
628
|
+
var SingleLineCounter = styled7.span.withConfig({
|
|
672
629
|
componentId: "ccl__sc-3dd0tt-6"
|
|
673
630
|
})(["line-height:22px;font-size:14px;color:var(--charcoal-text3);"]);
|
|
674
|
-
var AssistiveText =
|
|
631
|
+
var AssistiveText = styled7.p.withConfig({
|
|
675
632
|
componentId: "ccl__sc-3dd0tt-7"
|
|
676
633
|
})(["font-size:14px;line-height:22px;margin-top:4px;margin-bottom:-4px;color:", ";"], (p) => `var(--charcoal-${p.invalid ? `assertive` : `text2`})`);
|
|
677
634
|
|
|
@@ -679,7 +636,7 @@ var AssistiveText = styled8.p.withConfig({
|
|
|
679
636
|
import { useTextField as useTextField2 } from "@react-aria/textfield";
|
|
680
637
|
import { useVisuallyHidden as useVisuallyHidden2 } from "@react-aria/visually-hidden";
|
|
681
638
|
import { forwardRef as forwardRef10, useCallback as useCallback4, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
|
|
682
|
-
import
|
|
639
|
+
import styled8, { css as css4 } from "styled-components";
|
|
683
640
|
import { mergeProps as mergeProps2 } from "@react-aria/utils";
|
|
684
641
|
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
685
642
|
var TextArea = forwardRef10(function TextAreaInner({
|
|
@@ -764,31 +721,31 @@ var TextArea = forwardRef10(function TextAreaInner({
|
|
|
764
721
|
] });
|
|
765
722
|
});
|
|
766
723
|
var TextArea_default = TextArea;
|
|
767
|
-
var TextFieldRoot2 =
|
|
724
|
+
var TextFieldRoot2 = styled8.div.withConfig({
|
|
768
725
|
componentId: "ccl__sc-58waht-0"
|
|
769
726
|
})(["display:flex;flex-direction:column;", ""], (p) => p.isDisabled && {
|
|
770
727
|
opacity: p.theme.elementEffect.disabled.opacity
|
|
771
728
|
});
|
|
772
|
-
var StyledTextareaContainer =
|
|
729
|
+
var StyledTextareaContainer = styled8.div.withConfig({
|
|
773
730
|
componentId: "ccl__sc-58waht-1"
|
|
774
731
|
})(["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
732
|
rows
|
|
776
|
-
}) =>
|
|
777
|
-
var StyledTextarea =
|
|
733
|
+
}) => css4(["height:calc(22px * ", " + 18px);"], rows), (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);"]));
|
|
734
|
+
var StyledTextarea = styled8.textarea.withConfig({
|
|
778
735
|
componentId: "ccl__sc-58waht-2"
|
|
779
736
|
})(["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
737
|
rows = 1,
|
|
781
738
|
noBottomPadding
|
|
782
|
-
}) =>
|
|
783
|
-
var MultiLineCounter =
|
|
739
|
+
}) => css4(["height:calc(22px / 0.875 * ", " + ", "px);"], rows, noBottomPadding ? 9 : 20));
|
|
740
|
+
var MultiLineCounter = styled8.span.withConfig({
|
|
784
741
|
componentId: "ccl__sc-58waht-3"
|
|
785
742
|
})(["position:absolute;bottom:9px;right:8px;line-height:22px;font-size:14px;color:var(--charcoal-text3);"]);
|
|
786
743
|
|
|
787
744
|
// src/components/Icon/index.tsx
|
|
788
|
-
import * as
|
|
745
|
+
import * as React7 from "react";
|
|
789
746
|
import "@charcoal-ui/icons";
|
|
790
747
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
791
|
-
var Icon =
|
|
748
|
+
var Icon = React7.forwardRef(function IconInner({
|
|
792
749
|
name,
|
|
793
750
|
scale,
|
|
794
751
|
unsafeNonGuidelineScale,
|
|
@@ -801,9 +758,9 @@ var Icon_default = Icon;
|
|
|
801
758
|
|
|
802
759
|
// src/components/Modal/index.tsx
|
|
803
760
|
import { useContext as useContext4, forwardRef as forwardRef13, memo as memo4 } from "react";
|
|
804
|
-
import * as
|
|
761
|
+
import * as React11 from "react";
|
|
805
762
|
import { Overlay } from "@react-aria/overlays";
|
|
806
|
-
import
|
|
763
|
+
import styled10, { css as css6, useTheme } from "styled-components";
|
|
807
764
|
import { maxWidth as maxWidth2 } from "@charcoal-ui/utils";
|
|
808
765
|
import { useMedia } from "@charcoal-ui/styled";
|
|
809
766
|
import { animated as animated2, useTransition, easings } from "react-spring";
|
|
@@ -811,7 +768,7 @@ import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
|
|
|
811
768
|
|
|
812
769
|
// src/components/Modal/Dialog/index.tsx
|
|
813
770
|
import { forwardRef as forwardRef12 } from "react";
|
|
814
|
-
import
|
|
771
|
+
import styled9, { css as css5 } from "styled-components";
|
|
815
772
|
import { useDialog } from "@react-aria/dialog";
|
|
816
773
|
|
|
817
774
|
// ../foundation/src/grid.ts
|
|
@@ -826,10 +783,10 @@ import { maxWidth } from "@charcoal-ui/utils";
|
|
|
826
783
|
import { animated } from "react-spring";
|
|
827
784
|
|
|
828
785
|
// src/_lib/useForwardedRef.tsx
|
|
829
|
-
import * as
|
|
786
|
+
import * as React8 from "react";
|
|
830
787
|
function useForwardedRef(ref) {
|
|
831
|
-
const innerRef =
|
|
832
|
-
|
|
788
|
+
const innerRef = React8.useRef(null);
|
|
789
|
+
React8.useEffect(() => {
|
|
833
790
|
if (!ref)
|
|
834
791
|
return;
|
|
835
792
|
if (typeof ref === "function") {
|
|
@@ -852,7 +809,7 @@ var Dialog = forwardRef12(function Dialog2(props, forwardRef18) {
|
|
|
852
809
|
}, ref);
|
|
853
810
|
return /* @__PURE__ */ jsx13(AnimatedStyledDialogDiv, { ...props, role: dialogProps.role, tabIndex: dialogProps.tabIndex, "aria-labelledby": dialogProps["aria-labelledby"], onBlur: dialogProps.onBlur, ref });
|
|
854
811
|
});
|
|
855
|
-
var AnimatedStyledDialogDiv = animated(
|
|
812
|
+
var AnimatedStyledDialogDiv = animated(styled9.div.withConfig({
|
|
856
813
|
componentId: "ccl__sc-1ep4f6v-0"
|
|
857
814
|
})(["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) => {
|
|
858
815
|
switch (p.size) {
|
|
@@ -871,14 +828,14 @@ var AnimatedStyledDialogDiv = animated(styled10.div.withConfig({
|
|
|
871
828
|
}
|
|
872
829
|
}, ({
|
|
873
830
|
theme
|
|
874
|
-
}) => maxWidth(theme.breakpoint.screen1), (p) => p.bottomSheet !== false &&
|
|
831
|
+
}) => maxWidth(theme.breakpoint.screen1), (p) => p.bottomSheet !== false && css5(["max-width:unset;width:100%;border-radius:0;margin:auto 0 0 0;", ""], p.bottomSheet === "full" && css5(["min-height:100%;"]))));
|
|
875
832
|
|
|
876
833
|
// src/components/Modal/ModalBackgroundContext.tsx
|
|
877
|
-
import * as
|
|
878
|
-
var ModalBackgroundContext =
|
|
834
|
+
import * as React9 from "react";
|
|
835
|
+
var ModalBackgroundContext = React9.createContext(null);
|
|
879
836
|
|
|
880
837
|
// src/components/Modal/useCustomModalOverlay.tsx
|
|
881
|
-
import * as
|
|
838
|
+
import * as React10 from "react";
|
|
882
839
|
import { ariaHideOutside, useOverlay, useOverlayFocusContain, usePreventScroll } from "@react-aria/overlays";
|
|
883
840
|
function useCharcoalModalOverlay(props, state, ref) {
|
|
884
841
|
const {
|
|
@@ -894,7 +851,7 @@ function useCharcoalModalOverlay(props, state, ref) {
|
|
|
894
851
|
isDisabled: !state.isOpen
|
|
895
852
|
});
|
|
896
853
|
useOverlayFocusContain();
|
|
897
|
-
|
|
854
|
+
React10.useEffect(() => {
|
|
898
855
|
if (state.isOpen && ref.current) {
|
|
899
856
|
return ariaHideOutside([ref.current]);
|
|
900
857
|
}
|
|
@@ -963,8 +920,8 @@ var Modal = forwardRef13(function ModalInner({
|
|
|
963
920
|
duration: 0
|
|
964
921
|
}
|
|
965
922
|
});
|
|
966
|
-
const bgRef =
|
|
967
|
-
const handleClick =
|
|
923
|
+
const bgRef = React11.useRef(null);
|
|
924
|
+
const handleClick = React11.useCallback((e) => {
|
|
968
925
|
if (e.currentTarget === e.target) {
|
|
969
926
|
onClose();
|
|
970
927
|
}
|
|
@@ -990,21 +947,21 @@ var Modal = forwardRef13(function ModalInner({
|
|
|
990
947
|
] }) }) }) }) }));
|
|
991
948
|
});
|
|
992
949
|
var Modal_default = memo4(Modal);
|
|
993
|
-
var ModalContext =
|
|
950
|
+
var ModalContext = React11.createContext({
|
|
994
951
|
titleProps: {},
|
|
995
952
|
title: "",
|
|
996
953
|
close: void 0,
|
|
997
954
|
showDismiss: true,
|
|
998
955
|
bottomSheet: false
|
|
999
956
|
});
|
|
1000
|
-
var ModalBackground = animated2(
|
|
957
|
+
var ModalBackground = animated2(styled10.div.withConfig({
|
|
1001
958
|
componentId: "ccl__sc-h2bc55-0"
|
|
1002
959
|
})(["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 ", "{", "}"], ({
|
|
1003
960
|
zIndex
|
|
1004
961
|
}) => zIndex, ({
|
|
1005
962
|
theme
|
|
1006
|
-
}) => maxWidth2(theme.breakpoint.screen1), (p) => p.$bottomSheet !== false &&
|
|
1007
|
-
var ModalCrossButton =
|
|
963
|
+
}) => maxWidth2(theme.breakpoint.screen1), (p) => p.$bottomSheet !== false && css6(["padding:0;"])));
|
|
964
|
+
var ModalCrossButton = styled10(IconButton_default).withConfig({
|
|
1008
965
|
componentId: "ccl__sc-h2bc55-1"
|
|
1009
966
|
})(["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);}}"]);
|
|
1010
967
|
function ModalTitle(props) {
|
|
@@ -1014,12 +971,12 @@ function ModalTitle(props) {
|
|
|
1014
971
|
} = useContext4(ModalContext);
|
|
1015
972
|
return /* @__PURE__ */ jsx14(ModalHeading, { ...titleProps, ...props, children: title });
|
|
1016
973
|
}
|
|
1017
|
-
var ModalHeading =
|
|
974
|
+
var ModalHeading = styled10.h3.withConfig({
|
|
1018
975
|
componentId: "ccl__sc-h2bc55-2"
|
|
1019
976
|
})(["margin:0;font-weight:inherit;font-size:inherit;"]);
|
|
1020
977
|
|
|
1021
978
|
// src/components/Modal/ModalPlumbing.tsx
|
|
1022
|
-
import
|
|
979
|
+
import styled11, { css as css7 } from "styled-components";
|
|
1023
980
|
import { useContext as useContext5 } from "react";
|
|
1024
981
|
import { maxWidth as maxWidth3 } from "@charcoal-ui/utils";
|
|
1025
982
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
@@ -1027,27 +984,27 @@ function ModalHeader() {
|
|
|
1027
984
|
const modalCtx = useContext5(ModalContext);
|
|
1028
985
|
return /* @__PURE__ */ jsx15(ModalHeaderRoot, { $bottomSheet: modalCtx.bottomSheet, children: /* @__PURE__ */ jsx15(StyledModalTitle, {}) });
|
|
1029
986
|
}
|
|
1030
|
-
var ModalHeaderRoot =
|
|
987
|
+
var ModalHeaderRoot = styled11.div.withConfig({
|
|
1031
988
|
componentId: "ccl__sc-1k33wze-0"
|
|
1032
989
|
})(["height:64px;display:grid;align-content:center;justify-content:center;@media ", "{", "}"], ({
|
|
1033
990
|
theme
|
|
1034
|
-
}) => maxWidth3(theme.breakpoint.screen1), (p) => p.$bottomSheet !== false &&
|
|
1035
|
-
var StyledModalTitle =
|
|
991
|
+
}) => maxWidth3(theme.breakpoint.screen1), (p) => p.$bottomSheet !== false && css7(["height:48px;"]));
|
|
992
|
+
var StyledModalTitle = styled11(ModalTitle).withConfig({
|
|
1036
993
|
componentId: "ccl__sc-1k33wze-1"
|
|
1037
994
|
})(["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;}"]);
|
|
1038
|
-
var ModalAlign =
|
|
995
|
+
var ModalAlign = styled11.div.withConfig({
|
|
1039
996
|
componentId: "ccl__sc-1k33wze-2"
|
|
1040
997
|
})(["padding-left:16px;padding-right:16px;"]);
|
|
1041
|
-
var ModalBody =
|
|
998
|
+
var ModalBody = styled11.div.withConfig({
|
|
1042
999
|
componentId: "ccl__sc-1k33wze-3"
|
|
1043
1000
|
})(["padding-bottom:40px;"]);
|
|
1044
|
-
var ModalButtons =
|
|
1001
|
+
var ModalButtons = styled11.div.withConfig({
|
|
1045
1002
|
componentId: "ccl__sc-1k33wze-4"
|
|
1046
1003
|
})(["display:grid;grid-auto-flow:row;grid-row-gap:8px;padding-top:16px;padding-left:16px;padding-right:16px;"]);
|
|
1047
1004
|
|
|
1048
1005
|
// src/components/LoadingSpinner/index.tsx
|
|
1049
1006
|
import { forwardRef as forwardRef14, useImperativeHandle, useRef as useRef5, memo as memo5 } from "react";
|
|
1050
|
-
import
|
|
1007
|
+
import styled12, { keyframes } from "styled-components";
|
|
1051
1008
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1052
1009
|
var LoadingSpinner = forwardRef14(function LoadingSpinnerInner({
|
|
1053
1010
|
size = 48,
|
|
@@ -1058,7 +1015,7 @@ var LoadingSpinner = forwardRef14(function LoadingSpinnerInner({
|
|
|
1058
1015
|
return /* @__PURE__ */ jsx16(LoadingSpinnerRoot, { size, padding, transparent, className, ref, children: /* @__PURE__ */ jsx16(LoadingSpinnerIcon, {}) });
|
|
1059
1016
|
});
|
|
1060
1017
|
var LoadingSpinner_default = memo5(LoadingSpinner);
|
|
1061
|
-
var LoadingSpinnerRoot =
|
|
1018
|
+
var LoadingSpinnerRoot = styled12.div.attrs({
|
|
1062
1019
|
role: "progressbar"
|
|
1063
1020
|
}).withConfig({
|
|
1064
1021
|
componentId: "ccl__sc-1id6yz4-0"
|
|
@@ -1066,7 +1023,7 @@ var LoadingSpinnerRoot = styled13.div.attrs({
|
|
|
1066
1023
|
transparent
|
|
1067
1024
|
}) => `var(--charcoal-${transparent ? "transparent" : "background1"})`);
|
|
1068
1025
|
var scaleOut = keyframes(["from{transform:scale(0);opacity:1;}to{transform:scale(1);opacity:0;}"]);
|
|
1069
|
-
var Icon2 =
|
|
1026
|
+
var Icon2 = styled12.div.attrs({
|
|
1070
1027
|
role: "presentation"
|
|
1071
1028
|
}).withConfig({
|
|
1072
1029
|
componentId: "ccl__sc-1id6yz4-1"
|
|
@@ -1089,8 +1046,8 @@ var LoadingSpinnerIcon = forwardRef14(function LoadingSpinnerIcon2({
|
|
|
1089
1046
|
});
|
|
1090
1047
|
|
|
1091
1048
|
// src/components/DropdownSelector/index.tsx
|
|
1092
|
-
import { useState as useState3, useRef as useRef9, useMemo as
|
|
1093
|
-
import
|
|
1049
|
+
import { useState as useState3, useRef as useRef9, useMemo as useMemo5 } from "react";
|
|
1050
|
+
import styled15, { css as css8 } from "styled-components";
|
|
1094
1051
|
import { disabledSelector as disabledSelector2 } from "@charcoal-ui/utils";
|
|
1095
1052
|
|
|
1096
1053
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
@@ -1099,7 +1056,7 @@ import { useEffect as useEffect7, useRef as useRef7 } from "react";
|
|
|
1099
1056
|
// src/components/DropdownSelector/Popover/index.tsx
|
|
1100
1057
|
import { useContext as useContext6, useRef as useRef6 } from "react";
|
|
1101
1058
|
import { DismissButton, Overlay as Overlay2, usePopover } from "@react-aria/overlays";
|
|
1102
|
-
import
|
|
1059
|
+
import styled13 from "styled-components";
|
|
1103
1060
|
|
|
1104
1061
|
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
1105
1062
|
import { useEffect as useEffect6 } from "react";
|
|
@@ -1155,7 +1112,7 @@ function Popover(props) {
|
|
|
1155
1112
|
] })
|
|
1156
1113
|
] });
|
|
1157
1114
|
}
|
|
1158
|
-
var DropdownPopoverDiv =
|
|
1115
|
+
var DropdownPopoverDiv = styled13.div.withConfig({
|
|
1159
1116
|
componentId: "ccl__sc-jwnoy6-0"
|
|
1160
1117
|
})(["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;"]);
|
|
1161
1118
|
|
|
@@ -1184,12 +1141,12 @@ function DropdownPopover({
|
|
|
1184
1141
|
}
|
|
1185
1142
|
|
|
1186
1143
|
// src/components/DropdownSelector/utils/findPreviewRecursive.tsx
|
|
1187
|
-
import * as
|
|
1144
|
+
import * as React12 from "react";
|
|
1188
1145
|
function findPreviewRecursive(children, value) {
|
|
1189
|
-
const childArray =
|
|
1146
|
+
const childArray = React12.Children.toArray(children);
|
|
1190
1147
|
for (let i = 0; i < childArray.length; i++) {
|
|
1191
1148
|
const child = childArray[i];
|
|
1192
|
-
if (
|
|
1149
|
+
if (React12.isValidElement(child)) {
|
|
1193
1150
|
if ("value" in child.props) {
|
|
1194
1151
|
const childValue = child.props.value;
|
|
1195
1152
|
if (childValue === value && "children" in child.props) {
|
|
@@ -1208,8 +1165,8 @@ function findPreviewRecursive(children, value) {
|
|
|
1208
1165
|
}
|
|
1209
1166
|
|
|
1210
1167
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
1211
|
-
import { useMemo as
|
|
1212
|
-
import
|
|
1168
|
+
import { useMemo as useMemo4, useRef as useRef8 } from "react";
|
|
1169
|
+
import styled14 from "styled-components";
|
|
1213
1170
|
|
|
1214
1171
|
// src/components/DropdownSelector/MenuList/MenuListContext.ts
|
|
1215
1172
|
import { createContext as createContext6 } from "react";
|
|
@@ -1222,13 +1179,13 @@ var MenuListContext = createContext6({
|
|
|
1222
1179
|
});
|
|
1223
1180
|
|
|
1224
1181
|
// src/components/DropdownSelector/MenuList/internals/getValuesRecursive.tsx
|
|
1225
|
-
import * as
|
|
1182
|
+
import * as React13 from "react";
|
|
1226
1183
|
function getValuesRecursive(children) {
|
|
1227
|
-
const childArray =
|
|
1184
|
+
const childArray = React13.Children.toArray(children);
|
|
1228
1185
|
const propsArray = [];
|
|
1229
1186
|
for (let i = 0; i < childArray.length; i++) {
|
|
1230
1187
|
const child = childArray[i];
|
|
1231
|
-
if (
|
|
1188
|
+
if (React13.isValidElement(child)) {
|
|
1232
1189
|
const props = child.props;
|
|
1233
1190
|
if ("value" in props && typeof props.value === "string") {
|
|
1234
1191
|
propsArray.push({
|
|
@@ -1248,7 +1205,7 @@ function getValuesRecursive(children) {
|
|
|
1248
1205
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1249
1206
|
function MenuList(props) {
|
|
1250
1207
|
const root = useRef8(null);
|
|
1251
|
-
const propsArray =
|
|
1208
|
+
const propsArray = useMemo4(() => getValuesRecursive(props.children), [props.children]);
|
|
1252
1209
|
return /* @__PURE__ */ jsx19(StyledUl, { ref: root, children: /* @__PURE__ */ jsx19(MenuListContext.Provider, { value: {
|
|
1253
1210
|
value: props.value ?? "",
|
|
1254
1211
|
root,
|
|
@@ -1258,12 +1215,12 @@ function MenuList(props) {
|
|
|
1258
1215
|
}
|
|
1259
1216
|
}, children: props.children }) });
|
|
1260
1217
|
}
|
|
1261
|
-
var StyledUl =
|
|
1218
|
+
var StyledUl = styled14.ul.withConfig({
|
|
1262
1219
|
componentId: "ccl__sc-1y72v02-0"
|
|
1263
1220
|
})(["padding:0;margin:0;"]);
|
|
1264
1221
|
|
|
1265
1222
|
// src/components/DropdownSelector/index.tsx
|
|
1266
|
-
import { focusVisibleFocusRingCss as
|
|
1223
|
+
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss5 } from "@charcoal-ui/styled";
|
|
1267
1224
|
import { useVisuallyHidden as useVisuallyHidden3 } from "@react-aria/visually-hidden";
|
|
1268
1225
|
import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1269
1226
|
var defaultRequiredText = "*\u5FC5\u9808";
|
|
@@ -1271,7 +1228,7 @@ function DropdownSelector(props) {
|
|
|
1271
1228
|
const triggerRef = useRef9(null);
|
|
1272
1229
|
const [isOpen, setIsOpen] = useState3(false);
|
|
1273
1230
|
const preview = findPreviewRecursive(props.children, props.value);
|
|
1274
|
-
const isPlaceholder =
|
|
1231
|
+
const isPlaceholder = useMemo5(() => props.placeholder !== void 0 && preview === void 0, [preview, props.placeholder]);
|
|
1275
1232
|
const propsArray = getValuesRecursive(props.children);
|
|
1276
1233
|
const {
|
|
1277
1234
|
visuallyHiddenProps
|
|
@@ -1296,36 +1253,36 @@ function DropdownSelector(props) {
|
|
|
1296
1253
|
props.assistiveText !== void 0 && /* @__PURE__ */ jsx20(AssertiveText, { invalid: props.invalid, children: props.assistiveText })
|
|
1297
1254
|
] });
|
|
1298
1255
|
}
|
|
1299
|
-
var DropdownSelectorRoot =
|
|
1256
|
+
var DropdownSelectorRoot = styled15.div.withConfig({
|
|
1300
1257
|
componentId: "ccl__sc-1vnxmc8-0"
|
|
1301
1258
|
})(["display:inline-block;width:100%;", "{cursor:default;opacity:0.32;}"], disabledSelector2);
|
|
1302
|
-
var DropdownFieldLabel =
|
|
1259
|
+
var DropdownFieldLabel = styled15(FieldLabel_default).withConfig({
|
|
1303
1260
|
componentId: "ccl__sc-1vnxmc8-1"
|
|
1304
1261
|
})(["width:100%;margin-bottom:8px;"]);
|
|
1305
|
-
var DropdownButton =
|
|
1262
|
+
var DropdownButton = styled15.button.withConfig({
|
|
1306
1263
|
componentId: "ccl__sc-1vnxmc8-2"
|
|
1307
|
-
})(["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,
|
|
1264
|
+
})(["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, focusVisibleFocusRingCss5, ({
|
|
1308
1265
|
$active
|
|
1309
|
-
}) => $active === true ?
|
|
1266
|
+
}) => $active === true ? css8(["background-color:var(--charcoal-surface3-press);"]) : css8(["&:hover{background-color:var(--charcoal-surface3-hover);}&:active{background-color:var(--charcoal-surface3-press);}"]), ({
|
|
1310
1267
|
invalid
|
|
1311
|
-
}) => invalid === true &&
|
|
1312
|
-
var DropdownButtonText =
|
|
1268
|
+
}) => invalid === true && css8(["&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}"]));
|
|
1269
|
+
var DropdownButtonText = styled15.span.withConfig({
|
|
1313
1270
|
componentId: "ccl__sc-1vnxmc8-3"
|
|
1314
1271
|
})(["text-align:left;font-size:14px;line-height:22px;display:flow-root;color:var(--charcoal-", ");overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"], (p) => p.$isText3 ? "text3" : "text2");
|
|
1315
|
-
var DropdownButtonIcon =
|
|
1272
|
+
var DropdownButtonIcon = styled15(Icon_default).withConfig({
|
|
1316
1273
|
componentId: "ccl__sc-1vnxmc8-4"
|
|
1317
1274
|
})(["color:var(--charcoal-text2);"]);
|
|
1318
|
-
var AssertiveText =
|
|
1275
|
+
var AssertiveText = styled15.div.withConfig({
|
|
1319
1276
|
componentId: "ccl__sc-1vnxmc8-5"
|
|
1320
1277
|
})(["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;}", ""], ({
|
|
1321
1278
|
invalid
|
|
1322
|
-
}) => invalid === true &&
|
|
1279
|
+
}) => invalid === true && css8(["color:var(--charcoal-assertive);"]));
|
|
1323
1280
|
|
|
1324
1281
|
// src/components/DropdownSelector/DropdownMenuItem.tsx
|
|
1325
|
-
import
|
|
1282
|
+
import styled17 from "styled-components";
|
|
1326
1283
|
|
|
1327
1284
|
// src/components/DropdownSelector/ListItem/index.tsx
|
|
1328
|
-
import
|
|
1285
|
+
import styled16 from "styled-components";
|
|
1329
1286
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1330
1287
|
function ListItem(props) {
|
|
1331
1288
|
const {
|
|
@@ -1334,10 +1291,10 @@ function ListItem(props) {
|
|
|
1334
1291
|
} = props;
|
|
1335
1292
|
return /* @__PURE__ */ jsx21(StyledLi, { role: "option", children: /* @__PURE__ */ jsx21(ItemDiv, { ...rest, children: props.children }) });
|
|
1336
1293
|
}
|
|
1337
|
-
var StyledLi =
|
|
1294
|
+
var StyledLi = styled16.li.withConfig({
|
|
1338
1295
|
componentId: "ccl__sc-p1vs75-0"
|
|
1339
1296
|
})(["list-style:none;"]);
|
|
1340
|
-
var ItemDiv =
|
|
1297
|
+
var ItemDiv = styled16.div.withConfig({
|
|
1341
1298
|
componentId: "ccl__sc-p1vs75-1"
|
|
1342
1299
|
})(["display:flex;align-items:center;min-height:40px;cursor:pointer;outline:none;padding-right:16px;padding-left:16px;transition:background-color 0.2s;&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}:hover,:focus,:focus-within{&:not(disabled):not([aria-disabled='true']){background-color:var(--charcoal-surface3);}}"]);
|
|
1343
1300
|
|
|
@@ -1447,17 +1404,17 @@ function DropdownMenuItem(props) {
|
|
|
1447
1404
|
/* @__PURE__ */ jsx23(StyledSpan, { isSelected, children: props.children })
|
|
1448
1405
|
] });
|
|
1449
1406
|
}
|
|
1450
|
-
var StyledSpan =
|
|
1407
|
+
var StyledSpan = styled17.span.withConfig({
|
|
1451
1408
|
componentId: "ccl__sc-108wg2j-0"
|
|
1452
1409
|
})(["font-size:14px;line-height:22px;color:var(--charcoal-text2);padding:9px 0;display:flex;align-items:center;width:100%;margin-left:", "px;"], ({
|
|
1453
1410
|
isSelected
|
|
1454
1411
|
}) => isSelected === true ? 0 : 20);
|
|
1455
|
-
var Text2ColorIcon =
|
|
1412
|
+
var Text2ColorIcon = styled17(Icon_default).withConfig({
|
|
1456
1413
|
componentId: "ccl__sc-108wg2j-1"
|
|
1457
1414
|
})(["color:var(--charcoal-text2);padding-right:4px;"]);
|
|
1458
1415
|
|
|
1459
1416
|
// src/components/DropdownSelector/MenuItemGroup/index.tsx
|
|
1460
|
-
import
|
|
1417
|
+
import styled18 from "styled-components";
|
|
1461
1418
|
import { jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1462
1419
|
function MenuItemGroup(props) {
|
|
1463
1420
|
return /* @__PURE__ */ jsxs12(StyledLi2, { role: "presentation", children: [
|
|
@@ -1465,18 +1422,18 @@ function MenuItemGroup(props) {
|
|
|
1465
1422
|
/* @__PURE__ */ jsx24(StyledUl2, { role: "group", children: props.children })
|
|
1466
1423
|
] });
|
|
1467
1424
|
}
|
|
1468
|
-
var TextSpan =
|
|
1425
|
+
var TextSpan = styled18.span.withConfig({
|
|
1469
1426
|
componentId: "ccl__sc-1ubjfz7-0"
|
|
1470
1427
|
})(["display:block;color:var(--charcoal-text3);font-size:12px;font-weight:bold;padding:12px 0 8px 16px;"]);
|
|
1471
|
-
var StyledUl2 =
|
|
1428
|
+
var StyledUl2 = styled18.ul.withConfig({
|
|
1472
1429
|
componentId: "ccl__sc-1ubjfz7-1"
|
|
1473
1430
|
})(["padding-left:0;margin:0;box-sizing:border-box;list-style:none;overflow:hidden;"]);
|
|
1474
|
-
var StyledLi2 =
|
|
1431
|
+
var StyledLi2 = styled18.li.withConfig({
|
|
1475
1432
|
componentId: "ccl__sc-1ubjfz7-2"
|
|
1476
1433
|
})(["display:block;"]);
|
|
1477
1434
|
|
|
1478
1435
|
// src/components/SegmentedControl/index.tsx
|
|
1479
|
-
import { forwardRef as forwardRef15, memo as memo6, useMemo as
|
|
1436
|
+
import { forwardRef as forwardRef15, memo as memo6, useMemo as useMemo6, useRef as useRef10 } from "react";
|
|
1480
1437
|
|
|
1481
1438
|
// ../../node_modules/@react-stately/form/dist/import.mjs
|
|
1482
1439
|
import { createContext as $jcIOw$createContext, useMemo as $jcIOw$useMemo, useContext as $jcIOw$useContext, useState as $jcIOw$useState, useRef as $jcIOw$useRef, useEffect as $jcIOw$useEffect } from "react";
|
|
@@ -1704,7 +1661,7 @@ function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
|
|
|
1704
1661
|
|
|
1705
1662
|
// src/components/SegmentedControl/index.tsx
|
|
1706
1663
|
import { useRadio, useRadioGroup } from "@react-aria/radio";
|
|
1707
|
-
import
|
|
1664
|
+
import styled19, { css as css9 } from "styled-components";
|
|
1708
1665
|
|
|
1709
1666
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
1710
1667
|
import { createContext as createContext7, useContext as useContext9 } from "react";
|
|
@@ -1726,7 +1683,7 @@ var useRadioContext = () => {
|
|
|
1726
1683
|
// src/components/SegmentedControl/index.tsx
|
|
1727
1684
|
import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1728
1685
|
var SegmentedControl = forwardRef15(function SegmentedControlInner(props, ref) {
|
|
1729
|
-
const ariaRadioGroupProps =
|
|
1686
|
+
const ariaRadioGroupProps = useMemo6(() => ({
|
|
1730
1687
|
...props,
|
|
1731
1688
|
isDisabled: props.disabled,
|
|
1732
1689
|
isReadOnly: props.readonly,
|
|
@@ -1737,7 +1694,7 @@ var SegmentedControl = forwardRef15(function SegmentedControlInner(props, ref) {
|
|
|
1737
1694
|
const {
|
|
1738
1695
|
radioGroupProps
|
|
1739
1696
|
} = useRadioGroup(ariaRadioGroupProps, state);
|
|
1740
|
-
const segmentedControlItems =
|
|
1697
|
+
const segmentedControlItems = useMemo6(() => {
|
|
1741
1698
|
return props.data.map((d) => typeof d === "string" ? {
|
|
1742
1699
|
value: d,
|
|
1743
1700
|
label: d
|
|
@@ -1749,7 +1706,7 @@ var SegmentedControl_default = memo6(SegmentedControl);
|
|
|
1749
1706
|
var Segmented = (props) => {
|
|
1750
1707
|
const state = useRadioContext();
|
|
1751
1708
|
const ref = useRef10(null);
|
|
1752
|
-
const ariaRadioProps =
|
|
1709
|
+
const ariaRadioProps = useMemo6(() => ({
|
|
1753
1710
|
value: props.value,
|
|
1754
1711
|
isDisabled: props.disabled,
|
|
1755
1712
|
children: props.children
|
|
@@ -1764,37 +1721,37 @@ var Segmented = (props) => {
|
|
|
1764
1721
|
/* @__PURE__ */ jsx26(RadioLabel2, { children: /* @__PURE__ */ jsx26(SegmentedLabelInner, { children: props.children }) })
|
|
1765
1722
|
] });
|
|
1766
1723
|
};
|
|
1767
|
-
var SegmentedControlRoot =
|
|
1724
|
+
var SegmentedControlRoot = styled19.div.withConfig({
|
|
1768
1725
|
componentId: "ccl__sc-1xmkkqt-0"
|
|
1769
1726
|
})(["display:inline-flex;align-items:center;background-color:var(--charcoal-surface3);border-radius:16px;"]);
|
|
1770
|
-
var SegmentedRoot =
|
|
1727
|
+
var SegmentedRoot = styled19.label.withConfig({
|
|
1771
1728
|
componentId: "ccl__sc-1xmkkqt-1"
|
|
1772
1729
|
})(["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);", ""], ({
|
|
1773
1730
|
checked = false
|
|
1774
|
-
}) => checked &&
|
|
1775
|
-
var SegmentedInput =
|
|
1731
|
+
}) => checked && css9(["background-color:var(--charcoal-brand);color:var(--charcoal-text5);"]));
|
|
1732
|
+
var SegmentedInput = styled19.input.withConfig({
|
|
1776
1733
|
componentId: "ccl__sc-1xmkkqt-2"
|
|
1777
1734
|
})(["position:absolute;height:0px;width:0px;padding:0;margin:0;appearance:none;box-sizing:border-box;overflow:hidden;white-space:nowrap;opacity:0;"]);
|
|
1778
|
-
var RadioLabel2 =
|
|
1735
|
+
var RadioLabel2 = styled19.div.withConfig({
|
|
1779
1736
|
componentId: "ccl__sc-1xmkkqt-3"
|
|
1780
1737
|
})(["background:transparent;display:flex;align-items:center;height:22px;"]);
|
|
1781
|
-
var SegmentedLabelInner =
|
|
1738
|
+
var SegmentedLabelInner = styled19.div.withConfig({
|
|
1782
1739
|
componentId: "ccl__sc-1xmkkqt-4"
|
|
1783
1740
|
})(["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;}"]);
|
|
1784
1741
|
|
|
1785
1742
|
// src/components/Checkbox/index.tsx
|
|
1786
|
-
import { forwardRef as forwardRef16, memo as memo7, useMemo as
|
|
1787
|
-
import
|
|
1743
|
+
import { forwardRef as forwardRef16, memo as memo7, useMemo as useMemo7 } from "react";
|
|
1744
|
+
import styled20, { css as css10 } from "styled-components";
|
|
1788
1745
|
import { useCheckbox } from "@react-aria/checkbox";
|
|
1789
1746
|
import { useObjectRef as useObjectRef3 } from "@react-aria/utils";
|
|
1790
1747
|
import { useToggleState as useToggleState2 } from "react-stately";
|
|
1791
|
-
import { focusVisibleFocusRingCss as
|
|
1748
|
+
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss6 } from "@charcoal-ui/styled";
|
|
1792
1749
|
import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1793
1750
|
var Checkbox = forwardRef16(function CheckboxInner({
|
|
1794
1751
|
invalid = false,
|
|
1795
1752
|
...props
|
|
1796
1753
|
}, ref) {
|
|
1797
|
-
const ariaCheckboxProps =
|
|
1754
|
+
const ariaCheckboxProps = useMemo7(() => ({
|
|
1798
1755
|
...props,
|
|
1799
1756
|
isInValid: invalid,
|
|
1800
1757
|
isSelected: props.checked,
|
|
@@ -1818,32 +1775,32 @@ var Checkbox = forwardRef16(function CheckboxInner({
|
|
|
1818
1775
|
] });
|
|
1819
1776
|
});
|
|
1820
1777
|
var Checkbox_default = memo7(Checkbox);
|
|
1821
|
-
var hiddenCss =
|
|
1822
|
-
var InputRoot =
|
|
1778
|
+
var hiddenCss = css10(["visibility:hidden;"]);
|
|
1779
|
+
var InputRoot = styled20.label.withConfig({
|
|
1823
1780
|
componentId: "ccl__sc-wrdmwj-0"
|
|
1824
1781
|
})(["position:relative;display:flex;cursor:pointer;gap:4px;&:disabled,&[aria-disabled]:not([aria-disabled='false']){cursor:default;opacity:0.32;}"]);
|
|
1825
|
-
var CheckboxRoot =
|
|
1782
|
+
var CheckboxRoot = styled20.div.withConfig({
|
|
1826
1783
|
componentId: "ccl__sc-wrdmwj-1"
|
|
1827
1784
|
})(["position:relative;"]);
|
|
1828
|
-
var CheckboxInput =
|
|
1785
|
+
var CheckboxInput = styled20.input.withConfig({
|
|
1829
1786
|
componentId: "ccl__sc-wrdmwj-2"
|
|
1830
|
-
})(["&[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);}}"],
|
|
1831
|
-
var CheckboxInputOverlay =
|
|
1787
|
+
})(["&[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);}}"], focusVisibleFocusRingCss6);
|
|
1788
|
+
var CheckboxInputOverlay = styled20.div.withConfig({
|
|
1832
1789
|
componentId: "ccl__sc-wrdmwj-3"
|
|
1833
1790
|
})(["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);", ";"], ({
|
|
1834
1791
|
checked
|
|
1835
1792
|
}) => checked !== true && hiddenCss);
|
|
1836
|
-
var InputLabel =
|
|
1793
|
+
var InputLabel = styled20.div.withConfig({
|
|
1837
1794
|
componentId: "ccl__sc-wrdmwj-4"
|
|
1838
1795
|
})(["color:var(--charcoal-text2);font-size:14px;line-height:20px;"]);
|
|
1839
1796
|
|
|
1840
1797
|
// src/components/TagItem/index.tsx
|
|
1841
|
-
import { forwardRef as forwardRef17, memo as memo8, useMemo as
|
|
1798
|
+
import { forwardRef as forwardRef17, memo as memo8, useMemo as useMemo8 } from "react";
|
|
1842
1799
|
import { useObjectRef as useObjectRef4 } from "@react-aria/utils";
|
|
1843
|
-
import
|
|
1800
|
+
import styled21, { css as css11 } from "styled-components";
|
|
1844
1801
|
import { px as px2 } from "@charcoal-ui/utils";
|
|
1845
1802
|
import { useButton } from "@react-aria/button";
|
|
1846
|
-
import { focusVisibleFocusRingCss as
|
|
1803
|
+
import { focusVisibleFocusRingCss as focusVisibleFocusRingCss7 } from "@charcoal-ui/styled";
|
|
1847
1804
|
import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1848
1805
|
var sizeMap = {
|
|
1849
1806
|
S: 32,
|
|
@@ -1861,7 +1818,7 @@ var TagItem = forwardRef17(function TagItemInner({
|
|
|
1861
1818
|
...props
|
|
1862
1819
|
}, _ref) {
|
|
1863
1820
|
const ref = useObjectRef4(_ref);
|
|
1864
|
-
const ariaButtonProps =
|
|
1821
|
+
const ariaButtonProps = useMemo8(() => ({
|
|
1865
1822
|
elementType: "a",
|
|
1866
1823
|
isDisabled: disabled,
|
|
1867
1824
|
...props
|
|
@@ -1885,7 +1842,7 @@ var TagItem_default = memo8(TagItem);
|
|
|
1885
1842
|
var horizontalPadding = ({
|
|
1886
1843
|
left,
|
|
1887
1844
|
right
|
|
1888
|
-
}) =>
|
|
1845
|
+
}) => css11(["padding-right:", ";padding-left:", ";"], px2(right), px2(left));
|
|
1889
1846
|
var tagItemRootSize = (size) => {
|
|
1890
1847
|
switch (size) {
|
|
1891
1848
|
case "M":
|
|
@@ -1904,7 +1861,7 @@ var activeTagItemRoot = horizontalPadding({
|
|
|
1904
1861
|
left: 16,
|
|
1905
1862
|
right: 8
|
|
1906
1863
|
});
|
|
1907
|
-
var TagItemRoot =
|
|
1864
|
+
var TagItemRoot = styled21.a.withConfig({
|
|
1908
1865
|
componentId: "ccl__sc-11j9pu2-0"
|
|
1909
1866
|
})(["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;}"], ({
|
|
1910
1867
|
size
|
|
@@ -1915,30 +1872,30 @@ var TagItemRoot = styled22.a.withConfig({
|
|
|
1915
1872
|
status
|
|
1916
1873
|
}) => status === "active" && activeTagItemRoot, ({
|
|
1917
1874
|
status
|
|
1918
|
-
}) => status === "inactive" ? "var(--charcoal-text2)" : "var(--charcoal-text5)",
|
|
1919
|
-
var Background =
|
|
1875
|
+
}) => status === "inactive" ? "var(--charcoal-text2)" : "var(--charcoal-text5)", focusVisibleFocusRingCss7);
|
|
1876
|
+
var Background = styled21.div.withConfig({
|
|
1920
1877
|
componentId: "ccl__sc-11j9pu2-1"
|
|
1921
1878
|
})(["position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;background-color:", ";", " ", ""], ({
|
|
1922
1879
|
bgColor
|
|
1923
1880
|
}) => bgColor, ({
|
|
1924
1881
|
status
|
|
1925
|
-
}) => status === "inactive" &&
|
|
1882
|
+
}) => status === "inactive" && css11(["background-color:var(--charcoal-surface3);"]), ({
|
|
1926
1883
|
bgImage
|
|
1927
|
-
}) => bgImage !== void 0 &&
|
|
1928
|
-
var Inner =
|
|
1884
|
+
}) => bgImage !== void 0 && css11(["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));
|
|
1885
|
+
var Inner = styled21.div.withConfig({
|
|
1929
1886
|
componentId: "ccl__sc-11j9pu2-2"
|
|
1930
1887
|
})(["display:inline-flex;gap:8px;align-items:center;z-index:2;"]);
|
|
1931
|
-
var labelCSS =
|
|
1932
|
-
var translateLabelCSS =
|
|
1933
|
-
var LabelWrapper =
|
|
1888
|
+
var labelCSS = css11(["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;}"]);
|
|
1889
|
+
var translateLabelCSS = css11(["display:flex;align-items:center;flex-direction:column;font-size:10px;"]);
|
|
1890
|
+
var LabelWrapper = styled21.div.withConfig({
|
|
1934
1891
|
componentId: "ccl__sc-11j9pu2-3"
|
|
1935
1892
|
})(["", ""], ({
|
|
1936
1893
|
isTranslate
|
|
1937
1894
|
}) => isTranslate ?? false ? translateLabelCSS : labelCSS);
|
|
1938
|
-
var Label3 =
|
|
1895
|
+
var Label3 = styled21.span.withConfig({
|
|
1939
1896
|
componentId: "ccl__sc-11j9pu2-4"
|
|
1940
1897
|
})(["max-width:152px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:inherit;color:inherit;line-height:inherit;"]);
|
|
1941
|
-
var TranslatedLabel =
|
|
1898
|
+
var TranslatedLabel = styled21.div.withConfig({
|
|
1942
1899
|
componentId: "ccl__sc-11j9pu2-5"
|
|
1943
1900
|
})(["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;}"]);
|
|
1944
1901
|
export {
|