@cerberus-design/react 0.13.2-next-4bdc7c3 → 0.13.2-next-46f23d2

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 (114) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +49 -22
  2. package/build/legacy/components/Admonition.cjs.map +1 -1
  3. package/build/legacy/components/Avatar.cjs.map +1 -1
  4. package/build/legacy/components/Checkbox.cjs.map +1 -1
  5. package/build/legacy/components/FileStatus.cjs.map +1 -1
  6. package/build/legacy/components/FileUploader.cjs.map +1 -1
  7. package/build/legacy/components/Input.cjs.map +1 -1
  8. package/build/legacy/components/Notification.cjs.map +1 -1
  9. package/build/legacy/components/NotificationDescription.cjs.map +1 -1
  10. package/build/legacy/components/NotificationHeading.cjs.map +1 -1
  11. package/build/legacy/components/ProgressBar.cjs.map +1 -1
  12. package/build/legacy/components/Select.cjs.map +1 -1
  13. package/build/legacy/components/Tag.cjs.map +1 -1
  14. package/build/legacy/components/Text.cjs +59 -0
  15. package/build/legacy/components/Text.cjs.map +1 -0
  16. package/build/legacy/components/Toggle.cjs.map +1 -1
  17. package/build/legacy/config/cerbIcons.cjs.map +1 -1
  18. package/build/legacy/config/defineIcons.cjs.map +1 -1
  19. package/build/legacy/config/icons/checkbox.icons.cjs.map +1 -1
  20. package/build/legacy/context/confirm-modal.cjs.map +1 -1
  21. package/build/legacy/context/cta-modal.cjs +2 -3
  22. package/build/legacy/context/cta-modal.cjs.map +1 -1
  23. package/build/legacy/context/notification-center.cjs.map +1 -1
  24. package/build/legacy/context/prompt-modal.cjs.map +1 -1
  25. package/build/legacy/index.cjs +118 -86
  26. package/build/legacy/index.cjs.map +1 -1
  27. package/build/modern/_tsup-dts-rollup.d.ts +49 -22
  28. package/build/modern/chunk-2ZNIYPDV.js +47 -0
  29. package/build/modern/chunk-2ZNIYPDV.js.map +1 -0
  30. package/build/modern/{chunk-7SGPJM66.js → chunk-35L6DOHE.js} +2 -2
  31. package/build/modern/chunk-35L6DOHE.js.map +1 -0
  32. package/build/modern/{chunk-XL4JREDT.js → chunk-3DGV4ESI.js} +2 -2
  33. package/build/modern/{chunk-4QBPJVEN.js → chunk-42RVVWGM.js} +4 -4
  34. package/build/modern/chunk-42RVVWGM.js.map +1 -0
  35. package/build/modern/{chunk-N4QTLDVM.js → chunk-67KLFLNR.js} +3 -3
  36. package/build/modern/{chunk-SPZYPRZ6.js → chunk-C3HYHH3H.js} +2 -2
  37. package/build/modern/{chunk-TM5AS6M6.js → chunk-CMDPTXHB.js} +3 -3
  38. package/build/modern/chunk-CMDPTXHB.js.map +1 -0
  39. package/build/modern/{chunk-CP7OUC2Q.js → chunk-E3PAEB7Y.js} +1 -1
  40. package/build/modern/chunk-E3PAEB7Y.js.map +1 -0
  41. package/build/modern/{chunk-NMNONSHU.js → chunk-MRH2EO3L.js} +2 -2
  42. package/build/modern/{chunk-622N7YRT.js → chunk-NF5WV3OW.js} +5 -6
  43. package/build/modern/chunk-NF5WV3OW.js.map +1 -0
  44. package/build/modern/{chunk-W4DXACNV.js → chunk-OFAATLPF.js} +3 -3
  45. package/build/modern/{chunk-NB6DV4VA.js → chunk-PGXJJDPH.js} +2 -2
  46. package/build/modern/{chunk-7MM5KYEX.js → chunk-RET4YOBV.js} +4 -4
  47. package/build/modern/{chunk-C3CDRCHS.js → chunk-RHHFH6JJ.js} +4 -4
  48. package/build/modern/chunk-RHHFH6JJ.js.map +1 -0
  49. package/build/modern/{chunk-SXIXDXG3.js → chunk-SLHYBPJ5.js} +1 -1
  50. package/build/modern/chunk-SLHYBPJ5.js.map +1 -0
  51. package/build/modern/{chunk-NKM6PISB.js → chunk-SVFZJYLV.js} +2 -2
  52. package/build/modern/{chunk-VERRHMW4.js → chunk-UBN2CZLV.js} +2 -2
  53. package/build/modern/{chunk-XEW6TJJ4.js → chunk-UXY3KCC3.js} +1 -1
  54. package/build/modern/chunk-UXY3KCC3.js.map +1 -0
  55. package/build/modern/{chunk-F72ZABKX.js → chunk-W3YI64C5.js} +2 -2
  56. package/build/modern/{chunk-KCANMM64.js → chunk-WZJ5UQNM.js} +1 -1
  57. package/build/modern/chunk-WZJ5UQNM.js.map +1 -0
  58. package/build/modern/{chunk-F27AAKQ3.js → chunk-XNX3OTJK.js} +2 -2
  59. package/build/modern/components/Admonition.js +5 -5
  60. package/build/modern/components/Avatar.js +4 -4
  61. package/build/modern/components/Checkbox.js +4 -4
  62. package/build/modern/components/FileStatus.js +6 -6
  63. package/build/modern/components/FileUploader.js +5 -5
  64. package/build/modern/components/Input.js +4 -4
  65. package/build/modern/components/Notification.js +4 -4
  66. package/build/modern/components/NotificationDescription.js +1 -1
  67. package/build/modern/components/NotificationHeading.js +1 -1
  68. package/build/modern/components/ProgressBar.js +1 -1
  69. package/build/modern/components/Select.js +4 -4
  70. package/build/modern/components/Tag.js +4 -4
  71. package/build/modern/components/Text.js +7 -0
  72. package/build/modern/components/Text.js.map +1 -0
  73. package/build/modern/components/Toggle.js +4 -4
  74. package/build/modern/config/cerbIcons.js +2 -2
  75. package/build/modern/config/defineIcons.js +3 -3
  76. package/build/modern/config/icons/checkbox.icons.js +1 -1
  77. package/build/modern/context/confirm-modal.js +5 -5
  78. package/build/modern/context/cta-modal.js +5 -5
  79. package/build/modern/context/notification-center.js +7 -7
  80. package/build/modern/context/prompt-modal.js +6 -6
  81. package/build/modern/index.js +24 -20
  82. package/build/modern/index.js.map +1 -1
  83. package/package.json +3 -3
  84. package/src/components/Notification.tsx +6 -3
  85. package/src/components/NotificationDescription.tsx +2 -2
  86. package/src/components/NotificationHeading.tsx +1 -2
  87. package/src/components/ProgressBar.tsx +1 -1
  88. package/src/components/Text.tsx +70 -0
  89. package/src/config/icons/checkbox.icons.tsx +2 -2
  90. package/src/context/confirm-modal.tsx +1 -1
  91. package/src/context/cta-modal.tsx +6 -7
  92. package/src/context/notification-center.tsx +1 -1
  93. package/src/context/prompt-modal.tsx +1 -1
  94. package/src/index.ts +1 -0
  95. package/build/modern/chunk-4QBPJVEN.js.map +0 -1
  96. package/build/modern/chunk-622N7YRT.js.map +0 -1
  97. package/build/modern/chunk-7SGPJM66.js.map +0 -1
  98. package/build/modern/chunk-C3CDRCHS.js.map +0 -1
  99. package/build/modern/chunk-CP7OUC2Q.js.map +0 -1
  100. package/build/modern/chunk-KCANMM64.js.map +0 -1
  101. package/build/modern/chunk-SXIXDXG3.js.map +0 -1
  102. package/build/modern/chunk-TM5AS6M6.js.map +0 -1
  103. package/build/modern/chunk-XEW6TJJ4.js.map +0 -1
  104. /package/build/modern/{chunk-XL4JREDT.js.map → chunk-3DGV4ESI.js.map} +0 -0
  105. /package/build/modern/{chunk-N4QTLDVM.js.map → chunk-67KLFLNR.js.map} +0 -0
  106. /package/build/modern/{chunk-SPZYPRZ6.js.map → chunk-C3HYHH3H.js.map} +0 -0
  107. /package/build/modern/{chunk-NMNONSHU.js.map → chunk-MRH2EO3L.js.map} +0 -0
  108. /package/build/modern/{chunk-W4DXACNV.js.map → chunk-OFAATLPF.js.map} +0 -0
  109. /package/build/modern/{chunk-NB6DV4VA.js.map → chunk-PGXJJDPH.js.map} +0 -0
  110. /package/build/modern/{chunk-7MM5KYEX.js.map → chunk-RET4YOBV.js.map} +0 -0
  111. /package/build/modern/{chunk-NKM6PISB.js.map → chunk-SVFZJYLV.js.map} +0 -0
  112. /package/build/modern/{chunk-VERRHMW4.js.map → chunk-UBN2CZLV.js.map} +0 -0
  113. /package/build/modern/{chunk-F72ZABKX.js.map → chunk-W3YI64C5.js.map} +0 -0
  114. /package/build/modern/{chunk-F27AAKQ3.js.map → chunk-XNX3OTJK.js.map} +0 -0
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
-
3
1
  import { Accordion as Accordion_2 } from '@ark-ui/react';
