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