@cerberus-design/react 0.7.4-next-d474a8b → 0.7.4-next-a99660f

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 (98) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.ts +140 -1
  2. package/build/legacy/{chunk-NWMNEJGU.js → chunk-3C2DJSEE.js} +3 -3
  3. package/build/legacy/chunk-3C2DJSEE.js.map +1 -0
  4. package/build/legacy/chunk-A5WYZVUR.js +28 -0
  5. package/build/legacy/chunk-A5WYZVUR.js.map +1 -0
  6. package/build/legacy/{chunk-SINTHADQ.js → chunk-HW76XVA3.js} +3 -3
  7. package/build/legacy/chunk-HW76XVA3.js.map +1 -0
  8. package/build/legacy/chunk-KFJKK2WX.js +13 -0
  9. package/build/legacy/chunk-KFJKK2WX.js.map +1 -0
  10. package/build/legacy/{chunk-BYDTAFCU.js → chunk-LF2QFS5S.js} +4 -4
  11. package/build/legacy/chunk-LF2QFS5S.js.map +1 -0
  12. package/build/legacy/chunk-N3FUF4TB.js +12 -0
  13. package/build/legacy/chunk-N3FUF4TB.js.map +1 -0
  14. package/build/legacy/chunk-PJ3744I6.js +24 -0
  15. package/build/legacy/chunk-PJ3744I6.js.map +1 -0
  16. package/build/legacy/{chunk-X5JR5LSC.js → chunk-SMCEFK6Q.js} +4 -4
  17. package/build/legacy/chunk-SMCEFK6Q.js.map +1 -0
  18. package/build/legacy/chunk-XREC5IJE.js +24 -0
  19. package/build/legacy/chunk-XREC5IJE.js.map +1 -0
  20. package/build/legacy/{chunk-I5FPKT7H.js → chunk-XRED74C2.js} +7 -7
  21. package/build/legacy/chunk-XRED74C2.js.map +1 -0
  22. package/build/legacy/components/FileUploader.js +1 -1
  23. package/build/legacy/components/Notification.js +1 -1
  24. package/build/legacy/components/NotificationDescription.js +1 -1
  25. package/build/legacy/components/NotificationHeading.js +1 -1
  26. package/build/legacy/components/Table.js +9 -0
  27. package/build/legacy/components/Table.js.map +1 -0
  28. package/build/legacy/components/Tbody.js +7 -0
  29. package/build/legacy/components/Tbody.js.map +1 -0
  30. package/build/legacy/components/Td.js +7 -0
  31. package/build/legacy/components/Td.js.map +1 -0
  32. package/build/legacy/components/Th.js +7 -0
  33. package/build/legacy/components/Th.js.map +1 -0
  34. package/build/legacy/components/Thead.js +7 -0
  35. package/build/legacy/components/Thead.js.map +1 -0
  36. package/build/legacy/context/notification-center.js +4 -4
  37. package/build/legacy/index.js +37 -15
  38. package/build/legacy/index.js.map +1 -1
  39. package/build/modern/_tsup-dts-rollup.d.ts +140 -1
  40. package/build/modern/{chunk-NWMNEJGU.js → chunk-3C2DJSEE.js} +3 -3
  41. package/build/modern/chunk-3C2DJSEE.js.map +1 -0
  42. package/build/modern/{chunk-U5QWMMKZ.js → chunk-4N2L357B.js} +4 -4
  43. package/build/modern/chunk-4N2L357B.js.map +1 -0
  44. package/build/modern/chunk-A5WYZVUR.js +28 -0
  45. package/build/modern/chunk-A5WYZVUR.js.map +1 -0
  46. package/build/modern/{chunk-SINTHADQ.js → chunk-HW76XVA3.js} +3 -3
  47. package/build/modern/chunk-HW76XVA3.js.map +1 -0
  48. package/build/modern/{chunk-3YORUZIQ.js → chunk-IOG6XIR5.js} +4 -4
  49. package/build/modern/chunk-IOG6XIR5.js.map +1 -0
  50. package/build/modern/chunk-KFJKK2WX.js +13 -0
  51. package/build/modern/chunk-KFJKK2WX.js.map +1 -0
  52. package/build/modern/chunk-N3FUF4TB.js +12 -0
  53. package/build/modern/chunk-N3FUF4TB.js.map +1 -0
  54. package/build/modern/chunk-PJ3744I6.js +24 -0
  55. package/build/modern/chunk-PJ3744I6.js.map +1 -0
  56. package/build/modern/{chunk-NZWANWYC.js → chunk-UE5DPEKB.js} +7 -7
  57. package/build/modern/chunk-UE5DPEKB.js.map +1 -0
  58. package/build/modern/chunk-XREC5IJE.js +24 -0
  59. package/build/modern/chunk-XREC5IJE.js.map +1 -0
  60. package/build/modern/components/FileUploader.js +1 -1
  61. package/build/modern/components/Notification.js +1 -1
  62. package/build/modern/components/NotificationDescription.js +1 -1
  63. package/build/modern/components/NotificationHeading.js +1 -1
  64. package/build/modern/components/Table.js +9 -0
  65. package/build/modern/components/Table.js.map +1 -0
  66. package/build/modern/components/Tbody.js +7 -0
  67. package/build/modern/components/Tbody.js.map +1 -0
  68. package/build/modern/components/Td.js +7 -0
  69. package/build/modern/components/Td.js.map +1 -0
  70. package/build/modern/components/Th.js +7 -0
  71. package/build/modern/components/Th.js.map +1 -0
  72. package/build/modern/components/Thead.js +7 -0
  73. package/build/modern/components/Thead.js.map +1 -0
  74. package/build/modern/context/notification-center.js +4 -4
  75. package/build/modern/index.js +37 -15
  76. package/build/modern/index.js.map +1 -1
  77. package/package.json +2 -2
  78. package/src/components/FileUploader.tsx +3 -3
  79. package/src/components/Notification.tsx +3 -3
  80. package/src/components/NotificationDescription.tsx +2 -2
  81. package/src/components/NotificationHeading.tsx +2 -2
  82. package/src/components/Table.tsx +58 -0
  83. package/src/components/Tbody.tsx +31 -0
  84. package/src/components/Td.tsx +34 -0
  85. package/src/components/Th.tsx +26 -0
  86. package/src/components/Thead.tsx +24 -0
  87. package/src/context/notification-center.tsx +3 -3
  88. package/src/index.ts +5 -0
  89. package/build/legacy/chunk-BYDTAFCU.js.map +0 -1
  90. package/build/legacy/chunk-I5FPKT7H.js.map +0 -1
  91. package/build/legacy/chunk-NWMNEJGU.js.map +0 -1
  92. package/build/legacy/chunk-SINTHADQ.js.map +0 -1
  93. package/build/legacy/chunk-X5JR5LSC.js.map +0 -1
  94. package/build/modern/chunk-3YORUZIQ.js.map +0 -1
  95. package/build/modern/chunk-NWMNEJGU.js.map +0 -1
  96. package/build/modern/chunk-NZWANWYC.js.map +0 -1
  97. package/build/modern/chunk-SINTHADQ.js.map +0 -1
  98. package/build/modern/chunk-U5QWMMKZ.js.map +0 -1
