@cerberus-design/react 0.10.4 → 0.11.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 (159) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +244 -2
  2. package/build/legacy/components/Admonition.cjs +419 -0
  3. package/build/legacy/components/Admonition.cjs.map +1 -0
  4. package/build/legacy/components/AnimatingUploadIcon.cjs +124 -0
  5. package/build/legacy/components/AnimatingUploadIcon.cjs.map +1 -0
  6. package/build/legacy/components/Avatar.cjs +110 -13
  7. package/build/legacy/components/Avatar.cjs.map +1 -1
  8. package/build/legacy/components/Checkbox.cjs +107 -10
  9. package/build/legacy/components/Checkbox.cjs.map +1 -1
  10. package/build/legacy/components/CircularProgress.cjs +19 -5
  11. package/build/legacy/components/CircularProgress.cjs.map +1 -1
  12. package/build/legacy/components/Fieldset.cjs +66 -0
  13. package/build/legacy/components/Fieldset.cjs.map +1 -0
  14. package/build/legacy/components/FieldsetLabel.cjs +49 -0
  15. package/build/legacy/components/FieldsetLabel.cjs.map +1 -0
  16. package/build/legacy/components/FileStatus.cjs +138 -39
  17. package/build/legacy/components/FileStatus.cjs.map +1 -1
  18. package/build/legacy/components/FileUploader.cjs +120 -22
  19. package/build/legacy/components/FileUploader.cjs.map +1 -1
  20. package/build/legacy/components/Input.cjs +108 -11
  21. package/build/legacy/components/Input.cjs.map +1 -1
  22. package/build/legacy/components/Label.cjs +1 -1
  23. package/build/legacy/components/Label.cjs.map +1 -1
  24. package/build/legacy/components/Legend.cjs +95 -0
  25. package/build/legacy/components/Legend.cjs.map +1 -0
  26. package/build/legacy/components/ModalHeader.cjs +2 -2
  27. package/build/legacy/components/ModalHeader.cjs.map +1 -1
  28. package/build/legacy/components/Notification.cjs +109 -12
  29. package/build/legacy/components/Notification.cjs.map +1 -1
  30. package/build/legacy/components/Radio.cjs +27 -14
  31. package/build/legacy/components/Radio.cjs.map +1 -1
  32. package/build/legacy/components/Select.cjs +111 -14
  33. package/build/legacy/components/Select.cjs.map +1 -1
  34. package/build/legacy/components/Tag.cjs +106 -9
  35. package/build/legacy/components/Tag.cjs.map +1 -1
  36. package/build/legacy/components/Th.cjs +4 -1
  37. package/build/legacy/components/Th.cjs.map +1 -1
  38. package/build/legacy/components/Toggle.cjs +108 -11
  39. package/build/legacy/components/Toggle.cjs.map +1 -1
  40. package/build/legacy/config/cerbIcons.cjs +102 -5
  41. package/build/legacy/config/cerbIcons.cjs.map +1 -1
  42. package/build/legacy/config/defineIcons.cjs +102 -5
  43. package/build/legacy/config/defineIcons.cjs.map +1 -1
  44. package/build/legacy/context/confirm-modal.cjs +141 -40
  45. package/build/legacy/context/confirm-modal.cjs.map +1 -1
  46. package/build/legacy/context/notification-center.cjs +129 -32
  47. package/build/legacy/context/notification-center.cjs.map +1 -1
  48. package/build/legacy/context/prompt-modal.cjs +178 -66
  49. package/build/legacy/context/prompt-modal.cjs.map +1 -1
  50. package/build/legacy/hooks/useModal.cjs +6 -2
  51. package/build/legacy/hooks/useModal.cjs.map +1 -1
  52. package/build/legacy/index.cjs +793 -442
  53. package/build/legacy/index.cjs.map +1 -1
  54. package/build/modern/_tsup-dts-rollup.d.ts +244 -2
  55. package/build/modern/{chunk-S7XGIQY6.js → chunk-243VUIA6.js} +2 -2
  56. package/build/modern/{chunk-LKFXUM3Z.js → chunk-3NE6C66J.js} +36 -25
  57. package/build/modern/{chunk-LKFXUM3Z.js.map → chunk-3NE6C66J.js.map} +1 -1
  58. package/build/modern/chunk-3ZDFQO25.js +31 -0
  59. package/build/modern/chunk-3ZDFQO25.js.map +1 -0
  60. package/build/modern/{chunk-YLPSE5Z2.js → chunk-6QHOKCV3.js} +11 -6
  61. package/build/modern/chunk-6QHOKCV3.js.map +1 -0
  62. package/build/modern/chunk-6TTN2JMY.js +54 -0
  63. package/build/modern/chunk-6TTN2JMY.js.map +1 -0
  64. package/build/modern/{chunk-OW62FLJ6.js → chunk-7T3JIGM7.js} +8 -4
  65. package/build/modern/chunk-7T3JIGM7.js.map +1 -0
  66. package/build/modern/{chunk-7K6PZBHN.js → chunk-CO4BKT7K.js} +5 -2
  67. package/build/modern/{chunk-7K6PZBHN.js.map → chunk-CO4BKT7K.js.map} +1 -1
  68. package/build/modern/{chunk-NBG2OSYI.js → chunk-FT7DFRHQ.js} +2 -2
  69. package/build/modern/chunk-FTPZHG6J.js +46 -0
  70. package/build/modern/{chunk-LJYCFFX7.js.map → chunk-FTPZHG6J.js.map} +1 -1
  71. package/build/modern/{chunk-JCGWTIR4.js → chunk-HCB5NQ5J.js} +5 -4
  72. package/build/modern/chunk-HCB5NQ5J.js.map +1 -0
  73. package/build/modern/chunk-HVKM54BA.js +100 -0
  74. package/build/modern/chunk-HVKM54BA.js.map +1 -0
  75. package/build/modern/{chunk-CMUFJU4S.js → chunk-KLUBAM4U.js} +2 -2
  76. package/build/modern/{chunk-AUAPBPGW.js → chunk-MDIUFBDX.js} +2 -2
  77. package/build/modern/{chunk-I35HMGJQ.js → chunk-NMF2HYWO.js} +2 -2
  78. package/build/modern/{chunk-I35HMGJQ.js.map → chunk-NMF2HYWO.js.map} +1 -1
  79. package/build/modern/{chunk-O6JYYVO7.js → chunk-PA5EB7EO.js} +2 -2
  80. package/build/modern/chunk-PZAZKQMO.js +25 -0
  81. package/build/modern/chunk-PZAZKQMO.js.map +1 -0
  82. package/build/modern/{chunk-EZNGCXVJ.js → chunk-RDQHHCFR.js} +5 -5
  83. package/build/modern/{chunk-BDCFYW34.js → chunk-TMR7JGMP.js} +12 -9
  84. package/build/modern/chunk-TMR7JGMP.js.map +1 -0
  85. package/build/modern/{chunk-WZOYPFUU.js → chunk-UJKS4DDN.js} +2 -2
  86. package/build/modern/{chunk-WLEX22KS.js → chunk-ULYQLKWA.js} +3 -3
  87. package/build/modern/{chunk-WLEX22KS.js.map → chunk-ULYQLKWA.js.map} +1 -1
  88. package/build/modern/{chunk-6YUB3ITX.js → chunk-X4Y4WTRU.js} +10 -10
  89. package/build/modern/{chunk-UXHAFEBA.js → chunk-YMJMB6OP.js} +5 -3
  90. package/build/modern/chunk-YMJMB6OP.js.map +1 -0
  91. package/build/modern/{chunk-GMG3B34U.js → chunk-YWCTMLLO.js} +2 -2
  92. package/build/modern/chunk-ZW3FFE37.js +138 -0
  93. package/build/modern/chunk-ZW3FFE37.js.map +1 -0
  94. package/build/modern/{chunk-477G5ZEL.js → chunk-ZX6DBC2Z.js} +2 -2
  95. package/build/modern/components/Admonition.js +17 -0
  96. package/build/modern/components/Admonition.js.map +1 -0
  97. package/build/modern/components/AnimatingUploadIcon.js +7 -0
  98. package/build/modern/components/AnimatingUploadIcon.js.map +1 -0
  99. package/build/modern/components/Avatar.js +4 -3
  100. package/build/modern/components/Checkbox.js +4 -3
  101. package/build/modern/components/CircularProgress.js +2 -1
  102. package/build/modern/components/Fieldset.js +9 -0
  103. package/build/modern/components/Fieldset.js.map +1 -0
  104. package/build/modern/components/FieldsetLabel.js +7 -0
  105. package/build/modern/components/FieldsetLabel.js.map +1 -0
  106. package/build/modern/components/FileStatus.js +5 -4
  107. package/build/modern/components/FileUploader.js +5 -4
  108. package/build/modern/components/Input.js +4 -3
  109. package/build/modern/components/Label.js +1 -1
  110. package/build/modern/components/Legend.js +10 -0
  111. package/build/modern/components/Legend.js.map +1 -0
  112. package/build/modern/components/ModalHeader.js +1 -1
  113. package/build/modern/components/Notification.js +4 -3
  114. package/build/modern/components/Radio.js +1 -1
  115. package/build/modern/components/Select.js +4 -3
  116. package/build/modern/components/Tag.js +4 -3
  117. package/build/modern/components/Th.js +1 -1
  118. package/build/modern/components/Toggle.js +4 -3
  119. package/build/modern/config/cerbIcons.js +2 -1
  120. package/build/modern/config/defineIcons.js +3 -2
  121. package/build/modern/context/confirm-modal.js +8 -7
  122. package/build/modern/context/notification-center.js +6 -5
  123. package/build/modern/context/prompt-modal.js +10 -9
  124. package/build/modern/hooks/useModal.js +1 -1
  125. package/build/modern/index.js +86 -65
  126. package/build/modern/index.js.map +1 -1
  127. package/package.json +3 -3
  128. package/src/components/Admonition.tsx +186 -0
  129. package/src/components/AnimatingUploadIcon.tsx +83 -0
  130. package/src/components/CircularProgress.tsx +20 -12
  131. package/src/components/Fieldset.tsx +65 -0
  132. package/src/components/FieldsetLabel.tsx +59 -0
  133. package/src/components/FileStatus.tsx +2 -0
  134. package/src/components/FileUploader.tsx +6 -1
  135. package/src/components/Label.tsx +1 -1
  136. package/src/components/Legend.tsx +87 -0
  137. package/src/components/ModalHeader.tsx +2 -2
  138. package/src/components/Radio.tsx +10 -1
  139. package/src/components/Th.tsx +3 -0
  140. package/src/config/cerbIcons.ts +10 -8
  141. package/src/context/prompt-modal.tsx +8 -1
  142. package/src/hooks/useModal.ts +19 -4
  143. package/src/index.ts +4 -0
  144. package/build/modern/chunk-BDCFYW34.js.map +0 -1
  145. package/build/modern/chunk-JCGWTIR4.js.map +0 -1
  146. package/build/modern/chunk-LJYCFFX7.js +0 -33
  147. package/build/modern/chunk-OW62FLJ6.js.map +0 -1
  148. package/build/modern/chunk-UXHAFEBA.js.map +0 -1
  149. package/build/modern/chunk-YLPSE5Z2.js.map +0 -1
  150. /package/build/modern/{chunk-S7XGIQY6.js.map → chunk-243VUIA6.js.map} +0 -0
  151. /package/build/modern/{chunk-NBG2OSYI.js.map → chunk-FT7DFRHQ.js.map} +0 -0
  152. /package/build/modern/{chunk-CMUFJU4S.js.map → chunk-KLUBAM4U.js.map} +0 -0
  153. /package/build/modern/{chunk-AUAPBPGW.js.map → chunk-MDIUFBDX.js.map} +0 -0
  154. /package/build/modern/{chunk-O6JYYVO7.js.map → chunk-PA5EB7EO.js.map} +0 -0
  155. /package/build/modern/{chunk-EZNGCXVJ.js.map → chunk-RDQHHCFR.js.map} +0 -0
  156. /package/build/modern/{chunk-WZOYPFUU.js.map → chunk-UJKS4DDN.js.map} +0 -0
  157. /package/build/modern/{chunk-6YUB3ITX.js.map → chunk-X4Y4WTRU.js.map} +0 -0
  158. /package/build/modern/{chunk-GMG3B34U.js.map → chunk-YWCTMLLO.js.map} +0 -0
  159. /package/build/modern/{chunk-477G5ZEL.js.map → chunk-ZX6DBC2Z.js.map} +0 -0
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/components/Legend.tsx
22
+ var Legend_exports = {};
23
+ __export(Legend_exports, {
24
+ Legend: () => Legend
25
+ });
26
+ module.exports = __toCommonJS(Legend_exports);
27
+ var import_css = require("@cerberus/styled-system/css");
28
+
29
+ // src/context/field.tsx
30
+ var import_react = require("react");
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
+ var FieldContext = (0, import_react.createContext)(null);
33
+ function useFieldContext() {
34
+ const context = (0, import_react.useContext)(FieldContext);
35
+ if (!context) {
36
+ throw new Error("useFieldContext must be used within a Field Provider.");
37
+ }
38
+ return context;
39
+ }
40
+
41
+ // src/components/Show.tsx
42
+ var import_react2 = require("react");
43
+ function Show(props) {
44
+ const { when, children, fallback } = props;
45
+ const condition = (0, import_react2.useMemo)(() => when ?? false, [when]);
46
+ return (0, import_react2.useMemo)(() => {
47
+ if (condition) return children;
48
+ return fallback ?? null;
49
+ }, [condition, children, fallback]);
50
+ }
51
+
52
+ // src/components/Legend.tsx
53
+ var import_recipes = require("@cerberus-design/styled-system/recipes");
54
+ var import_patterns = require("@cerberus-design/styled-system/patterns");
55
+ var import_jsx_runtime2 = require("react/jsx-runtime");
56
+ function Legend(props) {
57
+ const { size, ...nativeProps } = props;
58
+ const { invalid, ...formState } = useFieldContext();
59
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
60
+ "legend",
61
+ {
62
+ ...nativeProps,
63
+ ...formState,
64
+ ...invalid && { "aria-invalid": true },
65
+ className: (0, import_css.cx)(
66
+ nativeProps.className,
67
+ (0, import_patterns.hstack)({
68
+ justify: "space-between",
69
+ w: "full"
70
+ }),
71
+ (0, import_recipes.label)({
72
+ size
73
+ })
74
+ ),
75
+ children: [
76
+ nativeProps.children,
77
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Show, { when: formState.required, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
78
+ "span",
79
+ {
80
+ className: (0, import_css.css)({
81
+ color: "page.text.100",
82
+ fontSize: "inherit"
83
+ }),
84
+ children: "(required)"
85
+ }
86
+ ) })
87
+ ]
88
+ }
89
+ );
90
+ }
91
+ // Annotate the CommonJS export names for ESM import in node:
92
+ 0 && (module.exports = {
93
+ Legend
94
+ });
95
+ //# sourceMappingURL=Legend.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/Legend.tsx","../../../src/context/field.tsx","../../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { type HTMLAttributes } from 'react'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\nimport {\n label,\n type LabelVariantProps,\n} from '@cerberus-design/styled-system/recipes'\nimport { hstack } from '@cerberus-design/styled-system/patterns'\n\n/**\n * This module contains the Fieldset component.\n * @module Fieldset\n */\n\nexport type LegendProps = HTMLAttributes<HTMLLegendElement> & LabelVariantProps\n\n/**\n * A component to provide a global label for a group of related elements in a form (for accessibility).\n * @memberof Fieldset\n * @see https://cerberus.digitalu.com/react/fieldset\n * @description [A11y Form Checklist](https://www.a11yproject.com/checklist/#forms)\n * @description [MDN Web Docs: Legend](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/legend)\n * @example\n * ```tsx\n * import { Fieldset, Legend, Field, Radio, Label } from '@cerberus/react'\n * import { Hstack } from '@cerberus/styled-system/jsx'\n *\n * function SomeForm() {\n * return (\n * <form>\n * <Fieldset>\n * <Legend>Do you like cats?</Legend>\n * <Hstack>\n * <Field>\n * <Radio id=\"yes\" name=\"cats\" value=\"yes\" />\n * <Label htmlFor=\"yes\">Yes</Label>\n * </Field>\n * </Hstack>\n * <Hstack>\n * <Field>\n * <Radio id=\"no\" name=\"cats\" value=\"no\" />\n * <Label htmlFor=\"no\">No</Label>\n * </Field>\n * </Hstack>\n * </Fieldset>\n * </form>\n * )\n * }\n * ```\n */\nexport function Legend(props: LegendProps) {\n const { size, ...nativeProps } = props\n const { invalid, ...formState } = useFieldContext()\n\n return (\n <legend\n {...nativeProps}\n {...formState}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(\n nativeProps.className,\n hstack({\n justify: 'space-between',\n w: 'full',\n }),\n label({\n size,\n }),\n )}\n >\n {nativeProps.children}\n <Show when={formState.required}>\n <span\n className={css({\n color: 'page.text.100',\n fontSize: 'inherit',\n })}\n >\n (required)\n </span>\n </Show>\n </legend>\n )\n}\n","'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\n/**\n * This module provides a context and hook for the field.\n * @module Field\n */\n\nexport interface FieldContextValue {\n /**\n * Whether the field is disabled.\n * @description [Moz Input Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes)\n */\n disabled?: boolean\n /**\n * Whether the field is read-only.\n */\n readOnly?: boolean\n /**\n * Whether the field is required.\n */\n required?: boolean\n /**\n * Whether the field is invalid.\n */\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\n/**\n * Provides the field state for a all related components used within a group.\n * @see https://cerberus.digitalu.design/react/input\n */\nexport function Field(\n props: PropsWithChildren<FieldContextValue>,\n): JSX.Element {\n const value = useMemo(\n () => ({\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n invalid: props.invalid,\n }),\n [props.disabled, props.readOnly, props.required, props.invalid],\n )\n\n return (\n <FieldContext.Provider value={value}>\n {props.children}\n </FieldContext.Provider>\n )\n}\n\n/**\n * Used to access the field context.\n * @returns The field context.\n */\nexport function useFieldContext(): FieldContextValue {\n const context = useContext(FieldContext)\n if (!context) {\n throw new Error('useFieldContext must be used within a Field Provider.')\n }\n return context\n}\n","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAwB;;;ACAxB,mBAKO;AA+CH;AApBJ,IAAM,mBAAe,4BAAwC,IAAI;AA8B1D,SAAS,kBAAqC;AACnD,QAAM,cAAU,yBAAW,YAAY;AACvC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AACA,SAAO;AACT;;;ACpEA,IAAAA,gBAAgE;AA4BzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AACrC,QAAM,gBAAY,uBAAQ,MAAM,QAAQ,OAAO,CAAC,IAAI,CAAC;AAErD,aAAO,uBAAQ,MAAM;AACnB,QAAI,UAAW,QAAO;AACtB,WAAO,YAAY;AAAA,EACrB,GAAG,CAAC,WAAW,UAAU,QAAQ,CAAC;AACpC;;;AFhCA,qBAGO;AACP,sBAAuB;AAgDnB,IAAAC,sBAAA;AALG,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,MAAM,GAAG,YAAY,IAAI;AACjC,QAAM,EAAE,SAAS,GAAG,UAAU,IAAI,gBAAgB;AAElD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,MACvC,eAAW;AAAA,QACT,YAAY;AAAA,YACZ,wBAAO;AAAA,UACL,SAAS;AAAA,UACT,GAAG;AAAA,QACL,CAAC;AAAA,YACD,sBAAM;AAAA,UACJ;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MAEC;AAAA,oBAAY;AAAA,QACb,6CAAC,QAAK,MAAM,UAAU,UACpB;AAAA,UAAC;AAAA;AAAA,YACC,eAAW,gBAAI;AAAA,cACb,OAAO;AAAA,cACP,UAAU;AAAA,YACZ,CAAC;AAAA,YACF;AAAA;AAAA,QAED,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["import_react","import_jsx_runtime"]}
@@ -35,8 +35,8 @@ function ModalHeader(props) {
35
35
  props.className,
36
36
  (0, import_patterns.vstack)({
37
37
  alignItems: "flex-start",
38
- gap: "4",
39
- mb: "8"
38
+ gap: "md",
39
+ mb: "md"
40
40
  })
41
41
  )