4
2
  import { AccordionVariantProps } from '@cerberus/styled-system/recipes';
5
3
  import { Activator } from '@dnd-kit/core';
@@ -12,6 +10,7 @@ import { applyModifiers } from '@dnd-kit/core';
12
10
  import { AutoScrollActivator } from '@dnd-kit/core';
13
11
  import { AutoScrollOptions } from '@dnd-kit/core';
14
12
  import { AvatarVariantProps } from '@cerberus/styled-system/recipes';
13
+ import { BoxProps } from '@cerberus-design/styled-system/jsx';
15
14
  import { ButtonHTMLAttributes } from 'react';
16
15
  import { ButtonVariantProps } from '@cerberus/styled-system/recipes';
17
16
  import { CancelDrop } from '@dnd-kit/core';
@@ -88,7 +87,7 @@ import { Menu as Menu_2 } from '@ark-ui/react';
88
87
  import { Modifier } from '@dnd-kit/core';
89
88
  import { Modifiers } from '@dnd-kit/core';
90
89
  import { MouseEvent as MouseEvent_2 } from 'react';
91
- import type { MouseEventHandler } from 'react';
90
+ import { MouseEventHandler } from 'react';
92
91
  import { MouseSensor } from '@dnd-kit/core';
93
92
  import { MouseSensorOptions } from '@dnd-kit/core';
94
93
  import { MutableRefObject } from 'react';
@@ -483,8 +482,7 @@ export { BaseConfirmOptions as BaseConfirmOptions_alias_1 }
483
482
  * This module exports the NotificationDescription component.
484
483
  * @module
485
484
  */
486
- declare interface BaseNotificationDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {
487
- }
485
+ declare type BaseNotificationDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
488
486
  export { BaseNotificationDescriptionProps }
489
487
  export { BaseNotificationDescriptionProps as BaseNotificationDescriptionProps_alias_1 }
490
488
 
