@knkcs/anker 1.8.1 → 1.9.1

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