42
42
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ModalHeader.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { vstack } from '@cerberus/styled-system/patterns'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ModalHeader component for a customizable modal.\n * @module\n */\n\nexport type ModalHeaderProps = HTMLAttributes<HTMLDivElement>\n\n/**\n * The ModalHeader component is a header element for a customizable modal.\n * @see https://cerberus.digitalu.design/react/modal\n * @example\n * ```tsx\n * <Modal>\n * <ModalHeader>\n * <h2>Modal Heading</h2>\n * </ModalHeader>\n * </Modal>\n * ```\n */\nexport function ModalHeader(props: ModalHeaderProps) {\n return (\n <div\n {...props}\n className={cx(\n props.className,\n vstack({\n alignItems: 'flex-start',\n gap: '4',\n mb: '8',\n }),\n )}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAmB;AACnB,sBAAuB;AAwBnB;AAFG,SAAS,YAAY,OAAyB;AACnD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,eAAW;AAAA,QACT,MAAM;AAAA,YACN,wBAAO;AAAA,UACL,YAAY;AAAA,UACZ,KAAK;AAAA,UACL,IAAI;AAAA,QACN,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/ModalHeader.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { vstack } from '@cerberus/styled-system/patterns'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ModalHeader component for a customizable modal.\n * @module\n */\n\nexport type ModalHeaderProps = HTMLAttributes<HTMLDivElement>\n\n/**\n * The ModalHeader component is a header element for a customizable modal.\n * @see https://cerberus.digitalu.design/react/modal\n * @example\n * ```tsx\n * <Modal>\n * <ModalHeader>\n * <h2>Modal Heading</h2>\n * </ModalHeader>\n * </Modal>\n * ```\n */\nexport function ModalHeader(props: ModalHeaderProps) {\n return (\n <div\n {...props}\n className={cx(\n props.className,\n vstack({\n alignItems: 'flex-start',\n gap: 'md',\n mb: 'md',\n }),\n )}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAmB;AACnB,sBAAuB;AAwBnB;AAFG,SAAS,YAAY,OAAyB;AACnD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,eAAW;AAAA,QACT,MAAM;AAAA,YACN,wBAAO;AAAA,UACL,YAAY;AAAA,UACZ,KAAK;AAAA,UACL,IAAI;AAAA,QACN,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -70,6 +70,102 @@ function IndeterminateIcon(props) {
70
70
  );
71
71
  }
72
72
 
73
+ // src/components/AnimatingUploadIcon.tsx
74
+ var import_jsx_runtime2 = require("react/jsx-runtime");
75
+ function AnimatingUploadIcon(props) {
76
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
77
+ "svg",
78
+ {
79
+ "aria-hidden": "true",
80
+ xmlns: "http://www.w3.org/2000/svg",
81
+ width: props.size ?? "1em",
82
+ height: props.size ?? "1em",
83
+ viewBox: "0 0 24 24",
84
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
85
+ "g",
86
+ {
87
+ fill: "none",
88
+ stroke: "currentColor",
89
+ strokeLinecap: "square",
90
+ strokeLinejoin: "round",
91
+ strokeWidth: 1.5,
92
+ children: [
93
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
94
+ "path",
95
+ {
96
+ "data-name": "animating-trail",
97
+ strokeDasharray: "2 4",
98
+ strokeDashoffset: 6,
99
+ d: "M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9",
100
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
101
+ "animate",
102
+ {
103
+ attributeName: "stroke-dashoffset",
104
+ dur: "0.45s",
105
+ repeatCount: "indefinite",
106
+ values: "6;0"
107
+ }
108
+ )
109
+ }
110
+ ),
111
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
112
+ "path",
113
+ {
114
+ "data-name": "half-circle",
115
+ strokeDasharray: 32,
116
+ strokeDashoffset: 32,
117
+ d: "M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9",
118
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
119
+ "animate",
120
+ {
121
+ fill: "freeze",
122
+ attributeName: "stroke-dashoffset",
123
+ begin: "0.075s",
124
+ dur: "0.3s",
125
+ values: "32;0"
126
+ }
127
+ )
128
+ }
129
+ ),
130
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
131
+ "svg",
132
+ {
133
+ "aria-hidden": "true",
134
+ xmlns: "http://www.w3.org/2000/svg",
135
+ width: "0.8em",
136
+ height: "0.8em",
137
+ x: "27%",
138
+ y: "27%",
139
+ viewBox: "0 0 24 24",
140
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
141
+ "polygon",
142
+ {
143
+ fill: "currentColor",
144
+ stroke: "currentColor",
145
+ strokeWidth: 0.8,
146
+ opacity: "1",
147
+ points: "3.7,6.7 7.5,2.9 7.5,15 8.5,15 8.5,2.9 12.3,6.7 13,6 8,1 3,6 ",
148
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
149
+ "animate",
150
+ {
151
+ fill: "freeze",
152
+ attributeName: "opacity",
153
+ values: "1;0;1",
154
+ dur: "2s",
155
+ repeatCount: "indefinite"
156
+ }
157
+ )
158
+ }
159
+ )
160
+ }
161
+ )
162
+ ]
163
+ }
164
+ )
165
+ }
166
+ );
167
+ }
168
+
73
169
  // src/config/cerbIcons.ts