@@ -0,0 +1,9 @@
1
+ import {
2
+ Table,
3
+ Tr
4
+ } from "../chunk-A5WYZVUR.js";
5
+ export {
6
+ Table,
7
+ Tr
8
+ };
9
+ //# sourceMappingURL=Table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ Tbody
3
+ } from "../chunk-PJ3744I6.js";
4
+ export {
5
+ Tbody
6
+ };
7
+ //# sourceMappingURL=Tbody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ Td
3
+ } from "../chunk-XREC5IJE.js";
4
+ export {
5
+ Td
6
+ };
7
+ //# sourceMappingURL=Td.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ Th
3
+ } from "../chunk-KFJKK2WX.js";
4
+ export {
5
+ Th
6
+ };
7
+ //# sourceMappingURL=Th.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ Thead
3
+ } from "../chunk-N3FUF4TB.js";
4
+ export {
5
+ Thead
6
+ };
7
+ //# sourceMappingURL=Thead.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  NotificationCenter,
4
4
  useNotificationCenter
5
- } from "../chunk-NZWANWYC.js";
6
- import "../chunk-U5QWMMKZ.js";
7
- import "../chunk-SINTHADQ.js";
8
- import "../chunk-NWMNEJGU.js";
5
+ } from "../chunk-UE5DPEKB.js";
6
+ import "../chunk-4N2L357B.js";
7
+ import "../chunk-HW76XVA3.js";
8
+ import "../chunk-3C2DJSEE.js";
9
9
  import "../chunk-4CAT3FHV.js";
10
10
  import "../chunk-2ATICEW3.js";
11
11
  import "../chunk-4O4QFF4S.js";
@@ -1,11 +1,24 @@
1
- import {
2
- NotificationCenter,
3
- useNotificationCenter
4
- } from "./chunk-NZWANWYC.js";
5
1
  import {
6
2
  PromptModal,
7
3
  usePromptModal
8
4
  } from "./chunk-BMQ7I2PL.js";
5
+ import {
6
+ Th
7
+ } from "./chunk-KFJKK2WX.js";
8
+ import {
9
+ Thead
10
+ } from "./chunk-N3FUF4TB.js";
11
+ import {
12
+ Toggle
13
+ } from "./chunk-IL5ELPTT.js";
14
+ import {
15
+ ConfirmModal,
16
+ useConfirmModal
17
+ } from "./chunk-ZPWSMCZ5.js";
18
+ import {
19
+ NotificationCenter,
20
+ useNotificationCenter
21
+ } from "./chunk-UE5DPEKB.js";
9
22
  import {
10
23
  Tab
11
24
  } from "./chunk-SONHHNYQ.js";
@@ -15,19 +28,22 @@ import {
15
28
  import {
16
29
  TabPanel
17
30
  } from "./chunk-U72VPIZA.js";
31
+ import {
32
+ Table,
33
+ Tr
34
+ } from "./chunk-A5WYZVUR.js";
18
35
  import {
19
36
  Tag
20
37
  } from "./chunk-Z6IWNVPN.js";
21
38
  import {
22
- Textarea
23
- } from "./chunk-TCO46FK7.js";
39
+ Tbody
40
+ } from "./chunk-PJ3744I6.js";
24
41
  import {
25
- Toggle
26
- } from "./chunk-IL5ELPTT.js";
42
+ Td
43
+ } from "./chunk-XREC5IJE.js";
27
44
  import {
28
- ConfirmModal,
29
- useConfirmModal
30
- } from "./chunk-ZPWSMCZ5.js";
45
+ Textarea
46
+ } from "./chunk-TCO46FK7.js";
31
47
  import {
32
48
  NavMenuList,
33
49
  getPosition
@@ -41,13 +57,13 @@ import {
41
57
  } from "./chunk-KJUCHZHV.js";
42
58
  import {
43
59
  Notification
44
- } from "./chunk-U5QWMMKZ.js";
60
+ } from "./chunk-4N2L357B.js";
45
61
  import {
46
62
  NotificationDescription
47
- } from "./chunk-SINTHADQ.js";
63
+ } from "./chunk-HW76XVA3.js";
48
64
  import {
49
65
  NotificationHeading
50
- } from "./chunk-NWMNEJGU.js";
66
+ } from "./chunk-3C2DJSEE.js";
51
67
  import {
52
68
  Portal
53
69
  } from "./chunk-4CAT3FHV.js";
