@polyfen/polykit-react 0.0.0-stage → 0.2.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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +166 -2
  3. package/dist/components/avatar.d.ts +19 -0
  4. package/dist/components/avatar.js +27 -0
  5. package/dist/components/button.d.ts +45 -0
  6. package/dist/components/button.js +44 -0
  7. package/dist/components/choice.d.ts +53 -0
  8. package/dist/components/choice.js +73 -0
  9. package/dist/components/dialog.d.ts +65 -0
  10. package/dist/components/dialog.js +178 -0
  11. package/dist/components/display.d.ts +61 -0
  12. package/dist/components/display.js +63 -0
  13. package/dist/components/field.d.ts +44 -0
  14. package/dist/components/field.js +62 -0
  15. package/dist/components/icon.d.ts +29 -0
  16. package/dist/components/icon.js +17 -0
  17. package/dist/components/link.d.ts +10 -0
  18. package/dist/components/link.js +9 -0
  19. package/dist/components/menu.d.ts +35 -0
  20. package/dist/components/menu.js +60 -0
  21. package/dist/components/navigation.d.ts +42 -0
  22. package/dist/components/navigation.js +47 -0
  23. package/dist/components/page.d.ts +97 -0
  24. package/dist/components/page.js +120 -0
  25. package/dist/components/popover.d.ts +10 -0
  26. package/dist/components/popover.js +16 -0
  27. package/dist/components/shell.d.ts +153 -0
  28. package/dist/components/shell.js +359 -0
  29. package/dist/components/table.d.ts +41 -0
  30. package/dist/components/table.js +35 -0
  31. package/dist/components/theme.d.ts +10 -0
  32. package/dist/components/theme.js +41 -0
  33. package/dist/components/toast.d.ts +27 -0
  34. package/dist/components/toast.js +93 -0
  35. package/dist/index.d.ts +18 -0
  36. package/dist/index.js +20 -0
  37. package/dist/lib/boot-script.d.ts +9 -0
  38. package/dist/lib/boot-script.js +26 -0
  39. package/dist/lib/compose-refs.d.ts +3 -0
  40. package/dist/lib/compose-refs.js +11 -0
  41. package/dist/lib/cx.d.ts +4 -0
  42. package/dist/lib/cx.js +4 -0
  43. package/dist/lib/dom.d.ts +10 -0
  44. package/dist/lib/dom.js +29 -0
  45. package/dist/lib/use-controllable.d.ts +5 -0
  46. package/dist/lib/use-controllable.js +19 -0
  47. package/package.json +50 -3
