@cerberus-design/react 0.11.1-next-c28b077 → 0.12.0-next-c2bae7a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/legacy/_tsup-dts-rollup.d.cts +143 -30
- package/build/legacy/components/Menu.cjs +82 -0
- package/build/legacy/components/Menu.cjs.map +1 -0
- package/build/legacy/components/NavMenuLink.cjs.map +1 -1
- package/build/legacy/components/NavMenuList.cjs.map +1 -1
- package/build/legacy/components/NavMenuTrigger.cjs.map +1 -1
- package/build/legacy/components/Tbody.cjs.map +1 -1
- package/build/legacy/components/Td.cjs.map +1 -1
- package/build/legacy/components/Th.cjs +1 -0
- package/build/legacy/components/Th.cjs.map +1 -1
- package/build/legacy/components/Thead.cjs.map +1 -1
- package/build/legacy/context/navMenu.cjs.map +1 -1
- package/build/legacy/index.cjs +400 -344
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +143 -30
- package/build/modern/{chunk-HPM2XRWT.js → chunk-3R4TIF2X.js} +1 -1
- package/build/modern/{chunk-HPM2XRWT.js.map → chunk-3R4TIF2X.js.map} +1 -1
- package/build/modern/{chunk-O75QAT4Z.js → chunk-6WS765J3.js} +1 -1
- package/build/modern/chunk-6WS765J3.js.map +1 -0
- package/build/modern/{chunk-PJGUYNKD.js → chunk-CSEHDNMJ.js} +4 -4
- package/build/modern/{chunk-OWKN5IV7.js → chunk-PM7CWT3N.js} +2 -2
- package/build/modern/chunk-PM7CWT3N.js.map +1 -0
- package/build/modern/chunk-RUR5MV54.js +52 -0
- package/build/modern/chunk-RUR5MV54.js.map +1 -0
- package/build/modern/{chunk-CO4BKT7K.js → chunk-SGKHA4EB.js} +1 -1
- package/build/modern/chunk-SGKHA4EB.js.map +1 -0
- package/build/modern/{chunk-JVIFMN67.js → chunk-T6LS5P5W.js} +4 -4
- package/build/modern/{chunk-5V5MBSM3.js → chunk-UZVQ4INR.js} +2 -2
- package/build/modern/chunk-UZVQ4INR.js.map +1 -0
- package/build/modern/{chunk-C7UVOGPZ.js → chunk-VP5ERLAY.js} +4 -4
- package/build/modern/{chunk-KBBASJIY.js → chunk-WPVDQRRF.js} +1 -1
- package/build/modern/chunk-WPVDQRRF.js.map +1 -0
- package/build/modern/{chunk-PKY46RRA.js → chunk-Y6QQCRQV.js} +1 -1
- package/build/modern/{chunk-PKY46RRA.js.map → chunk-Y6QQCRQV.js.map} +1 -1
- package/build/modern/{chunk-PKQTTFWA.js → chunk-ZR37P4NZ.js} +1 -1
- package/build/modern/{chunk-PKQTTFWA.js.map → chunk-ZR37P4NZ.js.map} +1 -1
- package/build/modern/components/Menu.js +19 -0
- package/build/modern/components/Menu.js.map +1 -0
- package/build/modern/components/NavMenuLink.js +1 -1
- package/build/modern/components/NavMenuList.js +2 -2
- package/build/modern/components/NavMenuTrigger.js +2 -2
- package/build/modern/components/Tbody.js +1 -1
- package/build/modern/components/Td.js +1 -1
- package/build/modern/components/Th.js +2 -1
- package/build/modern/components/Thead.js +1 -1
- package/build/modern/context/confirm-modal.js +2 -2
- package/build/modern/context/cta-modal.js +2 -2
- package/build/modern/context/navMenu.js +1 -1
- package/build/modern/context/prompt-modal.js +2 -2
- package/build/modern/index.js +39 -23
- package/build/modern/index.js.map +1 -1
- package/package.json +3 -2
- package/src/components/Menu.tsx +244 -0
- package/src/components/NavMenuLink.tsx +1 -11
- package/src/components/NavMenuList.tsx +1 -3
- package/src/components/NavMenuTrigger.tsx +1 -10
- package/src/components/Tbody.tsx +1 -2
- package/src/components/Td.tsx +1 -2
- package/src/components/Th.tsx +4 -2
- package/src/components/Thead.tsx +1 -2
- package/src/context/navMenu.tsx +1 -2
- package/src/index.ts +1 -0
- package/build/modern/chunk-5V5MBSM3.js.map +0 -1
- package/build/modern/chunk-CO4BKT7K.js.map +0 -1
- package/build/modern/chunk-KBBASJIY.js.map +0 -1
- package/build/modern/chunk-O75QAT4Z.js.map +0 -1
- package/build/modern/chunk-OWKN5IV7.js.map +0 -1
- /package/build/modern/{chunk-PJGUYNKD.js.map → chunk-CSEHDNMJ.js.map} +0 -0
- /package/build/modern/{chunk-JVIFMN67.js.map → chunk-T6LS5P5W.js.map} +0 -0
- /package/build/modern/{chunk-C7UVOGPZ.js.map → chunk-VP5ERLAY.js.map} +0 -0
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CTAModal,
|
|
4
4
|
useCTAModal
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-T6LS5P5W.js";
|
|
6
|
+
import "../chunk-2UXE5PDG.js";
|
|
6
7
|
import "../chunk-GLY7GU5S.js";
|
|
7
8
|
import "../chunk-BE4EOU2P.js";
|
|
8
9
|
import "../chunk-Q7BRMIBR.js";
|
|
9
10
|
import "../chunk-ZFAIE47A.js";
|
|
10
|
-
import "../chunk-2UXE5PDG.js";
|
|
11
11
|
import "../chunk-APD6IX5R.js";
|
|
12
12
|
import "../chunk-SPZYPRZ6.js";
|
|
13
13
|
import "../chunk-EXGKZGML.js";
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
PromptModal,
|
|
4
4
|
usePromptModal
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-VP5ERLAY.js";
|
|
6
|
+
import "../chunk-2UXE5PDG.js";
|
|
6
7
|
import "../chunk-GLY7GU5S.js";
|
|
7
8
|
import "../chunk-NKM6PISB.js";
|
|
8
9
|
import "../chunk-NMF2HYWO.js";
|
|
9
10
|
import "../chunk-BE4EOU2P.js";
|
|
10
11
|
import "../chunk-Q7BRMIBR.js";
|
|
11
12
|
import "../chunk-ZFAIE47A.js";
|
|
12
|
-
import "../chunk-2UXE5PDG.js";
|
|
13
13
|
import "../chunk-SPZYPRZ6.js";
|
|
14
14
|
import "../chunk-EXGKZGML.js";
|
|
15
15
|
import "../chunk-UZDVOIW5.js";
|
package/build/modern/index.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ThemeProvider,
|
|
3
|
+
useThemeContext
|
|
4
|
+
} from "./chunk-EB37HRCN.js";
|
|
5
|
+
import {
|
|
6
|
+
ConfirmModal,
|
|
7
|
+
useConfirmModal
|
|
8
|
+
} from "./chunk-CSEHDNMJ.js";
|
|
1
9
|
import {
|
|
2
10
|
CTAModal,
|
|
3
11
|
useCTAModal
|
|
4
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-T6LS5P5W.js";
|
|
5
13
|
import {
|
|
6
14
|
NotificationCenter,
|
|
7
15
|
useNotificationCenter
|
|
@@ -9,36 +17,32 @@ import {
|
|
|
9
17
|
import {
|
|
10
18
|
PromptModal,
|
|
11
19
|
usePromptModal
|
|
12
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-VP5ERLAY.js";
|
|
13
21
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} from "./chunk-
|
|
22
|
+
Table,
|
|
23
|
+
Tr
|
|
24
|
+
} from "./chunk-B4CVET74.js";
|
|
17
25
|
import {
|
|
18
26
|
Tag
|
|
19
27
|
} from "./chunk-F72ZABKX.js";
|
|
20
28
|
import {
|
|
21
29
|
Tbody
|
|
22
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-ZR37P4NZ.js";
|
|
23
31
|
import {
|
|
24
32
|
Td
|
|
25
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-3R4TIF2X.js";
|
|
26
34
|
import {
|
|
27
35
|
Textarea
|
|
28
36
|
} from "./chunk-JIJM6JFJ.js";
|
|
29
37
|
import {
|
|
30
38
|
Th
|
|
31
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-SGKHA4EB.js";
|
|
32
40
|
import {
|
|
33
41
|
Thead
|
|
34
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-Y6QQCRQV.js";
|
|
35
43
|
import {
|
|
36
44
|
Toggle
|
|
37
45
|
} from "./chunk-NMNONSHU.js";
|
|
38
|
-
import {
|
|
39
|
-
ConfirmModal,
|
|
40
|
-
useConfirmModal
|
|
41
|
-
} from "./chunk-PJGUYNKD.js";
|
|
42
46
|
import {
|
|
43
47
|
Radio
|
|
44
48
|
} from "./chunk-FTPZHG6J.js";
|
|
@@ -59,23 +63,22 @@ import {
|
|
|
59
63
|
TabPanel
|
|
60
64
|
} from "./chunk-AYIRV5CL.js";
|
|
61
65
|
import {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} from "./chunk-B4CVET74.js";
|
|
66
|
+
ModalHeading
|
|
67
|
+
} from "./chunk-2UXE5PDG.js";
|
|
65
68
|
import {
|
|
66
69
|
NavMenuLink
|
|
67
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-WPVDQRRF.js";
|
|
68
71
|
import {
|
|
69
72
|
NavMenuList,
|
|
70
73
|
getPosition
|
|
71
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-UZVQ4INR.js";
|
|
72
75
|
import {
|
|
73
76
|
NavMenuTrigger
|
|
74
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-PM7CWT3N.js";
|
|
75
78
|
import {
|
|
76
79
|
NavMenu,
|
|
77
80
|
useNavMenuContext
|
|
78
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-6WS765J3.js";
|
|
79
82
|
import {
|
|
80
83
|
Notification
|
|
81
84
|
} from "./chunk-7SGPJM66.js";
|
|
@@ -97,6 +100,15 @@ import {
|
|
|
97
100
|
import {
|
|
98
101
|
Legend
|
|
99
102
|
} from "./chunk-ILQW5VZT.js";
|
|
103
|
+
import {
|
|
104
|
+
Menu,
|
|
105
|
+
MenuContent,
|
|
106
|
+
MenuGroupLabel,
|
|
107
|
+
MenuItem,
|
|
108
|
+
MenuItemGroup,
|
|
109
|
+
MenuSeparator,
|
|
110
|
+
MenuTrigger
|
|
111
|
+
} from "./chunk-RUR5MV54.js";
|
|
100
112
|
import {
|
|
101
113
|
Modal
|
|
102
114
|
} from "./chunk-BE4EOU2P.js";
|
|
@@ -106,9 +118,6 @@ import {
|
|
|
106
118
|
import {
|
|
107
119
|
ModalHeader
|
|
108
120
|
} from "./chunk-ZFAIE47A.js";
|
|
109
|
-
import {
|
|
110
|
-
ModalHeading
|
|
111
|
-
} from "./chunk-2UXE5PDG.js";
|
|
112
121
|
import {
|
|
113
122
|
CircularProgress
|
|
114
123
|
} from "./chunk-6QHOKCV3.js";
|
|
@@ -229,6 +238,13 @@ export {
|
|
|
229
238
|
Label,
|
|
230
239
|
Legend,
|
|
231
240
|
MODE_KEY,
|
|
241
|
+
Menu,
|
|
242
|
+
MenuContent,
|
|
243
|
+
MenuGroupLabel,
|
|
244
|
+
MenuItem,
|
|
245
|
+
MenuItemGroup,
|
|
246
|
+
MenuSeparator,
|
|
247
|
+
MenuTrigger,
|
|
232
248
|
Modal,
|
|
233
249
|
ModalDescription,
|
|
234
250
|
ModalHeader,
|
|
@@ -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/Admonition'\nexport * from './components/Avatar'\nexport * from './components/Button'\nexport * from './components/Checkbox'\nexport * from './components/CircularProgress'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/Fieldset'\nexport * from './components/FieldsetLabel'\nexport * from './components/FileStatus'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Legend'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\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/ProgressBar'\nexport * from './components/Radio'\nexport * from './components/Select'\nexport * from './components/Spinner'\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/cta-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'\nexport * from './utils/index'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":"
|
|
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/Admonition'\nexport * from './components/Avatar'\nexport * from './components/Button'\nexport * from './components/Checkbox'\nexport * from './components/CircularProgress'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/Fieldset'\nexport * from './components/FieldsetLabel'\nexport * from './components/FileStatus'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Legend'\nexport * from './components/Menu'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\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/ProgressBar'\nexport * from './components/Radio'\nexport * from './components/Select'\nexport * from './components/Spinner'\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/cta-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'\nexport * from './utils/index'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFA,cAAc;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerberus-design/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0-next-c2bae7a",
|
|
4
4
|
"description": "The Cerberus Design React component library.",
|
|
5
5
|
"browserslist": "> 0.25%, not dead",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"react-dom": "*"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
+
"@ark-ui/react": "^4.4.0",
|
|
19
20
|
"@dnd-kit/core": "^6.1.0"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
"react-dom": "^18",
|
|
27
28
|
"tsup": "^8.1.0",
|
|
28
29
|
"@cerberus-design/configs": "0.0.0",
|
|
29
|
-
"@cerberus-design/styled-system": "0.
|
|
30
|
+
"@cerberus-design/styled-system": "0.12.0-next-c2bae7a"
|
|
30
31
|
},
|
|
31
32
|
"publishConfig": {
|
|
32
33
|
"access": "public"
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { Menu as ArkMenu } from '@ark-ui/react'
|
|
2
|
+
import { menu } from '@cerberus/styled-system/recipes'
|
|
3
|
+
import { cx } from '@cerberus/styled-system/css'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This module contains the Menu component family.
|
|
7
|
+
* @module Menu
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const menuStyles = menu()
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The root Menu component which controls the menu.
|
|
14
|
+
* @definition [Cerberus docs](https://cerberus.digitalu.design/react/menu)
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Menu>
|
|
18
|
+
* <MenuTrigger>Trigger</MenuTrigger>
|
|
19
|
+
* </Menu>
|
|
20
|
+
*/
|
|
21
|
+
export const Menu = ArkMenu.Root
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The MenuTrigger component opens/closes the Menu.
|
|
25
|
+
* @definition [Cerberus docs](https://cerberus.digitalu.design/react/menu)
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <Menu>
|
|
29
|
+
* <MenuTrigger>
|
|
30
|
+
* <Button>Trigger</Button>
|
|
31
|
+
* </MenuTrigger>
|
|
32
|
+
* </Menu>
|
|
33
|
+
*/
|
|
34
|
+
export function MenuTrigger(props: ArkMenu.TriggerProps) {
|
|
35
|
+
return <ArkMenu.Trigger {...props} asChild />
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The MenuContent component is the container for the menu items.
|
|
40
|
+
* @definition [Cerberus docs](https://cerberus.digitalu.design/react/menu)
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <Menu>
|
|
44
|
+
* <MenuTrigger>
|
|
45
|
+
* <Button>Trigger</Button>
|
|
46
|
+
* </MenuTrigger>
|
|
47
|
+
* <MenuContent>
|
|
48
|
+
* <MenuItem value="item_1">Item 1</MenuItem>
|
|
49
|
+
* <MenuItem value="item_2">Item 2</MenuItem>
|
|
50
|
+
* </MenuContent>
|
|
51
|
+
* </Menu>
|
|
52
|
+
*/
|
|
53
|
+
export function MenuContent(props: ArkMenu.ContentProps) {
|
|
54
|
+
return (
|
|
55
|
+
<ArkMenu.Positioner>
|
|
56
|
+
<ArkMenu.Content
|
|
57
|
+
{...props}
|
|
58
|
+
className={cx(props.className, menuStyles.content)}
|
|
59
|
+
/>
|
|
60
|
+
</ArkMenu.Positioner>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The MenuItem component is a single item in the menu.
|
|
66
|
+
* @definition [Cerberus docs](https://cerberus.digitalu.design/react/menu)
|
|
67
|
+
* @example
|
|
68
|
+
* ```tsx
|
|
69
|
+
* <Menu>
|
|
70
|
+
* <MenuTrigger>
|
|
71
|
+
* <Button>Trigger</Button>
|
|
72
|
+
* </MenuTrigger>
|
|
73
|
+
* <MenuContent>
|
|
74
|
+
* <MenuItem value="item_1">Item 1</MenuItem>
|
|
75
|
+
* <MenuItem value="item_2">Item 2</MenuItem>
|
|
76
|
+
* </MenuContent>
|
|
77
|
+
* </Menu>
|
|
78
|
+
*/
|
|
79
|
+
export function MenuItem(props: ArkMenu.ItemProps) {
|
|
80
|
+
return (
|
|
81
|
+
<ArkMenu.Item {...props} className={cx(props.className, menuStyles.item)} />
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The MenuItemGroup component is a group of menu items.
|
|
87
|
+
* @definition [Cerberus docs](https://cerberus.digitalu.design/react/menu)
|
|
88
|
+
* @example
|
|
89
|
+
* ```tsx
|
|
90
|
+
* <Menu>
|
|
91
|
+
* <MenuTrigger>
|
|
92
|
+
* <Button>Trigger</Button>
|
|
93
|
+
* </MenuTrigger>
|
|
94
|
+
* <MenuContent>
|
|
95
|
+
* <MenuItemGroup>
|
|
96
|
+
* <MenuItem value="item_1">Item 1</MenuItem>
|
|
97
|
+
* <MenuItem value="item_2">Item 2</MenuItem>
|
|
98
|
+
* </MenuItemGroup>
|
|
99
|
+
* </MenuContent>
|
|
100
|
+
* </Menu>
|
|
101
|
+
*/
|
|
102
|
+
export const MenuItemGroup = ArkMenu.ItemGroup
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The MenuItemGroupLabel component is the label for a group of menu items.
|
|
106
|
+
* @definition [Cerberus docs](https://cerberus.digitalu.design/react/menu)
|
|
107
|
+
* @example
|
|
108
|
+
* ```tsx
|
|
109
|
+
* <Menu>
|
|
110
|
+
* <MenuTrigger>
|
|
111
|
+
* <Button>Trigger</Button>
|
|
112
|
+
* </MenuTrigger>
|
|
113
|
+
* <MenuContent>
|
|
114
|
+
* <MenuItemGroup>
|
|
115
|
+
* <MenuItemGroupLabel>Group Label</MenuItemGroupLabel>
|
|
116
|
+
* <MenuItem value="item_1">Item 1</MenuItem>
|
|
117
|
+
* <MenuItem value="item_2">Item 2</MenuItem>
|
|
118
|
+
* </MenuItemGroup>
|
|
119
|
+
* </MenuContent>
|
|
120
|
+
* </Menu>
|
|
121
|
+
*/
|
|
122
|
+
export function MenuGroupLabel(props: ArkMenu.ItemGroupLabelProps) {
|
|
123
|
+
return (
|
|
124
|
+
<ArkMenu.ItemGroupLabel
|
|
125
|
+
{...props}
|
|
126
|
+
className={cx(props.className, menuStyles.itemGroupLabel)}
|
|
127
|
+
/>
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The MenuSeparator component is a visual divider between menu items.
|
|
133
|
+
* @definition [Cerberus docs](https://cerberus.digitalu.design/react/menu)
|
|
134
|
+
* @example
|
|
135
|
+
* ```tsx
|
|
136
|
+
* <Menu>
|
|
137
|
+
* <MenuTrigger>
|
|
138
|
+
* <Button>Trigger</Button>
|
|
139
|
+
* </MenuTrigger>
|
|
140
|
+
* <MenuContent>
|
|
141
|
+
* <MenuItemGroup>
|
|
142
|
+
* <MenuGroupLabel>Group Label</MenuGroupLabel>
|
|
143
|
+
* <MenuSeparator />
|
|
144
|
+
* <MenuItem value="item_1">Item 1</MenuItem>
|
|
145
|
+
* <MenuItem value="item_2">Item 2</MenuItem>
|
|
146
|
+
* </MenuItemGroup>
|
|
147
|
+
* </MenuContent>
|
|
148
|
+
* </Menu>
|
|
149
|
+
*/
|
|
150
|
+
export function MenuSeparator(props: ArkMenu.SeparatorProps) {
|
|
151
|
+
return (
|
|
152
|
+
<ArkMenu.Separator
|
|
153
|
+
{...props}
|
|
154
|
+
className={cx(props.className, menuStyles.separator)}
|
|
155
|
+
/>
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The MenuCheckboxItem component is a menu item with a checkbox.
|
|
161
|
+
* @definition [Cerberus docs](https://cerberus.digitalu.design/react/menu)
|
|
162
|
+
* @example
|
|
163
|
+
* ```tsx
|
|
164
|
+
* <Menu>
|
|
165
|
+
* <MenuTrigger>
|
|
166
|
+
* <Button>Trigger</Button>
|
|
167
|
+
* </MenuTrigger>
|
|
168
|
+
* <MenuContent>
|
|
169
|
+
* <MenuCheckboxItem
|
|
170
|
+
* checked={checked}
|
|
171
|
+
* onCheckedChange={setChecked}
|
|
172
|
+
* value="checked"
|
|
173
|
+
* >
|
|
174
|
+
* <MenuItemIndicator>✅</MenuItemIndicator>
|
|
175
|
+
* <MenuItemText>Check me</MenuItemText>
|
|
176
|
+
* </MenuCheckboxItem>
|
|
177
|
+
* </MenuContent>
|
|
178
|
+
*/
|
|
179
|
+
// export function MenuCheckboxItem(props: ArkMenu.CheckboxItemProps) {
|
|
180
|
+
// return (
|
|
181
|
+
// <ArkMenu.CheckboxItem
|
|
182
|
+
// {...props}
|
|
183
|
+
// className={cx(props.className, menuStyles.item)}
|
|
184
|
+
// />
|
|
185
|
+
// )
|
|
186
|
+
// }
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* The MenuItemText component is the text for a grouped menu item.
|
|
190
|
+
* @definition [Cerberus docs](https://cerberus.digitalu.design/react/menu)
|
|
191
|
+
* @example
|
|
192
|
+
* ```tsx
|
|
193
|
+
* <Menu>
|
|
194
|
+
* <MenuTrigger>
|
|
195
|
+
* <Button>Trigger</Button>
|
|
196
|
+
* </MenuTrigger>
|
|
197
|
+
* <MenuContent>
|
|
198
|
+
* <MenuCheckboxItem
|
|
199
|
+
* checked={checked}
|
|
200
|
+
* onCheckedChange={setChecked}
|
|
201
|
+
* value="checked"
|
|
202
|
+
* >
|
|
203
|
+
* <MenuItemText>Item 1</MenuItemText>
|
|
204
|
+
* </MenuCheckboxItem>
|
|
205
|
+
* </MenuContent>
|
|
206
|
+
* </Menu>
|
|
207
|
+
*/
|
|
208
|
+
// export function MenuItemText(props: ArkMenu.ItemTextProps) {
|
|
209
|
+
// return (
|
|
210
|
+
// <ArkMenu.ItemText
|
|
211
|
+
// {...props}
|
|
212
|
+
// className={cx(props.className, menuStyles.itemText)}
|
|
213
|
+
// />
|
|
214
|
+
// )
|
|
215
|
+
// }
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* The MenuItemIndicator component is the indicator for a grouped menu item.
|
|
219
|
+
* @definition [Cerberus docs](https://cerberus.digitalu.design/react/menu)
|
|
220
|
+
* @example
|
|
221
|
+
* ```tsx
|
|
222
|
+
* <Menu>
|
|
223
|
+
* <MenuTrigger>
|
|
224
|
+
* <Button>Trigger</Button>
|
|
225
|
+
* </MenuTrigger>
|
|
226
|
+
* <MenuContent>
|
|
227
|
+
* <MenuCheckboxItem
|
|
228
|
+
* checked={checked}
|
|
229
|
+
* onCheckedChange={setChecked}
|
|
230
|
+
* value="checked"
|
|
231
|
+
* >
|
|
232
|
+
* <MenuItemIndicator>✅</MenuItemIndicator>
|
|
233
|
+
* <MenuItemText>Check me</MenuItemText>
|
|
234
|
+
* </MenuCheckboxItem>
|
|
235
|
+
* </MenuContent>
|
|
236
|
+
*/
|
|
237
|
+
// export function MenuItemIndicator(props: ArkMenu.ItemIndicatorProps) {
|
|
238
|
+
// return (
|
|
239
|
+
// <ArkMenu.ItemIndicator
|
|
240
|
+
// {...props}
|
|
241
|
+
// className={cx(props.className, menuStyles.itemIndicator)}
|
|
242
|
+
// />
|
|
243
|
+
// )
|
|
244
|
+
// }
|
|
@@ -17,17 +17,7 @@ export interface NavMenuLinkProps
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @see https://cerberus.digitalu.design/react/nav-menu
|
|
22
|
-
* @example
|
|
23
|
-
* ```tsx
|
|
24
|
-
* <NavMenu>
|
|
25
|
-
* <NavMenuList id="nav-menu-list" position="bottom">
|
|
26
|
-
* <NavMenuLink href="/home">Home</NavMenuLink>
|
|
27
|
-
* <NavMenuLink href="/about">About</NavMenuLink>
|
|
28
|
-
* </NavMenuList>
|
|
29
|
-
* </NavMenu>
|
|
30
|
-
* ```
|
|
20
|
+
* @deprecated use the {@link Menu} family instead
|
|
31
21
|
*/
|
|
32
22
|
export function NavMenuLink(props: NavMenuLinkProps): JSX.Element {
|
|
33
23
|
const { as, ...nativeProps } = props
|
|
@@ -32,9 +32,7 @@ interface GetPositionResult {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
* @param position - The position of the NavMenuList.
|
|
37
|
-
* @returns The position of the NavMenuList.
|
|
35
|
+
* @deprecated use the {@link Menu} family instead
|
|
38
36
|
*/
|
|
39
37
|
export function getPosition(position: Positions): GetPositionResult {
|
|
40
38
|
const defaultPositions = {
|
|
@@ -37,16 +37,7 @@ export interface NavMenuTriggerProps
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @definition [NavMenu Docs](https://cerberus.digitalu.design/react/nav-menu)
|
|
42
|
-
* @example
|
|
43
|
-
* ```tsx
|
|
44
|
-
* <NavMenu>
|
|
45
|
-
* <NavMenuTrigger controls="nav-menu-list">
|
|
46
|
-
* Menu
|
|
47
|
-
* </NavMenuTrigger>
|
|
48
|
-
* </NavMenu>
|
|
49
|
-
* ```
|
|
40
|
+
* @deprecated use the {@link Menu} family instead
|
|
50
41
|
*/
|
|
51
42
|
export function NavMenuTrigger(props: NavMenuTriggerProps): JSX.Element {
|
|
52
43
|
const {
|
package/src/components/Tbody.tsx
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { tbody, type TbodyVariantProps } from '@cerberus/styled-system/recipes'
|
|
2
2
|
import { cx } from '@cerberus/styled-system/css'
|
|
3
|
-
import type { TableHTMLAttributes } from 'react'
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* This module provides a TBody component.
|
|
7
6
|
* @module
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
export type TbodyBaseProps =
|
|
9
|
+
export type TbodyBaseProps = JSX.IntrinsicElements['tbody']
|
|
11
10
|
export type TbodyProps = TbodyBaseProps & TbodyVariantProps
|
|
12
11
|
|
|
13
12
|
/**
|
package/src/components/Td.tsx
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { cx } from '@cerberus/styled-system/css'
|
|
2
2
|
import { td, type TdVariantProps } from '@cerberus/styled-system/recipes'
|
|
3
|
-
import type { TableHTMLAttributes } from 'react'
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Th component for the Td component
|
|
7
6
|
* @module
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
export type TdBaseProps =
|
|
9
|
+
export type TdBaseProps = JSX.IntrinsicElements['td']
|
|
11
10
|
export type TdProps = TdBaseProps & TdVariantProps
|
|
12
11
|
|
|
13
12
|
/**
|
package/src/components/Th.tsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
1
3
|
import { css, cx } from '@cerberus/styled-system/css'
|
|
2
4
|
import { th, type ThVariantProps } from '@cerberus/styled-system/recipes'
|
|
3
|
-
import type { MouseEvent
|
|
5
|
+
import type { MouseEvent } from 'react'
|
|
4
6
|
import { Show } from './Show'
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -8,7 +10,7 @@ import { Show } from './Show'
|
|
|
8
10
|
* @module
|
|
9
11
|
*/
|
|
10
12
|
|
|
11
|
-
export type ThBaseProps =
|
|
13
|
+
export type ThBaseProps = JSX.IntrinsicElements['th'] & {
|
|
12
14
|
/**
|
|
13
15
|
* Converts the Th into a actionable button. Called when the user clicks on
|
|
14
16
|
* the Th.
|
package/src/components/Thead.tsx
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { cx } from '@cerberus/styled-system/css'
|
|
2
2
|
import { thead } from '@cerberus/styled-system/recipes'
|
|
3
|
-
import type { TableHTMLAttributes } from 'react'
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* This module contains the Thead component.
|
|
7
6
|
* @module
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
export type TheadProps =
|
|
9
|
+
export type TheadProps = JSX.IntrinsicElements['thead']
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* The Thead component is used to render a table header.
|
package/src/context/navMenu.tsx
CHANGED
|
@@ -42,8 +42,7 @@ export interface NavMenuContextValue {
|
|
|
42
42
|
const NavMenuContext = createContext<NavMenuContextValue | null>(null)
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
* @see https://cerberus.digitalu.design/react/nav-menu
|
|
45
|
+
* @deprecated use the {@link Menu} family instead
|
|
47
46
|
*/
|
|
48
47
|
export function NavMenu(props: PropsWithChildren): JSX.Element {
|
|
49
48
|
const triggerRef = useRef<HTMLButtonElement>(null)
|
package/src/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ export * from './components/IconButton'
|
|
|
21
21
|
export * from './components/Input'
|
|
22
22
|
export * from './components/Label'
|
|
23
23
|
export * from './components/Legend'
|
|
24
|
+
export * from './components/Menu'
|
|
24
25
|
export * from './components/Modal'
|
|
25
26
|
export * from './components/ModalHeader'
|
|
26
27
|
export * from './components/ModalHeading'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/NavMenuList.tsx"],"sourcesContent":["'use client'\n\nimport { useMemo, type HTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport { vstack } from '@cerberus/styled-system/patterns'\nimport { useNavMenuContext } from '../context/navMenu'\nimport type { Positions } from '../types'\nimport { Show } from './Show'\n\n/**\n * This module contains the NavMenuList component.\n * @module\n */\n\ninterface GetPositionResult {\n /**\n * The left position of the element.\n */\n left: string\n /**\n * The right position of the element.\n */\n right: string\n /**\n * The top position of the element.\n */\n top: string\n /**\n * The bottom position of the element.\n */\n bottom: string\n}\n\n/**\n * Returns the position of the NavMenuList based on the position prop.\n * @param position - The position of the NavMenuList.\n * @returns The position of the NavMenuList.\n */\nexport function getPosition(position: Positions): GetPositionResult {\n const defaultPositions = {\n left: 'auto',\n right: 'auto',\n top: 'auto',\n bottom: 'auto',\n }\n switch (position) {\n case 'right':\n return { ...defaultPositions, top: '0%', left: '105%' }\n case 'left':\n return { ...defaultPositions, top: '0%', right: '105%' }\n case 'bottom':\n return { ...defaultPositions, top: '110%' }\n case 'top':\n return { ...defaultPositions, bottom: '110%' }\n default:\n return defaultPositions\n }\n}\n\nconst navListStyles = vstack({\n alignItems: 'flex-start',\n bgColor: 'page.surface.100',\n boxShadow: 'lg',\n gap: '2',\n opacity: '0',\n p: '4',\n position: 'absolute',\n rounded: 'md',\n zIndex: 'dropdown',\n _motionSafe: {\n animationName: 'zoomIn',\n animationDelay: '100ms',\n animationDuration: '150ms',\n animationFillMode: 'both',\n animationTimingFunction: 'ease-in-out',\n },\n _positionBottom: {\n transformOrigin: 'top left',\n },\n _positionTop: {\n transformOrigin: 'bottom left',\n },\n _positionLeft: {\n transformOrigin: 'top right',\n },\n _positionRight: {\n transformOrigin: 'top left',\n },\n})\n\nexport interface NavMenuListProps extends HTMLAttributes<HTMLUListElement> {\n /**\n * The unique identifier for the NavMenuList. Required for accessibility.\n */\n id: string\n /**\n * The position of the NavMenuList.\n * @type 'top' | 'right' | 'bottom' | 'left'\n * @default 'bottom'\n */\n position?: Positions\n}\n\n/**\n * A component that allows the user to display a menu of navigation links.\n * @definition [Disclosure Nav](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation/)\n * @see https://cerberus.digitalu.design/react/nav-menu\n *\n * @example\n * ```tsx\n * <NavMenu>\n * <NavMenuList id=\"nav-menu-list\" position=\"bottom\">\n * <NavMenuLink href=\"/home\">Home</NavMenuLink>\n * <NavMenuLink href=\"/about\">About</NavMenuLink>\n * </NavMenuList>\n * </NavMenu>\n * ```\n **/\nexport function NavMenuList(props: NavMenuListProps): JSX.Element {\n const { position, ...nativeProps } = props\n const { menuRef, expanded } = useNavMenuContext()\n const locationStyles = useMemo(\n () => getPosition(position ?? 'bottom'),\n [position],\n )\n\n return (\n <Show when={expanded}>\n <ul\n {...nativeProps}\n data-position={position ?? 'bottom'}\n className={cx(nativeProps.className, navListStyles)}\n ref={menuRef}\n style={locationStyles}\n />\n </Show>\n )\n}\n"],"mappings":";;;;;;;;AAEA,SAAS,eAAoC;AAC7C,SAAS,UAAU;AACnB,SAAS,cAAc;AA4HjB;AA1FC,SAAS,YAAY,UAAwC;AAClE,QAAM,mBAAmB;AAAA,IACvB,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,QAAQ;AAAA,EACV;AACA,UAAQ,UAAU;AAAA,IAChB,KAAK;AACH,aAAO,EAAE,GAAG,kBAAkB,KAAK,MAAM,MAAM,OAAO;AAAA,IACxD,KAAK;AACH,aAAO,EAAE,GAAG,kBAAkB,KAAK,MAAM,OAAO,OAAO;AAAA,IACzD,KAAK;AACH,aAAO,EAAE,GAAG,kBAAkB,KAAK,OAAO;AAAA,IAC5C,KAAK;AACH,aAAO,EAAE,GAAG,kBAAkB,QAAQ,OAAO;AAAA,IAC/C;AACE,aAAO;AAAA,EACX;AACF;AAEA,IAAM,gBAAgB,OAAO;AAAA,EAC3B,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,WAAW;AAAA,EACX,KAAK;AAAA,EACL,SAAS;AAAA,EACT,GAAG;AAAA,EACH,UAAU;AAAA,EACV,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,aAAa;AAAA,IACX,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,IACnB,mBAAmB;AAAA,IACnB,yBAAyB;AAAA,EAC3B;AAAA,EACA,iBAAiB;AAAA,IACf,iBAAiB;AAAA,EACnB;AAAA,EACA,cAAc;AAAA,IACZ,iBAAiB;AAAA,EACnB;AAAA,EACA,eAAe;AAAA,IACb,iBAAiB;AAAA,EACnB;AAAA,EACA,gBAAgB;AAAA,IACd,iBAAiB;AAAA,EACnB;AACF,CAAC;AA8BM,SAAS,YAAY,OAAsC;AAChE,QAAM,EAAE,UAAU,GAAG,YAAY,IAAI;AACrC,QAAM,EAAE,SAAS,SAAS,IAAI,kBAAkB;AAChD,QAAM,iBAAiB;AAAA,IACrB,MAAM,YAAY,YAAY,QAAQ;AAAA,IACtC,CAAC,QAAQ;AAAA,EACX;AAEA,SACE,oBAAC,QAAK,MAAM,UACV;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,iBAAe,YAAY;AAAA,MAC3B,WAAW,GAAG,YAAY,WAAW,aAAa;AAAA,MAClD,KAAK;AAAA,MACL,OAAO;AAAA;AAAA,EACT,GACF;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Th.tsx"],"sourcesContent":["import { css, cx } from '@cerberus/styled-system/css'\nimport { th, type ThVariantProps } from '@cerberus/styled-system/recipes'\nimport type { MouseEvent, TableHTMLAttributes } from 'react'\nimport { Show } from './Show'\n\n/**\n * Th component for the Table component\n * @module\n */\n\nexport type ThBaseProps = TableHTMLAttributes<HTMLTableCellElement> & {\n /**\n * Converts the Th into a actionable button. Called when the user clicks on\n * the Th.\n */\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type ThProps = ThBaseProps & ThVariantProps\n\n/**\n * Styles for the Th component\n * @see https://cerberus.digitalu.design/react/table\n * @memberof module:Table\n * @example\n * ```tsx\n * <Th>Header 1</Th>\n * ```\n * @example\n * ```tsx\n * <Th onClick={handleClick}>\n * Names\n * <SortIcon />\n * </Th>\n * ```\n */\nexport function Th(props: ThProps) {\n const { size, onClick, ...nativeProps } = props\n return (\n <Show\n when={Boolean(onClick)}\n fallback={\n <th\n {...nativeProps}\n className={cx(nativeProps.className, th({ size }))}\n />\n }\n >\n <th {...nativeProps}>\n <button\n className={cx(\n nativeProps.className,\n th({ size }),\n css({\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'space-between',\n userSelect: 'none',\n w: 'full',\n _hover: {\n bgColor: 'page.bg.100',\n },\n }),\n )}\n onClick={onClick}\n >\n {props.children}\n </button>\n </th>\n </Show>\n )\n}\n"],"mappings":";;;;;AAAA,SAAS,KAAK,UAAU;AACxB,SAAS,UAA+B;AAwChC;AAND,SAAS,GAAG,OAAgB;AACjC,QAAM,EAAE,MAAM,SAAS,GAAG,YAAY,IAAI;AAC1C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,QAAQ,OAAO;AAAA,MACrB,UACE;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACJ,WAAW,GAAG,YAAY,WAAW,GAAG,EAAE,KAAK,CAAC,CAAC;AAAA;AAAA,MACnD;AAAA,MAGF,8BAAC,QAAI,GAAG,aACN;AAAA,QAAC;AAAA;AAAA,UACC,WAAW;AAAA,YACT,YAAY;AAAA,YACZ,GAAG,EAAE,KAAK,CAAC;AAAA,YACX,IAAI;AAAA,cACF,YAAY;AAAA,cACZ,SAAS;AAAA,cACT,gBAAgB;AAAA,cAChB,YAAY;AAAA,cACZ,GAAG;AAAA,cACH,QAAQ;AAAA,gBACN,SAAS;AAAA,cACX;AAAA,YACF,CAAC;AAAA,UACH;AAAA,UACA;AAAA,UAEC,gBAAM;AAAA;AAAA,MACT,GACF;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/NavMenuLink.tsx"],"sourcesContent":["import type { AnchorHTMLAttributes, ElementType } from 'react'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { Show } from './Show'\n\n/**\n * This module contains the NavMenuLink component.\n * @module\n */\n\nexport interface NavMenuLinkProps\n extends AnchorHTMLAttributes<HTMLAnchorElement> {\n /**\n * The element type to render as. Recommended to use for Next apps with the\n * `Link` component.\n */\n as?: ElementType\n}\n\n/**\n * The NavMenuLink component is a link element that is used within the NavMenu.\n * @see https://cerberus.digitalu.design/react/nav-menu\n * @example\n * ```tsx\n * <NavMenu>\n * <NavMenuList id=\"nav-menu-list\" position=\"bottom\">\n * <NavMenuLink href=\"/home\">Home</NavMenuLink>\n * <NavMenuLink href=\"/about\">About</NavMenuLink>\n * </NavMenuList>\n * </NavMenu>\n * ```\n */\nexport function NavMenuLink(props: NavMenuLinkProps): JSX.Element {\n const { as, ...nativeProps } = props\n const hasAs = Boolean(as)\n const AsSub: ElementType = as!\n\n return (\n <li\n className={css({\n w: 'full',\n })}\n >\n <Show\n when={hasAs}\n fallback={\n <a\n {...nativeProps}\n className={cx(\n nativeProps.className,\n css({\n color: 'action.navigation.initial',\n textStyle: 'link',\n _hover: {\n color: 'action.navigation.hover',\n },\n }),\n )}\n />\n }\n >\n {hasAs && <AsSub {...nativeProps} />}\n </Show>\n </li>\n )\n}\n"],"mappings":";;;;;AACA,SAAS,KAAK,UAAU;AA4Cd;AAdH,SAAS,YAAY,OAAsC;AAChE,QAAM,EAAE,IAAI,GAAG,YAAY,IAAI;AAC/B,QAAM,QAAQ,QAAQ,EAAE;AACxB,QAAM,QAAqB;AAE3B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,IAAI;AAAA,QACb,GAAG;AAAA,MACL,CAAC;AAAA,MAED;AAAA,QAAC;AAAA;AAAA,UACC,MAAM;AAAA,UACN,UACE;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,cACJ,WAAW;AAAA,gBACT,YAAY;AAAA,gBACZ,IAAI;AAAA,kBACF,OAAO;AAAA,kBACP,WAAW;AAAA,kBACX,QAAQ;AAAA,oBACN,OAAO;AAAA,kBACT;AAAA,gBACF,CAAC;AAAA,cACH;AAAA;AAAA,UACF;AAAA,UAGD,mBAAS,oBAAC,SAAO,GAAG,aAAa;AAAA;AAAA,MACpC;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/navMenu.tsx"],"sourcesContent":["'use client'\n\nimport { css } from '@cerberus/styled-system/css'\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n type PropsWithChildren,\n type RefObject,\n} from 'react'\n\n/**\n * This module provides a context and hook for the nav menu.\n * @module NavMenu\n */\n\nexport type NavTriggerRef = RefObject<HTMLButtonElement>\nexport type NavMenuRef = RefObject<HTMLUListElement>\n\nexport interface NavMenuContextValue {\n /**\n * The ref for the trigger button.\n */\n triggerRef: NavTriggerRef | null\n /**\n * The ref for the menu.\n */\n menuRef: NavMenuRef | null\n /**\n * Whether the menu is expanded.\n */\n expanded: boolean\n /**\n * Called when the menu button is clicked.\n */\n onToggle: () => void\n}\n\nconst NavMenuContext = createContext<NavMenuContextValue | null>(null)\n\n/**\n * Provides the nav menu state for all the NavMenu family components.\n * @see https://cerberus.digitalu.design/react/nav-menu\n */\nexport function NavMenu(props: PropsWithChildren): JSX.Element {\n const triggerRef = useRef<HTMLButtonElement>(null)\n const menuRef = useRef<HTMLUListElement>(null)\n const [expanded, setExpanded] = useState<boolean>(false)\n\n const handleToggle = useCallback(() => {\n setExpanded((prev) => !prev)\n }, [])\n\n const value = useMemo(\n () => ({\n triggerRef,\n menuRef,\n expanded,\n onToggle: handleToggle,\n }),\n [expanded, handleToggle],\n )\n\n return (\n <NavMenuContext.Provider value={value}>\n <nav\n className={css({\n position: 'relative',\n })}\n >\n {props.children}\n </nav>\n </NavMenuContext.Provider>\n )\n}\n\n/**\n * Used to access the nav menu context.\n * @returns The nav menu context.\n */\nexport function useNavMenuContext(): NavMenuContextValue {\n const context = useContext(NavMenuContext)\n if (!context) {\n throw new Error('useNavMenuContext must be used within a NavMenu.')\n }\n return context\n}\n"],"mappings":";AAEA,SAAS,WAAW;AACpB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAwDD;AA3BN,IAAM,iBAAiB,cAA0C,IAAI;AAM9D,SAAS,QAAQ,OAAuC;AAC7D,QAAM,aAAa,OAA0B,IAAI;AACjD,QAAM,UAAU,OAAyB,IAAI;AAC7C,QAAM,CAAC,UAAU,WAAW,IAAI,SAAkB,KAAK;AAEvD,QAAM,eAAe,YAAY,MAAM;AACrC,gBAAY,CAAC,SAAS,CAAC,IAAI;AAAA,EAC7B,GAAG,CAAC,CAAC;AAEL,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,IACZ;AAAA,IACA,CAAC,UAAU,YAAY;AAAA,EACzB;AAEA,SACE,oBAAC,eAAe,UAAf,EAAwB,OACvB;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,IAAI;AAAA,QACb,UAAU;AAAA,MACZ,CAAC;AAAA,MAEA,gBAAM;AAAA;AAAA,EACT,GACF;AAEJ;AAMO,SAAS,oBAAyC;AACvD,QAAM,UAAU,WAAW,cAAc;AACzC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/NavMenuTrigger.tsx"],"sourcesContent":["'use client'\n\nimport {\n useCallback,\n type ButtonHTMLAttributes,\n type ElementType,\n type MouseEvent,\n} from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport { button } from '@cerberus/styled-system/recipes'\nimport {\n createNavTriggerProps,\n type NavTriggerAriaValues,\n} from '../aria-helpers/nav-menu.aria'\nimport { useNavMenuContext } from '../context/navMenu'\nimport type { ButtonProps } from './Button'\nimport { Show } from './Show'\n\n/**\n * This module contains the NavMenuTrigger component.\n * @module\n */\n\nexport interface NavMenuTriggerProps\n extends ButtonHTMLAttributes<HTMLButtonElement>,\n ButtonProps,\n NavTriggerAriaValues {\n /**\n * The element type to render as. Recommended to use for an IconButton trigger vs a standard Button.\n * @default 'button'\n * @example\n * ```tsx\n * <NavMenuTrigger as={IconButton} href=\"/home\" />\n * ```\n */\n as?: ElementType\n}\n\n/**\n * A component that allows the user to trigger a navigation menu.\n * @definition [NavMenu Docs](https://cerberus.digitalu.design/react/nav-menu)\n * @example\n * ```tsx\n * <NavMenu>\n * <NavMenuTrigger controls=\"nav-menu-list\">\n * Menu\n * </NavMenuTrigger>\n * </NavMenu>\n * ```\n */\nexport function NavMenuTrigger(props: NavMenuTriggerProps): JSX.Element {\n const {\n as,\n palette,\n usage,\n shape,\n controls,\n expanded: propsExpanded,\n onClick,\n ...nativeProps\n } = props\n const { triggerRef, onToggle, expanded } = useNavMenuContext()\n const ariaProps = createNavTriggerProps({\n controls,\n expanded: propsExpanded ?? expanded,\n })\n const hasAs = Boolean(as)\n const AsSub: ElementType = as!\n\n const handleClick = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n if (onClick) return onClick(e)\n onToggle()\n },\n [onClick, onToggle],\n )\n\n return (\n <Show\n when={hasAs}\n fallback={\n <button\n {...nativeProps}\n {...ariaProps}\n className={cx(\n nativeProps.className,\n button({\n palette,\n usage,\n shape,\n }),\n )}\n onClick={handleClick}\n ref={triggerRef}\n >\n {props.children}\n </button>\n }\n >\n {hasAs && (\n <AsSub\n {...nativeProps}\n {...ariaProps}\n onClick={handleClick}\n ref={triggerRef}\n />\n )}\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;AAEA;AAAA,EACE;AAAA,OAIK;AACP,SAAS,UAAU;AACnB,SAAS,cAAc;AAwEf;AA/BD,SAAS,eAAe,OAAyC;AACtE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,EAAE,YAAY,UAAU,SAAS,IAAI,kBAAkB;AAC7D,QAAM,YAAY,sBAAsB;AAAA,IACtC;AAAA,IACA,UAAU,iBAAiB;AAAA,EAC7B,CAAC;AACD,QAAM,QAAQ,QAAQ,EAAE;AACxB,QAAM,QAAqB;AAE3B,QAAM,cAAc;AAAA,IAClB,CAAC,MAAqC;AACpC,UAAI,QAAS,QAAO,QAAQ,CAAC;AAC7B,eAAS;AAAA,IACX;AAAA,IACA,CAAC,SAAS,QAAQ;AAAA,EACpB;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,UACE;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACH,GAAG;AAAA,UACJ,WAAW;AAAA,YACT,YAAY;AAAA,YACZ,OAAO;AAAA,cACL;AAAA,cACA;AAAA,cACA;AAAA,YACF,CAAC;AAAA,UACH;AAAA,UACA,SAAS;AAAA,UACT,KAAK;AAAA,UAEJ,gBAAM;AAAA;AAAA,MACT;AAAA,MAGD,mBACC;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACH,GAAG;AAAA,UACJ,SAAS;AAAA,UACT,KAAK;AAAA;AAAA,MACP;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|