@@ -492,8 +490,7 @@ export { BaseNotificationDescriptionProps as BaseNotificationDescriptionProps_al
492
490
  * This module exports the NotificationHeading component.
493
491
  * @module
494
492
  */
495
- declare interface BaseNotificationHeadingProps extends HTMLAttributes<HTMLParagraphElement> {
496
- }
493
+ declare type BaseNotificationHeadingProps = HTMLAttributes<HTMLParagraphElement>;
497
494
  export { BaseNotificationHeadingProps }
498
495
  export { BaseNotificationHeadingProps as BaseNotificationHeadingProps_alias_1 }
499
496
 
@@ -535,8 +532,7 @@ export { Checkbox as Checkbox_alias_1 }
535
532
  * This module contains substitute icons for the Checkbox component.
536
533
  * @module
537
534
  */
538
- declare interface CheckboxIconProps extends SVGProps<SVGSVGElement> {
539
- }
535
+ export declare type CheckboxIconProps = SVGProps<SVGSVGElement>;
540
536
 
541
537
  /**
542
538
  * This module contains the Checkbox component.
@@ -690,8 +686,7 @@ declare function ConfirmModal(props: PropsWithChildren<ConfirmModalProviderProps
690
686
  export { ConfirmModal }
691
687
  export { ConfirmModal as ConfirmModal_alias_1 }
692
688
 
693
- declare interface ConfirmModalProviderProps {
694
- }
689
+ declare type ConfirmModalProviderProps = PropsWithChildren<unknown>;
695
690
  export { ConfirmModalProviderProps }
696
691
  export { ConfirmModalProviderProps as ConfirmModalProviderProps_alias_1 }
697
692
 
@@ -741,8 +736,7 @@ declare function CTAModal(props: PropsWithChildren<CTAModalProviderProps>): JSX_
741
736
  export { CTAModal }
742
737
  export { CTAModal as CTAModal_alias_1 }
743
738
 
744
- declare interface CTAModalProviderProps {
745
- }
739
+ declare type CTAModalProviderProps = PropsWithChildren<unknown>;
746
740
  export { CTAModalProviderProps }
747
741
  export { CTAModalProviderProps as CTAModalProviderProps_alias_1 }
748
742
 
@@ -1296,6 +1290,14 @@ declare interface GetPositionResult {
1296
1290
 
1297
1291
  export { getScrollableAncestors }
1298
1292
 
1293
+ /**
1294
+ * This module exports a component for rendering text utilizing the styled-system JSX utility.
1295
+ * @module @cerberus-design/react/Text
1296
+ */
1297
+ declare type Headings = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
1298
+ export { Headings }
1299
+ export { Headings as Headings_alias_1 }
1300
+
1299
1301
  /**
1300
1302
  * A component that allows the user to perform actions using an icon
1301
1303
  * @see https://cerberus.digitalu.design/react/icon-button
@@ -1328,8 +1330,7 @@ export declare type IconType = CarbonIconType | ElementType;
1328
1330
  */
1329
1331
  export declare function IndeterminateIcon(props: IndeterminateIconProps): JSX_2.Element;
1330
1332
 
1331
- declare interface IndeterminateIconProps extends SVGProps<SVGSVGElement> {
1332
- }
1333
+ export declare type IndeterminateIconProps = SVGProps<SVGSVGElement>;
1333
1334
 
1334
1335
  declare type IndeterminateProgressBarProps = {
1335
1336
  /**
@@ -1990,8 +1991,7 @@ declare type NotificationProps = NotificationBaseProps & NotificationVariantProp
1990
1991
  export { NotificationProps }
1991
1992
  export { NotificationProps as NotificationProps_alias_1 }
1992
1993
 
1993
- declare interface NotificationsProviderProps extends PortalProps {
1994
- }
1994
+ declare type NotificationsProviderProps = PortalProps;
1995
1995
  export { NotificationsProviderProps }
1996
1996
  export { NotificationsProviderProps as NotificationsProviderProps_alias_1 }
1997
1997
 
@@ -2128,8 +2128,7 @@ export { ProgressBar as ProgressBar_alias_1 }
2128
2128
  * This module contains the ProgressBar component.
2129
2129
  * @module
2130
2130
  */
2131
- declare interface ProgressBarBaseProps extends HTMLAttributes<HTMLDivElement> {
2132
- }
2131
+ declare type ProgressBarBaseProps = HTMLAttributes<HTMLDivElement>;
2133
2132
  export { ProgressBarBaseProps }
2134
2133
  export { ProgressBarBaseProps as ProgressBarBaseProps_alias_1 }
2135
2134
 
@@ -2168,8 +2167,7 @@ declare function PromptModal(props: PropsWithChildren<PromptModalProviderProps>)
2168
2167
  export { PromptModal }
2169
2168
  export { PromptModal as PromptModal_alias_1 }
2170
2169
 
2171
- declare interface PromptModalProviderProps {
2172
- }
2170
+ declare type PromptModalProviderProps = PropsWithChildren<unknown>;
2173
2171
  export { PromptModalProviderProps }
2174
2172
  export { PromptModalProviderProps as PromptModalProviderProps_alias_1 }
2175
2173
 
@@ -2381,7 +2379,7 @@ declare interface ShowCTAModalOptions {
2381
2379
  */
2382
2380
  actions: {
2383
2381
  text: string;
2384
- onClick: Required<ButtonHTMLAttributes<HTMLButtonElement>['onClick']>;
2382
+ onClick: MouseEventHandler<HTMLButtonElement>;
2385
2383
  }[];
2386
2384
  }
2387
2385
  export { ShowCTAModalOptions }
@@ -2746,6 +2744,22 @@ declare type TdProps = TdBaseProps & TdVariantProps;
2746
2744
  export { TdProps }
2747
2745
  export { TdProps as TdProps_alias_1 }
2748
2746
 
2747
+ /**
2748
+ * A component for rendering text utilizing the styled-system JSX utility.
2749
+ * @definition [Text docs](https://cerberus.digitalu.design/react/text)
2750
+ * @example
2751
+ * ```tsx
2752
+ * <Text as="h1" color="page.text.100" textStyle={{
2753
+ * base: 'heading-md',
2754
+ * md: 'heading-lg',
2755
+ * }}>
2756
+ * Hello, world!
2757
+ * </Text>
2758
+ */
2759
+ declare function Text_2(props: PropsWithChildren<TextProps>): JSX_2.Element;
2760
+ export { Text_2 as Text }
2761
+ export { Text_2 as Text_alias_1 }
2762
+
2749
2763
  /**
2750
2764
  * A component that allows the user to input large blocks of text.
2751
2765
  * @see https://cerberus.digitalu.design/react/textarea
@@ -2775,6 +2789,19 @@ declare type TextareaProps = InputVariantProps & TextareaBaseProps;
2775
2789
  export { TextareaProps }
2776
2790
  export { TextareaProps as TextareaProps_alias_1 }
2777
2791
 
2792
+ declare type TextElements = 'p' | 'strong' | 'em' | 'small' | 'span';
2793
+ export { TextElements }
2794
+ export { TextElements as TextElements_alias_1 }
2795
+
2796
+ declare interface TextProps extends BoxProps {
2797
+ /**
2798
+ * The element to render as. Defaults to 'p'.
2799
+ */
2800
+ as?: TextElements | Headings;
2801
+ }
2802
+ export { TextProps }
2803
+ export { TextProps as TextProps_alias_1 }
2804
+
2778
2805
  /**
2779
2806
  * Styles for the Th component
2780
2807
  * @see https://cerberus.digitalu.design/react/table
@@ -0,0 +1,47 @@
1
+ // src/components/Text.tsx
2
+ import {
3
+ Em,
4
+ H1,
5
+ H2,
6
+ H3,
7
+ H4,
8
+ H5,
9
+ H6,
10
+ P,
11
+ Small,
12
+ Span,
13
+ Strong
14
+ } from "@cerberus-design/styled-system/jsx";
15
+ import { jsx } from "react/jsx-runtime";
16
+ function Text(props) {
17
+ const { as = "p", ...pandaJSXProps } = props;
18
+ switch (as) {
19
+ case "h1":
20
+ return /* @__PURE__ */ jsx(H1, { ...pandaJSXProps });
21
+ case "h2":
22
+ return /* @__PURE__ */ jsx(H2, { ...pandaJSXProps });
23
+ case "h3":
24
+ return /* @__PURE__ */ jsx(H3, { ...pandaJSXProps });
25
+ case "h4":
26
+ return /* @__PURE__ */ jsx(H4, { ...pandaJSXProps });
27
+ case "h5":
28
+ return /* @__PURE__ */ jsx(H5, { ...pandaJSXProps });
29
+ case "h6":
30
+ return /* @__PURE__ */ jsx(H6, { ...pandaJSXProps });
31
+ case "strong":
32
+ return /* @__PURE__ */ jsx(Strong, { ...pandaJSXProps });
33
+ case "em":
34
+ return /* @__PURE__ */ jsx(Em, { ...pandaJSXProps });
35
+ case "small":
36
+ return /* @__PURE__ */ jsx(Small, { ...pandaJSXProps });
37
+ case "span":
38
+ return /* @__PURE__ */ jsx(Span, { ...pandaJSXProps });
39
+ default:
40
+ return /* @__PURE__ */ jsx(P, { ...pandaJSXProps });
41
+ }
42
+ }
43
+
44
+ export {
45
+ Text
46
+ };
47
+ //# sourceMappingURL=chunk-2ZNIYPDV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Text.tsx"],"sourcesContent":["import {\n Em,\n H1,\n H2,\n H3,\n H4,\n H5,\n H6,\n P,\n Small,\n Span,\n Strong,\n type BoxProps,\n} from '@cerberus-design/styled-system/jsx'\nimport { type PropsWithChildren } from 'react'\n\n/**\n * This module exports a component for rendering text utilizing the styled-system JSX utility.\n * @module @cerberus-design/react/Text\n */\n\nexport type Headings = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\nexport type TextElements = 'p' | 'strong' | 'em' | 'small' | 'span'\n\nexport interface TextProps extends BoxProps {\n /**\n * The element to render as. Defaults to 'p'.\n */\n as?: TextElements | Headings\n}\n\n/**\n * A component for rendering text utilizing the styled-system JSX utility.\n * @definition [Text docs](https://cerberus.digitalu.design/react/text)\n * @example\n * ```tsx\n * <Text as=\"h1\" color=\"page.text.100\" textStyle={{\n * base: 'heading-md',\n * md: 'heading-lg',\n * }}>\n * Hello, world!\n * </Text>\n */\nexport function Text(props: PropsWithChildren<TextProps>) {\n const { as = 'p', ...pandaJSXProps } = props\n switch (as) {\n case 'h1':\n return <H1 {...pandaJSXProps} />\n case 'h2':\n return <H2 {...pandaJSXProps} />\n case 'h3':\n return <H3 {...pandaJSXProps} />\n case 'h4':\n return <H4 {...pandaJSXProps} />\n case 'h5':\n return <H5 {...pandaJSXProps} />\n case 'h6':\n return <H6 {...pandaJSXProps} />\n case 'strong':\n return <Strong {...pandaJSXProps} />\n case 'em':\n return <Em {...pandaJSXProps} />\n case 'small':\n return <Small {...pandaJSXProps} />\n case 'span':\n return <Span {...pandaJSXProps} />\n default:\n return <P {...pandaJSXProps} />\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAkCM;AAJN,SAAS,KAAK,OAAqC;AACxD,QAAM,EAAE,KAAK,KAAK,GAAG,cAAc,IAAI;AACvC,UAAQ,IAAI;AAAA,IACV,KAAK;AACH,aAAO,oBAAC,MAAI,GAAG,eAAe;AAAA,IAChC,KAAK;AACH,aAAO,oBAAC,MAAI,GAAG,eAAe;AAAA,IAChC,KAAK;AACH,aAAO,oBAAC,MAAI,GAAG,eAAe;AAAA,IAChC,KAAK;AACH,aAAO,oBAAC,MAAI,GAAG,eAAe;AAAA,IAChC,KAAK;AACH,aAAO,oBAAC,MAAI,GAAG,eAAe;AAAA,IAChC,KAAK;AACH,aAAO,oBAAC,MAAI,GAAG,eAAe;AAAA,IAChC,KAAK;AACH,aAAO,oBAAC,UAAQ,GAAG,eAAe;AAAA,IACpC,KAAK;AACH,aAAO,oBAAC,MAAI,GAAG,eAAe;AAAA,IAChC,KAAK;AACH,aAAO,oBAAC,SAAO,GAAG,eAAe;AAAA,IACnC,KAAK;AACH,aAAO,oBAAC,QAAM,GAAG,eAAe;AAAA,IAClC;AACE,aAAO,oBAAC,KAAG,GAAG,eAAe;AAAA,EACjC;AACF;","names":[]}
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-JIZQFTW6.js";
4
4
  import {
5
5
  $cerberusIcons
6
- } from "./chunk-VERRHMW4.js";
6
+ } from "./chunk-UBN2CZLV.js";
7
7
 
8
8
  // src/components/Notification.tsx
9
9
  import { cx } from "@cerberus/styled-system/css";
