@stridge/noctis 1.0.0-beta.5 → 1.0.0-beta.6

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 (43) hide show
  1. package/dist/components/breadcrumb/breadcrumb.d.ts +163 -0
  2. package/dist/components/breadcrumb/breadcrumb.js +152 -0
  3. package/dist/components/breadcrumb/breadcrumb.props.d.ts +59 -0
  4. package/dist/components/breadcrumb/breadcrumb.props.js +68 -0
  5. package/dist/components/breadcrumb/breadcrumb.slots.d.ts +16 -0
  6. package/dist/components/breadcrumb/breadcrumb.slots.js +32 -0
  7. package/dist/components/breadcrumb/breadcrumb.types.d.ts +9 -0
  8. package/dist/components/breadcrumb/index.d.ts +3 -0
  9. package/dist/components/command/command-listbox.js +174 -0
  10. package/dist/components/command/command-rank.d.ts +40 -0
  11. package/dist/components/command/command-rank.js +61 -0
  12. package/dist/components/command/command-score.d.ts +25 -0
  13. package/dist/components/command/command-score.js +85 -0
  14. package/dist/components/command/command.context.d.ts +17 -0
  15. package/dist/components/command/command.context.js +13 -0
  16. package/dist/components/command/command.d.ts +396 -0
  17. package/dist/components/command/command.js +471 -0
  18. package/dist/components/command/command.props.d.ts +91 -0
  19. package/dist/components/command/command.props.js +94 -0
  20. package/dist/components/command/command.slots.d.ts +23 -0
  21. package/dist/components/command/command.slots.js +60 -0
  22. package/dist/components/command/index.d.ts +6 -0
  23. package/dist/components/command/use-command-ranking.d.ts +37 -0
  24. package/dist/components/command/use-command-ranking.js +127 -0
  25. package/dist/components/search-dialog/parts/root.js +1 -1
  26. package/dist/components/skeleton/index.d.ts +3 -0
  27. package/dist/components/skeleton/skeleton.context.js +12 -0
  28. package/dist/components/skeleton/skeleton.d.ts +157 -0
  29. package/dist/components/skeleton/skeleton.js +130 -0
  30. package/dist/components/skeleton/skeleton.props.d.ts +47 -0
  31. package/dist/components/skeleton/skeleton.props.js +57 -0
  32. package/dist/components/skeleton/skeleton.slots.d.ts +15 -0
  33. package/dist/components/skeleton/skeleton.slots.js +28 -0
  34. package/dist/components/skeleton/skeleton.types.d.ts +13 -0
  35. package/dist/components/surface/surface.d.ts +1 -1
  36. package/dist/index.d.ts +15 -3
  37. package/dist/index.js +13 -4
  38. package/dist/primitives/index.d.ts +1 -1
  39. package/dist/primitives/index.js +2 -2
  40. package/dist/props.d.ts +37 -34
  41. package/dist/props.js +37 -34
  42. package/dist/styles.css +715 -0
  43. package/package.json +4 -4
