@charcoal-ui/react 4.0.0-beta.4 → 4.0.0-beta.6
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/README.md +1 -1
- package/dist/_lib/useClassNames.d.ts +2 -2
- package/dist/_lib/useClassNames.d.ts.map +1 -1
- package/dist/components/Checkbox/CheckboxInput/index.d.ts +11 -0
- package/dist/components/Checkbox/CheckboxInput/index.d.ts.map +1 -0
- package/dist/components/Checkbox/CheckboxWithLabel.d.ts +9 -0
- package/dist/components/Checkbox/CheckboxWithLabel.d.ts.map +1 -0
- package/dist/components/Checkbox/index.d.ts +9 -7
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Clickable/index.d.ts +10 -13
- package/dist/components/Clickable/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/index.d.ts.map +1 -1
- package/dist/components/FieldLabel/index.d.ts +1 -0
- package/dist/components/FieldLabel/index.d.ts.map +1 -1
- package/dist/components/IconButton/index.d.ts +7 -5
- package/dist/components/IconButton/index.d.ts.map +1 -1
- package/dist/components/LoadingSpinner/index.d.ts +1 -0
- package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
- package/dist/components/Modal/Dialog/index.d.ts +6 -24
- package/dist/components/Modal/Dialog/index.d.ts.map +1 -1
- package/dist/components/Modal/ModalPlumbing.d.ts +10 -3
- package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts +5 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Radio/index.d.ts +3 -5
- package/dist/components/Radio/index.d.ts.map +1 -1
- package/dist/components/SegmentedControl/index.d.ts +1 -0
- package/dist/components/SegmentedControl/index.d.ts.map +1 -1
- package/dist/components/Switch/SwitchInput/index.d.ts +9 -0
- package/dist/components/Switch/SwitchInput/index.d.ts.map +1 -0
- package/dist/components/Switch/SwitchWithLabel.d.ts +9 -0
- package/dist/components/Switch/SwitchWithLabel.d.ts.map +1 -0
- package/dist/components/Switch/index.d.ts +4 -15
- package/dist/components/Switch/index.d.ts.map +1 -1
- package/dist/components/TagItem/index.d.ts +14 -15
- package/dist/components/TagItem/index.d.ts.map +1 -1
- package/dist/components/TextArea/index.d.ts +28 -18
- package/dist/components/TextArea/index.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts +32 -19
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/core/SSRProvider.d.ts +3 -1
- package/dist/core/SSRProvider.d.ts.map +1 -1
- package/dist/index.cjs.js +471 -845
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +732 -28
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +427 -800
- package/dist/index.esm.js.map +1 -1
- package/dist/styled.d.ts +4 -4
- package/package.json +11 -10
- package/src/_lib/useClassNames.ts +3 -9
- package/src/components/Button/__snapshots__/index.story.storyshot +9 -9
- package/src/components/Button/index.story.tsx +1 -1
- package/src/components/Checkbox/CheckboxInput/__snapshots__/index.story.storyshot +77 -0
- package/src/components/Checkbox/CheckboxInput/index.css +111 -0
- package/src/components/{CheckboxInput → Checkbox/CheckboxInput}/index.story.tsx +17 -1
- package/src/components/Checkbox/CheckboxInput/index.tsx +47 -0
- package/src/components/Checkbox/CheckboxWithLabel.tsx +24 -0
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +59 -140
- package/src/components/Checkbox/index.css +2 -2
- package/src/components/Checkbox/index.story.tsx +18 -13
- package/src/components/Checkbox/index.tsx +23 -15
- package/src/components/Clickable/__snapshots__/index.story.storyshot +4 -80
- package/src/components/Clickable/index.css +41 -0
- package/src/components/Clickable/index.story.tsx +2 -2
- package/src/components/Clickable/index.tsx +25 -85
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +11 -136
- package/src/components/DropdownSelector/ListItem/index.story.tsx +1 -1
- package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +3 -3
- package/src/components/DropdownSelector/MenuList/index.story.tsx +1 -1
- package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +1 -1
- package/src/components/DropdownSelector/Popover/index.story.tsx +1 -1
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +184 -1435
- package/src/components/DropdownSelector/index.story.tsx +2 -2
- package/src/components/DropdownSelector/index.tsx +9 -38
- package/src/components/FieldLabel/index.css +35 -0
- package/src/components/FieldLabel/index.tsx +15 -105
- package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
- package/src/components/Icon/index.story.tsx +1 -1
- package/src/components/IconButton/__snapshots__/index.story.storyshot +15 -291
- package/src/components/IconButton/index.css +118 -0
- package/src/components/IconButton/index.story.tsx +3 -3
- package/src/components/IconButton/index.tsx +41 -118
- package/src/components/LoadingSpinner/__snapshots__/LoadingSpinnerIcon.story.storyshot +2 -17
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +44 -132
- package/src/components/LoadingSpinner/index.css +42 -0
- package/src/components/LoadingSpinner/index.story.tsx +1 -1
- package/src/components/LoadingSpinner/index.tsx +26 -52
- package/src/components/Modal/Dialog/index.css +44 -0
- package/src/components/Modal/Dialog/index.tsx +13 -57
- package/src/components/Modal/ModalPlumbing.css +40 -0
- package/src/components/Modal/ModalPlumbing.tsx +22 -61
- package/src/components/Modal/__snapshots__/index.story.storyshot +479 -1893
- package/src/components/Modal/index.css +36 -0
- package/src/components/Modal/index.story.tsx +2 -2
- package/src/components/Modal/index.tsx +37 -72
- package/src/components/Radio/__snapshots__/index.story.storyshot +55 -780
- package/src/components/Radio/index.css +97 -0
- package/src/components/Radio/index.story.tsx +2 -11
- package/src/components/Radio/index.test.tsx +0 -1
- package/src/components/Radio/index.tsx +50 -161
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +32 -262
- package/src/components/SegmentedControl/index.css +50 -0
- package/src/components/SegmentedControl/index.story.tsx +1 -1
- package/src/components/SegmentedControl/index.tsx +20 -89
- package/src/components/Switch/SwitchInput/index.css +82 -0
- package/src/components/Switch/SwitchInput/index.tsx +40 -0
- package/src/components/Switch/SwitchWithLabel.tsx +24 -0
- package/src/components/Switch/__snapshots__/index.story.storyshot +33 -536
- package/src/components/Switch/index.css +23 -0
- package/src/components/Switch/index.story.tsx +6 -1
- package/src/components/Switch/index.tsx +43 -140
- package/src/components/TagItem/__snapshots__/index.story.storyshot +161 -1138
- package/src/components/TagItem/index.css +140 -0
- package/src/components/TagItem/index.story.tsx +2 -2
- package/src/components/TagItem/index.tsx +76 -220
- package/src/components/TextArea/TextArea.story.tsx +1 -1
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +214 -1368
- package/src/components/TextArea/index.tsx +68 -91
- package/src/components/TextField/TextField.story.tsx +1 -1
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +287 -1627
- package/src/components/TextField/index.tsx +77 -105
- package/src/core/SSRProvider.tsx +12 -1
- package/src/index.ts +5 -8
- package/src/type.d.ts +6 -0
- package/dist/components/CheckboxInput/index.d.ts +0 -9
- package/dist/components/CheckboxInput/index.d.ts.map +0 -1
- package/dist/components/MultiSelect/context.d.ts +0 -14
- package/dist/components/MultiSelect/context.d.ts.map +0 -1
- package/dist/components/MultiSelect/index.d.ts +0 -36
- package/dist/components/MultiSelect/index.d.ts.map +0 -1
- package/src/components/CheckboxInput/__snapshots__/index.story.storyshot +0 -109
- package/src/components/CheckboxInput/index.css +0 -77
- package/src/components/CheckboxInput/index.tsx +0 -53
- package/src/components/MultiSelect/__snapshots__/index.story.storyshot +0 -1054
- package/src/components/MultiSelect/context.ts +0 -23
- package/src/components/MultiSelect/index.story.tsx +0 -112
- package/src/components/MultiSelect/index.test.tsx +0 -263
- package/src/components/MultiSelect/index.tsx +0 -282
package/dist/index.cjs.js
CHANGED
|
@@ -42,13 +42,12 @@ __export(src_exports, {
|
|
|
42
42
|
ModalAlign: () => ModalAlign,
|
|
43
43
|
ModalBody: () => ModalBody,
|
|
44
44
|
ModalButtons: () => ModalButtons,
|
|
45
|
+
ModalCloseButton: () => ModalCloseButton,
|
|
45
46
|
ModalHeader: () => ModalHeader,
|
|
46
|
-
MultiSelect: () => MultiSelect_default,
|
|
47
|
-
MultiSelectGroup: () => MultiSelectGroup,
|
|
48
47
|
OverlayProvider: () => import_overlays.OverlayProvider,
|
|
49
48
|
Radio: () => Radio_default,
|
|
50
49
|
RadioGroup: () => RadioGroup,
|
|
51
|
-
SSRProvider: () =>
|
|
50
|
+
SSRProvider: () => SSRProvider,
|
|
52
51
|
SegmentedControl: () => SegmentedControl_default,
|
|
53
52
|
Switch: () => Switch_default,
|
|
54
53
|
TagItem: () => TagItem_default,
|
|
@@ -88,6 +87,12 @@ function useComponentAbstraction() {
|
|
|
88
87
|
|
|
89
88
|
// src/core/SSRProvider.tsx
|
|
90
89
|
var import_ssr = require("@react-aria/ssr");
|
|
90
|
+
var import_react2 = require("react");
|
|
91
|
+
function isReactVersionOver(minVersion) {
|
|
92
|
+
const reactMajorVersion = parseInt(import_react2.version.split(".")[0], 10);
|
|
93
|
+
return Number.isFinite(reactMajorVersion) ? reactMajorVersion >= minVersion : false;
|
|
94
|
+
}
|
|
95
|
+
var SSRProvider = isReactVersionOver(18) ? import_react2.Fragment : import_ssr.SSRProvider;
|
|
91
96
|
|
|
92
97
|
// src/core/OverlayProvider.tsx
|
|
93
98
|
var import_overlays = require("@react-aria/overlays");
|
|
@@ -104,24 +109,24 @@ function CharcoalProvider({
|
|
|
104
109
|
children,
|
|
105
110
|
background
|
|
106
111
|
}) {
|
|
107
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SSRProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_styled_components.ThemeProvider, { theme: defaultTheme, children: [
|
|
108
113
|
injectTokens && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_styled.TokenInjector, { theme: themeMap, background }),
|
|
109
114
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ComponentAbstraction, { components, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_overlays.OverlayProvider, { children }) })
|
|
110
115
|
] }) });
|
|
111
116
|
}
|
|
112
117
|
|
|
113
118
|
// src/components/Button/index.tsx
|
|
114
|
-
var
|
|
119
|
+
var import_react4 = require("react");
|
|
115
120
|
|
|
116
121
|
// src/_lib/useClassNames.ts
|
|
117
|
-
var
|
|
118
|
-
function useClassNames(
|
|
119
|
-
return (0,
|
|
122
|
+
var import_react3 = require("react");
|
|
123
|
+
function useClassNames(...classNames) {
|
|
124
|
+
return (0, import_react3.useMemo)(() => classNames.filter((v) => v).join(" "), [classNames]);
|
|
120
125
|
}
|
|
121
126
|
|
|
122
127
|
// src/components/Button/index.tsx
|
|
123
128
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
124
|
-
var Button = (0,
|
|
129
|
+
var Button = (0, import_react4.forwardRef)(function Button2({
|
|
125
130
|
variant,
|
|
126
131
|
fullWidth,
|
|
127
132
|
size,
|
|
@@ -131,108 +136,44 @@ var Button = (0, import_react3.forwardRef)(function Button2({
|
|
|
131
136
|
componentAs,
|
|
132
137
|
...props
|
|
133
138
|
}, ref) {
|
|
134
|
-
const Component = (0,
|
|
139
|
+
const Component = (0, import_react4.useMemo)(() => as ?? "button", [as]);
|
|
135
140
|
const classNames = useClassNames("charcoal-button", className);
|
|
136
141
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Component, { ...props, as: componentAs, className: classNames, "data-variant": variant, "data-size": size, "data-full-width": fullWidth, "data-active": isActive, ref });
|
|
137
142
|
});
|
|
138
143
|
var Button_default = Button;
|
|
139
144
|
|
|
140
145
|
// src/components/Clickable/index.tsx
|
|
141
|
-
var
|
|
142
|
-
var import_styled_components2 = __toESM(require("styled-components"));
|
|
143
|
-
var import_utils = require("@charcoal-ui/utils");
|
|
146
|
+
var import_react5 = require("react");
|
|
144
147
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
145
|
-
var Clickable =
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
if (isLink) {
|
|
154
|
-
const {
|
|
155
|
-
disabled,
|
|
156
|
-
..._rest
|
|
157
|
-
} = props;
|
|
158
|
-
rest = _rest;
|
|
159
|
-
}
|
|
160
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StyledClickableDiv, { ...rest, ref, as, "aria-disabled": ariaDisabled });
|
|
148
|
+
var Clickable = (0, import_react5.forwardRef)(function Clickable2({
|
|
149
|
+
componentAs,
|
|
150
|
+
as,
|
|
151
|
+
...props
|
|
152
|
+
}, ref) {
|
|
153
|
+
const className = useClassNames("charcoal-clickable", props.className);
|
|
154
|
+
const Component = (0, import_react5.useMemo)(() => as ?? "button", [as]);
|
|
155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Component, { ...props, ref, className, as: componentAs });
|
|
161
156
|
});
|
|
162
157
|
var Clickable_default = Clickable;
|
|
163
|
-
var StyledClickableDiv = import_styled_components2.default.div.withConfig({
|
|
164
|
-
componentId: "ccl__sc-1lxyknw-0"
|
|
165
|
-
})(["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;}"], import_utils.disabledSelector);
|
|
166
158
|
|
|
167
159
|
// src/components/IconButton/index.tsx
|
|
168
|
-
var
|
|
169
|
-
var import_styled_components3 = __toESM(require("styled-components"));
|
|
170
|
-
var import_styled2 = require("@charcoal-ui/styled");
|
|
160
|
+
var import_react6 = require("react");
|
|
171
161
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
172
|
-
var IconButton = (0,
|
|
162
|
+
var IconButton = (0, import_react6.forwardRef)(function IconButtonInner({
|
|
173
163
|
variant = "Default",
|
|
174
164
|
size = "M",
|
|
175
165
|
icon,
|
|
176
166
|
isActive = false,
|
|
167
|
+
componentAs,
|
|
168
|
+
as,
|
|
177
169
|
...rest
|
|
178
170
|
}, ref) {
|
|
179
171
|
validateIconSize(size, icon);
|
|
180
|
-
|
|
172
|
+
const Component = (0, import_react6.useMemo)(() => as ?? "button", [as]);
|
|
173
|
+
const classNames = useClassNames("charcoal-icon-button", rest.className);
|
|
174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Component, { ...rest, as: componentAs, ref, className: classNames, "data-size": size, "data-active": isActive, "data-variant": variant, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("pixiv-icon", { name: icon }) });
|
|
181
175
|
});
|
|
182
176
|
var IconButton_default = IconButton;
|
|
183
|
-
var StyledIconButton = (0, import_styled_components3.default)(Clickable_default).attrs(styledProps).withConfig({
|
|
184
|
-
componentId: "ccl__sc-zssehl-0"
|
|
185
|
-
})(["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, ({
|
|
186
|
-
$font
|
|
187
|
-
}) => `--charcoal-${$font}`, ({
|
|
188
|
-
$background
|
|
189
|
-
}) => `--charcoal-${$background}`, ({
|
|
190
|
-
$isActive,
|
|
191
|
-
$background,
|
|
192
|
-
$font
|
|
193
|
-
}) => $isActive ? (0, import_styled_components3.css)(["color:var(--charcoal-", "-press);background-color:var(--charcoal-", "-press);"], $font, $background) : (0, import_styled_components3.css)(["&:hover{color:var(--charcoal-", "-hover);background-color:var(--charcoal-", "-hover);}&:active{color:var(--charcoal-", "-press);background-color:var(--charcoal-", "-press);}"], $font, $background, $font, $background), import_styled2.focusVisibleFocusRingCss);
|
|
194
|
-
function styledProps({
|
|
195
|
-
$size,
|
|
196
|
-
$variant
|
|
197
|
-
}) {
|
|
198
|
-
return {
|
|
199
|
-
...variantToProps($variant),
|
|
200
|
-
...sizeToProps($size)
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
function variantToProps(variant) {
|
|
204
|
-
switch (variant) {
|
|
205
|
-
case "Default":
|
|
206
|
-
return {
|
|
207
|
-
$font: "text3",
|
|
208
|
-
$background: "transparent"
|
|
209
|
-
};
|
|
210
|
-
case "Overlay":
|
|
211
|
-
return {
|
|
212
|
-
$font: "text5",
|
|
213
|
-
$background: "surface4"
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
function sizeToProps(size) {
|
|
218
|
-
switch (size) {
|
|
219
|
-
case "XS":
|
|
220
|
-
return {
|
|
221
|
-
$width: 20,
|
|
222
|
-
$height: 20
|
|
223
|
-
};
|
|
224
|
-
case "S":
|
|
225
|
-
return {
|
|
226
|
-
$width: 32,
|
|
227
|
-
$height: 32
|
|
228
|
-
};
|
|
229
|
-
case "M":
|
|
230
|
-
return {
|
|
231
|
-
$width: 40,
|
|
232
|
-
$height: 40
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
177
|
function validateIconSize(size, icon) {
|
|
237
178
|
let requiredIconSize;
|
|
238
179
|
switch (size) {
|
|
@@ -255,17 +196,15 @@ function validateIconSize(size, icon) {
|
|
|
255
196
|
}
|
|
256
197
|
|
|
257
198
|
// src/components/Radio/index.tsx
|
|
258
|
-
var
|
|
259
|
-
var
|
|
260
|
-
var import_styled_components4 = __toESM(require("styled-components"));
|
|
199
|
+
var import_react7 = require("react");
|
|
200
|
+
var React5 = __toESM(require("react"));
|
|
261
201
|
var import_warning = __toESM(require("warning"));
|
|
262
|
-
var import_styled3 = require("@charcoal-ui/styled");
|
|
263
202
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
264
|
-
var Radio = (0,
|
|
203
|
+
var Radio = (0, import_react7.forwardRef)(function RadioInner({
|
|
265
204
|
value,
|
|
266
205
|
disabled = false,
|
|
267
206
|
children,
|
|
268
|
-
|
|
207
|
+
...props
|
|
269
208
|
}, ref) {
|
|
270
209
|
const {
|
|
271
210
|
name,
|
|
@@ -274,7 +213,8 @@ var Radio = (0, import_react5.forwardRef)(function RadioInner({
|
|
|
274
213
|
readonly,
|
|
275
214
|
invalid,
|
|
276
215
|
onChange
|
|
277
|
-
} = (0,
|
|
216
|
+
} = (0, import_react7.useContext)(RadioGroupContext);
|
|
217
|
+
const classNames = useClassNames("charcoal-radio__label", props.className);
|
|
278
218
|
(0, import_warning.default)(
|
|
279
219
|
name !== void 0,
|
|
280
220
|
`"name" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`
|
|
@@ -282,30 +222,16 @@ var Radio = (0, import_react5.forwardRef)(function RadioInner({
|
|
|
282
222
|
const isSelected = value === selected;
|
|
283
223
|
const isDisabled = disabled || isParentDisabled;
|
|
284
224
|
const isReadonly = readonly && !isSelected;
|
|
285
|
-
const handleChange = (0,
|
|
225
|
+
const handleChange = (0, import_react7.useCallback)((e) => {
|
|
286
226
|
onChange(e.currentTarget.value);
|
|
287
227
|
}, [onChange]);
|
|
288
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
289
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
290
|
-
children != null && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { "aria-disabled": isDisabled || isReadonly, className: classNames, children: [
|
|
229
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "radio", className: "charcoal-radio__input", name, value, checked: isSelected, "aria-invalid": invalid, onChange: handleChange, disabled: isDisabled || isReadonly, ref }),
|
|
230
|
+
children != null && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "charcoal-radio__label_div", children })
|
|
291
231
|
] });
|
|
292
232
|
});
|
|
293
|
-
var Radio_default = (0,
|
|
294
|
-
var
|
|
295
|
-
componentId: "ccl__sc-1hitkzn-0"
|
|
296
|
-
})(["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;}"]);
|
|
297
|
-
var RadioInput = import_styled_components4.default.input.attrs({
|
|
298
|
-
type: "radio"
|
|
299
|
-
}).withConfig({
|
|
300
|
-
componentId: "ccl__sc-1hitkzn-1"
|
|
301
|
-
})(["&[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);}}}}}"], import_styled3.focusVisibleFocusRingCss);
|
|
302
|
-
var RadioLabel = import_styled_components4.default.div.withConfig({
|
|
303
|
-
componentId: "ccl__sc-1hitkzn-2"
|
|
304
|
-
})(["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;}"]);
|
|
305
|
-
var StyledRadioGroup = import_styled_components4.default.div.withConfig({
|
|
306
|
-
componentId: "ccl__sc-1hitkzn-3"
|
|
307
|
-
})(["display:grid;grid-template-columns:1fr;grid-gap:8px;"]);
|
|
308
|
-
var RadioGroupContext = React4.createContext({
|
|
233
|
+
var Radio_default = (0, import_react7.memo)(Radio);
|
|
234
|
+
var RadioGroupContext = React5.createContext({
|
|
309
235
|
name: void 0,
|
|
310
236
|
selected: void 0,
|
|
311
237
|
disabled: false,
|
|
@@ -315,233 +241,100 @@ var RadioGroupContext = React4.createContext({
|
|
|
315
241
|
throw new Error("Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?");
|
|
316
242
|
}
|
|
317
243
|
});
|
|
318
|
-
|
|
319
|
-
className,
|
|
244
|
+
var RadioGroup = (0, import_react7.forwardRef)(function RadioGroupInner({
|
|
320
245
|
value,
|
|
321
|
-
label,
|
|
322
246
|
name,
|
|
323
247
|
onChange,
|
|
324
248
|
disabled,
|
|
325
249
|
readonly,
|
|
326
250
|
invalid,
|
|
327
|
-
children
|
|
328
|
-
|
|
329
|
-
|
|
251
|
+
children,
|
|
252
|
+
...props
|
|
253
|
+
}, ref) {
|
|
254
|
+
const classNames = useClassNames("charcoal-radio-group", props.className);
|
|
255
|
+
const handleChange = (0, import_react7.useCallback)((next) => {
|
|
330
256
|
onChange(next);
|
|
331
257
|
}, [onChange]);
|
|
332
|
-
|
|
258
|
+
const contextValue = (0, import_react7.useMemo)(() => ({
|
|
333
259
|
name,
|
|
334
260
|
selected: value,
|
|
335
261
|
disabled: disabled ?? false,
|
|
336
262
|
readonly: readonly ?? false,
|
|
337
263
|
invalid: invalid ?? false,
|
|
338
264
|
onChange: handleChange
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
// src/components/MultiSelect/index.tsx
|
|
343
|
-
var import_react7 = require("react");
|
|
344
|
-
var import_styled_components5 = __toESM(require("styled-components"));
|
|
345
|
-
var import_warning2 = __toESM(require("warning"));
|
|
346
|
-
var import_utils2 = require("@charcoal-ui/utils");
|
|
347
|
-
|
|
348
|
-
// src/components/MultiSelect/context.ts
|
|
349
|
-
var import_react6 = require("react");
|
|
350
|
-
var MultiSelectGroupContext = (0, import_react6.createContext)({
|
|
351
|
-
name: void 0,
|
|
352
|
-
selected: [],
|
|
353
|
-
disabled: false,
|
|
354
|
-
readonly: false,
|
|
355
|
-
invalid: false,
|
|
356
|
-
onChange() {
|
|
357
|
-
throw new Error("Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<MultiSelectGroup />` ?");
|
|
358
|
-
}
|
|
265
|
+
}), [disabled, handleChange, invalid, name, readonly, value]);
|
|
266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RadioGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { role: "radiogroup", "aria-orientation": "vertical", "aria-invalid": invalid, className: classNames, ref, children }) });
|
|
359
267
|
});
|
|
360
268
|
|
|
361
|
-
// src/components/
|
|
362
|
-
var
|
|
269
|
+
// src/components/Switch/index.tsx
|
|
270
|
+
var import_react9 = require("react");
|
|
271
|
+
var import_utils = require("@react-aria/utils");
|
|
363
272
|
|
|
364
|
-
// src/components/
|
|
365
|
-
var
|
|
366
|
-
var import_icons = require("@charcoal-ui/icons");
|
|
273
|
+
// src/components/Switch/SwitchInput/index.tsx
|
|
274
|
+
var import_react8 = require("react");
|
|
367
275
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
368
|
-
var
|
|
369
|
-
|
|
370
|
-
scale,
|
|
371
|
-
unsafeNonGuidelineScale,
|
|
276
|
+
var SwitchInput = (0, import_react8.forwardRef)(function SwitchInput2({
|
|
277
|
+
onChange,
|
|
372
278
|
className,
|
|
373
|
-
...
|
|
279
|
+
...props
|
|
374
280
|
}, ref) {
|
|
375
|
-
|
|
281
|
+
const handleChange = (0, import_react8.useCallback)((e) => {
|
|
282
|
+
const el = e.currentTarget;
|
|
283
|
+
onChange?.(el.checked);
|
|
284
|
+
}, [onChange]);
|
|
285
|
+
props.children;
|
|
286
|
+
const classNames = useClassNames("charcoal-switch-input", className);
|
|
287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { ref, className: classNames, type: "checkbox", onChange: handleChange, ...props });
|
|
376
288
|
});
|
|
377
|
-
var
|
|
289
|
+
var SwitchInput_default = SwitchInput;
|
|
378
290
|
|
|
379
|
-
// src/components/
|
|
291
|
+
// src/components/Switch/SwitchWithLabel.tsx
|
|
292
|
+
var React6 = __toESM(require("react"));
|
|
380
293
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
381
|
-
var
|
|
382
|
-
|
|
383
|
-
disabled = false,
|
|
384
|
-
onChange,
|
|
385
|
-
variant = "default",
|
|
294
|
+
var SwitchWithLabel = React6.memo(function SwitchWithLabel2({
|
|
295
|
+
children,
|
|
386
296
|
className,
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
onChange: parentOnChange
|
|
396
|
-
} = (0, import_react7.useContext)(MultiSelectGroupContext);
|
|
397
|
-
(0, import_warning2.default)(
|
|
398
|
-
name !== void 0,
|
|
399
|
-
`"name" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`
|
|
400
|
-
);
|
|
401
|
-
const isSelected = selected.includes(value);
|
|
402
|
-
const isDisabled = disabled || parentDisabled || readonly;
|
|
403
|
-
const handleChange = (0, import_react7.useCallback)((event) => {
|
|
404
|
-
if (!(event.currentTarget instanceof HTMLInputElement)) {
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
if (onChange)
|
|
408
|
-
onChange({
|
|
409
|
-
value,
|
|
410
|
-
selected: event.currentTarget.checked
|
|
411
|
-
});
|
|
412
|
-
parentOnChange({
|
|
413
|
-
value,
|
|
414
|
-
selected: event.currentTarget.checked
|
|
415
|
-
});
|
|
416
|
-
}, [onChange, parentOnChange, value]);
|
|
417
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(MultiSelectRoot, { "aria-disabled": isDisabled, className, children: [
|
|
418
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MultiSelectInput, { ...{
|
|
419
|
-
name,
|
|
420
|
-
value,
|
|
421
|
-
invalid
|
|
422
|
-
}, checked: isSelected, disabled: isDisabled, onChange: handleChange, overlay: variant === "overlay", "aria-invalid": invalid, ref }),
|
|
423
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MultiSelectInputOverlay, { overlay: variant === "overlay", invalid, "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon_default, { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 }) }),
|
|
424
|
-
Boolean(children) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MultiSelectLabel, { children })
|
|
297
|
+
disabled,
|
|
298
|
+
id,
|
|
299
|
+
input
|
|
300
|
+
}) {
|
|
301
|
+
const classNames = useClassNames("charcoal-switch__label", className);
|
|
302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { htmlFor: id, className: classNames, "aria-disabled": disabled, children: [
|
|
303
|
+
input,
|
|
304
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "charcoal-switch__label_div", children })
|
|
425
305
|
] });
|
|
426
306
|
});
|
|
427
|
-
var MultiSelect_default = (0, import_react7.memo)(MultiSelect);
|
|
428
|
-
var MultiSelectRoot = import_styled_components5.default.label.withConfig({
|
|
429
|
-
componentId: "ccl__sc-wpr5y9-0"
|
|
430
|
-
})(["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;}"], ({
|
|
431
|
-
theme
|
|
432
|
-
}) => (0, import_utils2.px)(theme.spacing[4]));
|
|
433
|
-
var MultiSelectLabel = import_styled_components5.default.div.withConfig({
|
|
434
|
-
componentId: "ccl__sc-wpr5y9-1"
|
|
435
|
-
})(["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;}"]);
|
|
436
|
-
var MultiSelectInput = import_styled_components5.default.input.attrs({
|
|
437
|
-
type: "checkbox"
|
|
438
|
-
}).withConfig({
|
|
439
|
-
componentId: "ccl__sc-wpr5y9-2"
|
|
440
|
-
})(["&[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);}}", " ", " ", "}"], import_styled4.focusVisibleFocusRingCss, ({
|
|
441
|
-
invalid,
|
|
442
|
-
overlay
|
|
443
|
-
}) => invalid && !overlay && (0, import_styled_components5.css)(["&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}"]), ({
|
|
444
|
-
overlay
|
|
445
|
-
}) => overlay && (0, import_styled_components5.css)(["background-color:var(--charcoal-surface4);"]));
|
|
446
|
-
var MultiSelectInputOverlay = import_styled_components5.default.div.withConfig({
|
|
447
|
-
componentId: "ccl__sc-wpr5y9-3"
|
|
448
|
-
})(["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;", " ", ""], ({
|
|
449
|
-
invalid,
|
|
450
|
-
overlay
|
|
451
|
-
}) => invalid && overlay && (0, import_styled_components5.css)(["&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}"]), ({
|
|
452
|
-
overlay
|
|
453
|
-
}) => overlay && (0, import_styled_components5.css)(["border-color:var(--charcoal-text5);border-width:2px;border-style:solid;"]));
|
|
454
|
-
function MultiSelectGroup({
|
|
455
|
-
className,
|
|
456
|
-
name,
|
|
457
|
-
label,
|
|
458
|
-
selected,
|
|
459
|
-
onChange,
|
|
460
|
-
disabled = false,
|
|
461
|
-
readonly = false,
|
|
462
|
-
invalid = false,
|
|
463
|
-
children
|
|
464
|
-
}) {
|
|
465
|
-
const handleChange = (0, import_react7.useCallback)((payload) => {
|
|
466
|
-
const index = selected.indexOf(payload.value);
|
|
467
|
-
if (payload.selected) {
|
|
468
|
-
if (index < 0) {
|
|
469
|
-
onChange([...selected, payload.value]);
|
|
470
|
-
}
|
|
471
|
-
} else {
|
|
472
|
-
if (index >= 0) {
|
|
473
|
-
onChange([...selected.slice(0, index), ...selected.slice(index + 1)]);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}, [onChange, selected]);
|
|
477
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MultiSelectGroupContext.Provider, { value: {
|
|
478
|
-
name,
|
|
479
|
-
selected: Array.from(new Set(selected)),
|
|
480
|
-
disabled,
|
|
481
|
-
readonly,
|
|
482
|
-
invalid,
|
|
483
|
-
onChange: handleChange
|
|
484
|
-
}, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className, "aria-label": label, "data-testid": "SelectGroup", children }) });
|
|
485
|
-
}
|
|
486
307
|
|
|
487
308
|
// src/components/Switch/index.tsx
|
|
488
|
-
var import_switch = require("@react-aria/switch");
|
|
489
|
-
var import_react8 = require("react");
|
|
490
|
-
var import_react_stately = require("react-stately");
|
|
491
|
-
var import_styled_components6 = __toESM(require("styled-components"));
|
|
492
|
-
var import_utils3 = require("@react-aria/utils");
|
|
493
|
-
var import_styled5 = require("@charcoal-ui/styled");
|
|
494
309
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
495
|
-
var
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
className: _className,
|
|
511
|
-
type: _type,
|
|
512
|
-
...rest
|
|
513
|
-
}
|
|
514
|
-
} = (0, import_switch.useSwitch)(ariaSwitchProps, state, ref);
|
|
515
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Label, { className, "aria-disabled": disabled, children: [
|
|
516
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SwitchInput, { ...rest, ref }),
|
|
517
|
-
"children" in props ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LabelInner, { children: props.children }) : void 0
|
|
518
|
-
] });
|
|
310
|
+
var Switch = (0, import_react9.forwardRef)(function Switch2({
|
|
311
|
+
children,
|
|
312
|
+
onChange,
|
|
313
|
+
disabled,
|
|
314
|
+
className,
|
|
315
|
+
id,
|
|
316
|
+
...props
|
|
317
|
+
}, ref) {
|
|
318
|
+
const htmlId = (0, import_utils.useId)(id);
|
|
319
|
+
const noChildren = children === void 0;
|
|
320
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SwitchInput_default, { ...props, disabled, className: noChildren ? className : void 0, id: htmlId, onChange, ref, role: "switch", type: "checkbox" });
|
|
321
|
+
if (noChildren) {
|
|
322
|
+
return input;
|
|
323
|
+
}
|
|
324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SwitchWithLabel, { className, disabled, id: htmlId, input, children });
|
|
519
325
|
});
|
|
520
|
-
var Switch_default = (0,
|
|
521
|
-
var Label = import_styled_components6.default.label.withConfig({
|
|
522
|
-
componentId: "ccl__sc-1wy6z5h-0"
|
|
523
|
-
})(["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;}"]);
|
|
524
|
-
var LabelInner = import_styled_components6.default.div.withConfig({
|
|
525
|
-
componentId: "ccl__sc-1wy6z5h-1"
|
|
526
|
-
})(["font-size:14px;line-height:22px;color:var(--charcoal-text2);margin-left:4px;"]);
|
|
527
|
-
var SwitchInput = import_styled_components6.default.input.attrs({
|
|
528
|
-
type: "checkbox"
|
|
529
|
-
}).withConfig({
|
|
530
|
-
componentId: "ccl__sc-1wy6z5h-2"
|
|
531
|
-
})(["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;}}"], import_styled5.focusVisibleFocusRingCss);
|
|
326
|
+
var Switch_default = (0, import_react9.memo)(Switch);
|
|
532
327
|
|
|
533
328
|
// src/components/TextField/index.tsx
|
|
534
|
-
var import_textfield = require("@react-aria/textfield");
|
|
535
329
|
var import_visually_hidden = require("@react-aria/visually-hidden");
|
|
536
|
-
var
|
|
537
|
-
var
|
|
538
|
-
var
|
|
330
|
+
var import_react11 = require("react");
|
|
331
|
+
var React8 = __toESM(require("react"));
|
|
332
|
+
var import_styled_components2 = __toESM(require("styled-components"));
|
|
539
333
|
|
|
540
334
|
// src/components/FieldLabel/index.tsx
|
|
541
|
-
var
|
|
542
|
-
var import_styled_components7 = __toESM(require("styled-components"));
|
|
335
|
+
var React7 = __toESM(require("react"));
|
|
543
336
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
544
|
-
var FieldLabel =
|
|
337
|
+
var FieldLabel = React7.forwardRef(function FieldLabel2({
|
|
545
338
|
style,
|
|
546
339
|
className,
|
|
547
340
|
label,
|
|
@@ -550,30 +343,16 @@ var FieldLabel = React6.forwardRef(function FieldLabel2({
|
|
|
550
343
|
subLabel,
|
|
551
344
|
...labelProps
|
|
552
345
|
}, ref) {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
346
|
+
const classNames = useClassNames("charcoal-field-label-root", className);
|
|
347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style, className: classNames, children: [
|
|
348
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { ref, className: "charcoal-field-label", ...labelProps, children: label }),
|
|
349
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "charcoal-field-label-required-text", children: requiredText }),
|
|
350
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "charcoal-field-label-sub-label", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: subLabel }) })
|
|
557
351
|
] });
|
|
558
352
|
});
|
|
559
353
|
var FieldLabel_default = FieldLabel;
|
|
560
|
-
var Label2 = import_styled_components7.default.label.withConfig({
|
|
561
|
-
componentId: "ccl__sc-1iotshb-0"
|
|
562
|
-
})(["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;}"]);
|
|
563
|
-
var RequiredText = import_styled_components7.default.span.withConfig({
|
|
564
|
-
componentId: "ccl__sc-1iotshb-1"
|
|
565
|
-
})(["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;}"]);
|
|
566
|
-
var SubLabelClickable = import_styled_components7.default.div.withConfig({
|
|
567
|
-
componentId: "ccl__sc-1iotshb-2"
|
|
568
|
-
})(["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);}}"]);
|
|
569
|
-
var FieldLabelWrapper = import_styled_components7.default.div.withConfig({
|
|
570
|
-
componentId: "ccl__sc-1iotshb-3"
|
|
571
|
-
})(["display:inline-flex;align-items:center;> ", "{margin-left:4px;}> ", "{margin-left:auto;}"], RequiredText, SubLabelClickable);
|
|
572
354
|
|
|
573
355
|
// src/_lib/index.ts
|
|
574
|
-
function unreachable(value) {
|
|
575
|
-
throw new Error(arguments.length === 0 ? "unreachable" : `unreachable (${JSON.stringify(value)})`);
|
|
576
|
-
}
|
|
577
356
|
function mergeRefs(...refs) {
|
|
578
357
|
return (value) => {
|
|
579
358
|
for (const ref of refs) {
|
|
@@ -591,9 +370,9 @@ function countCodePointsInString(string) {
|
|
|
591
370
|
}
|
|
592
371
|
|
|
593
372
|
// src/components/TextField/useFocusWithClick.tsx
|
|
594
|
-
var
|
|
373
|
+
var import_react10 = require("react");
|
|
595
374
|
function useFocusWithClick(containerRef, inputRef) {
|
|
596
|
-
(0,
|
|
375
|
+
(0, import_react10.useEffect)(() => {
|
|
597
376
|
const el = containerRef.current;
|
|
598
377
|
if (el) {
|
|
599
378
|
const handleDown = (e) => {
|
|
@@ -610,151 +389,128 @@ function useFocusWithClick(containerRef, inputRef) {
|
|
|
610
389
|
}
|
|
611
390
|
|
|
612
391
|
// src/components/TextField/index.tsx
|
|
613
|
-
var
|
|
392
|
+
var import_utils2 = require("@react-aria/utils");
|
|
614
393
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
615
|
-
var TextField =
|
|
394
|
+
var TextField = React8.forwardRef(function SingleLineTextFieldInner({
|
|
395
|
+
assistiveText,
|
|
396
|
+
className,
|
|
397
|
+
disabled = false,
|
|
398
|
+
label = "",
|
|
399
|
+
maxLength,
|
|
616
400
|
onChange,
|
|
401
|
+
prefix = null,
|
|
402
|
+
required,
|
|
403
|
+
requiredText,
|
|
404
|
+
showCount = false,
|
|
405
|
+
showLabel = false,
|
|
406
|
+
subLabel,
|
|
407
|
+
suffix = null,
|
|
408
|
+
type = "text",
|
|
409
|
+
value,
|
|
410
|
+
getCount = countCodePointsInString,
|
|
617
411
|
...props
|
|
618
|
-
},
|
|
619
|
-
const
|
|
620
|
-
className,
|
|
621
|
-
showLabel = false,
|
|
622
|
-
showCount = false,
|
|
623
|
-
label,
|
|
624
|
-
requiredText,
|
|
625
|
-
subLabel,
|
|
626
|
-
disabled = false,
|
|
627
|
-
required,
|
|
628
|
-
invalid = false,
|
|
629
|
-
readOnly = false,
|
|
630
|
-
assistiveText,
|
|
631
|
-
maxLength,
|
|
632
|
-
prefix = null,
|
|
633
|
-
suffix = null,
|
|
634
|
-
...restProps
|
|
635
|
-
} = props;
|
|
412
|
+
}, forwardRef20) {
|
|
413
|
+
const inputRef = (0, import_react11.useRef)(null);
|
|
636
414
|
const {
|
|
637
415
|
visuallyHiddenProps
|
|
638
416
|
} = (0, import_visually_hidden.useVisuallyHidden)();
|
|
639
|
-
const
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
const count2 = countCodePointsInString(value);
|
|
417
|
+
const [count, setCount] = (0, import_react11.useState)(getCount(value ?? ""));
|
|
418
|
+
const handleChange = (0, import_react11.useCallback)((e) => {
|
|
419
|
+
const value2 = e.target.value;
|
|
420
|
+
const count2 = getCount(value2);
|
|
644
421
|
if (maxLength !== void 0 && count2 > maxLength) {
|
|
645
422
|
return;
|
|
646
423
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
errorMessageProps
|
|
660
|
-
} = (0, import_textfield.useTextField)({
|
|
661
|
-
inputElementType: "input",
|
|
662
|
-
isDisabled: disabled,
|
|
663
|
-
isRequired: required,
|
|
664
|
-
isReadOnly: readOnly,
|
|
665
|
-
validationState: invalid ? "invalid" : "valid",
|
|
666
|
-
description: !invalid && assistiveText,
|
|
667
|
-
errorMessage: invalid && assistiveText,
|
|
668
|
-
onChange: handleChange,
|
|
669
|
-
...props
|
|
670
|
-
}, ariaRef);
|
|
671
|
-
const containerRef = (0, import_react10.useRef)(null);
|
|
672
|
-
useFocusWithClick(containerRef, ariaRef);
|
|
673
|
-
const inputProps = (0, import_utils4.mergeProps)(restProps, ariaInputProps);
|
|
424
|
+
setCount(count2);
|
|
425
|
+
onChange?.(value2);
|
|
426
|
+
}, [getCount, maxLength, onChange]);
|
|
427
|
+
(0, import_react11.useEffect)(() => {
|
|
428
|
+
setCount(getCount(value ?? ""));
|
|
429
|
+
}, [getCount, value]);
|
|
430
|
+
const containerRef = (0, import_react11.useRef)(null);
|
|
431
|
+
useFocusWithClick(containerRef, inputRef);
|
|
432
|
+
const inputId = (0, import_utils2.useId)(props.id);
|
|
433
|
+
const describedbyId = (0, import_utils2.useId)();
|
|
434
|
+
const labelledbyId = (0, import_utils2.useId)();
|
|
435
|
+
const showAssistiveText = assistiveText != null && assistiveText.length !== 0;
|
|
674
436
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(TextFieldRoot, { className, isDisabled: disabled, children: [
|
|
675
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
676
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(StyledInputContainer, {
|
|
437
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FieldLabel_default, { htmlFor: inputId, id: labelledbyId, label, required, requiredText, subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
438
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(StyledInputContainer, { "aria-disabled": disabled === true ? true : void 0, hasPrefix: prefix != null, hasSuffix: suffix != null || showCount, invalid: props.invalid === true, ref: containerRef, children: [
|
|
677
439
|
prefix && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PrefixContainer, { children: prefix }),
|
|
678
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(StyledInput, { ref: mergeRefs(
|
|
440
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(StyledInput, { "aria-describedby": showAssistiveText ? describedbyId : void 0, "aria-invalid": props.invalid, "aria-labelledby": labelledbyId, id: inputId, invalid: props.invalid === true, maxLength, onChange: handleChange, prefix: props.rdfaPredix, ref: (0, import_utils2.mergeRefs)(forwardRef20, inputRef), type, value, ...props }),
|
|
679
441
|
(suffix || showCount) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(SuffixContainer, { children: [
|
|
680
442
|
suffix,
|
|
681
443
|
showCount && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SingleLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
682
444
|
] })
|
|
683
445
|
] }),
|
|
684
|
-
|
|
446
|
+
showAssistiveText && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AssistiveText, { invalid: props.invalid === true, id: describedbyId, children: assistiveText })
|
|
685
447
|
] });
|
|
686
448
|
});
|
|
687
449
|
var TextField_default = TextField;
|
|
688
|
-
var TextFieldRoot =
|
|
450
|
+
var TextFieldRoot = import_styled_components2.default.div.withConfig({
|
|
689
451
|
componentId: "ccl__sc-3dd0tt-0"
|
|
690
|
-
})(["display:
|
|
452
|
+
})(["display:grid;grid-template-columns:1fr;grid-gap:4px;", ""], (p) => p.isDisabled && {
|
|
691
453
|
opacity: p.theme.elementEffect.disabled.opacity
|
|
692
454
|
});
|
|
693
|
-
var
|
|
455
|
+
var StyledInputContainer = import_styled_components2.default.div.withConfig({
|
|
694
456
|
componentId: "ccl__sc-3dd0tt-1"
|
|
695
|
-
})(["
|
|
696
|
-
var
|
|
457
|
+
})(["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 && (0, import_styled_components2.css)(["box-shadow:0 0 0 4px rgba(255,43,0,0.32);"]));
|
|
458
|
+
var PrefixContainer = import_styled_components2.default.div.withConfig({
|
|
697
459
|
componentId: "ccl__sc-3dd0tt-2"
|
|
698
|
-
})(["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 && (0, import_styled_components8.css)(["box-shadow:0 0 0 4px rgba(255,43,0,0.32);"]));
|
|
699
|
-
var PrefixContainer = import_styled_components8.default.div.withConfig({
|
|
700
|
-
componentId: "ccl__sc-3dd0tt-3"
|
|
701
460
|
})(["display:flex;align-items:center;"]);
|
|
702
|
-
var SuffixContainer =
|
|
703
|
-
componentId: "ccl__sc-3dd0tt-
|
|
461
|
+
var SuffixContainer = import_styled_components2.default.span.withConfig({
|
|
462
|
+
componentId: "ccl__sc-3dd0tt-3"
|
|
704
463
|
})(["display:flex;align-items:center;gap:8px;"]);
|
|
705
|
-
var StyledInput =
|
|
706
|
-
componentId: "ccl__sc-3dd0tt-
|
|
464
|
+
var StyledInput = import_styled_components2.default.input.withConfig({
|
|
465
|
+
componentId: "ccl__sc-3dd0tt-4"
|
|
707
466
|
})(["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);}"]);
|
|
708
|
-
var SingleLineCounter =
|
|
709
|
-
componentId: "ccl__sc-3dd0tt-
|
|
467
|
+
var SingleLineCounter = import_styled_components2.default.span.withConfig({
|
|
468
|
+
componentId: "ccl__sc-3dd0tt-5"
|
|
710
469
|
})(["line-height:22px;font-size:14px;color:var(--charcoal-text3);"]);
|
|
711
|
-
var AssistiveText =
|
|
712
|
-
componentId: "ccl__sc-3dd0tt-
|
|
713
|
-
})(["font-size:14px;line-height:22px;margin
|
|
470
|
+
var AssistiveText = import_styled_components2.default.p.withConfig({
|
|
471
|
+
componentId: "ccl__sc-3dd0tt-6"
|
|
472
|
+
})(["font-size:14px;line-height:22px;margin:0;color:", ";"], (p) => `var(--charcoal-${p.invalid ? `assertive` : `text2`})`);
|
|
714
473
|
|
|
715
474
|
// src/components/TextArea/index.tsx
|
|
716
|
-
var import_textfield2 = require("@react-aria/textfield");
|
|
717
475
|
var import_visually_hidden2 = require("@react-aria/visually-hidden");
|
|
718
|
-
var
|
|
719
|
-
var
|
|
720
|
-
var
|
|
476
|
+
var import_react12 = require("react");
|
|
477
|
+
var import_styled_components3 = __toESM(require("styled-components"));
|
|
478
|
+
var import_utils3 = require("@react-aria/utils");
|
|
721
479
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
722
|
-
var TextArea = (0,
|
|
480
|
+
var TextArea = (0, import_react12.forwardRef)(function TextAreaInner({
|
|
723
481
|
onChange,
|
|
482
|
+
className,
|
|
483
|
+
value,
|
|
484
|
+
showCount = false,
|
|
485
|
+
showLabel = false,
|
|
486
|
+
label = "",
|
|
487
|
+
requiredText,
|
|
488
|
+
subLabel,
|
|
489
|
+
disabled = false,
|
|
490
|
+
required,
|
|
491
|
+
assistiveText,
|
|
492
|
+
maxLength,
|
|
493
|
+
autoHeight = false,
|
|
494
|
+
rows: initialRows = 4,
|
|
495
|
+
getCount = countCodePointsInString,
|
|
724
496
|
...props
|
|
725
|
-
},
|
|
726
|
-
const {
|
|
727
|
-
className,
|
|
728
|
-
showCount = false,
|
|
729
|
-
showLabel = false,
|
|
730
|
-
label,
|
|
731
|
-
requiredText,
|
|
732
|
-
subLabel,
|
|
733
|
-
disabled = false,
|
|
734
|
-
required,
|
|
735
|
-
invalid = false,
|
|
736
|
-
readOnly = false,
|
|
737
|
-
assistiveText,
|
|
738
|
-
maxLength,
|
|
739
|
-
autoHeight = false,
|
|
740
|
-
rows: initialRows = 4,
|
|
741
|
-
...restProps
|
|
742
|
-
} = props;
|
|
497
|
+
}, forwardRef20) {
|
|
743
498
|
const {
|
|
744
499
|
visuallyHiddenProps
|
|
745
500
|
} = (0, import_visually_hidden2.useVisuallyHidden)();
|
|
746
|
-
const textareaRef = (0,
|
|
747
|
-
const
|
|
748
|
-
const [count, setCount] = (0,
|
|
749
|
-
const [rows, setRows] = (0,
|
|
750
|
-
const syncHeight = (0,
|
|
501
|
+
const textareaRef = (0, import_react12.useRef)(null);
|
|
502
|
+
const textAreaRef = (0, import_react12.useRef)(null);
|
|
503
|
+
const [count, setCount] = (0, import_react12.useState)(getCount(value ?? ""));
|
|
504
|
+
const [rows, setRows] = (0, import_react12.useState)(initialRows);
|
|
505
|
+
const syncHeight = (0, import_react12.useCallback)((textarea) => {
|
|
751
506
|
const rows2 = (`${textarea.value}
|
|
752
507
|
`.match(/\n/gu)?.length ?? 0) || 1;
|
|
753
508
|
setRows(initialRows <= rows2 ? rows2 : initialRows);
|
|
754
509
|
}, [initialRows]);
|
|
755
|
-
const nonControlled =
|
|
756
|
-
const handleChange = (0,
|
|
757
|
-
const
|
|
510
|
+
const nonControlled = value === void 0;
|
|
511
|
+
const handleChange = (0, import_react12.useCallback)((e) => {
|
|
512
|
+
const value2 = e.target.value;
|
|
513
|
+
const count2 = getCount(value2);
|
|
758
514
|
if (maxLength !== void 0 && count2 > maxLength) {
|
|
759
515
|
return;
|
|
760
516
|
}
|
|
@@ -764,88 +520,86 @@ var TextArea = (0, import_react11.forwardRef)(function TextAreaInner({
|
|
|
764
520
|
if (autoHeight && textareaRef.current !== null) {
|
|
765
521
|
syncHeight(textareaRef.current);
|
|
766
522
|
}
|
|
767
|
-
onChange?.(
|
|
768
|
-
}, [autoHeight, maxLength, nonControlled, onChange, syncHeight]);
|
|
769
|
-
(0,
|
|
770
|
-
setCount(
|
|
771
|
-
}, [
|
|
772
|
-
|
|
773
|
-
inputProps: ariaInputProps,
|
|
774
|
-
labelProps,
|
|
775
|
-
descriptionProps,
|
|
776
|
-
errorMessageProps
|
|
777
|
-
} = (0, import_textfield2.useTextField)({
|
|
778
|
-
inputElementType: "textarea",
|
|
779
|
-
isDisabled: disabled,
|
|
780
|
-
isRequired: required,
|
|
781
|
-
isReadOnly: readOnly,
|
|
782
|
-
validationState: invalid ? "invalid" : "valid",
|
|
783
|
-
description: !invalid && assistiveText,
|
|
784
|
-
errorMessage: invalid && assistiveText,
|
|
785
|
-
onChange: handleChange,
|
|
786
|
-
...props
|
|
787
|
-
}, ariaRef);
|
|
788
|
-
(0, import_react11.useEffect)(() => {
|
|
523
|
+
onChange?.(value2);
|
|
524
|
+
}, [autoHeight, getCount, maxLength, nonControlled, onChange, syncHeight]);
|
|
525
|
+
(0, import_react12.useEffect)(() => {
|
|
526
|
+
setCount(getCount(value ?? ""));
|
|
527
|
+
}, [getCount, value]);
|
|
528
|
+
(0, import_react12.useEffect)(() => {
|
|
789
529
|
if (autoHeight && textareaRef.current !== null) {
|
|
790
530
|
syncHeight(textareaRef.current);
|
|
791
531
|
}
|
|
792
532
|
}, [autoHeight, syncHeight]);
|
|
793
|
-
const containerRef = (0,
|
|
794
|
-
useFocusWithClick(containerRef,
|
|
795
|
-
const
|
|
533
|
+
const containerRef = (0, import_react12.useRef)(null);
|
|
534
|
+
useFocusWithClick(containerRef, textAreaRef);
|
|
535
|
+
const textAreaId = (0, import_utils3.useId)(props.id);
|
|
536
|
+
const describedbyId = (0, import_utils3.useId)();
|
|
537
|
+
const labelledbyId = (0, import_utils3.useId)();
|
|
538
|
+
const showAssistiveText = assistiveText != null && assistiveText.length !== 0;
|
|
796
539
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(TextFieldRoot2, { className, isDisabled: disabled, children: [
|
|
797
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
798
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(StyledTextareaContainer, {
|
|
799
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(StyledTextarea, {
|
|
540
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FieldLabel_default, { htmlFor: textAreaId, id: labelledbyId, label, required, requiredText, subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
541
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(StyledTextareaContainer, { "aria-disabled": disabled === true ? "true" : void 0, invalid: props.invalid === true, ref: containerRef, rows: showCount ? rows + 1 : rows, children: [
|
|
542
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(StyledTextarea, { "aria-describedby": showAssistiveText ? describedbyId : void 0, "aria-invalid": props.invalid, "aria-labelledby": labelledbyId, id: textAreaId, maxLength, noBottomPadding: showCount, onChange: handleChange, ref: mergeRefs(forwardRef20, textAreaRef), rows, value, ...props }),
|
|
800
543
|
showCount && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MultiLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
801
544
|
] }),
|
|
802
|
-
|
|
545
|
+
showAssistiveText && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AssistiveText, { invalid: props.invalid === true, id: describedbyId, children: assistiveText })
|
|
803
546
|
] });
|
|
804
547
|
});
|
|
805
548
|
var TextArea_default = TextArea;
|
|
806
|
-
var TextFieldRoot2 =
|
|
549
|
+
var TextFieldRoot2 = import_styled_components3.default.div.withConfig({
|
|
807
550
|
componentId: "ccl__sc-58waht-0"
|
|
808
|
-
})(["display:
|
|
551
|
+
})(["display:grid;grid-template-columns:1fr;grid-gap:4px;", ""], (p) => p.isDisabled && {
|
|
809
552
|
opacity: p.theme.elementEffect.disabled.opacity
|
|
810
553
|
});
|
|
811
|
-
var StyledTextareaContainer =
|
|
554
|
+
var StyledTextareaContainer = import_styled_components3.default.div.withConfig({
|
|
812
555
|
componentId: "ccl__sc-58waht-1"
|
|
813
556
|
})(["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 ", ";}", ""], ({
|
|
814
557
|
rows
|
|
815
|
-
}) => (0,
|
|
816
|
-
var StyledTextarea =
|
|
558
|
+
}) => (0, import_styled_components3.css)(["height:calc(22px * ", " + 18px);"], rows), (p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`, (p) => p.invalid && (0, import_styled_components3.css)(["box-shadow:0 0 0 4px rgba(255,43,0,0.32);"]));
|
|
559
|
+
var StyledTextarea = import_styled_components3.default.textarea.withConfig({
|
|
817
560
|
componentId: "ccl__sc-58waht-2"
|
|
818
561
|
})(["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 : "", ({
|
|
819
562
|
rows = 1,
|
|
820
563
|
noBottomPadding
|
|
821
|
-
}) => (0,
|
|
822
|
-
var MultiLineCounter =
|
|
564
|
+
}) => (0, import_styled_components3.css)(["height:calc(22px / 0.875 * ", " + ", "px);"], rows, noBottomPadding ? 9 : 20));
|
|
565
|
+
var MultiLineCounter = import_styled_components3.default.span.withConfig({
|
|
823
566
|
componentId: "ccl__sc-58waht-3"
|
|
824
567
|
})(["position:absolute;bottom:9px;right:8px;line-height:22px;font-size:14px;color:var(--charcoal-text3);"]);
|
|
825
568
|
|
|
569
|
+
// src/components/Icon/index.tsx
|
|
570
|
+
var React9 = __toESM(require("react"));
|
|
571
|
+
var import_icons = require("@charcoal-ui/icons");
|
|
572
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
573
|
+
var Icon = React9.forwardRef(function IconInner({
|
|
574
|
+
name,
|
|
575
|
+
scale,
|
|
576
|
+
unsafeNonGuidelineScale,
|
|
577
|
+
className,
|
|
578
|
+
...rest
|
|
579
|
+
}, ref) {
|
|
580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
|
|
581
|
+
});
|
|
582
|
+
var Icon_default = Icon;
|
|
583
|
+
|
|
826
584
|
// src/components/Modal/index.tsx
|
|
827
|
-
var
|
|
828
|
-
var
|
|
585
|
+
var import_react15 = require("react");
|
|
586
|
+
var React13 = __toESM(require("react"));
|
|
829
587
|
var import_overlays3 = require("@react-aria/overlays");
|
|
830
|
-
var
|
|
831
|
-
var
|
|
832
|
-
var
|
|
833
|
-
var
|
|
834
|
-
var
|
|
588
|
+
var import_styled_components4 = require("styled-components");
|
|
589
|
+
var import_utils4 = require("@charcoal-ui/utils");
|
|
590
|
+
var import_styled2 = require("@charcoal-ui/styled");
|
|
591
|
+
var import_react_spring = require("react-spring");
|
|
592
|
+
var import_utils5 = require("@react-aria/utils");
|
|
835
593
|
|
|
836
594
|
// src/components/Modal/Dialog/index.tsx
|
|
837
|
-
var
|
|
838
|
-
var import_styled_components10 = __toESM(require("styled-components"));
|
|
595
|
+
var import_react13 = require("react");
|
|
839
596
|
var import_dialog = require("@react-aria/dialog");
|
|
840
|
-
var import_foundation = require("@charcoal-ui/foundation");
|
|
841
|
-
var import_utils6 = require("@charcoal-ui/utils");
|
|
842
|
-
var import_react_spring = require("react-spring");
|
|
843
597
|
|
|
844
598
|
// src/_lib/useForwardedRef.tsx
|
|
845
|
-
var
|
|
599
|
+
var React10 = __toESM(require("react"));
|
|
846
600
|
function useForwardedRef(ref) {
|
|
847
|
-
const innerRef =
|
|
848
|
-
|
|
601
|
+
const innerRef = React10.useRef(null);
|
|
602
|
+
React10.useEffect(() => {
|
|
849
603
|
if (!ref)
|
|
850
604
|
return;
|
|
851
605
|
if (typeof ref === "function") {
|
|
@@ -858,49 +612,36 @@ function useForwardedRef(ref) {
|
|
|
858
612
|
}
|
|
859
613
|
|
|
860
614
|
// src/components/Modal/Dialog/index.tsx
|
|
861
|
-
var
|
|
862
|
-
var Dialog = (0,
|
|
863
|
-
|
|
615
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
616
|
+
var Dialog = (0, import_react13.forwardRef)(function Dialog2({
|
|
617
|
+
size,
|
|
618
|
+
bottomSheet,
|
|
619
|
+
css: css4,
|
|
620
|
+
className,
|
|
621
|
+
...props
|
|
622
|
+
}, forwardRef20) {
|
|
623
|
+
const ref = useForwardedRef(forwardRef20);
|
|
864
624
|
const {
|
|
865
625
|
dialogProps
|
|
866
626
|
} = (0, import_dialog.useDialog)({
|
|
867
627
|
role: "dialog"
|
|
868
628
|
}, ref);
|
|
869
|
-
|
|
629
|
+
const classNames = useClassNames("charcoal-modal-dialog", className);
|
|
630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: classNames, role: dialogProps.role, "data-bottom-sheet": bottomSheet, tabIndex: dialogProps.tabIndex, "aria-labelledby": dialogProps["aria-labelledby"], onBlur: dialogProps.onBlur, ref, ...props });
|
|
870
631
|
});
|
|
871
|
-
var AnimatedStyledDialogDiv = (0, import_react_spring.animated)(import_styled_components10.default.div.withConfig({
|
|
872
|
-
componentId: "ccl__sc-1ep4f6v-0"
|
|
873
|
-
})(["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) => {
|
|
874
|
-
switch (p.size) {
|
|
875
|
-
case "S": {
|
|
876
|
-
return (0, import_foundation.columnSystem)(3, import_foundation.COLUMN_UNIT, import_foundation.GUTTER_UNIT) + import_foundation.GUTTER_UNIT * 2;
|
|
877
|
-
}
|
|
878
|
-
case "M": {
|
|
879
|
-
return (0, import_foundation.columnSystem)(4, import_foundation.COLUMN_UNIT, import_foundation.GUTTER_UNIT) + import_foundation.GUTTER_UNIT * 2;
|
|
880
|
-
}
|
|
881
|
-
case "L": {
|
|
882
|
-
return (0, import_foundation.columnSystem)(6, import_foundation.COLUMN_UNIT, import_foundation.GUTTER_UNIT) + import_foundation.GUTTER_UNIT * 2;
|
|
883
|
-
}
|
|
884
|
-
default: {
|
|
885
|
-
return unreachable(p.size);
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
}, ({
|
|
889
|
-
theme
|
|
890
|
-
}) => (0, import_utils6.maxWidth)(theme.breakpoint.screen1), (p) => p.bottomSheet !== false && (0, import_styled_components10.css)(["max-width:unset;width:100%;border-radius:0;margin:auto 0 0 0;", ""], p.bottomSheet === "full" && (0, import_styled_components10.css)(["min-height:100%;"]))));
|
|
891
632
|
|
|
892
633
|
// src/components/Modal/ModalBackgroundContext.tsx
|
|
893
|
-
var
|
|
894
|
-
var ModalBackgroundContext =
|
|
634
|
+
var React11 = __toESM(require("react"));
|
|
635
|
+
var ModalBackgroundContext = React11.createContext(null);
|
|
895
636
|
|
|
896
637
|
// src/components/Modal/useCustomModalOverlay.tsx
|
|
897
|
-
var
|
|
638
|
+
var React12 = __toESM(require("react"));
|
|
898
639
|
var import_overlays2 = require("@react-aria/overlays");
|
|
899
640
|
|
|
900
641
|
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
901
|
-
var
|
|
642
|
+
var import_react14 = require("react");
|
|
902
643
|
function usePreventScroll(element, isOpen) {
|
|
903
|
-
(0,
|
|
644
|
+
(0, import_react14.useEffect)(() => {
|
|
904
645
|
if (isOpen && element) {
|
|
905
646
|
const defaultPaddingRight = element.style.paddingRight;
|
|
906
647
|
const defaultOverflow = element.style.overflow;
|
|
@@ -927,7 +668,7 @@ function useCharcoalModalOverlay(props, state, ref) {
|
|
|
927
668
|
}, ref);
|
|
928
669
|
usePreventScroll(typeof document !== "undefined" ? document.body : null, state.isOpen);
|
|
929
670
|
(0, import_overlays2.useOverlayFocusContain)();
|
|
930
|
-
|
|
671
|
+
React12.useEffect(() => {
|
|
931
672
|
if (state.isOpen && ref.current) {
|
|
932
673
|
return (0, import_overlays2.ariaHideOutside)([ref.current]);
|
|
933
674
|
}
|
|
@@ -939,9 +680,9 @@ function useCharcoalModalOverlay(props, state, ref) {
|
|
|
939
680
|
}
|
|
940
681
|
|
|
941
682
|
// src/components/Modal/index.tsx
|
|
942
|
-
var
|
|
683
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
943
684
|
var DEFAULT_Z_INDEX = 10;
|
|
944
|
-
var Modal = (0,
|
|
685
|
+
var Modal = (0, import_react15.forwardRef)(function ModalInner({
|
|
945
686
|
children,
|
|
946
687
|
zIndex = DEFAULT_Z_INDEX,
|
|
947
688
|
portalContainer,
|
|
@@ -954,9 +695,10 @@ var Modal = (0, import_react14.forwardRef)(function ModalInner({
|
|
|
954
695
|
isDismissable,
|
|
955
696
|
onClose,
|
|
956
697
|
className,
|
|
957
|
-
isOpen = false
|
|
698
|
+
isOpen = false,
|
|
699
|
+
closeButtonAriaLabel = "Close"
|
|
958
700
|
} = props;
|
|
959
|
-
const ref = (0,
|
|
701
|
+
const ref = (0, import_utils5.useObjectRef)(external);
|
|
960
702
|
const {
|
|
961
703
|
modalProps,
|
|
962
704
|
underlayProps
|
|
@@ -967,11 +709,11 @@ var Modal = (0, import_react14.forwardRef)(function ModalInner({
|
|
|
967
709
|
onClose,
|
|
968
710
|
isOpen
|
|
969
711
|
}, ref);
|
|
970
|
-
const theme = (0,
|
|
971
|
-
const isMobile = (0,
|
|
712
|
+
const theme = (0, import_styled_components4.useTheme)();
|
|
713
|
+
const isMobile = (0, import_styled2.useMedia)((0, import_utils4.maxWidth)(theme.breakpoint.screen1)) ?? false;
|
|
972
714
|
const transitionEnabled = isMobile && bottomSheet !== false;
|
|
973
715
|
const showDismiss = !isMobile || bottomSheet !== true;
|
|
974
|
-
const transition = (0,
|
|
716
|
+
const transition = (0, import_react_spring.useTransition)(isOpen, {
|
|
975
717
|
from: {
|
|
976
718
|
transform: "translateY(100%)",
|
|
977
719
|
backgroundColor: "rgba(0, 0, 0, 0)",
|
|
@@ -991,13 +733,13 @@ var Modal = (0, import_react14.forwardRef)(function ModalInner({
|
|
|
991
733
|
},
|
|
992
734
|
config: transitionEnabled ? {
|
|
993
735
|
duration: 400,
|
|
994
|
-
easing:
|
|
736
|
+
easing: import_react_spring.easings.easeOutQuart
|
|
995
737
|
} : {
|
|
996
738
|
duration: 0
|
|
997
739
|
}
|
|
998
740
|
});
|
|
999
|
-
const bgRef =
|
|
1000
|
-
const handleClick =
|
|
741
|
+
const bgRef = React13.useRef(null);
|
|
742
|
+
const handleClick = React13.useCallback((e) => {
|
|
1001
743
|
if (e.currentTarget === e.target) {
|
|
1002
744
|
onClose();
|
|
1003
745
|
}
|
|
@@ -1006,12 +748,15 @@ var Modal = (0, import_react14.forwardRef)(function ModalInner({
|
|
|
1006
748
|
backgroundColor,
|
|
1007
749
|
overflow,
|
|
1008
750
|
transform
|
|
1009
|
-
}, item) => item && /* @__PURE__ */ (0,
|
|
751
|
+
}, item) => item && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_overlays3.Overlay, { portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_spring.animated.div, { className: "charcoal-modal-background", ref: bgRef, ...underlayProps, style: transitionEnabled ? {
|
|
1010
752
|
backgroundColor,
|
|
1011
|
-
overflow
|
|
1012
|
-
|
|
753
|
+
overflow,
|
|
754
|
+
zIndex
|
|
755
|
+
} : {
|
|
756
|
+
zIndex
|
|
757
|
+
}, "data-bottom-sheet": bottomSheet, onClick: handleClick, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ModalBackgroundContext.Provider, { value: bgRef.current, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AnimatedDialog, { ref, ...modalProps, style: transitionEnabled ? {
|
|
1013
758
|
transform
|
|
1014
|
-
} : {}, size, bottomSheet, className, children: /* @__PURE__ */ (0,
|
|
759
|
+
} : {}, size, bottomSheet, className, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(ModalContext.Provider, { value: {
|
|
1015
760
|
titleProps: {},
|
|
1016
761
|
title,
|
|
1017
762
|
close: onClose,
|
|
@@ -1019,96 +764,63 @@ var Modal = (0, import_react14.forwardRef)(function ModalInner({
|
|
|
1019
764
|
bottomSheet
|
|
1020
765
|
}, children: [
|
|
1021
766
|
children,
|
|
1022
|
-
isDismissable === true && /* @__PURE__ */ (0,
|
|
767
|
+
isDismissable === true && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ModalCloseButton, { "aria-label": closeButtonAriaLabel, onClick: onClose })
|
|
1023
768
|
] }) }) }) }) }));
|
|
1024
769
|
});
|
|
1025
|
-
var
|
|
1026
|
-
var
|
|
770
|
+
var AnimatedDialog = (0, import_react_spring.animated)(Dialog);
|
|
771
|
+
var Modal_default = (0, import_react15.memo)(Modal);
|
|
772
|
+
var ModalContext = React13.createContext({
|
|
1027
773
|
titleProps: {},
|
|
1028
774
|
title: "",
|
|
1029
775
|
close: void 0,
|
|
1030
776
|
showDismiss: true,
|
|
1031
777
|
bottomSheet: false
|
|
1032
778
|
});
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
})(["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 ", "{", "}"], ({
|
|
1036
|
-
zIndex
|
|
1037
|
-
}) => zIndex, ({
|
|
1038
|
-
theme
|
|
1039
|
-
}) => (0, import_utils7.maxWidth)(theme.breakpoint.screen1), (p) => p.$bottomSheet !== false && (0, import_styled_components11.css)(["padding:0;"])));
|
|
1040
|
-
var ModalCrossButton = (0, import_styled_components11.default)(IconButton_default).withConfig({
|
|
1041
|
-
componentId: "ccl__sc-h2bc55-1"
|
|
1042
|
-
})(["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);}}"]);
|
|
1043
|
-
function ModalTitle(props) {
|
|
1044
|
-
const {
|
|
1045
|
-
titleProps,
|
|
1046
|
-
title
|
|
1047
|
-
} = (0, import_react14.useContext)(ModalContext);
|
|
1048
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ModalHeading, { ...titleProps, ...props, children: title });
|
|
779
|
+
function ModalCloseButton(props) {
|
|
780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(IconButton_default, { className: "charcoal-modal-close-button", size: "S", icon: "24/Close", type: "button", ...props });
|
|
1049
781
|
}
|
|
1050
|
-
var ModalHeading = import_styled_components11.default.h3.withConfig({
|
|
1051
|
-
componentId: "ccl__sc-h2bc55-2"
|
|
1052
|
-
})(["margin:0;font-weight:inherit;font-size:inherit;"]);
|
|
1053
782
|
|
|
1054
783
|
// src/components/Modal/ModalPlumbing.tsx
|
|
1055
|
-
var
|
|
1056
|
-
var
|
|
1057
|
-
var import_utils9 = require("@charcoal-ui/utils");
|
|
1058
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
784
|
+
var import_react16 = require("react");
|
|
785
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1059
786
|
function ModalHeader() {
|
|
1060
|
-
const modalCtx = (0,
|
|
1061
|
-
return /* @__PURE__ */ (0,
|
|
787
|
+
const modalCtx = (0, import_react16.useContext)(ModalContext);
|
|
788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "charcoal-modal-header-root", "data-bottom-sheet": modalCtx.bottomSheet, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "charcoal-modal-header-title", children: modalCtx.title }) });
|
|
789
|
+
}
|
|
790
|
+
var ModalAlign = createDivComponent("charcoal-modal-align");
|
|
791
|
+
var ModalBody = createDivComponent("charcoal-modal-body");
|
|
792
|
+
var ModalButtons = createDivComponent("charcoal-modal-buttons");
|
|
793
|
+
function createDivComponent(mainClassName) {
|
|
794
|
+
return (0, import_react16.forwardRef)(function DivComponent({
|
|
795
|
+
className,
|
|
796
|
+
...props
|
|
797
|
+
}, ref) {
|
|
798
|
+
const classNames = useClassNames(mainClassName, className);
|
|
799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: classNames, ref, ...props });
|
|
800
|
+
});
|
|
1062
801
|
}
|
|
1063
|
-
var ModalHeaderRoot = import_styled_components12.default.div.withConfig({
|
|
1064
|
-
componentId: "ccl__sc-1k33wze-0"
|
|
1065
|
-
})(["height:64px;display:grid;align-content:center;justify-content:center;@media ", "{", "}"], ({
|
|
1066
|
-
theme
|
|
1067
|
-
}) => (0, import_utils9.maxWidth)(theme.breakpoint.screen1), (p) => p.$bottomSheet !== false && (0, import_styled_components12.css)(["height:48px;"]));
|
|
1068
|
-
var StyledModalTitle = (0, import_styled_components12.default)(ModalTitle).withConfig({
|
|
1069
|
-
componentId: "ccl__sc-1k33wze-1"
|
|
1070
|
-
})(["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;}"]);
|
|
1071
|
-
var ModalAlign = import_styled_components12.default.div.withConfig({
|
|
1072
|
-
componentId: "ccl__sc-1k33wze-2"
|
|
1073
|
-
})(["padding-left:16px;padding-right:16px;"]);
|
|
1074
|
-
var ModalBody = import_styled_components12.default.div.withConfig({
|
|
1075
|
-
componentId: "ccl__sc-1k33wze-3"
|
|
1076
|
-
})(["padding-bottom:40px;"]);
|
|
1077
|
-
var ModalButtons = import_styled_components12.default.div.withConfig({
|
|
1078
|
-
componentId: "ccl__sc-1k33wze-4"
|
|
1079
|
-
})(["display:grid;grid-auto-flow:row;grid-row-gap:8px;padding-top:16px;padding-left:16px;padding-right:16px;"]);
|
|
1080
802
|
|
|
1081
803
|
// src/components/LoadingSpinner/index.tsx
|
|
1082
|
-
var
|
|
1083
|
-
var
|
|
1084
|
-
var
|
|
1085
|
-
var LoadingSpinner = (0, import_react16.forwardRef)(function LoadingSpinnerInner({
|
|
804
|
+
var import_react17 = require("react");
|
|
805
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
806
|
+
var LoadingSpinner = (0, import_react17.forwardRef)(function LoadingSpinnerInner({
|
|
1086
807
|
size = 48,
|
|
1087
808
|
padding = 16,
|
|
1088
809
|
transparent = false,
|
|
1089
|
-
|
|
810
|
+
...props
|
|
1090
811
|
}, ref) {
|
|
1091
|
-
|
|
812
|
+
const classNames = useClassNames("charcoal-loading-spinner", props.className);
|
|
813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { role: "progressbar", style: {
|
|
814
|
+
"--charcoal-loading-spinner-size": `${size}px`,
|
|
815
|
+
"--charcoal-loading-spinner-padding": `${padding}px`
|
|
816
|
+
}, "data-transparent": transparent, className: classNames, ref, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LoadingSpinnerIcon, {}) });
|
|
1092
817
|
});
|
|
1093
|
-
var LoadingSpinner_default = (0,
|
|
1094
|
-
var
|
|
1095
|
-
role: "progressbar"
|
|
1096
|
-
}).withConfig({
|
|
1097
|
-
componentId: "ccl__sc-1id6yz4-0"
|
|
1098
|
-
})(["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, ({
|
|
1099
|
-
transparent
|
|
1100
|
-
}) => `var(--charcoal-${transparent ? "transparent" : "background1"})`);
|
|
1101
|
-
var scaleOut = (0, import_styled_components13.keyframes)(["from{transform:scale(0);opacity:1;}to{transform:scale(1);opacity:0;}"]);
|
|
1102
|
-
var Icon2 = import_styled_components13.default.div.attrs({
|
|
1103
|
-
role: "presentation"
|
|
1104
|
-
}).withConfig({
|
|
1105
|
-
componentId: "ccl__sc-1id6yz4-1"
|
|
1106
|
-
})(["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");
|
|
1107
|
-
var LoadingSpinnerIcon = (0, import_react16.forwardRef)(function LoadingSpinnerIcon2({
|
|
818
|
+
var LoadingSpinner_default = (0, import_react17.memo)(LoadingSpinner);
|
|
819
|
+
var LoadingSpinnerIcon = (0, import_react17.forwardRef)(function LoadingSpinnerIcon2({
|
|
1108
820
|
once = false
|
|
1109
821
|
}, ref) {
|
|
1110
|
-
const iconRef = (0,
|
|
1111
|
-
(0,
|
|
822
|
+
const iconRef = (0, import_react17.useRef)(null);
|
|
823
|
+
(0, import_react17.useImperativeHandle)(ref, () => ({
|
|
1112
824
|
restart: () => {
|
|
1113
825
|
if (!iconRef.current) {
|
|
1114
826
|
return;
|
|
@@ -1118,25 +830,25 @@ var LoadingSpinnerIcon = (0, import_react16.forwardRef)(function LoadingSpinnerI
|
|
|
1118
830
|
delete iconRef.current.dataset.resetAnimation;
|
|
1119
831
|
}
|
|
1120
832
|
}));
|
|
1121
|
-
return /* @__PURE__ */ (0,
|
|
833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { role: "presentation", ref: iconRef, "data-once": once, className: "charcoal-loading-spinner-icon" });
|
|
1122
834
|
});
|
|
1123
835
|
|
|
1124
836
|
// src/components/DropdownSelector/index.tsx
|
|
1125
|
-
var
|
|
1126
|
-
var
|
|
1127
|
-
var
|
|
837
|
+
var import_react22 = require("react");
|
|
838
|
+
var import_styled_components7 = __toESM(require("styled-components"));
|
|
839
|
+
var import_utils6 = require("@charcoal-ui/utils");
|
|
1128
840
|
|
|
1129
841
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
1130
|
-
var
|
|
842
|
+
var import_react19 = require("react");
|
|
1131
843
|
|
|
1132
844
|
// src/components/DropdownSelector/Popover/index.tsx
|
|
1133
|
-
var
|
|
845
|
+
var import_react18 = require("react");
|
|
1134
846
|
var import_overlays4 = require("@react-aria/overlays");
|
|
1135
|
-
var
|
|
1136
|
-
var
|
|
847
|
+
var import_styled_components5 = __toESM(require("styled-components"));
|
|
848
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1137
849
|
var _empty = () => null;
|
|
1138
850
|
function Popover(props) {
|
|
1139
|
-
const defaultPopoverRef = (0,
|
|
851
|
+
const defaultPopoverRef = (0, import_react18.useRef)(null);
|
|
1140
852
|
const finalPopoverRef = props.popoverRef === void 0 ? defaultPopoverRef : props.popoverRef;
|
|
1141
853
|
const {
|
|
1142
854
|
popoverProps,
|
|
@@ -1152,40 +864,40 @@ function Popover(props) {
|
|
|
1152
864
|
setOpen: _empty,
|
|
1153
865
|
toggle: _empty
|
|
1154
866
|
});
|
|
1155
|
-
const modalBackground = (0,
|
|
867
|
+
const modalBackground = (0, import_react18.useContext)(ModalBackgroundContext);
|
|
1156
868
|
usePreventScroll(modalBackground, props.isOpen);
|
|
1157
869
|
if (!props.isOpen)
|
|
1158
870
|
return null;
|
|
1159
|
-
return /* @__PURE__ */ (0,
|
|
1160
|
-
/* @__PURE__ */ (0,
|
|
871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_overlays4.Overlay, { portalContainer: document.body, children: [
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ...underlayProps, style: {
|
|
1161
873
|
position: "fixed",
|
|
1162
874
|
zIndex: typeof popoverProps.style?.zIndex === "number" ? popoverProps.style.zIndex - 1 : 99999,
|
|
1163
875
|
inset: 0
|
|
1164
876
|
} }),
|
|
1165
|
-
/* @__PURE__ */ (0,
|
|
1166
|
-
/* @__PURE__ */ (0,
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownPopoverDiv, { ...popoverProps, ref: finalPopoverRef, children: [
|
|
878
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_overlays4.DismissButton, { onDismiss: () => props.onClose() }),
|
|
1167
879
|
props.children,
|
|
1168
|
-
/* @__PURE__ */ (0,
|
|
880
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_overlays4.DismissButton, { onDismiss: () => props.onClose() })
|
|
1169
881
|
] })
|
|
1170
882
|
] });
|
|
1171
883
|
}
|
|
1172
|
-
var DropdownPopoverDiv =
|
|
884
|
+
var DropdownPopoverDiv = import_styled_components5.default.div.withConfig({
|
|
1173
885
|
componentId: "ccl__sc-jwnoy6-0"
|
|
1174
886
|
})(["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;"]);
|
|
1175
887
|
|
|
1176
888
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
1177
|
-
var
|
|
889
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1178
890
|
function DropdownPopover({
|
|
1179
891
|
children,
|
|
1180
892
|
...props
|
|
1181
893
|
}) {
|
|
1182
|
-
const ref = (0,
|
|
1183
|
-
(0,
|
|
894
|
+
const ref = (0, import_react19.useRef)(null);
|
|
895
|
+
(0, import_react19.useEffect)(() => {
|
|
1184
896
|
if (props.isOpen && ref.current && props.triggerRef.current) {
|
|
1185
897
|
ref.current.style.width = `${props.triggerRef.current.clientWidth}px`;
|
|
1186
898
|
}
|
|
1187
899
|
}, [props.triggerRef, props.isOpen]);
|
|
1188
|
-
(0,
|
|
900
|
+
(0, import_react19.useEffect)(() => {
|
|
1189
901
|
if (props.isOpen && props.value !== void 0) {
|
|
1190
902
|
const windowScrollY = window.scrollY;
|
|
1191
903
|
const windowScrollX = window.scrollX;
|
|
@@ -1194,16 +906,16 @@ function DropdownPopover({
|
|
|
1194
906
|
window.scrollTo(windowScrollX, windowScrollY);
|
|
1195
907
|
}
|
|
1196
908
|
}, [props.value, props.isOpen]);
|
|
1197
|
-
return /* @__PURE__ */ (0,
|
|
909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Popover, { isOpen: props.isOpen, onClose: props.onClose, popoverRef: ref, triggerRef: props.triggerRef, children });
|
|
1198
910
|
}
|
|
1199
911
|
|
|
1200
912
|
// src/components/DropdownSelector/utils/findPreviewRecursive.tsx
|
|
1201
|
-
var
|
|
913
|
+
var React14 = __toESM(require("react"));
|
|
1202
914
|
function findPreviewRecursive(children, value) {
|
|
1203
|
-
const childArray =
|
|
915
|
+
const childArray = React14.Children.toArray(children);
|
|
1204
916
|
for (let i = 0; i < childArray.length; i++) {
|
|
1205
917
|
const child = childArray[i];
|
|
1206
|
-
if (
|
|
918
|
+
if (React14.isValidElement(child)) {
|
|
1207
919
|
if ("value" in child.props) {
|
|
1208
920
|
const childValue = child.props.value;
|
|
1209
921
|
if (childValue === value && "children" in child.props) {
|
|
@@ -1222,12 +934,12 @@ function findPreviewRecursive(children, value) {
|
|
|
1222
934
|
}
|
|
1223
935
|
|
|
1224
936
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
1225
|
-
var
|
|
1226
|
-
var
|
|
937
|
+
var import_react21 = require("react");
|
|
938
|
+
var import_styled_components6 = __toESM(require("styled-components"));
|
|
1227
939
|
|
|
1228
940
|
// src/components/DropdownSelector/MenuList/MenuListContext.ts
|
|
1229
|
-
var
|
|
1230
|
-
var MenuListContext = (0,
|
|
941
|
+
var import_react20 = require("react");
|
|
942
|
+
var MenuListContext = (0, import_react20.createContext)({
|
|
1231
943
|
root: void 0,
|
|
1232
944
|
value: "",
|
|
1233
945
|
propsArray: [],
|
|
@@ -1236,13 +948,13 @@ var MenuListContext = (0, import_react19.createContext)({
|
|
|
1236
948
|
});
|
|
1237
949
|
|
|
1238
950
|
// src/components/DropdownSelector/MenuList/internals/getValuesRecursive.tsx
|
|
1239
|
-
var
|
|
951
|
+
var React15 = __toESM(require("react"));
|
|
1240
952
|
function getValuesRecursive(children) {
|
|
1241
|
-
const childArray =
|
|
953
|
+
const childArray = React15.Children.toArray(children);
|
|
1242
954
|
const propsArray = [];
|
|
1243
955
|
for (let i = 0; i < childArray.length; i++) {
|
|
1244
956
|
const child = childArray[i];
|
|
1245
|
-
if (
|
|
957
|
+
if (React15.isValidElement(child)) {
|
|
1246
958
|
const props = child.props;
|
|
1247
959
|
if ("value" in props && typeof props.value === "string") {
|
|
1248
960
|
propsArray.push({
|
|
@@ -1259,11 +971,11 @@ function getValuesRecursive(children) {
|
|
|
1259
971
|
}
|
|
1260
972
|
|
|
1261
973
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
1262
|
-
var
|
|
974
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1263
975
|
function MenuList(props) {
|
|
1264
|
-
const root = (0,
|
|
1265
|
-
const propsArray = (0,
|
|
1266
|
-
return /* @__PURE__ */ (0,
|
|
976
|
+
const root = (0, import_react21.useRef)(null);
|
|
977
|
+
const propsArray = (0, import_react21.useMemo)(() => getValuesRecursive(props.children), [props.children]);
|
|
978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StyledUl, { ref: root, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MenuListContext.Provider, { value: {
|
|
1267
979
|
value: props.value ?? "",
|
|
1268
980
|
root,
|
|
1269
981
|
propsArray,
|
|
@@ -1272,97 +984,89 @@ function MenuList(props) {
|
|
|
1272
984
|
}
|
|
1273
985
|
}, children: props.children }) });
|
|
1274
986
|
}
|
|
1275
|
-
var StyledUl =
|
|
987
|
+
var StyledUl = import_styled_components6.default.ul.withConfig({
|
|
1276
988
|
componentId: "ccl__sc-1y72v02-0"
|
|
1277
989
|
})(["padding:0;margin:0;"]);
|
|
1278
990
|
|
|
1279
991
|
// src/components/DropdownSelector/index.tsx
|
|
1280
|
-
var
|
|
992
|
+
var import_styled3 = require("@charcoal-ui/styled");
|
|
1281
993
|
var import_visually_hidden3 = require("@react-aria/visually-hidden");
|
|
1282
|
-
var
|
|
994
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1283
995
|
var defaultRequiredText = "*\u5FC5\u9808";
|
|
1284
996
|
function DropdownSelector({
|
|
1285
997
|
onChange,
|
|
1286
998
|
...props
|
|
1287
999
|
}) {
|
|
1288
|
-
const triggerRef = (0,
|
|
1289
|
-
const [isOpen, setIsOpen] = (0,
|
|
1000
|
+
const triggerRef = (0, import_react22.useRef)(null);
|
|
1001
|
+
const [isOpen, setIsOpen] = (0, import_react22.useState)(false);
|
|
1290
1002
|
const preview = findPreviewRecursive(props.children, props.value);
|
|
1291
|
-
const isPlaceholder = (0,
|
|
1003
|
+
const isPlaceholder = (0, import_react22.useMemo)(() => props.placeholder !== void 0 && preview === void 0, [preview, props.placeholder]);
|
|
1292
1004
|
const propsArray = getValuesRecursive(props.children);
|
|
1293
1005
|
const {
|
|
1294
1006
|
visuallyHiddenProps
|
|
1295
1007
|
} = (0, import_visually_hidden3.useVisuallyHidden)();
|
|
1296
|
-
const handleChange = (0,
|
|
1008
|
+
const handleChange = (0, import_react22.useCallback)((e) => {
|
|
1297
1009
|
onChange(e.target.value);
|
|
1298
1010
|
}, [onChange]);
|
|
1299
|
-
return /* @__PURE__ */ (0,
|
|
1300
|
-
props.showLabel === true && /* @__PURE__ */ (0,
|
|
1301
|
-
/* @__PURE__ */ (0,
|
|
1302
|
-
return /* @__PURE__ */ (0,
|
|
1011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownSelectorRoot, { "aria-disabled": props.disabled, children: [
|
|
1012
|
+
props.showLabel === true && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FieldLabel_default, { label: props.label, required: props.required, requiredText: props.requiredText ?? defaultRequiredText, subLabel: props.subLabel }),
|
|
1013
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { ...visuallyHiddenProps, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { name: props.name, value: props.value, onChange: handleChange, tabIndex: -1, children: propsArray.map((itemProps) => {
|
|
1014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: itemProps.value, disabled: itemProps.disabled, children: itemProps.value }, itemProps.value);
|
|
1303
1015
|
}) }) }),
|
|
1304
|
-
/* @__PURE__ */ (0,
|
|
1016
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownButton, { invalid: props.invalid, disabled: props.disabled, onClick: () => {
|
|
1305
1017
|
if (props.disabled === true)
|
|
1306
1018
|
return;
|
|
1307
1019
|
setIsOpen(true);
|
|
1308
1020
|
}, ref: triggerRef, type: "button", $active: isOpen, children: [
|
|
1309
|
-
/* @__PURE__ */ (0,
|
|
1310
|
-
/* @__PURE__ */ (0,
|
|
1021
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownButtonText, { $isText3: isPlaceholder, children: isPlaceholder ? props.placeholder : preview }),
|
|
1022
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownButtonIcon, { name: "16/Menu" })
|
|
1311
1023
|
] }),
|
|
1312
|
-
isOpen && /* @__PURE__ */ (0,
|
|
1024
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownPopover, { isOpen, onClose: () => setIsOpen(false), triggerRef, value: props.value, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MenuList, { value: props.value, onChange: (v) => {
|
|
1313
1025
|
onChange(v);
|
|
1314
1026
|
setIsOpen(false);
|
|
1315
1027
|
}, children: props.children }) }),
|
|
1316
|
-
props.assistiveText !== void 0 && /* @__PURE__ */ (0,
|
|
1028
|
+
props.assistiveText !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AssistiveText, { invalid: props.invalid === true, children: props.assistiveText })
|
|
1317
1029
|
] });
|
|
1318
1030
|
}
|
|
1319
|
-
var DropdownSelectorRoot =
|
|
1031
|
+
var DropdownSelectorRoot = import_styled_components7.default.div.withConfig({
|
|
1320
1032
|
componentId: "ccl__sc-1vnxmc8-0"
|
|
1321
|
-
})(["display:
|
|
1322
|
-
var
|
|
1033
|
+
})(["display:grid;grid-template-columns:1fr;grid-gap:4px;width:100%;", "{cursor:default;opacity:0.32;}"], import_utils6.disabledSelector);
|
|
1034
|
+
var DropdownButton = import_styled_components7.default.button.withConfig({
|
|
1323
1035
|
componentId: "ccl__sc-1vnxmc8-1"
|
|
1324
|
-
})(["width:100%;
|
|
1325
|
-
var DropdownButton = import_styled_components16.default.button.withConfig({
|
|
1326
|
-
componentId: "ccl__sc-1vnxmc8-2"
|
|
1327
|
-
})(["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']{", " ", "}", ""], import_utils10.disabledSelector, import_styled7.focusVisibleFocusRingCss, ({
|
|
1036
|
+
})(["display:grid;grid-template-columns:1fr auto;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']{", " ", "}", ""], import_utils6.disabledSelector, import_styled3.focusVisibleFocusRingCss, ({
|
|
1328
1037
|
$active
|
|
1329
|
-
}) => $active === true ? (0,
|
|
1038
|
+
}) => $active === true ? (0, import_styled_components7.css)(["background-color:var(--charcoal-surface3-press);"]) : (0, import_styled_components7.css)(["&:hover{background-color:var(--charcoal-surface3-hover);}&:active{background-color:var(--charcoal-surface3-press);}"]), ({
|
|
1330
1039
|
invalid
|
|
1331
|
-
}) => invalid === true && (0,
|
|
1332
|
-
var DropdownButtonText =
|
|
1333
|
-
componentId: "ccl__sc-1vnxmc8-
|
|
1040
|
+
}) => invalid === true && (0, import_styled_components7.css)(["&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}"]));
|
|
1041
|
+
var DropdownButtonText = import_styled_components7.default.span.withConfig({
|
|
1042
|
+
componentId: "ccl__sc-1vnxmc8-2"
|
|
1334
1043
|
})(["text-align:left;font-size:14px;line-height:22px;display:flow-root;color:var(--charcoal-", ");overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"], (p) => p.$isText3 ? "text3" : "text2");
|
|
1335
|
-
var DropdownButtonIcon = (0,
|
|
1336
|
-
componentId: "ccl__sc-1vnxmc8-
|
|
1044
|
+
var DropdownButtonIcon = (0, import_styled_components7.default)(Icon_default).withConfig({
|
|
1045
|
+
componentId: "ccl__sc-1vnxmc8-3"
|
|
1337
1046
|
})(["color:var(--charcoal-text2);"]);
|
|
1338
|
-
var AssertiveText = import_styled_components16.default.div.withConfig({
|
|
1339
|
-
componentId: "ccl__sc-1vnxmc8-5"
|
|
1340
|
-
})(["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;}", ""], ({
|
|
1341
|
-
invalid
|
|
1342
|
-
}) => invalid === true && (0, import_styled_components16.css)(["color:var(--charcoal-assertive);"]));
|
|
1343
1047
|
|
|
1344
1048
|
// src/components/DropdownSelector/DropdownMenuItem.tsx
|
|
1345
|
-
var
|
|
1049
|
+
var import_styled_components9 = __toESM(require("styled-components"));
|
|
1346
1050
|
|
|
1347
1051
|
// src/components/DropdownSelector/ListItem/index.tsx
|
|
1348
|
-
var
|
|
1349
|
-
var
|
|
1052
|
+
var import_styled_components8 = __toESM(require("styled-components"));
|
|
1053
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1350
1054
|
function ListItem(props) {
|
|
1351
1055
|
const {
|
|
1352
1056
|
children,
|
|
1353
1057
|
...rest
|
|
1354
1058
|
} = props;
|
|
1355
|
-
return /* @__PURE__ */ (0,
|
|
1059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyledLi, { role: "option", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemDiv, { ...rest, children: props.children }) });
|
|
1356
1060
|
}
|
|
1357
|
-
var StyledLi =
|
|
1061
|
+
var StyledLi = import_styled_components8.default.li.withConfig({
|
|
1358
1062
|
componentId: "ccl__sc-p1vs75-0"
|
|
1359
1063
|
})(["list-style:none;"]);
|
|
1360
|
-
var ItemDiv =
|
|
1064
|
+
var ItemDiv = import_styled_components8.default.div.withConfig({
|
|
1361
1065
|
componentId: "ccl__sc-p1vs75-1"
|
|
1362
1066
|
})(["display:flex;align-items:center;min-height:40px;cursor:pointer;outline:none;padding-right:16px;padding-left:16px;transition:background-color 0.2s;&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}:hover,:focus,:focus-within{&:not(disabled):not([aria-disabled='true']){background-color:var(--charcoal-surface3);}}"]);
|
|
1363
1067
|
|
|
1364
1068
|
// src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
|
|
1365
|
-
var
|
|
1069
|
+
var import_react23 = require("react");
|
|
1366
1070
|
|
|
1367
1071
|
// src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx
|
|
1368
1072
|
function handleFocusByKeyBoard(element, parent) {
|
|
@@ -1399,12 +1103,12 @@ function useMenuItemHandleKeyDown(value) {
|
|
|
1399
1103
|
setValue,
|
|
1400
1104
|
root,
|
|
1401
1105
|
propsArray
|
|
1402
|
-
} = (0,
|
|
1403
|
-
const setContextValue = (0,
|
|
1106
|
+
} = (0, import_react23.useContext)(MenuListContext);
|
|
1107
|
+
const setContextValue = (0, import_react23.useCallback)(() => {
|
|
1404
1108
|
if (value !== void 0)
|
|
1405
1109
|
setValue(value);
|
|
1406
1110
|
}, [value, setValue]);
|
|
1407
|
-
const handleKeyDown = (0,
|
|
1111
|
+
const handleKeyDown = (0, import_react23.useCallback)((e) => {
|
|
1408
1112
|
if (e.key === "Enter") {
|
|
1409
1113
|
setContextValue();
|
|
1410
1114
|
} else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
@@ -1439,7 +1143,7 @@ function useMenuItemHandleKeyDown(value) {
|
|
|
1439
1143
|
}
|
|
1440
1144
|
|
|
1441
1145
|
// src/components/DropdownSelector/MenuItem/index.tsx
|
|
1442
|
-
var
|
|
1146
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1443
1147
|
function MenuItem(props) {
|
|
1444
1148
|
const {
|
|
1445
1149
|
children,
|
|
@@ -1447,81 +1151,81 @@ function MenuItem(props) {
|
|
|
1447
1151
|
...rest
|
|
1448
1152
|
} = props;
|
|
1449
1153
|
const [handleKeyDown, setContextValue] = useMenuItemHandleKeyDown(props.value);
|
|
1450
|
-
return /* @__PURE__ */ (0,
|
|
1154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(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 });
|
|
1451
1155
|
}
|
|
1452
1156
|
|
|
1453
1157
|
// src/components/DropdownSelector/DropdownMenuItem.tsx
|
|
1454
|
-
var
|
|
1455
|
-
var
|
|
1158
|
+
var import_react24 = require("react");
|
|
1159
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1456
1160
|
function DropdownMenuItem(props) {
|
|
1457
1161
|
const {
|
|
1458
1162
|
value: ctxValue
|
|
1459
|
-
} = (0,
|
|
1163
|
+
} = (0, import_react24.useContext)(MenuListContext);
|
|
1460
1164
|
const isSelected = props.value === ctxValue;
|
|
1461
1165
|
const {
|
|
1462
1166
|
children,
|
|
1463
1167
|
...rest
|
|
1464
1168
|
} = props;
|
|
1465
|
-
return /* @__PURE__ */ (0,
|
|
1466
|
-
isSelected && /* @__PURE__ */ (0,
|
|
1467
|
-
/* @__PURE__ */ (0,
|
|
1169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(MenuItem, { ...rest, children: [
|
|
1170
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text2ColorIcon, { name: "16/Check" }),
|
|
1171
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StyledSpan, { isSelected, children: props.children })
|
|
1468
1172
|
] });
|
|
1469
1173
|
}
|
|
1470
|
-
var StyledSpan =
|
|
1174
|
+
var StyledSpan = import_styled_components9.default.span.withConfig({
|
|
1471
1175
|
componentId: "ccl__sc-108wg2j-0"
|
|
1472
1176
|
})(["font-size:14px;line-height:22px;color:var(--charcoal-text2);padding:9px 0;display:flex;align-items:center;width:100%;margin-left:", "px;"], ({
|
|
1473
1177
|
isSelected
|
|
1474
1178
|
}) => isSelected === true ? 0 : 20);
|
|
1475
|
-
var Text2ColorIcon = (0,
|
|
1179
|
+
var Text2ColorIcon = (0, import_styled_components9.default)(Icon_default).withConfig({
|
|
1476
1180
|
componentId: "ccl__sc-108wg2j-1"
|
|
1477
1181
|
})(["color:var(--charcoal-text2);padding-right:4px;"]);
|
|
1478
1182
|
|
|
1479
1183
|
// src/components/DropdownSelector/MenuItemGroup/index.tsx
|
|
1480
|
-
var
|
|
1481
|
-
var
|
|
1184
|
+
var import_styled_components10 = __toESM(require("styled-components"));
|
|
1185
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1482
1186
|
function MenuItemGroup(props) {
|
|
1483
|
-
return /* @__PURE__ */ (0,
|
|
1484
|
-
/* @__PURE__ */ (0,
|
|
1485
|
-
/* @__PURE__ */ (0,
|
|
1187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(StyledLi2, { role: "presentation", children: [
|
|
1188
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TextSpan, { children: props.text }),
|
|
1189
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(StyledUl2, { role: "group", children: props.children })
|
|
1486
1190
|
] });
|
|
1487
1191
|
}
|
|
1488
|
-
var TextSpan =
|
|
1192
|
+
var TextSpan = import_styled_components10.default.span.withConfig({
|
|
1489
1193
|
componentId: "ccl__sc-1ubjfz7-0"
|
|
1490
1194
|
})(["display:block;color:var(--charcoal-text3);font-size:12px;font-weight:bold;padding:12px 0 8px 16px;"]);
|
|
1491
|
-
var StyledUl2 =
|
|
1195
|
+
var StyledUl2 = import_styled_components10.default.ul.withConfig({
|
|
1492
1196
|
componentId: "ccl__sc-1ubjfz7-1"
|
|
1493
1197
|
})(["padding-left:0;margin:0;box-sizing:border-box;list-style:none;overflow:hidden;"]);
|
|
1494
|
-
var StyledLi2 =
|
|
1198
|
+
var StyledLi2 = import_styled_components10.default.li.withConfig({
|
|
1495
1199
|
componentId: "ccl__sc-1ubjfz7-2"
|
|
1496
1200
|
})(["display:block;"]);
|
|
1497
1201
|
|
|
1498
1202
|
// src/components/SegmentedControl/index.tsx
|
|
1499
|
-
var
|
|
1203
|
+
var import_react26 = require("react");
|
|
1500
1204
|
var import_radio = require("@react-stately/radio");
|
|
1501
1205
|
var import_radio2 = require("@react-aria/radio");
|
|
1502
|
-
var import_styled_components20 = __toESM(require("styled-components"));
|
|
1503
1206
|
|
|
1504
1207
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
1505
|
-
var
|
|
1506
|
-
var
|
|
1507
|
-
var RadioContext = (0,
|
|
1208
|
+
var import_react25 = require("react");
|
|
1209
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1210
|
+
var RadioContext = (0, import_react25.createContext)(null);
|
|
1508
1211
|
var RadioProvider = ({
|
|
1509
1212
|
value,
|
|
1510
1213
|
children
|
|
1511
1214
|
}) => {
|
|
1512
|
-
return /* @__PURE__ */ (0,
|
|
1215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RadioContext.Provider, { value, children });
|
|
1513
1216
|
};
|
|
1514
1217
|
var useRadioContext = () => {
|
|
1515
|
-
const state = (0,
|
|
1218
|
+
const state = (0, import_react25.useContext)(RadioContext);
|
|
1516
1219
|
if (state === null)
|
|
1517
1220
|
throw new Error("`<RadioProvider>` is not likely mounted.");
|
|
1518
1221
|
return state;
|
|
1519
1222
|
};
|
|
1520
1223
|
|
|
1521
1224
|
// src/components/SegmentedControl/index.tsx
|
|
1522
|
-
var
|
|
1523
|
-
var SegmentedControl = (0,
|
|
1524
|
-
const
|
|
1225
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1226
|
+
var SegmentedControl = (0, import_react26.forwardRef)(function SegmentedControlInner(props, ref) {
|
|
1227
|
+
const className = useClassNames("charcoal-segmented-control", props.className);
|
|
1228
|
+
const ariaRadioGroupProps = (0, import_react26.useMemo)(() => ({
|
|
1525
1229
|
...props,
|
|
1526
1230
|
isDisabled: props.disabled,
|
|
1527
1231
|
isReadOnly: props.readonly,
|
|
@@ -1532,19 +1236,19 @@ var SegmentedControl = (0, import_react25.forwardRef)(function SegmentedControlI
|
|
|
1532
1236
|
const {
|
|
1533
1237
|
radioGroupProps
|
|
1534
1238
|
} = (0, import_radio2.useRadioGroup)(ariaRadioGroupProps, state);
|
|
1535
|
-
const segmentedControlItems = (0,
|
|
1239
|
+
const segmentedControlItems = (0, import_react26.useMemo)(() => {
|
|
1536
1240
|
return props.data.map((d) => typeof d === "string" ? {
|
|
1537
1241
|
value: d,
|
|
1538
1242
|
label: d
|
|
1539
1243
|
} : d);
|
|
1540
1244
|
}, [props.data]);
|
|
1541
|
-
return /* @__PURE__ */ (0,
|
|
1245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref, ...radioGroupProps, className, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Segmented, { value: item.value, disabled: item.disabled, children: item.label }, item.value)) }) });
|
|
1542
1246
|
});
|
|
1543
|
-
var SegmentedControl_default = (0,
|
|
1247
|
+
var SegmentedControl_default = (0, import_react26.memo)(SegmentedControl);
|
|
1544
1248
|
var Segmented = (props) => {
|
|
1545
1249
|
const state = useRadioContext();
|
|
1546
|
-
const ref = (0,
|
|
1547
|
-
const ariaRadioProps = (0,
|
|
1250
|
+
const ref = (0, import_react26.useRef)(null);
|
|
1251
|
+
const ariaRadioProps = (0, import_react26.useMemo)(() => ({
|
|
1548
1252
|
value: props.value,
|
|
1549
1253
|
isDisabled: props.disabled,
|
|
1550
1254
|
children: props.children
|
|
@@ -1554,180 +1258,103 @@ var Segmented = (props) => {
|
|
|
1554
1258
|
isDisabled,
|
|
1555
1259
|
isSelected
|
|
1556
1260
|
} = (0, import_radio2.useRadio)(ariaRadioProps, state, ref);
|
|
1557
|
-
return /* @__PURE__ */ (0,
|
|
1558
|
-
/* @__PURE__ */ (0,
|
|
1559
|
-
|
|
1261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "charcoal-segmented-control-radio__label", "aria-disabled": isDisabled || state.isReadOnly, "data-checked": isSelected, children: [
|
|
1262
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { className: "charcoal-segmented-control-radio__input", ...inputProps, ref }),
|
|
1263
|
+
props.children
|
|
1560
1264
|
] });
|
|
1561
1265
|
};
|
|
1562
|
-
var SegmentedControlRoot = import_styled_components20.default.div.withConfig({
|
|
1563
|
-
componentId: "ccl__sc-1xmkkqt-0"
|
|
1564
|
-
})(["display:inline-flex;align-items:center;background-color:var(--charcoal-surface3);border-radius:16px;"]);
|
|
1565
|
-
var SegmentedRoot = import_styled_components20.default.label.withConfig({
|
|
1566
|
-
componentId: "ccl__sc-1xmkkqt-1"
|
|
1567
|
-
})(["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);", ""], ({
|
|
1568
|
-
checked = false
|
|
1569
|
-
}) => checked && (0, import_styled_components20.css)(["background-color:var(--charcoal-brand);color:var(--charcoal-text5);"]));
|
|
1570
|
-
var SegmentedInput = import_styled_components20.default.input.withConfig({
|
|
1571
|
-
componentId: "ccl__sc-1xmkkqt-2"
|
|
1572
|
-
})(["position:absolute;height:0px;width:0px;padding:0;margin:0;appearance:none;box-sizing:border-box;overflow:hidden;white-space:nowrap;opacity:0;"]);
|
|
1573
|
-
var RadioLabel2 = import_styled_components20.default.div.withConfig({
|
|
1574
|
-
componentId: "ccl__sc-1xmkkqt-3"
|
|
1575
|
-
})(["background:transparent;display:flex;align-items:center;height:22px;"]);
|
|
1576
|
-
var SegmentedLabelInner = import_styled_components20.default.div.withConfig({
|
|
1577
|
-
componentId: "ccl__sc-1xmkkqt-4"
|
|
1578
|
-
})(["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;}"]);
|
|
1579
1266
|
|
|
1580
1267
|
// src/components/Checkbox/index.tsx
|
|
1581
|
-
var
|
|
1582
|
-
var
|
|
1268
|
+
var import_react29 = require("react");
|
|
1269
|
+
var import_utils7 = require("@react-aria/utils");
|
|
1583
1270
|
|
|
1584
|
-
// src/components/CheckboxInput/index.tsx
|
|
1585
|
-
var
|
|
1586
|
-
var
|
|
1587
|
-
var CheckboxInput = (0,
|
|
1271
|
+
// src/components/Checkbox/CheckboxInput/index.tsx
|
|
1272
|
+
var import_react27 = require("react");
|
|
1273
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1274
|
+
var CheckboxInput = (0, import_react27.forwardRef)(function CheckboxInput2({
|
|
1588
1275
|
onChange,
|
|
1589
1276
|
checked,
|
|
1590
1277
|
invalid,
|
|
1278
|
+
className,
|
|
1279
|
+
rounded,
|
|
1591
1280
|
...props
|
|
1592
1281
|
}, ref) {
|
|
1593
|
-
const handleChange = (0,
|
|
1282
|
+
const handleChange = (0, import_react27.useCallback)((e) => {
|
|
1594
1283
|
const el = e.currentTarget;
|
|
1595
1284
|
onChange?.(el.checked);
|
|
1596
1285
|
}, [onChange]);
|
|
1597
|
-
const classNames = useClassNames("charcoal-checkbox-
|
|
1598
|
-
return /* @__PURE__ */ (0,
|
|
1599
|
-
|
|
1600
|
-
|
|
1286
|
+
const classNames = useClassNames("charcoal-checkbox-input", className);
|
|
1287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { className: classNames, ref, type: "checkbox", onChange: handleChange, "aria-invalid": invalid, checked, "data-rounded": rounded, ...props });
|
|
1288
|
+
});
|
|
1289
|
+
var CheckboxInput_default = (0, import_react27.memo)(CheckboxInput);
|
|
1290
|
+
|
|
1291
|
+
// src/components/Checkbox/CheckboxWithLabel.tsx
|
|
1292
|
+
var import_react28 = __toESM(require("react"));
|
|
1293
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1294
|
+
var CheckboxWithLabel = import_react28.default.memo(function CheckboxWithLabel2({
|
|
1295
|
+
className,
|
|
1296
|
+
children,
|
|
1297
|
+
input,
|
|
1298
|
+
id,
|
|
1299
|
+
disabled
|
|
1300
|
+
}) {
|
|
1301
|
+
const classNames = useClassNames("charcoal-checkbox__label", className);
|
|
1302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { htmlFor: id, "aria-disabled": disabled, className: classNames, children: [
|
|
1303
|
+
input,
|
|
1304
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "charcoal-checkbox__label_div", children })
|
|
1601
1305
|
] });
|
|
1602
1306
|
});
|
|
1603
|
-
var CheckboxInput_default = (0, import_react26.memo)(CheckboxInput);
|
|
1604
1307
|
|
|
1605
1308
|
// src/components/Checkbox/index.tsx
|
|
1606
|
-
var
|
|
1607
|
-
var Checkbox = (0,
|
|
1309
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1310
|
+
var Checkbox = (0, import_react29.forwardRef)(function Checkbox2({
|
|
1608
1311
|
disabled,
|
|
1609
1312
|
className,
|
|
1610
1313
|
id,
|
|
1611
1314
|
children,
|
|
1612
1315
|
...props
|
|
1613
1316
|
}, ref) {
|
|
1614
|
-
const
|
|
1615
|
-
const
|
|
1616
|
-
const input = /* @__PURE__ */ (0,
|
|
1617
|
-
if (
|
|
1317
|
+
const htmlId = (0, import_utils7.useId)(id);
|
|
1318
|
+
const noChildren = children === void 0;
|
|
1319
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CheckboxInput_default, { ...props, className: noChildren ? className : void 0, disabled, id: htmlId, ref });
|
|
1320
|
+
if (noChildren) {
|
|
1618
1321
|
return input;
|
|
1619
1322
|
}
|
|
1620
|
-
return /* @__PURE__ */ (0,
|
|
1621
|
-
input,
|
|
1622
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "charcoal-checkbox__text", children })
|
|
1623
|
-
] });
|
|
1323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CheckboxWithLabel, { className, disabled, id: htmlId, input, children });
|
|
1624
1324
|
});
|
|
1625
|
-
var Checkbox_default = (0,
|
|
1325
|
+
var Checkbox_default = (0, import_react29.memo)(Checkbox);
|
|
1626
1326
|
|
|
1627
1327
|
// src/components/TagItem/index.tsx
|
|
1628
|
-
var
|
|
1629
|
-
var
|
|
1630
|
-
var
|
|
1631
|
-
var
|
|
1632
|
-
|
|
1633
|
-
var import_styled8 = require("@charcoal-ui/styled");
|
|
1634
|
-
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1635
|
-
var sizeMap = {
|
|
1636
|
-
S: 32,
|
|
1637
|
-
M: 40
|
|
1638
|
-
};
|
|
1639
|
-
var TagItem = (0, import_react28.forwardRef)(function TagItemInner({
|
|
1328
|
+
var import_react30 = require("react");
|
|
1329
|
+
var import_utils8 = require("@react-aria/utils");
|
|
1330
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1331
|
+
var TagItem = (0, import_react30.forwardRef)(function TagItemInner({
|
|
1332
|
+
as,
|
|
1640
1333
|
label,
|
|
1641
1334
|
translatedLabel,
|
|
1642
1335
|
bgColor = "#7ACCB1",
|
|
1643
1336
|
bgImage,
|
|
1644
1337
|
size = "M",
|
|
1645
|
-
disabled,
|
|
1646
1338
|
status = "default",
|
|
1647
|
-
className,
|
|
1648
1339
|
...props
|
|
1649
1340
|
}, _ref) {
|
|
1650
|
-
const ref = (0,
|
|
1651
|
-
const ariaButtonProps = (0, import_react28.useMemo)(() => ({
|
|
1652
|
-
elementType: "a",
|
|
1653
|
-
isDisabled: disabled,
|
|
1654
|
-
...props
|
|
1655
|
-
}), [disabled, props]);
|
|
1656
|
-
const {
|
|
1657
|
-
buttonProps
|
|
1658
|
-
} = (0, import_button.useButton)(ariaButtonProps, ref);
|
|
1341
|
+
const ref = (0, import_utils8.useObjectRef)(_ref);
|
|
1659
1342
|
const hasTranslatedLabel = translatedLabel !== void 0 && translatedLabel.length > 0;
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1343
|
+
const className = useClassNames("charcoal-tag-item", "charcoal-tag-item__bg", props.className);
|
|
1344
|
+
const bgVariant = bgImage !== void 0 && bgImage.length > 0 ? "image" : "color";
|
|
1345
|
+
const bg = bgVariant === "color" ? bgColor : `url(${bgImage ?? ""})`;
|
|
1346
|
+
const Component = (0, import_react30.useMemo)(() => as ?? "button", [as]);
|
|
1347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Component, { ...props, ref, className, "data-state": status, "data-bg-variant": bgVariant, "data-size": hasTranslatedLabel ? "M" : size, style: {
|
|
1348
|
+
"--charcoal-tag-item-bg": bg
|
|
1349
|
+
}, children: [
|
|
1350
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "charcoal-tag-item__label", "data-has-translate": hasTranslatedLabel, children: [
|
|
1351
|
+
hasTranslatedLabel && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "charcoal-tag-item__label__translated", children: translatedLabel }),
|
|
1352
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "charcoal-tag-item__label__text", "data-has-translate": hasTranslatedLabel, children: label })
|
|
1353
|
+
] }),
|
|
1354
|
+
status === "active" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon_default, { name: "16/Remove" })
|
|
1669
1355
|
] });
|
|
1670
1356
|
});
|
|
1671
|
-
var TagItem_default = (0,
|
|
1672
|
-
var horizontalPadding = ({
|
|
1673
|
-
left,
|
|
1674
|
-
right
|
|
1675
|
-
}) => (0, import_styled_components21.css)(["padding-right:", ";padding-left:", ";"], (0, import_utils13.px)(right), (0, import_utils13.px)(left));
|
|
1676
|
-
var tagItemRootSize = (size) => {
|
|
1677
|
-
switch (size) {
|
|
1678
|
-
case "M":
|
|
1679
|
-
return horizontalPadding({
|
|
1680
|
-
left: 24,
|
|
1681
|
-
right: 24
|
|
1682
|
-
});
|
|
1683
|
-
case "S":
|
|
1684
|
-
return horizontalPadding({
|
|
1685
|
-
left: 16,
|
|
1686
|
-
right: 16
|
|
1687
|
-
});
|
|
1688
|
-
}
|
|
1689
|
-
};
|
|
1690
|
-
var activeTagItemRoot = horizontalPadding({
|
|
1691
|
-
left: 16,
|
|
1692
|
-
right: 8
|
|
1693
|
-
});
|
|
1694
|
-
var TagItemRoot = import_styled_components21.default.a.withConfig({
|
|
1695
|
-
componentId: "ccl__sc-11j9pu2-0"
|
|
1696
|
-
})(["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;}"], ({
|
|
1697
|
-
size
|
|
1698
|
-
}) => sizeMap[size], ({
|
|
1699
|
-
size,
|
|
1700
|
-
status
|
|
1701
|
-
}) => status !== "active" && tagItemRootSize(size), ({
|
|
1702
|
-
status
|
|
1703
|
-
}) => status === "active" && activeTagItemRoot, ({
|
|
1704
|
-
status
|
|
1705
|
-
}) => status === "inactive" ? "var(--charcoal-text2)" : "var(--charcoal-text5)", import_styled8.focusVisibleFocusRingCss);
|
|
1706
|
-
var Background = import_styled_components21.default.div.withConfig({
|
|
1707
|
-
componentId: "ccl__sc-11j9pu2-1"
|
|
1708
|
-
})(["position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;background-color:", ";", " ", ""], ({
|
|
1709
|
-
bgColor
|
|
1710
|
-
}) => bgColor, ({
|
|
1711
|
-
status
|
|
1712
|
-
}) => status === "inactive" && (0, import_styled_components21.css)(["background-color:var(--charcoal-surface3);"]), ({
|
|
1713
|
-
bgImage
|
|
1714
|
-
}) => bgImage !== void 0 && (0, import_styled_components21.css)(["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));
|
|
1715
|
-
var Inner = import_styled_components21.default.div.withConfig({
|
|
1716
|
-
componentId: "ccl__sc-11j9pu2-2"
|
|
1717
|
-
})(["display:inline-flex;gap:8px;align-items:center;z-index:2;"]);
|
|
1718
|
-
var labelCSS = (0, import_styled_components21.css)(["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;}"]);
|
|
1719
|
-
var translateLabelCSS = (0, import_styled_components21.css)(["display:flex;align-items:center;flex-direction:column;font-size:10px;"]);
|
|
1720
|
-
var LabelWrapper = import_styled_components21.default.div.withConfig({
|
|
1721
|
-
componentId: "ccl__sc-11j9pu2-3"
|
|
1722
|
-
})(["", ""], ({
|
|
1723
|
-
isTranslate
|
|
1724
|
-
}) => isTranslate ?? false ? translateLabelCSS : labelCSS);
|
|
1725
|
-
var Label3 = import_styled_components21.default.span.withConfig({
|
|
1726
|
-
componentId: "ccl__sc-11j9pu2-4"
|
|
1727
|
-
})(["max-width:152px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:inherit;color:inherit;line-height:inherit;"]);
|
|
1728
|
-
var TranslatedLabel = import_styled_components21.default.div.withConfig({
|
|
1729
|
-
componentId: "ccl__sc-11j9pu2-5"
|
|
1730
|
-
})(["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;}"]);
|
|
1357
|
+
var TagItem_default = (0, import_react30.memo)(TagItem);
|
|
1731
1358
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1732
1359
|
0 && (module.exports = {
|
|
1733
1360
|
Button,
|
|
@@ -1746,9 +1373,8 @@ var TranslatedLabel = import_styled_components21.default.div.withConfig({
|
|
|
1746
1373
|
ModalAlign,
|
|
1747
1374
|
ModalBody,
|
|
1748
1375
|
ModalButtons,
|
|
1376
|
+
ModalCloseButton,
|
|
1749
1377
|
ModalHeader,
|
|
1750
|
-
MultiSelect,
|
|
1751
|
-
MultiSelectGroup,
|
|
1752
1378
|
OverlayProvider,
|
|
1753
1379
|
Radio,
|
|
1754
1380
|
RadioGroup,
|