@@ -0,0 +1,47 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Slot, Tabs as TabsPrimitive, Toggle, ToggleGroup } from 'radix-ui';
4
+ import { forwardRef, } from 'react';
5
+ import { cx } from '../lib/cx.js';
6
+ /* Tabs that swap a panel in place (Radix Tabs: role="tab", aria-selected, arrow keys). */
7
+ export const Tabs = TabsPrimitive.Root;
8
+ /** The row of tabs (`.pk-tabs`). Name it with `aria-label`. */
9
+ export const TabsList = forwardRef(function TabsList({ className, ...props }, ref) {
10
+ return _jsx(TabsPrimitive.List, { ref: ref, className: cx('pk-tabs', className), ...props });
11
+ });
12
+ /** One tab (`.pk-tabs__tab`); the underline marks the selected one. */
13
+ export const TabsTrigger = forwardRef(function TabsTrigger({ className, ...props }, ref) {
14
+ return _jsx(TabsPrimitive.Trigger, { ref: ref, className: cx('pk-tabs__tab', className), ...props });
15
+ });
16
+ export const TabsContent = TabsPrimitive.Content;
17
+ /** A count after a tab's label (`.pk-tabs__count`). */
18
+ export const TabsCount = forwardRef(function TabsCount({ className, ...props }, ref) {
19
+ return _jsx("span", { ref: ref, className: cx('pk-tabs__count', className), ...props });
20
+ });
21
+ /* Tabs that change the page: links, the current one with aria-current="page". */
22
+ /** Navigation tabs (`<nav class="pk-tabs">`). Name it with `aria-label`. */
23
+ export const NavTabs = forwardRef(function NavTabs({ className, ...props }, ref) {
24
+ return _jsx("nav", { ref: ref, className: cx('pk-tabs', className), ...props });
25
+ });
26
+ /** One navigation tab: a link. */
27
+ export const NavTab = forwardRef(function NavTab({ current, asChild, className, ...props }, ref) {
28
+ const Comp = asChild ? Slot.Root : 'a';
29
+ return (_jsx(Comp, { ref: ref, className: cx('pk-tabs__tab', className), "aria-current": current ? 'page' : undefined, ...props }));
30
+ });
31
+ /**
32
+ * A segmented control (`.pk-segmented`): a Radix single-choice toggle group with roving focus and
33
+ * arrow keys. Name it with `aria-label`. shadcn: `ToggleGroup type="single"`.
34
+ */
35
+ export const SegmentedControl = forwardRef(function SegmentedControl({ icons, className, onValueChange, ...props }, ref) {
36
+ return (_jsx(ToggleGroup.Root, { ref: ref, type: "single", className: cx('pk-segmented', icons && 'pk-segmented--icons', className), onValueChange: (value) => {
37
+ if (value)
38
+ onValueChange?.(value);
39
+ }, ...props }));
40
+ });
41
+ export const SegmentedControlItem = forwardRef(function SegmentedControlItem({ className, ...props }, ref) {
42
+ return _jsx(ToggleGroup.Item, { ref: ref, className: cx('pk-segmented__item', className), ...props });
43
+ });
44
+ /** A pill that toggles (`.pk-chip`, `aria-pressed`). shadcn: Toggle. */
45
+ export const Chip = forwardRef(function Chip({ variant = 'default', tileColor, className, style, ...props }, ref) {
46
+ return (_jsx(Toggle.Root, { ref: ref, className: cx('pk-chip', variant !== 'default' && `pk-chip--${variant}`, className), style: tileColor ? { '--pk-tile-color': tileColor, ...style } : style, ...props }));
47
+ });
@@ -0,0 +1,97 @@
1
+ import { type HTMLAttributes, type MouseEvent, type ReactNode } from 'react';
2
+ import { type CategoryColor } from './display.js';
3
+ /**
4
+ * The head of a page (`.pk-page-header`): an optional icon, the title, the actions and a line of
5
+ * description, in that order. On a narrow page the actions move to their own row.
6
+ */
7
+ export declare const PageHeader: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLElement>>;
8
+ /** The page's title (`h1.pk-page-header__title`); a count or badge may follow the words. */
9
+ export declare const PageHeaderTitle: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & import("react").RefAttributes<HTMLHeadingElement>>;
10
+ export declare const PageHeaderActions: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
11
+ export declare const PageHeaderDescription: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLParagraphElement>>;
12
+ /** A number beside a heading (`.pk-count`). */
13
+ export declare const Count: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & import("react").RefAttributes<HTMLSpanElement>>;
14
+ export interface GroupProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
15
+ title: ReactNode;
16
+ /** How many rows are in the group. */
17
+ count?: ReactNode;
18
+ /** The heading's level; 2 by default. */
19
+ level?: 2 | 3 | 4 | 5 | 6;
20
+ /** Put the children in a card (the default), or lay them out yourself. */
21
+ card?: boolean;
22
+ }
23
+ /** A titled section of a page (`.pk-group`): a heading with a count, then a card of rows. */
24
+ export declare const Group: import("react").ForwardRefExoticComponent<GroupProps & import("react").RefAttributes<HTMLElement>>;
25
+ /** The quiet line of facts under a row title (`.pk-meta`): one element per fact. */
26
+ export declare const Meta: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
27
+ export interface MetaItemProps extends HTMLAttributes<HTMLSpanElement> {
28
+ /** The CSS adds a prefix or a color for each kind; write the words, not the symbols. */
29
+ kind?: 'owner' | 'due' | 'attention' | 'carried' | 'repeat';
30
+ /** For `due`: past due. Say "overdue" in the words too. */
31
+ overdue?: boolean;
32
+ }
33
+ export declare const MetaItem: import("react").ForwardRefExoticComponent<MetaItemProps & import("react").RefAttributes<HTMLSpanElement>>;
34
+ export interface RowProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
35
+ title: ReactNode;
36
+ /** The line under the title: a `Meta`. */
37
+ meta?: ReactNode;
38
+ /** A body that opens: the row becomes a `<details>`. Its summary must not hold controls. */
39
+ body?: ReactNode;
40
+ /** With a body: open at first. */
41
+ defaultOpen?: boolean;
42
+ /** Make the title a link (a row that opens a page). */
43
+ href?: string;
44
+ /** Make the title a button (a row that opens a panel or dialog). */
45
+ onOpen?: (event: MouseEvent<HTMLButtonElement>) => void;
46
+ /** A completion control before the title (a `CheckRound`). Not with a body. */
47
+ check?: ReactNode;
48
+ /** A category tile or icon before the title. */
49
+ icon?: ReactNode;
50
+ /** A bar down the left edge: a category hue, or any color token. Say the category in words. */
51
+ color?: CategoryColor | (string & {});
52
+ /** A quiet delete button at the end; its name, such as "Delete Draft the brief". */
53
+ removeLabel?: string;
54
+ onRemove?: () => void;
55
+ done?: boolean;
56
+ /** Selected: the accent tint and ring. Also expose it (a checkbox, or `aria-selected`). */
57
+ selected?: boolean;
58
+ /** Only reports: no pointer, no hover. */
59
+ static?: boolean;
60
+ /** The element for a plain row; `li` inside a list. */
61
+ as?: 'div' | 'li';
62
+ }
63
+ /**
64
+ * A row in a list (`.pk-row`): a title, a line of meta, and optionally a body that opens. Put
65
+ * rows in a `Card` (or a `Group`) and they get separators.
66
+ */
67
+ export declare const Row: import("react").ForwardRefExoticComponent<RowProps & import("react").RefAttributes<HTMLElement>>;
68
+ /** The pages to show: the first, the last, the current and its neighbors, with gaps (null). */
69
+ export declare function pageRange(page: number, pageCount: number, siblings?: number): (number | null)[];
70
+ export interface PaginationProps extends Omit<HTMLAttributes<HTMLElement>, 'onChange'> {
71
+ /** The current page, from 1. */
72
+ page: number;
73
+ /** How many pages. Leave it out when the total is unknown: Previous, "Page N" and Next. */
74
+ pageCount?: number;
75
+ /** Pages are buttons that call this… */
76
+ onPageChange?: (page: number) => void;
77
+ /** …or links to this URL. */
78
+ getPageHref?: (page: number) => string;
79
+ /** The summary, such as "26–50 of 312". */
80
+ summary?: ReactNode;
81
+ /** Neighbors of the current page to show on each side. */
82
+ siblings?: number;
83
+ /** Rows per page, with a select to change it. */
84
+ pageSize?: number;
85
+ pageSizeOptions?: number[];
86
+ onPageSizeChange?: (size: number) => void;
87
+ /** The navigation's name. */
88
+ 'aria-label'?: string;
89
+ labels?: {
90
+ previous?: string;
91
+ next?: string;
92
+ rows?: string;
93
+ page?: (page: number) => string;
94
+ };
95
+ }
96
+ /** Pages of a list or table (`.pk-pagination`). */
97
+ export declare const Pagination: import("react").ForwardRefExoticComponent<PaginationProps & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,120 @@
1
+ 'use client';
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { forwardRef, useId, } from 'react';
4
+ import { cx } from '../lib/cx.js';
5
+ import { Card } from './display.js';
6
+ import { Icon } from './icon.js';
7
+ /* ---- page header ---- */
8
+ /**
9
+ * The head of a page (`.pk-page-header`): an optional icon, the title, the actions and a line of
10
+ * description, in that order. On a narrow page the actions move to their own row.
11
+ */
12
+ export const PageHeader = forwardRef(function PageHeader({ className, ...props }, ref) {
13
+ return _jsx("header", { ref: ref, className: cx('pk-page-header', className), ...props });
14
+ });
15
+ /** The page's title (`h1.pk-page-header__title`); a count or badge may follow the words. */
16
+ export const PageHeaderTitle = forwardRef(function PageHeaderTitle({ className, ...props }, ref) {
17
+ return _jsx("h1", { ref: ref, className: cx('pk-page-header__title', className), ...props });
18
+ });
19
+ export const PageHeaderActions = forwardRef(function PageHeaderActions({ className, ...props }, ref) {
20
+ return _jsx("div", { ref: ref, className: cx('pk-page-header__actions', className), ...props });
21
+ });
22
+ export const PageHeaderDescription = forwardRef(function PageHeaderDescription({ className, ...props }, ref) {
23
+ return _jsx("p", { ref: ref, className: cx('pk-page-header__description', className), ...props });
24
+ });
25
+ /* ---- group and count ---- */
26
+ /** A number beside a heading (`.pk-count`). */
27
+ export const Count = forwardRef(function Count({ className, ...props }, ref) {
28
+ return _jsx("span", { ref: ref, className: cx('pk-count', className), ...props });
29
+ });
30
+ /** A titled section of a page (`.pk-group`): a heading with a count, then a card of rows. */
31
+ export const Group = forwardRef(function Group({ title, count, level = 2, card = true, className, children, ...props }, ref) {
32
+ const headingId = `pk-group-${useId()}`;
33
+ const Heading = `h${level}`;
34
+ return (_jsxs("section", { ref: ref, className: cx('pk-group', className), "aria-labelledby": headingId, ...props, children: [_jsxs(Heading, { className: "pk-group__heading", id: headingId, children: [title, count != null && (_jsxs(_Fragment, { children: [' ', _jsx(Count, { children: count })] }))] }), card ? _jsx(Card, { children: children }) : children] }));
35
+ });
36
+ /* ---- meta ---- */
37
+ /** The quiet line of facts under a row title (`.pk-meta`): one element per fact. */
38
+ export const Meta = forwardRef(function Meta({ className, ...props }, ref) {
39
+ return _jsx("div", { ref: ref, className: cx('pk-meta', className), ...props });
40
+ });
41
+ export const MetaItem = forwardRef(function MetaItem({ kind, overdue, className, ...props }, ref) {
42
+ return (_jsx("span", { ref: ref, className: cx(kind && `pk-meta__${kind}`, kind === 'due' && overdue && 'pk-meta__due--overdue', className) || undefined, ...props }));
43
+ });
44
+ const CATEGORY = new Set(['rose', 'green', 'indigo', 'sky', 'purple', 'amber', 'teal', 'gray']);
45
+ /**
46
+ * A row in a list (`.pk-row`): a title, a line of meta, and optionally a body that opens. Put
47
+ * rows in a `Card` (or a `Group`) and they get separators.
48
+ */
49
+ export const Row = forwardRef(function Row({ title, meta, body, defaultOpen, href, onOpen, check, icon, color, removeLabel, onRemove, done, selected, static: isStatic, as = 'div', className, style, ...props }, ref) {
50
+ const titleEl = href !== undefined ? (_jsx("a", { className: "pk-row__title", href: href, children: title })) : onOpen ? (_jsx("button", { type: "button", className: "pk-row__title", onClick: onOpen, children: title })) : (_jsx("span", { className: "pk-row__title", children: title }));
51
+ const inside = (_jsxs(_Fragment, { children: [check != null && _jsx("span", { className: "pk-row__check", children: check }), icon != null && _jsx("span", { className: "pk-row__icon", children: icon }), titleEl, meta, onRemove && (_jsx("button", { type: "button", className: "pk-row__trailing", "aria-label": removeLabel ?? 'Remove', onClick: onRemove, children: "\u00D7" }))] }));
52
+ const shared = {
53
+ className: cx('pk-row', check != null && 'pk-row--with-check', icon != null && 'pk-row--with-icon', onRemove && 'pk-row--with-trailing', isStatic && 'pk-row--static', className),
54
+ style: color
55
+ ? {
56
+ '--pk-row-color': CATEGORY.has(color) ? `var(--pk-color-cat-${color})` : color,
57
+ ...style,
58
+ }
59
+ : style,
60
+ 'data-done': done ? '' : undefined,
61
+ 'data-selected': selected ? '' : undefined,
62
+ ...props,
63
+ };
64
+ if (body != null) {
65
+ return (_jsxs("details", { ref: ref, open: defaultOpen, ...shared, children: [_jsx("summary", { className: "pk-row__summary", children: inside }), _jsx("div", { className: "pk-row__body", children: body })] }));
66
+ }
67
+ const Tag = as;
68
+ return (_jsx(Tag, { ref: ref, ...shared, children: _jsx("div", { className: "pk-row__summary", children: inside }) }));
69
+ });
70
+ /* ---- pagination ---- */
71
+ /** The pages to show: the first, the last, the current and its neighbors, with gaps (null). */
72
+ export function pageRange(page, pageCount, siblings = 1) {
73
+ const pages = new Set([1, pageCount]);
74
+ for (let p = page - siblings; p <= page + siblings; p++) {
75
+ if (p >= 1 && p <= pageCount)
76
+ pages.add(p);
77
+ }
78
+ const sorted = [...pages].filter((p) => p >= 1).sort((a, b) => a - b);
79
+ const out = [];
80
+ sorted.forEach((p, i) => {
81
+ if (i > 0) {
82
+ const gap = p - sorted[i - 1];
83
+ if (gap === 2)
84
+ out.push(p - 1);
85
+ else if (gap > 2)
86
+ out.push(null);
87
+ }
88
+ out.push(p);
89
+ });
90
+ return out;
91
+ }
92
+ /** Pages of a list or table (`.pk-pagination`). */
93
+ export const Pagination = forwardRef(function Pagination({ page, pageCount, onPageChange, getPageHref, summary, siblings = 1, pageSize, pageSizeOptions, onPageSizeChange, 'aria-label': label = 'Pages', labels = {}, className, ...props }, ref) {
94
+ const sizeId = `pk-pagination-${useId()}-size`;
95
+ const { previous = 'Previous page', next = 'Next page', rows = 'Rows', page: pageLabel = (p) => `Page ${p}`, } = labels;
96
+ const link = (target, content, { name, current, disabled }) => {
97
+ const common = {
98
+ className: 'pk-pagination__page',
99
+ 'aria-label': name,
100
+ 'aria-current': current ? 'page' : undefined,
101
+ 'aria-disabled': disabled ? true : undefined,
102
+ };
103
+ if (getPageHref) {
104
+ return disabled ? (_jsx("a", { role: "link", ...common, children: content })) : (_jsx("a", { href: getPageHref(target), ...common, children: content }));
105
+ }
106
+ return (_jsx("button", { type: "button", ...common, onClick: () => {
107
+ if (!disabled && !current)
108
+ onPageChange?.(target);
109
+ }, children: content }));
110
+ };
111
+ const known = typeof pageCount === 'number';
112
+ const last = known ? Math.max(1, pageCount) : undefined;
113
+ return (_jsxs("nav", { ref: ref, className: cx('pk-pagination', className), "aria-label": label, ...props, children: [summary != null && _jsx("p", { className: "pk-pagination__summary", children: summary }), _jsxs("ul", { className: "pk-pagination__pages", children: [_jsx("li", { children: link(page - 1, _jsx(Icon, { name: "chevron-left" }), {
114
+ name: previous,
115
+ disabled: page <= 1,
116
+ }) }), known ? (pageRange(page, last, siblings).map((p, i) => (_jsx("li", { children: p === null ? (_jsx("span", { className: "pk-pagination__gap", "aria-hidden": "true", children: "\u2026" })) : (link(p, p, { current: p === page, name: p === page ? undefined : pageLabel(p) })) }, p ?? `gap-${i}`)))) : (_jsx("li", { children: _jsx("span", { className: "pk-pagination__page", "aria-current": "page", children: pageLabel(page) }) })), _jsx("li", { children: link(page + 1, _jsx(Icon, { name: "chevron-right" }), {
117
+ name: next,
118
+ disabled: known ? page >= last : false,
119
+ }) })] }), pageSize !== undefined && pageSizeOptions && (_jsxs("label", { className: "pk-pagination__size", htmlFor: sizeId, children: [rows, ' ', _jsx("select", { id: sizeId, className: "pk-select pk-select--compact", value: pageSize, onChange: (event) => onPageSizeChange?.(Number(event.currentTarget.value)), children: pageSizeOptions.map((size) => (_jsx("option", { value: size, children: size }, size))) })] }))] }));
120
+ });
@@ -0,0 +1,10 @@
1
+ import { Popover as PopoverPrimitive } from 'radix-ui';
2
+ export declare const Popover: import("react").FC<PopoverPrimitive.PopoverProps>;
3
+ export declare const PopoverTrigger: import("react").ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
4
+ export declare const PopoverAnchor: import("react").ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & import("react").RefAttributes<HTMLDivElement>>;
5
+ export declare const PopoverClose: import("react").ForwardRefExoticComponent<PopoverPrimitive.PopoverCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
6
+ /**
7
+ * The popover surface (`.pk-popover`): the menu's surface for anything else, such as a small
8
+ * form. Radix places it, keeps it in the viewport, moves focus in and closes it on Escape.
9
+ */
10
+ export declare const PopoverContent: import("react").ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,16 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Popover as PopoverPrimitive } from 'radix-ui';
4
+ import { forwardRef } from 'react';
5
+ import { cx } from '../lib/cx.js';
6
+ export const Popover = PopoverPrimitive.Root;
7
+ export const PopoverTrigger = PopoverPrimitive.Trigger;
8
+ export const PopoverAnchor = PopoverPrimitive.Anchor;
9
+ export const PopoverClose = PopoverPrimitive.Close;
10
+ /**
11
+ * The popover surface (`.pk-popover`): the menu's surface for anything else, such as a small
12
+ * form. Radix places it, keeps it in the viewport, moves focus in and closes it on Escape.
13
+ */
14
+ export const PopoverContent = forwardRef(function PopoverContent({ className, align = 'start', sideOffset = 6, collisionPadding = 8, ...props }, ref) {
15
+ return (_jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { ref: ref, className: cx('pk-popover', className), align: align, sideOffset: sideOffset, collisionPadding: collisionPadding, ...props }) }));
16
+ });
@@ -0,0 +1,153 @@
1
+ import { type AnchorHTMLAttributes, type HTMLAttributes, type InputHTMLAttributes, type MouseEvent, type ReactNode } from 'react';
2
+ import { type IconName } from './icon.js';
3
+ interface ShellContextValue {
4
+ rail: boolean;
5
+ setRail: (rail: boolean) => void;
6
+ toggleRail: () => void;
7
+ narrow: boolean;
8
+ drawerOpen: boolean;
9
+ setDrawerOpen: (open: boolean, options?: {
10
+ restoreFocus?: boolean;
11
+ }) => void;
12
+ panelOpen: boolean;
13
+ setPanelOpen: (open: boolean) => void;
14
+ sidebarId: string;
15
+ sidebarRef: {
16
+ current: HTMLElement | null;
17
+ };
18
+ menuButtonRef: {
19
+ current: HTMLElement | null;
20
+ };
21
+ }
22
+ /** The app shell's state: the rail, the phone drawer and the side panel. Use it inside `AppShell`. */
23
+ export declare function useAppShell(): ShellContextValue;
24
+ export interface AppShellProps extends HTMLAttributes<HTMLDivElement> {
25
+ /** Start as the icon rail. Left out: the saved choice, else the rail on windows up to 1100px. */
26
+ defaultRail?: boolean;
27
+ /** Control the rail yourself. */
28
+ rail?: boolean;
29
+ onRailChange?: (rail: boolean) => void;
30
+ /** Save the rail choice as `pk.sidebar`, which the boot script reads. On by default. */
31
+ persist?: boolean;
32
+ }
33
+ /**
34
+ * The app shell (`.pk-shell`): the dark frame of sidebar and top bar around the content. Its
35
+ * state lives on `<html>` (`data-sidebar="rail"`, `data-sidebar-open`, `data-panel-open`), where
36
+ * the CSS and the boot script expect it. It also renders the scrim behind the phone drawer.
37
+ */
38
+ export declare const AppShell: import("react").ForwardRefExoticComponent<AppShellProps & import("react").RefAttributes<HTMLDivElement>>;
39
+ /** The column beside the sidebar (`.pk-shell__main`): the top bar, then the content. */
40
+ export declare const ShellMain: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
41
+ /**
42
+ * The sidebar (`.pk-sidebar`): full width, an icon rail, or a drawer on phones. Following a link
43
+ * in the drawer closes it; a button closes it only with `data-pk-sidebar-close`.
44
+ */
45
+ export declare const Sidebar: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLElement>>;
46
+ /** The top of the sidebar, as tall as the top bar (`.pk-sidebar__brand`). */
47
+ export declare const SidebarBrand: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
48
+ export interface WordmarkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
49
+ /** The project's mark (an svg); it stays on the rail. It is decoration: the name is the text. */
50
+ mark?: ReactNode;
51
+ asChild?: boolean;
52
+ }
53
+ /** The product's name and mark (`.pk-wordmark`), usually a link home. */
54
+ export declare const Wordmark: import("react").ForwardRefExoticComponent<WordmarkProps & import("react").RefAttributes<HTMLAnchorElement>>;
55
+ export interface SidebarNavProps extends HTMLAttributes<HTMLElement> {
56
+ /** The navigation's name ("Projects", "Main"). */
57
+ 'aria-label': string;
58
+ }
59
+ /** The scrolling middle of the sidebar (`nav.pk-sidebar__groups`). */
60
+ export declare const SidebarNav: import("react").ForwardRefExoticComponent<SidebarNavProps & import("react").RefAttributes<HTMLElement>>;
61
+ export interface SidebarGroupProps extends HTMLAttributes<HTMLDivElement> {
62
+ /** The section's name. In the rail a short rule stands in for it. */
63
+ label?: ReactNode;
64
+ }
65
+ /** A section of the sidebar (`.pk-sidebar__group`): a label and a list of items. */
66
+ export declare const SidebarGroup: import("react").ForwardRefExoticComponent<SidebarGroupProps & import("react").RefAttributes<HTMLDivElement>>;
67
+ export interface SidebarItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
68
+ /** An icon name from the sprite, or any icon element (a monogram). */
69
+ icon?: IconName | ReactNode;
70
+ /** The page this item opens is the one showing. */
71
+ current?: boolean;
72
+ /** A sub-item of this item is current: the rail, which hides sub-items, marks this one. */
73
+ currentParent?: boolean;
74
+ /** A count after the label. */
75
+ count?: ReactNode;
76
+ /** Sub-items (`SidebarSubItem`), listed under this item; the rail hides them. */
77
+ subItems?: ReactNode;
78
+ /** Render the child (a router's link) as the item; its children are the label. */
79
+ asChild?: boolean;
80
+ /** Without `href`, the item is a button (in the foot: Feedback, a theme switch). */
81
+ onClick?: (event: MouseEvent<HTMLElement>) => void;
82
+ }
83
+ /** A sidebar item (`.pk-sidebar__item`): a link (or a button without `href`). */
84
+ export declare const SidebarItem: import("react").ForwardRefExoticComponent<SidebarItemProps & import("react").RefAttributes<HTMLElement>>;
85
+ /** A sub-item under a `SidebarItem`: a shorter row with a dot where the icon goes. */
86
+ export declare const SidebarSubItem: import("react").ForwardRefExoticComponent<Omit<SidebarItemProps, "icon" | "subItems"> & import("react").RefAttributes<HTMLElement>>;
87
+ /** The bottom of the sidebar (`.pk-sidebar__foot`): feedback, theme, collapse. */
88
+ export declare const SidebarFoot: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
89
+ export interface SidebarCollapseProps extends HTMLAttributes<HTMLButtonElement> {
90
+ /** The visible label. */
91
+ label?: string;
92
+ }
93
+ /** The rail toggle, in the foot (`.pk-sidebar__collapse`). Hidden on phones. */
94
+ export declare const SidebarCollapse: import("react").ForwardRefExoticComponent<SidebarCollapseProps & import("react").RefAttributes<HTMLButtonElement>>;
95
+ /** The theme switch, as a sidebar item: Auto, Light, Dark in turn. */
96
+ export declare const SidebarThemeToggle: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLButtonElement> & import("react").RefAttributes<HTMLButtonElement>>;
97
+ /** The top bar (`.pk-topbar`), in the frame: start, middle and end. */
98
+ export declare const Topbar: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLElement>>;
99
+ export declare const TopbarStart: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
100
+ export declare const TopbarMid: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
101
+ export declare const TopbarEnd: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
102
+ /** Where you are, in the top bar (`.pk-topbar__context`). */
103
+ export declare const TopbarContext: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & import("react").RefAttributes<HTMLSpanElement>>;
104
+ export interface TopbarMenuButtonProps extends HTMLAttributes<HTMLButtonElement> {
105
+ 'aria-label'?: string;
106
+ }
107
+ /** Opens the sidebar drawer on phones (`.pk-topbar__menu`); hidden on wider screens. */
108
+ export declare const TopbarMenuButton: import("react").ForwardRefExoticComponent<TopbarMenuButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
109
+ export interface SearchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
110
+ /** `frame` is for the dark top bar. */
111
+ variant?: 'default' | 'frame';
112
+ /** A search field has no visible label, so it needs a name. */
113
+ 'aria-label': string;
114
+ /** Classes for the wrapper. */
115
+ wrapperClassName?: string;
116
+ }
117
+ /** The search field (`.pk-search`): an icon inside a rounded input. */
118
+ export declare const Search: import("react").ForwardRefExoticComponent<SearchProps & import("react").RefAttributes<HTMLInputElement>>;
119
+ /**
120
+ * The page area (`main.pk-content`): it scrolls on its own, and its corner tightens once the
121
+ * content is under the top bar. Focusable, so the keyboard can scroll it.
122
+ */
123
+ export declare const Content: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLElement>>;
124
+ export interface PageProps extends HTMLAttributes<HTMLDivElement> {
125
+ /** Fill the content's height (a board, a calendar). */
126
+ fill?: boolean;
127
+ }
128
+ /** The page inside the content (`.pk-page`), a size container for its parts. */
129
+ export declare const Page: import("react").ForwardRefExoticComponent<PageProps & import("react").RefAttributes<HTMLDivElement>>;
130
+ export interface SidePanelProps extends HTMLAttributes<HTMLElement> {
131
+ open: boolean;
132
+ onOpenChange: (open: boolean) => void;
133
+ }
134
+ /**
135
+ * A side panel under the top bar (`.pk-panel`): chat, details. Wide windows make room for it;
136
+ * narrower ones lay it over the page; phones give it the screen. Opening it focuses an element
137
+ * with `data-autofocus` or the first field; Escape and the close button close it and return
138
+ * focus to where it was. Inside an `AppShell` it sets `data-panel-open`.
139
+ */
140
+ export declare const SidePanel: import("react").ForwardRefExoticComponent<SidePanelProps & import("react").RefAttributes<HTMLElement>>;
141
+ export interface SidePanelHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
142
+ /** An icon name or element before the title. */
143
+ icon?: IconName | ReactNode;
144
+ title: ReactNode;
145
+ /** A quiet note after the title (a model name, a count). */
146
+ meta?: ReactNode;
147
+ closeLabel?: string;
148
+ }
149
+ /** The panel's head (`.pk-panel__head`): icon, title, meta and the close button. */
150
+ export declare const SidePanelHeader: import("react").ForwardRefExoticComponent<SidePanelHeaderProps & import("react").RefAttributes<HTMLDivElement>>;
151
+ export declare const SidePanelBody: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
152
+ export declare const SidePanelFooter: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
153
+ export {};