74
170
  var defaultIcons = {
75
171
  avatar: import_icons.UserFilled,
@@ -78,12 +174,13 @@ var defaultIcons = {
78
174
  confirmModal: import_icons.Information,
79
175
  delete: import_icons.TrashCan,
80
176
  promptModal: import_icons.Information,
81
- fileUploader: import_icons.CloudUpload,
177
+ waitingFileUploader: import_icons.CloudUpload,
178
+ fileUploader: AnimatingUploadIcon,
82
179
  indeterminate: IndeterminateIcon,
83
- infoNotification: import_icons.InformationFilled,
84
- successNotification: import_icons.CheckmarkFilled,
85
- warningNotification: import_icons.WarningFilled,
86
- dangerNotification: import_icons.ErrorFilled,
180
+ infoNotification: import_icons.Information,
181
+ successNotification: import_icons.CheckmarkOutline,
182
+ warningNotification: import_icons.WarningAlt,
183
+ dangerNotification: import_icons.WarningFilled,
87
184
  invalid: import_icons.WarningFilled,
88
185
  invalidAlt: import_icons.Warning,
89
186
  redo: import_icons.Restart,
@@ -121,19 +218,19 @@ function trapFocus(modalRef) {
121
218
  }
122
219
 
123
220
  // src/components/Notification.tsx
124
- var import_jsx_runtime2 = require("react/jsx-runtime");
221
+ var import_jsx_runtime3 = require("react/jsx-runtime");
125
222
  function MatchNotificationIcon(props) {
126
223
  const palette = props.palette || "info";
127
224
  const key = `${palette}Notification`;
128
225
  const Icon = $cerberusIcons[key];
129
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, {});
226
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, {});
130
227
  }
