@charcoal-ui/react 4.0.0-beta.5 → 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/components/Modal/index.d.ts +4 -0
- package/dist/components/Modal/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 +122 -110
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +14 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +8 -8
- 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 +5 -5
- package/src/components/Checkbox/CheckboxInput/index.story.tsx +1 -1
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +6 -6
- package/src/components/Checkbox/index.story.tsx +2 -2
- package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
- package/src/components/Clickable/index.story.tsx +1 -1
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +1 -1
- 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 +14 -559
- package/src/components/DropdownSelector/index.story.tsx +2 -2
- 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 +3 -3
- package/src/components/IconButton/index.story.tsx +1 -1
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +4 -4
- package/src/components/LoadingSpinner/index.story.tsx +1 -1
- package/src/components/Modal/__snapshots__/index.story.storyshot +20 -12
- package/src/components/Modal/index.story.tsx +2 -2
- package/src/components/Modal/index.tsx +17 -5
- package/src/components/Radio/__snapshots__/index.story.storyshot +5 -5
- package/src/components/Radio/index.story.tsx +1 -1
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +2 -2
- package/src/components/SegmentedControl/index.story.tsx +1 -1
- package/src/components/Switch/__snapshots__/index.story.storyshot +4 -4
- package/src/components/Switch/index.story.tsx +1 -1
- package/src/components/TagItem/__snapshots__/index.story.storyshot +8 -8
- package/src/components/TagItem/index.story.tsx +1 -1
- package/src/components/TextArea/TextArea.story.tsx +1 -1
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +11 -11
- package/src/components/TextField/TextField.story.tsx +1 -1
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +13 -13
- package/src/core/SSRProvider.tsx +12 -1
- package/src/index.ts +5 -1
package/dist/index.cjs.js
CHANGED
|
@@ -42,11 +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
47
|
OverlayProvider: () => import_overlays.OverlayProvider,
|
|
47
48
|
Radio: () => Radio_default,
|
|
48
49
|
RadioGroup: () => RadioGroup,
|
|
49
|
-
SSRProvider: () =>
|
|
50
|
+
SSRProvider: () => SSRProvider,
|
|
50
51
|
SegmentedControl: () => SegmentedControl_default,
|
|
51
52
|
Switch: () => Switch_default,
|
|
52
53
|
TagItem: () => TagItem_default,
|
|
@@ -86,6 +87,12 @@ function useComponentAbstraction() {
|
|
|
86
87
|
|
|
87
88
|
// src/core/SSRProvider.tsx
|
|
88
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;
|
|
89
96
|
|
|
90
97
|
// src/core/OverlayProvider.tsx
|
|
91
98
|
var import_overlays = require("@react-aria/overlays");
|
|
@@ -102,24 +109,24 @@ function CharcoalProvider({
|
|
|
102
109
|
children,
|
|
103
110
|
background
|
|
104
111
|
}) {
|
|
105
|
-
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: [
|
|
106
113
|
injectTokens && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_styled.TokenInjector, { theme: themeMap, background }),
|
|
107
114
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ComponentAbstraction, { components, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_overlays.OverlayProvider, { children }) })
|
|
108
115
|
] }) });
|
|
109
116
|
}
|
|
110
117
|
|
|
111
118
|
// src/components/Button/index.tsx
|
|
112
|
-
var
|
|
119
|
+
var import_react4 = require("react");
|
|
113
120
|
|
|
114
121
|
// src/_lib/useClassNames.ts
|
|
115
|
-
var
|
|
122
|
+
var import_react3 = require("react");
|
|
116
123
|
function useClassNames(...classNames) {
|
|
117
|
-
return (0,
|
|
124
|
+
return (0, import_react3.useMemo)(() => classNames.filter((v) => v).join(" "), [classNames]);
|
|
118
125
|
}
|
|
119
126
|
|
|
120
127
|
// src/components/Button/index.tsx
|
|
121
128
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
122
|
-
var Button = (0,
|
|
129
|
+
var Button = (0, import_react4.forwardRef)(function Button2({
|
|
123
130
|
variant,
|
|
124
131
|
fullWidth,
|
|
125
132
|
size,
|
|
@@ -129,30 +136,30 @@ var Button = (0, import_react3.forwardRef)(function Button2({
|
|
|
129
136
|
componentAs,
|
|
130
137
|
...props
|
|
131
138
|
}, ref) {
|
|
132
|
-
const Component = (0,
|
|
139
|
+
const Component = (0, import_react4.useMemo)(() => as ?? "button", [as]);
|
|
133
140
|
const classNames = useClassNames("charcoal-button", className);
|
|
134
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 });
|
|
135
142
|
});
|
|
136
143
|
var Button_default = Button;
|
|
137
144
|
|
|
138
145
|
// src/components/Clickable/index.tsx
|
|
139
|
-
var
|
|
146
|
+
var import_react5 = require("react");
|
|
140
147
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
141
|
-
var Clickable = (0,
|
|
148
|
+
var Clickable = (0, import_react5.forwardRef)(function Clickable2({
|
|
142
149
|
componentAs,
|
|
143
150
|
as,
|
|
144
151
|
...props
|
|
145
152
|
}, ref) {
|
|
146
153
|
const className = useClassNames("charcoal-clickable", props.className);
|
|
147
|
-
const Component = (0,
|
|
154
|
+
const Component = (0, import_react5.useMemo)(() => as ?? "button", [as]);
|
|
148
155
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Component, { ...props, ref, className, as: componentAs });
|
|
149
156
|
});
|
|
150
157
|
var Clickable_default = Clickable;
|
|
151
158
|
|
|
152
159
|
// src/components/IconButton/index.tsx
|
|
153
|
-
var
|
|
160
|
+
var import_react6 = require("react");
|
|
154
161
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
155
|
-
var IconButton = (0,
|
|
162
|
+
var IconButton = (0, import_react6.forwardRef)(function IconButtonInner({
|
|
156
163
|
variant = "Default",
|
|
157
164
|
size = "M",
|
|
158
165
|
icon,
|
|
@@ -162,7 +169,7 @@ var IconButton = (0, import_react5.forwardRef)(function IconButtonInner({
|
|
|
162
169
|
...rest
|
|
163
170
|
}, ref) {
|
|
164
171
|
validateIconSize(size, icon);
|
|
165
|
-
const Component = (0,
|
|
172
|
+
const Component = (0, import_react6.useMemo)(() => as ?? "button", [as]);
|
|
166
173
|
const classNames = useClassNames("charcoal-icon-button", rest.className);
|
|
167
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 }) });
|
|
168
175
|
});
|
|
@@ -189,11 +196,11 @@ function validateIconSize(size, icon) {
|
|
|
189
196
|
}
|
|
190
197
|
|
|
191
198
|
// src/components/Radio/index.tsx
|
|
192
|
-
var
|
|
199
|
+
var import_react7 = require("react");
|
|
193
200
|
var React5 = __toESM(require("react"));
|
|
194
201
|
var import_warning = __toESM(require("warning"));
|
|
195
202
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
196
|
-
var Radio = (0,
|
|
203
|
+
var Radio = (0, import_react7.forwardRef)(function RadioInner({
|
|
197
204
|
value,
|
|
198
205
|
disabled = false,
|
|
199
206
|
children,
|
|
@@ -206,7 +213,7 @@ var Radio = (0, import_react6.forwardRef)(function RadioInner({
|
|
|
206
213
|
readonly,
|
|
207
214
|
invalid,
|
|
208
215
|
onChange
|
|
209
|
-
} = (0,
|
|
216
|
+
} = (0, import_react7.useContext)(RadioGroupContext);
|
|
210
217
|
const classNames = useClassNames("charcoal-radio__label", props.className);
|
|
211
218
|
(0, import_warning.default)(
|
|
212
219
|
name !== void 0,
|
|
@@ -215,7 +222,7 @@ var Radio = (0, import_react6.forwardRef)(function RadioInner({
|
|
|
215
222
|
const isSelected = value === selected;
|
|
216
223
|
const isDisabled = disabled || isParentDisabled;
|
|
217
224
|
const isReadonly = readonly && !isSelected;
|
|
218
|
-
const handleChange = (0,
|
|
225
|
+
const handleChange = (0, import_react7.useCallback)((e) => {
|
|
219
226
|
onChange(e.currentTarget.value);
|
|
220
227
|
}, [onChange]);
|
|
221
228
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { "aria-disabled": isDisabled || isReadonly, className: classNames, children: [
|
|
@@ -223,7 +230,7 @@ var Radio = (0, import_react6.forwardRef)(function RadioInner({
|
|
|
223
230
|
children != null && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "charcoal-radio__label_div", children })
|
|
224
231
|
] });
|
|
225
232
|
});
|
|
226
|
-
var Radio_default = (0,
|
|
233
|
+
var Radio_default = (0, import_react7.memo)(Radio);
|
|
227
234
|
var RadioGroupContext = React5.createContext({
|
|
228
235
|
name: void 0,
|
|
229
236
|
selected: void 0,
|
|
@@ -234,7 +241,7 @@ var RadioGroupContext = React5.createContext({
|
|
|
234
241
|
throw new Error("Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?");
|
|
235
242
|
}
|
|
236
243
|
});
|
|
237
|
-
var RadioGroup = (0,
|
|
244
|
+
var RadioGroup = (0, import_react7.forwardRef)(function RadioGroupInner({
|
|
238
245
|
value,
|
|
239
246
|
name,
|
|
240
247
|
onChange,
|
|
@@ -245,10 +252,10 @@ var RadioGroup = (0, import_react6.forwardRef)(function RadioGroupInner({
|
|
|
245
252
|
...props
|
|
246
253
|
}, ref) {
|
|
247
254
|
const classNames = useClassNames("charcoal-radio-group", props.className);
|
|
248
|
-
const handleChange = (0,
|
|
255
|
+
const handleChange = (0, import_react7.useCallback)((next) => {
|
|
249
256
|
onChange(next);
|
|
250
257
|
}, [onChange]);
|
|
251
|
-
const contextValue = (0,
|
|
258
|
+
const contextValue = (0, import_react7.useMemo)(() => ({
|
|
252
259
|
name,
|
|
253
260
|
selected: value,
|
|
254
261
|
disabled: disabled ?? false,
|
|
@@ -260,18 +267,18 @@ var RadioGroup = (0, import_react6.forwardRef)(function RadioGroupInner({
|
|
|
260
267
|
});
|
|
261
268
|
|
|
262
269
|
// src/components/Switch/index.tsx
|
|
263
|
-
var
|
|
270
|
+
var import_react9 = require("react");
|
|
264
271
|
var import_utils = require("@react-aria/utils");
|
|
265
272
|
|
|
266
273
|
// src/components/Switch/SwitchInput/index.tsx
|
|
267
|
-
var
|
|
274
|
+
var import_react8 = require("react");
|
|
268
275
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
269
|
-
var SwitchInput = (0,
|
|
276
|
+
var SwitchInput = (0, import_react8.forwardRef)(function SwitchInput2({
|
|
270
277
|
onChange,
|
|
271
278
|
className,
|
|
272
279
|
...props
|
|
273
280
|
}, ref) {
|
|
274
|
-
const handleChange = (0,
|
|
281
|
+
const handleChange = (0, import_react8.useCallback)((e) => {
|
|
275
282
|
const el = e.currentTarget;
|
|
276
283
|
onChange?.(el.checked);
|
|
277
284
|
}, [onChange]);
|
|
@@ -300,7 +307,7 @@ var SwitchWithLabel = React6.memo(function SwitchWithLabel2({
|
|
|
300
307
|
|
|
301
308
|
// src/components/Switch/index.tsx
|
|
302
309
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
303
|
-
var Switch = (0,
|
|
310
|
+
var Switch = (0, import_react9.forwardRef)(function Switch2({
|
|
304
311
|
children,
|
|
305
312
|
onChange,
|
|
306
313
|
disabled,
|
|
@@ -316,11 +323,11 @@ var Switch = (0, import_react8.forwardRef)(function Switch2({
|
|
|
316
323
|
}
|
|
317
324
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SwitchWithLabel, { className, disabled, id: htmlId, input, children });
|
|
318
325
|
});
|
|
319
|
-
var Switch_default = (0,
|
|
326
|
+
var Switch_default = (0, import_react9.memo)(Switch);
|
|
320
327
|
|
|
321
328
|
// src/components/TextField/index.tsx
|
|
322
329
|
var import_visually_hidden = require("@react-aria/visually-hidden");
|
|
323
|
-
var
|
|
330
|
+
var import_react11 = require("react");
|
|
324
331
|
var React8 = __toESM(require("react"));
|
|
325
332
|
var import_styled_components2 = __toESM(require("styled-components"));
|
|
326
333
|
|
|
@@ -363,9 +370,9 @@ function countCodePointsInString(string) {
|
|
|
363
370
|
}
|
|
364
371
|
|
|
365
372
|
// src/components/TextField/useFocusWithClick.tsx
|
|
366
|
-
var
|
|
373
|
+
var import_react10 = require("react");
|
|
367
374
|
function useFocusWithClick(containerRef, inputRef) {
|
|
368
|
-
(0,
|
|
375
|
+
(0, import_react10.useEffect)(() => {
|
|
369
376
|
const el = containerRef.current;
|
|
370
377
|
if (el) {
|
|
371
378
|
const handleDown = (e) => {
|
|
@@ -403,12 +410,12 @@ var TextField = React8.forwardRef(function SingleLineTextFieldInner({
|
|
|
403
410
|
getCount = countCodePointsInString,
|
|
404
411
|
...props
|
|
405
412
|
}, forwardRef20) {
|
|
406
|
-
const inputRef = (0,
|
|
413
|
+
const inputRef = (0, import_react11.useRef)(null);
|
|
407
414
|
const {
|
|
408
415
|
visuallyHiddenProps
|
|
409
416
|
} = (0, import_visually_hidden.useVisuallyHidden)();
|
|
410
|
-
const [count, setCount] = (0,
|
|
411
|
-
const handleChange = (0,
|
|
417
|
+
const [count, setCount] = (0, import_react11.useState)(getCount(value ?? ""));
|
|
418
|
+
const handleChange = (0, import_react11.useCallback)((e) => {
|
|
412
419
|
const value2 = e.target.value;
|
|
413
420
|
const count2 = getCount(value2);
|
|
414
421
|
if (maxLength !== void 0 && count2 > maxLength) {
|
|
@@ -417,10 +424,10 @@ var TextField = React8.forwardRef(function SingleLineTextFieldInner({
|
|
|
417
424
|
setCount(count2);
|
|
418
425
|
onChange?.(value2);
|
|
419
426
|
}, [getCount, maxLength, onChange]);
|
|
420
|
-
(0,
|
|
427
|
+
(0, import_react11.useEffect)(() => {
|
|
421
428
|
setCount(getCount(value ?? ""));
|
|
422
429
|
}, [getCount, value]);
|
|
423
|
-
const containerRef = (0,
|
|
430
|
+
const containerRef = (0, import_react11.useRef)(null);
|
|
424
431
|
useFocusWithClick(containerRef, inputRef);
|
|
425
432
|
const inputId = (0, import_utils2.useId)(props.id);
|
|
426
433
|
const describedbyId = (0, import_utils2.useId)();
|
|
@@ -466,11 +473,11 @@ var AssistiveText = import_styled_components2.default.p.withConfig({
|
|
|
466
473
|
|
|
467
474
|
// src/components/TextArea/index.tsx
|
|
468
475
|
var import_visually_hidden2 = require("@react-aria/visually-hidden");
|
|
469
|
-
var
|
|
476
|
+
var import_react12 = require("react");
|
|
470
477
|
var import_styled_components3 = __toESM(require("styled-components"));
|
|
471
478
|
var import_utils3 = require("@react-aria/utils");
|
|
472
479
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
473
|
-
var TextArea = (0,
|
|
480
|
+
var TextArea = (0, import_react12.forwardRef)(function TextAreaInner({
|
|
474
481
|
onChange,
|
|
475
482
|
className,
|
|
476
483
|
value,
|
|
@@ -491,17 +498,17 @@ var TextArea = (0, import_react11.forwardRef)(function TextAreaInner({
|
|
|
491
498
|
const {
|
|
492
499
|
visuallyHiddenProps
|
|
493
500
|
} = (0, import_visually_hidden2.useVisuallyHidden)();
|
|
494
|
-
const textareaRef = (0,
|
|
495
|
-
const textAreaRef = (0,
|
|
496
|
-
const [count, setCount] = (0,
|
|
497
|
-
const [rows, setRows] = (0,
|
|
498
|
-
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) => {
|
|
499
506
|
const rows2 = (`${textarea.value}
|
|
500
507
|
`.match(/\n/gu)?.length ?? 0) || 1;
|
|
501
508
|
setRows(initialRows <= rows2 ? rows2 : initialRows);
|
|
502
509
|
}, [initialRows]);
|
|
503
510
|
const nonControlled = value === void 0;
|
|
504
|
-
const handleChange = (0,
|
|
511
|
+
const handleChange = (0, import_react12.useCallback)((e) => {
|
|
505
512
|
const value2 = e.target.value;
|
|
506
513
|
const count2 = getCount(value2);
|
|
507
514
|
if (maxLength !== void 0 && count2 > maxLength) {
|
|
@@ -515,15 +522,15 @@ var TextArea = (0, import_react11.forwardRef)(function TextAreaInner({
|
|
|
515
522
|
}
|
|
516
523
|
onChange?.(value2);
|
|
517
524
|
}, [autoHeight, getCount, maxLength, nonControlled, onChange, syncHeight]);
|
|
518
|
-
(0,
|
|
525
|
+
(0, import_react12.useEffect)(() => {
|
|
519
526
|
setCount(getCount(value ?? ""));
|
|
520
527
|
}, [getCount, value]);
|
|
521
|
-
(0,
|
|
528
|
+
(0, import_react12.useEffect)(() => {
|
|
522
529
|
if (autoHeight && textareaRef.current !== null) {
|
|
523
530
|
syncHeight(textareaRef.current);
|
|
524
531
|
}
|
|
525
532
|
}, [autoHeight, syncHeight]);
|
|
526
|
-
const containerRef = (0,
|
|
533
|
+
const containerRef = (0, import_react12.useRef)(null);
|
|
527
534
|
useFocusWithClick(containerRef, textAreaRef);
|
|
528
535
|
const textAreaId = (0, import_utils3.useId)(props.id);
|
|
529
536
|
const describedbyId = (0, import_utils3.useId)();
|
|
@@ -575,7 +582,7 @@ var Icon = React9.forwardRef(function IconInner({
|
|
|
575
582
|
var Icon_default = Icon;
|
|
576
583
|
|
|
577
584
|
// src/components/Modal/index.tsx
|
|
578
|
-
var
|
|
585
|
+
var import_react15 = require("react");
|
|
579
586
|
var React13 = __toESM(require("react"));
|
|
580
587
|
var import_overlays3 = require("@react-aria/overlays");
|
|
581
588
|
var import_styled_components4 = require("styled-components");
|
|
@@ -585,7 +592,7 @@ var import_react_spring = require("react-spring");
|
|
|
585
592
|
var import_utils5 = require("@react-aria/utils");
|
|
586
593
|
|
|
587
594
|
// src/components/Modal/Dialog/index.tsx
|
|
588
|
-
var
|
|
595
|
+
var import_react13 = require("react");
|
|
589
596
|
var import_dialog = require("@react-aria/dialog");
|
|
590
597
|
|
|
591
598
|
// src/_lib/useForwardedRef.tsx
|
|
@@ -606,7 +613,7 @@ function useForwardedRef(ref) {
|
|
|
606
613
|
|
|
607
614
|
// src/components/Modal/Dialog/index.tsx
|
|
608
615
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
609
|
-
var Dialog = (0,
|
|
616
|
+
var Dialog = (0, import_react13.forwardRef)(function Dialog2({
|
|
610
617
|
size,
|
|
611
618
|
bottomSheet,
|
|
612
619
|
css: css4,
|
|
@@ -632,9 +639,9 @@ var React12 = __toESM(require("react"));
|
|
|
632
639
|
var import_overlays2 = require("@react-aria/overlays");
|
|
633
640
|
|
|
634
641
|
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
635
|
-
var
|
|
642
|
+
var import_react14 = require("react");
|
|
636
643
|
function usePreventScroll(element, isOpen) {
|
|
637
|
-
(0,
|
|
644
|
+
(0, import_react14.useEffect)(() => {
|
|
638
645
|
if (isOpen && element) {
|
|
639
646
|
const defaultPaddingRight = element.style.paddingRight;
|
|
640
647
|
const defaultOverflow = element.style.overflow;
|
|
@@ -675,7 +682,7 @@ function useCharcoalModalOverlay(props, state, ref) {
|
|
|
675
682
|
// src/components/Modal/index.tsx
|
|
676
683
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
677
684
|
var DEFAULT_Z_INDEX = 10;
|
|
678
|
-
var Modal = (0,
|
|
685
|
+
var Modal = (0, import_react15.forwardRef)(function ModalInner({
|
|
679
686
|
children,
|
|
680
687
|
zIndex = DEFAULT_Z_INDEX,
|
|
681
688
|
portalContainer,
|
|
@@ -688,7 +695,8 @@ var Modal = (0, import_react14.forwardRef)(function ModalInner({
|
|
|
688
695
|
isDismissable,
|
|
689
696
|
onClose,
|
|
690
697
|
className,
|
|
691
|
-
isOpen = false
|
|
698
|
+
isOpen = false,
|
|
699
|
+
closeButtonAriaLabel = "Close"
|
|
692
700
|
} = props;
|
|
693
701
|
const ref = (0, import_utils5.useObjectRef)(external);
|
|
694
702
|
const {
|
|
@@ -756,11 +764,11 @@ var Modal = (0, import_react14.forwardRef)(function ModalInner({
|
|
|
756
764
|
bottomSheet
|
|
757
765
|
}, children: [
|
|
758
766
|
children,
|
|
759
|
-
isDismissable === true && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
767
|
+
isDismissable === true && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ModalCloseButton, { "aria-label": closeButtonAriaLabel, onClick: onClose })
|
|
760
768
|
] }) }) }) }) }));
|
|
761
769
|
});
|
|
762
770
|
var AnimatedDialog = (0, import_react_spring.animated)(Dialog);
|
|
763
|
-
var Modal_default = (0,
|
|
771
|
+
var Modal_default = (0, import_react15.memo)(Modal);
|
|
764
772
|
var ModalContext = React13.createContext({
|
|
765
773
|
titleProps: {},
|
|
766
774
|
title: "",
|
|
@@ -768,19 +776,22 @@ var ModalContext = React13.createContext({
|
|
|
768
776
|
showDismiss: true,
|
|
769
777
|
bottomSheet: false
|
|
770
778
|
});
|
|
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 });
|
|
781
|
+
}
|
|
771
782
|
|
|
772
783
|
// src/components/Modal/ModalPlumbing.tsx
|
|
773
|
-
var
|
|
784
|
+
var import_react16 = require("react");
|
|
774
785
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
775
786
|
function ModalHeader() {
|
|
776
|
-
const modalCtx = (0,
|
|
787
|
+
const modalCtx = (0, import_react16.useContext)(ModalContext);
|
|
777
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 }) });
|
|
778
789
|
}
|
|
779
790
|
var ModalAlign = createDivComponent("charcoal-modal-align");
|
|
780
791
|
var ModalBody = createDivComponent("charcoal-modal-body");
|
|
781
792
|
var ModalButtons = createDivComponent("charcoal-modal-buttons");
|
|
782
793
|
function createDivComponent(mainClassName) {
|
|
783
|
-
return (0,
|
|
794
|
+
return (0, import_react16.forwardRef)(function DivComponent({
|
|
784
795
|
className,
|
|
785
796
|
...props
|
|
786
797
|
}, ref) {
|
|
@@ -790,9 +801,9 @@ function createDivComponent(mainClassName) {
|
|
|
790
801
|
}
|
|
791
802
|
|
|
792
803
|
// src/components/LoadingSpinner/index.tsx
|
|
793
|
-
var
|
|
804
|
+
var import_react17 = require("react");
|
|
794
805
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
795
|
-
var LoadingSpinner = (0,
|
|
806
|
+
var LoadingSpinner = (0, import_react17.forwardRef)(function LoadingSpinnerInner({
|
|
796
807
|
size = 48,
|
|
797
808
|
padding = 16,
|
|
798
809
|
transparent = false,
|
|
@@ -804,12 +815,12 @@ var LoadingSpinner = (0, import_react16.forwardRef)(function LoadingSpinnerInner
|
|
|
804
815
|
"--charcoal-loading-spinner-padding": `${padding}px`
|
|
805
816
|
}, "data-transparent": transparent, className: classNames, ref, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LoadingSpinnerIcon, {}) });
|
|
806
817
|
});
|
|
807
|
-
var LoadingSpinner_default = (0,
|
|
808
|
-
var LoadingSpinnerIcon = (0,
|
|
818
|
+
var LoadingSpinner_default = (0, import_react17.memo)(LoadingSpinner);
|
|
819
|
+
var LoadingSpinnerIcon = (0, import_react17.forwardRef)(function LoadingSpinnerIcon2({
|
|
809
820
|
once = false
|
|
810
821
|
}, ref) {
|
|
811
|
-
const iconRef = (0,
|
|
812
|
-
(0,
|
|
822
|
+
const iconRef = (0, import_react17.useRef)(null);
|
|
823
|
+
(0, import_react17.useImperativeHandle)(ref, () => ({
|
|
813
824
|
restart: () => {
|
|
814
825
|
if (!iconRef.current) {
|
|
815
826
|
return;
|
|
@@ -823,21 +834,21 @@ var LoadingSpinnerIcon = (0, import_react16.forwardRef)(function LoadingSpinnerI
|
|
|
823
834
|
});
|
|
824
835
|
|
|
825
836
|
// src/components/DropdownSelector/index.tsx
|
|
826
|
-
var
|
|
837
|
+
var import_react22 = require("react");
|
|
827
838
|
var import_styled_components7 = __toESM(require("styled-components"));
|
|
828
839
|
var import_utils6 = require("@charcoal-ui/utils");
|
|
829
840
|
|
|
830
841
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
831
|
-
var
|
|
842
|
+
var import_react19 = require("react");
|
|
832
843
|
|
|
833
844
|
// src/components/DropdownSelector/Popover/index.tsx
|
|
834
|
-
var
|
|
845
|
+
var import_react18 = require("react");
|
|
835
846
|
var import_overlays4 = require("@react-aria/overlays");
|
|
836
847
|
var import_styled_components5 = __toESM(require("styled-components"));
|
|
837
848
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
838
849
|
var _empty = () => null;
|
|
839
850
|
function Popover(props) {
|
|
840
|
-
const defaultPopoverRef = (0,
|
|
851
|
+
const defaultPopoverRef = (0, import_react18.useRef)(null);
|
|
841
852
|
const finalPopoverRef = props.popoverRef === void 0 ? defaultPopoverRef : props.popoverRef;
|
|
842
853
|
const {
|
|
843
854
|
popoverProps,
|
|
@@ -853,7 +864,7 @@ function Popover(props) {
|
|
|
853
864
|
setOpen: _empty,
|
|
854
865
|
toggle: _empty
|
|
855
866
|
});
|
|
856
|
-
const modalBackground = (0,
|
|
867
|
+
const modalBackground = (0, import_react18.useContext)(ModalBackgroundContext);
|
|
857
868
|
usePreventScroll(modalBackground, props.isOpen);
|
|
858
869
|
if (!props.isOpen)
|
|
859
870
|
return null;
|
|
@@ -880,13 +891,13 @@ function DropdownPopover({
|
|
|
880
891
|
children,
|
|
881
892
|
...props
|
|
882
893
|
}) {
|
|
883
|
-
const ref = (0,
|
|
884
|
-
(0,
|
|
894
|
+
const ref = (0, import_react19.useRef)(null);
|
|
895
|
+
(0, import_react19.useEffect)(() => {
|
|
885
896
|
if (props.isOpen && ref.current && props.triggerRef.current) {
|
|
886
897
|
ref.current.style.width = `${props.triggerRef.current.clientWidth}px`;
|
|
887
898
|
}
|
|
888
899
|
}, [props.triggerRef, props.isOpen]);
|
|
889
|
-
(0,
|
|
900
|
+
(0, import_react19.useEffect)(() => {
|
|
890
901
|
if (props.isOpen && props.value !== void 0) {
|
|
891
902
|
const windowScrollY = window.scrollY;
|
|
892
903
|
const windowScrollX = window.scrollX;
|
|
@@ -923,12 +934,12 @@ function findPreviewRecursive(children, value) {
|
|
|
923
934
|
}
|
|
924
935
|
|
|
925
936
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
926
|
-
var
|
|
937
|
+
var import_react21 = require("react");
|
|
927
938
|
var import_styled_components6 = __toESM(require("styled-components"));
|
|
928
939
|
|
|
929
940
|
// src/components/DropdownSelector/MenuList/MenuListContext.ts
|
|
930
|
-
var
|
|
931
|
-
var MenuListContext = (0,
|
|
941
|
+
var import_react20 = require("react");
|
|
942
|
+
var MenuListContext = (0, import_react20.createContext)({
|
|
932
943
|
root: void 0,
|
|
933
944
|
value: "",
|
|
934
945
|
propsArray: [],
|
|
@@ -962,8 +973,8 @@ function getValuesRecursive(children) {
|
|
|
962
973
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
963
974
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
964
975
|
function MenuList(props) {
|
|
965
|
-
const root = (0,
|
|
966
|
-
const propsArray = (0,
|
|
976
|
+
const root = (0, import_react21.useRef)(null);
|
|
977
|
+
const propsArray = (0, import_react21.useMemo)(() => getValuesRecursive(props.children), [props.children]);
|
|
967
978
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StyledUl, { ref: root, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MenuListContext.Provider, { value: {
|
|
968
979
|
value: props.value ?? "",
|
|
969
980
|
root,
|
|
@@ -986,15 +997,15 @@ function DropdownSelector({
|
|
|
986
997
|
onChange,
|
|
987
998
|
...props
|
|
988
999
|
}) {
|
|
989
|
-
const triggerRef = (0,
|
|
990
|
-
const [isOpen, setIsOpen] = (0,
|
|
1000
|
+
const triggerRef = (0, import_react22.useRef)(null);
|
|
1001
|
+
const [isOpen, setIsOpen] = (0, import_react22.useState)(false);
|
|
991
1002
|
const preview = findPreviewRecursive(props.children, props.value);
|
|
992
|
-
const isPlaceholder = (0,
|
|
1003
|
+
const isPlaceholder = (0, import_react22.useMemo)(() => props.placeholder !== void 0 && preview === void 0, [preview, props.placeholder]);
|
|
993
1004
|
const propsArray = getValuesRecursive(props.children);
|
|
994
1005
|
const {
|
|
995
1006
|
visuallyHiddenProps
|
|
996
1007
|
} = (0, import_visually_hidden3.useVisuallyHidden)();
|
|
997
|
-
const handleChange = (0,
|
|
1008
|
+
const handleChange = (0, import_react22.useCallback)((e) => {
|
|
998
1009
|
onChange(e.target.value);
|
|
999
1010
|
}, [onChange]);
|
|
1000
1011
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownSelectorRoot, { "aria-disabled": props.disabled, children: [
|
|
@@ -1055,7 +1066,7 @@ var ItemDiv = import_styled_components8.default.div.withConfig({
|
|
|
1055
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);}}"]);
|
|
1056
1067
|
|
|
1057
1068
|
// src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
|
|
1058
|
-
var
|
|
1069
|
+
var import_react23 = require("react");
|
|
1059
1070
|
|
|
1060
1071
|
// src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx
|
|
1061
1072
|
function handleFocusByKeyBoard(element, parent) {
|
|
@@ -1092,12 +1103,12 @@ function useMenuItemHandleKeyDown(value) {
|
|
|
1092
1103
|
setValue,
|
|
1093
1104
|
root,
|
|
1094
1105
|
propsArray
|
|
1095
|
-
} = (0,
|
|
1096
|
-
const setContextValue = (0,
|
|
1106
|
+
} = (0, import_react23.useContext)(MenuListContext);
|
|
1107
|
+
const setContextValue = (0, import_react23.useCallback)(() => {
|
|
1097
1108
|
if (value !== void 0)
|
|
1098
1109
|
setValue(value);
|
|
1099
1110
|
}, [value, setValue]);
|
|
1100
|
-
const handleKeyDown = (0,
|
|
1111
|
+
const handleKeyDown = (0, import_react23.useCallback)((e) => {
|
|
1101
1112
|
if (e.key === "Enter") {
|
|
1102
1113
|
setContextValue();
|
|
1103
1114
|
} else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
@@ -1144,12 +1155,12 @@ function MenuItem(props) {
|
|
|
1144
1155
|
}
|
|
1145
1156
|
|
|
1146
1157
|
// src/components/DropdownSelector/DropdownMenuItem.tsx
|
|
1147
|
-
var
|
|
1158
|
+
var import_react24 = require("react");
|
|
1148
1159
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1149
1160
|
function DropdownMenuItem(props) {
|
|
1150
1161
|
const {
|
|
1151
1162
|
value: ctxValue
|
|
1152
|
-
} = (0,
|
|
1163
|
+
} = (0, import_react24.useContext)(MenuListContext);
|
|
1153
1164
|
const isSelected = props.value === ctxValue;
|
|
1154
1165
|
const {
|
|
1155
1166
|
children,
|
|
@@ -1189,14 +1200,14 @@ var StyledLi2 = import_styled_components10.default.li.withConfig({
|
|
|
1189
1200
|
})(["display:block;"]);
|
|
1190
1201
|
|
|
1191
1202
|
// src/components/SegmentedControl/index.tsx
|
|
1192
|
-
var
|
|
1203
|
+
var import_react26 = require("react");
|
|
1193
1204
|
var import_radio = require("@react-stately/radio");
|
|
1194
1205
|
var import_radio2 = require("@react-aria/radio");
|
|
1195
1206
|
|
|
1196
1207
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
1197
|
-
var
|
|
1208
|
+
var import_react25 = require("react");
|
|
1198
1209
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1199
|
-
var RadioContext = (0,
|
|
1210
|
+
var RadioContext = (0, import_react25.createContext)(null);
|
|
1200
1211
|
var RadioProvider = ({
|
|
1201
1212
|
value,
|
|
1202
1213
|
children
|
|
@@ -1204,7 +1215,7 @@ var RadioProvider = ({
|
|
|
1204
1215
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RadioContext.Provider, { value, children });
|
|
1205
1216
|
};
|
|
1206
1217
|
var useRadioContext = () => {
|
|
1207
|
-
const state = (0,
|
|
1218
|
+
const state = (0, import_react25.useContext)(RadioContext);
|
|
1208
1219
|
if (state === null)
|
|
1209
1220
|
throw new Error("`<RadioProvider>` is not likely mounted.");
|
|
1210
1221
|
return state;
|
|
@@ -1212,9 +1223,9 @@ var useRadioContext = () => {
|
|
|
1212
1223
|
|
|
1213
1224
|
// src/components/SegmentedControl/index.tsx
|
|
1214
1225
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1215
|
-
var SegmentedControl = (0,
|
|
1226
|
+
var SegmentedControl = (0, import_react26.forwardRef)(function SegmentedControlInner(props, ref) {
|
|
1216
1227
|
const className = useClassNames("charcoal-segmented-control", props.className);
|
|
1217
|
-
const ariaRadioGroupProps = (0,
|
|
1228
|
+
const ariaRadioGroupProps = (0, import_react26.useMemo)(() => ({
|
|
1218
1229
|
...props,
|
|
1219
1230
|
isDisabled: props.disabled,
|
|
1220
1231
|
isReadOnly: props.readonly,
|
|
@@ -1225,7 +1236,7 @@ var SegmentedControl = (0, import_react25.forwardRef)(function SegmentedControlI
|
|
|
1225
1236
|
const {
|
|
1226
1237
|
radioGroupProps
|
|
1227
1238
|
} = (0, import_radio2.useRadioGroup)(ariaRadioGroupProps, state);
|
|
1228
|
-
const segmentedControlItems = (0,
|
|
1239
|
+
const segmentedControlItems = (0, import_react26.useMemo)(() => {
|
|
1229
1240
|
return props.data.map((d) => typeof d === "string" ? {
|
|
1230
1241
|
value: d,
|
|
1231
1242
|
label: d
|
|
@@ -1233,11 +1244,11 @@ var SegmentedControl = (0, import_react25.forwardRef)(function SegmentedControlI
|
|
|
1233
1244
|
}, [props.data]);
|
|
1234
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)) }) });
|
|
1235
1246
|
});
|
|
1236
|
-
var SegmentedControl_default = (0,
|
|
1247
|
+
var SegmentedControl_default = (0, import_react26.memo)(SegmentedControl);
|
|
1237
1248
|
var Segmented = (props) => {
|
|
1238
1249
|
const state = useRadioContext();
|
|
1239
|
-
const ref = (0,
|
|
1240
|
-
const ariaRadioProps = (0,
|
|
1250
|
+
const ref = (0, import_react26.useRef)(null);
|
|
1251
|
+
const ariaRadioProps = (0, import_react26.useMemo)(() => ({
|
|
1241
1252
|
value: props.value,
|
|
1242
1253
|
isDisabled: props.disabled,
|
|
1243
1254
|
children: props.children
|
|
@@ -1254,13 +1265,13 @@ var Segmented = (props) => {
|
|
|
1254
1265
|
};
|
|
1255
1266
|
|
|
1256
1267
|
// src/components/Checkbox/index.tsx
|
|
1257
|
-
var
|
|
1268
|
+
var import_react29 = require("react");
|
|
1258
1269
|
var import_utils7 = require("@react-aria/utils");
|
|
1259
1270
|
|
|
1260
1271
|
// src/components/Checkbox/CheckboxInput/index.tsx
|
|
1261
|
-
var
|
|
1272
|
+
var import_react27 = require("react");
|
|
1262
1273
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1263
|
-
var CheckboxInput = (0,
|
|
1274
|
+
var CheckboxInput = (0, import_react27.forwardRef)(function CheckboxInput2({
|
|
1264
1275
|
onChange,
|
|
1265
1276
|
checked,
|
|
1266
1277
|
invalid,
|
|
@@ -1268,19 +1279,19 @@ var CheckboxInput = (0, import_react26.forwardRef)(function CheckboxInput2({
|
|
|
1268
1279
|
rounded,
|
|
1269
1280
|
...props
|
|
1270
1281
|
}, ref) {
|
|
1271
|
-
const handleChange = (0,
|
|
1282
|
+
const handleChange = (0, import_react27.useCallback)((e) => {
|
|
1272
1283
|
const el = e.currentTarget;
|
|
1273
1284
|
onChange?.(el.checked);
|
|
1274
1285
|
}, [onChange]);
|
|
1275
1286
|
const classNames = useClassNames("charcoal-checkbox-input", className);
|
|
1276
1287
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { className: classNames, ref, type: "checkbox", onChange: handleChange, "aria-invalid": invalid, checked, "data-rounded": rounded, ...props });
|
|
1277
1288
|
});
|
|
1278
|
-
var CheckboxInput_default = (0,
|
|
1289
|
+
var CheckboxInput_default = (0, import_react27.memo)(CheckboxInput);
|
|
1279
1290
|
|
|
1280
1291
|
// src/components/Checkbox/CheckboxWithLabel.tsx
|
|
1281
|
-
var
|
|
1292
|
+
var import_react28 = __toESM(require("react"));
|
|
1282
1293
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1283
|
-
var CheckboxWithLabel =
|
|
1294
|
+
var CheckboxWithLabel = import_react28.default.memo(function CheckboxWithLabel2({
|
|
1284
1295
|
className,
|
|
1285
1296
|
children,
|
|
1286
1297
|
input,
|
|
@@ -1296,7 +1307,7 @@ var CheckboxWithLabel = import_react27.default.memo(function CheckboxWithLabel2(
|
|
|
1296
1307
|
|
|
1297
1308
|
// src/components/Checkbox/index.tsx
|
|
1298
1309
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1299
|
-
var Checkbox = (0,
|
|
1310
|
+
var Checkbox = (0, import_react29.forwardRef)(function Checkbox2({
|
|
1300
1311
|
disabled,
|
|
1301
1312
|
className,
|
|
1302
1313
|
id,
|
|
@@ -1311,13 +1322,13 @@ var Checkbox = (0, import_react28.forwardRef)(function Checkbox2({
|
|
|
1311
1322
|
}
|
|
1312
1323
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CheckboxWithLabel, { className, disabled, id: htmlId, input, children });
|
|
1313
1324
|
});
|
|
1314
|
-
var Checkbox_default = (0,
|
|
1325
|
+
var Checkbox_default = (0, import_react29.memo)(Checkbox);
|
|
1315
1326
|
|
|
1316
1327
|
// src/components/TagItem/index.tsx
|
|
1317
|
-
var
|
|
1328
|
+
var import_react30 = require("react");
|
|
1318
1329
|
var import_utils8 = require("@react-aria/utils");
|
|
1319
1330
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1320
|
-
var TagItem = (0,
|
|
1331
|
+
var TagItem = (0, import_react30.forwardRef)(function TagItemInner({
|
|
1321
1332
|
as,
|
|
1322
1333
|
label,
|
|
1323
1334
|
translatedLabel,
|
|
@@ -1332,7 +1343,7 @@ var TagItem = (0, import_react29.forwardRef)(function TagItemInner({
|
|
|
1332
1343
|
const className = useClassNames("charcoal-tag-item", "charcoal-tag-item__bg", props.className);
|
|
1333
1344
|
const bgVariant = bgImage !== void 0 && bgImage.length > 0 ? "image" : "color";
|
|
1334
1345
|
const bg = bgVariant === "color" ? bgColor : `url(${bgImage ?? ""})`;
|
|
1335
|
-
const Component = (0,
|
|
1346
|
+
const Component = (0, import_react30.useMemo)(() => as ?? "button", [as]);
|
|
1336
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: {
|
|
1337
1348
|
"--charcoal-tag-item-bg": bg
|
|
1338
1349
|
}, children: [
|
|
@@ -1343,7 +1354,7 @@ var TagItem = (0, import_react29.forwardRef)(function TagItemInner({
|
|
|
1343
1354
|
status === "active" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon_default, { name: "16/Remove" })
|
|
1344
1355
|
] });
|
|
1345
1356
|
});
|
|
1346
|
-
var TagItem_default = (0,
|
|
1357
|
+
var TagItem_default = (0, import_react30.memo)(TagItem);
|
|
1347
1358
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1348
1359
|
0 && (module.exports = {
|
|
1349
1360
|
Button,
|
|
@@ -1362,6 +1373,7 @@ var TagItem_default = (0, import_react29.memo)(TagItem);
|
|
|
1362
1373
|
ModalAlign,
|
|
1363
1374
|
ModalBody,
|
|
1364
1375
|
ModalButtons,
|
|
1376
|
+
ModalCloseButton,
|
|
1365
1377
|
ModalHeader,
|
|
1366
1378
|
OverlayProvider,
|
|
1367
1379
|
Radio,
|