@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.
- package/LICENSE +21 -0
- package/README.md +166 -2
- package/dist/components/avatar.d.ts +19 -0
- package/dist/components/avatar.js +27 -0
- package/dist/components/button.d.ts +45 -0
- package/dist/components/button.js +44 -0
- package/dist/components/choice.d.ts +53 -0
- package/dist/components/choice.js +73 -0
- package/dist/components/dialog.d.ts +65 -0
- package/dist/components/dialog.js +178 -0
- package/dist/components/display.d.ts +61 -0
- package/dist/components/display.js +63 -0
- package/dist/components/field.d.ts +44 -0
- package/dist/components/field.js +62 -0
- package/dist/components/icon.d.ts +29 -0
- package/dist/components/icon.js +17 -0
- package/dist/components/link.d.ts +10 -0
- package/dist/components/link.js +9 -0
- package/dist/components/menu.d.ts +35 -0
- package/dist/components/menu.js +60 -0
- package/dist/components/navigation.d.ts +42 -0
- package/dist/components/navigation.js +47 -0
- package/dist/components/page.d.ts +97 -0
- package/dist/components/page.js +120 -0
- package/dist/components/popover.d.ts +10 -0
- package/dist/components/popover.js +16 -0
- package/dist/components/shell.d.ts +153 -0
- package/dist/components/shell.js +359 -0
- package/dist/components/table.d.ts +41 -0
- package/dist/components/table.js +35 -0
- package/dist/components/theme.d.ts +10 -0
- package/dist/components/theme.js +41 -0
- package/dist/components/toast.d.ts +27 -0
- package/dist/components/toast.js +93 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +20 -0
- package/dist/lib/boot-script.d.ts +9 -0
- package/dist/lib/boot-script.js +26 -0
- package/dist/lib/compose-refs.d.ts +3 -0
- package/dist/lib/compose-refs.js +11 -0
- package/dist/lib/cx.d.ts +4 -0
- package/dist/lib/cx.js +4 -0
- package/dist/lib/dom.d.ts +10 -0
- package/dist/lib/dom.js +29 -0
- package/dist/lib/use-controllable.d.ts +5 -0
- package/dist/lib/use-controllable.js +19 -0
- package/package.json +50 -3
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Slot } from 'radix-ui';
|
|
4
|
+
import { Children, cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useMemo, useRef, useState, } from 'react';
|
|
5
|
+
import { composeRefs } from '../lib/compose-refs.js';
|
|
6
|
+
import { cx } from '../lib/cx.js';
|
|
7
|
+
import { FIELD, FOCUSABLE, matches, readStorage, useIsomorphicLayoutEffect, writeStorage, } from '../lib/dom.js';
|
|
8
|
+
import { IconButton } from './button.js';
|
|
9
|
+
import { Icon } from './icon.js';
|
|
10
|
+
import { useTheme } from './theme.js';
|
|
11
|
+
/* The breakpoints the CSS uses: md (the drawer) and lg (the rail by default). Tests keep them
|
|
12
|
+
equal to the tokens. */
|
|
13
|
+
const DRAWER = '(max-width: 760px)';
|
|
14
|
+
const RAIL_BY_DEFAULT = '(max-width: 1100px)';
|
|
15
|
+
const SIDEBAR_KEY = 'pk.sidebar';
|
|
16
|
+
const ShellContext = createContext(null);
|
|
17
|
+
/** The app shell's state: the rail, the phone drawer and the side panel. Use it inside `AppShell`. */
|
|
18
|
+
export function useAppShell() {
|
|
19
|
+
const ctx = useContext(ShellContext);
|
|
20
|
+
if (!ctx)
|
|
21
|
+
throw new Error('useAppShell must be used inside an AppShell.');
|
|
22
|
+
return ctx;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The app shell (`.pk-shell`): the dark frame of sidebar and top bar around the content. Its
|
|
26
|
+
* state lives on `<html>` (`data-sidebar="rail"`, `data-sidebar-open`, `data-panel-open`), where
|
|
27
|
+
* the CSS and the boot script expect it. It also renders the scrim behind the phone drawer.
|
|
28
|
+
*/
|
|
29
|
+
export const AppShell = forwardRef(function AppShell({ defaultRail, rail: railProp, onRailChange, persist = true, className, children, ...props }, ref) {
|
|
30
|
+
const [ownRail, setOwnRail] = useState(defaultRail ?? false);
|
|
31
|
+
const [ready, setReady] = useState(false);
|
|
32
|
+
const [narrow, setNarrow] = useState(false);
|
|
33
|
+
const [drawerOpen, setDrawerState] = useState(false);
|
|
34
|
+
const [panelOpen, setPanelOpen] = useState(false);
|
|
35
|
+
const rail = railProp ?? ownRail;
|
|
36
|
+
const sidebarId = `pk-sidebar-${useId()}`;
|
|
37
|
+
const sidebarRef = useRef(null);
|
|
38
|
+
const menuButtonRef = useRef(null);
|
|
39
|
+
const opener = useRef(null);
|
|
40
|
+
// First paint follows the boot script (or the saved choice, or the window), not the server.
|
|
41
|
+
useIsomorphicLayoutEffect(() => {
|
|
42
|
+
if (defaultRail === undefined && railProp === undefined) {
|
|
43
|
+
const attr = document.documentElement.getAttribute('data-sidebar');
|
|
44
|
+
const saved = readStorage(SIDEBAR_KEY);
|
|
45
|
+
setOwnRail(attr === 'rail' || saved === 'rail' || (saved === null && matches(RAIL_BY_DEFAULT)));
|
|
46
|
+
}
|
|
47
|
+
setNarrow(matches(DRAWER));
|
|
48
|
+
setReady(true);
|
|
49
|
+
// Only on mount: later changes come from the toggle.
|
|
50
|
+
}, []);
|
|
51
|
+
// Write the state where the CSS reads it.
|
|
52
|
+
useIsomorphicLayoutEffect(() => {
|
|
53
|
+
if (!ready)
|
|
54
|
+
return;
|
|
55
|
+
const html = document.documentElement;
|
|
56
|
+
if (rail)
|
|
57
|
+
html.setAttribute('data-sidebar', 'rail');
|
|
58
|
+
else
|
|
59
|
+
html.removeAttribute('data-sidebar');
|
|
60
|
+
html.toggleAttribute('data-sidebar-open', drawerOpen);
|
|
61
|
+
html.toggleAttribute('data-panel-open', panelOpen);
|
|
62
|
+
}, [ready, rail, drawerOpen, panelOpen]);
|
|
63
|
+
useEffect(() => () => {
|
|
64
|
+
const html = document.documentElement;
|
|
65
|
+
html.removeAttribute('data-sidebar-open');
|
|
66
|
+
html.removeAttribute('data-panel-open');
|
|
67
|
+
}, []);
|
|
68
|
+
const setRail = useCallback((next) => {
|
|
69
|
+
if (railProp === undefined)
|
|
70
|
+
setOwnRail(next);
|
|
71
|
+
if (persist)
|
|
72
|
+
writeStorage(SIDEBAR_KEY, next ? 'rail' : 'expanded');
|
|
73
|
+
onRailChange?.(next);
|
|
74
|
+
}, [railProp, persist, onRailChange]);
|
|
75
|
+
const drawerRef = useRef(false);
|
|
76
|
+
drawerRef.current = drawerOpen;
|
|
77
|
+
const setDrawerOpen = useCallback((open, { restoreFocus = false } = {}) => {
|
|
78
|
+
if (drawerRef.current === open)
|
|
79
|
+
return;
|
|
80
|
+
drawerRef.current = open;
|
|
81
|
+
if (open) {
|
|
82
|
+
opener.current = document.activeElement ?? null;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
const sidebar = sidebarRef.current;
|
|
86
|
+
const focusInside = !!sidebar && sidebar.contains(document.activeElement);
|
|
87
|
+
const back = opener.current ?? menuButtonRef.current;
|
|
88
|
+
opener.current = null;
|
|
89
|
+
if (restoreFocus || focusInside)
|
|
90
|
+
back?.focus();
|
|
91
|
+
}
|
|
92
|
+
setDrawerState(open);
|
|
93
|
+
}, []);
|
|
94
|
+
// Opening the drawer moves focus to the current item (or the first control).
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (!drawerOpen)
|
|
97
|
+
return;
|
|
98
|
+
const sidebar = sidebarRef.current;
|
|
99
|
+
(sidebar?.querySelector('[aria-current="page"]') ??
|
|
100
|
+
sidebar?.querySelector(FOCUSABLE))?.focus();
|
|
101
|
+
}, [drawerOpen]);
|
|
102
|
+
// Escape closes the drawer; growing past the phone breakpoint closes it too.
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!drawerOpen)
|
|
105
|
+
return;
|
|
106
|
+
const onKey = (event) => {
|
|
107
|
+
if (event.key === 'Escape')
|
|
108
|
+
setDrawerOpen(false, { restoreFocus: true });
|
|
109
|
+
};
|
|
110
|
+
document.addEventListener('keydown', onKey);
|
|
111
|
+
return () => document.removeEventListener('keydown', onKey);
|
|
112
|
+
}, [drawerOpen, setDrawerOpen]);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (typeof window.matchMedia !== 'function')
|
|
115
|
+
return;
|
|
116
|
+
const query = window.matchMedia(DRAWER);
|
|
117
|
+
const onChange = () => {
|
|
118
|
+
setNarrow(query.matches);
|
|
119
|
+
if (!query.matches) {
|
|
120
|
+
drawerRef.current = false;
|
|
121
|
+
setDrawerState(false);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
query.addEventListener?.('change', onChange);
|
|
125
|
+
return () => query.removeEventListener?.('change', onChange);
|
|
126
|
+
}, []);
|
|
127
|
+
const value = useMemo(() => ({
|
|
128
|
+
rail,
|
|
129
|
+
setRail,
|
|
130
|
+
toggleRail: () => setRail(!rail),
|
|
131
|
+
narrow,
|
|
132
|
+
drawerOpen,
|
|
133
|
+
setDrawerOpen,
|
|
134
|
+
panelOpen,
|
|
135
|
+
setPanelOpen,
|
|
136
|
+
sidebarId,
|
|
137
|
+
sidebarRef,
|
|
138
|
+
menuButtonRef,
|
|
139
|
+
}), [rail, setRail, narrow, drawerOpen, setDrawerOpen, panelOpen, sidebarId]);
|
|
140
|
+
return (_jsxs(ShellContext.Provider, { value: value, children: [_jsx("div", { ref: ref, className: cx('pk-shell', className), ...props, children: children }), _jsx("div", { className: "pk-scrim", hidden: !drawerOpen, onClick: () => setDrawerOpen(false) })] }));
|
|
141
|
+
});
|
|
142
|
+
/** The column beside the sidebar (`.pk-shell__main`): the top bar, then the content. */
|
|
143
|
+
export const ShellMain = forwardRef(function ShellMain({ className, ...props }, ref) {
|
|
144
|
+
return _jsx("div", { ref: ref, className: cx('pk-shell__main', className), ...props });
|
|
145
|
+
});
|
|
146
|
+
/* ---- sidebar ---- */
|
|
147
|
+
/**
|
|
148
|
+
* The sidebar (`.pk-sidebar`): full width, an icon rail, or a drawer on phones. Following a link
|
|
149
|
+
* in the drawer closes it; a button closes it only with `data-pk-sidebar-close`.
|
|
150
|
+
*/
|
|
151
|
+
export const Sidebar = forwardRef(function Sidebar({ className, onClick, ...props }, ref) {
|
|
152
|
+
const shell = useAppShell();
|
|
153
|
+
return (_jsx("aside", { ref: composeRefs(shell.sidebarRef, ref), id: shell.sidebarId, className: cx('pk-sidebar', className), onClick: (event) => {
|
|
154
|
+
onClick?.(event);
|
|
155
|
+
const target = event.target;
|
|
156
|
+
if (shell.narrow && target.closest?.('a[href], [data-pk-sidebar-close]')) {
|
|
157
|
+
shell.setDrawerOpen(false);
|
|
158
|
+
}
|
|
159
|
+
}, ...props }));
|
|
160
|
+
});
|
|
161
|
+
/** The top of the sidebar, as tall as the top bar (`.pk-sidebar__brand`). */
|
|
162
|
+
export const SidebarBrand = forwardRef(function SidebarBrand({ className, ...props }, ref) {
|
|
163
|
+
return _jsx("div", { ref: ref, className: cx('pk-sidebar__brand', className), ...props });
|
|
164
|
+
});
|
|
165
|
+
/** The product's name and mark (`.pk-wordmark`), usually a link home. */
|
|
166
|
+
export const Wordmark = forwardRef(function Wordmark({ mark, asChild, className, children, ...props }, ref) {
|
|
167
|
+
const inner = (label) => (_jsxs(_Fragment, { children: [mark != null && (_jsx("span", { className: "pk-wordmark__mark", "aria-hidden": "true", children: mark })), _jsx("span", { className: "pk-wordmark__text", children: label })] }));
|
|
168
|
+
if (asChild) {
|
|
169
|
+
const child = Children.only(children);
|
|
170
|
+
return (_jsx(Slot.Root, { ref: ref, className: cx('pk-wordmark', className), ...props, children: cloneElement(child, undefined, inner(child.props.children)) }));
|
|
171
|
+
}
|
|
172
|
+
return (_jsx("a", { ref: ref, className: cx('pk-wordmark', className), ...props, children: inner(children) }));
|
|
173
|
+
});
|
|
174
|
+
/** The scrolling middle of the sidebar (`nav.pk-sidebar__groups`). */
|
|
175
|
+
export const SidebarNav = forwardRef(function SidebarNav({ className, ...props }, ref) {
|
|
176
|
+
return _jsx("nav", { ref: ref, className: cx('pk-sidebar__groups', className), ...props });
|
|
177
|
+
});
|
|
178
|
+
const InListContext = createContext(false);
|
|
179
|
+
/** A section of the sidebar (`.pk-sidebar__group`): a label and a list of items. */
|
|
180
|
+
export const SidebarGroup = forwardRef(function SidebarGroup({ label, className, children, ...props }, ref) {
|
|
181
|
+
const labelId = `pk-sidebar-label-${useId()}`;
|
|
182
|
+
return (_jsxs("div", { ref: ref, className: cx('pk-sidebar__group', className), ...props, children: [label != null && (_jsx("p", { className: "pk-sidebar__label", id: labelId, children: _jsx("span", { children: label }) })), _jsx("ul", { "aria-labelledby": label != null ? labelId : undefined, children: _jsx(InListContext.Provider, { value: true, children: children }) })] }));
|
|
183
|
+
});
|
|
184
|
+
function itemLabel(label) {
|
|
185
|
+
return typeof label === 'string' || typeof label === 'number' ? String(label) : undefined;
|
|
186
|
+
}
|
|
187
|
+
function renderIcon(icon) {
|
|
188
|
+
if (icon == null)
|
|
189
|
+
return null;
|
|
190
|
+
return typeof icon === 'string' ? _jsx(Icon, { name: icon }) : icon;
|
|
191
|
+
}
|
|
192
|
+
function SidebarEntry({ sub, icon, current, currentParent, count, subItems, asChild, className, children, title, href, innerRef, ...props }) {
|
|
193
|
+
const shell = useContext(ShellContext);
|
|
194
|
+
const inList = useContext(InListContext);
|
|
195
|
+
const tooltips = !!shell && shell.rail && !shell.narrow;
|
|
196
|
+
const classes = cx('pk-sidebar__item', sub && 'pk-sidebar__sub', currentParent && 'is-current-parent', className);
|
|
197
|
+
const inner = (label) => (_jsxs(_Fragment, { children: [sub ? _jsx("span", { className: "pk-sidebar__dot", "aria-hidden": "true" }) : renderIcon(icon), _jsx("span", { className: "pk-sidebar__text", children: label }), count != null && _jsx("span", { className: "pk-sidebar__count", children: count })] }));
|
|
198
|
+
const shared = {
|
|
199
|
+
className: classes,
|
|
200
|
+
'aria-current': current ? 'page' : undefined,
|
|
201
|
+
// In the rail the labels are hidden, so a tooltip stands in for them.
|
|
202
|
+
title: title ?? (tooltips ? itemLabel(asChild ? undefined : children) : undefined),
|
|
203
|
+
};
|
|
204
|
+
let entry;
|
|
205
|
+
if (asChild && isValidElement(children)) {
|
|
206
|
+
const child = children;
|
|
207
|
+
entry = (_jsx(Slot.Root, { ref: innerRef, ...shared, title: shared.title ?? (tooltips ? itemLabel(child.props.children) : undefined), ...props, children: cloneElement(child, undefined, inner(child.props.children)) }));
|
|
208
|
+
}
|
|
209
|
+
else if (href !== undefined) {
|
|
210
|
+
entry = (_jsx("a", { ref: innerRef, href: href, ...shared, ...props, children: inner(children) }));
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
entry = (_jsx("button", { ref: innerRef, type: "button", ...shared, ...props, children: inner(children) }));
|
|
214
|
+
}
|
|
215
|
+
const subs = subItems != null ? (_jsx("ul", { className: "pk-sidebar__subs", children: _jsx(InListContext.Provider, { value: true, children: subItems }) })) : null;
|
|
216
|
+
if (!inList)
|
|
217
|
+
return (_jsxs(_Fragment, { children: [entry, subs] }));
|
|
218
|
+
return (_jsx("li", { children: _jsxs(InListContext.Provider, { value: false, children: [entry, subs] }) }));
|
|
219
|
+
}
|
|
220
|
+
/** A sidebar item (`.pk-sidebar__item`): a link (or a button without `href`). */
|
|
221
|
+
export const SidebarItem = forwardRef(function SidebarItem(props, ref) {
|
|
222
|
+
return _jsx(SidebarEntry, { sub: false, innerRef: ref, ...props });
|
|
223
|
+
});
|
|
224
|
+
/** A sub-item under a `SidebarItem`: a shorter row with a dot where the icon goes. */
|
|
225
|
+
export const SidebarSubItem = forwardRef(function SidebarSubItem(props, ref) {
|
|
226
|
+
return _jsx(SidebarEntry, { sub: true, innerRef: ref, ...props });
|
|
227
|
+
});
|
|
228
|
+
/** The bottom of the sidebar (`.pk-sidebar__foot`): feedback, theme, collapse. */
|
|
229
|
+
export const SidebarFoot = forwardRef(function SidebarFoot({ className, ...props }, ref) {
|
|
230
|
+
return _jsx("div", { ref: ref, className: cx('pk-sidebar__foot', className), ...props });
|
|
231
|
+
});
|
|
232
|
+
/** The rail toggle, in the foot (`.pk-sidebar__collapse`). Hidden on phones. */
|
|
233
|
+
export const SidebarCollapse = forwardRef(function SidebarCollapse({ label = 'Collapse', className, onClick, ...props }, ref) {
|
|
234
|
+
const shell = useAppShell();
|
|
235
|
+
const name = shell.rail ? 'Expand sidebar' : 'Collapse sidebar';
|
|
236
|
+
return (_jsxs("button", { ref: ref, type: "button", className: cx('pk-sidebar__item', 'pk-sidebar__collapse', className), "aria-controls": shell.sidebarId, "aria-expanded": !shell.rail, "aria-label": name, title: shell.rail && !shell.narrow ? name : undefined, onClick: (event) => {
|
|
237
|
+
onClick?.(event);
|
|
238
|
+
if (!event.defaultPrevented)
|
|
239
|
+
shell.toggleRail();
|
|
240
|
+
}, ...props, children: [_jsx(Icon, { name: "sidebar" }), _jsx("span", { className: "pk-sidebar__text", children: label })] }));
|
|
241
|
+
});
|
|
242
|
+
const THEME_NAMES = { auto: 'Auto', light: 'Light', dark: 'Dark' };
|
|
243
|
+
const THEME_ICONS = { auto: 'circle-half', light: 'sun', dark: 'moon' };
|
|
244
|
+
/** The theme switch, as a sidebar item: Auto, Light, Dark in turn. */
|
|
245
|
+
export const SidebarThemeToggle = forwardRef(function SidebarThemeToggle({ className, onClick, ...props }, ref) {
|
|
246
|
+
const { theme, cycleTheme } = useTheme();
|
|
247
|
+
const shell = useContext(ShellContext);
|
|
248
|
+
const label = `Theme: ${THEME_NAMES[theme]}`;
|
|
249
|
+
return (_jsxs("button", { ref: ref, type: "button", className: cx('pk-sidebar__item', className), title: shell?.rail && !shell.narrow ? label : undefined, onClick: (event) => {
|
|
250
|
+
onClick?.(event);
|
|
251
|
+
if (!event.defaultPrevented)
|
|
252
|
+
cycleTheme();
|
|
253
|
+
}, ...props, children: [_jsx(Icon, { name: THEME_ICONS[theme] }), _jsx("span", { className: "pk-sidebar__text", children: label })] }));
|
|
254
|
+
});
|
|
255
|
+
/* ---- top bar ---- */
|
|
256
|
+
/** The top bar (`.pk-topbar`), in the frame: start, middle and end. */
|
|
257
|
+
export const Topbar = forwardRef(function Topbar({ className, ...props }, ref) {
|
|
258
|
+
return _jsx("header", { ref: ref, className: cx('pk-topbar', className), ...props });
|
|
259
|
+
});
|
|
260
|
+
const part = (name, displayName) => {
|
|
261
|
+
const Part = forwardRef(({ className, ...props }, ref) => _jsx("div", { ref: ref, className: cx(name, className), ...props }));
|
|
262
|
+
Part.displayName = displayName;
|
|
263
|
+
return Part;
|
|
264
|
+
};
|
|
265
|
+
export const TopbarStart = part('pk-topbar__start', 'TopbarStart');
|
|
266
|
+
export const TopbarMid = part('pk-topbar__mid', 'TopbarMid');
|
|
267
|
+
export const TopbarEnd = part('pk-topbar__end', 'TopbarEnd');
|
|
268
|
+
/** Where you are, in the top bar (`.pk-topbar__context`). */
|
|
269
|
+
export const TopbarContext = forwardRef(function TopbarContext({ className, ...props }, ref) {
|
|
270
|
+
return _jsx("span", { ref: ref, className: cx('pk-topbar__context', className), ...props });
|
|
271
|
+
});
|
|
272
|
+
/** Opens the sidebar drawer on phones (`.pk-topbar__menu`); hidden on wider screens. */
|
|
273
|
+
export const TopbarMenuButton = forwardRef(function TopbarMenuButton({ 'aria-label': label = 'Open navigation', className, onClick, ...props }, ref) {
|
|
274
|
+
const shell = useAppShell();
|
|
275
|
+
return (_jsx(IconButton, { ref: composeRefs(shell.menuButtonRef, ref), variant: "frame", className: cx('pk-topbar__menu', className), "aria-label": label, "aria-controls": shell.sidebarId, "aria-expanded": shell.drawerOpen, onClick: (event) => {
|
|
276
|
+
onClick?.(event);
|
|
277
|
+
if (!event.defaultPrevented)
|
|
278
|
+
shell.setDrawerOpen(!shell.drawerOpen);
|
|
279
|
+
}, ...props, children: _jsx(Icon, { name: "menu" }) }));
|
|
280
|
+
});
|
|
281
|
+
/** The search field (`.pk-search`): an icon inside a rounded input. */
|
|
282
|
+
export const Search = forwardRef(function Search({ variant = 'default', wrapperClassName, className, autoComplete = 'off', ...props }, ref) {
|
|
283
|
+
return (_jsxs("div", { className: cx('pk-search', variant === 'frame' && 'pk-search--frame', wrapperClassName), children: [_jsx(Icon, { name: "search", className: "pk-search__icon" }), _jsx("input", { ref: ref, type: "search", className: cx('pk-search__input', className), autoComplete: autoComplete, ...props })] }));
|
|
284
|
+
});
|
|
285
|
+
/* ---- content ---- */
|
|
286
|
+
/**
|
|
287
|
+
* The page area (`main.pk-content`): it scrolls on its own, and its corner tightens once the
|
|
288
|
+
* content is under the top bar. Focusable, so the keyboard can scroll it.
|
|
289
|
+
*/
|
|
290
|
+
export const Content = forwardRef(function Content({ className, onScroll, tabIndex = 0, ...props }, ref) {
|
|
291
|
+
const [scrolled, setScrolled] = useState(false);
|
|
292
|
+
return (_jsx("main", { ref: ref, tabIndex: tabIndex, className: cx('pk-content', scrolled && 'is-scrolled', className), onScroll: (event) => {
|
|
293
|
+
onScroll?.(event);
|
|
294
|
+
setScrolled(event.currentTarget.scrollTop > 0);
|
|
295
|
+
}, ...props }));
|
|
296
|
+
});
|
|
297
|
+
/** The page inside the content (`.pk-page`), a size container for its parts. */
|
|
298
|
+
export const Page = forwardRef(function Page({ fill, className, ...props }, ref) {
|
|
299
|
+
return _jsx("div", { ref: ref, className: cx('pk-page', fill && 'pk-page--fill', className), ...props });
|
|
300
|
+
});
|
|
301
|
+
const PanelContext = createContext(null);
|
|
302
|
+
/**
|
|
303
|
+
* A side panel under the top bar (`.pk-panel`): chat, details. Wide windows make room for it;
|
|
304
|
+
* narrower ones lay it over the page; phones give it the screen. Opening it focuses an element
|
|
305
|
+
* with `data-autofocus` or the first field; Escape and the close button close it and return
|
|
306
|
+
* focus to where it was. Inside an `AppShell` it sets `data-panel-open`.
|
|
307
|
+
*/
|
|
308
|
+
export const SidePanel = forwardRef(function SidePanel({ open, onOpenChange, className, onKeyDown, children, ...props }, ref) {
|
|
309
|
+
const shell = useContext(ShellContext);
|
|
310
|
+
const node = useRef(null);
|
|
311
|
+
const returnTo = useRef(null);
|
|
312
|
+
const titleId = `pk-panel-${useId()}-title`;
|
|
313
|
+
const setPanelOpen = shell?.setPanelOpen;
|
|
314
|
+
useIsomorphicLayoutEffect(() => {
|
|
315
|
+
if (setPanelOpen)
|
|
316
|
+
setPanelOpen(open);
|
|
317
|
+
else
|
|
318
|
+
document.documentElement.toggleAttribute('data-panel-open', open);
|
|
319
|
+
}, [open, setPanelOpen]);
|
|
320
|
+
useEffect(() => {
|
|
321
|
+
const panel = node.current;
|
|
322
|
+
if (!panel)
|
|
323
|
+
return;
|
|
324
|
+
if (open) {
|
|
325
|
+
returnTo.current = document.activeElement;
|
|
326
|
+
panel.querySelector(`[data-autofocus], ${FIELD}`)?.focus();
|
|
327
|
+
}
|
|
328
|
+
else if (returnTo.current) {
|
|
329
|
+
const back = returnTo.current;
|
|
330
|
+
returnTo.current = null;
|
|
331
|
+
if (!document.activeElement || document.activeElement === document.body)
|
|
332
|
+
back.focus();
|
|
333
|
+
}
|
|
334
|
+
}, [open]);
|
|
335
|
+
const close = useCallback(() => {
|
|
336
|
+
const panel = node.current;
|
|
337
|
+
const back = returnTo.current;
|
|
338
|
+
const focusInside = !!panel && panel.contains(document.activeElement);
|
|
339
|
+
onOpenChange(false);
|
|
340
|
+
if (focusInside && back?.isConnected) {
|
|
341
|
+
returnTo.current = null;
|
|
342
|
+
back.focus();
|
|
343
|
+
}
|
|
344
|
+
}, [onOpenChange]);
|
|
345
|
+
return (_jsx(PanelContext.Provider, { value: { titleId, close }, children: _jsx("aside", { ref: composeRefs(node, ref), className: cx('pk-panel', className), "aria-labelledby": titleId, hidden: !open, onKeyDown: (event) => {
|
|
346
|
+
onKeyDown?.(event);
|
|
347
|
+
if (event.key === 'Escape' && !event.defaultPrevented)
|
|
348
|
+
close();
|
|
349
|
+
}, ...props, children: children }) }));
|
|
350
|
+
});
|
|
351
|
+
/** The panel's head (`.pk-panel__head`): icon, title, meta and the close button. */
|
|
352
|
+
export const SidePanelHeader = forwardRef(function SidePanelHeader({ icon, title, meta, closeLabel = 'Close', className, ...props }, ref) {
|
|
353
|
+
const panel = useContext(PanelContext);
|
|
354
|
+
if (!panel)
|
|
355
|
+
throw new Error('SidePanelHeader must be inside a SidePanel.');
|
|
356
|
+
return (_jsxs("div", { ref: ref, className: cx('pk-panel__head', className), ...props, children: [renderIcon(icon), _jsx("h2", { className: "pk-panel__title", id: panel.titleId, children: title }), meta != null && _jsx("span", { className: "pk-panel__meta", children: meta }), _jsx(IconButton, { "aria-label": closeLabel, className: meta == null ? 'pk-push-right' : undefined, onClick: panel.close, children: _jsx(Icon, { name: "x" }) })] }));
|
|
357
|
+
});
|
|
358
|
+
export const SidePanelBody = part('pk-panel__body', 'SidePanelBody');
|
|
359
|
+
export const SidePanelFooter = part('pk-panel__foot', 'SidePanelFooter');
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type HTMLAttributes, type TdHTMLAttributes, type ThHTMLAttributes } from 'react';
|
|
2
|
+
export interface TableProps extends HTMLAttributes<HTMLTableElement> {
|
|
3
|
+
density?: 'compact' | 'default' | 'comfortable';
|
|
4
|
+
/** Alternate the row fill. */
|
|
5
|
+
striped?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* The scroll region's name, when the table has no `TableCaption` (which names it otherwise).
|
|
8
|
+
*/
|
|
9
|
+
label?: string;
|
|
10
|
+
/** Rows scroll under a header that stays in view, past this height (a CSS length). */
|
|
11
|
+
maxHeight?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A data table (`.pk-table`) in a focusable scroll wrap, so it works on a narrow screen and the
|
|
15
|
+
* keyboard can scroll it. shadcn: Table.
|
|
16
|
+
*/
|
|
17
|
+
export declare const Table: import("react").ForwardRefExoticComponent<TableProps & import("react").RefAttributes<HTMLTableElement>>;
|
|
18
|
+
export interface TableCaptionProps extends HTMLAttributes<HTMLTableCaptionElement> {
|
|
19
|
+
/** Shown above the table. Hidden (for assistive technology only) by default. */
|
|
20
|
+
visible?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const TableCaption: import("react").ForwardRefExoticComponent<TableCaptionProps & import("react").RefAttributes<HTMLTableCaptionElement>>;
|
|
23
|
+
export declare const TableHeader: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
24
|
+
export declare const TableBody: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
25
|
+
export declare const TableFooter: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
26
|
+
export interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
|
|
27
|
+
/** A selected row; its checkbox says so too. */
|
|
28
|
+
selected?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare const TableRow: import("react").ForwardRefExoticComponent<TableRowProps & import("react").RefAttributes<HTMLTableRowElement>>;
|
|
31
|
+
type CellKind = 'num' | 'date' | 'truncate' | 'check';
|
|
32
|
+
export interface TableHeadProps extends ThHTMLAttributes<HTMLTableCellElement> {
|
|
33
|
+
kind?: CellKind;
|
|
34
|
+
}
|
|
35
|
+
export declare const TableHead: import("react").ForwardRefExoticComponent<TableHeadProps & import("react").RefAttributes<HTMLTableCellElement>>;
|
|
36
|
+
export interface TableCellProps extends TdHTMLAttributes<HTMLTableCellElement> {
|
|
37
|
+
/** `num` right-aligns with tabular figures; `truncate` keeps one line (put the rest in `title`). */
|
|
38
|
+
kind?: CellKind;
|
|
39
|
+
}
|
|
40
|
+
export declare const TableCell: import("react").ForwardRefExoticComponent<TableCellProps & import("react").RefAttributes<HTMLTableCellElement>>;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, forwardRef, useContext, useId, } from 'react';
|
|
4
|
+
import { cx } from '../lib/cx.js';
|
|
5
|
+
const TableContext = createContext(null);
|
|
6
|
+
/**
|
|
7
|
+
* A data table (`.pk-table`) in a focusable scroll wrap, so it works on a narrow screen and the
|
|
8
|
+
* keyboard can scroll it. shadcn: Table.
|
|
9
|
+
*/
|
|
10
|
+
export const Table = forwardRef(function Table({ density = 'default', striped, label, maxHeight, className, ...props }, ref) {
|
|
11
|
+
const captionId = `pk-table-${useId()}-caption`;
|
|
12
|
+
return (_jsx(TableContext.Provider, { value: captionId, children: _jsx("div", { className: "pk-table-wrap", tabIndex: 0, role: "region", "aria-label": label, "aria-labelledby": label ? undefined : captionId, style: maxHeight ? { '--pk-table-max-height': maxHeight } : undefined, children: _jsx("table", { ref: ref, className: cx('pk-table', density !== 'default' && `pk-table--${density}`, striped && 'pk-table--striped', className), ...props }) }) }));
|
|
13
|
+
});
|
|
14
|
+
export const TableCaption = forwardRef(function TableCaption({ visible, className, ...props }, ref) {
|
|
15
|
+
const id = useContext(TableContext) ?? undefined;
|
|
16
|
+
return (_jsx("caption", { ref: ref, id: id, className: cx(!visible && 'pk-sr-only', className), ...props }));
|
|
17
|
+
});
|
|
18
|
+
export const TableHeader = forwardRef(function TableHeader(props, ref) {
|
|
19
|
+
return _jsx("thead", { ref: ref, ...props });
|
|
20
|
+
});
|
|
21
|
+
export const TableBody = forwardRef(function TableBody(props, ref) {
|
|
22
|
+
return _jsx("tbody", { ref: ref, ...props });
|
|
23
|
+
});
|
|
24
|
+
export const TableFooter = forwardRef(function TableFooter(props, ref) {
|
|
25
|
+
return _jsx("tfoot", { ref: ref, ...props });
|
|
26
|
+
});
|
|
27
|
+
export const TableRow = forwardRef(function TableRow({ selected, ...props }, ref) {
|
|
28
|
+
return _jsx("tr", { ref: ref, "aria-selected": selected ? true : undefined, ...props });
|
|
29
|
+
});
|
|
30
|
+
export const TableHead = forwardRef(function TableHead({ kind, scope = 'col', className, ...props }, ref) {
|
|
31
|
+
return (_jsx("th", { ref: ref, scope: scope, className: cx(kind && `pk-table__${kind}`, className) || undefined, ...props }));
|
|
32
|
+
});
|
|
33
|
+
export const TableCell = forwardRef(function TableCell({ kind, className, ...props }, ref) {
|
|
34
|
+
return (_jsx("td", { ref: ref, className: cx(kind && `pk-table__${kind}`, className) || undefined, ...props }));
|
|
35
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ThemeChoice = 'auto' | 'light' | 'dark';
|
|
2
|
+
/**
|
|
3
|
+
* The theme choice, as `behaviors/theme.js` keeps it: `data-theme` on `<html>` (none for auto),
|
|
4
|
+
* saved as `pk.theme`. With the boot script in `<head>` a saved choice applies before first paint.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useTheme(): {
|
|
7
|
+
theme: ThemeChoice;
|
|
8
|
+
setTheme: (next: ThemeChoice) => void;
|
|
9
|
+
cycleTheme: () => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useCallback, useState } from 'react';
|
|
3
|
+
import { readStorage, useIsomorphicLayoutEffect, writeStorage } from '../lib/dom.js';
|
|
4
|
+
const KEY = 'pk.theme';
|
|
5
|
+
const ORDER = ['auto', 'light', 'dark'];
|
|
6
|
+
/**
|
|
7
|
+
* The theme choice, as `behaviors/theme.js` keeps it: `data-theme` on `<html>` (none for auto),
|
|
8
|
+
* saved as `pk.theme`. With the boot script in `<head>` a saved choice applies before first paint.
|
|
9
|
+
*/
|
|
10
|
+
export function useTheme() {
|
|
11
|
+
const [theme, setThemeState] = useState('auto');
|
|
12
|
+
useIsomorphicLayoutEffect(() => {
|
|
13
|
+
const attr = document.documentElement.getAttribute('data-theme');
|
|
14
|
+
const saved = readStorage(KEY);
|
|
15
|
+
const initial = attr === 'light' || attr === 'dark' ? attr : saved;
|
|
16
|
+
if (initial === 'light' || initial === 'dark')
|
|
17
|
+
setThemeState(initial);
|
|
18
|
+
}, []);
|
|
19
|
+
const setTheme = useCallback((next) => {
|
|
20
|
+
const html = document.documentElement;
|
|
21
|
+
if (next === 'auto')
|
|
22
|
+
html.removeAttribute('data-theme');
|
|
23
|
+
else
|
|
24
|
+
html.setAttribute('data-theme', next);
|
|
25
|
+
writeStorage(KEY, next);
|
|
26
|
+
setThemeState(next);
|
|
27
|
+
}, []);
|
|
28
|
+
const cycleTheme = useCallback(() => {
|
|
29
|
+
setThemeState((current) => {
|
|
30
|
+
const next = ORDER[(ORDER.indexOf(current) + 1) % ORDER.length];
|
|
31
|
+
const html = document.documentElement;
|
|
32
|
+
if (next === 'auto')
|
|
33
|
+
html.removeAttribute('data-theme');
|
|
34
|
+
else
|
|
35
|
+
html.setAttribute('data-theme', next);
|
|
36
|
+
writeStorage(KEY, next);
|
|
37
|
+
return next;
|
|
38
|
+
});
|
|
39
|
+
}, []);
|
|
40
|
+
return { theme, setTheme, cycleTheme };
|
|
41
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
export interface ToastOptions {
|
|
3
|
+
/** `error` is for failures: the danger fill, and it stays twice as long. */
|
|
4
|
+
variant?: 'default' | 'error';
|
|
5
|
+
/** One action, usually Undo. A toast with an action stays twice as long. */
|
|
6
|
+
action?: {
|
|
7
|
+
label: string;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
};
|
|
10
|
+
/** Milliseconds. 4000 by default; 8000 with an action or an error. */
|
|
11
|
+
duration?: number;
|
|
12
|
+
}
|
|
13
|
+
declare function show(message: string, options?: ToastOptions): number;
|
|
14
|
+
/** Shows a toast. Returns its id. shadcn: Sonner's `toast()`. */
|
|
15
|
+
export declare const toast: typeof show & {
|
|
16
|
+
error: (message: string, options?: Omit<ToastOptions, 'variant'>) => number;
|
|
17
|
+
/** Removes the toast (or only the one with this id, if it is still showing). */
|
|
18
|
+
dismiss: (id?: number) => void;
|
|
19
|
+
};
|
|
20
|
+
export type ToasterProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
|
|
21
|
+
/**
|
|
22
|
+
* Where toasts show (`.pk-toast`). Render one, near the end of the app. It stays in the page as a
|
|
23
|
+
* live region and is invisible while empty, so a screen reader hears each message arrive. The
|
|
24
|
+
* timer pauses while the pointer or the focus is on the toast.
|
|
25
|
+
*/
|
|
26
|
+
export declare function Toaster({ className, ...props }: ToasterProps): import("react").JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useSyncExternalStore } from 'react';
|
|
4
|
+
import { cx } from '../lib/cx.js';
|
|
5
|
+
/*
|
|
6
|
+
* One toast at a time, as Polykit's toast.js: a new toast replaces the old. The store lives at
|
|
7
|
+
* module level so `toast()` can be called from anywhere, as with Sonner.
|
|
8
|
+
*/
|
|
9
|
+
let current = null;
|
|
10
|
+
let nextId = 1;
|
|
11
|
+
const listeners = new Set();
|
|
12
|
+
const emit = () => listeners.forEach((listener) => listener());
|
|
13
|
+
function show(message, options = {}) {
|
|
14
|
+
current = { id: nextId++, message, ...options };
|
|
15
|
+
emit();
|
|
16
|
+
return current.id;
|
|
17
|
+
}
|
|
18
|
+
/** Shows a toast. Returns its id. shadcn: Sonner's `toast()`. */
|
|
19
|
+
export const toast = Object.assign(show, {
|
|
20
|
+
error: (message, options = {}) => show(message, { ...options, variant: 'error' }),
|
|
21
|
+
/** Removes the toast (or only the one with this id, if it is still showing). */
|
|
22
|
+
dismiss: (id) => {
|
|
23
|
+
if (current && (id === undefined || current.id === id)) {
|
|
24
|
+
current = null;
|
|
25
|
+
emit();
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
const subscribe = (listener) => {
|
|
30
|
+
listeners.add(listener);
|
|
31
|
+
return () => listeners.delete(listener);
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Where toasts show (`.pk-toast`). Render one, near the end of the app. It stays in the page as a
|
|
35
|
+
* live region and is invisible while empty, so a screen reader hears each message arrive. The
|
|
36
|
+
* timer pauses while the pointer or the focus is on the toast.
|
|
37
|
+
*/
|
|
38
|
+
export function Toaster({ className, ...props }) {
|
|
39
|
+
const state = useSyncExternalStore(subscribe, () => current, () => null);
|
|
40
|
+
const paused = useRef({ hover: false, focus: false });
|
|
41
|
+
const returnTo = useRef(null);
|
|
42
|
+
const timer = useRef(undefined);
|
|
43
|
+
const remaining = useRef(0);
|
|
44
|
+
const started = useRef(0);
|
|
45
|
+
const stop = () => {
|
|
46
|
+
if (timer.current)
|
|
47
|
+
clearTimeout(timer.current);
|
|
48
|
+
timer.current = undefined;
|
|
49
|
+
};
|
|
50
|
+
const start = () => {
|
|
51
|
+
stop();
|
|
52
|
+
if (!state || paused.current.hover || paused.current.focus)
|
|
53
|
+
return;
|
|
54
|
+
started.current = Date.now();
|
|
55
|
+
const id = state.id;
|
|
56
|
+
timer.current = setTimeout(() => toast.dismiss(id), remaining.current);
|
|
57
|
+
};
|
|
58
|
+
const pause = (why) => {
|
|
59
|
+
if (!paused.current.hover && !paused.current.focus && timer.current) {
|
|
60
|
+
remaining.current -= Date.now() - started.current;
|
|
61
|
+
}
|
|
62
|
+
paused.current[why] = true;
|
|
63
|
+
stop();
|
|
64
|
+
};
|
|
65
|
+
const resume = (why) => {
|
|
66
|
+
paused.current[why] = false;
|
|
67
|
+
start();
|
|
68
|
+
};
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (!state)
|
|
71
|
+
return stop;
|
|
72
|
+
remaining.current = state.duration ?? (state.action || state.variant === 'error' ? 8000 : 4000);
|
|
73
|
+
start();
|
|
74
|
+
return stop;
|
|
75
|
+
}, [state]);
|
|
76
|
+
return (_jsx("div", { role: "status", "aria-live": "polite", className: cx('pk-toast', state?.variant === 'error' && 'pk-toast--error', className), onPointerEnter: () => pause('hover'), onPointerLeave: () => resume('hover'), onFocus: (event) => {
|
|
77
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
78
|
+
returnTo.current = event.relatedTarget;
|
|
79
|
+
}
|
|
80
|
+
pause('focus');
|
|
81
|
+
}, onBlur: (event) => {
|
|
82
|
+
if (!event.currentTarget.contains(event.relatedTarget))
|
|
83
|
+
resume('focus');
|
|
84
|
+
}, ...props, children: state ? (_jsxs(_Fragment, { children: [state.message, state.action ? (_jsxs(_Fragment, { children: [' ', _jsx("button", { type: "button", className: "pk-toast__action", onClick: () => {
|
|
85
|
+
const back = returnTo.current;
|
|
86
|
+
state.action.onClick();
|
|
87
|
+
toast.dismiss(state.id);
|
|
88
|
+
paused.current.focus = false;
|
|
89
|
+
// Focus was on the action, which is gone now: give it back.
|
|
90
|
+
if (back?.isConnected)
|
|
91
|
+
back.focus();
|
|
92
|
+
}, children: state.action.label })] })) : null] })) : null }));
|
|
93
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { cx, type ClassValue } from './lib/cx.js';
|
|
2
|
+
export { Icon, IconProvider, type IconName, type IconProps, type IconProviderProps, } from './components/icon.js';
|
|
3
|
+
export { Button, IconButton, buttonClassName, type ButtonProps, type ButtonSize, type ButtonVariant, type IconButtonProps, } from './components/button.js';
|
|
4
|
+
export { Link, type LinkProps, type LinkVariant } from './components/link.js';
|
|
5
|
+
export { Badge, Banner, BannerActions, BannerText, Callout, Card, Empty, Progress, Separator, StatusPill, type BadgeProps, type BadgeVariant, type BannerProps, type CalloutProps, type CardProps, type CategoryColor, type EmptyProps, type ProgressProps, type SeparatorProps, type Tone, } from './components/display.js';
|
|
6
|
+
export { Avatar, AvatarFallback, AvatarImage, type AvatarFallbackProps, type AvatarProps, } from './components/avatar.js';
|
|
7
|
+
export { Field, FormActions, FormGrid, Input, Label, NativeSelect, Textarea, type FieldProps, type InputProps, type NativeSelectProps, } from './components/field.js';
|
|
8
|
+
export { CheckRound, Checkbox, Choice, RadioGroup, RadioGroupItem, Switch, type CheckRoundProps, type CheckboxProps, type CheckedState, type RadioGroupItemProps, type RadioGroupProps, type SwitchProps, } from './components/choice.js';
|
|
9
|
+
export { Chip, NavTab, NavTabs, SegmentedControl, SegmentedControlItem, Tabs, TabsContent, TabsCount, TabsList, TabsTrigger, type ChipProps, type NavTabProps, type SegmentedControlProps, } from './components/navigation.js';
|
|
10
|
+
export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuTrigger, type DropdownMenuContentProps, type MenuItemVariantProps, } from './components/menu.js';
|
|
11
|
+
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, } from './components/popover.js';
|
|
12
|
+
export { AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogForm, DialogHeader, DialogTitle, DialogTrigger, type DialogContentProps, type DialogHeaderProps, type DialogProps, type DialogTitleProps, } from './components/dialog.js';
|
|
13
|
+
export { Toaster, toast, type ToastOptions, type ToasterProps } from './components/toast.js';
|
|
14
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, type TableCaptionProps, type TableCellProps, type TableHeadProps, type TableProps, type TableRowProps, } from './components/table.js';
|
|
15
|
+
export { polykitBootScript } from './lib/boot-script.js';
|
|
16
|
+
export { useTheme, type ThemeChoice } from './components/theme.js';
|
|
17
|
+
export { AppShell, Content, Page, Search, ShellMain, SidePanel, SidePanelBody, SidePanelFooter, SidePanelHeader, Sidebar, SidebarBrand, SidebarCollapse, SidebarFoot, SidebarGroup, SidebarItem, SidebarNav, SidebarSubItem, SidebarThemeToggle, Topbar, TopbarContext, TopbarEnd, TopbarMenuButton, TopbarMid, TopbarStart, Wordmark, useAppShell, type AppShellProps, type PageProps, type SearchProps, type SidePanelHeaderProps, type SidePanelProps, type SidebarCollapseProps, type SidebarGroupProps, type SidebarItemProps, type SidebarNavProps, type TopbarMenuButtonProps, type WordmarkProps, } from './components/shell.js';
|
|
18
|
+
export { Count, Group, Meta, MetaItem, PageHeader, PageHeaderActions, PageHeaderDescription, PageHeaderTitle, Pagination, Row, pageRange, type GroupProps, type MetaItemProps, type PaginationProps, type RowProps, } from './components/page.js';
|