131
228
  function Notification(props) {
132
229
  const { children, palette, onClose, ...nativeProps } = props;
133
230
  const ref = (0, import_react.useRef)(null);
134
231
  const onKeyDown = trapFocus(ref);
135
232
  const styles = (0, import_recipes.notification)({ palette });
136
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
233
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
137
234
  "dialog",
138
235
  {
139
236
  ...nativeProps,
@@ -148,8 +245,8 @@ function Notification(props) {
148
245
  onKeyDown,
149
246
  ref,
150
247
  children: [
151
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MatchNotificationIcon, { palette }) }),
152
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
248
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MatchNotificationIcon, { palette }) }),
249
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
153
250
  "div",
154
251
  {
155
252
  className: (0, import_patterns.vstack)({
@@ -160,14 +257,14 @@ function Notification(props) {
160
257
  children
161
258
  }
162
259
  ),
163
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
260
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
164
261
  "button",
165
262
  {
166
263
  "aria-label": "Close",
167
264
  className: styles.close,
168
265
  onClick: onClose,
169
266
  value: props.id,
170
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.Close, {})
267
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.Close, {})
171
268
  }
172
269
  )
173
270
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Notification.tsx","../../../src/config/cerbIcons.ts","../../../src/config/icons/checkbox.icons.tsx","../../../src/config/defineIcons.ts","../../../src/aria-helpers/trap-focus.aria.ts"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport {\n useRef,\n type DialogHTMLAttributes,\n type PropsWithChildren,\n type MouseEvent,\n} from 'react'\nimport { Close } from '@cerberus/icons'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport type { IconType } from '../config/cerbIcons'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\n\n/**\n * This module exports the Notification component.\n * @module\n */\n\nfunction MatchNotificationIcon(props: NotificationVariantProps) {\n const palette = props.palette || 'info'\n const key = `${palette}Notification` as keyof typeof $cerberusIcons\n const Icon = $cerberusIcons[key] as IconType\n return <Icon />\n}\n\nexport interface NotificationBaseProps\n extends Omit<DialogHTMLAttributes<HTMLDialogElement>, 'onClose'> {\n /**\n * The unique id of the notification. Required for the onClose callback.\n */\n id: string\n /**\n * Called when the close button is clicked.\n */\n onClose?: (e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type NotificationProps = NotificationBaseProps & NotificationVariantProps\n\n/**\n * A static Notification component that displays a message to the user. This\n * is typically only used when not utilizing the NotificationCenter.\n * @see https://cerberus.digitalu.design/react/notification\n * @memberof module:NotificationCenter\n * @example\n * ```tsx\n * <Notification id=\"info:1\" open>\n * <NotificationHeading>Info Notification</NotificationHeading>\n * <NotificationDescription>\n * This is a description with a <a href=\"#\">link</a> in the message.\n * </NotificationDescription>\n * </Notification>\n * ```\n */\nexport function Notification(props: PropsWithChildren<NotificationProps>) {\n const { children, palette, onClose, ...nativeProps } = props\n const ref = useRef<HTMLDialogElement>(null)\n const onKeyDown = trapFocus(ref)\n const styles = notification({ palette })\n\n return (\n <dialog\n {...nativeProps}\n className={cx(\n nativeProps.className,\n hstack({\n position: 'relative',\n gap: '4',\n }),\n styles.dialog,\n )}\n onKeyDown={onKeyDown}\n ref={ref}\n >\n <span className={styles.icon}>\n <MatchNotificationIcon palette={palette} />\n </span>\n\n <div\n className={vstack({\n alignItems: 'flex-start',\n gap: '0',\n py: '2',\n })}\n >\n {children}\n </div>\n\n <button\n aria-label=\"Close\"\n className={styles.close}\n onClick={onClose}\n value={props.id}\n >\n <Close />\n </button>\n </dialog>\n )\n}\n","import {\n Checkmark,\n CheckmarkFilled,\n ChevronDown,\n CloseFilled,\n CloudUpload,\n ErrorFilled,\n Information,\n InformationFilled,\n Restart,\n TrashCan,\n UserFilled,\n Warning,\n WarningFilled,\n type CarbonIconType,\n} from '@cerberus/icons'\nimport type { ElementType } from 'react'\nimport { CheckmarkIcon, IndeterminateIcon } from './icons/checkbox.icons'\n\nexport type IconType = CarbonIconType | ElementType\n\nexport interface DefinedIcons {\n avatar?: IconType\n checkbox?: IconType\n close?: IconType\n confirmModal?: IconType\n delete?: IconType\n promptModal?: IconType\n fileUploader?: IconType\n indeterminate?: IconType\n infoNotification?: IconType\n successNotification?: IconType\n warningNotification?: IconType\n dangerNotification?: IconType\n invalid: IconType\n invalidAlt?: IconType\n redo?: IconType\n selectArrow?: IconType\n toggleChecked?: IconType\n}\n\nexport const defaultIcons: DefinedIcons = {\n avatar: UserFilled,\n checkbox: CheckmarkIcon,\n close: CloseFilled,\n confirmModal: Information,\n delete: TrashCan,\n promptModal: Information,\n fileUploader: CloudUpload,\n indeterminate: IndeterminateIcon,\n infoNotification: InformationFilled,\n successNotification: CheckmarkFilled,\n warningNotification: WarningFilled,\n dangerNotification: ErrorFilled,\n invalid: WarningFilled,\n invalidAlt: Warning,\n redo: Restart,\n selectArrow: ChevronDown,\n toggleChecked: Checkmark,\n}\n","import type { SVGProps } from 'react'\n\n/**\n * This module contains substitute icons for the Checkbox component.\n * @module\n */\n\ninterface CheckboxIconProps extends SVGProps<SVGSVGElement> {}\n\n/**\n * Checkmark icon for Checkbox component\n */\nexport function CheckmarkIcon(props: CheckboxIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n role=\"img\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path\n fill=\"currentColor\"\n d=\"M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z\"\n />\n </svg>\n )\n}\n\ninterface IndeterminateIconProps extends SVGProps<SVGSVGElement> {}\n\n/**\n * Indeterminate icon for Checkbox component\n */\nexport function IndeterminateIcon(props: IndeterminateIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n role=\"img\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path fill=\"currentColor\" d=\"M4 11h16v2.667H4z\" />\n </svg>\n )\n}\n","import { defaultIcons, type DefinedIcons } from './cerbIcons'\n\nfunction _validateIconsProperties(icons: DefinedIcons) {\n if (!icons.invalid) {\n throw new Error(\n 'The an invalid property must be defined in your custom icons library.',\n )\n }\n}\n\nexport function defineIcons(icons: DefinedIcons): Required<DefinedIcons> {\n _validateIconsProperties(icons)\n $cerberusIcons = {\n ...defaultIcons,\n ...icons,\n } as Required<DefinedIcons>\n return $cerberusIcons\n}\n\n// Default icons\n\nexport let $cerberusIcons = defaultIcons as Required<DefinedIcons>\n","import type { KeyboardEvent, KeyboardEventHandler, RefObject } from 'react'\n\nexport function trapFocus(\n modalRef: RefObject<HTMLDialogElement>,\n): KeyboardEventHandler<HTMLDialogElement> {\n const focusableElements =\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n const focusable = Array.from(\n modalRef.current?.querySelectorAll(focusableElements) ?? [],\n )\n const firstFocusable = focusable[0] as HTMLElement\n const lastFocusable = focusable[focusable.length - 1] as HTMLElement\n\n return function handleKeyDown(event: KeyboardEvent<HTMLDialogElement>) {\n if (event.key === 'Tab') {\n if (event.shiftKey) {\n if (document.activeElement === firstFocusable) {\n lastFocusable.focus()\n event.preventDefault()\n }\n } else {\n if (document.activeElement === lastFocusable) {\n firstFocusable.focus()\n event.preventDefault()\n }\n }\n }\n }\n}\n"],"mappings":"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","names":["import_icons","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../../src/components/Notification.tsx","../../../src/config/cerbIcons.ts","../../../src/config/icons/checkbox.icons.tsx","../../../src/components/AnimatingUploadIcon.tsx","../../../src/config/defineIcons.ts","../../../src/aria-helpers/trap-focus.aria.ts"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport {\n useRef,\n type DialogHTMLAttributes,\n type PropsWithChildren,\n type MouseEvent,\n} from 'react'\nimport { Close } from '@cerberus/icons'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport type { IconType } from '../config/cerbIcons'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\n\n/**\n * This module exports the Notification component.\n * @module\n */\n\nfunction MatchNotificationIcon(props: NotificationVariantProps) {\n const palette = props.palette || 'info'\n const key = `${palette}Notification` as keyof typeof $cerberusIcons\n const Icon = $cerberusIcons[key] as IconType\n return <Icon />\n}\n\nexport interface NotificationBaseProps\n extends Omit<DialogHTMLAttributes<HTMLDialogElement>, 'onClose'> {\n /**\n * The unique id of the notification. Required for the onClose callback.\n */\n id: string\n /**\n * Called when the close button is clicked.\n */\n onClose?: (e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type NotificationProps = NotificationBaseProps & NotificationVariantProps\n\n/**\n * A static Notification component that displays a message to the user. This\n * is typically only used when not utilizing the NotificationCenter.\n * @see https://cerberus.digitalu.design/react/notification\n * @memberof module:NotificationCenter\n * @example\n * ```tsx\n * <Notification id=\"info:1\" open>\n * <NotificationHeading>Info Notification</NotificationHeading>\n * <NotificationDescription>\n * This is a description with a <a href=\"#\">link</a> in the message.\n * </NotificationDescription>\n * </Notification>\n * ```\n */\nexport function Notification(props: PropsWithChildren<NotificationProps>) {\n const { children, palette, onClose, ...nativeProps } = props\n const ref = useRef<HTMLDialogElement>(null)\n const onKeyDown = trapFocus(ref)\n const styles = notification({ palette })\n\n return (\n <dialog\n {...nativeProps}\n className={cx(\n nativeProps.className,\n hstack({\n position: 'relative',\n gap: '4',\n }),\n styles.dialog,\n )}\n onKeyDown={onKeyDown}\n ref={ref}\n >\n <span className={styles.icon}>\n <MatchNotificationIcon palette={palette} />\n </span>\n\n <div\n className={vstack({\n alignItems: 'flex-start',\n gap: '0',\n py: '2',\n })}\n >\n {children}\n </div>\n\n <button\n aria-label=\"Close\"\n className={styles.close}\n onClick={onClose}\n value={props.id}\n >\n <Close />\n </button>\n </dialog>\n )\n}\n","import {\n Checkmark,\n CheckmarkOutline,\n ChevronDown,\n CloseFilled,\n CloudUpload,\n Information,\n Restart,\n TrashCan,\n UserFilled,\n Warning,\n WarningAlt,\n WarningFilled,\n type CarbonIconType,\n} from '@cerberus/icons'\nimport type { ElementType } from 'react'\nimport { CheckmarkIcon, IndeterminateIcon } from './icons/checkbox.icons'\nimport { AnimatingUploadIcon } from '../components/AnimatingUploadIcon'\n\nexport type IconType = CarbonIconType | ElementType\n\nexport interface DefinedIcons {\n avatar?: IconType\n checkbox?: IconType\n close?: IconType\n confirmModal?: IconType\n delete?: IconType\n promptModal?: IconType\n waitingFileUploader?: IconType\n fileUploader?: IconType\n indeterminate?: IconType\n infoNotification?: IconType\n successNotification?: IconType\n warningNotification?: IconType\n dangerNotification?: IconType\n invalid: IconType\n invalidAlt?: IconType\n redo?: IconType\n selectArrow?: IconType\n toggleChecked?: IconType\n}\n\nexport const defaultIcons: DefinedIcons = {\n avatar: UserFilled,\n checkbox: CheckmarkIcon,\n close: CloseFilled,\n confirmModal: Information,\n delete: TrashCan,\n promptModal: Information,\n waitingFileUploader: CloudUpload,\n fileUploader: AnimatingUploadIcon,\n indeterminate: IndeterminateIcon,\n infoNotification: Information,\n successNotification: CheckmarkOutline,\n warningNotification: WarningAlt,\n dangerNotification: WarningFilled,\n invalid: WarningFilled,\n invalidAlt: Warning,\n redo: Restart,\n selectArrow: ChevronDown,\n toggleChecked: Checkmark,\n}\n","import type { SVGProps } from 'react'\n\n/**\n * This module contains substitute icons for the Checkbox component.\n * @module\n */\n\ninterface CheckboxIconProps extends SVGProps<SVGSVGElement> {}\n\n/**\n * Checkmark icon for Checkbox component\n */\nexport function CheckmarkIcon(props: CheckboxIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n role=\"img\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path\n fill=\"currentColor\"\n d=\"M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z\"\n />\n </svg>\n )\n}\n\ninterface IndeterminateIconProps extends SVGProps<SVGSVGElement> {}\n\n/**\n * Indeterminate icon for Checkbox component\n */\nexport function IndeterminateIcon(props: IndeterminateIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n role=\"img\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path fill=\"currentColor\" d=\"M4 11h16v2.667H4z\" />\n </svg>\n )\n}\n","import { type CarbonIconProps } from '@cerberus/icons'\n\n/**\n * This module contains an animating icon to use for the FileStatus component.\n * @module\n */\n\nexport type AnimatingUploadIconProps = CarbonIconProps\n\nexport function AnimatingUploadIcon(props: AnimatingUploadIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width={props.size ?? '1em'}\n height={props.size ?? '1em'}\n viewBox=\"0 0 24 24\"\n >\n <g\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"square\"\n strokeLinejoin=\"round\"\n strokeWidth={1.5}\n >\n <path\n data-name=\"animating-trail\"\n strokeDasharray=\"2 4\"\n strokeDashoffset={6}\n d=\"M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9\"\n >\n <animate\n attributeName=\"stroke-dashoffset\"\n dur=\"0.45s\"\n repeatCount=\"indefinite\"\n values=\"6;0\"\n ></animate>\n </path>\n\n <path\n data-name=\"half-circle\"\n strokeDasharray={32}\n strokeDashoffset={32}\n d=\"M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9\"\n >\n <animate\n fill=\"freeze\"\n attributeName=\"stroke-dashoffset\"\n begin=\"0.075s\"\n dur=\"0.3s\"\n values=\"32;0\"\n ></animate>\n </path>\n\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"0.8em\"\n height=\"0.8em\"\n x=\"27%\"\n y=\"27%\"\n viewBox=\"0 0 24 24\"\n >\n <polygon\n fill=\"currentColor\"\n stroke=\"currentColor\"\n strokeWidth={0.8}\n opacity=\"1\"\n points=\"3.7,6.7 7.5,2.9 7.5,15 8.5,15 8.5,2.9 12.3,6.7 13,6 8,1 3,6 \"\n >\n <animate\n fill=\"freeze\"\n attributeName=\"opacity\"\n values=\"1;0;1\"\n dur=\"2s\"\n repeatCount=\"indefinite\"\n ></animate>\n </polygon>\n </svg>\n </g>\n </svg>\n )\n}\n","import { defaultIcons, type DefinedIcons } from './cerbIcons'\n\nfunction _validateIconsProperties(icons: DefinedIcons) {\n if (!icons.invalid) {\n throw new Error(\n 'The an invalid property must be defined in your custom icons library.',\n )\n }\n}\n\nexport function defineIcons(icons: DefinedIcons): Required<DefinedIcons> {\n _validateIconsProperties(icons)\n $cerberusIcons = {\n ...defaultIcons,\n ...icons,\n } as Required<DefinedIcons>\n return $cerberusIcons\n}\n\n// Default icons\n\nexport let $cerberusIcons = defaultIcons as Required<DefinedIcons>\n","import type { KeyboardEvent, KeyboardEventHandler, RefObject } from 'react'\n\nexport function trapFocus(\n modalRef: RefObject<HTMLDialogElement>,\n): KeyboardEventHandler<HTMLDialogElement> {\n const focusableElements =\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n const focusable = Array.from(\n modalRef.current?.querySelectorAll(focusableElements) ?? [],\n )\n const firstFocusable = focusable[0] as HTMLElement\n const lastFocusable = focusable[focusable.length - 1] as HTMLElement\n\n return function handleKeyDown(event: KeyboardEvent<HTMLDialogElement>) {\n if (event.key === 'Tab') {\n if (event.shiftKey) {\n if (document.activeElement === firstFocusable) {\n lastFocusable.focus()\n event.preventDefault()\n }\n } else {\n if (document.activeElement === lastFocusable) {\n firstFocusable.focus()\n event.preventDefault()\n }\n }\n }\n }\n}\n"],"mappings":"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","names":["import_icons","import_jsx_runtime","import_jsx_runtime"]}
@@ -46,20 +46,33 @@ function Radio(props) {
46
46
  const { children, size, ...nativeProps } = props;
47
47
  const { invalid, ...state } = useFieldContext();
48
48
  const styles = (0, import_recipes.radio)({ size });
49
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: (0, import_css.cx)("group", (0, import_patterns.hstack)(), styles.root), tabIndex: 0, children: [
50
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
51
- "input",
52
- {
53
- ...nativeProps,
54
- ...state,
55
- ...invalid && { "aria-invalid": true },
56
- className: (0, import_css.cx)(nativeProps.className, styles.input),
57
- tabIndex: -1,
58
- type: "radio"
59
- }
60
- ),
61
- children
62
- ] });
49
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
50
+ "div",
51
+ {
52
+ className: (0, import_css.cx)(
53
+ "group",
54
+ (0, import_patterns.hstack)({
55
+ gap: "sm"
56
+ }),
57
+ styles.root
58
+ ),
59
+ tabIndex: 0,
60
+ children: [
61
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
62
+ "input",
63
+ {
64
+ ...nativeProps,
65
+ ...state,
66
+ ...invalid && { "aria-invalid": true },
67
+ className: (0, import_css.cx)(nativeProps.className, styles.input),
68
+ tabIndex: -1,
69
+ type: "radio"
70
+ }
71
+ ),
72
+ children
73
+ ]
74
+ }
75
+ );
63
76
  }