@@ -72,4 +72,4 @@ function Notification(props) {
72
72
  export {
73
73
  Notification
74
74
  };
75
- //# sourceMappingURL=chunk-7SGPJM66.js.map
75
+ //# sourceMappingURL=chunk-35L6DOHE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Notification.tsx"],"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 { $cerberusIcons } from '../config/defineIcons'\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') as\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n const key = `${palette}Notification` as keyof typeof $cerberusIcons\n const Icon = $cerberusIcons[key]\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 const { close: CloseIcon } = $cerberusIcons\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 <CloseIcon />\n </button>\n </dialog>\n )\n}\n"],"mappings":";;;;;;;;AAEA,SAAS,UAAU;AACnB,SAAS,QAAQ,cAAc;AAC/B;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,OAIK;AAiBE,cAuCL,YAvCK;AART,SAAS,sBAAsB,OAAiC;AAC9D,QAAM,UAAW,MAAM,WAAW;AAKlC,QAAM,MAAM,GAAG,OAAO;AACtB,QAAM,OAAO,eAAe,GAAG;AAC/B,SAAO,oBAAC,QAAK;AACf;AA8BO,SAAS,aAAa,OAA6C;AACxE,QAAM,EAAE,UAAU,SAAS,SAAS,GAAG,YAAY,IAAI;AACvD,QAAM,MAAM,OAA0B,IAAI;AAC1C,QAAM,YAAY,UAAU,GAAG;AAC/B,QAAM,SAAS,aAAa,EAAE,QAAQ,CAAC;AACvC,QAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,OAAO;AAAA,UACL,UAAU;AAAA,UACV,KAAK;AAAA,QACP,CAAC;AAAA,QACD,OAAO;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA,4BAAC,UAAK,WAAW,OAAO,MACtB,8BAAC,yBAAsB,SAAkB,GAC3C;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,OAAO;AAAA,cAChB,YAAY;AAAA,cACZ,KAAK;AAAA,cACL,IAAI;AAAA,YACN,CAAC;AAAA,YAEA;AAAA;AAAA,QACH;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,cAAW;AAAA,YACX,WAAW,OAAO;AAAA,YAClB,SAAS;AAAA,YACT,OAAO,MAAM;AAAA,YAEb,8BAAC,aAAU;AAAA;AAAA,QACb;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-BUVVRQLZ.js";
7
7
  import {
8
8
  $cerberusIcons
9
- } from "./chunk-VERRHMW4.js";
9
+ } from "./chunk-UBN2CZLV.js";
10
10
 
11
11
  // src/components/Select.tsx
12
12
  import { cx } from "@cerberus/styled-system/css";
@@ -65,4 +65,4 @@ export {
65
65
  Select,
66
66
  Option
67
67
  };
68
- //# sourceMappingURL=chunk-XL4JREDT.js.map
68
+ //# sourceMappingURL=chunk-3DGV4ESI.js.map
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-2UXE5PDG.js";
16
16
  import {
17
17
  Input
18
- } from "./chunk-NKM6PISB.js";
18
+ } from "./chunk-SVFZJYLV.js";
19
19
  import {
20
20
  Label
21
21
  } from "./chunk-NMF2HYWO.js";
@@ -30,7 +30,7 @@ import {
30
30
  } from "./chunk-KGQG5JGW.js";
31
31
  import {
32
32
  Avatar
33
- } from "./chunk-SPZYPRZ6.js";
33
+ } from "./chunk-C3HYHH3H.js";
34
34
  import {
35
35
  Show
36
36
  } from "./chunk-BUVVRQLZ.js";
@@ -39,7 +39,7 @@ import {
39
39
  } from "./chunk-JIZQFTW6.js";
40
40
  import {
41
41
  $cerberusIcons
42
- } from "./chunk-VERRHMW4.js";
42
+ } from "./chunk-UBN2CZLV.js";
43
43
 
44
44
  // src/context/prompt-modal.tsx
45
45
  import {
@@ -240,4 +240,4 @@ export {
240
240
  PromptModal,
241
241
  usePromptModal
242
242
  };
243
- //# sourceMappingURL=chunk-4QBPJVEN.js.map
243
+ //# sourceMappingURL=chunk-42RVVWGM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/context/prompt-modal.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type MouseEvent,\n type PropsWithChildren,\n} from 'react'\nimport { Portal } from '../components/Portal'\nimport { Button } from '../components/Button'\nimport { css } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\nimport { Input } from '../components/Input'\nimport { Field } from './field'\nimport { Label } from '../components/Label'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { Show } from '../components/Show'\nimport { useModal } from '../hooks/useModal'\nimport { Modal } from '../components/Modal'\nimport { ModalHeader } from '../components/ModalHeader'\nimport { ModalHeading } from '../components/ModalHeading'\nimport { ModalDescription } from '../components/ModalDescription'\nimport { Avatar } from '../components/Avatar'\n\n/**\n * This module provides a context and hook for the prompt modal.\n * @module PromptModal\n */\n\nexport interface ShowPromptModalOptions {\n /**\n * The kind of prompt modal to show.\n * @default 'non-destructive'\n */\n kind?: 'destructive' | 'non-destructive'\n /**\n * The heading of the prompt modal.\n */\n heading: string\n /**\n * The description of the prompt modal.\n */\n description?: string\n /**\n * The key to confirm the action.\n */\n key: string\n /**\n * The text for the action button.\n */\n actionText: string\n /**\n * The text for the cancel button.\n */\n cancelText: string\n}\nexport type PromptShowResult =\n | ((value: string | PromiseLike<string>) => void)\n | null\n\nexport interface PromptModalValue {\n /**\n * The method to trigger the prompt modal.\n * @returns the value of the key if the action is confirmed.\n * @example\n * ```tsx\n * const accepted = await prompt.show({\n * kind: 'destructive',\n * heading: 'Delete channel?',\n * description:\n * 'This will permanently delete a channel on your account. There is no going back.',\n * key: CHANNEL_NAME,\n * actionText: 'Yes, delete channel',\n * cancelText: 'No, cancel',\n * })\n */\n show: (options: ShowPromptModalOptions) => Promise<string>\n}\n\nconst PromptModalContext = createContext<PromptModalValue | null>(null)\n\nexport type PromptModalProviderProps = PropsWithChildren<unknown>\n\n/**\n * Provides a prompt modal to the app.\n * @see https://cerberus.digitalu.design/react/prompt-modal\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <PromptModal>\n * <SomeFeatureSection />\n * </PromptModal>\n *\n * // Use the hook to show the prompt modal.\n * const prompt = usePromptModal()\n *\n * const handleClick = useCallback(async () => {\n * const accepted = await prompt.show({\n * kind: 'destructive',\n * heading: 'Delete channel?',\n * description:\n * 'This will permanently delete a channel on your account. There is no going back.',\n * key: CHANNEL_NAME,\n * actionText: 'Yes, delete channel',\n * cancelText: 'No, cancel',\n * })\n * // do something with accepted\n * }, [prompt])\n * ```\n */\nexport function PromptModal(\n props: PropsWithChildren<PromptModalProviderProps>,\n) {\n const { modalRef, show, close } = useModal()\n const resolveRef = useRef<PromptShowResult>(null)\n const [content, setContent] = useState<ShowPromptModalOptions | null>(null)\n const [inputValue, setInputValue] = useState<string>('')\n const focusTrap = trapFocus(modalRef)\n const PromptIcon = $cerberusIcons.promptModal\n\n const isValid = useMemo(\n () => inputValue === content?.key,\n [inputValue, content],\n )\n\n const palette = useMemo(\n () => (content?.kind === 'destructive' ? 'danger' : 'action'),\n [content],\n )\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setInputValue(e.currentTarget.value)\n },\n [content],\n )\n\n const handleChoice = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n if (target.value === 'true') {\n resolveRef.current?.(inputValue)\n }\n close()\n },\n [inputValue, close],\n )\n\n const handleShow = useCallback(\n (options: ShowPromptModalOptions) => {\n return new Promise<string>((resolve) => {\n setContent({ ...options, kind: options.kind || 'non-destructive' })\n show()\n resolveRef.current = resolve\n })\n },\n [show],\n )\n\n const value = useMemo(\n () => ({\n show: handleShow,\n }),\n [handleShow],\n )\n\n return (\n <PromptModalContext.Provider value={value}>\n {props.children}\n\n <Portal>\n <Modal onKeyDown={focusTrap} ref={modalRef}>\n <ModalHeader>\n <div\n className={hstack({\n justify: 'center',\n w: 'full',\n })}\n >\n <Show\n when={palette === 'danger'}\n fallback={\n <Avatar\n ariaLabel=\"\"\n gradient=\"charon-light\"\n icon={<PromptIcon size={24} />}\n src=\"\"\n />\n }\n >\n <Avatar\n ariaLabel=\"\"\n gradient=\"hades-dark\"\n icon={<PromptIcon size={24} />}\n src=\"\"\n />\n </Show>\n </div>\n <ModalHeading>{content?.heading}</ModalHeading>\n <ModalDescription>{content?.description}</ModalDescription>\n </ModalHeader>\n\n <div\n className={vstack({\n alignItems: 'flex-start',\n mt: '4',\n mb: '8',\n })}\n >\n <Field invalid={!isValid}>\n <Label\n className={css({\n gap: 1,\n justifyContent: 'flex-start',\n })}\n htmlFor=\"confirm\"\n size=\"md\"\n >\n Type\n <strong\n className={css({\n textTransform: 'uppercase',\n })}\n >\n {content?.key}\n </strong>\n to confirm\n </Label>\n <Input\n id=\"confirm\"\n name=\"confirm\"\n onChange={handleChange}\n type=\"text\"\n />\n </Field>\n </div>\n\n <div\n className={hstack({\n justifyContent: 'stretch',\n gap: '4',\n })}\n >\n <Button\n autoFocus\n className={css({\n w: '1/2',\n })}\n disabled={!isValid}\n name=\"confirm\"\n onClick={handleChoice}\n palette={palette}\n value=\"true\"\n >\n {content?.actionText}\n </Button>\n <Button\n className={css({\n w: '1/2',\n })}\n name=\"cancel\"\n onClick={handleChoice}\n usage=\"outlined\"\n value=\"false\"\n >\n {content?.cancelText}\n </Button>\n </div>\n </Modal>\n </Portal>\n </PromptModalContext.Provider>\n )\n}\n\n/**\n * Used to retrieve the context of the PromptModal provider.\n */\nexport function usePromptModal(): PromptModalValue {\n const context = useContext(PromptModalContext)\n if (context === null) {\n throw new Error('usePromptModal must be used within a PromptModal Provider')\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAGP,SAAS,WAAW;AACpB,SAAS,QAAQ,cAAc;AAkKrB,SAagB,KAbhB;AA7FV,IAAM,qBAAqB,cAAuC,IAAI;AA+B/D,SAAS,YACd,OACA;AACA,QAAM,EAAE,UAAU,MAAM,MAAM,IAAI,SAAS;AAC3C,QAAM,aAAa,OAAyB,IAAI;AAChD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAwC,IAAI;AAC1E,QAAM,CAAC,YAAY,aAAa,IAAI,SAAiB,EAAE;AACvD,QAAM,YAAY,UAAU,QAAQ;AACpC,QAAM,aAAa,eAAe;AAElC,QAAM,UAAU;AAAA,IACd,MAAM,eAAe,SAAS;AAAA,IAC9B,CAAC,YAAY,OAAO;AAAA,EACtB;AAEA,QAAM,UAAU;AAAA,IACd,MAAO,SAAS,SAAS,gBAAgB,WAAW;AAAA,IACpD,CAAC,OAAO;AAAA,EACV;AAEA,QAAM,eAAe;AAAA,IACnB,CAAC,MAAqC;AACpC,oBAAc,EAAE,cAAc,KAAK;AAAA,IACrC;AAAA,IACA,CAAC,OAAO;AAAA,EACV;AAEA,QAAM,eAAe;AAAA,IACnB,CAAC,MAAqC;AACpC,YAAM,SAAS,EAAE;AACjB,UAAI,OAAO,UAAU,QAAQ;AAC3B,mBAAW,UAAU,UAAU;AAAA,MACjC;AACA,YAAM;AAAA,IACR;AAAA,IACA,CAAC,YAAY,KAAK;AAAA,EACpB;AAEA,QAAM,aAAa;AAAA,IACjB,CAAC,YAAoC;AACnC,aAAO,IAAI,QAAgB,CAAC,YAAY;AACtC,mBAAW,EAAE,GAAG,SAAS,MAAM,QAA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"./chunk-BUVVRQLZ.js";
7
7
  import {
8
8
  $cerberusIcons
9
- } from "./chunk-VERRHMW4.js";
9
+ } from "./chunk-UBN2CZLV.js";
10
10
 
