@charcoal-ui/react 4.2.0 → 4.3.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/_lib/index.d.ts.map +1 -1
  2. package/dist/components/Button/index.d.ts +2 -2
  3. package/dist/components/Button/index.d.ts.map +1 -1
  4. package/dist/components/Clickable/index.d.ts +2 -2
  5. package/dist/components/Clickable/index.d.ts.map +1 -1
  6. package/dist/components/DropdownSelector/ListItem/index.d.ts +2 -2
  7. package/dist/components/DropdownSelector/ListItem/index.d.ts.map +1 -1
  8. package/dist/components/DropdownSelector/MenuList/MenuListContext.d.ts +1 -1
  9. package/dist/components/DropdownSelector/MenuList/MenuListContext.d.ts.map +1 -1
  10. package/dist/components/DropdownSelector/Popover/index.d.ts +2 -2
  11. package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
  12. package/dist/components/IconButton/index.d.ts +2 -2
  13. package/dist/components/IconButton/index.d.ts.map +1 -1
  14. package/dist/components/Modal/useCustomModalOverlay.d.ts +1 -1
  15. package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
  16. package/dist/components/Radio/RadioGroup/index.d.ts +1 -0
  17. package/dist/components/Radio/RadioGroup/index.d.ts.map +1 -1
  18. package/dist/components/TagItem/index.d.ts +2 -2
  19. package/dist/components/TagItem/index.d.ts.map +1 -1
  20. package/dist/components/TextField/index.d.ts.map +1 -1
  21. package/dist/components/TextField/useFocusWithClick.d.ts +1 -1
  22. package/dist/components/TextField/useFocusWithClick.d.ts.map +1 -1
  23. package/dist/core/SetThemeScript.d.ts +18 -0
  24. package/dist/core/SetThemeScript.d.ts.map +1 -0
  25. package/dist/core/themeHelper.d.ts +39 -0
  26. package/dist/core/themeHelper.d.ts.map +1 -0
  27. package/dist/index.cjs.js +424 -233
  28. package/dist/index.cjs.js.map +1 -1
  29. package/dist/index.css +1 -1
  30. package/dist/index.css.map +1 -1
  31. package/dist/index.d.ts +2 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.esm.js +315 -137
  34. package/dist/index.esm.js.map +1 -1
  35. package/dist/layered.css +1 -1
  36. package/dist/layered.css.map +1 -1
  37. package/package.json +11 -9
  38. package/src/_lib/index.ts +2 -0
  39. package/src/components/Button/index.tsx +7 -1
  40. package/src/components/Clickable/index.tsx +1 -1
  41. package/src/components/DropdownSelector/ListItem/index.tsx +1 -1
  42. package/src/components/DropdownSelector/MenuList/MenuListContext.ts +1 -1
  43. package/src/components/DropdownSelector/Popover/index.tsx +3 -2
  44. package/src/components/IconButton/index.tsx +30 -30
  45. package/src/components/Modal/__snapshots__/index.story.storyshot +0 -5
  46. package/src/components/Modal/useCustomModalOverlay.tsx +1 -1
  47. package/src/components/Radio/RadioGroup/index.tsx +1 -1
  48. package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +0 -7
  49. package/src/components/TagItem/index.tsx +55 -55
  50. package/src/components/TextArea/index.css +1 -1
  51. package/src/components/TextField/index.tsx +2 -4
  52. package/src/components/TextField/text-field.test.tsx +72 -0
  53. package/src/components/TextField/useFocusWithClick.tsx +2 -2
  54. package/src/core/SetThemeScript.tsx +57 -0
  55. package/src/core/themeHelper.ts +180 -0
  56. package/src/index.ts +11 -0
package/dist/index.esm.js CHANGED
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  // src/core/SSRProvider.tsx
2
4
  import { SSRProvider as OriginSSRProvider } from "@react-aria/ssr";
3
5
  import { version, Fragment } from "react";