64
77
  // Annotate the CommonJS export names for ESM import in node:
65
78
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Radio.tsx","../../../src/context/field.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { radio } from '@cerberus/styled-system/recipes'\nimport type { RecipeVariantProps } from '@cerberus/styled-system/types'\nimport type { InputHTMLAttributes, PropsWithChildren } from 'react'\nimport { useFieldContext } from '../context/field'\n\n/**\n * This module contains the Radio component.\n * @module\n */\n\nexport type RadioRecipe = RecipeVariantProps<typeof radio>\nexport interface RadioBaseProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n /**\n * A unique identifier for the radio button. Required for accessibility.\n */\n id: string\n}\nexport type RadioProps = RadioBaseProps & RadioRecipe\n\n/**\n * The Radio component is used to allow users to select a single option from a list of options.\n * @see https://cerberus.digitalu.design/react/radio\n * @memberof module:Field\n * @example\n * ```tsx\n * <Field>\n * <fieldset name=\"fruit\">\n * <Radio id=\"radio-1\" name=\"fruit\" value=\"1\">\n * Option 1\n * </Radio>\n * <Radio id=\"radio-2\" name=\"fruit\" value=\"2\">\n * Option 2\n * </Radio>\n * <Radio id=\"radio-3\" name=\"fruit\" value=\"3\">\n * Option 3\n * </Radio>\n * </fieldset>\n * </Field>\n * ```\n */\nexport function Radio(props: PropsWithChildren<RadioProps>) {\n const { children, size, ...nativeProps } = props\n const { invalid, ...state } = useFieldContext()\n const styles = radio({ size })\n\n return (\n <div className={cx('group', hstack(), styles.root)} tabIndex={0}>\n <input\n {...nativeProps}\n {...state}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(nativeProps.className, styles.input)}\n tabIndex={-1}\n type=\"radio\"\n />\n {children}\n </div>\n )\n}\n","'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\n/**\n * This module provides a context and hook for the field.\n * @module Field\n */\n\nexport interface FieldContextValue {\n /**\n * Whether the field is disabled.\n * @description [Moz Input Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes)\n */\n disabled?: boolean\n /**\n * Whether the field is read-only.\n */\n readOnly?: boolean\n /**\n * Whether the field is required.\n */\n required?: boolean\n /**\n * Whether the field is invalid.\n */\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\n/**\n * Provides the field state for a all related components used within a group.\n * @see https://cerberus.digitalu.design/react/input\n */\nexport function Field(\n props: PropsWithChildren<FieldContextValue>,\n): JSX.Element {\n const value = useMemo(\n () => ({\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n invalid: props.invalid,\n }),\n [props.disabled, props.readOnly, props.required, props.invalid],\n )\n\n return (\n <FieldContext.Provider value={value}>\n {props.children}\n </FieldContext.Provider>\n )\n}\n\n/**\n * Used to access the field context.\n * @returns The field context.\n */\nexport function useFieldContext(): FieldContextValue {\n const context = useContext(FieldContext)\n if (!context) {\n throw new Error('useFieldContext must be used within a Field Provider.')\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AACnB,sBAAuB;AACvB,qBAAsB;;;ACFtB,mBAKO;AA+CH;AApBJ,IAAM,mBAAe,4BAAwC,IAAI;AA8B1D,SAAS,kBAAqC;AACnD,QAAM,cAAU,yBAAW,YAAY;AACvC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AACA,SAAO;AACT;;;ADnBI,IAAAA,sBAAA;AANG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,UAAU,MAAM,GAAG,YAAY,IAAI;AAC3C,QAAM,EAAE,SAAS,GAAG,MAAM,IAAI,gBAAgB;AAC9C,QAAM,aAAS,sBAAM,EAAE,KAAK,CAAC;AAE7B,SACE,8CAAC,SAAI,eAAW,eAAG,aAAS,wBAAO,GAAG,OAAO,IAAI,GAAG,UAAU,GAC5D;AAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,QACvC,eAAW,eAAG,YAAY,WAAW,OAAO,KAAK;AAAA,QACjD,UAAU;AAAA,QACV,MAAK;AAAA;AAAA,IACP;AAAA,IACC;AAAA,KACH;AAEJ;","names":["import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../../src/components/Radio.tsx","../../../src/context/field.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { radio } from '@cerberus/styled-system/recipes'\nimport type { RecipeVariantProps } from '@cerberus/styled-system/types'\nimport type { InputHTMLAttributes, PropsWithChildren } from 'react'\nimport { useFieldContext } from '../context/field'\n\n/**\n * This module contains the Radio component.\n * @module\n */\n\nexport type RadioRecipe = RecipeVariantProps<typeof radio>\nexport interface RadioBaseProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n /**\n * A unique identifier for the radio button. Required for accessibility.\n */\n id: string\n}\nexport type RadioProps = RadioBaseProps & RadioRecipe\n\n/**\n * The Radio component is used to allow users to select a single option from a list of options.\n * @see https://cerberus.digitalu.design/react/radio\n * @memberof module:Field\n * @example\n * ```tsx\n * <Field>\n * <fieldset name=\"fruit\">\n * <Radio id=\"radio-1\" name=\"fruit\" value=\"1\">\n * Option 1\n * </Radio>\n * <Radio id=\"radio-2\" name=\"fruit\" value=\"2\">\n * Option 2\n * </Radio>\n * <Radio id=\"radio-3\" name=\"fruit\" value=\"3\">\n * Option 3\n * </Radio>\n * </fieldset>\n * </Field>\n * ```\n */\nexport function Radio(props: PropsWithChildren<RadioProps>) {\n const { children, size, ...nativeProps } = props\n const { invalid, ...state } = useFieldContext()\n const styles = radio({ size })\n\n return (\n <div\n className={cx(\n 'group',\n hstack({\n gap: 'sm',\n }),\n styles.root,\n )}\n tabIndex={0}\n >\n <input\n {...nativeProps}\n {...state}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(nativeProps.className, styles.input)}\n tabIndex={-1}\n type=\"radio\"\n />\n {children}\n </div>\n )\n}\n","'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\n/**\n * This module provides a context and hook for the field.\n * @module Field\n */\n\nexport interface FieldContextValue {\n /**\n * Whether the field is disabled.\n * @description [Moz Input Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes)\n */\n disabled?: boolean\n /**\n * Whether the field is read-only.\n */\n readOnly?: boolean\n /**\n * Whether the field is required.\n */\n required?: boolean\n /**\n * Whether the field is invalid.\n */\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\n/**\n * Provides the field state for a all related components used within a group.\n * @see https://cerberus.digitalu.design/react/input\n */\nexport function Field(\n props: PropsWithChildren<FieldContextValue>,\n): JSX.Element {\n const value = useMemo(\n () => ({\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n invalid: props.invalid,\n }),\n [props.disabled, props.readOnly, props.required, props.invalid],\n )\n\n return (\n <FieldContext.Provider value={value}>\n {props.children}\n </FieldContext.Provider>\n )\n}\n\n/**\n * Used to access the field context.\n * @returns The field context.\n */\nexport function useFieldContext(): FieldContextValue {\n const context = useContext(FieldContext)\n if (!context) {\n throw new Error('useFieldContext must be used within a Field Provider.')\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AACnB,sBAAuB;AACvB,qBAAsB;;;ACFtB,mBAKO;AA+CH;AApBJ,IAAM,mBAAe,4BAAwC,IAAI;AA8B1D,SAAS,kBAAqC;AACnD,QAAM,cAAU,yBAAW,YAAY;AACvC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AACA,SAAO;AACT;;;ADnBI,IAAAA,sBAAA;AANG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,UAAU,MAAM,GAAG,YAAY,IAAI;AAC3C,QAAM,EAAE,SAAS,GAAG,MAAM,IAAI,gBAAgB;AAC9C,QAAM,aAAS,sBAAM,EAAE,KAAK,CAAC;AAE7B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,QACT;AAAA,YACA,wBAAO;AAAA,UACL,KAAK;AAAA,QACP,CAAC;AAAA,QACD,OAAO;AAAA,MACT;AAAA,MACA,UAAU;AAAA,MAEV;AAAA;AAAA,UAAC;AAAA;AAAA,YACE,GAAG;AAAA,YACH,GAAG;AAAA,YACH,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,YACvC,eAAW,eAAG,YAAY,WAAW,OAAO,KAAK;AAAA,YACjD,UAAU;AAAA,YACV,MAAK;AAAA;AAAA,QACP;AAAA,QACC;AAAA;AAAA;AAAA,EACH;AAEJ;","names":["import_jsx_runtime"]}
@@ -69,6 +69,102 @@ function IndeterminateIcon(props) {
69
69
  );
70
70
  }