@@ -110,7 +126,7 @@ import {
110
126
  } from "./chunk-ZAU4JVLL.js";
111
127
  import {
112
128
  FileUploader
113
- } from "./chunk-3YORUZIQ.js";
129
+ } from "./chunk-IOG6XIR5.js";
114
130
  import {
115
131
  Show
116
132
  } from "./chunk-4O4QFF4S.js";
@@ -178,12 +194,18 @@ export {
178
194
  Tab,
179
195
  TabList,
180
196
  TabPanel,
197
+ Table,
181
198
  Tabs,
182
199
  TabsContext,
183
200
  Tag,
201
+ Tbody,
202
+ Td,
184
203
  Textarea,
204
+ Th,
205
+ Thead,
185
206
  ThemeProvider,
186
207
  Toggle,
208
+ Tr,
187
209
  createNavTriggerProps,
188
210
  defineIcons,
189
211
  getPosition,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// components\n\nexport * from './components/Button'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\nexport * from './components/ModalIcon'\nexport * from './components/NavMenuTrigger'\nexport * from './components/NavMenuList'\nexport * from './components/NavMenuLink'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/Radio'\nexport * from './components/Tab'\nexport * from './components/TabList'\nexport * from './components/TabPanel'\nexport * from './components/Tag'\nexport * from './components/Textarea'\nexport * from './components/Toggle'\nexport * from './components/Show'\n\n// context\n\nexport * from './context/confirm-modal'\nexport * from './context/feature-flags'\nexport * from './context/field'\nexport * from './context/navMenu'\nexport * from './context/notification-center'\nexport * from './context/prompt-modal'\nexport * from './context/tabs'\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useModal'\nexport * from './hooks/useTheme'\nexport * from './hooks/useToggle'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/tabs.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/defineIcons'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// components\n\nexport * from './components/Button'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\nexport * from './components/ModalIcon'\nexport * from './components/NavMenuTrigger'\nexport * from './components/NavMenuList'\nexport * from './components/NavMenuLink'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/Radio'\nexport * from './components/Tab'\nexport * from './components/TabList'\nexport * from './components/TabPanel'\nexport * from './components/Table'\nexport * from './components/Thead'\nexport * from './components/Th'\nexport * from './components/Td'\nexport * from './components/Tbody'\nexport * from './components/Tag'\nexport * from './components/Textarea'\nexport * from './components/Toggle'\nexport * from './components/Show'\n\n// context\n\nexport * from './context/confirm-modal'\nexport * from './context/feature-flags'\nexport * from './context/field'\nexport * from './context/navMenu'\nexport * from './context/notification-center'\nexport * from './context/prompt-modal'\nexport * from './context/tabs'\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useModal'\nexport * from './hooks/useTheme'\nexport * from './hooks/useToggle'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/tabs.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/defineIcons'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EA,cAAc;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerberus-design/react",
3
- "version": "0.7.4-next-d474a8b",
3
+ "version": "0.7.4-next-a99660f",
4
4
  "description": "The Cerberus Design React component library.",
5
5
  "browserslist": "> 0.25%, not dead",
6
6
  "sideEffects": false,
@@ -26,7 +26,7 @@
26
26
  "react-dom": "^18",
27
27
  "tsup": "^8.1.0",
28
28
  "@cerberus-design/configs": "0.0.0",
29
- "@cerberus-design/styled-system": "0.7.4-next-d474a8b"
29
+ "@cerberus-design/styled-system": "0.7.4-next-a99660f"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"
@@ -1,10 +1,10 @@
1
1
  'use client'
2
2
 
3
- import { cx } from '@cerberus-design/styled-system/css'
4
- import { circle, vstack } from '@cerberus-design/styled-system/patterns'
3
+ import { cx } from '@cerberus/styled-system/css'
4
+ import { circle, vstack } from '@cerberus/styled-system/patterns'
5
5
  import { type InputHTMLAttributes } from 'react'
6
6
  import { Show } from './Show'
7
- import { fileUploader, modalIcon } from '@cerberus-design/styled-system/recipes'
7
+ import { fileUploader, modalIcon } from '@cerberus/styled-system/recipes'
8
8
  import { $cerberusIcons } from '../config/defineIcons'
9
9
 
10
10
  export interface FileUploaderProps
@@ -1,11 +1,11 @@
1
1
  'use client'
2
2
 
3
- import { cx } from '@cerberus-design/styled-system/css'
4
- import { hstack, vstack } from '@cerberus-design/styled-system/patterns'
3
+ import { cx } from '@cerberus/styled-system/css'
4
+ import { hstack, vstack } from '@cerberus/styled-system/patterns'
5
5
  import {
6
6
  notification,
7
7
  type NotificationVariantProps,
8
- } from '@cerberus-design/styled-system/recipes'
8
+ } from '@cerberus/styled-system/recipes'
9
9
  import {
10
10
  useRef,
11
11
  type DialogHTMLAttributes,
@@ -3,11 +3,11 @@
3
3
  * @module
4
4
  */
5
5
 
6
- import { cx } from '@cerberus-design/styled-system/css'
6
+ import { cx } from '@cerberus/styled-system/css'
7
7
  import {
8
8
  notification,
9
9
  type NotificationVariantProps,
10
- } from '@cerberus-design/styled-system/recipes'
10
+ } from '@cerberus/styled-system/recipes'
11
11
  import type { HTMLAttributes } from 'react'
12
12
 
13
13
  export interface BaseNotificationDescriptionProps
@@ -3,11 +3,11 @@
3
3
  * @module
4
4
  */
5
5
 
6
- import { cx } from '@cerberus-design/styled-system/css'
6
+ import { cx } from '@cerberus/styled-system/css'
7
7
  import {
8
8
  notification,
9
9
  type NotificationVariantProps,
10
- } from '@cerberus-design/styled-system/recipes'
10
+ } from '@cerberus/styled-system/recipes'
11
11
  import type { HTMLAttributes } from 'react'