11
11
  // src/components/Admonition.tsx
12
12
  import {
@@ -135,4 +135,4 @@ export {
135
135
  AdmonitionHeading,
136
136
  AdmonitionDescription
137
137
  };
138
- //# sourceMappingURL=chunk-N4QTLDVM.js.map
138
+ //# sourceMappingURL=chunk-67KLFLNR.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-BUVVRQLZ.js";
4
4
  import {
5
5
  $cerberusIcons
6
- } from "./chunk-VERRHMW4.js";
6
+ } from "./chunk-UBN2CZLV.js";
7
7
 
8
8
  // src/components/Avatar.tsx
9
9
  import { css, cx } from "@cerberus/styled-system/css";
@@ -101,4 +101,4 @@ var iconSizeMap = {
101
101
  export {
102
102
  Avatar
103
103
  };
104
- //# sourceMappingURL=chunk-SPZYPRZ6.js.map
104
+ //# sourceMappingURL=chunk-C3HYHH3H.js.map
@@ -21,7 +21,7 @@ import {
21
21
  } from "./chunk-KGQG5JGW.js";
22
22
  import {
23
23
  Avatar
24
- } from "./chunk-SPZYPRZ6.js";
24
+ } from "./chunk-C3HYHH3H.js";
25
25
  import {
26
26
  Show
27
27
  } from "./chunk-BUVVRQLZ.js";
@@ -30,7 +30,7 @@ import {
30
30
  } from "./chunk-JIZQFTW6.js";
31
31
  import {
32
32
  $cerberusIcons
33
- } from "./chunk-VERRHMW4.js";
33
+ } from "./chunk-UBN2CZLV.js";
34
34
 
35
35
  // src/context/confirm-modal.tsx