71
71
 
72
+ // src/components/AnimatingUploadIcon.tsx
73
+ var import_jsx_runtime2 = require("react/jsx-runtime");
74
+ function AnimatingUploadIcon(props) {
75
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
76
+ "svg",
77
+ {
78
+ "aria-hidden": "true",
79
+ xmlns: "http://www.w3.org/2000/svg",
80
+ width: props.size ?? "1em",
81
+ height: props.size ?? "1em",
82
+ viewBox: "0 0 24 24",
83
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
84
+ "g",
85
+ {
86
+ fill: "none",
87
+ stroke: "currentColor",
88
+ strokeLinecap: "square",
89
+ strokeLinejoin: "round",
90
+ strokeWidth: 1.5,
91
+ children: [
92
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
93
+ "path",
94
+ {
95
+ "data-name": "animating-trail",
96
+ strokeDasharray: "2 4",
97
+ strokeDashoffset: 6,
98
+ d: "M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9",
99
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
100
+ "animate",
101
+ {
102
+ attributeName: "stroke-dashoffset",
103
+ dur: "0.45s",
104
+ repeatCount: "indefinite",
105
+ values: "6;0"
106
+ }
107
+ )
108
+ }
109
+ ),
110
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
111
+ "path",
112
+ {
113
+ "data-name": "half-circle",
114
+ strokeDasharray: 32,
115
+ strokeDashoffset: 32,
116
+ d: "M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9",
117
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
118
+ "animate",
119
+ {
120
+ fill: "freeze",
121
+ attributeName: "stroke-dashoffset",
122
+ begin: "0.075s",
123
+ dur: "0.3s",
124
+ values: "32;0"
125
+ }
126
+ )
127
+ }
128
+ ),
129
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
130
+ "svg",
131
+ {
132
+ "aria-hidden": "true",
133
+ xmlns: "http://www.w3.org/2000/svg",
134
+ width: "0.8em",
135
+ height: "0.8em",
136
+ x: "27%",
137
+ y: "27%",
138
+ viewBox: "0 0 24 24",
139
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
140
+ "polygon",
141
+ {
142
+ fill: "currentColor",
143
+ stroke: "currentColor",
144
+ strokeWidth: 0.8,
145
+ opacity: "1",
146
+ points: "3.7,6.7 7.5,2.9 7.5,15 8.5,15 8.5,2.9 12.3,6.7 13,6 8,1 3,6 ",
147
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
148
+ "animate",
149
+ {
150
+ fill: "freeze",
151
+ attributeName: "opacity",
152
+ values: "1;0;1",
153
+ dur: "2s",
154
+ repeatCount: "indefinite"
155
+ }
156
+ )
157
+ }
158
+ )
159
+ }
160
+ )
161
+ ]
162
+ }
163
+ )
164
+ }
165
+ );
166
+ }
167
+
72
168
  // src/config/cerbIcons.ts