@@ -0,0 +1,396 @@
1
+ import { useRender } from "../../core/render.js";
2
+ import { CommandPage } from "./command.context.js";
3
+ import { CommandPartProps, breadcrumbProps, emptyProps, footerProps, groupLabelProps, groupProps, headerProps, inputActionProps, inputProps, itemIconProps, itemLabelProps, itemProps, listProps, loadingProps, panelProps, separatorProps } from "./command.props.js";
4
+ import { ComponentPropsWithoutRef, ReactElement, ReactNode, Ref } from "react";
5
+
6
+ //#region src/components/command/command.d.ts
7
+ /** The query + drill-in state both mounting modes share, wired into the listbox engine and the context. */
8
+ interface PaletteStateProps {
9
+ /** The query value (controlled). */
10
+ value?: string;
11
+ /** The initial query when uncontrolled. */
12
+ defaultValue?: string;
13
+ /** Called as the query changes. */
14
+ onValueChange?: (value: string) => void;
15
+ /**
16
+ * The drill-in stack (controlled). Selecting a parent command pushes a page; Backspace on the empty
17
+ * query — or clicking an earlier breadcrumb — pops. The consumer owns the stack so children can load
18
+ * lazily; map the current page to the rendered `Command.Item`s.
19
+ */
20
+ pages?: readonly CommandPage[];
21
+ /** Called when the drill-in stack should change (push on select, pop on Backspace/breadcrumb). */
22
+ onPagesChange?: (pages: readonly CommandPage[]) => void;
23
+ /** Whether async results are still settling; drives the loading/empty copy and `aria-busy`. */
24
+ loading?: boolean;
25
+ /**
26
+ * Whether arrow-key navigation cycles past the ends of the list — `ArrowDown` from the last row
27
+ * wraps back to the first (through the input, per the ARIA combobox pattern) and `ArrowUp` from the
28
+ * first wraps to the last. Off by default: the highlight stops at the ends, matching a command bar.
29
+ * @default false
30
+ */
31
+ loop?: boolean;
32
+ }
33
+ /** Props for {@link CommandRoot}. */
34
+ interface CommandRootProps extends PaletteStateProps, Omit<ComponentPropsWithoutRef<"div">, "defaultValue"> {
35
+ /** The palette parts — a `Command.Header`, a `Command.List`, and an optional `Command.Footer`. */
36
+ children?: ReactNode;
37
+ }
38
+ /**
39
+ * The inline palette: the command interface embedded in normal flow (a page, a sidebar, a settings
40
+ * panel) rather than a modal. Renders the panel through `Surface` (the `menu` elevation scope, border,
41
+ * and card shadow) and shares the query + drill-in state with every part. For the modal launcher use
42
+ * `Command.Dialog`; both share identical inner parts.
43
+ *
44
+ * @see {@link CommandRootProps}
45
+ */
46
+ declare function CommandRoot({
47
+ value,
48
+ defaultValue,
49
+ onValueChange,
50
+ pages,
51
+ onPagesChange,
52
+ loading,
53
+ loop,
54
+ children,
55
+ ...props
56
+ }: CommandRootProps): ReactElement;
57
+ /** Props for {@link CommandDialog}. */
58
+ interface CommandDialogProps extends PaletteStateProps {
59
+ /** Whether the modal palette is open. */
60
+ open: boolean;
61
+ /** Called when the open state should change (backdrop, Esc, dismissal). */
62
+ onOpenChange: (open: boolean) => void;
63
+ /**
64
+ * The dialog's accessible name (rendered visually hidden; the palette has no visible heading).
65
+ * Defaults to the localized `command.label` string from the Noctis i18n catalog ("Command palette").
66
+ */
67
+ label?: string;
68
+ /** The palette parts — a `Command.Header`, a `Command.List`, and an optional `Command.Footer`. */
69
+ children?: ReactNode;
70
+ }
71
+ /**
72
+ * The modal palette: the centred, focus-trapped command launcher built on the Noctis `Dialog` chassis
73
+ * (portal, blurred backdrop, scroll-lock, Esc/outside-click dismissal) with a top-anchored, fixed-height
74
+ * panel that scale-fades in. Wire `open`/`onOpenChange` to a `Command.Trigger` (or any control). Shares
75
+ * identical inner parts with the inline `Command.Root`.
76
+ *
77
+ * @see {@link CommandDialogProps}
78
+ */
79
+ declare function CommandDialog({
80
+ open,
81
+ onOpenChange,
82
+ label,
83
+ value,
84
+ defaultValue,
85
+ onValueChange,
86
+ pages,
87
+ onPagesChange,
88
+ loading,
89
+ loop,
90
+ children
91
+ }: CommandDialogProps): ReactElement;
92
+ /** Props for {@link CommandTrigger}. */
93
+ interface CommandTriggerProps extends ComponentPropsWithoutRef<"button"> {
94
+ /** Whether the palette this trigger opens is currently open (reflected as `aria-expanded`). */
95
+ open?: boolean;
96
+ /** Called to open the palette (fired on click). Wire it to the same setter as `Command.Dialog`. */
97
+ onOpenChange?: (open: boolean) => void;
98
+ /** A Base UI render prop — bring your own button/visuals; the trigger only wires behaviour + ARIA. */
99
+ render?: useRender.RenderProp;
100
+ /** Ref to the rendered element. */
101
+ ref?: Ref<HTMLButtonElement>;
102
+ }
103
+ /**
104
+ * A headless launcher for the modal palette. It wires only behaviour and accessibility — `onClick` to
105
+ * open, `aria-haspopup="dialog"`, and `aria-expanded` — onto whatever element you render, so you bring
106
+ * your own `Button`/`Kbd` visuals. Wire the same `open`/`onOpenChange` state you pass to `Command.Dialog`.
107
+ *
108
+ * @see {@link CommandTriggerProps}
109
+ */
110
+ declare function CommandTrigger({
111
+ open,
112
+ onOpenChange,
113
+ render,
114
+ ref,
115
+ onClick,
116
+ ...props
117
+ }: CommandTriggerProps): ReactElement;
118
+ /** Props for {@link CommandHeader}. */
119
+ interface CommandHeaderProps extends ComponentPropsWithoutRef<"div"> {}
120
+ /** The input row: holds an optional `Command.Breadcrumb`, a leading glyph, the `Command.Input`, and an
121
+ * optional `Command.InputAction`, over a hairline divider. */
122
+ declare function CommandHeader({
123
+ children,
124
+ ...props
125
+ }: CommandHeaderProps): ReactElement;
126
+ /** Props for {@link CommandBreadcrumb}. */
127
+ interface CommandBreadcrumbProps extends Omit<ComponentPropsWithoutRef<"div">, "children"> {}
128
+ /**
129
+ * The drill-in trail. Renders one button per page in the stack and nothing at the top level; clicking a
130
+ * segment truncates the stack back to its depth. Reads the stack from context — just drop it in the
131
+ * header.
132
+ */
133
+ declare function CommandBreadcrumb(props: CommandBreadcrumbProps): ReactElement | null;
134
+ /** Props for {@link CommandInput}. */
135
+ interface CommandInputProps extends Omit<ComponentPropsWithoutRef<"input">, "value" | "onChange" | "type" | "role" | "aria-activedescendant"> {}
136
+ /**
137
+ * The query field — a `role="combobox"` that keeps focus while a virtual cursor (`aria-activedescendant`)
138
+ * moves the active row. Typing filters (you rank externally); arrows / Home / End / PageUp-Down move the
139
+ * highlight, Enter activates it, and Backspace on an empty query pops the drill-in stack. The keyboard
140
+ * model is the palette's own (see `command-listbox`), not a delegated primitive's.
141
+ *
142
+ * @see {@link CommandInput.Props}
143
+ */
144
+ declare function CommandInput({
145
+ onKeyDown,
146
+ ...props
147
+ }: CommandInputProps): ReactElement;
148
+ /** Props for {@link CommandInputAction}. */
149
+ interface CommandInputActionProps extends ComponentPropsWithoutRef<"div"> {}
150
+ /** A trailing affordance slot in the input row (a mode pill, an "ask" hand-off, a hint). */
151
+ declare function CommandInputAction({
152
+ children,
153
+ ...props
154
+ }: CommandInputActionProps): ReactElement;
155
+ /** Props for {@link CommandList}. */
156
+ interface CommandListProps extends Omit<ComponentPropsWithoutRef<"div">, "id" | "role"> {
157
+ /** The command rows and sections (rendered inside the measured sizer). */
158
+ children?: ReactNode;
159
+ }
160
+ /**
161
+ * The scrolling `role="listbox"` of command rows and sections. The rows render inside a measured sizer so
162
+ * the palette can animate its height as the result set changes (see {@link useListAutoHeight}). Within it,
163
+ * a per-page view wrapper is keyed by the drill-in depth: pushing or popping a page remounts it, so its
164
+ * CSS enter animation replays — the old view gives way and the new one opens — while a query change (same
165
+ * page) leaves it in place so typing doesn't re-animate.
166
+ */
167
+ declare function CommandList({
168
+ children,
169
+ ...props
170
+ }: CommandListProps): ReactElement;
171
+ /** Props for {@link CommandGroup}. */
172
+ interface CommandGroupProps extends Omit<ComponentPropsWithoutRef<"div">, "role"> {}
173
+ /** A labelled section: a `role="group"` wrapping a `Command.GroupLabel` and its rows, `aria-labelledby`
174
+ * the label while one is rendered. */
175
+ declare function CommandGroup({
176
+ children,
177
+ ...props
178
+ }: CommandGroupProps): ReactElement;
179
+ /** Props for {@link CommandGroupLabel}. */
180
+ interface CommandGroupLabelProps extends Omit<ComponentPropsWithoutRef<"div">, "id"> {}
181
+ /** A section heading (not an option). Lends its id to the enclosing `Command.Group`'s `aria-labelledby`. */
182
+ declare function CommandGroupLabel({
183
+ children,
184
+ ...props
185
+ }: CommandGroupLabelProps): ReactElement;
186
+ /** Props for {@link CommandItem}. */
187
+ interface CommandItemProps extends Omit<ComponentPropsWithoutRef<"div">, "id" | "role" | "onSelect"> {
188
+ /** A stable, unique value for the row (the React key / selection value). */
189
+ value: string;
190
+ /** Whether the row is disabled — non-activatable and skipped by keyboard navigation. */
191
+ disabled?: boolean;
192
+ /** Run when the row is activated by click or by Enter while highlighted. */
193
+ onSelect?: (value: string) => void;
194
+ }
195
+ /**
196
+ * One command row (`role="option"`). Activated by click or by pressing Enter while highlighted
197
+ * (`onSelect`). Compose a `Command.ItemIcon` and a `Command.ItemLabel` inside; any further content (a
198
+ * `Kbd` shortcut, a badge, a count) is pushed to the row's end by the label's `flex` — the row stays
199
+ * yours to fill past the icon. Hovering highlights it; the keyboard highlight (`data-highlighted`, the
200
+ * input's `aria-activedescendant`) is the palette's own; activation runs the action, never fills the query.
201
+ *
202
+ * @see {@link CommandItem.Props}
203
+ */
204
+ declare function CommandItem({
205
+ value,
206
+ disabled,
207
+ onSelect,
208
+ onClick,
209
+ onPointerMove,
210
+ children,
211
+ ...props
212
+ }: CommandItemProps): ReactElement;
213
+ /** Props for {@link CommandItemIcon}. */
214
+ interface CommandItemIconProps extends ComponentPropsWithoutRef<"span"> {}
215
+ /** The leading glyph column of a row (wrap an `Icon` so it keeps its token sizing). */
216
+ declare function CommandItemIcon({
217
+ children,
218
+ ...props
219
+ }: CommandItemIconProps): ReactElement;
220
+ /** Props for {@link CommandItemLabel}. */
221
+ interface CommandItemLabelProps extends ComponentPropsWithoutRef<"span"> {}
222
+ /** The row's text column (truncates rather than wrapping). */
223
+ declare function CommandItemLabel({
224
+ children,
225
+ ...props
226
+ }: CommandItemLabelProps): ReactElement;
227
+ /** Props for {@link CommandSeparator}. */
228
+ interface CommandSeparatorProps extends ComponentPropsWithoutRef<"div"> {}
229
+ /** A thin divider between sections. */
230
+ declare function CommandSeparator(props: CommandSeparatorProps): ReactElement;
231
+ /** Props for {@link CommandEmpty}. */
232
+ interface CommandEmptyProps extends ComponentPropsWithoutRef<"div"> {}
233
+ /**
234
+ * The centred no-results message. A polite live region so screen readers announce it; render it
235
+ * conditionally when your ranked list is empty (you own the data, so you know when there's nothing to
236
+ * show — Noctis doesn't filter internally).
237
+ */
238
+ declare function CommandEmpty({
239
+ children,
240
+ ...props
241
+ }: CommandEmptyProps): ReactElement;
242
+ /** Props for {@link CommandLoading}. */
243
+ interface CommandLoadingProps extends ComponentPropsWithoutRef<"div"> {}
244
+ /** The centred async progress shell, shown before results settle (compose a spinner glyph + copy). */
245
+ declare function CommandLoading({
246
+ children,
247
+ ...props
248
+ }: CommandLoadingProps): ReactElement;
249
+ /** Props for {@link CommandFooter}. */
250
+ interface CommandFooterProps extends ComponentPropsWithoutRef<"div"> {}
251
+ /**
252
+ * The footer region — a bare, end-aligned strip below the list. Unopinionated about its contents: drop
253
+ * in whatever status or hints you want (e.g. `Kbd` caps beside a label). The component ships no
254
+ * "hint" part, so you own the markup.
255
+ */
256
+ declare function CommandFooter({
257
+ children,
258
+ ...props
259
+ }: CommandFooterProps): ReactElement;
260
+ /**
261
+ * An accessible command palette — a query field over a ranked, sectioned list of commands with full
262
+ * combobox/`aria-activedescendant` keyboard navigation and breadcrumb drill-in. Ships as a modal
263
+ * (`Command.Dialog` + a headless `Command.Trigger`) or inline (`Command.Root`); both share identical
264
+ * inner parts. Ranking is owned by Noctis — rank your commands with the exported `rankItems` /
265
+ * `useCommandRanking` and render the survivors as `Command.Item`s.
266
+ *
267
+ * @example
268
+ * ```tsx
269
+ * const ranked = rankItems(commands, query);
270
+ * <Command.Dialog open={open} onOpenChange={setOpen} value={query} onValueChange={setQuery}>
271
+ * <Command.Header>
272
+ * <SearchIcon />
273
+ * <Command.Input placeholder="Type a command…" />
274
+ * </Command.Header>
275
+ * <Command.List>
276
+ * <Command.Empty>No commands found.</Command.Empty>
277
+ * {ranked.map((c) => (
278
+ * <Command.Item key={c.value} value={c.value} onSelect={c.run}>
279
+ * <Command.ItemLabel>{c.label}</Command.ItemLabel>
280
+ * </Command.Item>
281
+ * ))}
282
+ * </Command.List>
283
+ * </Command.Dialog>
284
+ * ```
285
+ */
286
+ declare const Command: {
287
+ /** The inline palette (embedded in normal flow). `Command.Root.props()` → its spreadable panel prop bag. */Root: typeof CommandRoot & {
288
+ props: typeof panelProps;
289
+ }; /** The modal palette (centred, focus-trapped). */
290
+ Dialog: typeof CommandDialog; /** A headless launcher that wires open + ARIA onto your own button. */
291
+ Trigger: typeof CommandTrigger; /** The input row. `Command.Header.props()` → its spreadable prop bag. */
292
+ Header: typeof CommandHeader & {
293
+ props: typeof headerProps;
294
+ }; /** The drill-in trail. `Command.Breadcrumb.props()` → its spreadable prop bag. */
295
+ Breadcrumb: typeof CommandBreadcrumb & {
296
+ props: typeof breadcrumbProps;
297
+ }; /** The query field. `Command.Input.props()` → its spreadable prop bag. */
298
+ Input: typeof CommandInput & {
299
+ props: typeof inputProps;
300
+ }; /** The trailing input affordance. `Command.InputAction.props()` → its spreadable prop bag. */
301
+ InputAction: typeof CommandInputAction & {
302
+ props: typeof inputActionProps;
303
+ }; /** The scrolling listbox. `Command.List.props()` → its spreadable prop bag. */
304
+ List: typeof CommandList & {
305
+ props: typeof listProps;
306
+ }; /** A labelled section. `Command.Group.props()` → its spreadable prop bag. */
307
+ Group: typeof CommandGroup & {
308
+ props: typeof groupProps;
309
+ }; /** A section heading. `Command.GroupLabel.props()` → its spreadable prop bag. */
310
+ GroupLabel: typeof CommandGroupLabel & {
311
+ props: typeof groupLabelProps;
312
+ }; /** One command row. `Command.Item.props({ highlighted, disabled })` → its spreadable prop bag for a foreign element. */
313
+ Item: typeof CommandItem & {
314
+ props: typeof itemProps;
315
+ }; /** The leading row glyph. `Command.ItemIcon.props()` → its spreadable prop bag. */
316
+ ItemIcon: typeof CommandItemIcon & {
317
+ props: typeof itemIconProps;
318
+ }; /** The row's text column. `Command.ItemLabel.props()` → its spreadable prop bag. */
319
+ ItemLabel: typeof CommandItemLabel & {
320
+ props: typeof itemLabelProps;
321
+ }; /** A section divider. `Command.Separator.props()` → its spreadable prop bag. */
322
+ Separator: typeof CommandSeparator & {
323
+ props: typeof separatorProps;
324
+ }; /** The no-results message. `Command.Empty.props()` → its spreadable prop bag. */
325
+ Empty: typeof CommandEmpty & {
326
+ props: typeof emptyProps;
327
+ }; /** The async progress shell. `Command.Loading.props()` → its spreadable prop bag. */
328
+ Loading: typeof CommandLoading & {
329
+ props: typeof loadingProps;
330
+ }; /** The footer region (compose your own status/hints). `Command.Footer.props()` → its spreadable prop bag. */
331
+ Footer: typeof CommandFooter & {
332
+ props: typeof footerProps;
333
+ };
334
+ };
335
+ /**
336
+ * Per-part prop types, mirroring Base UI's `Component.Part.Props` convention. Types-only — it emits no
337
+ * runtime code and merges with the `Command` object above, so `Command.Item` is the component value
338
+ * while `Command.Item.Props` is its prop type.
339
+ */
340
+ declare namespace Command {
341
+ /** The spreadable data-attribute prop bag every `Command.*.props()` returns (D12). */
342
+ type PartProps = CommandPartProps;
343
+ namespace Root {
344
+ type Props = CommandRootProps;
345
+ }
346
+ namespace Dialog {
347
+ type Props = CommandDialogProps;
348
+ }
349
+ namespace Trigger {
350
+ type Props = CommandTriggerProps;
351
+ }
352
+ namespace Header {
353
+ type Props = CommandHeaderProps;
354
+ }
355
+ namespace Breadcrumb {
356
+ type Props = CommandBreadcrumbProps;
357
+ }
358
+ namespace Input {
359
+ type Props = CommandInputProps;
360
+ }
361
+ namespace InputAction {
362
+ type Props = CommandInputActionProps;
363
+ }
364
+ namespace List {
365
+ type Props = CommandListProps;
366
+ }
367
+ namespace Group {
368
+ type Props = CommandGroupProps;
369
+ }
370
+ namespace GroupLabel {
371
+ type Props = CommandGroupLabelProps;
372
+ }
373
+ namespace Item {
374
+ type Props = CommandItemProps;
375
+ }
376
+ namespace ItemIcon {
377
+ type Props = CommandItemIconProps;
378
+ }
379
+ namespace ItemLabel {
380
+ type Props = CommandItemLabelProps;
381
+ }
382
+ namespace Separator {
383
+ type Props = CommandSeparatorProps;
384
+ }
385
+ namespace Empty {
386
+ type Props = CommandEmptyProps;
387
+ }
388
+ namespace Loading {
389
+ type Props = CommandLoadingProps;
390
+ }
391
+ namespace Footer {
392
+ type Props = CommandFooterProps;
393
+ }
394
+ }
395
+ //#endregion
396
+ export { Command };