36
36
  import {
@@ -170,4 +170,4 @@ export {
170
170
  ConfirmModal,
171
171
  useConfirmModal
172
172
  };
173
- //# sourceMappingURL=chunk-TM5AS6M6.js.map
173
+ //# sourceMappingURL=chunk-CMDPTXHB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/context/confirm-modal.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n type MouseEvent,\n type PropsWithChildren,\n type ReactNode,\n} from 'react'\nimport { Portal } from '../components/Portal'\nimport { Button } from '../components/Button'\nimport { css } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\nimport { Show } from '../components/Show'\nimport { Modal } from '../components/Modal'\nimport { useModal } from '../hooks/useModal'\nimport { ModalHeader } from '../components/ModalHeader'\nimport { ModalHeading } from '../components/ModalHeading'\nimport { ModalDescription } from '../components/ModalDescription'\nimport { Avatar } from '../components/Avatar'\nimport { HStack, VStack } from '@cerberus/styled-system/jsx'\n\n/**\n * This module provides a context and hook for the confirm modal.\n * @module\n */\n\nexport interface BaseConfirmOptions {\n /**\n * The heading of the confirm modal.\n */\n heading: string\n /**\n * The text for the action button.\n */\n actionText: string\n /**\n * The text for the cancel button.\n */\n cancelText: string\n}\n\nexport interface DestructiveConfirmOptions extends BaseConfirmOptions {\n /**\n * The kind of confirm modal to show.\n */\n kind?: 'destructive'\n /**\n * The description of the confirm modal. Can only be a string for destructive confirm modals.\n */\n description?: string\n}\n\nexport interface NonDestructiveConfirmModalOptions extends BaseConfirmOptions {\n /**\n * The kind of confirm modal to show.\n * @default 'non-destructive'\n */\n kind?: 'non-destructive'\n /**\n * The description of the confirm modal. Can be a ReactNode for non-destructive kind if you need to display text links.\n * @example\n * ```tsx\n * description: <>Use a Fragment because we put the content within a Paragraph tag.</>\n */\n description?: ReactNode\n}\n\nexport type ShowConfirmModalOptions =\n | NonDestructiveConfirmModalOptions\n | DestructiveConfirmOptions\n\nexport type ShowResult =\n | ((value: boolean | PromiseLike<boolean>) => void)\n | null\n\nexport interface ConfirmModalValue {\n show: (options: ShowConfirmModalOptions) => Promise<boolean>\n}\n\nconst ConfirmModalContext = createContext<ConfirmModalValue | null>(null)\n\nexport type ConfirmModalProviderProps = PropsWithChildren<unknown>\n\n/**\n * Provides a confirm modal to the app.\n * @see https://cerberus.digitalu.design/react/confirm-modal\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <ConfirmModal>\n * <SomeFeatureSection />\n * </ConfirmModal>\n *\n * // Use the hook to show the confirm modal.\n * const confirm = useConfirmModal()\n *\n * const handleClick = useCallback(async () => {\n * const userConsent = await confirm.show({\n * heading: 'Add new payment method?',\n * description:\n * 'This will add a new payment method to your account to be billed for future purchases.',\n * actionText: 'Yes, add payment method',\n * cancelText: 'No, cancel',\n * })\n * setConsent(userConsent)\n * }, [confirm])\n * ```\n */\nexport function ConfirmModal(\n props: PropsWithChildren<ConfirmModalProviderProps>,\n) {\n const { modalRef, show, close } = useModal()\n const resolveRef = useRef<ShowResult>(null)\n const [content, setContent] = useState<ShowConfirmModalOptions | null>(null)\n const focusTrap = trapFocus(modalRef)\n const ConfirmIcon = $cerberusIcons.confirmModal\n const kind = content?.kind ?? 'non-destructive'\n\n const palette = useMemo(\n () => (kind === 'destructive' ? 'danger' : 'action'),\n [kind],\n )\n\n const handleChoice = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n if (target.value === 'true') {\n resolveRef.current?.(true)\n }\n resolveRef.current?.(false)\n close()\n },\n [close],\n )\n\n const handleShow = useCallback(\n (options: ShowConfirmModalOptions) => {\n return new Promise<boolean>((resolve) => {\n setContent({ ...options })\n show()\n resolveRef.current = resolve\n })\n },\n [show],\n )\n\n const value = useMemo(\n () => ({\n show: handleShow,\n }),\n [handleShow],\n )\n\n return (\n <ConfirmModalContext.Provider value={value}>\n {props.children}\n\n <Portal>\n <Modal onKeyDown={focusTrap} ref={modalRef}>\n <VStack gap=\"xl\" w=\"full\">\n <ModalHeader>\n <div\n className={hstack({\n justify: 'center',\n w: 'full',\n })}\n >\n <Show\n when={palette === 'danger'}\n fallback={\n <Avatar\n ariaLabel=\"\"\n gradient=\"charon-light\"\n icon={<ConfirmIcon size={24} />}\n src=\"\"\n />\n }\n >\n <Avatar\n ariaLabel=\"\"\n gradient=\"hades-dark\"\n icon={<ConfirmIcon size={24} />}\n src=\"\"\n />\n </Show>\n </div>\n <ModalHeading>{content?.heading}</ModalHeading>\n <ModalDescription>{content?.description}</ModalDescription>\n </ModalHeader>\n\n <HStack gap=\"4\" w=\"full\">\n <Button\n autoFocus\n className={css({\n w: '1/2',\n })}\n name=\"confirm\"\n onClick={handleChoice}\n palette={palette}\n value=\"true\"\n >\n {content?.actionText}\n </Button>\n <Button\n className={css({\n w: '1/2',\n })}\n name=\"cancel\"\n onClick={handleChoice}\n usage=\"outlined\"\n value=\"false\"\n >\n {content?.cancelText}\n </Button>\n </HStack>\n </VStack>\n </Modal>\n </Portal>\n </ConfirmModalContext.Provider>\n )\n}\n\nexport function useConfirmModal(): ConfirmModalValue {\n const context = useContext(ConfirmModalContext)\n if (context === null) {\n throw new Error(\n 'useConfirmModal must be used within a ConfirmModal Provider',\n )\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAGP,SAAS,WAAW;AACpB,SAAS,cAAc;AAUvB,SAAS,QAAQ,cAAc;AA6InB,SAagB,KAbhB;AAjFZ,IAAM,sBAAsB,cAAwC,IAAI;AA6BjE,SAAS,aACd,OACA;AACA,QAAM,EAAE,UAAU,MAAM,MAAM,IAAI,SAAS;AAC3C,QAAM,aAAa,OAAmB,IAAI;AAC1C,QAAM,CAAC,SAAS,UAAU,IAAI,SAAyC,IAAI;AAC3E,QAAM,YAAY,UAAU,QAAQ;AACpC,QAAM,cAAc,eAAe;AACnC,QAAM,OAAO,SAAS,QAAQ;AAE9B,QAAM,UAAU;AAAA,IACd,MAAO,SAAS,gBAAgB,WAAW;AAAA,IAC3C,CAAC,IAAI;AAAA,EACP;AAEA,QAAM,eAAe;AAAA,IACnB,CAAC,MAAqC;A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;AAAA,SAC1C;AAAA,MAEA,qBAAC,UAAO,KAAI,KAAI,GAAE,QAChB;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,WAAS;AAAA,YACT,WAAW,IAAI;AAAA,cACb,GAAG;AAAA,YACL,CAAC;AAAA,YACD,MAAK;AAAA,YACL,SAAS;AAAA,YACT;AAAA,YACA,OAAM;AAAA,YAEL,mBAAS;AAAA;AAAA,QACZ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,IAAI;AAAA,cACb,GAAG;AAAA,YACL,CAAC;AAAA,YACD,MAAK;AAAA,YACL,SAAS;AAAA,YACT,OAAM;AAAA,YACN,OAAM;AAAA,YAEL,mBAAS;AAAA;AAAA,QACZ;AAAA,SACF;AAAA,OACF,GACF,GACF;AAAA,KACF;AAEJ;AAEO,SAAS,kBAAqC;AACnD,QAAM,UAAU,WAAW,mBAAmB;AAC9C,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
@@ -39,4 +39,4 @@ export {
39
39
  CheckmarkIcon,
40
40
  IndeterminateIcon
41
41
  };
42
- //# sourceMappingURL=chunk-CP7OUC2Q.js.map
42
+ //# sourceMappingURL=chunk-E3PAEB7Y.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/config/icons/checkbox.icons.tsx"],"sourcesContent":["import type { SVGProps } from 'react'\n\n/**\n * This module contains substitute icons for the Checkbox component.\n * @module\n */\n\nexport type CheckboxIconProps = 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\nexport type IndeterminateIconProps = 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"],"mappings":";AAsBM;AAVC,SAAS,cAAc,OAA0B;AACtD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAY;AAAA,MACZ,OAAM;AAAA,MACN,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACP,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,GAAE;AAAA;AAAA,MACJ;AAAA;AAAA,EACF;AAEJ;AAOO,SAAS,kBAAkB,OAA+B;AAC/D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAY;AAAA,MACZ,OAAM;AAAA,MACN,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACP,GAAG;AAAA,MAEJ,8BAAC,UAAK,MAAK,gBAAe,GAAE,qBAAoB;AAAA;AAAA,EAClD;AAEJ;","names":[]}
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-UZDVOIW5.js";
4
4
  import {
5
5
  $cerberusIcons
6
- } from "./chunk-VERRHMW4.js";
6
+ } from "./chunk-UBN2CZLV.js";
7
7
 
8
8
  // src/components/Toggle.tsx
9
9
  import { cx } from "@cerberus/styled-system/css";
@@ -55,4 +55,4 @@ function Toggle(props) {
55
55
  export {
56
56
  Toggle
57
57
  };
58
- //# sourceMappingURL=chunk-NMNONSHU.js.map
58
+ //# sourceMappingURL=chunk-MRH2EO3L.js.map
@@ -24,7 +24,7 @@ import {
24
24
  } from "./chunk-KGQG5JGW.js";
25
25
  import {
26
26
  Avatar
27
- } from "./chunk-SPZYPRZ6.js";
27
+ } from "./chunk-C3HYHH3H.js";
28
28
  import {
29
29
  Show
30
30
  } from "./chunk-BUVVRQLZ.js";
@@ -33,7 +33,7 @@ import {
33
33
  } from "./chunk-JIZQFTW6.js";
34
34
  import {
35
35
  $cerberusIcons
36
- } from "./chunk-VERRHMW4.js";
36
+ } from "./chunk-UBN2CZLV.js";
37
37
 
38
38
  // src/context/cta-modal.tsx