12
12
 
13
13
  export interface BaseNotificationHeadingProps
@@ -0,0 +1,58 @@
1
+ import { cx } from '@cerberus/styled-system/css'
2
+ import { table } from '@cerberus/styled-system/recipes'
3
+ import type { PropsWithChildren, TableHTMLAttributes } from 'react'
4
+
5
+ /**
6
+ * This module contains the table component.
7
+ * @module
8
+ */
9
+
10
+ export interface TableProps extends TableHTMLAttributes<HTMLTableElement> {
11
+ caption: string
12
+ }
13
+
14
+ /**
15
+ * The Table component is used to render a table.
16
+ * @definition [Table docs](https://cerberus.digitalu.design/react/table)
17
+ * @prop caption - An easy to understand description of the table.
18
+ * @example
19
+ * ```tsx
20
+ * <Table caption="Basic Table">
21
+ * {children}
22
+ * </Table>
23
+ * ```
24
+ */
25
+ export function Table(props: PropsWithChildren<TableProps>) {
26
+ const { caption, children, ...nativeProps } = props
27
+ const styles = table()
28
+
29
+ return (
30
+ <div className={styles.container}>
31
+ <table
32
+ {...nativeProps}
33
+ className={cx(nativeProps.className, styles.table)}
34
+ >
35
+ <caption className={styles.caption}>{caption}</caption>
36
+ {children}
37
+ </table>
38
+ </div>
39
+ )
40
+ }
41
+
42
+ // We only provide this for consistency with the rest of the components
43
+
44
+ export type TrProps = TableHTMLAttributes<HTMLTableRowElement>
45
+
46
+ /**
47
+ * The Tr component is used to render a table row.
48
+ * @definition [Table docs](https://cerberus.digitalu.design/react/table)
49
+ * @example
50
+ * ```tsx
51
+ * <Tr>
52
+ * {children}
53
+ * </Tr>
54
+ * ```
55
+ */
56
+ export function Tr(props: PropsWithChildren<TrProps>) {
57
+ return <tr {...props} />
58
+ }
@@ -0,0 +1,31 @@
1
+ import { tbody, type TbodyVariantProps } from '@cerberus/styled-system/recipes'
2
+ import { cx } from '@cerberus/styled-system/css'
3
+ import type { TableHTMLAttributes } from 'react'
4
+
5
+ export type TbodyBaseProps = TableHTMLAttributes<HTMLTableSectionElement>
6
+ export type TbodyProps = TbodyBaseProps & TbodyVariantProps
7
+
8
+ /**
9
+ * The TBody component is used to render a table body.
10
+ * @definition [Table docs](https://cerberus.digitalu.design/react/table)
11
+ * @example
12
+ * ```tsx
13
+ * <TBody>
14
+ * {children}
15
+ * </TBody>
16
+ * ```
17
+ */
18
+ export function Tbody(props: TbodyProps) {
19
+ const { decoration, ...nativeProps } = props
20
+ return (
21
+ <tbody
22
+ {...nativeProps}
23
+ className={cx(
24
+ nativeProps.className,
25
+ tbody({
26
+ decoration,
27
+ }),
28
+ )}
29
+ />
30
+ )
31
+ }
@@ -0,0 +1,34 @@
1
+ import { cx } from '@cerberus/styled-system/css'
2
+ import { td, type TdVariantProps } from '@cerberus/styled-system/recipes'
3
+ import type { TableHTMLAttributes } from 'react'
4
+
5
+ /**
6
+ * Th component for the Td component
7
+ * @module
8
+ */
9
+
10
+ export type TdBaseProps = TableHTMLAttributes<HTMLTableCellElement>
11
+ export type TdProps = TdBaseProps & TdVariantProps
12
+
13
+ /**
14
+ * Styles for the Th component
15
+ * @definition [Table docs](https://cerberus.digitalu.design/react/table)
16
+ * @example
17
+ * ```tsx
18
+ * <Td>Data cell</Td>
19
+ * ```
20
+ */
21
+ export function Td(props: TdProps) {
22
+ const { size, ...nativeProps } = props
23
+ return (
24
+ <td
25
+ {...nativeProps}
26
+ className={cx(
27
+ nativeProps.className,
28
+ td({
29
+ size,
30
+ }),
31
+ )}
32
+ />
33
+ )
34
+ }
@@ -0,0 +1,26 @@
1
+ import { cx } from '@cerberus/styled-system/css'
2
+ import { th, type ThVariantProps } from '@cerberus/styled-system/recipes'
3
+ import type { TableHTMLAttributes } from 'react'
4
+
5
+ /**
6
+ * Th component for the Table component
7
+ * @module
8
+ */
9
+
10
+ export type ThBaseProps = TableHTMLAttributes<HTMLTableCellElement>
11
+ export type ThProps = ThBaseProps & ThVariantProps
12
+
13
+ /**
14
+ * Styles for the Th component
15
+ * @definition [Table docs](https://cerberus.digitalu.design/react/table)
16
+ * @example
17
+ * ```tsx
18
+ * <Th>Header 1</Th>
19
+ * ```
20
+ */
21
+ export function Th(props: ThProps) {
22
+ const { size, ...nativeProps } = props
23
+ return (
24
+ <th {...nativeProps} className={cx(nativeProps.className, th({ size }))} />
25
+ )
26
+ }
@@ -0,0 +1,24 @@
1
+ import { cx } from '@cerberus/styled-system/css'
2
+ import { thead } from '@cerberus/styled-system/recipes'
3
+ import type { TableHTMLAttributes } from 'react'
4
+
5
+ /**
6
+ * This module contains the Thead component.
7
+ * @module
8
+ */
9
+
10
+ export type TheadProps = TableHTMLAttributes<HTMLTableSectionElement>
11
+
12
+ /**
13
+ * The Thead component is used to render a table header.
14
+ * @definition [Table docs](https://cerberus.digitalu.design/react/table)
15
+ * @example
16
+ * ```tsx
17
+ * <Thead>
18
+ * {children}
19
+ * </Thead>
20
+ * ```
21
+ */
22
+ export function Thead(props: TheadProps) {
23
+ return <thead {...props} className={cx(props.className, thead())} />
24
+ }
@@ -14,11 +14,11 @@ import { Show } from '../components/Show'
14
14
  import { NotificationHeading } from '../components/NotificationHeading'
