@gridui/site-navigation 0.0.0-stage → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -2
- package/dist/index.d.ts +9 -0
- package/dist/index.js +145 -0
- package/dist/index.js.map +7 -0
- package/dist/site-navigation/site-navigation.d.ts +25 -0
- package/dist/site-navigation/style.d.ts +7 -0
- package/dist/styles.css +7 -0
- package/package.json +53 -3
package/README.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @gridui/site-navigation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Landing family. Public API: `SiteNavigation`, `SiteNavigationLink`, `SiteNavigationProps`.
|
|
4
|
+
|
|
5
|
+
Import components from `@gridui/site-navigation` and load `@gridui/site-navigation/styles.css` after Theme.
|
|
6
|
+
Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
|
|
7
|
+
|
|
8
|
+
See [component ownership](../../docs/component-ownership.md) and [release history](.changeset/history/).
|
|
9
|
+
|
|
10
|
+
## Rich navigation menus
|
|
11
|
+
|
|
12
|
+
SiteNavigation combines `@gridui/responsive-navigation`, `@gridui/menu`,
|
|
13
|
+
`@gridui/drawer`, and `@gridui/button`. Applications supply links, localized labels,
|
|
14
|
+
preferences, desktop content, and optional mobile content/footer slots.
|
|
15
|
+
|
|
16
|
+
ResponsiveNavigation owns desktop/mobile switching. Menu owns content-neutral
|
|
17
|
+
navigation parts. Drawer owns modal focus management, scroll locking, start/end
|
|
18
|
+
placement, dismissal, and its header/body/footer parts. The independent Popover
|
|
19
|
+
family owns desktop hover intent. SiteHeader supplies a separate frame shell
|
|
20
|
+
with caller-owned branding.
|
|
21
|
+
|
|
22
|
+
Set `columns={1}` on a MenuGrid passed as mobile content; the composition does
|
|
23
|
+
not select its private descendants. Load rendered dependency styles before
|
|
24
|
+
SiteNavigation styles.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Site Navigation
|
|
4
|
+
* @namespace Root
|
|
5
|
+
* @description Index
|
|
6
|
+
*/
|
|
7
|
+
export type { SiteNavigationLink } from "./site-navigation/site-navigation";
|
|
8
|
+
export type { SiteNavigationProps } from "./site-navigation/site-navigation";
|
|
9
|
+
export { SiteNavigation } from "./site-navigation/site-navigation";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// src/site-navigation/style.ts
|
|
2
|
+
import { cn } from "@gridui/style-utils";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
var navigationActionsStyles = cva(cn(
|
|
5
|
+
"gridui-navigation-actions",
|
|
6
|
+
"ms-auto"
|
|
7
|
+
));
|
|
8
|
+
|
|
9
|
+
// src/site-navigation/site-navigation.tsx
|
|
10
|
+
import { Button } from "@gridui/button";
|
|
11
|
+
import { DrawerBody, DrawerCloseButton, DrawerFooter, DrawerHeader, DrawerPanel, DrawerTitle, DrawerTrigger } from "@gridui/drawer";
|
|
12
|
+
import { MenuGroup, MenuItemContent, MenuItemLabel, MenuLabel, MenuLink, MenuSeparator, NavigationLinks } from "@gridui/menu";
|
|
13
|
+
import { DesktopNavigation, MobileNavigation, ResponsiveDrawer, ResponsiveNavigation } from "@gridui/responsive-navigation";
|
|
14
|
+
import { cn as cn2 } from "@gridui/style-utils";
|
|
15
|
+
import { Menu } from "lucide-react";
|
|
16
|
+
import { useId } from "react";
|
|
17
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
var SiteNavigation = (props) => {
|
|
19
|
+
const {
|
|
20
|
+
label,
|
|
21
|
+
links,
|
|
22
|
+
menuLabel,
|
|
23
|
+
closeLabel,
|
|
24
|
+
settingsLabel,
|
|
25
|
+
preferences,
|
|
26
|
+
mobilePreferences,
|
|
27
|
+
desktopContent,
|
|
28
|
+
mobileContent,
|
|
29
|
+
mobileFooter
|
|
30
|
+
} = props;
|
|
31
|
+
const id = useId();
|
|
32
|
+
return /* @__PURE__ */ jsxs(ResponsiveNavigation, { children: [
|
|
33
|
+
/* @__PURE__ */ jsxs(DesktopNavigation, { children: [
|
|
34
|
+
/* @__PURE__ */ jsxs(
|
|
35
|
+
NavigationLinks,
|
|
36
|
+
{
|
|
37
|
+
"aria-label": label,
|
|
38
|
+
children: [
|
|
39
|
+
links.map((link) => {
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
"a",
|
|
42
|
+
{
|
|
43
|
+
href: link.href,
|
|
44
|
+
"aria-current": link.current ? "page" : void 0,
|
|
45
|
+
children: link.label
|
|
46
|
+
},
|
|
47
|
+
link.href
|
|
48
|
+
);
|
|
49
|
+
}),
|
|
50
|
+
desktopContent
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: cn2(navigationActionsStyles()),
|
|
58
|
+
children: preferences
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] }),
|
|
62
|
+
/* @__PURE__ */ jsx(MobileNavigation, { children: /* @__PURE__ */ jsxs(ResponsiveDrawer, { children: [
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
DrawerTrigger,
|
|
65
|
+
{
|
|
66
|
+
asChild: true,
|
|
67
|
+
children: /* @__PURE__ */ jsx(
|
|
68
|
+
Button,
|
|
69
|
+
{
|
|
70
|
+
variant: "quiet",
|
|
71
|
+
size: "standard",
|
|
72
|
+
layout: "icon",
|
|
73
|
+
"aria-label": menuLabel,
|
|
74
|
+
title: menuLabel,
|
|
75
|
+
children: /* @__PURE__ */ jsx(
|
|
76
|
+
Menu,
|
|
77
|
+
{
|
|
78
|
+
"aria-hidden": "true"
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ jsxs(DrawerPanel, { children: [
|
|
86
|
+
/* @__PURE__ */ jsxs(DrawerHeader, { children: [
|
|
87
|
+
/* @__PURE__ */ jsx(DrawerTitle, { children: menuLabel }),
|
|
88
|
+
/* @__PURE__ */ jsx(
|
|
89
|
+
DrawerCloseButton,
|
|
90
|
+
{
|
|
91
|
+
"aria-label": closeLabel
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ jsxs(DrawerBody, { children: [
|
|
96
|
+
/* @__PURE__ */ jsxs(
|
|
97
|
+
"nav",
|
|
98
|
+
{
|
|
99
|
+
"aria-label": label,
|
|
100
|
+
children: [
|
|
101
|
+
links.map((link) => {
|
|
102
|
+
return /* @__PURE__ */ jsx(
|
|
103
|
+
MenuLink,
|
|
104
|
+
{
|
|
105
|
+
href: link.href,
|
|
106
|
+
"aria-current": link.current ? "page" : void 0,
|
|
107
|
+
children: /* @__PURE__ */ jsx(MenuItemContent, { children: /* @__PURE__ */ jsx(MenuItemLabel, { children: link.label }) })
|
|
108
|
+
},
|
|
109
|
+
link.href
|
|
110
|
+
);
|
|
111
|
+
}),
|
|
112
|
+
mobileContent && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
113
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
114
|
+
mobileContent
|
|
115
|
+
] })
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
120
|
+
/* @__PURE__ */ jsxs(
|
|
121
|
+
MenuGroup,
|
|
122
|
+
{
|
|
123
|
+
"aria-labelledby": `${id}-settings`,
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ jsx(
|
|
126
|
+
MenuLabel,
|
|
127
|
+
{
|
|
128
|
+
id: `${id}-settings`,
|
|
129
|
+
children: settingsLabel
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
mobilePreferences
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
] }),
|
|
137
|
+
mobileFooter && /* @__PURE__ */ jsx(DrawerFooter, { children: mobileFooter })
|
|
138
|
+
] })
|
|
139
|
+
] }) })
|
|
140
|
+
] });
|
|
141
|
+
};
|
|
142
|
+
export {
|
|
143
|
+
SiteNavigation
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/site-navigation/style.ts", "../src/site-navigation/site-navigation.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package Site Navigation\n * @namespace SiteNavigation\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const navigationActionsStyles = cva(cn(\n \"gridui-navigation-actions\",\n \"ms-auto\",\n));\n", "/**\n * @author WMXPY\n * @package Site Navigation\n * @namespace SiteNavigation\n * @description Site Navigation\n */\n\nimport { navigationActionsStyles } from \"./style\";\nimport { Button } from \"@gridui/button\";\nimport { DrawerBody, DrawerCloseButton, DrawerFooter, DrawerHeader, DrawerPanel, DrawerTitle, DrawerTrigger } from \"@gridui/drawer\";\nimport { MenuGroup, MenuItemContent, MenuItemLabel, MenuLabel, MenuLink, MenuSeparator, NavigationLinks } from \"@gridui/menu\";\nimport { DesktopNavigation, MobileNavigation, ResponsiveDrawer, ResponsiveNavigation } from \"@gridui/responsive-navigation\";\nimport { cn } from \"@gridui/style-utils\";\nimport { Menu } from \"lucide-react\";\nimport { type FC, type ReactNode, useId } from \"react\";\n\nexport type SiteNavigationLink = {\n readonly href: string;\n readonly label: string;\n readonly current?: boolean;\n};\n\nexport type SiteNavigationProps = {\n readonly label: string;\n readonly links: readonly SiteNavigationLink[];\n readonly menuLabel: string;\n readonly closeLabel: string;\n readonly settingsLabel: string;\n readonly preferences: ReactNode;\n readonly mobilePreferences: ReactNode;\n readonly desktopContent?: ReactNode;\n readonly mobileContent?: ReactNode;\n readonly mobileFooter?: ReactNode;\n};\n\nexport const SiteNavigation: FC<SiteNavigationProps> = (props: SiteNavigationProps) => {\n const {\n label,\n links,\n menuLabel,\n closeLabel,\n settingsLabel,\n preferences,\n mobilePreferences,\n desktopContent,\n mobileContent,\n mobileFooter,\n } = props;\n const id = useId();\n return (<ResponsiveNavigation>\n <DesktopNavigation>\n <NavigationLinks\n aria-label={label}\n >\n {links.map((link) => {\n return (<a\n key={link.href}\n href={link.href}\n aria-current={link.current ? \"page\" : undefined}\n >\n {link.label}\n </a>);\n })}\n {desktopContent}\n </NavigationLinks>\n <div\n className={cn(navigationActionsStyles())}\n >\n {preferences}\n </div>\n </DesktopNavigation>\n <MobileNavigation>\n <ResponsiveDrawer>\n <DrawerTrigger\n asChild\n >\n <Button\n variant=\"quiet\"\n size=\"standard\"\n layout=\"icon\"\n aria-label={menuLabel}\n title={menuLabel}\n >\n <Menu\n aria-hidden=\"true\"\n />\n </Button>\n </DrawerTrigger>\n <DrawerPanel>\n <DrawerHeader>\n <DrawerTitle >\n {menuLabel}\n </DrawerTitle>\n <DrawerCloseButton\n aria-label={closeLabel}\n />\n </DrawerHeader>\n <DrawerBody>\n <nav\n aria-label={label}\n >\n {links.map((link) => {\n return (<MenuLink\n key={link.href}\n href={link.href}\n aria-current={link.current ? \"page\" : undefined}\n >\n <MenuItemContent>\n <MenuItemLabel>\n {link.label}\n </MenuItemLabel>\n </MenuItemContent>\n </MenuLink>);\n })}\n {mobileContent && (<>\n <MenuSeparator />\n {mobileContent}\n </>)}\n </nav>\n <MenuSeparator />\n <MenuGroup\n aria-labelledby={`${id}-settings`}\n >\n <MenuLabel\n id={`${id}-settings`}\n >\n {settingsLabel}\n </MenuLabel>\n {mobilePreferences}\n </MenuGroup>\n </DrawerBody>\n {mobileFooter && (<DrawerFooter>\n {mobileFooter}\n </DrawerFooter>)}\n </DrawerPanel>\n </ResponsiveDrawer>\n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,QAAO;AAAA,cACP,cAAY;AAAA,cACZ,OAAO;AAAA,cAEP;AAAA,gBAAC;AAAA;AAAA,kBACG,eAAY;AAAA;AAAA,cAChB;AAAA;AAAA,UACJ;AAAA;AAAA,MACJ;AAAA,MACA,qBAAC,eACG;AAAA,6BAAC,gBACG;AAAA,8BAAC,eACI,qBACL;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACG,cAAY;AAAA;AAAA,UAChB;AAAA,WACJ;AAAA,QACA,qBAAC,cACG;AAAA;AAAA,YAAC;AAAA;AAAA,cACG,cAAY;AAAA,cAEX;AAAA,sBAAM,IAAI,CAAC,SAAS;AACjB,yBAAQ;AAAA,oBAAC;AAAA;AAAA,sBAEL,MAAM,KAAK;AAAA,sBACX,gBAAc,KAAK,UAAU,SAAS;AAAA,sBAEtC,8BAAC,mBACG,8BAAC,iBACI,eAAK,OACV,GACJ;AAAA;AAAA,oBARK,KAAK;AAAA,kBASd;AAAA,gBACJ,CAAC;AAAA,gBACA,iBAAkB,iCACf;AAAA,sCAAC,iBAAc;AAAA,kBACd;AAAA,mBACL;AAAA;AAAA;AAAA,UACJ;AAAA,UACA,oBAAC,iBAAc;AAAA,UACf;AAAA,YAAC;AAAA;AAAA,cACG,mBAAiB,GAAG,EAAE;AAAA,cAEtB;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACG,IAAI,GAAG,EAAE;AAAA,oBAER;AAAA;AAAA,gBACL;AAAA,gBACC;AAAA;AAAA;AAAA,UACL;AAAA,WACJ;AAAA,QACC,gBAAiB,oBAAC,gBACd,wBACL;AAAA,SACJ;AAAA,OACJ,GACJ;AAAA,KACJ;AACJ;",
|
|
6
|
+
"names": ["cn"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Site Navigation
|
|
4
|
+
* @namespace SiteNavigation
|
|
5
|
+
* @description Site Navigation
|
|
6
|
+
*/
|
|
7
|
+
import { type FC, type ReactNode } from "react";
|
|
8
|
+
export type SiteNavigationLink = {
|
|
9
|
+
readonly href: string;
|
|
10
|
+
readonly label: string;
|
|
11
|
+
readonly current?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type SiteNavigationProps = {
|
|
14
|
+
readonly label: string;
|
|
15
|
+
readonly links: readonly SiteNavigationLink[];
|
|
16
|
+
readonly menuLabel: string;
|
|
17
|
+
readonly closeLabel: string;
|
|
18
|
+
readonly settingsLabel: string;
|
|
19
|
+
readonly preferences: ReactNode;
|
|
20
|
+
readonly mobilePreferences: ReactNode;
|
|
21
|
+
readonly desktopContent?: ReactNode;
|
|
22
|
+
readonly mobileContent?: ReactNode;
|
|
23
|
+
readonly mobileFooter?: ReactNode;
|
|
24
|
+
};
|
|
25
|
+
export declare const SiteNavigation: FC<SiteNavigationProps>;
|
package/dist/styles.css
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/site-navigation",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "GridUI React site navigation",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"**/*.css"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./styles.css": "./dist/styles.css"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": "^19.2.0",
|
|
26
|
+
"react-dom": "^19.2.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@gridui/button": "^2.1.1",
|
|
30
|
+
"@gridui/drawer": "^0.0.0",
|
|
31
|
+
"@gridui/menu": "^0.0.0",
|
|
32
|
+
"@gridui/responsive-navigation": "^0.0.0",
|
|
33
|
+
"@gridui/style-utils": "^2.1.2",
|
|
34
|
+
"@gridui/theme": "^2.1.2",
|
|
35
|
+
"class-variance-authority": "0.7.1",
|
|
36
|
+
"lucide-react": "1.62.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@gridui-internal/configuration": "0.0.0",
|
|
40
|
+
"@jest/globals": "30.5.2",
|
|
41
|
+
"@types/jest": "30.0.0",
|
|
42
|
+
"@types/node": "26.6.5",
|
|
43
|
+
"@types/react": "19.3.0",
|
|
44
|
+
"@types/react-dom": "19.3.0",
|
|
45
|
+
"jest": "30.5.2",
|
|
46
|
+
"react": "19.3.1",
|
|
47
|
+
"react-dom": "19.3.1",
|
|
48
|
+
"typescript": "6.0.3"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "node ../../scripts/compilation/package.ts",
|
|
52
|
+
"compile": "tsc --project tsconfig.json",
|
|
53
|
+
"test": "jest",
|
|
54
|
+
"coverage": "jest --coverage"
|
|
55
|
+
}
|
|
6
56
|
}
|