@knkcs/anker 1.8.0 → 1.9.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.
@@ -1,6 +1,6 @@
1
1
  import { Progress } from '../chunk-WEP2AIQ5.js';
2
- import { Spinner } from '../chunk-5YDCDC4B.js';
3
2
  import { IconButton } from '../chunk-JS7ZEZV3.js';
3
+ import { Spinner } from '../chunk-5YDCDC4B.js';
4
4
  import { Box, Flex, Text, Stack, HStack } from '../chunk-G4QMIXLC.js';
5
5
  import { Dialog, Portal, ButtonGroup, Button } from '@chakra-ui/react';
6
6
  import { createContext, useState, useRef, useCallback, useContext, useEffect } from 'react';
@@ -0,0 +1,51 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+
4
+ interface AuthCardProps {
5
+ /** Logo or wordmark, far-left of the topbar. */
6
+ logo?: React__default.ReactNode;
7
+ /** Right-side topbar content (help link, locale switcher, etc.). */
8
+ topBarRight?: React__default.ReactNode;
9
+ /** Hide the topbar entirely (rare — e.g. embedded preview). */
10
+ hideTopBar?: boolean;
11
+ /** Hide the dot-grid background (rare — e.g. printable). */
12
+ hideBackground?: boolean;
13
+ /** Small uppercase eyebrow above the title. */
14
+ eyebrow?: React__default.ReactNode;
15
+ /**
16
+ * Card title. Accepts a string or inline element — the component wraps
17
+ * it in an `<h3>` (semantic heading, 24px, semibold, default color).
18
+ * Avoid passing block elements (e.g. `<div>`) or pre-built headings.
19
+ */
20
+ title?: React__default.ReactNode;
21
+ /** Subtitle below title (14px, muted color, centered). */
22
+ subtitle?: React__default.ReactNode;
23
+ /** Card width preset. md = 440px (default), lg = 480px. */
24
+ size?: "md" | "lg";
25
+ /** Card footer slot. Bottom-bordered inside the card. */
26
+ footer?: React__default.ReactNode;
27
+ /** Page content inside the card body. */
28
+ children: React__default.ReactNode;
29
+ }
30
+ declare const AuthCard: {
31
+ ({ logo, topBarRight, hideTopBar, hideBackground, eyebrow, title, subtitle, size, footer, children, }: AuthCardProps): react_jsx_runtime.JSX.Element;
32
+ displayName: string;
33
+ };
34
+
35
+ interface PageHeaderBreadcrumb {
36
+ label: string;
37
+ to?: string;
38
+ }
39
+ interface PageHeaderProps {
40
+ breadcrumbs?: PageHeaderBreadcrumb[];
41
+ title: React__default.ReactNode;
42
+ subtitle?: React__default.ReactNode;
43
+ actions?: React__default.ReactNode;
44
+ eyebrow?: React__default.ReactNode;
45
+ }
46
+ declare const PageHeader: {
47
+ ({ breadcrumbs, title, subtitle, actions, eyebrow, }: PageHeaderProps): react_jsx_runtime.JSX.Element;
48
+ displayName: string;
49
+ };
50
+
51
+ export { AuthCard as A, PageHeader as P, type AuthCardProps as a, type PageHeaderBreadcrumb as b, type PageHeaderProps as c };
@@ -0,0 +1,296 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import { a as AuthCardProps, c as PageHeaderProps } from '../page-header-D-kxNn-f.js';
4
+
5
+ /**
6
+ * Register page-action content (typically buttons rendered to the right of
7
+ * the page title) from any descendant of `<AppShell>`. The content is
8
+ * surfaced by the active page template inside its `<PageHeader>` actions
9
+ * slot.
10
+ *
11
+ * Pass `null` (or omit) to clear the registration. The hook is a no-op when
12
+ * called outside an AppShell, which keeps it safe to use in stories and
13
+ * isolated component tests.
14
+ */
15
+ declare function usePageActions(content: ReactNode): void;
16
+ /**
17
+ * Register context-rail content from any descendant of `<AppShell>`. The
18
+ * content is rendered in the rail column (assuming the AppShell has a rail
19
+ * slot enabled).
20
+ *
21
+ * Pass `null` (or omit) to clear the registration. The hook is a no-op when
22
+ * called outside an AppShell.
23
+ */
24
+ declare function usePageRail(content: ReactNode): void;
25
+ interface AppShellProps {
26
+ /**
27
+ * Sidebar element — the navigation column. Required. Typically an instance
28
+ * of `<Sidebar>` from `@knkcs/anker/components`. AppShell does not own the
29
+ * sidebar's collapsed-state — pass it through the Sidebar's own props.
30
+ */
31
+ sidebar: ReactNode;
32
+ /**
33
+ * Context rail element. Pass an instance of `<ContextRail>` to enable the
34
+ * rail column. Pass `null` (or omit) to disable the column entirely (no
35
+ * grid track is reserved). Pages can still register rail content via
36
+ * `usePageRail` — when the rail column is disabled, registered content is
37
+ * dropped silently.
38
+ *
39
+ * Tip: pass an _empty_ `<ContextRail>` if you want the column to exist
40
+ * (so child pages can populate it via `usePageRail`) without rendering
41
+ * any default content.
42
+ */
43
+ rail?: ReactNode;
44
+ /** Page content. */
45
+ children: ReactNode;
46
+ }
47
+ /**
48
+ * AppShell is the top-level layout for authenticated knkCMS pages. It owns
49
+ * the slot context that powers `usePageActions` and `usePageRail`, and
50
+ * arranges sidebar / main / rail in a 3-column CSS grid.
51
+ *
52
+ * AppShell is layout-only — it does not render a PageHeader, and it does not
53
+ * inject any business chrome. Pages compose `<IndexPageTemplate>`,
54
+ * `<DetailPageTemplate>`, etc. inside `children`.
55
+ */
56
+ declare function AppShell({ sidebar, rail, children }: AppShellProps): react_jsx_runtime.JSX.Element;
57
+ declare namespace AppShell {
58
+ var displayName: string;
59
+ }
60
+
61
+ interface AuthPageTemplateProps extends AuthCardProps {
62
+ /**
63
+ * Page body — typically a form or a verification CTA. Inherits all
64
+ * AuthCard slots (logo, topBarRight, eyebrow, title, subtitle, footer).
65
+ */
66
+ children: ReactNode;
67
+ }
68
+ /**
69
+ * Auth-flow page layout. Use for any pre-authentication screen (login,
70
+ * register, MFA, forgot-password, reset-password) and for short
71
+ * confirmation flows (email-verify, account-deleted). For consent
72
+ * dialogs, prefer `<OAuthConsentPageTemplate>` (denser layout).
73
+ *
74
+ * The template supplies a centered card with a dot-grid background, an
75
+ * optional topbar with logo + locale switcher, and a footer slot. To hide
76
+ * the topbar (rare — embedded preview, printable receipts) pass
77
+ * `hideTopBar`. To hide the dot-grid (printable) pass `hideBackground`.
78
+ */
79
+ declare function AuthPageTemplate(props: AuthPageTemplateProps): react_jsx_runtime.JSX.Element;
80
+ declare namespace AuthPageTemplate {
81
+ var displayName: string;
82
+ }
83
+
84
+ interface DashboardPageTemplateProps extends Pick<PageHeaderProps, "breadcrumbs" | "title" | "subtitle" | "eyebrow"> {
85
+ actions?: ReactNode;
86
+ /**
87
+ * Dashboard widgets. Children are placed inside a 12-column responsive
88
+ * CSS grid with `gap="4"`. Each child should set `gridColumn` (e.g.
89
+ * `"span 3"` for a quarter-width tile, `"span 6"` for half, `"span 12"`
90
+ * for full-width). The default per-child column span is `"span 12"`.
91
+ */
92
+ children: ReactNode;
93
+ /**
94
+ * Override the grid `gap` between widgets. @default "4" (= 16px)
95
+ */
96
+ gap?: string;
97
+ }
98
+ declare function DashboardPageTemplate({ breadcrumbs, title, subtitle, eyebrow, actions, children, gap, }: DashboardPageTemplateProps): react_jsx_runtime.JSX.Element;
99
+ declare namespace DashboardPageTemplate {
100
+ var displayName: string;
101
+ }
102
+
103
+ interface DetailPageTemplateProps extends Pick<PageHeaderProps, "breadcrumbs" | "title" | "subtitle" | "eyebrow"> {
104
+ actions?: ReactNode;
105
+ /**
106
+ * Tab strip rendered immediately under the PageHeader. Typically a
107
+ * `<Tabs.Root>` containing a `<Tabs.List>` and one `<Tabs.Content>` per
108
+ * pane. The template does not render `<Tabs.Content>` separately —
109
+ * consumers control the tab body composition entirely.
110
+ */
111
+ tabs?: ReactNode;
112
+ /**
113
+ * Page body — the entity's identity card, tab bodies, edit forms, etc.
114
+ * Rendered with horizontal padding (`px="8"`) and top padding (`pt="6"`)
115
+ * so cards inside don't sit flush against the page edges. Override by
116
+ * passing a `<Box px="0" pt="0">…</Box>` if you need a flush layout.
117
+ */
118
+ children: ReactNode;
119
+ /**
120
+ * When `true`, removes the default `px="8" pt="6"` padding around
121
+ * `children`. Use for detail pages whose body is itself a full-bleed
122
+ * surface (e.g. a code editor). @default false
123
+ */
124
+ flush?: boolean;
125
+ }
126
+ declare function DetailPageTemplate({ breadcrumbs, title, subtitle, eyebrow, actions, tabs, children, flush, }: DetailPageTemplateProps): react_jsx_runtime.JSX.Element;
127
+ declare namespace DetailPageTemplate {
128
+ var displayName: string;
129
+ }
130
+
131
+ interface ErrorPageProps {
132
+ /**
133
+ * Status code (404, 500, 403, …) shown as the page's largest piece of
134
+ * type. Pass any string — non-numeric codes like "OOPS" work too.
135
+ */
136
+ statusCode: ReactNode;
137
+ /** Short headline — e.g. "Page not found" or "Something went wrong". */
138
+ title: ReactNode;
139
+ /**
140
+ * One-paragraph explanation. Keep it short — the user is already in a
141
+ * frustrated state.
142
+ */
143
+ description?: ReactNode;
144
+ /**
145
+ * Action(s) — typically one solid button (back home / retry) plus an
146
+ * optional secondary link.
147
+ */
148
+ actions?: ReactNode;
149
+ /**
150
+ * Optional illustration rendered above the status code. Use sparingly.
151
+ */
152
+ illustration?: ReactNode;
153
+ /**
154
+ * Logo or wordmark rendered top-left. Useful for branded error pages
155
+ * served from the root domain.
156
+ */
157
+ logo?: ReactNode;
158
+ }
159
+ declare function ErrorPage({ statusCode, title, description, actions, illustration, logo, }: ErrorPageProps): react_jsx_runtime.JSX.Element;
160
+ declare namespace ErrorPage {
161
+ var displayName: string;
162
+ }
163
+
164
+ interface IndexPageTemplateProps extends Pick<PageHeaderProps, "breadcrumbs" | "title" | "subtitle" | "eyebrow"> {
165
+ /**
166
+ * Optional explicit page-action content (rendered inside the PageHeader's
167
+ * actions slot). When omitted, the template falls back to whatever a
168
+ * descendant has registered via `usePageActions`.
169
+ */
170
+ actions?: ReactNode;
171
+ /**
172
+ * Optional tab strip rendered between the PageHeader and the toolbar.
173
+ * Pass an instance of `<Tabs.Root>` (with its own `<Tabs.List>` and
174
+ * `<Tabs.Content>`s). When omitted, no tab strip is rendered.
175
+ */
176
+ tabs?: ReactNode;
177
+ /**
178
+ * Toolbar element rendered between the tabs (if any) and the page body.
179
+ * Typically an instance of `<Toolbar>` from `@knkcs/anker/components`.
180
+ * Pass `null` to omit the toolbar entirely (rare).
181
+ */
182
+ toolbar?: ReactNode;
183
+ /**
184
+ * Page body — DataTable, list, empty state, or error/loading content.
185
+ * Rendered flush against the canvas. Add internal padding inside
186
+ * `children` if you need it.
187
+ */
188
+ children: ReactNode;
189
+ }
190
+ /**
191
+ * Canonical list-page layout. Renders PageHeader → optional Tabs → optional
192
+ * Toolbar → children, full-bleed against the canvas.
193
+ *
194
+ * Page actions are sourced from (in priority order): `actions` prop →
195
+ * registered slot via `usePageActions`. This lets a tab-pane component deep
196
+ * inside `children` register its own actions without prop-drilling.
197
+ */
198
+ declare function IndexPageTemplate({ breadcrumbs, title, subtitle, eyebrow, actions, tabs, toolbar, children, }: IndexPageTemplateProps): react_jsx_runtime.JSX.Element;
199
+ declare namespace IndexPageTemplate {
200
+ var displayName: string;
201
+ }
202
+
203
+ interface LoadingPageProps {
204
+ /** Optional logo rendered above the spinner. */
205
+ logo?: ReactNode;
206
+ /**
207
+ * Optional message rendered below the spinner. Keep it short
208
+ * (e.g. "Loading your workspace…").
209
+ */
210
+ message?: ReactNode;
211
+ }
212
+ declare function LoadingPage({ logo, message }: LoadingPageProps): react_jsx_runtime.JSX.Element;
213
+ declare namespace LoadingPage {
214
+ var displayName: string;
215
+ }
216
+
217
+ interface MaintenancePageProps {
218
+ /** Logo rendered top-left. */
219
+ logo?: ReactNode;
220
+ /** Headline — e.g. "We'll be right back". */
221
+ title?: ReactNode;
222
+ /**
223
+ * One-paragraph message explaining what's happening and what users
224
+ * should do (typically "wait, we'll be back shortly").
225
+ */
226
+ description?: ReactNode;
227
+ /**
228
+ * Estimated-time-of-restoration banner. Pass a string like
229
+ * "Estimated back online: 14:30 UTC". Rendered below the description.
230
+ */
231
+ eta?: ReactNode;
232
+ /**
233
+ * Optional link to a status page or twitter status. Pass a fully-
234
+ * styled `<Link>` or an `<a>` element.
235
+ */
236
+ statusLink?: ReactNode;
237
+ }
238
+ declare function MaintenancePage({ logo, title, description, eta, statusLink, }: MaintenancePageProps): react_jsx_runtime.JSX.Element;
239
+ declare namespace MaintenancePage {
240
+ var displayName: string;
241
+ }
242
+
243
+ interface MarketingPageTemplateProps {
244
+ /** Logo or wordmark, far-left of the topbar. */
245
+ logo?: ReactNode;
246
+ /** Navigation links and/or sign-in CTA, far-right of the topbar. */
247
+ topBarRight?: ReactNode;
248
+ /** Hide the topbar (rare). */
249
+ hideTopBar?: boolean;
250
+ /** Eyebrow above the hero title (uppercase, muted). */
251
+ heroEyebrow?: ReactNode;
252
+ /** Hero title — large display text. */
253
+ heroTitle?: ReactNode;
254
+ /** Hero subtitle — one-paragraph value statement. */
255
+ heroSubtitle?: ReactNode;
256
+ /** Hero CTAs — typically one solid button + one ghost link. */
257
+ heroActions?: ReactNode;
258
+ /** Optional visual rendered to the right of the hero copy on wide viewports. */
259
+ heroVisual?: ReactNode;
260
+ /**
261
+ * Feature sections, testimonials, etc. Rendered with `maxW="6xl"` and
262
+ * `marginInline="auto"` so content tracks a consistent reading column.
263
+ */
264
+ children?: ReactNode;
265
+ /** Footer content — copyright, secondary nav, contact. */
266
+ footer?: ReactNode;
267
+ }
268
+ declare function MarketingPageTemplate({ logo, topBarRight, hideTopBar, heroEyebrow, heroTitle, heroSubtitle, heroActions, heroVisual, children, footer, }: MarketingPageTemplateProps): react_jsx_runtime.JSX.Element;
269
+ declare namespace MarketingPageTemplate {
270
+ var displayName: string;
271
+ }
272
+
273
+ interface SettingsPageTemplateProps extends Pick<PageHeaderProps, "breadcrumbs" | "title" | "subtitle" | "eyebrow"> {
274
+ actions?: ReactNode;
275
+ /**
276
+ * Tab strip. Settings pages should always have at least two tabs — if
277
+ * you only have one section, use DetailPageTemplate instead.
278
+ */
279
+ tabs: ReactNode;
280
+ /** Page body — typically Card-wrapped forms or DataLists. */
281
+ children: ReactNode;
282
+ /**
283
+ * Constrain the body width for readability. Settings forms read better
284
+ * at ~720px even on wide viewports. Pass a Chakra width token (`"3xl"`,
285
+ * `"4xl"`) or any CSS length. @default "3xl" (= 768px)
286
+ *
287
+ * Pass `"full"` to disable the constraint entirely.
288
+ */
289
+ maxBodyWidth?: string;
290
+ }
291
+ declare function SettingsPageTemplate({ breadcrumbs, title, subtitle, eyebrow, actions, tabs, children, maxBodyWidth, }: SettingsPageTemplateProps): react_jsx_runtime.JSX.Element;
292
+ declare namespace SettingsPageTemplate {
293
+ var displayName: string;
294
+ }
295
+
296
+ export { AppShell, type AppShellProps, AuthPageTemplate, type AuthPageTemplateProps, DashboardPageTemplate, type DashboardPageTemplateProps, DetailPageTemplate, type DetailPageTemplateProps, ErrorPage, type ErrorPageProps, IndexPageTemplate, type IndexPageTemplateProps, LoadingPage, type LoadingPageProps, MaintenancePage, type MaintenancePageProps, MarketingPageTemplate, type MarketingPageTemplateProps, SettingsPageTemplate, type SettingsPageTemplateProps, usePageActions, usePageRail };