15
15
  import { NotificationDescription } from '../components/NotificationDescription'
16
16
  import { Notification } from '../components/Notification'
17
- import { animateIn, vstack } from '@cerberus-design/styled-system/patterns'
17
+ import { animateIn, vstack } from '@cerberus/styled-system/patterns'
18
18
  import { Portal, type PortalProps } from '../components/Portal'
19
- import { notification } from '@cerberus-design/styled-system/recipes'
19
+ import { notification } from '@cerberus/styled-system/recipes'
20
20
  import { Button } from '../components/Button'
21
- import { cx } from '@cerberus-design/styled-system/css'
21
+ import { cx } from '@cerberus/styled-system/css'
22
22
 
23
23
  /**
24
24
  * This module provides a context and hook for notifications.
package/src/index.ts CHANGED
@@ -29,6 +29,11 @@ export * from './components/Radio'
29
29
  export * from './components/Tab'
30
30
  export * from './components/TabList'
31
31
  export * from './components/TabPanel'
32
+ export * from './components/Table'
33
+ export * from './components/Thead'
34
+ export * from './components/Th'
35
+ export * from './components/Td'
36
+ export * from './components/Tbody'
32
37
  export * from './components/Tag'
33
38
  export * from './components/Textarea'
34
39
  export * from './components/Toggle'
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Notification.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus-design/styled-system/css'\nimport { hstack, vstack } from '@cerberus-design/styled-system/patterns'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus-design/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 id: string\n onClose?: (e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type NotificationProps = NotificationBaseProps & NotificationVariantProps\n\n/**\n * The info notification component.\n * @param props - The component props.\n * @returns The info notification component.\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 role=\"alert\"\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"],"mappings":";;;;;;;;AAEA,SAAS,UAAU;AACnB,SAAS,QAAQ,cAAc;AAC/B;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,OAIK;AACP,SAAS,aAAa;AAcb,cA+BL,YA/BK;AAJT,SAAS,sBAAsB,OAAiC;AAC9D,QAAM,UAAU,MAAM,WAAW;AACjC,QAAM,MAAM,GAAG,OAAO;AACtB,QAAM,OAAO,eAAe,GAAG;AAC/B,SAAO,oBAAC,QAAK;AACf;AAuBO,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;AAEvC,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,MACA,MAAK;AAAA,MAEL;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,SAAM;AAAA;AAAA,QACT;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1 +0,0 @@
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-design/styled-system/patterns'\nimport { Portal, type PortalProps } from '../components/Portal'\nimport { notification } from '@cerberus-design/styled-system/recipes'\nimport { Button } from '../components/Button'\nimport { cx } from '@cerberus-design/styled-system/css'\n\n/**\n * This module provides a context and hook for notifications.\n * @module\n */\n\nexport interface NotifyOptions {\n palette: 'info' | 'success' | 'warning' | 'danger'\n heading: string\n id?: string\n description?: ReactNode\n onClose?: () => void\n}\n\nexport interface NotificationsValue {\n notify: (options: NotifyOptions) => void\n}\n\nconst NotificationsContext = createContext<NotificationsValue | null>(null)\n\nexport interface NotificationsProviderProps extends PortalProps {}\n\n/**\n * Provides a notification center to the app.\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=\"text\"\n >\n Close all\n </Button>\n </Show>\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 <Notification\n id={option.id!}\n key={option.id}\n onClose={handleClose}\n open\n palette={option.palette}\n >\n <NotificationHeading palette={option.palette}>\n {option.heading}\n </NotificationHeading>\n <NotificationDescription palette={option.palette}>\n {option.description}\n </NotificationDescription>\n </Notification>\n ))}\n </div>\n </div>\n </Portal>\n </Show>\n </NotificationsContext.Provider>\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;AA+FL,cAqBE,YArBF;AA5Ed,IAAM,uBAAuB,cAAyC,IAAI;AAyBnE,SAAS,mBACd,OACA;AACA,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAEpD,CAAC,CAAC;AACJ,QAAM,SAAS,aAAa;AAE5B,QAAM,eAAe,YAAY,CAAC,YAA2B;AAC3D,2BAAuB,CAAC,SAAS;AAC/B,YAAM,KAAK,GAAG,QAAQ,OAAO,IAAI,KAAK,SAAS,CAAC;AAChD,aAAO,CAAC,GAAG,MAAM,EAAE,GAAG,SAAS,GAAG,CAAC;AAAA,IACrC,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,QAAM,cAAc,YAAY,CAAC,MAAqC;AACpE,UAAM,SAAS,EAAE;AACjB,2BAAuB,CAAC,SAAS;AAC/B,YAAM,OAAO,KAAK,KAAK,CAAC,WAAW,OAAO,OAAO,OAAO,KAAK;AAC7D,UAAI,6BAAM,QAAS,MAAK,QAAQ;AAChC,aAAO,KAAK,OAAO,CAAC,WAAW,OAAO,OAAO,OAAO,KAAK;AAAA,IAC3D,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,QAAM,iBAAiB,YAAY,MAAM;AACvC,2BAAuB,CAAC,SAAS;AAC/B,WAAK,QAAQ,CAAC,SAAS;AACrB,YAAI,KAAK,QAAS,MAAK,QAAQ;AAAA,MACjC,CAAC;AACD,aAAO,CAAC;AAAA,IACV,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAKA,SACE,qBAAC,qBAAqB,UAArB,EAA8B,OAC5B;AAAA,UAAM;AAAA,IAEP,oBAAC,QAAK,MAAM,oBAAoB,SAAS,GACvC,8BAAC,UAAO,WAAW,MAAM,WACvB,+BAAC,SAAI,WAAW,OAAO,QACrB;AAAA,0BAAC,QAAK,MAAM,oBAAoB,UAAU,GACxC;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,GAAG,OAAO,UAAU,UAAU,CAAC;AAAA,UAC1C,SAAS;AAAA,UACT,SAAQ;AAAA,UACR,OAAM;AAAA,UACN,MAAK;AAAA,UACL,OAAM;AAAA,UACP;AAAA;AAAA,MAED,GACF;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,OAAO;AAAA,YAChB,YAAY;AAAA,YACZ,KAAK;AAAA,UACP,CAAC;AAAA,UACD,OAAO;AAAA,YACL,YAAY;AAAA,UACd;AAAA,UAEC,8BAAoB,IAAI,CAAC,WACxB;AAAA,YAAC;AAAA;AAAA,cACC,IAAI,OAAO;AAAA,cAEX,SAAS;AAAA,cACT,MAAI;AAAA,cACJ,SAAS,OAAO;AAAA,cAEhB;AAAA,oCAAC,uBAAoB,SAAS,OAAO,SAClC,iBAAO,SACV;AAAA,gBACA,oBAAC,2BAAwB,SAAS,OAAO,SACtC,iBAAO,aACV;AAAA;AAAA;AAAA,YAVK,OAAO;AAAA,UAWd,CACD;AAAA;AAAA,MACH;AAAA,OACF,GACF,GACF;AAAA,KACF;AAEJ;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":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/NotificationHeading.tsx"],"sourcesContent":["/**\n * This module exports the NotificationHeading component.\n * @module\n */\n\nimport { cx } from '@cerberus-design/styled-system/css'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus-design/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\nexport interface BaseNotificationHeadingProps\n extends HTMLAttributes<HTMLParagraphElement> {}\nexport type NotificationHeadingProps = BaseNotificationHeadingProps &\n NotificationVariantProps\n\n/**\n * The NotificationHeading component is used to render the heading of a notification.\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":";AAKA,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,OAEK;AAgBH;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":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/NotificationDescription.tsx"],"sourcesContent":["/**\n * This module exports the NotificationDescription component.\n * @module\n */\n\nimport { cx } from '@cerberus-design/styled-system/css'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus-design/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\nexport interface BaseNotificationDescriptionProps\n extends HTMLAttributes<HTMLParagraphElement> {}\nexport type NotificationDescriptionProps = BaseNotificationDescriptionProps &\n NotificationVariantProps\n\n/**\n * The NotificationDescription component is used to render the description of a notification.\n * @param props - The anything a HTMLParagraphElement can accept.\n */\nexport function NotificationDescription(props: NotificationDescriptionProps) {\n const { palette, ...nativeProps } = props\n const styles = notification({ palette })\n return (\n <p\n className={cx(nativeProps.className, styles.description)}\n {...nativeProps}\n />\n )\n}\n"],"mappings":";AAKA,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,OAEK;AAgBH;AAJG,SAAS,wBAAwB,OAAqC;AAC3E,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI;AACpC,QAAM,SAAS,aAAa,EAAE,QAAQ,CAAC;AACvC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,YAAY,WAAW,OAAO,WAAW;AAAA,MACtD,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/FileUploader.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus-design/styled-system/css'\nimport { circle, vstack } from '@cerberus-design/styled-system/patterns'\nimport { type InputHTMLAttributes } from 'react'\nimport { Show } from './Show'\nimport { fileUploader, modalIcon } from '@cerberus-design/styled-system/recipes'\nimport { $cerberusIcons } from '../config/defineIcons'\n\nexport interface FileUploaderProps\n extends InputHTMLAttributes<HTMLInputElement> {\n heading?: string\n name: string\n}\n\nexport function FileUploader(props: FileUploaderProps) {\n const styles = fileUploader()\n const Icon = $cerberusIcons.fileUploader\n\n return (\n <div\n className={cx(\n vstack({\n justify: 'center',\n }),\n styles.container,\n )}\n >\n <span className={cx(styles.icon, modalIcon(), circle())}>\n <Icon />\n </span>\n\n <label\n className={cx(\n vstack({\n justify: 'center',\n }),\n styles.label,\n )}\n htmlFor={props.name}\n >\n <Show when={Boolean(props.heading)}>\n <p className={styles.heading}>{props.heading}</p>\n </Show>\n Import {props.accept?.replace(',', ', ')} files\n <p className={styles.description}>Or click to upload</p>\n <input\n {...props}\n className={cx(props.className, styles.input)}\n type=\"file\"\n />\n </label>\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAEA,SAAS,UAAU;AACnB,SAAS,QAAQ,cAAc;AAG/B,SAAS,cAAc,iBAAiB;AAuBhC,cAGF,YAHE;AAdD,SAAS,aAAa,OAA0B;AAfvD;AAgBE,QAAM,SAAS,aAAa;AAC5B,QAAM,OAAO,eAAe;AAE5B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT,OAAO;AAAA,UACL,SAAS;AAAA,QACX,CAAC;AAAA,QACD,OAAO;AAAA,MACT;AAAA,MAEA;AAAA,4BAAC,UAAK,WAAW,GAAG,OAAO,MAAM,UAAU,GAAG,OAAO,CAAC,GACpD,8BAAC,QAAK,GACR;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,cACT,OAAO;AAAA,gBACL,SAAS;AAAA,cACX,CAAC;AAAA,cACD,OAAO;AAAA,YACT;AAAA,YACA,SAAS,MAAM;AAAA,YAEf;AAAA,kCAAC,QAAK,MAAM,QAAQ,MAAM,OAAO,GAC/B,8BAAC,OAAE,WAAW,OAAO,SAAU,gBAAM,SAAQ,GAC/C;AAAA,cAAO;AAAA,eACC,WAAM,WAAN,mBAAc,QAAQ,KAAK;AAAA,cAAM;AAAA,cACzC,oBAAC,OAAE,WAAW,OAAO,aAAa,gCAAkB;AAAA,cACpD;AAAA,gBAAC;AAAA;AAAA,kBACE,GAAG;AAAA,kBACJ,WAAW,GAAG,MAAM,WAAW,OAAO,KAAK;AAAA,kBAC3C,MAAK;AAAA;AAAA,cACP;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/FileUploader.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus-design/styled-system/css'\nimport { circle, vstack } from '@cerberus-design/styled-system/patterns'\nimport { type InputHTMLAttributes } from 'react'\nimport { Show } from './Show'\nimport { fileUploader, modalIcon } from '@cerberus-design/styled-system/recipes'\nimport { $cerberusIcons } from '../config/defineIcons'\n\nexport interface FileUploaderProps\n extends InputHTMLAttributes<HTMLInputElement> {\n heading?: string\n name: string\n}\n\nexport function FileUploader(props: FileUploaderProps) {\n const styles = fileUploader()\n const Icon = $cerberusIcons.fileUploader\n\n return (\n <div\n className={cx(\n vstack({\n justify: 'center',\n }),\n styles.container,\n )}\n >\n <span className={cx(styles.icon, modalIcon(), circle())}>\n <Icon />\n </span>\n\n <label\n className={cx(\n vstack({\n justify: 'center',\n }),\n styles.label,\n )}\n htmlFor={props.name}\n >\n <Show when={Boolean(props.heading)}>\n <p className={styles.heading}>{props.heading}</p>\n </Show>\n Import {props.accept?.replace(',', ', ')} files\n <p className={styles.description}>Or click to upload</p>\n <input\n {...props}\n className={cx(props.className, styles.input)}\n type=\"file\"\n />\n </label>\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAEA,SAAS,UAAU;AACnB,SAAS,QAAQ,cAAc;AAG/B,SAAS,cAAc,iBAAiB;AAuBhC,cAGF,YAHE;AAdD,SAAS,aAAa,OAA0B;AACrD,QAAM,SAAS,aAAa;AAC5B,QAAM,OAAO,eAAe;AAE5B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT,OAAO;AAAA,UACL,SAAS;AAAA,QACX,CAAC;AAAA,QACD,OAAO;AAAA,MACT;AAAA,MAEA;AAAA,4BAAC,UAAK,WAAW,GAAG,OAAO,MAAM,UAAU,GAAG,OAAO,CAAC,GACpD,8BAAC,QAAK,GACR;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,cACT,OAAO;AAAA,gBACL,SAAS;AAAA,cACX,CAAC;AAAA,cACD,OAAO;AAAA,YACT;AAAA,YACA,SAAS,MAAM;AAAA,YAEf;AAAA,kCAAC,QAAK,MAAM,QAAQ,MAAM,OAAO,GAC/B,8BAAC,OAAE,WAAW,OAAO,SAAU,gBAAM,SAAQ,GAC/C;AAAA,cAAO;AAAA,cACC,MAAM,QAAQ,QAAQ,KAAK,IAAI;AAAA,cAAE;AAAA,cACzC,oBAAC,OAAE,WAAW,OAAO,aAAa,gCAAkB;AAAA,cACpD;AAAA,gBAAC;AAAA;AAAA,kBACE,GAAG;AAAA,kBACJ,WAAW,GAAG,MAAM,WAAW,OAAO,KAAK;AAAA,kBAC3C,MAAK;AAAA;AAAA,cACP;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/NotificationHeading.tsx"],"sourcesContent":["/**\n * This module exports the NotificationHeading component.\n * @module\n */\n\nimport { cx } from '@cerberus-design/styled-system/css'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus-design/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\nexport interface BaseNotificationHeadingProps\n extends HTMLAttributes<HTMLParagraphElement> {}\nexport type NotificationHeadingProps = BaseNotificationHeadingProps &\n NotificationVariantProps\n\n/**\n * The NotificationHeading component is used to render the heading of a notification.\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":";AAKA,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,OAEK;AAgBH;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":[]}
@@ -1 +0,0 @@
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-design/styled-system/patterns'\nimport { Portal, type PortalProps } from '../components/Portal'\nimport { notification } from '@cerberus-design/styled-system/recipes'\nimport { Button } from '../components/Button'\nimport { cx } from '@cerberus-design/styled-system/css'\n\n/**\n * This module provides a context and hook for notifications.\n * @module\n */\n\nexport interface NotifyOptions {\n palette: 'info' | 'success' | 'warning' | 'danger'\n heading: string\n id?: string\n description?: ReactNode\n onClose?: () => void\n}\n\nexport interface NotificationsValue {\n notify: (options: NotifyOptions) => void\n}\n\nconst NotificationsContext = createContext<NotificationsValue | null>(null)\n\nexport interface NotificationsProviderProps extends PortalProps {}\n\n/**\n * Provides a notification center to the app.\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=\"text\"\n >\n Close all\n </Button>\n </Show>\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 <Notification\n id={option.id!}\n key={option.id}\n onClose={handleClose}\n open\n palette={option.palette}\n >\n <NotificationHeading palette={option.palette}>\n {option.heading}\n </NotificationHeading>\n <NotificationDescription palette={option.palette}>\n {option.description}\n </NotificationDescription>\n </Notification>\n ))}\n </div>\n </div>\n </Portal>\n </Show>\n </NotificationsContext.Provider>\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;AA+FL,cAqBE,YArBF;AA5Ed,IAAM,uBAAuB,cAAyC,IAAI;AAyBnE,SAAS,mBACd,OACA;AACA,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAEpD,CAAC,CAAC;AACJ,QAAM,SAAS,aAAa;AAE5B,QAAM,eAAe,YAAY,CAAC,YAA2B;AAC3D,2BAAuB,CAAC,SAAS;AAC/B,YAAM,KAAK,GAAG,QAAQ,OAAO,IAAI,KAAK,SAAS,CAAC;AAChD,aAAO,CAAC,GAAG,MAAM,EAAE,GAAG,SAAS,GAAG,CAAC;AAAA,IACrC,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,QAAM,cAAc,YAAY,CAAC,MAAqC;AACpE,UAAM,SAAS,EAAE;AACjB,2BAAuB,CAAC,SAAS;AAC/B,YAAM,OAAO,KAAK,KAAK,CAAC,WAAW,OAAO,OAAO,OAAO,KAAK;AAC7D,UAAI,MAAM,QAAS,MAAK,QAAQ;AAChC,aAAO,KAAK,OAAO,CAAC,WAAW,OAAO,OAAO,OAAO,KAAK;AAAA,IAC3D,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,QAAM,iBAAiB,YAAY,MAAM;AACvC,2BAAuB,CAAC,SAAS;AAC/B,WAAK,QAAQ,CAAC,SAAS;AACrB,YAAI,KAAK,QAAS,MAAK,QAAQ;AAAA,MACjC,CAAC;AACD,aAAO,CAAC;AAAA,IACV,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAKA,SACE,qBAAC,qBAAqB,UAArB,EAA8B,OAC5B;AAAA,UAAM;AAAA,IAEP,oBAAC,QAAK,MAAM,oBAAoB,SAAS,GACvC,8BAAC,UAAO,WAAW,MAAM,WACvB,+BAAC,SAAI,WAAW,OAAO,QACrB;AAAA,0BAAC,QAAK,MAAM,oBAAoB,UAAU,GACxC;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,GAAG,OAAO,UAAU,UAAU,CAAC;AAAA,UAC1C,SAAS;AAAA,UACT,SAAQ;AAAA,UACR,OAAM;AAAA,UACN,MAAK;AAAA,UACL,OAAM;AAAA,UACP;AAAA;AAAA,MAED,GACF;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,OAAO;AAAA,YAChB,YAAY;AAAA,YACZ,KAAK;AAAA,UACP,CAAC;AAAA,UACD,OAAO;AAAA,YACL,YAAY;AAAA,UACd;AAAA,UAEC,8BAAoB,IAAI,CAAC,WACxB;AAAA,YAAC;AAAA;AAAA,cACC,IAAI,OAAO;AAAA,cAEX,SAAS;AAAA,cACT,MAAI;AAAA,cACJ,SAAS,OAAO;AAAA,cAEhB;AAAA,oCAAC,uBAAoB,SAAS,OAAO,SAClC,iBAAO,SACV;AAAA,gBACA,oBAAC,2BAAwB,SAAS,OAAO,SACtC,iBAAO,aACV;AAAA;AAAA;AAAA,YAVK,OAAO;AAAA,UAWd,CACD;AAAA;AAAA,MACH;AAAA,OACF,GACF,GACF;AAAA,KACF;AAEJ;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":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/NotificationDescription.tsx"],"sourcesContent":["/**\n * This module exports the NotificationDescription component.\n * @module\n */\n\nimport { cx } from '@cerberus-design/styled-system/css'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus-design/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\nexport interface BaseNotificationDescriptionProps\n extends HTMLAttributes<HTMLParagraphElement> {}\nexport type NotificationDescriptionProps = BaseNotificationDescriptionProps &\n NotificationVariantProps\n\n/**\n * The NotificationDescription component is used to render the description of a notification.\n * @param props - The anything a HTMLParagraphElement can accept.\n */\nexport function NotificationDescription(props: NotificationDescriptionProps) {\n const { palette, ...nativeProps } = props\n const styles = notification({ palette })\n return (\n <p\n className={cx(nativeProps.className, styles.description)}\n {...nativeProps}\n />\n )\n}\n"],"mappings":";AAKA,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,OAEK;AAgBH;AAJG,SAAS,wBAAwB,OAAqC;AAC3E,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI;AACpC,QAAM,SAAS,aAAa,EAAE,QAAQ,CAAC;AACvC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,YAAY,WAAW,OAAO,WAAW;AAAA,MACtD,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Notification.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus-design/styled-system/css'\nimport { hstack, vstack } from '@cerberus-design/styled-system/patterns'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus-design/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 id: string\n onClose?: (e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type NotificationProps = NotificationBaseProps & NotificationVariantProps\n\n/**\n * The info notification component.\n * @param props - The component props.\n * @returns The info notification component.\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 role=\"alert\"\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"],"mappings":";;;;;;;;AAEA,SAAS,UAAU;AACnB,SAAS,QAAQ,cAAc;AAC/B;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,OAIK;AACP,SAAS,aAAa;AAcb,cA+BL,YA/BK;AAJT,SAAS,sBAAsB,OAAiC;AAC9D,QAAM,UAAU,MAAM,WAAW;AACjC,QAAM,MAAM,GAAG,OAAO;AACtB,QAAM,OAAO,eAAe,GAAG;AAC/B,SAAO,oBAAC,QAAK;AACf;AAuBO,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;AAEvC,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,MACA,MAAK;AAAA,MAEL;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,SAAM;AAAA;AAAA,QACT;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}