39
39
  import {
@@ -72,9 +72,8 @@ function CTAModal(props) {
72
72
  (event) => {
73
73
  const index = event.currentTarget.getAttribute("data-index");
74
74
  const action = content?.actions[Number(index)];
75
- if (typeof action?.onClick === "function") {
76
- action.onClick(event);
77
- }
75
+ const { onClick } = action || {};
76
+ onClick?.(event);
78
77
  close();
79
78
  },
80
79
  [content, close]
@@ -152,4 +151,4 @@ export {
152
151
  CTAModal,
153
152
  useCTAModal
154
153
  };
155
- //# sourceMappingURL=chunk-622N7YRT.js.map
154
+ //# sourceMappingURL=chunk-NF5WV3OW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/context/cta-modal.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState,\n type MouseEvent,\n type MouseEventHandler,\n type PropsWithChildren,\n type ReactNode,\n} from 'react'\nimport { Portal } from '../components/Portal'\nimport { Button } from '../components/Button'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\nimport { Show } from '../components/Show'\nimport { Modal } from '../components/Modal'\nimport { useModal } from '../hooks/useModal'\nimport { ModalHeader } from '../components/ModalHeader'\nimport { ModalHeading } from '../components/ModalHeading'\nimport { ModalDescription } from '../components/ModalDescription'\nimport { Avatar } from '../components/Avatar'\nimport { HStack } from '@cerberus/styled-system/jsx'\nimport { IconButton } from '../components/IconButton'\nimport { css } from '@cerberus/styled-system/css'\nimport { VStack } from '@cerberus/styled-system/jsx'\n\n/**\n * This module provides a context and hook for the cta modal.\n * @module\n */\n\nexport interface ShowCTAModalOptions {\n /**\n * The heading of the cta modal.\n */\n heading: string\n /**\n * The description of the cta modal.\n */\n description?: string\n /**\n * The icon used for the modal Avatar.\n */\n icon?: ReactNode\n /**\n * The actions for the cta modal. Max of 2 actions.\n */\n actions: {\n text: string\n onClick: MouseEventHandler<HTMLButtonElement>\n }[]\n}\n\nexport interface CTAModalValue {\n show: (options: ShowCTAModalOptions) => void\n}\n\nconst CTAModalContext = createContext<CTAModalValue | null>(null)\n\nexport type CTAModalProviderProps = PropsWithChildren<unknown>\n\n/**\n * Provides a CTA modal to the app.\n * @see https://cerberus.digitalu.design/react/cta-modal\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <CTAModal>\n * <SomeFeatureSection />\n * </CTAModal>\n *\n * // Use the hook to show the cta modal.\n * const cta = useCTAModal()\n *\n * const handleClick = useCallback(async () => {\n * const userConsent = await cta.show({\n * heading: 'Create or copy a Cohort',\n * description:\n * 'Create a new cohort or copy and existing one.',\n * icon: <Copy size={24} />,\n * actions: [\n * {\n * text: 'Create Cohort',\n * onClick: () => {},\n * {\n * text: 'Copy Cohort',\n * onClick: () => {}\n * }\n * })\n * setConsent(userConsent)\n * }, [cta])\n * ```\n */\nexport function CTAModal(props: PropsWithChildren<CTAModalProviderProps>) {\n const { modalRef, show, close } = useModal()\n const [content, setContent] = useState<ShowCTAModalOptions | null>(null)\n const focusTrap = trapFocus(modalRef)\n const FallbackIcon = $cerberusIcons.confirmModal\n const confirmIcon = content?.icon\n const { close: CloseIcon } = $cerberusIcons\n\n const handleShow = useCallback(\n (options: ShowCTAModalOptions) => {\n const maxActions = 2\n if (options.actions.length > maxActions) {\n throw new Error(\n `CTA Modal only supports a maximum of ${maxActions} actions.`,\n )\n }\n setContent({ ...options })\n show()\n },\n [show],\n )\n\n const handleActionClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n const index = event.currentTarget.getAttribute('data-index')\n const action = content?.actions[Number(index)]\n const { onClick } = action || {}\n onClick?.(event)\n close()\n },\n [content, close],\n )\n\n const value = useMemo(\n () => ({\n show: handleShow,\n }),\n [handleShow],\n )\n\n return (\n <CTAModalContext.Provider value={value}>\n {props.children}\n\n <Portal>\n <Modal onKeyDown={focusTrap} ref={modalRef}>\n <span\n className={css({\n padding: 'md',\n position: 'absolute',\n right: 0,\n top: 0,\n zIndex: 'decorator',\n })}\n >\n <IconButton ariaLabel=\"Close modal\" onClick={close}>\n <CloseIcon />\n </IconButton>\n </span>\n\n <VStack gap=\"xl\" w=\"full\">\n <ModalHeader>\n <VStack gap=\"lg\" w=\"full\">\n <Avatar\n ariaLabel=\"\"\n gradient=\"charon-light\"\n icon={\n <Show\n when={Boolean(confirmIcon)}\n fallback={<FallbackIcon size={24} />}\n >\n {confirmIcon}\n </Show>\n }\n src=\"\"\n />\n <ModalHeading>{content?.heading}</ModalHeading>\n <ModalDescription>{content?.description}</ModalDescription>\n </VStack>\n </ModalHeader>\n\n <HStack gap=\"md\" w=\"full\">\n <Show when={Boolean(content?.actions?.length)}>\n {content?.actions?.map((action, index) => (\n <Button\n data-index={index}\n className={css({\n w: '1/2',\n })}\n key={index}\n onClick={handleActionClick}\n shape=\"rounded\"\n usage=\"outlined\"\n >\n {action.text}\n </Button>\n ))}\n </Show>\n </HStack>\n </VStack>\n </Modal>\n </Portal>\n </CTAModalContext.Provider>\n )\n}\n\nexport function useCTAModal(): CTAModalValue {\n const context = useContext(CTAModalContext)\n if (context === null) {\n throw new Error('useCTAModal must be used within a CTAModal Provider')\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AAYP,SAAS,cAAc;AAEvB,SAAS,WAAW;AACpB,SAAS,cAAc;AA6HT,cAMA,YANA;AA5Fd,IAAM,kBAAkB,cAAoC,IAAI;AAoCzD,SAAS,SAAS,OAAiD;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,GAAE,QACjB;AAAA,4BAAC,eACC,+BAAC,UAAO,KAAI,MAAK,GAAE,QACjB;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,UAAS;AAAA,cACT,MACE;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAM,QAAQ,WAAW;AAAA,kBACzB,UAAU,oBAAC,gBAAa,MAAM,IAAI;AAAA,kBAEjC;AAAA;AAAA,cACH;AAAA,cAEF,KAAI;AAAA;AAAA,UACN;AAAA,UACA,oBAAC,gBAAc,mBAAS,SAAQ;AAAA,UAChC,oBAAC,oBAAkB,mBAAS,aAAY;AAAA,WAC1C,GACF;AAAA,QAEA,oBAAC,UAAO,KAAI,MAAK,GAAE,QACjB,8BAAC,QAAK,MAAM,QAAQ,SAAS,SAAS,MAAM,GACzC,mBAAS,SAAS,IAAI,CAAC,QAAQ,UAC9B;AAAA,UAAC;AAAA;AAAA,YACC,cAAY;AAAA,YACZ,WAAW,IAAI;AAAA,cACb,GAAG;AAAA,YACL,CAAC;AAAA,YAED,SAAS;AAAA,YACT,OAAM;AAAA,YACN,OAAM;AAAA,YAEL,iBAAO;AAAA;AAAA,UALH;AAAA,QAMP,CACD,GACH,GACF;AAAA,SACF;AAAA,OACF,GACF;AAAA,KACF;AAEJ;AAEO,SAAS,cAA6B;AAC3C,QAAM,UAAU,WAAW,eAAe;AAC1C,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AACA,SAAO;AACT;","names":[]}
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Avatar
3
- } from "./chunk-SPZYPRZ6.js";
3
+ } from "./chunk-C3HYHH3H.js";
4
4
  import {
5
5
  Show
6
6
  } from "./chunk-BUVVRQLZ.js";
7
7
  import {
8
8
  $cerberusIcons
9
- } from "./chunk-VERRHMW4.js";
9
+ } from "./chunk-UBN2CZLV.js";
10
10
 
11
11
  // src/components/FileUploader.tsx
12
12
  import { cx } from "@cerberus/styled-system/css";
@@ -72,4 +72,4 @@ function FileUploader(props) {
72
72
  export {
73
73
  FileUploader
74
74
  };
75
- //# sourceMappingURL=chunk-W4DXACNV.js.map
75
+ //# sourceMappingURL=chunk-OFAATLPF.js.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-BUVVRQLZ.js";
7
7
  import {
8
8
  $cerberusIcons
9
- } from "./chunk-VERRHMW4.js";
9
+ } from "./chunk-UBN2CZLV.js";
10
10
 
11
11
  // src/components/Checkbox.tsx
12
12
  import {
@@ -53,4 +53,4 @@ function Checkbox(props) {
53
53
  export {
54
54
  Checkbox
55
55
  };
56
- //# sourceMappingURL=chunk-NB6DV4VA.js.map
56
+ //# sourceMappingURL=chunk-PGXJJDPH.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ProgressBar
3
- } from "./chunk-KCANMM64.js";
3
+ } from "./chunk-WZJ5UQNM.js";
4
4
  import {
5
5
  IconButton
6
6
  } from "./chunk-APD6IX5R.js";
@@ -12,10 +12,10 @@ import {
12
12
  } from "./chunk-UZDVOIW5.js";
13
13
  import {
14
14
  Avatar
15
- } from "./chunk-SPZYPRZ6.js";
15
+ } from "./chunk-C3HYHH3H.js";
16
16
  import {
17
17
  $cerberusIcons
18
- } from "./chunk-VERRHMW4.js";
18
+ } from "./chunk-UBN2CZLV.js";
19
19
 
20
20
  // src/components/FileStatus.tsx