73
169
  var defaultIcons = {
74
170
  avatar: import_icons.UserFilled,
@@ -77,12 +173,13 @@ var defaultIcons = {
77
173
  confirmModal: import_icons.Information,
78
174
  delete: import_icons.TrashCan,
79
175
  promptModal: import_icons.Information,
80
- fileUploader: import_icons.CloudUpload,
176
+ waitingFileUploader: import_icons.CloudUpload,
177
+ fileUploader: AnimatingUploadIcon,
81
178
  indeterminate: IndeterminateIcon,
82
- infoNotification: import_icons.InformationFilled,
83
- successNotification: import_icons.CheckmarkFilled,
84
- warningNotification: import_icons.WarningFilled,
85
- dangerNotification: import_icons.ErrorFilled,
179
+ infoNotification: import_icons.Information,
180
+ successNotification: import_icons.CheckmarkOutline,
181
+ warningNotification: import_icons.WarningAlt,
182
+ dangerNotification: import_icons.WarningFilled,
86
183
  invalid: import_icons.WarningFilled,
87
184
  invalidAlt: import_icons.Warning,
88
185
  redo: import_icons.Restart,
@@ -95,7 +192,7 @@ var $cerberusIcons = defaultIcons;
95
192
 
96
193
  // src/context/field.tsx
97
194
  var import_react = require("react");
98
- var import_jsx_runtime2 = require("react/jsx-runtime");
195
+ var import_jsx_runtime3 = require("react/jsx-runtime");
99
196
  var FieldContext = (0, import_react.createContext)(null);
100
197
  function useFieldContext() {
101
198
  const context = (0, import_react.useContext)(FieldContext);
@@ -117,7 +214,7 @@ function Show(props) {
117
214
  }
118
215
 
119
216
  // src/components/Select.tsx
120
- var import_jsx_runtime3 = require("react/jsx-runtime");
217
+ var import_jsx_runtime4 = require("react/jsx-runtime");
121
218
  function Select(props) {
122
219
  const { describedBy, size, ...nativeProps } = props;
123
220
  const { invalid, ...fieldStates } = useFieldContext();
@@ -125,8 +222,8 @@ function Select(props) {
125
222
  const styles = (0, import_recipes.select)({
126
223
  size
127
224
  });
128
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: styles.root, children: [
129
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
225
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles.root, children: [
226
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
130
227
  "select",
131
228
  {
132
229
  ...nativeProps,
@@ -136,7 +233,7 @@ function Select(props) {
136
233
  className: styles.input
137
234
  }
138
235
  ),
139
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
236
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
140
237
  "span",
141
238
  {
142
239
  className: (0, import_css.cx)(
@@ -146,22 +243,22 @@ function Select(props) {
146
243
  })
147
244
  ),
148
245
  children: [
149
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Show, { when: invalid, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
246
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Show, { when: invalid, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
150
247
  "span",
151
248
  {
152
249
  ...invalid && { "data-invalid": true },
153
250
  className: styles.stateIcon,
154
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InvalidIcon, {})
251
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InvalidIcon, {})
155
252
  }
156
253
  ) }),
157
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styles.arrowIcon, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SelectArrow, {}) })
254
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.arrowIcon, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SelectArrow, {}) })
158
255
  ]
159
256
  }
160
257
  )
161
258
  ] });
162
259
  }
163
260
  function Option(props) {
164
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { ...props });
261
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { ...props });
165
262
  }
166
263
  // Annotate the CommonJS export names for ESM import in node:
167
264
  0 && (module.exports = {