@@ -18,17 +20,175 @@ function CharcoalProvider({
18
20
  return /* @__PURE__ */ jsx(SSRProvider, { children: /* @__PURE__ */ jsx(OverlayProvider, { children }) });
19
21
  }
20
22
 
23
+ // src/core/themeHelper.ts
24
+ import { useEffect, useMemo, useState } from "react";
25
+ var LOCAL_STORAGE_KEY = "charcoal-theme";
26
+ var DEFAULT_ROOT_ATTRIBUTE = "theme";
27
+ var keyStringRegExp = new RegExp(/^(\w|-)+$/);
28
+ function assertKeyString(key) {
29
+ if (!keyStringRegExp.test(key)) {
30
+ throw new Error(`Unexpected key :${key}, expect: /^(\\w|-)+$/`);
31
+ }
32
+ }
33
+ var themeSetter = (attr = DEFAULT_ROOT_ATTRIBUTE) => (theme) => {
34
+ assertKeyString(attr);
35
+ if (theme !== void 0) {
36
+ document.documentElement.dataset[attr] = theme;
37
+ } else {
38
+ delete document.documentElement.dataset[attr];
39
+ }
40
+ };
41
+ function themeSelector(theme, attr) {
42
+ return `:root[data-${attr ?? DEFAULT_ROOT_ATTRIBUTE}='${theme}']`;
43
+ }
44
+ function prefersColorScheme(theme) {
45
+ return `@media (prefers-color-scheme: ${theme})`;
46
+ }
47
+ function useThemeSetter({
48
+ key = LOCAL_STORAGE_KEY,
49
+ setter = themeSetter()
50
+ } = {}) {
51
+ const [theme, , system] = useTheme(key);
52
+ useEffect(() => {
53
+ if (theme === void 0) {
54
+ return;
55
+ }
56
+ setter(system ? void 0 : theme);
57
+ }, [setter, system, theme]);
58
+ }
59
+ function getThemeSync(key = LOCAL_STORAGE_KEY) {
60
+ const theme = localStorage.getItem(key);
61
+ return theme;
62
+ }
63
+ var useTheme = (localStorageKey = LOCAL_STORAGE_KEY) => {
64
+ assertKeyString(localStorageKey);
65
+ const isDark = useMedia("(prefers-color-scheme: dark)");
66
+ const media = isDark !== void 0 ? isDark ? "dark" : "light" : void 0;
67
+ const [local, setTheme, ready] = useLocalStorage(localStorageKey);
68
+ const theme = !ready || media === void 0 ? void 0 : local ?? media;
69
+ const system = local === void 0;
70
+ return [theme, setTheme, system];
71
+ };
72
+ function useLocalStorage(key, defaultValue) {
73
+ const [ready, setReady] = useState(false);
74
+ const [state, setState] = useState();
75
+ const defaultValueMemo = useMemo(() => defaultValue?.(), [defaultValue]);
76
+ useEffect(() => {
77
+ fetch();
78
+ window.addEventListener("storage", handleStorage);
79
+ return () => {
80
+ window.removeEventListener("storage", handleStorage);
81
+ };
82
+ });
83
+ const handleStorage = (e) => {
84
+ if (e.storageArea !== localStorage) {
85
+ return;
86
+ }
87
+ if (e.key !== key) {
88
+ return;
89
+ }
90
+ fetch();
91
+ };
92
+ const fetch = () => {
93
+ const raw = localStorage.getItem(key);
94
+ setState((raw !== null ? deserialize(raw) : null) ?? defaultValueMemo);
95
+ setReady(true);
96
+ };
97
+ const set = (value) => {
98
+ if (value === void 0) {
99
+ localStorage.removeItem(key);
100
+ } else {
101
+ const raw = serialize(value);
102
+ localStorage.setItem(key, raw);
103
+ }
104
+ const event = new StorageEvent("storage", {
105
+ bubbles: true,
106
+ cancelable: false,
107
+ key,
108
+ url: location.href,
109
+ storageArea: localStorage
110
+ });
111
+ dispatchEvent(event);
112
+ };
113
+ return [state ?? defaultValueMemo, set, ready];
114
+ }
115
+ function deserialize(raw) {
116
+ try {
117
+ return JSON.parse(raw);
118
+ } catch {
119
+ return raw;
120
+ }
121
+ }
122
+ function serialize(value) {
123
+ if (typeof value === "string") {
124
+ return value;
125
+ } else {
126
+ return JSON.stringify(value);
127
+ }
128
+ }
129
+ function useMedia(query) {
130
+ const [match, setState] = useState();
131
+ useEffect(() => {
132
+ const matcher = window.matchMedia(query);
133
+ const onChange = () => {
134
+ setState(matcher.matches);
135
+ };
136
+ matcher.addEventListener("change", onChange);
137
+ setState(matcher.matches);
138
+ return () => {
139
+ matcher.removeEventListener("change", onChange);
140
+ };
141
+ }, [query]);
142
+ return match;
143
+ }
144
+
145
+ // src/core/SetThemeScript.tsx
146
+ import { jsx as jsx2 } from "react/jsx-runtime";
147
+ function makeSetThemeScriptCode({
148
+ localStorageKey = defaultProps.localStorageKey,
149
+ rootAttribute = defaultProps.rootAttribute
150
+ } = defaultProps) {
151
+ assertKeyString(localStorageKey);
152
+ assertKeyString(rootAttribute);
153
+ return `'use strict';
154
+ (function () {
155
+ var localStorageKey = '${localStorageKey}'
156
+ var rootAttribute = '${rootAttribute}'
157
+ var currentTheme = localStorage.getItem(localStorageKey);
158
+ if (currentTheme) {
159
+ document.documentElement.dataset[rootAttribute] = currentTheme;
160
+ }
161
+ })();
162
+ `;
163
+ }
164
+ function SetThemeScript({
165
+ localStorageKey = defaultProps.localStorageKey,
166
+ rootAttribute = defaultProps.rootAttribute
167
+ }) {
168
+ const src = makeSetThemeScriptCode({
169
+ localStorageKey,
170
+ rootAttribute
171
+ });
172
+ return /* @__PURE__ */ jsx2("script", { dangerouslySetInnerHTML: {
173
+ __html: src
174
+ } });
175
+ }
176
+ var defaultProps = {
177
+ localStorageKey: LOCAL_STORAGE_KEY,
178
+ rootAttribute: DEFAULT_ROOT_ATTRIBUTE
179
+ };
180
+
21
181
  // src/components/Button/index.tsx
22
- import { forwardRef, useMemo as useMemo2 } from "react";
182
+ import { forwardRef, useMemo as useMemo3 } from "react";
23
183
 
24
184
  // src/_lib/useClassNames.ts
25
- import { useMemo } from "react";
185
+ import { useMemo as useMemo2 } from "react";
26
186
  function useClassNames(...classNames) {
27
- return useMemo(() => classNames.filter((v) => v).join(" "), [classNames]);
187
+ return useMemo2(() => classNames.filter((v) => v).join(" "), [classNames]);
28
188
  }
29
189
 
30
190
  // src/components/Button/index.tsx
31
- import { jsx as jsx2 } from "react/jsx-runtime";
191
+ import { jsx as jsx3 } from "react/jsx-runtime";
32
192
  var Button = forwardRef(function Button2({
33
193
  variant,
34
194
  fullWidth,
@@ -38,28 +198,28 @@ var Button = forwardRef(function Button2({
38
198
  isActive,
39
199
  ...props
40
200
  }, ref) {
41
- const Component = useMemo2(() => component ?? "button", [component]);
201
+ const Component = useMemo3(() => component ?? "button", [component]);
42
202
  const classNames = useClassNames("charcoal-button", className);
43
- return /* @__PURE__ */ jsx2(Component, { ...props, className: classNames, "data-variant": variant, "data-size": size, "data-full-width": fullWidth, "data-active": isActive, ref });
203
+ return /* @__PURE__ */ jsx3(Component, { ...props, className: classNames, "data-variant": variant, "data-size": size, "data-full-width": fullWidth, "data-active": isActive, ref });
44
204
  });
45
205
  var Button_default = Button;
46
206
 
47
207
  // src/components/Clickable/index.tsx
48
- import { useMemo as useMemo3, forwardRef as forwardRef2 } from "react";
49
- import { jsx as jsx3 } from "react/jsx-runtime";
208
+ import { useMemo as useMemo4, forwardRef as forwardRef2 } from "react";
209
+ import { jsx as jsx4 } from "react/jsx-runtime";
50
210
  var Clickable = forwardRef2(function Clickable2({
51
211
  component,
52
212
  ...props
53
213
  }, ref) {
54
214
  const className = useClassNames("charcoal-clickable", props.className);
55
- const Component = useMemo3(() => component ?? "button", [component]);
56
- return /* @__PURE__ */ jsx3(Component, { ...props, ref, className });
215
+ const Component = useMemo4(() => component ?? "button", [component]);
216
+ return /* @__PURE__ */ jsx4(Component, { ...props, ref, className });
57
217
  });
58
218
  var Clickable_default = Clickable;
59
219
 
60
220
  // src/components/IconButton/index.tsx
61
- import { forwardRef as forwardRef3, useMemo as useMemo4 } from "react";
62
- import { jsx as jsx4 } from "react/jsx-runtime";
221
+ import { forwardRef as forwardRef3, useMemo as useMemo5 } from "react";
222
+ import { jsx as jsx5 } from "react/jsx-runtime";
63
223
  var IconButton = forwardRef3(function IconButtonInner({
64
224
  variant = "Default",
65
225
  size = "M",
@@ -69,9 +229,9 @@ var IconButton = forwardRef3(function IconButtonInner({
69
229
  ...rest
70
230
  }, ref) {
71
231
  validateIconSize(size, icon);
72
- const Component = useMemo4(() => component ?? "button", [component]);
232
+ const Component = useMemo5(() => component ?? "button", [component]);
73
233
  const classNames = useClassNames("charcoal-icon-button", rest.className);
74
- return /* @__PURE__ */ jsx4(Component, { ...rest, ref, className: classNames, "data-size": size, "data-active": isActive, "data-variant": variant, children: /* @__PURE__ */ jsx4("pixiv-icon", { name: icon }) });
234
+ return /* @__PURE__ */ jsx5(Component, { ...rest, ref, className: classNames, "data-size": size, "data-active": isActive, "data-variant": variant, children: /* @__PURE__ */ jsx5("pixiv-icon", { name: icon }) });
75
235
  });
76
236
  var IconButton_default = IconButton;
77
237
  function validateIconSize(size, icon) {
@@ -114,7 +274,7 @@ var RadioGroupContext = React4.createContext({
114
274
 
115
275
  // src/components/Radio/RadioInput/index.tsx
116
276
  import { forwardRef as forwardRef4, memo, useCallback } from "react";
117
- import { jsx as jsx5 } from "react/jsx-runtime";
277
+ import { jsx as jsx6 } from "react/jsx-runtime";
118
278
  var RadioInput = forwardRef4(function RadioInput2({
119
279
  onChange,
120
280
  invalid,
@@ -126,12 +286,12 @@ var RadioInput = forwardRef4(function RadioInput2({
126
286
  onChange?.(el.value);
127
287
  }, [onChange]);
128
288
  const classNames = useClassNames("charcoal-radio-input", className);
129
- return /* @__PURE__ */ jsx5("input", { className: classNames, ref, type: "radio", onChange: handleChange, "aria-invalid": invalid, ...props });
289
+ return /* @__PURE__ */ jsx6("input", { className: classNames, ref, type: "radio", onChange: handleChange, "aria-invalid": invalid, ...props });
130
290
  });
131
291
  var RadioInput_default = memo(RadioInput);
132
292
 
133
293
  // src/components/Radio/index.tsx
134
- import { jsx as jsx6, jsxs } from "react/jsx-runtime";
294
+ import { jsx as jsx7, jsxs } from "react/jsx-runtime";
135
295
  var Radio = forwardRef5(function RadioInner({
136
296
  value,
137
297
  disabled = false,
@@ -148,6 +308,7 @@ var Radio = forwardRef5(function RadioInner({
148
308
  } = useContext(RadioGroupContext);
149
309
  const classNames = useClassNames("charcoal-radio__label", props.className);
150
310
  warning(
311
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
151
312
  name !== void 0,
152
313
  `"name" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`
153
314
  );
@@ -155,15 +316,15 @@ var Radio = forwardRef5(function RadioInner({
155
316
  const isDisabled = disabled || isParentDisabled;
156
317
  const isReadonly = readonly && !isSelected;
157
318
  return /* @__PURE__ */ jsxs("label", { "aria-disabled": isDisabled || isReadonly, className: classNames, children: [
158
- /* @__PURE__ */ jsx6(RadioInput_default, { name, value, checked: isSelected, "aria-invalid": invalid, onChange, disabled: isDisabled || isReadonly, ref }),
159
- children != null && /* @__PURE__ */ jsx6("div", { className: "charcoal-radio__label_div", children })
319
+ /* @__PURE__ */ jsx7(RadioInput_default, { name, value, checked: isSelected, "aria-invalid": invalid, onChange, disabled: isDisabled || isReadonly, ref }),
320
+ children != null && /* @__PURE__ */ jsx7("div", { className: "charcoal-radio__label_div", children })
160
321
  ] });
161
322
  });
162
323
  var Radio_default = memo2(Radio);
163
324
 
164
325
  // src/components/Radio/RadioGroup/index.tsx
165
- import { forwardRef as forwardRef6, useCallback as useCallback2, useMemo as useMemo5 } from "react";
166
- import { jsx as jsx7 } from "react/jsx-runtime";
326
+ import { forwardRef as forwardRef6, useCallback as useCallback2, useMemo as useMemo6 } from "react";
327
+ import { jsx as jsx8 } from "react/jsx-runtime";
167
328
  var RadioGroup = forwardRef6(function RadioGroupInner({
168
329
  value,
169
330
  label,
@@ -180,7 +341,7 @@ var RadioGroup = forwardRef6(function RadioGroupInner({
180
341
  const handleChange = useCallback2((next) => {
181
342
  onChange(next);
182
343
  }, [onChange]);
183
- const contextValue = useMemo5(() => ({
344
+ const contextValue = useMemo6(() => ({
184
345
  name,
185
346
  selected: value,
186
347
  disabled: disabled ?? false,
@@ -188,7 +349,7 @@ var RadioGroup = forwardRef6(function RadioGroupInner({
188
349
  invalid: invalid ?? false,
189
350
  onChange: handleChange
190
351
  }), [disabled, handleChange, invalid, name, readonly, value]);
191
- return /* @__PURE__ */ jsx7(RadioGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx7("div", { role: "radiogroup", "aria-disabled": disabled, "aria-invalid": invalid, "aria-label": label, "aria-labelledby": props["aria-labelledby"], "aria-orientation": ariaOrientation, className: classNames, ref, children }) });
352
+ return /* @__PURE__ */ jsx8(RadioGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx8("div", { role: "radiogroup", "aria-disabled": disabled, "aria-invalid": invalid, "aria-label": label, "aria-labelledby": props["aria-labelledby"], "aria-orientation": ariaOrientation, className: classNames, ref, children }) });
192
353
  });
193
354
 
194
355
  // src/components/Switch/index.tsx
@@ -197,7 +358,7 @@ import { useId } from "@react-aria/utils";
197
358
 
198
359
  // src/components/Switch/SwitchInput/index.tsx
199
360
  import { forwardRef as forwardRef7, useCallback as useCallback3 } from "react";
200
- import { jsx as jsx8 } from "react/jsx-runtime";
361
+ import { jsx as jsx9 } from "react/jsx-runtime";
201
362
  var SwitchInput = forwardRef7(function SwitchInput2({
202
363
  onChange,
203
364
  className,
@@ -208,13 +369,13 @@ var SwitchInput = forwardRef7(function SwitchInput2({
208
369
  onChange?.(el.checked);
209
370
  }, [onChange]);
210
371
  const classNames = useClassNames("charcoal-switch-input", className);
211
- return /* @__PURE__ */ jsx8("input", { ref, className: classNames, type: "checkbox", onChange: handleChange, ...props });
372
+ return /* @__PURE__ */ jsx9("input", { ref, className: classNames, type: "checkbox", onChange: handleChange, ...props });
212
373
  });
213
374
  var SwitchInput_default = SwitchInput;
214
375
 
215
376
  // src/components/Switch/SwitchWithLabel.tsx
216
377
  import * as React5 from "react";
217
- import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
378
+ import { jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
218
379
  var SwitchWithLabel = React5.memo(function SwitchWithLabel2({
219
380
  children,
220
381
  className,
@@ -225,12 +386,12 @@ var SwitchWithLabel = React5.memo(function SwitchWithLabel2({
225
386
  const classNames = useClassNames("charcoal-switch__label", className);
226
387
  return /* @__PURE__ */ jsxs2("label", { htmlFor: id, className: classNames, "aria-disabled": disabled, children: [
227
388
  input,
228
- /* @__PURE__ */ jsx9("div", { className: "charcoal-switch__label_div", children })
389
+ /* @__PURE__ */ jsx10("div", { className: "charcoal-switch__label_div", children })
229
390
  ] });
230
391
  });
231
392
 
232
393
  // src/components/Switch/index.tsx
233
- import { jsx as jsx10 } from "react/jsx-runtime";
394
+ import { jsx as jsx11 } from "react/jsx-runtime";
234
395
  var Switch = forwardRef8(function Switch2({
235
396
  children,
236
397
  onChange,
@@ -241,22 +402,22 @@ var Switch = forwardRef8(function Switch2({
241
402
  }, ref) {
242
403
  const htmlId = useId(id);
243
404
  const noChildren = children === void 0;
244
- const input = /* @__PURE__ */ jsx10(SwitchInput_default, { ...props, disabled, className: noChildren ? className : void 0, id: htmlId, onChange, ref, role: "switch", type: "checkbox" });
405
+ const input = /* @__PURE__ */ jsx11(SwitchInput_default, { ...props, disabled, className: noChildren ? className : void 0, id: htmlId, onChange, ref, role: "switch", type: "checkbox" });
245
406
  if (noChildren) {
246
407
  return input;
247
408
  }
248
- return /* @__PURE__ */ jsx10(SwitchWithLabel, { className, disabled, id: htmlId, input, children });
409
+ return /* @__PURE__ */ jsx11(SwitchWithLabel, { className, disabled, id: htmlId, input, children });
249
410
  });
250
411
  var Switch_default = memo4(Switch);
251
412
 
252
413
  // src/components/TextField/index.tsx
253
414
  import { useVisuallyHidden } from "@react-aria/visually-hidden";
254
- import { useCallback as useCallback4, useEffect as useEffect2, useRef, useState } from "react";
415
+ import { useCallback as useCallback4, useEffect as useEffect3, useRef, useState as useState2 } from "react";
255
416
  import * as React7 from "react";
256
417
 
257
418
  // src/components/FieldLabel/index.tsx
258
419
  import * as React6 from "react";
259
- import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
420
+ import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
260
421
  var FieldLabel = React6.forwardRef(function FieldLabel2({
261
422
  style,
262
423
  className,
@@ -268,9 +429,9 @@ var FieldLabel = React6.forwardRef(function FieldLabel2({
268
429
  }, ref) {
269
430
  const classNames = useClassNames("charcoal-field-label-root", className);
270
431
  return /* @__PURE__ */ jsxs3("div", { style, className: classNames, children: [
271
- /* @__PURE__ */ jsx11("label", { ref, className: "charcoal-field-label", ...labelProps, children: label }),
272
- required && /* @__PURE__ */ jsx11("div", { className: "charcoal-field-label-required-text", children: requiredText }),
273
- /* @__PURE__ */ jsx11("div", { className: "charcoal-field-label-sub-label", children: /* @__PURE__ */ jsx11("span", { children: subLabel }) })
432
+ /* @__PURE__ */ jsx12("label", { ref, className: "charcoal-field-label", ...labelProps, children: label }),
433
+ required && /* @__PURE__ */ jsx12("div", { className: "charcoal-field-label-required-text", children: requiredText }),
434
+ /* @__PURE__ */ jsx12("div", { className: "charcoal-field-label-sub-label", children: /* @__PURE__ */ jsx12("span", { children: subLabel }) })
274
435
  ] });
275
436
  });
276
437
  var FieldLabel_default = FieldLabel;
@@ -293,9 +454,9 @@ function countCodePointsInString(string) {
293
454
  }
294
455
 
295
456
  // src/components/TextField/useFocusWithClick.tsx
296
- import { useEffect } from "react";
457
+ import { useEffect as useEffect2 } from "react";
297
458
  function useFocusWithClick(containerRef, inputRef) {
298
- useEffect(() => {
459
+ useEffect2(() => {
299
460
  const el = containerRef.current;
300
461
  if (el) {
301
462
  const handleDown = (e) => {
@@ -316,14 +477,14 @@ import { mergeRefs as mergeRefs2, useId as useId2 } from "@react-aria/utils";
316
477
 
317
478
  // src/_lib/createDivComponent.tsx
318
479
  import { forwardRef as forwardRef10 } from "react";
319
- import { jsx as jsx12 } from "react/jsx-runtime";
480
+ import { jsx as jsx13 } from "react/jsx-runtime";
320
481
  function createDivComponent(mainClassName) {
321
482
  return forwardRef10(function DivComponent({
322
483
  className,
323
484
  ...props
324
485
  }, ref) {
325
486
  const classNames = useClassNames(mainClassName, className);
326
- return /* @__PURE__ */ jsx12("div", { className: classNames, ref, ...props });
487
+ return /* @__PURE__ */ jsx13("div", { className: classNames, ref, ...props });
327
488
  });
328
489
  }
329
490
 
@@ -331,7 +492,7 @@ function createDivComponent(mainClassName) {
331
492
  var AssistiveText = createDivComponent("charcoal-text-field-assistive-text");
332
493
 
333
494
  // src/components/TextField/index.tsx
334
- import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
495
+ import { jsx as jsx14, jsxs as jsxs4 } from "react/jsx-runtime";
335
496
  var TextField = React7.forwardRef(function SingleLineTextFieldInner({
336
497
  assistiveText,
337
498
  className,
@@ -356,7 +517,7 @@ var TextField = React7.forwardRef(function SingleLineTextFieldInner({
356
517
  const {
357
518
  visuallyHiddenProps
358
519
  } = useVisuallyHidden();
359
- const [count, setCount] = useState(getCount(value ?? ""));
520
+ const [count, setCount] = useState2(getCount(value ?? ""));
360
521
  const handleChange = useCallback4((e) => {
361
522
  const value2 = e.target.value;
362
523
  const count2 = getCount(value2);
@@ -366,7 +527,7 @@ var TextField = React7.forwardRef(function SingleLineTextFieldInner({
366
527
  setCount(count2);
367
528
  onChange?.(value2);
368
529
  }, [getCount, maxLength, onChange]);
369
- useEffect2(() => {
530
+ useEffect3(() => {
370
531
  setCount(getCount(value ?? ""));
371
532
  }, [getCount, value]);
372
533
  const containerRef = useRef(null);
@@ -377,25 +538,25 @@ var TextField = React7.forwardRef(function SingleLineTextFieldInner({
377
538
  const showAssistiveText = assistiveText != null && assistiveText.length !== 0;
378
539
  const classNames = useClassNames("charcoal-text-field-root", className);
379
540
  return /* @__PURE__ */ jsxs4("div", { className: classNames, "aria-disabled": disabled, children: [
380
- /* @__PURE__ */ jsx13(FieldLabel_default, { htmlFor: inputId, id: labelledbyId, label, required, requiredText, subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
541
+ /* @__PURE__ */ jsx14(FieldLabel_default, { htmlFor: inputId, id: labelledbyId, label, required, requiredText, subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
381
542
  /* @__PURE__ */ jsxs4("div", { className: "charcoal-text-field-container", "aria-disabled": disabled === true ? true : void 0, "data-invalid": invalid === true, ref: containerRef, children: [
382
- prefix !== null && /* @__PURE__ */ jsx13("div", { className: "charcoal-text-field-prefix", children: prefix }),
383
- /* @__PURE__ */ jsx13("input", { className: "charcoal-text-field-input", "aria-describedby": showAssistiveText ? describedbyId : void 0, "aria-invalid": invalid, "aria-labelledby": labelledbyId, id: inputId, "data-invalid": invalid === true, maxLength, onChange: handleChange, disabled, ref: mergeRefs2(forwardRef23, inputRef), type, value, ...props }),
384
- (suffix !== null || showCount) && /* @__PURE__ */ jsxs4("div", { className: "charcoal-text-field-suffix", children: [
543
+ prefix && /* @__PURE__ */ jsx14("div", { className: "charcoal-text-field-prefix", children: prefix }),
544
+ /* @__PURE__ */ jsx14("input", { className: "charcoal-text-field-input", "aria-describedby": showAssistiveText ? describedbyId : void 0, "aria-invalid": invalid, "aria-labelledby": labelledbyId, id: inputId, "data-invalid": invalid === true, maxLength, onChange: handleChange, disabled, ref: mergeRefs2(forwardRef23, inputRef), type, value, ...props }),
545
+ (suffix || showCount) && /* @__PURE__ */ jsxs4("div", { className: "charcoal-text-field-suffix", children: [
385
546
  suffix,
386
- showCount && /* @__PURE__ */ jsx13("span", { className: "charcoal-text-field-line-counter", children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
547
+ showCount && /* @__PURE__ */ jsx14("span", { className: "charcoal-text-field-line-counter", children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
387
548
  ] })
388
549
  ] }),
389
- showAssistiveText && /* @__PURE__ */ jsx13(AssistiveText, { "data-invalid": invalid === true, id: describedbyId, children: assistiveText })
550
+ showAssistiveText && /* @__PURE__ */ jsx14(AssistiveText, { "data-invalid": invalid === true, id: describedbyId, children: assistiveText })
390
551
  ] });
391
552
  });
392
553
  var TextField_default = TextField;
393
554
 
394
555
  // src/components/TextArea/index.tsx
395
556
  import { useVisuallyHidden as useVisuallyHidden2 } from "@react-aria/visually-hidden";
396
- import { forwardRef as forwardRef12, useCallback as useCallback5, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
557
+ import { forwardRef as forwardRef12, useCallback as useCallback5, useEffect as useEffect4, useRef as useRef2, useState as useState3 } from "react";
397
558
  import { useId as useId3 } from "@react-aria/utils";
398
- import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
559
+ import { jsx as jsx15, jsxs as jsxs5 } from "react/jsx-runtime";
399
560
  var TextArea = forwardRef12(function TextAreaInner({
400
561
  onChange,
401
562
  className,
@@ -419,8 +580,8 @@ var TextArea = forwardRef12(function TextAreaInner({
419
580
  visuallyHiddenProps
420
581
  } = useVisuallyHidden2();
421
582
  const textareaRef = useRef2(null);
422
- const [count, setCount] = useState2(getCount(value ?? ""));
423
- const [rows, setRows] = useState2(initialRows);
583
+ const [count, setCount] = useState3(getCount(value ?? ""));
584
+ const [rows, setRows] = useState3(initialRows);
424
585
  const syncHeight = useCallback5((textarea) => {
425
586
  const rows2 = (`${textarea.value}
426
587
  `.match(/\n/gu)?.length ?? 0) || 1;
@@ -441,10 +602,10 @@ var TextArea = forwardRef12(function TextAreaInner({
441
602
  }
442
603
  onChange?.(value2);
443
604
  }, [autoHeight, getCount, maxLength, nonControlled, onChange, syncHeight]);
444
- useEffect3(() => {
605
+ useEffect4(() => {
445
606
  setCount(getCount(value ?? ""));
446
607
  }, [getCount, value]);
447
- useEffect3(() => {
608
+ useEffect4(() => {
448
609
  if (autoHeight && textareaRef.current !== null) {
449
610
  syncHeight(textareaRef.current);
450
611
  }
@@ -457,14 +618,14 @@ var TextArea = forwardRef12(function TextAreaInner({
457
618
  const classNames = useClassNames("charcoal-text-area-root", className);
458
619
  const showAssistiveText = assistiveText != null && assistiveText.length !== 0;
459
620
  return /* @__PURE__ */ jsxs5("div", { className: classNames, "aria-disabled": disabled, children: [
460
- /* @__PURE__ */ jsx14(FieldLabel_default, { htmlFor: textAreaId, id: labelledbyId, label, required, requiredText, subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
621
+ /* @__PURE__ */ jsx15(FieldLabel_default, { htmlFor: textAreaId, id: labelledbyId, label, required, requiredText, subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
461
622
  /* @__PURE__ */ jsxs5("div", { className: "charcoal-text-area-container", "aria-disabled": disabled === true ? "true" : void 0, "aria-invalid": invalid === true, ref: containerRef, style: {
462
623
  "--charcoal-text-area-rows": `${showCount ? rows + 1 : rows}`
463
624
  }, children: [
464
- /* @__PURE__ */ jsx14("textarea", { className: "charcoal-text-area-textarea", "aria-describedby": showAssistiveText ? describedbyId : void 0, "aria-invalid": invalid, "aria-labelledby": labelledbyId, id: textAreaId, maxLength, "data-no-bottom-padding": showCount, onChange: handleChange, ref: mergeRefs(forwardRef23, textareaRef), rows, value, disabled, ...props }),
465
- showCount && /* @__PURE__ */ jsx14("span", { className: "charcoal-text-area-counter", children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
625
+ /* @__PURE__ */ jsx15("textarea", { className: "charcoal-text-area-textarea", "aria-describedby": showAssistiveText ? describedbyId : void 0, "aria-invalid": invalid, "aria-labelledby": labelledbyId, id: textAreaId, maxLength, "data-no-bottom-padding": showCount, onChange: handleChange, ref: mergeRefs(forwardRef23, textareaRef), rows, value, disabled, ...props }),
626
+ showCount && /* @__PURE__ */ jsx15("span", { className: "charcoal-text-area-counter", children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
466
627
  ] }),
467
- showAssistiveText && /* @__PURE__ */ jsx14(AssistiveText, { "data-invalid": invalid === true, id: describedbyId, children: assistiveText })
628
+ showAssistiveText && /* @__PURE__ */ jsx15(AssistiveText, { "data-invalid": invalid === true, id: describedbyId, children: assistiveText })
468
629
  ] });
469
630
  });
470
631
  var TextArea_default = TextArea;
@@ -472,7 +633,7 @@ var TextArea_default = TextArea;
472
633
  // src/components/Icon/index.tsx
473
634
  import * as React8 from "react";
474
635
  import "@charcoal-ui/icons";
475
- import { jsx as jsx15 } from "react/jsx-runtime";
636
+ import { jsx as jsx16 } from "react/jsx-runtime";
476
637
  var Icon = React8.forwardRef(function IconInner({
477
638
  name,
478
639
  scale,
@@ -480,7 +641,7 @@ var Icon = React8.forwardRef(function IconInner({
480
641
  className,
481
642
  ...rest
482
643
  }, ref) {
483
- return /* @__PURE__ */ jsx15("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
644
+ return /* @__PURE__ */ jsx16("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
484
645
  });
485
646
  var Icon_default = Icon;
486
647
 
@@ -512,7 +673,7 @@ function useForwardedRef(ref) {
512
673
  }
513
674
 
514
675
  // src/components/Modal/Dialog/index.tsx
515
- import { jsx as jsx16 } from "react/jsx-runtime";
676
+ import { jsx as jsx17 } from "react/jsx-runtime";
516
677
  var Dialog = forwardRef14(function Dialog2({
517
678
  size,
518
679
  bottomSheet,
@@ -526,7 +687,7 @@ var Dialog = forwardRef14(function Dialog2({
526
687
  role: "dialog"
527
688
  }, ref);
528
689
  const classNames = useClassNames("charcoal-modal-dialog", className);
529
- return /* @__PURE__ */ jsx16("div", { className: classNames, role: dialogProps.role, "data-bottom-sheet": bottomSheet, tabIndex: dialogProps.tabIndex, "aria-labelledby": dialogProps["aria-labelledby"], onBlur: dialogProps.onBlur, "data-size": size, ref, ...props });
690
+ return /* @__PURE__ */ jsx17("div", { className: classNames, role: dialogProps.role, "data-bottom-sheet": bottomSheet, tabIndex: dialogProps.tabIndex, "aria-labelledby": dialogProps["aria-labelledby"], onBlur: dialogProps.onBlur, "data-size": size, ref, ...props });
530
691
  });
531
692
 
532
693
  // src/components/Modal/ModalBackgroundContext.tsx
@@ -538,9 +699,9 @@ import * as React11 from "react";
538
699
  import { ariaHideOutside, useOverlay, useOverlayFocusContain } from "@react-aria/overlays";
539
700
 
540
701
  // src/components/DropdownSelector/Popover/usePreventScroll.tsx
541
- import { useEffect as useEffect5 } from "react";
702
+ import { useEffect as useEffect6 } from "react";
542
703
  function usePreventScroll(element, isOpen) {
543
- useEffect5(() => {
704
+ useEffect6(() => {
544
705
  if (isOpen && element) {
545
706
  const defaultPaddingRight = element.style.paddingRight;
546
707
  const defaultOverflow = element.style.overflow;
@@ -595,7 +756,7 @@ function useWindowWidth() {
595
756
  }
596
757
 
597
758
  // src/components/Modal/index.tsx
598
- import { jsx as jsx17, jsxs as jsxs6 } from "react/jsx-runtime";
759
+ import { jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
599
760
  var DEFAULT_Z_INDEX = 10;
600
761
  var Modal = forwardRef15(function ModalInner({
601
762
  children,
@@ -662,13 +823,13 @@ var Modal = forwardRef15(function ModalInner({
662
823
  backgroundColor,
663
824
  overflow,
664
825
  transform
665
- }, item) => item && /* @__PURE__ */ jsx17(Overlay, { portalContainer, children: /* @__PURE__ */ jsx17(animated.div, { className: "charcoal-modal-background", ref: bgRef, ...underlayProps, style: transitionEnabled ? {
826
+ }, item) => item && /* @__PURE__ */ jsx18(Overlay, { portalContainer, children: /* @__PURE__ */ jsx18(animated.div, { className: "charcoal-modal-background", ref: bgRef, ...underlayProps, style: transitionEnabled ? {
666
827
  backgroundColor,
667
828
  overflow,
668
829
  zIndex
669
830
  } : {
670
831
  zIndex
671
- }, "data-bottom-sheet": bottomSheet, onClick: handleClick, children: /* @__PURE__ */ jsx17(ModalBackgroundContext.Provider, { value: bgRef.current, children: /* @__PURE__ */ jsx17(AnimatedDialog, { ref, ...modalProps, style: transitionEnabled ? {
832
+ }, "data-bottom-sheet": bottomSheet, onClick: handleClick, children: /* @__PURE__ */ jsx18(ModalBackgroundContext.Provider, { value: bgRef.current, children: /* @__PURE__ */ jsx18(AnimatedDialog, { ref, ...modalProps, style: transitionEnabled ? {
672
833
  transform
673
834
  } : {}, size, bottomSheet, className, children: /* @__PURE__ */ jsxs6(ModalContext.Provider, { value: {
674
835
  titleProps: {},
@@ -678,7 +839,7 @@ var Modal = forwardRef15(function ModalInner({
678
839
  bottomSheet
679
840
  }, children: [
680
841
  children,
681
- isDismissable === true && /* @__PURE__ */ jsx17(ModalCloseButton, { "aria-label": closeButtonAriaLabel, onClick: onClose })
842
+ isDismissable === true && /* @__PURE__ */ jsx18(ModalCloseButton, { "aria-label": closeButtonAriaLabel, onClick: onClose })
682
843
  ] }) }) }) }) }));
683
844
  });
684
845
  var AnimatedDialog = animated(Dialog);
@@ -691,15 +852,15 @@ var ModalContext = React12.createContext({
691
852
  bottomSheet: false
692
853
  });
693
854
  function ModalCloseButton(props) {
694
- return /* @__PURE__ */ jsx17(IconButton_default, { className: "charcoal-modal-close-button", size: "S", icon: "24/Close", type: "button", ...props });
855
+ return /* @__PURE__ */ jsx18(IconButton_default, { className: "charcoal-modal-close-button", size: "S", icon: "24/Close", type: "button", ...props });
695
856
  }
696
857
 
697
858
  // src/components/Modal/ModalPlumbing.tsx
698
859
  import { useContext as useContext3 } from "react";
699
- import { jsx as jsx18 } from "react/jsx-runtime";
860
+ import { jsx as jsx19 } from "react/jsx-runtime";
700
861
  function ModalHeader() {
701
862
  const modalCtx = useContext3(ModalContext);
702
- return /* @__PURE__ */ jsx18("div", { className: "charcoal-modal-header-root", "data-bottom-sheet": modalCtx.bottomSheet, children: /* @__PURE__ */ jsx18("div", { className: "charcoal-modal-header-title", children: modalCtx.title }) });
863
+ return /* @__PURE__ */ jsx19("div", { className: "charcoal-modal-header-root", "data-bottom-sheet": modalCtx.bottomSheet, children: /* @__PURE__ */ jsx19("div", { className: "charcoal-modal-header-title", children: modalCtx.title }) });
703
864
  }
704
865
  var ModalAlign = createDivComponent("charcoal-modal-align");
705
866
  var ModalBody = createDivComponent("charcoal-modal-body");
@@ -707,7 +868,7 @@ var ModalButtons = createDivComponent("charcoal-modal-buttons");
707
868
 
708
869
  // src/components/LoadingSpinner/index.tsx
709
870
  import { forwardRef as forwardRef16, useImperativeHandle, useRef as useRef5, memo as memo6 } from "react";
710
- import { jsx as jsx19 } from "react/jsx-runtime";
871
+ import { jsx as jsx20 } from "react/jsx-runtime";
711
872
  var LoadingSpinner = forwardRef16(function LoadingSpinnerInner({
712
873
  size = 48,
713
874
  padding = 16,
@@ -715,10 +876,10 @@ var LoadingSpinner = forwardRef16(function LoadingSpinnerInner({
715
876
  ...props
716
877
  }, ref) {
717
878
  const classNames = useClassNames("charcoal-loading-spinner", props.className);
718
- return /* @__PURE__ */ jsx19("div", { role: "progressbar", style: {
879
+ return /* @__PURE__ */ jsx20("div", { role: "progressbar", style: {
719
880
  "--charcoal-loading-spinner-size": `${size}px`,
720
881
  "--charcoal-loading-spinner-padding": `${padding}px`
721
- }, "data-transparent": transparent, className: classNames, ref, children: /* @__PURE__ */ jsx19(LoadingSpinnerIcon, {}) });
882
+ }, "data-transparent": transparent, className: classNames, ref, children: /* @__PURE__ */ jsx20(LoadingSpinnerIcon, {}) });
722
883
  });
723
884
  var LoadingSpinner_default = memo6(LoadingSpinner);
724
885
  var LoadingSpinnerIcon = forwardRef16(function LoadingSpinnerIcon2({
@@ -735,19 +896,19 @@ var LoadingSpinnerIcon = forwardRef16(function LoadingSpinnerIcon2({
735
896
  delete iconRef.current.dataset.resetAnimation;
736
897
  }
737
898
  }));
738
- return /* @__PURE__ */ jsx19("div", { role: "presentation", ref: iconRef, "data-once": once, className: "charcoal-loading-spinner-icon" });
899
+ return /* @__PURE__ */ jsx20("div", { role: "presentation", ref: iconRef, "data-once": once, className: "charcoal-loading-spinner-icon" });
739
900
  });
740
901
 
741
902
  // src/components/DropdownSelector/index.tsx
742
- import { useState as useState4, useRef as useRef9, useMemo as useMemo7, useCallback as useCallback7 } from "react";
903
+ import { useState as useState5, useRef as useRef9, useMemo as useMemo8, useCallback as useCallback7 } from "react";
743
904
 
744
905
  // src/components/DropdownSelector/DropdownPopover.tsx
745
- import { useEffect as useEffect7, useRef as useRef7 } from "react";
906
+ import { useEffect as useEffect8, useRef as useRef7 } from "react";
746
907
 
747
908
  // src/components/DropdownSelector/Popover/index.tsx
748
909
  import { useContext as useContext4, useRef as useRef6 } from "react";
749
910
  import { DismissButton, Overlay as Overlay2, usePopover } from "@react-aria/overlays";
750
- import { jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
911
+ import { jsx as jsx21, jsxs as jsxs7 } from "react/jsx-runtime";
751
912
  var _empty = () => null;
752
913
  function Popover(props) {
753
914
  const defaultPopoverRef = useRef6(null);
@@ -762,6 +923,7 @@ function Popover(props) {
762
923
  }, {
763
924
  close: props.onClose,
764
925
  isOpen: props.isOpen,
926
+ // never used
765
927
  open: _empty,
766
928
  setOpen: _empty,
767
929
  toggle: _empty
@@ -771,34 +933,34 @@ function Popover(props) {
771
933
  if (!props.isOpen)
772
934
  return null;
773
935
  return /* @__PURE__ */ jsxs7(Overlay2, { portalContainer: document.body, children: [
774
- /* @__PURE__ */ jsx20("div", { ...underlayProps, style: {
936
+ /* @__PURE__ */ jsx21("div", { ...underlayProps, style: {
775
937
  position: "fixed",
776
938
  zIndex: typeof popoverProps.style?.zIndex === "number" ? popoverProps.style.zIndex - 1 : 99999,
777
939
  inset: 0
778
940
  } }),
779
941
  /* @__PURE__ */ jsxs7("div", { ...popoverProps, ref: finalPopoverRef, className: "charcoal-popover", children: [
780
- /* @__PURE__ */ jsx20(DismissButton, { onDismiss: () => props.onClose() }),
781
- /* @__PURE__ */ jsx20("div", { tabIndex: 0, onFocus: props.onClose }),
942
+ /* @__PURE__ */ jsx21(DismissButton, { onDismiss: () => props.onClose() }),
943
+ /* @__PURE__ */ jsx21("div", { tabIndex: 0, onFocus: props.onClose }),
782
944
  props.children,
783
- /* @__PURE__ */ jsx20("div", { tabIndex: 0, onFocus: props.onClose }),
784
- /* @__PURE__ */ jsx20(DismissButton, { onDismiss: () => props.onClose() })
945
+ /* @__PURE__ */ jsx21("div", { tabIndex: 0, onFocus: props.onClose }),
946
+ /* @__PURE__ */ jsx21(DismissButton, { onDismiss: () => props.onClose() })
785
947
  ] })
786
948
  ] });
787
949
  }
788
950
 
789
951
  // src/components/DropdownSelector/DropdownPopover.tsx
790
- import { jsx as jsx21 } from "react/jsx-runtime";
952
+ import { jsx as jsx22 } from "react/jsx-runtime";
791
953
  function DropdownPopover({
792
954
  children,
793
955
  ...props
794
956
  }) {
795
957
  const ref = useRef7(null);
796
- useEffect7(() => {
958
+ useEffect8(() => {
797
959
  if (props.isOpen && ref.current && props.triggerRef.current) {
798
960
  ref.current.style.width = `${props.triggerRef.current.clientWidth}px`;
799
961
  }
800
962
  }, [props.triggerRef, props.isOpen]);
801
- useEffect7(() => {
963
+ useEffect8(() => {
802
964
  if (props.isOpen) {
803
965
  if (props.value !== void 0 && props.value !== "") {
804
966
  const windowScrollY = window.scrollY;
@@ -814,7 +976,7 @@ function DropdownPopover({
814
976
  }
815
977
  }
816
978
  }, [props.value, props.isOpen]);
817
- return /* @__PURE__ */ jsx21(Popover, { isOpen: props.isOpen, onClose: props.onClose, popoverRef: ref, triggerRef: props.triggerRef, children });
979
+ return /* @__PURE__ */ jsx22(Popover, { isOpen: props.isOpen, onClose: props.onClose, popoverRef: ref, triggerRef: props.triggerRef, children });
818
980
  }
819
981
 
820
982
  // src/components/DropdownSelector/utils/findPreviewRecursive.tsx
@@ -842,7 +1004,7 @@ function findPreviewRecursive(children, value) {
842
1004
  }
843
1005
 
844
1006
  // src/components/DropdownSelector/MenuList/index.tsx
845
- import { useMemo as useMemo6, useRef as useRef8 } from "react";
1007
+ import { useMemo as useMemo7, useRef as useRef8 } from "react";
846
1008
 
847
1009
  // src/components/DropdownSelector/MenuList/MenuListContext.ts
848
1010
  import { createContext as createContext4 } from "react";
@@ -878,11 +1040,11 @@ function getValuesRecursive(children) {
878
1040
  }
879
1041
 
880
1042
  // src/components/DropdownSelector/MenuList/index.tsx
881
- import { jsx as jsx22 } from "react/jsx-runtime";
1043
+ import { jsx as jsx23 } from "react/jsx-runtime";
882
1044
  function MenuList(props) {
883
1045
  const root = useRef8(null);
884
- const propsArray = useMemo6(() => getValuesRecursive(props.children), [props.children]);
885
- return /* @__PURE__ */ jsx22("ul", { className: "charcoal-menu-list", ref: root, children: /* @__PURE__ */ jsx22(MenuListContext.Provider, { value: {
1046
+ const propsArray = useMemo7(() => getValuesRecursive(props.children), [props.children]);
1047
+ return /* @__PURE__ */ jsx23("ul", { className: "charcoal-menu-list", ref: root, children: /* @__PURE__ */ jsx23(MenuListContext.Provider, { value: {
886
1048
  value: props.value ?? "",
887
1049
  root,
888
1050
  propsArray,
@@ -895,16 +1057,16 @@ function MenuList(props) {
895
1057
  // src/components/DropdownSelector/index.tsx
896
1058
  import { useVisuallyHidden as useVisuallyHidden3 } from "@react-aria/visually-hidden";
897
1059
  import { useId as useId4 } from "@react-aria/utils";
898
- import { jsx as jsx23, jsxs as jsxs8 } from "react/jsx-runtime";
1060
+ import { jsx as jsx24, jsxs as jsxs8 } from "react/jsx-runtime";
899
1061
  function DropdownSelector({
900
1062
  onChange,
901
1063
  showLabel = false,
902
1064
  ...props
903
1065
  }) {
904
1066
  const triggerRef = useRef9(null);
905
- const [isOpen, setIsOpen] = useState4(false);
1067
+ const [isOpen, setIsOpen] = useState5(false);
906
1068
  const preview = findPreviewRecursive(props.children, props.value);
907
- const isPlaceholder = useMemo7(() => props.placeholder !== void 0 && preview === void 0, [preview, props.placeholder]);
1069
+ const isPlaceholder = useMemo8(() => props.placeholder !== void 0 && preview === void 0, [preview, props.placeholder]);
908
1070
  const propsArray = getValuesRecursive(props.children);
909
1071
  const {
910
1072
  visuallyHiddenProps
@@ -916,23 +1078,23 @@ function DropdownSelector({
916
1078
  const describedbyId = useId4();
917
1079
  const classNames = useClassNames("charcoal-dropdown-selector-root", props.className);
918
1080
  return /* @__PURE__ */ jsxs8("div", { className: classNames, "aria-disabled": props.disabled, children: [
919
- /* @__PURE__ */ jsx23(FieldLabel_default, { id: labelId, label: props.label, required: props.required, requiredText: props.requiredText, subLabel: props.subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
920
- /* @__PURE__ */ jsx23("div", { ...visuallyHiddenProps, "aria-hidden": "true", children: /* @__PURE__ */ jsx23("select", { name: props.name, value: props.value, onChange: handleChange, tabIndex: -1, children: propsArray.map((itemProps) => {
921
- return /* @__PURE__ */ jsx23("option", { value: itemProps.value, disabled: itemProps.disabled, children: itemProps.value }, itemProps.value);
1081
+ /* @__PURE__ */ jsx24(FieldLabel_default, { id: labelId, label: props.label, required: props.required, requiredText: props.requiredText, subLabel: props.subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
1082
+ /* @__PURE__ */ jsx24("div", { ...visuallyHiddenProps, "aria-hidden": "true", children: /* @__PURE__ */ jsx24("select", { name: props.name, value: props.value, onChange: handleChange, tabIndex: -1, children: propsArray.map((itemProps) => {
1083
+ return /* @__PURE__ */ jsx24("option", { value: itemProps.value, disabled: itemProps.disabled, children: itemProps.value }, itemProps.value);
922
1084
  }) }) }),
923
1085
  /* @__PURE__ */ jsxs8("button", { className: "charcoal-dropdown-selector-button", "aria-labelledby": labelId, "aria-invalid": props.invalid, "aria-describedby": props.assistiveText !== void 0 ? describedbyId : void 0, disabled: props.disabled, onClick: () => {
924
1086
  if (props.disabled === true)
925
1087
  return;
926
1088
  setIsOpen(true);
927
1089
  }, ref: triggerRef, type: "button", "data-active": isOpen, children: [
928
- /* @__PURE__ */ jsx23("span", { className: "charcoal-ui-dropdown-selector-text", "data-placeholder": isPlaceholder, children: isPlaceholder ? props.placeholder : preview }),
929
- /* @__PURE__ */ jsx23(Icon_default, { className: "charcoal-ui-dropdown-selector-icon", name: "16/Menu" })
1090
+ /* @__PURE__ */ jsx24("span", { className: "charcoal-ui-dropdown-selector-text", "data-placeholder": isPlaceholder, children: isPlaceholder ? props.placeholder : preview }),
1091
+ /* @__PURE__ */ jsx24(Icon_default, { className: "charcoal-ui-dropdown-selector-icon", name: "16/Menu" })
930
1092
  ] }),
931
- isOpen && /* @__PURE__ */ jsx23(DropdownPopover, { isOpen, onClose: () => setIsOpen(false), triggerRef, value: props.value, children: /* @__PURE__ */ jsx23(MenuList, { value: props.value, onChange: (v) => {
1093
+ isOpen && /* @__PURE__ */ jsx24(DropdownPopover, { isOpen, onClose: () => setIsOpen(false), triggerRef, value: props.value, children: /* @__PURE__ */ jsx24(MenuList, { value: props.value, onChange: (v) => {
932
1094
  onChange(v);
933
1095
  setIsOpen(false);
934
1096
  }, children: props.children }) }),
935
- props.assistiveText !== void 0 && /* @__PURE__ */ jsx23(AssistiveText, { "data-invalid": props.invalid === true, id: describedbyId, children: props.assistiveText })
1097
+ props.assistiveText !== void 0 && /* @__PURE__ */ jsx24(AssistiveText, { "data-invalid": props.invalid === true, id: describedbyId, children: props.assistiveText })
936
1098
  ] });
937
1099
  }
938
1100
 
@@ -940,16 +1102,16 @@ function DropdownSelector({
940
1102
  import { forwardRef as forwardRef18 } from "react";
941
1103
 
942
1104
  // src/components/DropdownSelector/ListItem/index.tsx
943
- import { forwardRef as forwardRef17, useMemo as useMemo8 } from "react";
944
- import { jsx as jsx24 } from "react/jsx-runtime";
1105
+ import { forwardRef as forwardRef17, useMemo as useMemo9 } from "react";
1106
+ import { jsx as jsx25 } from "react/jsx-runtime";
945
1107
  var ListItem = forwardRef17(function ListItem2({
946
1108
  as,
947
1109
  className,
948
1110
  ...props
949
1111
  }, ref) {
950
- const Component = useMemo8(() => as ?? "li", [as]);
1112
+ const Component = useMemo9(() => as ?? "li", [as]);
951
1113
  const classNames = useClassNames("charcoal-list-item", className);
952
- return /* @__PURE__ */ jsx24(Component, { className: classNames, ref, ...props });
1114
+ return /* @__PURE__ */ jsx25(Component, { className: classNames, ref, ...props });
953
1115
  });
954
1116
  var ListItem_default = ListItem;
955
1117
 
@@ -1009,7 +1171,13 @@ function useMenuItemHandleKeyDown(value) {
1009
1171
  if (index === -1)
1010
1172
  return;
1011
1173
  for (let n = 0; n < values.length; n++) {
1012
- const focusValue = isForward ? index + 1 >= values.length ? values[0] : values[index + 1] : index - 1 < 0 ? values[values.length - 1] : values[index - 1];
1174
+ const focusValue = isForward ? (
1175
+ // prev or last
1176
+ index + 1 >= values.length ? values[0] : values[index + 1]
1177
+ ) : (
1178
+ // next or first
1179
+ index - 1 < 0 ? values[values.length - 1] : values[index - 1]
1180
+ );
1013
1181
  const next = root?.current?.querySelector(`[data-key='${focusValue}']`);
1014
1182
  if (next instanceof HTMLElement) {
1015
1183
  if (next.ariaDisabled === "true") {
@@ -1031,7 +1199,7 @@ function useMenuItemHandleKeyDown(value) {
1031
1199
  }
1032
1200
 
1033
1201
  // src/components/DropdownSelector/MenuItem/index.tsx
1034
- import { jsx as jsx25 } from "react/jsx-runtime";
1202
+ import { jsx as jsx26 } from "react/jsx-runtime";
1035
1203
  var MenuItem = forwardRef18(function MenuItem2({
1036
1204
  className,
1037
1205
  value,
@@ -1039,13 +1207,13 @@ var MenuItem = forwardRef18(function MenuItem2({
1039
1207
  ...props
1040
1208
  }, ref) {
1041
1209
  const [handleKeyDown, setContextValue] = useMenuItemHandleKeyDown(value);
1042
- return /* @__PURE__ */ jsx25(ListItem_default, { ...props, ref, "data-key": value, onKeyDown: handleKeyDown, onClick: disabled === true ? void 0 : setContextValue, tabIndex: -1, "aria-disabled": disabled, role: "option", children: props.children });
1210
+ return /* @__PURE__ */ jsx26(ListItem_default, { ...props, ref, "data-key": value, onKeyDown: handleKeyDown, onClick: disabled === true ? void 0 : setContextValue, tabIndex: -1, "aria-disabled": disabled, role: "option", children: props.children });
1043
1211
  });
1044
1212
  var MenuItem_default = MenuItem;
1045
1213
 
1046
1214
  // src/components/DropdownSelector/DropdownMenuItem/index.tsx
1047
1215
  import { useContext as useContext6 } from "react";
1048
- import { jsx as jsx26, jsxs as jsxs9 } from "react/jsx-runtime";
1216
+ import { jsx as jsx27, jsxs as jsxs9 } from "react/jsx-runtime";
1049
1217
  function DropdownMenuItem(props) {
1050
1218
  const {
1051
1219
  value: ctxValue
@@ -1056,34 +1224,34 @@ function DropdownMenuItem(props) {
1056
1224
  ...rest
1057
1225
  } = props;
1058
1226
  return /* @__PURE__ */ jsxs9(MenuItem_default, { ...rest, "aria-selected": isSelected, children: [
1059
- isSelected && /* @__PURE__ */ jsx26(Icon_default, { className: "charcoal-dropdown-selector-menu-item-icon", name: "16/Check" }),
1060
- /* @__PURE__ */ jsx26("span", { className: "charcoal-dropdown-selector-menu-item", "data-selected": isSelected, children: props.children })
1227
+ isSelected && /* @__PURE__ */ jsx27(Icon_default, { className: "charcoal-dropdown-selector-menu-item-icon", name: "16/Check" }),
1228
+ /* @__PURE__ */ jsx27("span", { className: "charcoal-dropdown-selector-menu-item", "data-selected": isSelected, children: props.children })
1061
1229
  ] });
1062
1230
  }
1063
1231
 
1064
1232
  // src/components/DropdownSelector/MenuItemGroup/index.tsx
1065
- import { jsx as jsx27, jsxs as jsxs10 } from "react/jsx-runtime";
1233
+ import { jsx as jsx28, jsxs as jsxs10 } from "react/jsx-runtime";
1066
1234
  function MenuItemGroup(props) {
1067
1235
  return /* @__PURE__ */ jsxs10("li", { className: "charcoal-menu-item-group", role: "presentation", children: [
1068
- /* @__PURE__ */ jsx27("span", { children: props.text }),
1069
- /* @__PURE__ */ jsx27("ul", { role: "group", children: props.children })
1236
+ /* @__PURE__ */ jsx28("span", { children: props.text }),
1237
+ /* @__PURE__ */ jsx28("ul", { role: "group", children: props.children })
1070
1238
  ] });
1071
1239
  }
1072
1240
 
1073
1241
  // src/components/SegmentedControl/index.tsx
1074
- import { forwardRef as forwardRef19, memo as memo7, useMemo as useMemo9, useRef as useRef10 } from "react";
1242
+ import { forwardRef as forwardRef19, memo as memo7, useMemo as useMemo10, useRef as useRef10 } from "react";
1075
1243
  import { useRadioGroupState } from "@react-stately/radio";
1076
1244
  import { useRadio, useRadioGroup } from "@react-aria/radio";
1077
1245
 
1078
1246
  // src/components/SegmentedControl/RadioGroupContext.tsx
1079
1247
  import { createContext as createContext5, useContext as useContext7 } from "react";
1080
- import { jsx as jsx28 } from "react/jsx-runtime";
1248
+ import { jsx as jsx29 } from "react/jsx-runtime";
1081
1249
  var RadioContext = createContext5(null);
1082
1250
  var RadioProvider = ({
1083
1251
  value,
1084
1252
  children
1085
1253
  }) => {
1086
- return /* @__PURE__ */ jsx28(RadioContext.Provider, { value, children });
1254
+ return /* @__PURE__ */ jsx29(RadioContext.Provider, { value, children });
1087
1255
  };
1088
1256
  var useRadioContext = () => {
1089
1257
  const state = useContext7(RadioContext);
@@ -1093,10 +1261,10 @@ var useRadioContext = () => {
1093
1261
  };
1094
1262
 
1095
1263
  // src/components/SegmentedControl/index.tsx
1096
- import { jsx as jsx29, jsxs as jsxs11 } from "react/jsx-runtime";
1264
+ import { jsx as jsx30, jsxs as jsxs11 } from "react/jsx-runtime";
1097
1265
  var SegmentedControl = forwardRef19(function SegmentedControlInner(props, ref) {
1098
1266
  const className = useClassNames("charcoal-segmented-control", props.className);
1099
- const ariaRadioGroupProps = useMemo9(() => ({
1267
+ const ariaRadioGroupProps = useMemo10(() => ({
1100
1268
  ...props,
1101
1269
  isDisabled: props.disabled,
1102
1270
  isReadOnly: props.readonly,
@@ -1107,19 +1275,19 @@ var SegmentedControl = forwardRef19(function SegmentedControlInner(props, ref) {
1107
1275
  const {
1108
1276
  radioGroupProps
1109
1277
  } = useRadioGroup(ariaRadioGroupProps, state);
1110
- const segmentedControlItems = useMemo9(() => {
1278
+ const segmentedControlItems = useMemo10(() => {
1111
1279
  return props.data.map((d) => typeof d === "string" ? {
1112
1280
  value: d,
1113
1281
  label: d
1114
1282
  } : d);
1115
1283
  }, [props.data]);
1116
- return /* @__PURE__ */ jsx29("div", { ref, ...radioGroupProps, className, children: /* @__PURE__ */ jsx29(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ jsx29(Segmented, { value: item.value, disabled: item.disabled, children: item.label }, item.value)) }) });
1284
+ return /* @__PURE__ */ jsx30("div", { ref, ...radioGroupProps, className, children: /* @__PURE__ */ jsx30(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ jsx30(Segmented, { value: item.value, disabled: item.disabled, children: item.label }, item.value)) }) });
1117
1285
  });
1118
1286
  var SegmentedControl_default = memo7(SegmentedControl);
1119
1287
  var Segmented = (props) => {
1120
1288
  const state = useRadioContext();
1121
1289
  const ref = useRef10(null);
1122
- const ariaRadioProps = useMemo9(() => ({
1290
+ const ariaRadioProps = useMemo10(() => ({
1123
1291
  value: props.value,
1124
1292
  isDisabled: props.disabled,
1125
1293
  children: props.children
@@ -1130,7 +1298,7 @@ var Segmented = (props) => {
1130
1298
  isSelected
1131
1299
  } = useRadio(ariaRadioProps, state, ref);
1132
1300
  return /* @__PURE__ */ jsxs11("label", { className: "charcoal-segmented-control-radio__label", "aria-disabled": isDisabled || state.isReadOnly, "data-checked": isSelected, children: [
1133
- /* @__PURE__ */ jsx29("input", { className: "charcoal-segmented-control-radio__input", ...inputProps, ref }),
1301
+ /* @__PURE__ */ jsx30("input", { className: "charcoal-segmented-control-radio__input", ...inputProps, ref }),
1134
1302
  props.children
1135
1303
  ] });
1136
1304
  };
@@ -1141,7 +1309,7 @@ import { useId as useId5 } from "@react-aria/utils";
1141
1309
 
1142
1310
  // src/components/Checkbox/CheckboxInput/index.tsx
1143
1311
  import { forwardRef as forwardRef20, memo as memo8, useCallback as useCallback9 } from "react";
1144
- import { jsx as jsx30 } from "react/jsx-runtime";
1312
+ import { jsx as jsx31 } from "react/jsx-runtime";
1145
1313
  var CheckboxInput = forwardRef20(function CheckboxInput2({
1146
1314
  onChange,
1147
1315
  checked,
@@ -1155,13 +1323,13 @@ var CheckboxInput = forwardRef20(function CheckboxInput2({
1155
1323
  onChange?.(el.checked);
1156
1324
  }, [onChange]);
1157
1325
  const classNames = useClassNames("charcoal-checkbox-input", className);
1158
- return /* @__PURE__ */ jsx30("input", { className: classNames, ref, type: "checkbox", onChange: handleChange, "aria-invalid": invalid, checked, "data-rounded": rounded, ...props });
1326
+ return /* @__PURE__ */ jsx31("input", { className: classNames, ref, type: "checkbox", onChange: handleChange, "aria-invalid": invalid, checked, "data-rounded": rounded, ...props });
1159
1327
  });
1160
1328
  var CheckboxInput_default = memo8(CheckboxInput);
1161
1329
 
1162
1330
  // src/components/Checkbox/CheckboxWithLabel.tsx
1163
1331
  import React16 from "react";
1164
- import { jsx as jsx31, jsxs as jsxs12 } from "react/jsx-runtime";
1332
+ import { jsx as jsx32, jsxs as jsxs12 } from "react/jsx-runtime";
1165
1333
  var CheckboxWithLabel = React16.memo(function CheckboxWithLabel2({
1166
1334
  className,
1167
1335
  children,
@@ -1172,12 +1340,12 @@ var CheckboxWithLabel = React16.memo(function CheckboxWithLabel2({
1172
1340
  const classNames = useClassNames("charcoal-checkbox__label", className);
1173
1341
  return /* @__PURE__ */ jsxs12("label", { htmlFor: id, "aria-disabled": disabled, className: classNames, children: [
1174
1342
  input,
1175
- /* @__PURE__ */ jsx31("div", { className: "charcoal-checkbox__label_div", children })
1343
+ /* @__PURE__ */ jsx32("div", { className: "charcoal-checkbox__label_div", children })
1176
1344
  ] });
1177
1345
  });
1178
1346
 
1179
1347
  // src/components/Checkbox/index.tsx
1180
- import { jsx as jsx32 } from "react/jsx-runtime";
1348
+ import { jsx as jsx33 } from "react/jsx-runtime";
1181
1349
  var Checkbox = forwardRef21(function Checkbox2({
1182
1350
  disabled,
1183
1351
  className,
@@ -1187,18 +1355,18 @@ var Checkbox = forwardRef21(function Checkbox2({
1187
1355
  }, ref) {
1188
1356
  const htmlId = useId5(id);
1189
1357
  const noChildren = children === void 0;
1190
- const input = /* @__PURE__ */ jsx32(CheckboxInput_default, { ...props, className: noChildren ? className : void 0, disabled, id: htmlId, ref });
1358
+ const input = /* @__PURE__ */ jsx33(CheckboxInput_default, { ...props, className: noChildren ? className : void 0, disabled, id: htmlId, ref });
1191
1359
  if (noChildren) {
1192
1360
  return input;
1193
1361
  }
1194
- return /* @__PURE__ */ jsx32(CheckboxWithLabel, { className, disabled, id: htmlId, input, children });
1362
+ return /* @__PURE__ */ jsx33(CheckboxWithLabel, { className, disabled, id: htmlId, input, children });
1195
1363
  });
1196
1364
  var Checkbox_default = memo9(Checkbox);
1197
1365
 
1198
1366
  // src/components/TagItem/index.tsx
1199
- import { forwardRef as forwardRef22, memo as memo10, useMemo as useMemo10 } from "react";
1367
+ import { forwardRef as forwardRef22, memo as memo10, useMemo as useMemo11 } from "react";
1200
1368
  import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
1201
- import { jsx as jsx33, jsxs as jsxs13 } from "react/jsx-runtime";
1369
+ import { jsx as jsx34, jsxs as jsxs13 } from "react/jsx-runtime";
1202
1370
  var TagItem = forwardRef22(function TagItemInner({
1203
1371
  component,
1204
1372
  label,
@@ -1214,15 +1382,15 @@ var TagItem = forwardRef22(function TagItemInner({
1214
1382
  const className = useClassNames("charcoal-tag-item", "charcoal-tag-item__bg", props.className);
1215
1383
  const bgVariant = bgImage !== void 0 && bgImage.length > 0 ? "image" : "color";
1216
1384
  const bg = bgVariant === "color" ? bgColor : `url(${bgImage ?? ""})`;
1217
- const Component = useMemo10(() => component ?? "button", [component]);
1385
+ const Component = useMemo11(() => component ?? "button", [component]);
1218
1386
  return /* @__PURE__ */ jsxs13(Component, { ...props, ref, className, "data-state": status, "data-bg-variant": bgVariant, "data-size": hasTranslatedLabel ? "M" : size, style: {
1219
1387
  "--charcoal-tag-item-bg": bg
1220
1388
  }, children: [
1221
1389
  /* @__PURE__ */ jsxs13("div", { className: "charcoal-tag-item__label", "data-has-translate": hasTranslatedLabel, children: [
1222
- hasTranslatedLabel && /* @__PURE__ */ jsx33("span", { className: "charcoal-tag-item__label__translated", children: translatedLabel }),
1223
- /* @__PURE__ */ jsx33("span", { className: "charcoal-tag-item__label__text", "data-has-translate": hasTranslatedLabel, children: label })
1390
+ hasTranslatedLabel && /* @__PURE__ */ jsx34("span", { className: "charcoal-tag-item__label__translated", children: translatedLabel }),
1391
+ /* @__PURE__ */ jsx34("span", { className: "charcoal-tag-item__label__text", "data-has-translate": hasTranslatedLabel, children: label })
1224
1392
  ] }),
1225
- status === "active" && /* @__PURE__ */ jsx33(Icon_default, { name: "16/Remove" })
1393
+ status === "active" && /* @__PURE__ */ jsx34(Icon_default, { name: "16/Remove" })
1226
1394
  ] });
1227
1395
  });
1228
1396
  var TagItem_default = memo10(TagItem);
@@ -1249,9 +1417,19 @@ export {
1249
1417
  RadioGroup,
1250
1418
  SSRProvider,
1251
1419
  SegmentedControl_default as SegmentedControl,
1420
+ SetThemeScript,
1252
1421
  Switch_default as Switch,
1253
1422
  TagItem_default as TagItem,
1254
1423
  TextArea_default as TextArea,
1255
- TextField_default as TextField
1424
+ TextField_default as TextField,
1425
+ getThemeSync,
1426
+ makeSetThemeScriptCode,
1427
+ prefersColorScheme,
1428
+ themeSelector,
1429
+ themeSetter,
1430
+ useLocalStorage,
1431
+ useMedia,
1432
+ useTheme,
1433
+ useThemeSetter
1256
1434
  };
1257
1435
  //# sourceMappingURL=index.esm.js.map