21
21
  import {
@@ -225,4 +225,4 @@ export {
225
225
  processStatus,
226
226
  FileStatus
227
227
  };
228
- //# sourceMappingURL=chunk-7MM5KYEX.js.map
228
+ //# sourceMappingURL=chunk-RET4YOBV.js.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Notification
3
- } from "./chunk-7SGPJM66.js";
3
+ } from "./chunk-35L6DOHE.js";
4
4
  import {
5
5
  NotificationDescription
6
- } from "./chunk-XEW6TJJ4.js";
6
+ } from "./chunk-UXY3KCC3.js";
7
7
  import {
8
8
  NotificationHeading
9
- } from "./chunk-SXIXDXG3.js";
9
+ } from "./chunk-SLHYBPJ5.js";
10
10
  import {
11
11
  Portal
12
12
  } from "./chunk-IQJDVFPP.js";
@@ -159,4 +159,4 @@ export {
159
159
  NotificationCenter,
160
160
  useNotificationCenter
161
161
  };
162
- //# sourceMappingURL=chunk-C3CDRCHS.js.map
162
+ //# sourceMappingURL=chunk-RHHFH6JJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/context/notification-center.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState,\n type MouseEvent,\n type PropsWithChildren,\n type ReactNode,\n} from 'react'\nimport { Show } from '../components/Show'\nimport { NotificationHeading } from '../components/NotificationHeading'\nimport { NotificationDescription } from '../components/NotificationDescription'\nimport { Notification } from '../components/Notification'\nimport { animateIn, vstack } from '@cerberus/styled-system/patterns'\nimport { Portal, type PortalProps } from '../components/Portal'\nimport { notification } from '@cerberus/styled-system/recipes'\nimport { Button } from '../components/Button'\nimport { cx } from '@cerberus/styled-system/css'\n\n/**\n * This module provides a context and hook for notifications.\n * @module\n */\n\nexport interface NotifyOptions {\n /**\n * The palette of the notification.\n * @default 'info'\n */\n palette: 'info' | 'success' | 'warning' | 'danger'\n /**\n * The heading of the notification.\n */\n heading: string\n /**\n * The unique id of the notification.\n */\n id?: string\n /**\n * The description of the notification.\n */\n description?: ReactNode\n /**\n * The action to take when the notification is closed\n */\n onClose?: () => void\n}\n\nexport interface NotificationsValue {\n notify: (options: NotifyOptions) => void\n}\n\nconst NotificationsContext = createContext<NotificationsValue | null>(null)\n\nexport type NotificationsProviderProps = PortalProps\n\n/**\n * Provides a notification center to the app.\n * @see https://cerberus.digitalu.design/react/notification\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <Notifications>\n * <SomeFeatureSection />\n * </Notifications>\n *\n * // Use the hook to show a notification.\n * const notify = useNotifications()\n *\n * const handleClick = useCallback(() => {\n * notify({\n * palette: 'info',\n * heading: 'New feature!',\n * description: 'We have added a new feature to the app.',\n * })\n * }, [notify])\n * ```\n */\nexport function NotificationCenter(\n props: PropsWithChildren<NotificationsProviderProps>,\n) {\n const [activeNotifications, setActiveNotifications] = useState<\n NotifyOptions[]\n >([])\n const styles = notification()\n\n const handleNotify = useCallback((options: NotifyOptions) => {\n setActiveNotifications((prev) => {\n const id = `${options.palette}:${prev.length + 1}`\n return [...prev, { ...options, id }]\n })\n }, [])\n\n const handleClose = useCallback((e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n setActiveNotifications((prev) => {\n const item = prev.find((option) => option.id === target.value)\n if (item?.onClose) item.onClose()\n return prev.filter((option) => option.id !== target.value)\n })\n }, [])\n\n const handleCloseAll = useCallback(() => {\n setActiveNotifications((prev) => {\n prev.forEach((item) => {\n if (item.onClose) item.onClose()\n })\n return []\n })\n }, [])\n\n const value = useMemo(\n () => ({\n notify: handleNotify,\n }),\n [handleNotify],\n )\n\n // For some reason, the vstack pattern alignItems is not registering here.\n // So we are forcing it with the style prop.\n\n return (\n <NotificationsContext.Provider value={value}>\n {props.children}\n\n <Show when={activeNotifications.length > 0}>\n <Portal container={props.container}>\n <div className={styles.center}>\n <Show when={activeNotifications.length >= 4}>\n <Button\n className={cx(styles.closeAll, animateIn())}\n onClick={handleCloseAll}\n palette=\"action\"\n shape=\"rounded\"\n size=\"sm\"\n usage=\"ghost\"\n >\n Close all\n </Button>\n </Show>\n\n <div\n className={vstack({\n alignItems: 'flex-end',\n gap: '4',\n })}\n style={{\n alignItems: 'flex-end',\n }}\n >\n {activeNotifications.map((option) => (\n <MatchNotification\n key={option.id}\n {...option}\n onClose={handleClose}\n />\n ))}\n </div>\n </div>\n </Portal>\n </Show>\n </NotificationsContext.Provider>\n )\n}\n\ninterface MatchNotificationProps extends Omit<NotifyOptions, 'onClose'> {\n onClose: (e: MouseEvent<HTMLButtonElement>) => void\n key: string | undefined\n}\n\nfunction MatchNotification(props: MatchNotificationProps) {\n const { palette, id, onClose, heading, description } = props\n\n switch (palette) {\n case 'success':\n return (\n <Notification\n id={id!}\n key={id}\n onClose={onClose}\n open\n palette=\"success\"\n >\n <NotificationHeading palette=\"success\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"success\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n\n case 'warning':\n return (\n <Notification\n id={id!}\n key={id}\n onClose={onClose}\n open\n palette=\"warning\"\n >\n <NotificationHeading palette=\"warning\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"warning\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n\n case 'danger':\n return (\n <Notification id={id!} key={id} onClose={onClose} open palette=\"danger\">\n <NotificationHeading palette=\"danger\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"danger\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n\n case 'info':\n default:\n return (\n <Notification id={id!} key={id} onClose={onClose} open palette=\"info\">\n <NotificationHeading palette=\"info\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"info\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n }\n}\n\n/**\n * The hook to use the NotificationCenter.\n * @returns The notify method to trigger a notification.\n * @example\n * ```tsx\n * const {notify} = useNotificationCenter()\n * notify({\n * palette: 'info',\n * heading: 'New feature',\n * description: 'We have added a new feature to the app.',\n * })\n * ```\n */\nexport function useNotificationCenter(): NotificationsValue {\n const context = useContext(NotificationsContext)\n if (!context) {\n throw new Error(\n 'useNotificationCenter must be used within a NotificationsProvider',\n )\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAKP,SAAS,WAAW,cAAc;AAElC,SAAS,oBAAoB;AAE7B,SAAS,UAAU;AA8GT,SAEI,KAFJ;AA3EV,IAAM,uBAAuB,cAAyC,IAAI;AA0BnE,SAAS,mBACd,OACA;AACA,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAEpD,CAAC,CAAC;AACJ,QAAM,SAAS,aA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,QAC7D;AAAA,4BAAC,uBAAoB,SAAQ,QAAQ,mBAAQ;AAAA,QAC7C,oBAAC,2BAAwB,SAAQ,QAC9B,uBACH;AAAA,WAJ0B,EAK5B;AAAA,EAEN;AACF;AAeO,SAAS,wBAA4C;AAC1D,QAAM,UAAU,WAAW,oBAAoB;AAC/C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
@@ -13,4 +13,4 @@ function NotificationHeading(props) {
13
13
  export {
14
14
  NotificationHeading
15
15
  };
16
- //# sourceMappingURL=chunk-SXIXDXG3.js.map
16
+ //# sourceMappingURL=chunk-SLHYBPJ5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/NotificationHeading.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module exports the NotificationHeading component.\n * @module\n */\n\nexport type BaseNotificationHeadingProps = HTMLAttributes<HTMLParagraphElement>\nexport type NotificationHeadingProps = BaseNotificationHeadingProps &\n NotificationVariantProps\n\n/**\n * Used to render the heading of a notification.\n * @see https://cerberus.digitalu.design/react/notification\n * @memberof module:NotificationCenter\n * @param props - The anything a HTMLParagraphElement can accept.\n */\nexport function NotificationHeading(props: NotificationHeadingProps) {\n const { palette, ...nativeProps } = props\n const styles = notification({ palette })\n return (\n <p className={cx(nativeProps.className, styles.heading)} {...nativeProps} />\n )\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,OAEK;AAsBH;AAJG,SAAS,oBAAoB,OAAiC;AACnE,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI;AACpC,QAAM,SAAS,aAAa,EAAE,QAAQ,CAAC;AACvC,SACE,oBAAC,OAAE,WAAW,GAAG,YAAY,WAAW,OAAO,OAAO,GAAI,GAAG,aAAa;AAE9E;","names":[]}