@knkcs/anker 2.3.1 → 2.4.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/CLAUDE-ANKER.md +3 -0
- package/dist/atoms/index.js +1 -1
- package/dist/{chunk-L7SKAZX3.js → chunk-PLXVGYFW.js} +9 -3
- package/dist/chunk-PLXVGYFW.js.map +1 -0
- package/dist/components/index.d.ts +46 -1
- package/dist/components/index.js +157 -110
- package/dist/components/index.js.map +1 -1
- package/dist/feedback/index.js +1 -1
- package/dist/templates/index.d.ts +36 -1
- package/dist/templates/index.js +122 -3
- package/dist/templates/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-L7SKAZX3.js.map +0 -1
package/CLAUDE-ANKER.md
CHANGED
|
@@ -89,9 +89,12 @@ Available templates:
|
|
|
89
89
|
| `<ErrorPage>` | 404 / 500 / 403 |
|
|
90
90
|
| `<LoadingPage>` | Initial app boot |
|
|
91
91
|
| `<MaintenancePage>` | Service-down screens |
|
|
92
|
+
| `<SubNavLayout>` | Multi-resource navigation inside a `<DetailPageTemplate>` tab body — grouped vertical nav (left) + detail pane (right) with collapse toggle and `localStorage` persistence. |
|
|
92
93
|
|
|
93
94
|
**Rule:** if a template doesn't fit your page, file an issue — don't reinvent the layout.
|
|
94
95
|
|
|
96
|
+
- For multi-resource navigation inside a tab body, use `<SubNavLayout>` rather than rolling your own master-detail. It owns collapse state, persistence, and the divider — wire `<NavList.Item asChild>` to `<NavLink>` for URL deep-linking.
|
|
97
|
+
|
|
95
98
|
Full spec with composition diagrams, slot tables, and authoring rules: `docs/page-patterns.md` in the anker repo (linked from the GitHub Pages docs site).
|
|
96
99
|
|
|
97
100
|
---
|
package/dist/atoms/index.js
CHANGED
|
@@ -6,9 +6,9 @@ export { SearchInput } from '../chunk-E7KRPPCQ.js';
|
|
|
6
6
|
import { Textarea } from '../chunk-NFZMG6ZL.js';
|
|
7
7
|
import { text_input_default } from '../chunk-OU6H3KU4.js';
|
|
8
8
|
export { text_input_default as TextInput } from '../chunk-OU6H3KU4.js';
|
|
9
|
+
import { Spinner } from '../chunk-5YDCDC4B.js';
|
|
9
10
|
import { IconButton, Button } from '../chunk-JS7ZEZV3.js';
|
|
10
11
|
export { Button, IconButton } from '../chunk-JS7ZEZV3.js';
|
|
11
|
-
import { Spinner } from '../chunk-5YDCDC4B.js';
|
|
12
12
|
import { Text, Box, Stack as Stack$1, Flex, HStack, Heading } from '../chunk-G4QMIXLC.js';
|
|
13
13
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
14
|
import { DataList as DataList$1, Icon, Circle, useCheckboxGroup, Stack, Box as Box$1, Clipboard, IconButton as IconButton$1, Input, chakra, ButtonGroup, Button as Button$1, Square } from '@chakra-ui/react';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Box, Flex, Text, Heading, Link } from './chunk-G4QMIXLC.js';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
3
4
|
|
|
4
5
|
var SIZE_TO_WIDTH = {
|
|
5
6
|
md: "440px",
|
|
@@ -101,6 +102,11 @@ var AuthCard = ({
|
|
|
101
102
|
) });
|
|
102
103
|
};
|
|
103
104
|
AuthCard.displayName = "AuthCard";
|
|
105
|
+
var NavListModeContext = createContext(null);
|
|
106
|
+
var NavListModeProvider = NavListModeContext.Provider;
|
|
107
|
+
function useNavListMode() {
|
|
108
|
+
return useContext(NavListModeContext) ?? { collapsed: false };
|
|
109
|
+
}
|
|
104
110
|
var PageHeader = ({
|
|
105
111
|
breadcrumbs,
|
|
106
112
|
title,
|
|
@@ -211,6 +217,6 @@ var PageHeader = ({
|
|
|
211
217
|
};
|
|
212
218
|
PageHeader.displayName = "PageHeader";
|
|
213
219
|
|
|
214
|
-
export { AuthCard, PageHeader };
|
|
215
|
-
//# sourceMappingURL=chunk-
|
|
216
|
-
//# sourceMappingURL=chunk-
|
|
220
|
+
export { AuthCard, NavListModeProvider, PageHeader, useNavListMode };
|
|
221
|
+
//# sourceMappingURL=chunk-PLXVGYFW.js.map
|
|
222
|
+
//# sourceMappingURL=chunk-PLXVGYFW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/auth-card.tsx","../src/components/nav-list/nav-list-context.tsx","../src/components/page-header.tsx"],"names":["jsxs","jsx"],"mappings":";;;;AAgCA,IAAM,aAAA,GAAoE;AAAA,EACzE,EAAA,EAAI,OAAA;AAAA,EACJ,EAAA,EAAI;AACL,CAAA;AAEA,IAAM,cAAA,GACL,wEAAA;AAEM,IAAM,WAAW,CAAC;AAAA,EACxB,IAAA;AAAA,EACA,WAAA;AAAA,EACA,UAAA,GAAa,KAAA;AAAA,EACb,cAAA,GAAiB,KAAA;AAAA,EACjB,OAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA,GAAO,IAAA;AAAA,EACP,MAAA;AAAA,EACA;AACD,CAAA,KAAqB;AACpB,EAAA,uBACC,GAAA,CAAC,OAAI,aAAA,EAAY,WAAA,EAAY,aAAW,IAAA,EAAM,IAAA,EAAK,OAAA,EAAQ,EAAA,EAAG,WAAA,EAC7D,QAAA,kBAAA,IAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACA,aAAA,EAAY,kBAAA;AAAA,MACZ,iBAAA,EAAiB,iBAAiB,QAAA,GAAW,SAAA;AAAA,MAC7C,IAAA,EAAK,OAAA;AAAA,MACL,OAAA,EAAS,iBAAiB,MAAA,GAAY,cAAA;AAAA,MACtC,MAAA,EAAO,WAAA;AAAA,MAEN,QAAA,EAAA;AAAA,QAAA,CAAC,UAAA,oBACD,IAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACA,KAAA,EAAM,QAAA;AAAA,YACN,OAAA,EAAQ,eAAA;AAAA,YACR,EAAA,EAAG,GAAA;AAAA,YACH,EAAA,EAAG,GAAA;AAAA,YACH,EAAA,EAAG,eAAA;AAAA,Y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A;AAAA;AAAA,eACF;AAAA,cACC,MAAA,oBACAA,GAAAA,CAAC,IAAA,EAAA,EAAK,aAAA,EAAY,sBAAqB,KAAA,EAAM,QAAA,EAAS,GAAA,EAAI,GAAA,EACxD,QAAA,EAAA,MAAA,EACF;AAAA,aAAA,EAEF,CAAA;AAAA,YACC,4BACAA,GAAAA;AAAA,cAAC,IAAA;AAAA,cAAA;AAAA,gBACA,aAAA,EAAY,sBAAA;AAAA,gBACZ,QAAA,EAAS,IAAA;AAAA,gBACT,KAAA,EAAM,OAAA;AAAA,gBACN,EAAA,EAAG,GAAA;AAAA,gBAEF,QAAA,EAAA;AAAA;AAAA,aACF;AAAA,YAEA,IAAA,oBACAA,GAAAA,CAAC,GAAA,EAAA,EAAI,eAAY,kBAAA,EAAmB,EAAA,EAAG,KACrC,QAAA,EAAA,IAAA,EACF;AAAA,WAAA,EAEF,CAAA;AAAA,UACC,UAAA,oBACAA,GAAAA,CAAC,IAAA,EAAA,EAAK,KAAA,EAAM,UAAS,GAAA,EAAI,GAAA,EAAI,UAAA,EAAY,CAAA,EACvC,QAAA,EAAA,OAAA,EACF;AAAA,SAAA,EAEF,CAAA;AAAA,QACC,IAAA,oBACAA,GAAAA,CAAC,GAAA,EAAA,EAAI,aAAA,EAAY,kBAAA,EAAmB,EAAA,EAAG,GAAA,EAAI,EAAA,EAAG,IAAA,EAAK,EAAA,EAAG,IAAA,EACpD,QAAA,EAAA,IAAA,EACF;AAAA;AAAA;AAAA,GAEF;AAEF;AACA,UAAA,CAAW,WAAA,GAAc,YAAA","file":"chunk-PLXVGYFW.js","sourcesContent":["// src/components/auth-card.tsx\nimport type React from \"react\";\nimport { Box, Flex } from \"../primitives/layout\";\nimport { Heading, Text } from \"../primitives/typography\";\n\nexport interface AuthCardProps {\n\t/** Logo or wordmark, far-left of the topbar. */\n\tlogo?: React.ReactNode;\n\t/** Right-side topbar content (help link, locale switcher, etc.). */\n\ttopBarRight?: React.ReactNode;\n\t/** Hide the topbar entirely (rare — e.g. embedded preview). */\n\thideTopBar?: boolean;\n\t/** Hide the dot-grid background (rare — e.g. printable). */\n\thideBackground?: boolean;\n\t/** Small uppercase eyebrow above the title. */\n\teyebrow?: React.ReactNode;\n\t/**\n\t * Card title. Accepts a string or inline element — the component wraps\n\t * it in an `<h3>` (semantic heading, 24px, semibold, default color).\n\t * Avoid passing block elements (e.g. `<div>`) or pre-built headings.\n\t */\n\ttitle?: React.ReactNode;\n\t/** Subtitle below title (14px, muted color, centered). */\n\tsubtitle?: React.ReactNode;\n\t/** Card width preset. md = 440px (default), lg = 480px. */\n\tsize?: \"md\" | \"lg\";\n\t/** Card footer slot. Bottom-bordered inside the card. */\n\tfooter?: React.ReactNode;\n\t/** Page content inside the card body. */\n\tchildren: React.ReactNode;\n}\n\nconst SIZE_TO_WIDTH: Record<NonNullable<AuthCardProps[\"size\"]>, string> = {\n\tmd: \"440px\",\n\tlg: \"480px\",\n};\n\nconst DOT_PATTERN_BG =\n\t\"radial-gradient(var(--chakra-colors-primary-200) 1px, transparent 1px)\";\n\nexport const AuthCard = ({\n\tlogo,\n\ttopBarRight,\n\thideTopBar = false,\n\thideBackground = false,\n\teyebrow,\n\ttitle,\n\tsubtitle,\n\tsize = \"md\",\n\tfooter,\n\tchildren,\n}: AuthCardProps) => {\n\treturn (\n\t\t<Box data-testid=\"auth-card\" data-size={size} minH=\"100vh\" bg=\"bg-canvas\">\n\t\t\t<Box\n\t\t\t\tdata-testid=\"auth-card-canvas\"\n\t\t\t\tdata-background={hideBackground ? \"hidden\" : \"visible\"}\n\t\t\t\tminH=\"100vh\"\n\t\t\t\tbgImage={hideBackground ? undefined : DOT_PATTERN_BG}\n\t\t\t\tbgSize=\"24px 24px\"\n\t\t\t>\n\t\t\t\t{!hideTopBar && (\n\t\t\t\t\t<Flex\n\t\t\t\t\t\talign=\"center\"\n\t\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t\t\tpx=\"8\"\n\t\t\t\t\t\tpy=\"4\"\n\t\t\t\t\t\tbg=\"bg-surface/85\"\n\t\t\t\t\t\tbackdropFilter=\"blur(4px)\"\n\t\t\t\t\t\tborderBottom=\"1px solid\"\n\t\t\t\t\t\tborderColor=\"border\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Box>{logo}</Box>\n\t\t\t\t\t\t<Flex gap=\"4\" fontSize=\"xs\" color=\"muted\">\n\t\t\t\t\t\t\t{topBarRight}\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t</Flex>\n\t\t\t\t)}\n\n\t\t\t\t<Flex justify=\"center\" pt=\"16\" px=\"4\">\n\t\t\t\t\t<Box\n\t\t\t\t\t\tw=\"full\"\n\t\t\t\t\t\tmaxW={SIZE_TO_WIDTH[size]}\n\t\t\t\t\t\tbg=\"bg-surface\"\n\t\t\t\t\t\tborderRadius=\"lg\"\n\t\t\t\t\t\tshadow=\"md\"\n\t\t\t\t\t\tp=\"8\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{eyebrow && (\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\ttextStyle=\"overline\"\n\t\t\t\t\t\t\t\tcolor=\"muted\"\n\t\t\t\t\t\t\t\ttextAlign=\"center\"\n\t\t\t\t\t\t\t\tmb=\"2\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{eyebrow}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{title && (\n\t\t\t\t\t\t\t<Heading\n\t\t\t\t\t\t\t\tas=\"h3\"\n\t\t\t\t\t\t\t\tsize=\"2xl\"\n\t\t\t\t\t\t\t\tfontWeight=\"semibold\"\n\t\t\t\t\t\t\t\tcolor=\"default\"\n\t\t\t\t\t\t\t\ttextAlign=\"center\"\n\t\t\t\t\t\t\t\tmb=\"2\"\n\t\t\t\t\t\t\t\tletterSpacing=\"-0.02em\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{subtitle && (\n\t\t\t\t\t\t\t<Text color=\"muted\" textAlign=\"center\" fontSize=\"sm\" mb=\"6\">\n\t\t\t\t\t\t\t\t{subtitle}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t{children}\n\n\t\t\t\t\t\t{footer && (\n\t\t\t\t\t\t\t<Box\n\t\t\t\t\t\t\t\tdata-testid=\"auth-card-footer\"\n\t\t\t\t\t\t\t\tmt=\"6\"\n\t\t\t\t\t\t\t\tpt=\"4\"\n\t\t\t\t\t\t\t\tborderTop=\"1px solid\"\n\t\t\t\t\t\t\t\tborderColor=\"border\"\n\t\t\t\t\t\t\t\ttextAlign=\"center\"\n\t\t\t\t\t\t\t\tfontSize=\"xs\"\n\t\t\t\t\t\t\t\tcolor=\"emphasized\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{footer}\n\t\t\t\t\t\t\t</Box>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Box>\n\t\t\t\t</Flex>\n\t\t\t</Box>\n\t\t</Box>\n\t);\n};\nAuthCard.displayName = \"AuthCard\";\n","// src/components/nav-list/nav-list-context.tsx\nimport { createContext, useContext } from \"react\";\n\nexport interface NavListMode {\n\t/** When true, NavList items render icon-only with tooltips. */\n\tcollapsed: boolean;\n}\n\nconst NavListModeContext = createContext<NavListMode | null>(null);\n\nexport const NavListModeProvider = NavListModeContext.Provider;\n\n/**\n * Read the collapsed mode published by the nearest parent\n * (Sidebar, SubNavLayout, etc.). Returns `{ collapsed: false }`\n * when no provider is present — NavList is usable standalone.\n */\nexport function useNavListMode(): NavListMode {\n\treturn useContext(NavListModeContext) ?? { collapsed: false };\n}\n","// src/components/page-header.tsx\nimport type React from \"react\";\nimport { Box, Flex } from \"../primitives/layout\";\nimport { Heading, Link, Text } from \"../primitives/typography\";\n\nexport interface PageHeaderBreadcrumb {\n\tlabel: string;\n\tto?: string;\n}\n\nexport interface PageHeaderProps {\n\tbreadcrumbs?: PageHeaderBreadcrumb[];\n\ttitle: React.ReactNode;\n\tsubtitle?: React.ReactNode;\n\tactions?: React.ReactNode;\n\tavatar?: React.ReactNode;\n\tbadges?: React.ReactNode;\n\teyebrow?: React.ReactNode;\n\tmeta?: React.ReactNode;\n\ttabs?: React.ReactNode;\n}\n\nexport const PageHeader = ({\n\tbreadcrumbs,\n\ttitle,\n\tsubtitle,\n\tactions,\n\tavatar,\n\tbadges,\n\teyebrow,\n\tmeta,\n\ttabs,\n}: PageHeaderProps) => {\n\tconst hasCrumbs = !!breadcrumbs && breadcrumbs.length > 0;\n\tconst hasActions = !!actions;\n\n\treturn (\n\t\t<Box\n\t\t\tpy=\"4\"\n\t\t\tpx=\"8\"\n\t\t\tborderBottomWidth=\"1px\"\n\t\t\tborderBottomColor=\"border\"\n\t\t\tbg=\"bg-surface\"\n\t\t>\n\t\t\t{eyebrow && (\n\t\t\t\t<Text\n\t\t\t\t\tfontSize=\"2xs\"\n\t\t\t\t\tfontWeight=\"semibold\"\n\t\t\t\t\tletterSpacing=\"wider\"\n\t\t\t\t\ttextTransform=\"uppercase\"\n\t\t\t\t\tcolor=\"muted\"\n\t\t\t\t\tmb=\"1\"\n\t\t\t\t>\n\t\t\t\t\t{eyebrow}\n\t\t\t\t</Text>\n\t\t\t)}\n\n\t\t\t{hasCrumbs && (\n\t\t\t\t<Flex\n\t\t\t\t\tdata-testid=\"page-header-breadcrumbs\"\n\t\t\t\t\talign=\"center\"\n\t\t\t\t\tgap=\"1\"\n\t\t\t\t\tmb=\"1\"\n\t\t\t\t\tfontSize=\"xs\"\n\t\t\t\t\tcolor=\"muted\"\n\t\t\t\t>\n\t\t\t\t\t{breadcrumbs.map((c, idx) => {\n\t\t\t\t\t\tconst isLast = idx === breadcrumbs.length - 1;\n\t\t\t\t\t\tconst sep = !isLast ? <span aria-hidden> › </span> : null;\n\t\t\t\t\t\tconst node = c.to ? (\n\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\tkey={`crumb-link-${c.label}`}\n\t\t\t\t\t\t\t\thref={c.to}\n\t\t\t\t\t\t\t\tcolor=\"muted\"\n\t\t\t\t\t\t\t\t_hover={{ color: \"default\" }}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{c.label}\n\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tkey={`crumb-text-${c.label}`}\n\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\tcolor={isLast ? \"default\" : \"muted\"}\n\t\t\t\t\t\t\t\tfontWeight={isLast ? \"medium\" : \"normal\"}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{c.label}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Flex key={`crumb-wrap-${c.label}`} align=\"center\" gap=\"1\">\n\t\t\t\t\t\t\t\t{node}\n\t\t\t\t\t\t\t\t{sep}\n\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t);\n\t\t\t\t\t})}\n\t\t\t\t</Flex>\n\t\t\t)}\n\n\t\t\t<Flex align=\"flex-start\" justify=\"space-between\" gap=\"4\">\n\t\t\t\t{avatar && (\n\t\t\t\t\t<Box data-testid=\"page-header-avatar\" flexShrink={0}>\n\t\t\t\t\t\t{avatar}\n\t\t\t\t\t</Box>\n\t\t\t\t)}\n\t\t\t\t<Box flex=\"1\" minW=\"0\">\n\t\t\t\t\t<Flex align=\"center\" gap=\"2\" wrap=\"wrap\">\n\t\t\t\t\t\t<Heading\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\tfontSize=\"2xl\"\n\t\t\t\t\t\t\tfontWeight=\"semibold\"\n\t\t\t\t\t\t\tcolor=\"default\"\n\t\t\t\t\t\t\tletterSpacing=\"-0.02em\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t{badges && (\n\t\t\t\t\t\t\t<Flex data-testid=\"page-header-badges\" align=\"center\" gap=\"2\">\n\t\t\t\t\t\t\t\t{badges}\n\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Flex>\n\t\t\t\t\t{subtitle && (\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tdata-testid=\"page-header-subtitle\"\n\t\t\t\t\t\t\tfontSize=\"sm\"\n\t\t\t\t\t\t\tcolor=\"muted\"\n\t\t\t\t\t\t\tmt=\"1\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{subtitle}\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t)}\n\t\t\t\t\t{meta && (\n\t\t\t\t\t\t<Box data-testid=\"page-header-meta\" mt=\"2\">\n\t\t\t\t\t\t\t{meta}\n\t\t\t\t\t\t</Box>\n\t\t\t\t\t)}\n\t\t\t\t</Box>\n\t\t\t\t{hasActions && (\n\t\t\t\t\t<Flex align=\"center\" gap=\"2\" flexShrink={0}>\n\t\t\t\t\t\t{actions}\n\t\t\t\t\t</Flex>\n\t\t\t\t)}\n\t\t\t</Flex>\n\t\t\t{tabs && (\n\t\t\t\t<Box data-testid=\"page-header-tabs\" mt=\"4\" mx=\"-8\" mb=\"-4\">\n\t\t\t\t\t{tabs}\n\t\t\t\t</Box>\n\t\t\t)}\n\t\t</Box>\n\t);\n};\nPageHeader.displayName = \"PageHeader\";\n"]}
|
|
@@ -631,6 +631,51 @@ interface ModalProps extends Omit<DialogRootProps, "open" | "onOpenChange"> {
|
|
|
631
631
|
}
|
|
632
632
|
declare const Modal: React.FC<ModalProps>;
|
|
633
633
|
|
|
634
|
+
interface NavListProps {
|
|
635
|
+
"aria-label"?: string;
|
|
636
|
+
children: ReactNode;
|
|
637
|
+
}
|
|
638
|
+
interface NavListGroupProps {
|
|
639
|
+
label?: string;
|
|
640
|
+
children: ReactNode;
|
|
641
|
+
}
|
|
642
|
+
interface NavListItemProps {
|
|
643
|
+
icon?: ReactNode;
|
|
644
|
+
count?: number | string;
|
|
645
|
+
active?: boolean;
|
|
646
|
+
asChild?: boolean;
|
|
647
|
+
/** Override tooltip text when the parent is collapsed. */
|
|
648
|
+
label?: string;
|
|
649
|
+
/** data-testid for the root element (non-asChild branch). Defaults to "nav-list-item". */
|
|
650
|
+
testId?: string;
|
|
651
|
+
children: ReactNode;
|
|
652
|
+
}
|
|
653
|
+
declare const NavList: {
|
|
654
|
+
({ children, ...rest }: NavListProps): react_jsx_runtime.JSX.Element;
|
|
655
|
+
displayName: string;
|
|
656
|
+
} & {
|
|
657
|
+
Group: {
|
|
658
|
+
({ label, children }: NavListGroupProps): react_jsx_runtime.JSX.Element;
|
|
659
|
+
displayName: string;
|
|
660
|
+
};
|
|
661
|
+
Item: {
|
|
662
|
+
({ icon, count, active, asChild, label, testId, children, }: NavListItemProps): react_jsx_runtime.JSX.Element;
|
|
663
|
+
displayName: string;
|
|
664
|
+
};
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
interface NavListMode {
|
|
668
|
+
/** When true, NavList items render icon-only with tooltips. */
|
|
669
|
+
collapsed: boolean;
|
|
670
|
+
}
|
|
671
|
+
declare const NavListModeProvider: React$1.Provider<NavListMode | null>;
|
|
672
|
+
/**
|
|
673
|
+
* Read the collapsed mode published by the nearest parent
|
|
674
|
+
* (Sidebar, SubNavLayout, etc.). Returns `{ collapsed: false }`
|
|
675
|
+
* when no provider is present — NavList is usable standalone.
|
|
676
|
+
*/
|
|
677
|
+
declare function useNavListMode(): NavListMode;
|
|
678
|
+
|
|
634
679
|
interface PaginationProps {
|
|
635
680
|
/** Current page (1-based). */
|
|
636
681
|
page: number;
|
|
@@ -1058,4 +1103,4 @@ interface WidgetProps {
|
|
|
1058
1103
|
}
|
|
1059
1104
|
declare const Widget: React__default.FC<WidgetProps>;
|
|
1060
1105
|
|
|
1061
|
-
export { ActionCell, type ActionCellAction, type ActionCellProps, BooleanCell, type BooleanCellProps, BulkActionBar, type BulkActionBarProps, type BulkActionProps, type BulkPopoverActionProps, Card, CardList, CardListData, type CardListDataProps, CardListItem, type CardListItemProps, type CardListMenuItem, type CardListProps, type CardProps, ChipPicker, type ChipPickerProps, CodeCell, type CodeCellProps, ColorSwatchCell, type ColorSwatchCellProps, ContextRail, type ContextRailHeaderProps, type ContextRailProps, type ContextRailSectionProps, CountCell, type CountCellProps, DataTable, type DataTableProps, DateCell, type DateCellProps, DescriptionList, type DescriptionListProps, type DescriptionListRowProps, DeviceCell, type DeviceCellProps, type DrawerProps, DrawerRoot, FactBox, type FactBoxAction, type FactBoxProps, IdentityCell, type IdentityCellProps, InlineCreatableList, type InlineCreatableListProps, KnkLogo, type KnkLogoProps, LabeledSwitch, type LabeledSwitchProps, LinkCell, type LinkCellProps, MenuCell, type MenuCellAction, type MenuCellProps, Modal, type ModalProps, NumberCell, type NumberCellProps, Pagination, type PaginationProps, SelectableCard, type SelectableCardBodyProps, type SelectableCardFooterProps, type SelectableCardProps, type SelectableCardThumbnailProps, Sidebar, type SidebarItemProps, type SidebarLogoProps, type SidebarSectionProps$1 as SidebarNavSectionProps, type SidebarProps, SidebarSection, type SidebarSectionProps, type SidebarUserMenuItemProps, type SidebarUserMenuProps, SlugCell, type SlugCellProps, StatusBadgeCell, type StatusBadgeCellProps, Stepper, StepperCompleted, StepperContainer, StepperContent, type StepperContentProps, StepperIcon, type StepperIconProps, type StepperProps, StepperProvider, StepperSeparator, type StepperSeparatorProps, StepperStep, type StepperStepProps, StepperStepTitle, StepperSteps, type StepperStepsProps, SwitchCell, type SwitchCellProps, CardList as Table, CardListData as TableData, type CardListDataProps as TableDataProps, CardListItem as TableItem, type CardListItemProps as TableItemProps, type CardListMenuItem as TableMenuItem, type CardListProps as TableProps, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, type TimelineItemProps, TimelineRoot, type TimelineRootProps, TimelineSeparator, TimelineTitle, Toolbar, type ToolbarFilterChipProps, type ToolbarSearchProps, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, type TreeViewBranchProps, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemIndicator, type TreeViewItemProps, TreeViewItemText, TreeViewLabel, TreeViewNode, TreeViewRoot, type TreeViewRootProps, TreeViewTree, TruncatedTextCell, type TruncatedTextCellProps, UploadDropZone, type UploadDropZoneProps, UrlCell, type UrlCellProps, type UseStepProps, type UseStepperProps, type UseStepperReturn, Widget, type WidgetProps, emptyCellValue, formatUserAgent, parseUserAgent, pluralize, truncateText, useSidebarContext, useStep, useStepper, useStepperContext, useStepperNextButton, useStepperPrevButton };
|
|
1106
|
+
export { ActionCell, type ActionCellAction, type ActionCellProps, BooleanCell, type BooleanCellProps, BulkActionBar, type BulkActionBarProps, type BulkActionProps, type BulkPopoverActionProps, Card, CardList, CardListData, type CardListDataProps, CardListItem, type CardListItemProps, type CardListMenuItem, type CardListProps, type CardProps, ChipPicker, type ChipPickerProps, CodeCell, type CodeCellProps, ColorSwatchCell, type ColorSwatchCellProps, ContextRail, type ContextRailHeaderProps, type ContextRailProps, type ContextRailSectionProps, CountCell, type CountCellProps, DataTable, type DataTableProps, DateCell, type DateCellProps, DescriptionList, type DescriptionListProps, type DescriptionListRowProps, DeviceCell, type DeviceCellProps, type DrawerProps, DrawerRoot, FactBox, type FactBoxAction, type FactBoxProps, IdentityCell, type IdentityCellProps, InlineCreatableList, type InlineCreatableListProps, KnkLogo, type KnkLogoProps, LabeledSwitch, type LabeledSwitchProps, LinkCell, type LinkCellProps, MenuCell, type MenuCellAction, type MenuCellProps, Modal, type ModalProps, NavList, type NavListGroupProps, type NavListItemProps, type NavListMode, NavListModeProvider, type NavListProps, NumberCell, type NumberCellProps, Pagination, type PaginationProps, SelectableCard, type SelectableCardBodyProps, type SelectableCardFooterProps, type SelectableCardProps, type SelectableCardThumbnailProps, Sidebar, type SidebarItemProps, type SidebarLogoProps, type SidebarSectionProps$1 as SidebarNavSectionProps, type SidebarProps, SidebarSection, type SidebarSectionProps, type SidebarUserMenuItemProps, type SidebarUserMenuProps, SlugCell, type SlugCellProps, StatusBadgeCell, type StatusBadgeCellProps, Stepper, StepperCompleted, StepperContainer, StepperContent, type StepperContentProps, StepperIcon, type StepperIconProps, type StepperProps, StepperProvider, StepperSeparator, type StepperSeparatorProps, StepperStep, type StepperStepProps, StepperStepTitle, StepperSteps, type StepperStepsProps, SwitchCell, type SwitchCellProps, CardList as Table, CardListData as TableData, type CardListDataProps as TableDataProps, CardListItem as TableItem, type CardListItemProps as TableItemProps, type CardListMenuItem as TableMenuItem, type CardListProps as TableProps, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, type TimelineItemProps, TimelineRoot, type TimelineRootProps, TimelineSeparator, TimelineTitle, Toolbar, type ToolbarFilterChipProps, type ToolbarSearchProps, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, type TreeViewBranchProps, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemIndicator, type TreeViewItemProps, TreeViewItemText, TreeViewLabel, TreeViewNode, TreeViewRoot, type TreeViewRootProps, TreeViewTree, TruncatedTextCell, type TruncatedTextCellProps, UploadDropZone, type UploadDropZoneProps, UrlCell, type UrlCellProps, type UseStepProps, type UseStepperProps, type UseStepperReturn, Widget, type WidgetProps, emptyCellValue, formatUserAgent, parseUserAgent, pluralize, truncateText, useNavListMode, useSidebarContext, useStep, useStepper, useStepperContext, useStepperNextButton, useStepperPrevButton };
|
package/dist/components/index.js
CHANGED
|
@@ -3,14 +3,15 @@ import { formatRelativeDateTime, StatusBadge } from '../chunk-ETY43HAI.js';
|
|
|
3
3
|
import { Tooltip, MenuItem, MenuRoot, MenuTrigger, MenuContent, Badge, Avatar, Table } from '../chunk-2ZWZ2WAS.js';
|
|
4
4
|
import { Popover, PopoverTrigger, PopoverContent, PopoverBody, Switch } from '../chunk-WQIEF5N3.js';
|
|
5
5
|
import { text_input_default } from '../chunk-OU6H3KU4.js';
|
|
6
|
+
import { useNavListMode, NavListModeProvider } from '../chunk-PLXVGYFW.js';
|
|
7
|
+
export { AuthCard, NavListModeProvider, PageHeader, useNavListMode } from '../chunk-PLXVGYFW.js';
|
|
6
8
|
import { Button, IconButton } from '../chunk-JS7ZEZV3.js';
|
|
7
|
-
|
|
8
|
-
import { Box, Flex, Text, Heading, HStack, Grid, GridItem, Code, VStack, Link, Spacer, Stack } from '../chunk-G4QMIXLC.js';
|
|
9
|
+
import { Box, Flex, Stack, Text, Heading, HStack, Grid, GridItem, Code, VStack, Link, Spacer } from '../chunk-G4QMIXLC.js';
|
|
9
10
|
import { PanelRightOpen, PanelRightClose, ChevronRight, PanelLeftOpen, PanelLeftClose, Search, X, Ellipsis, Plus, ChevronLeft, ArrowUp, ArrowDown, ArrowUpDown, ChevronDown, Check, Upload } from 'lucide-react';
|
|
10
11
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
11
12
|
import { createContext as createContext$1, Timeline, TreeView, chakra, Card as Card$1, Menu, Portal, Checkbox, Drawer, ButtonGroup, Dialog, useSlotRecipe } from '@chakra-ui/react';
|
|
12
13
|
export { createTreeCollection } from '@chakra-ui/react';
|
|
13
|
-
import
|
|
14
|
+
import React6, { createContext, useState, useEffect, useCallback, useMemo, useContext, useRef, Children } from 'react';
|
|
14
15
|
import dayjs from 'dayjs';
|
|
15
16
|
import { Link as Link$1 } from 'react-router-dom';
|
|
16
17
|
import { useReactTable, getSortedRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
|
|
@@ -398,7 +399,7 @@ function useContextRailMode() {
|
|
|
398
399
|
}
|
|
399
400
|
var RAIL_ATOM = /* @__PURE__ */ Symbol.for("anker.contextRail.atom");
|
|
400
401
|
function isRailAtom(child) {
|
|
401
|
-
if (!
|
|
402
|
+
if (!React6.isValidElement(child)) return false;
|
|
402
403
|
const type = child.type;
|
|
403
404
|
if (typeof type !== "function") return false;
|
|
404
405
|
return type.railAtom === RAIL_ATOM;
|
|
@@ -704,7 +705,7 @@ var ContextRailRoot = ({ storageKey, children }) => {
|
|
|
704
705
|
overflowY: "auto",
|
|
705
706
|
children
|
|
706
707
|
}
|
|
707
|
-
) : /* @__PURE__ */ jsx(
|
|
708
|
+
) : /* @__PURE__ */ jsx(Stack, { h: "full", overflowY: "auto", px: "4", pt: "4", pb: "4", gap: "3", children })
|
|
708
709
|
]
|
|
709
710
|
}
|
|
710
711
|
) }) });
|
|
@@ -753,7 +754,7 @@ var ContextRailSection = ({
|
|
|
753
754
|
const { collapsed } = useContextRailMode();
|
|
754
755
|
const [open, setOpen] = useState(defaultOpen);
|
|
755
756
|
if (collapsed) {
|
|
756
|
-
const atomChildren =
|
|
757
|
+
const atomChildren = React6.Children.toArray(children).filter(isRailAtom);
|
|
757
758
|
if (atomChildren.length === 0) return null;
|
|
758
759
|
return /* @__PURE__ */ jsx(Fragment, { children: atomChildren });
|
|
759
760
|
}
|
|
@@ -813,7 +814,7 @@ var ContextRailSection = ({
|
|
|
813
814
|
),
|
|
814
815
|
action && /* @__PURE__ */ jsx(Box, { py: "3", children: action })
|
|
815
816
|
] }),
|
|
816
|
-
open && /* @__PURE__ */ jsx(
|
|
817
|
+
open && /* @__PURE__ */ jsx(Stack, { pb: "3", gap: "2", children })
|
|
817
818
|
]
|
|
818
819
|
}
|
|
819
820
|
);
|
|
@@ -1583,7 +1584,7 @@ var FactBox = (props) => {
|
|
|
1583
1584
|
expandLabel = "Expand",
|
|
1584
1585
|
...rest
|
|
1585
1586
|
} = props;
|
|
1586
|
-
const [show, setShow] =
|
|
1587
|
+
const [show, setShow] = React6.useState(true);
|
|
1587
1588
|
const handleToggle = () => {
|
|
1588
1589
|
setShow(!show);
|
|
1589
1590
|
};
|
|
@@ -1961,6 +1962,127 @@ var Modal = ({
|
|
|
1961
1962
|
);
|
|
1962
1963
|
};
|
|
1963
1964
|
Modal.displayName = "Modal";
|
|
1965
|
+
var NavListRoot = ({ children, ...rest }) => /* @__PURE__ */ jsx(Box, { as: "nav", "aria-label": rest["aria-label"], children });
|
|
1966
|
+
NavListRoot.displayName = "NavList";
|
|
1967
|
+
var NavListGroup = ({ label, children }) => {
|
|
1968
|
+
const { collapsed } = useNavListMode();
|
|
1969
|
+
return /* @__PURE__ */ jsxs(Box, { mb: "2", px: "2", children: [
|
|
1970
|
+
label && !collapsed && /* @__PURE__ */ jsx(
|
|
1971
|
+
Text,
|
|
1972
|
+
{
|
|
1973
|
+
fontSize: "2xs",
|
|
1974
|
+
fontWeight: "semibold",
|
|
1975
|
+
letterSpacing: "wider",
|
|
1976
|
+
textTransform: "uppercase",
|
|
1977
|
+
color: "subtle",
|
|
1978
|
+
px: "2",
|
|
1979
|
+
pt: "2",
|
|
1980
|
+
pb: "1",
|
|
1981
|
+
children: label
|
|
1982
|
+
}
|
|
1983
|
+
),
|
|
1984
|
+
/* @__PURE__ */ jsx(Flex, { direction: "column", gap: "0.5", children })
|
|
1985
|
+
] });
|
|
1986
|
+
};
|
|
1987
|
+
NavListGroup.displayName = "NavList.Group";
|
|
1988
|
+
var NavListItem = ({
|
|
1989
|
+
icon,
|
|
1990
|
+
count,
|
|
1991
|
+
active,
|
|
1992
|
+
asChild,
|
|
1993
|
+
label,
|
|
1994
|
+
testId = "nav-list-item",
|
|
1995
|
+
children
|
|
1996
|
+
}) => {
|
|
1997
|
+
const { collapsed } = useNavListMode();
|
|
1998
|
+
const itemStyle = {
|
|
1999
|
+
display: "flex",
|
|
2000
|
+
alignItems: "center",
|
|
2001
|
+
justifyContent: collapsed ? "center" : "flex-start",
|
|
2002
|
+
gap: "var(--chakra-spacing-2)",
|
|
2003
|
+
paddingInline: "var(--chakra-spacing-3)",
|
|
2004
|
+
paddingBlock: "var(--chakra-spacing-2)",
|
|
2005
|
+
borderRadius: "var(--chakra-radii-sm)",
|
|
2006
|
+
fontSize: "var(--chakra-font-sizes-sm)",
|
|
2007
|
+
fontWeight: active ? "var(--chakra-font-weights-medium)" : "var(--chakra-font-weights-normal)",
|
|
2008
|
+
color: active ? "var(--chakra-colors-primary-700)" : "var(--chakra-colors-default)",
|
|
2009
|
+
background: active ? "var(--chakra-colors-bg-surface)" : "transparent",
|
|
2010
|
+
boxShadow: active ? "inset 0 0 0 1px var(--chakra-colors-border), 0 1px 2px rgba(0,0,0,0.04)" : void 0,
|
|
2011
|
+
position: "relative",
|
|
2012
|
+
textDecoration: "none",
|
|
2013
|
+
cursor: "pointer"
|
|
2014
|
+
};
|
|
2015
|
+
const iconEl = icon ? /* @__PURE__ */ jsx(Box, { display: "inline-flex", alignItems: "center", flexShrink: 0, children: icon }) : null;
|
|
2016
|
+
const countEl = count !== void 0 && !collapsed ? /* @__PURE__ */ jsx(
|
|
2017
|
+
Text,
|
|
2018
|
+
{
|
|
2019
|
+
as: "span",
|
|
2020
|
+
fontSize: "xs",
|
|
2021
|
+
color: active ? "primary.700" : "subtle",
|
|
2022
|
+
flexShrink: 0,
|
|
2023
|
+
marginInlineStart: "auto",
|
|
2024
|
+
style: { fontVariantNumeric: "tabular-nums" },
|
|
2025
|
+
children: count
|
|
2026
|
+
}
|
|
2027
|
+
) : null;
|
|
2028
|
+
const pillEl = active && !collapsed ? /* @__PURE__ */ jsx(
|
|
2029
|
+
"span",
|
|
2030
|
+
{
|
|
2031
|
+
"aria-hidden": "true",
|
|
2032
|
+
style: {
|
|
2033
|
+
width: 3,
|
|
2034
|
+
height: 14,
|
|
2035
|
+
background: "var(--chakra-colors-primary-700)",
|
|
2036
|
+
borderRadius: 999,
|
|
2037
|
+
flexShrink: 0,
|
|
2038
|
+
marginInlineStart: count !== void 0 ? "var(--chakra-spacing-2)" : "auto"
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
) : null;
|
|
2042
|
+
const tooltipLabel = label || (typeof children === "string" ? children : "");
|
|
2043
|
+
const wrapTooltip = (node) => collapsed && tooltipLabel ? /* @__PURE__ */ jsx(Tooltip, { content: tooltipLabel, positioning: { placement: "right" }, children: node }) : node;
|
|
2044
|
+
if (asChild) {
|
|
2045
|
+
const child = React6.Children.only(children);
|
|
2046
|
+
const cloned = React6.cloneElement(
|
|
2047
|
+
child,
|
|
2048
|
+
{
|
|
2049
|
+
"data-active": active ? "true" : "false",
|
|
2050
|
+
"aria-current": active ? "page" : void 0,
|
|
2051
|
+
style: {
|
|
2052
|
+
...itemStyle,
|
|
2053
|
+
...child.props.style
|
|
2054
|
+
}
|
|
2055
|
+
},
|
|
2056
|
+
iconEl,
|
|
2057
|
+
collapsed ? null : child.props.children,
|
|
2058
|
+
countEl,
|
|
2059
|
+
pillEl
|
|
2060
|
+
);
|
|
2061
|
+
return wrapTooltip(cloned);
|
|
2062
|
+
}
|
|
2063
|
+
return wrapTooltip(
|
|
2064
|
+
/* @__PURE__ */ jsxs(
|
|
2065
|
+
Box,
|
|
2066
|
+
{
|
|
2067
|
+
"data-testid": testId,
|
|
2068
|
+
"data-active": active ? "true" : "false",
|
|
2069
|
+
"aria-current": active ? "page" : void 0,
|
|
2070
|
+
style: itemStyle,
|
|
2071
|
+
children: [
|
|
2072
|
+
iconEl,
|
|
2073
|
+
!collapsed && children,
|
|
2074
|
+
countEl,
|
|
2075
|
+
pillEl
|
|
2076
|
+
]
|
|
2077
|
+
}
|
|
2078
|
+
)
|
|
2079
|
+
);
|
|
2080
|
+
};
|
|
2081
|
+
NavListItem.displayName = "NavList.Item";
|
|
2082
|
+
var NavList = Object.assign(NavListRoot, {
|
|
2083
|
+
Group: NavListGroup,
|
|
2084
|
+
Item: NavListItem
|
|
2085
|
+
});
|
|
1964
2086
|
var SelectableCardThumbnail = ({
|
|
1965
2087
|
height = "160px",
|
|
1966
2088
|
children
|
|
@@ -2049,9 +2171,9 @@ SelectableCard.Footer = SelectableCardFooter;
|
|
|
2049
2171
|
var COLLAPSED_WIDTH2 = "64px";
|
|
2050
2172
|
var EXPANDED_WIDTH2 = "240px";
|
|
2051
2173
|
var COLLAPSE_BREAKPOINT2 = 1440;
|
|
2052
|
-
var SidebarContext =
|
|
2174
|
+
var SidebarContext = React6.createContext(null);
|
|
2053
2175
|
function useSidebarContext() {
|
|
2054
|
-
const ctx =
|
|
2176
|
+
const ctx = React6.useContext(SidebarContext);
|
|
2055
2177
|
if (!ctx) {
|
|
2056
2178
|
throw new Error("useSidebarContext must be used inside <Sidebar>");
|
|
2057
2179
|
}
|
|
@@ -2088,7 +2210,7 @@ var SidebarRoot = ({
|
|
|
2088
2210
|
}),
|
|
2089
2211
|
[collapsed, toggle]
|
|
2090
2212
|
);
|
|
2091
|
-
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs(
|
|
2213
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(NavListModeProvider, { value: { collapsed }, children: /* @__PURE__ */ jsxs(
|
|
2092
2214
|
Box,
|
|
2093
2215
|
{
|
|
2094
2216
|
position: "relative",
|
|
@@ -2136,7 +2258,7 @@ var SidebarRoot = ({
|
|
|
2136
2258
|
)
|
|
2137
2259
|
]
|
|
2138
2260
|
}
|
|
2139
|
-
) });
|
|
2261
|
+
) }) });
|
|
2140
2262
|
};
|
|
2141
2263
|
SidebarRoot.displayName = "Sidebar";
|
|
2142
2264
|
var SidebarHeader = ({ children }) => /* @__PURE__ */ jsx(Box, { p: "4", borderBottomWidth: "1px", borderBottomColor: "border", children });
|
|
@@ -2167,25 +2289,7 @@ var SidebarLogo = ({ productName }) => {
|
|
|
2167
2289
|
SidebarLogo.displayName = "Sidebar.Logo";
|
|
2168
2290
|
var SidebarSlot = ({ children }) => /* @__PURE__ */ jsx(Box, { mt: "3", children });
|
|
2169
2291
|
SidebarSlot.displayName = "Sidebar.Slot";
|
|
2170
|
-
var SidebarSection = ({ label, children }) => {
|
|
2171
|
-
const { collapsed } = useSidebarContext();
|
|
2172
|
-
return /* @__PURE__ */ jsxs(Box, { mb: "4", px: "3", children: [
|
|
2173
|
-
!collapsed && /* @__PURE__ */ jsx(
|
|
2174
|
-
Text,
|
|
2175
|
-
{
|
|
2176
|
-
fontSize: "2xs",
|
|
2177
|
-
fontWeight: "semibold",
|
|
2178
|
-
letterSpacing: "wider",
|
|
2179
|
-
textTransform: "uppercase",
|
|
2180
|
-
color: "muted",
|
|
2181
|
-
px: "2",
|
|
2182
|
-
mb: "1",
|
|
2183
|
-
children: label
|
|
2184
|
-
}
|
|
2185
|
-
),
|
|
2186
|
-
/* @__PURE__ */ jsx(Flex, { direction: "column", gap: "0.5", children })
|
|
2187
|
-
] });
|
|
2188
|
-
};
|
|
2292
|
+
var SidebarSection = ({ label, children }) => /* @__PURE__ */ jsx(NavList.Group, { label, children });
|
|
2189
2293
|
SidebarSection.displayName = "Sidebar.Section";
|
|
2190
2294
|
var SidebarItem = ({
|
|
2191
2295
|
icon,
|
|
@@ -2193,74 +2297,17 @@ var SidebarItem = ({
|
|
|
2193
2297
|
asChild,
|
|
2194
2298
|
active,
|
|
2195
2299
|
label
|
|
2196
|
-
}) =>
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
borderRadius: "var(--chakra-radii-sm)",
|
|
2206
|
-
fontSize: "var(--chakra-font-sizes-sm)",
|
|
2207
|
-
fontWeight: active ? "var(--chakra-font-weights-medium)" : "var(--chakra-font-weights-normal)",
|
|
2208
|
-
color: active ? "var(--chakra-colors-primary-700)" : "var(--chakra-colors-default)",
|
|
2209
|
-
background: active ? "var(--chakra-colors-bg-surface)" : "transparent",
|
|
2210
|
-
boxShadow: active ? "inset 0 0 0 1px var(--chakra-colors-border), 0 1px 2px rgba(0,0,0,0.04)" : void 0,
|
|
2211
|
-
position: "relative",
|
|
2212
|
-
textDecoration: "none"
|
|
2213
|
-
};
|
|
2214
|
-
const iconEl = icon ? /* @__PURE__ */ jsx(Box, { display: "inline-flex", alignItems: "center", flexShrink: 0, children: icon }) : null;
|
|
2215
|
-
const activeTab = active && !collapsed ? /* @__PURE__ */ jsx(
|
|
2216
|
-
"span",
|
|
2217
|
-
{
|
|
2218
|
-
"aria-hidden": "true",
|
|
2219
|
-
style: {
|
|
2220
|
-
width: 3,
|
|
2221
|
-
height: 14,
|
|
2222
|
-
background: "var(--chakra-colors-primary-700)",
|
|
2223
|
-
borderRadius: 999,
|
|
2224
|
-
flexShrink: 0,
|
|
2225
|
-
marginInlineStart: "auto"
|
|
2226
|
-
}
|
|
2227
|
-
}
|
|
2228
|
-
) : null;
|
|
2229
|
-
const tooltipLabel = label || (typeof children === "string" ? children : "");
|
|
2230
|
-
const wrapTooltip = (node) => collapsed && tooltipLabel ? /* @__PURE__ */ jsx(Tooltip, { content: tooltipLabel, positioning: { placement: "right" }, children: node }) : node;
|
|
2231
|
-
if (asChild) {
|
|
2232
|
-
const child = React5.Children.only(children);
|
|
2233
|
-
const cloned = React5.cloneElement(
|
|
2234
|
-
child,
|
|
2235
|
-
{
|
|
2236
|
-
"data-active": active ? "true" : "false",
|
|
2237
|
-
style: {
|
|
2238
|
-
...itemStyle,
|
|
2239
|
-
...child.props.style
|
|
2240
|
-
}
|
|
2241
|
-
},
|
|
2242
|
-
iconEl,
|
|
2243
|
-
collapsed ? null : child.props.children,
|
|
2244
|
-
activeTab
|
|
2245
|
-
);
|
|
2246
|
-
return wrapTooltip(cloned);
|
|
2300
|
+
}) => /* @__PURE__ */ jsx(
|
|
2301
|
+
NavList.Item,
|
|
2302
|
+
{
|
|
2303
|
+
icon,
|
|
2304
|
+
active,
|
|
2305
|
+
asChild,
|
|
2306
|
+
label,
|
|
2307
|
+
testId: "sidebar-item",
|
|
2308
|
+
children
|
|
2247
2309
|
}
|
|
2248
|
-
|
|
2249
|
-
/* @__PURE__ */ jsxs(
|
|
2250
|
-
Box,
|
|
2251
|
-
{
|
|
2252
|
-
"data-testid": "sidebar-item",
|
|
2253
|
-
"data-active": active ? "true" : "false",
|
|
2254
|
-
style: itemStyle,
|
|
2255
|
-
children: [
|
|
2256
|
-
iconEl,
|
|
2257
|
-
!collapsed && children,
|
|
2258
|
-
activeTab
|
|
2259
|
-
]
|
|
2260
|
-
}
|
|
2261
|
-
)
|
|
2262
|
-
);
|
|
2263
|
-
};
|
|
2310
|
+
);
|
|
2264
2311
|
SidebarItem.displayName = "Sidebar.Item";
|
|
2265
2312
|
var SidebarUserMenu = ({ user, children }) => {
|
|
2266
2313
|
const { collapsed } = useSidebarContext();
|
|
@@ -2318,8 +2365,8 @@ var SidebarUserMenuItem = ({
|
|
|
2318
2365
|
children
|
|
2319
2366
|
}) => {
|
|
2320
2367
|
if (asChild) {
|
|
2321
|
-
const child =
|
|
2322
|
-
return /* @__PURE__ */ jsx(MenuItem, { value: "link", onClick, children:
|
|
2368
|
+
const child = React6.Children.only(children);
|
|
2369
|
+
return /* @__PURE__ */ jsx(MenuItem, { value: "link", onClick, children: React6.cloneElement(child, {}) });
|
|
2323
2370
|
}
|
|
2324
2371
|
return /* @__PURE__ */ jsx(
|
|
2325
2372
|
MenuItem,
|
|
@@ -2404,16 +2451,16 @@ var [StepperProvider, useStepperContext] = createContext$1({
|
|
|
2404
2451
|
});
|
|
2405
2452
|
function useStepper(props) {
|
|
2406
2453
|
const { step, onChange } = props;
|
|
2407
|
-
const [activeIndex, setIndex] =
|
|
2408
|
-
const stepsRef =
|
|
2409
|
-
const registerStep =
|
|
2454
|
+
const [activeIndex, setIndex] = React6.useState(-1);
|
|
2455
|
+
const stepsRef = React6.useRef([]);
|
|
2456
|
+
const registerStep = React6.useCallback((name) => {
|
|
2410
2457
|
const newSteps = [...stepsRef.current];
|
|
2411
2458
|
if (newSteps.indexOf(name) === -1) {
|
|
2412
2459
|
newSteps.push(name);
|
|
2413
2460
|
}
|
|
2414
2461
|
stepsRef.current = newSteps;
|
|
2415
2462
|
}, []);
|
|
2416
|
-
const unregisterStep =
|
|
2463
|
+
const unregisterStep = React6.useCallback((name) => {
|
|
2417
2464
|
stepsRef.current = stepsRef.current.filter((step2) => step2 !== name);
|
|
2418
2465
|
}, []);
|
|
2419
2466
|
const setStep = useCallback((name) => {
|
|
@@ -2428,7 +2475,7 @@ function useStepper(props) {
|
|
|
2428
2475
|
const prevStep = () => {
|
|
2429
2476
|
setIndex(activeIndex - 1);
|
|
2430
2477
|
};
|
|
2431
|
-
|
|
2478
|
+
React6.useEffect(() => {
|
|
2432
2479
|
if (typeof step === "string") {
|
|
2433
2480
|
setStep(step);
|
|
2434
2481
|
} else if (typeof step === "number") {
|
|
@@ -2437,7 +2484,7 @@ function useStepper(props) {
|
|
|
2437
2484
|
setIndex(0);
|
|
2438
2485
|
}
|
|
2439
2486
|
}, [step, activeIndex, setStep]);
|
|
2440
|
-
|
|
2487
|
+
React6.useEffect(() => {
|
|
2441
2488
|
onChange?.(activeIndex);
|
|
2442
2489
|
}, [activeIndex, onChange]);
|
|
2443
2490
|
const context = {
|
|
@@ -2459,7 +2506,7 @@ function useStepper(props) {
|
|
|
2459
2506
|
function useStep(props) {
|
|
2460
2507
|
const { name, isActive, isCompleted } = props;
|
|
2461
2508
|
const { registerStep, unregisterStep, activeStep } = useStepperContext();
|
|
2462
|
-
|
|
2509
|
+
React6.useEffect(() => {
|
|
2463
2510
|
if (!name) {
|
|
2464
2511
|
return;
|
|
2465
2512
|
}
|
|
@@ -2493,12 +2540,12 @@ function useStepperNextButton({
|
|
|
2493
2540
|
};
|
|
2494
2541
|
}
|
|
2495
2542
|
function getChildOfType(children, type) {
|
|
2496
|
-
return
|
|
2543
|
+
return React6.Children.toArray(children).find(
|
|
2497
2544
|
(item) => item.type === type
|
|
2498
2545
|
);
|
|
2499
2546
|
}
|
|
2500
2547
|
function getChildrenOfType(children, type) {
|
|
2501
|
-
return
|
|
2548
|
+
return React6.Children.toArray(children).filter(
|
|
2502
2549
|
(item) => Array.isArray(type) ? type.some((component) => component === item.type) : item.type === type
|
|
2503
2550
|
);
|
|
2504
2551
|
}
|
|
@@ -2982,6 +3029,6 @@ var Widget = ({
|
|
|
2982
3029
|
};
|
|
2983
3030
|
Widget.displayName = "Widget";
|
|
2984
3031
|
|
|
2985
|
-
export { ActionCell, BooleanCell, BulkActionBar, Card, CardList, CardListData, CardListItem, ChipPicker, CodeCell, ColorSwatchCell, ContextRail, CountCell, DataTable, DateCell, DescriptionList, DeviceCell, DrawerRoot, FactBox, IdentityCell, InlineCreatableList, KnkLogo, LabeledSwitch, LinkCell, MenuCell, Modal, NumberCell, Pagination, SelectableCard, Sidebar, SidebarSection2 as SidebarSection, SlugCell, StatusBadgeCell, Stepper, StepperCompleted, StepperContainer, StepperContent, StepperIcon, StepperProvider, StepperSeparator, StepperStep, StepperStepTitle, StepperSteps, SwitchCell, CardList as Table, CardListData as TableData, CardListItem as TableItem, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, TimelineRoot, TimelineSeparator, TimelineTitle, Toolbar, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemIndicator, TreeViewItemText, TreeViewLabel, TreeViewNode, TreeViewRoot, TreeViewTree, TruncatedTextCell, UploadDropZone, UrlCell, Widget, emptyCellValue, formatUserAgent, parseUserAgent, pluralize, truncateText, useSidebarContext, useStep, useStepper, useStepperContext, useStepperNextButton, useStepperPrevButton };
|
|
3032
|
+
export { ActionCell, BooleanCell, BulkActionBar, Card, CardList, CardListData, CardListItem, ChipPicker, CodeCell, ColorSwatchCell, ContextRail, CountCell, DataTable, DateCell, DescriptionList, DeviceCell, DrawerRoot, FactBox, IdentityCell, InlineCreatableList, KnkLogo, LabeledSwitch, LinkCell, MenuCell, Modal, NavList, NumberCell, Pagination, SelectableCard, Sidebar, SidebarSection2 as SidebarSection, SlugCell, StatusBadgeCell, Stepper, StepperCompleted, StepperContainer, StepperContent, StepperIcon, StepperProvider, StepperSeparator, StepperStep, StepperStepTitle, StepperSteps, SwitchCell, CardList as Table, CardListData as TableData, CardListItem as TableItem, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, TimelineRoot, TimelineSeparator, TimelineTitle, Toolbar, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemIndicator, TreeViewItemText, TreeViewLabel, TreeViewNode, TreeViewRoot, TreeViewTree, TruncatedTextCell, UploadDropZone, UrlCell, Widget, emptyCellValue, formatUserAgent, parseUserAgent, pluralize, truncateText, useSidebarContext, useStep, useStepper, useStepperContext, useStepperNextButton, useStepperPrevButton };
|
|
2986
3033
|
//# sourceMappingURL=index.js.map
|
|
2987
3034
|
//# sourceMappingURL=index.js.map
|