@gecko-ui-kit/react 0.0.0-stage → 0.3.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/src/data.d.ts ADDED
@@ -0,0 +1,762 @@
1
+ import type * as React from 'react';
2
+ import type { HostProps, Mounted, IconLike, DateLike } from './core.js';
3
+ import type { Person } from './basics.js';
4
+
5
+ type Ref<H> = React.RefAttributes<Mounted<H>>;
6
+ type Words<K extends string> = Partial<Record<K, string | ((...a: any[]) => string)>>;
7
+
8
+ /* ---------------- Accordion ---------------- */
9
+ export interface AccordionItem {
10
+ /** Defaults to its position (1, 2, 3…). */
11
+ id?: string | number;
12
+ /** The heading: text or any React content. */
13
+ title: React.ReactNode;
14
+ /** A small line under the title. */
15
+ sub?: string;
16
+ /** An icon before the title. */
17
+ icon?: string;
18
+ /** A small count or word at the end of the heading. */
19
+ badge?: string | number;
20
+ /** What the panel shows when open (React content). */
21
+ content?: React.ReactNode;
22
+ /** Starts open (when neither value nor defaultValue is given). */
23
+ open?: boolean;
24
+ disabled?: boolean;
25
+ }
26
+ export interface AccordionHandle {
27
+ readonly root: HTMLElement;
28
+ /** The open ids. */
29
+ readonly value: string[];
30
+ isOpen(id: string | number): boolean;
31
+ open(id: string | number): boolean;
32
+ close(id: string | number): boolean;
33
+ toggle(id: string | number): boolean;
34
+ /** Only with multiple. */
35
+ openAll(): boolean;
36
+ closeAll(): void;
37
+ /** Hide what doesn't match and mark hits; returns how many match. (Marks split the text React drew: clear it before that text changes.) */
38
+ filter(text: string, options?: { open?: boolean }): number;
39
+ destroy(): void;
40
+ }
41
+ export interface AccordionProps extends HostProps {
42
+ items: AccordionItem[];
43
+ /** The open ids (controlled). */
44
+ value?: (string | number)[];
45
+ /** The open ids to start with. */
46
+ defaultValue?: (string | number)[];
47
+ /** false: opening one closes the others. */
48
+ multiple?: boolean;
49
+ /** false: one always stays open. */
50
+ collapsible?: boolean;
51
+ look?: 'lines' | 'cards';
52
+ marker?: 'chevron' | 'plus';
53
+ /** Heading level around each button (3). */
54
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
55
+ /** After a click, with every open id. */
56
+ onChange?: (value: string[], acc: AccordionHandle) => void;
57
+ /** For every item that opens or closes. */
58
+ onToggle?: (id: string, open: boolean, acc: AccordionHandle) => void;
59
+ }
60
+ /** <Accordion items={[{ id: 'pay', title: 'Payment', content: <PaymentForm /> }]} /> */
61
+ export const Accordion: React.ForwardRefExoticComponent<AccordionProps & Ref<AccordionHandle>>;
62
+
63
+ /* ---------------- Carousel ---------------- */
64
+ export interface CarouselHandle {
65
+ readonly root: HTMLElement;
66
+ readonly index: number;
67
+ readonly count: number;
68
+ readonly positions: number;
69
+ go(index: number): boolean;
70
+ next(): boolean;
71
+ prev(): boolean;
72
+ play(): void;
73
+ pause(): void;
74
+ /** Measure again (after the box changed size in a way it could not see). */
75
+ update(): void;
76
+ destroy(): void;
77
+ }
78
+ export interface CarouselProps extends HostProps {
79
+ /** Each child is one slide. */
80
+ children?: React.ReactNode;
81
+ /** The current slide (controlled). */
82
+ value?: number;
83
+ /** The slide to start on (vanilla `start`). */
84
+ defaultValue?: number;
85
+ /** Slides in view, or by the carousel's own width: { 0: 1, 600: 2, 960: 3 }. */
86
+ perView?: number | Record<number, number>;
87
+ /** px between slides (12). */
88
+ gap?: number;
89
+ /** px of the next slide left showing. */
90
+ peek?: number;
91
+ /** Slides beside the current one shrink back (one in view). */
92
+ focus?: boolean;
93
+ /** Next at the end goes back to the first. */
94
+ rewind?: boolean;
95
+ /** ms per slide (0 = off); pauses on hover, focus and drag. */
96
+ autoplay?: number;
97
+ arrows?: boolean;
98
+ dots?: boolean;
99
+ /** Name for screen readers. */
100
+ label?: string;
101
+ words?: Words<'label' | 'prev' | 'next' | 'slide' | 'goTo' | 'pause' | 'play'>;
102
+ onChange?: (index: number, c: CarouselHandle) => void;
103
+ }
104
+ /** <Carousel perView={{ 0: 1, 640: 2 }}>{slides}</Carousel> */
105
+ export const Carousel: React.ForwardRefExoticComponent<CarouselProps & Ref<CarouselHandle>>;
106
+
107
+ /* ---------------- BeforeAfter ---------------- */
108
+ export interface BeforeAfterHandle { readonly root: HTMLElement; readonly value: number; set(value: number, animate?: boolean): BeforeAfterHandle; destroy(): void }
109
+ export interface BeforeAfterProps extends HostProps {
110
+ /** The "before" side (React content, e.g. an <img>). */
111
+ before?: React.ReactNode;
112
+ /** The "after" side. */
113
+ after?: React.ReactNode;
114
+ /** Where the divider is, 0–100 (controlled). */
115
+ value?: number;
116
+ /** Where it starts (vanilla `start`, default 50). */
117
+ defaultValue?: number;
118
+ /** The divider follows the mouse without pressing. */
119
+ hover?: boolean;
120
+ /** Sweep once when it first scrolls into view. */
121
+ hint?: boolean;
122
+ /** The “Before” / “After” tags. */
123
+ labels?: boolean;
124
+ /** Aspect ratio of the frame ('4/3'; '' = as tall as the content). */
125
+ ratio?: string;
126
+ /** Arrow-key step in % (Shift × 4). */
127
+ step?: number;
128
+ words?: Words<'before' | 'after' | 'label' | 'value'>;
129
+ /** 0–100, while it moves. */
130
+ onChange?: (value: number, ba: BeforeAfterHandle) => void;
131
+ }
132
+ /** <BeforeAfter before={<img …/>} after={<img …/>} /> */
133
+ export const BeforeAfter: React.ForwardRefExoticComponent<BeforeAfterProps & Ref<BeforeAfterHandle>>;
134
+
135
+ /* ---------------- Tree ---------------- */
136
+ export interface TreeItem {
137
+ id: string | number;
138
+ label: string;
139
+ icon?: string;
140
+ iconOpen?: string;
141
+ badge?: string | number;
142
+ /** Nested items, or true: loaded with load() the first time it opens. */
143
+ children?: TreeItem[] | true;
144
+ open?: boolean;
145
+ selected?: boolean;
146
+ checked?: boolean;
147
+ disabled?: boolean;
148
+ [key: string]: unknown;
149
+ }
150
+ export interface TreeInfo { id: string; label: string; item: TreeItem; depth: number; parent: string | null; open: boolean; selected: boolean; checked: boolean | 'mixed'; branch: boolean; loaded: boolean }
151
+ export interface TreeHandle {
152
+ readonly root: HTMLElement;
153
+ readonly value: string[];
154
+ readonly checked: string[];
155
+ readonly checkedLeaves: string[];
156
+ get(id: string | number): TreeInfo | null;
157
+ select(ids: string | number | (string | number)[] | null): boolean;
158
+ check(id: string | number, on?: boolean): boolean;
159
+ open(id: string | number): boolean;
160
+ close(id: string | number): boolean;
161
+ toggle(id: string | number): boolean;
162
+ expandAll(): void;
163
+ collapseAll(): void;
164
+ reveal(id: string | number, options?: { select?: boolean; focus?: boolean }): boolean;
165
+ filter(text: string): number;
166
+ add(parentId: string | number | null, item: TreeItem, index?: number): string | null;
167
+ remove(id: string | number): boolean;
168
+ rename(id: string | number, label: string): boolean;
169
+ destroy(): void;
170
+ }
171
+ export interface TreeProps extends HostProps {
172
+ items: TreeItem[];
173
+ select?: 'single' | 'multiple' | 'none';
174
+ /** Checkboxes; a branch ticks everything inside it. */
175
+ checkable?: boolean;
176
+ /** Guide lines down each open branch. */
177
+ lines?: boolean;
178
+ /** Folder / open folder / file when an item has no icon. */
179
+ icons?: boolean;
180
+ /** Clicking a branch's row opens or closes it. */
181
+ openOnClick?: boolean;
182
+ /** px per level. */
183
+ indent?: number;
184
+ /** Selected ids (controlled; applied with select()). */
185
+ value?: string | number | (string | number)[] | null;
186
+ /** Selected ids to start with. */
187
+ defaultValue?: string | number | (string | number)[] | null;
188
+ /** Ticked ids (applied with check()). */
189
+ checked?: (string | number)[];
190
+ /** Children of a branch with children: true. */
191
+ load?: (item: TreeItem, t: TreeHandle) => Promise<TreeItem[]> | TreeItem[];
192
+ /** Name for screen readers. */
193
+ label?: string;
194
+ words?: Words<'label' | 'loading' | 'empty' | 'error' | 'retry' | 'loaded'>;
195
+ onSelect?: (ids: string[], item: TreeInfo | null, t: TreeHandle) => void;
196
+ onCheck?: (ids: string[], t: TreeHandle) => void;
197
+ onToggle?: (id: string, open: boolean, t: TreeHandle) => void;
198
+ /** Enter or double click on an item. */
199
+ onActivate?: (item: TreeInfo, t: TreeHandle) => void;
200
+ }
201
+ /** <Tree items={folders} onSelect={…} /> */
202
+ export const Tree: React.ForwardRefExoticComponent<TreeProps & Ref<TreeHandle>>;
203
+
204
+ /* ---------------- DataGrid ---------------- */
205
+ export type Row = Record<string, any>;
206
+ export interface GridColumn<R extends Row = Row> {
207
+ key: string;
208
+ label: string;
209
+ type?: 'text' | 'number' | 'select' | 'bool' | 'date';
210
+ /** For select: [value, label] pairs or plain values. */
211
+ options?: (string | number | [string | number, string])[];
212
+ /** Editable in place. */
213
+ edit?: boolean;
214
+ /** A filter list above the grid (select / bool columns). */
215
+ filter?: boolean;
216
+ filterLabel?: string;
217
+ align?: 'left' | 'right';
218
+ width?: string;
219
+ wrap?: boolean;
220
+ /** Trusted HTML for the cell — escape app text yourself. */
221
+ render?: (value: any, row: R) => string;
222
+ /** Text for the cell (escaped for you). */
223
+ format?: (value: any, row: R) => string | number;
224
+ /** An error message, or '' when fine. */
225
+ validate?: (value: any, row: R) => string | void;
226
+ sort?: false;
227
+ min?: number; max?: number; step?: number;
228
+ }
229
+ export interface DataGridHandle<R extends Row = Row> {
230
+ readonly el: HTMLElement;
231
+ rows(): R[];
232
+ visible(): R[];
233
+ setRows(rows: R[]): void;
234
+ search(q: string): void;
235
+ filter(key: string, value?: string): void;
236
+ sort(key: string, dir?: 1 | -1): void;
237
+ page(p: number): void;
238
+ reset(): void;
239
+ add(row?: Partial<R>): R;
240
+ remove(ids: string | string[]): void;
241
+ selected(): R[];
242
+ destroy(): void;
243
+ }
244
+ export interface DataGridProps<R extends Row = Row> extends HostProps {
245
+ columns: GridColumn<R>[];
246
+ /** Applied in place with setRows() when it changes. */
247
+ rows: R[];
248
+ /** The id field (default 'id'). */
249
+ id?: string;
250
+ search?: boolean;
251
+ searchPlaceholder?: string;
252
+ /** Rows per page (0 = no pages). */
253
+ pageSize?: number;
254
+ /** Row checkboxes. */
255
+ select?: boolean;
256
+ /** An "Add row" button. */
257
+ add?: boolean;
258
+ addLabel?: string;
259
+ /** Delete buttons. */
260
+ remove?: boolean;
261
+ density?: 'comfy' | 'compact';
262
+ stripes?: boolean;
263
+ newRow?: () => Partial<R>;
264
+ emptyText?: string;
265
+ onChange?: (row: R, key: string, value: any, old: any) => void;
266
+ onAdd?: (row: R) => void;
267
+ onRemove?: (rows: R[]) => void;
268
+ onView?: (view: { rows: R[]; total: number }) => void;
269
+ }
270
+ /** <DataGrid columns={…} rows={…} /> */
271
+ export const DataGrid: React.ForwardRefExoticComponent<DataGridProps & Ref<DataGridHandle>>;
272
+
273
+ /* ---------------- VirtualList ---------------- */
274
+ export interface VirtualListHandle<T = any> {
275
+ readonly root: HTMLElement;
276
+ readonly range: { start: number; end: number; rendered: number; count: number };
277
+ readonly count: number;
278
+ readonly selected: number;
279
+ readonly active: number;
280
+ item(index: number): T;
281
+ update(items: T[] | number): VirtualListHandle<T>;
282
+ scrollTo(index: number, options?: { align?: 'start' | 'center' | 'end' | 'auto'; smooth?: boolean }): Promise<void>;
283
+ select(index: number, options?: { scroll?: boolean }): boolean;
284
+ refresh(): VirtualListHandle<T>;
285
+ destroy(): void;
286
+ }
287
+ export interface VirtualListProps<T = any> extends HostProps {
288
+ /** An array, or just a count (the item is then its index). Applied in place with update(). */
289
+ items: T[] | number;
290
+ /** A React row. */
291
+ renderItem?: (item: T, index: number) => React.ReactNode;
292
+ /** Or: trusted HTML / a Node for each row. */
293
+ render?: (item: T, index: number) => string | Node;
294
+ /** px for every row, or 'auto' (measured as rows show). */
295
+ rowHeight?: number | 'auto';
296
+ /** With 'auto': the guess for rows not measured yet. */
297
+ estimate?: number;
298
+ /** Viewport height (px or CSS length); leave out to fill the element. */
299
+ height?: number | string;
300
+ /** Extra rows kept above and below the view. */
301
+ overscan?: number;
302
+ /** Keeps heights, selection and scroll place across item changes (default item.id ?? item.key ?? index). */
303
+ key?: (item: T, index: number) => unknown;
304
+ /** A listbox with an active row and one picked row. */
305
+ selectable?: boolean;
306
+ /** Key of the picked row (controlled). */
307
+ value?: unknown;
308
+ /** Key of the picked row to start with. */
309
+ defaultValue?: unknown;
310
+ /** Name for screen readers. */
311
+ label?: string;
312
+ words?: Words<'label' | 'empty' | 'count'>;
313
+ onSelect?: (item: T, index: number, list: VirtualListHandle<T>) => void;
314
+ onRange?: (range: { start: number; end: number; rendered: number; count: number }, list: VirtualListHandle<T>) => void;
315
+ }
316
+ /** <VirtualList items={rows} renderItem={(r) => <Row r={r} />} /> */
317
+ export const VirtualList: React.ForwardRefExoticComponent<VirtualListProps & Ref<VirtualListHandle>>;
318
+
319
+ /* ---------------- Timeline ---------------- */
320
+ export interface TimelineRow { id: string | number; label: string; sub?: string; icon?: string }
321
+ export interface Booking {
322
+ id: string | number;
323
+ row: string | number;
324
+ /** '2026-12-04' or '2026-12-04T10:00'. */
325
+ start: DateLike;
326
+ /** When it comes back. */
327
+ end: DateLike;
328
+ label?: string;
329
+ status?: 'booked' | 'out' | 'late' | 'done' | 'service';
330
+ color?: string;
331
+ /** false: locked; 'end': can only be made longer. */
332
+ edit?: boolean | 'end';
333
+ [key: string]: unknown;
334
+ }
335
+ export interface TimelineHandle {
336
+ readonly el: HTMLElement;
337
+ readonly from: string;
338
+ items(): (Booking & { start: string; end: string })[];
339
+ setItems(items: Booking[]): TimelineHandle;
340
+ add(item: Booking): Booking | null;
341
+ update(id: string | number, patch: Partial<Booking>): Booking | null;
342
+ remove(id: string | number): TimelineHandle;
343
+ undo(): boolean;
344
+ go(where: DateLike | number): TimelineHandle;
345
+ today(): TimelineHandle;
346
+ destroy(): void;
347
+ }
348
+ export interface TimelineProps extends HostProps {
349
+ rows: TimelineRow[];
350
+ /** Applied in place (add / update / remove) when it changes. */
351
+ items: Booking[];
352
+ /** First day shown (default today). */
353
+ from?: DateLike;
354
+ days?: number;
355
+ locale?: string;
356
+ title?: string;
357
+ today?: DateLike;
358
+ edit?: boolean;
359
+ /** true lets bookings share a row. */
360
+ overlap?: boolean;
361
+ minDays?: number;
362
+ /** A line at the current time. */
363
+ now?: boolean;
364
+ /** 'out' past its end shows as late. */
365
+ late?: boolean;
366
+ dayWidth?: number;
367
+ rowHeight?: number;
368
+ labelWidth?: number;
369
+ /** The second line on each bar. */
370
+ sub?: (item: Booking, days: number) => string;
371
+ words?: Words<'day' | 'days' | 'clash' | 'clashBack' | 'picked' | 'undone' | 'booking'>;
372
+ onChange?: (item: Booking, before: Booking) => void;
373
+ onOpen?: (item: Booking, bar: HTMLElement) => void;
374
+ onAdd?: (at: { row: string; start: string }) => void;
375
+ onClash?: (item: Booking, other: Booking) => void;
376
+ }
377
+ /** <Timeline rows={bikes} items={bookings} /> */
378
+ export const Timeline: React.ForwardRefExoticComponent<TimelineProps & Ref<TimelineHandle>>;
379
+
380
+ /* ---------------- Calendar ---------------- */
381
+ export interface CalendarEvent {
382
+ id?: string | number;
383
+ title: string;
384
+ start: DateLike;
385
+ end?: DateLike;
386
+ /** accent good warn bad indigo teal rose amber violet green slate sky, or any CSS colour. */
387
+ tone?: string;
388
+ /** false: a dot and the time instead of a bar. */
389
+ allDay?: boolean;
390
+ time?: string;
391
+ [key: string]: unknown;
392
+ }
393
+ export interface CalendarHandle {
394
+ readonly el: HTMLElement;
395
+ readonly month: Date;
396
+ readonly value: Date | null;
397
+ readonly events: CalendarEvent[];
398
+ go(date: DateLike): CalendarHandle;
399
+ next(): CalendarHandle;
400
+ prev(): CalendarHandle;
401
+ today(): CalendarHandle;
402
+ select(date: DateLike | null): CalendarHandle;
403
+ setEvents(events: CalendarEvent[]): CalendarHandle;
404
+ addEvent(event: CalendarEvent): CalendarHandle;
405
+ removeEvent(id: string | number): CalendarHandle;
406
+ destroy(): void;
407
+ }
408
+ export interface CalendarProps extends HostProps {
409
+ events?: CalendarEvent[];
410
+ /** The month on show (applied with go()). */
411
+ month?: DateLike;
412
+ /** The picked day (controlled; applied with select()). */
413
+ value?: DateLike | null;
414
+ /** The picked day to start with. */
415
+ defaultValue?: DateLike | null;
416
+ /** 1 = Monday, 0 = Sunday. */
417
+ weekStart?: number;
418
+ /** Month and day names through Intl ('th' gives Thai with the Buddhist year). */
419
+ locale?: string;
420
+ today?: DateLike;
421
+ /** Chips shown per day; the rest go under “+2 more”. */
422
+ maxPerDay?: number;
423
+ selectable?: boolean;
424
+ /** Drag an event to another day. */
425
+ draggable?: boolean;
426
+ size?: '' | 'sm';
427
+ label?: string;
428
+ words?: Words<'label' | 'prev' | 'next' | 'today' | 'todayMark' | 'count' | 'more' | 'moreLabel' | 'close' | 'moveHint' | 'moved'>;
429
+ onMonth?: (date: Date, cal: CalendarHandle) => void;
430
+ onDay?: (date: Date, events: CalendarEvent[], cal: CalendarHandle) => void;
431
+ onEvent?: (event: CalendarEvent, cal: CalendarHandle) => void;
432
+ /** Return false to put it back. */
433
+ onMove?: (event: CalendarEvent, start: DateLike, end: DateLike, cal: CalendarHandle) => boolean | void;
434
+ }
435
+ /** <Calendar events={…} onDay={…} /> */
436
+ export const Calendar: React.ForwardRefExoticComponent<CalendarProps & Ref<CalendarHandle>>;
437
+
438
+ /* ---------------- Swipe ---------------- */
439
+ export interface SwipeAction {
440
+ id: string;
441
+ label?: string;
442
+ /** An icon name or any React node. */
443
+ icon?: IconLike;
444
+ tone?: 'good' | 'bad' | 'warn' | 'accent' | 'neutral';
445
+ /** Running it slides the row off (and hides it). */
446
+ remove?: boolean;
447
+ }
448
+ export interface SwipeItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'id'> {
449
+ /** data-id (ctx.id in onAction). */
450
+ id?: string | number;
451
+ /** Shown when the row is pulled right (first = at the edge). */
452
+ start?: SwipeAction[];
453
+ /** Shown when the row is pulled left (first = at the edge, the one a long swipe runs). */
454
+ end?: SwipeAction[];
455
+ look?: 'both' | 'icons' | 'labels';
456
+ /** Accessible name for the row (otherwise its text is read). */
457
+ label?: string;
458
+ }
459
+ /** <SwipeItem id="b1" end={[…]}>row</SwipeItem> */
460
+ export const SwipeItem: React.ForwardRefExoticComponent<SwipeItemProps & React.RefAttributes<HTMLDivElement>>;
461
+
462
+ export interface SwipeContext { row: HTMLElement; id?: string; action: string; undo(): boolean }
463
+ export interface SwipeHandle {
464
+ readonly el: HTMLElement;
465
+ readonly openRow: HTMLElement | null;
466
+ open(row: Element | string, side?: 'start' | 'end'): SwipeHandle;
467
+ close(row?: Element | string): SwipeHandle;
468
+ peek(row?: Element | string, side?: 'start' | 'end'): SwipeHandle;
469
+ destroy(): void;
470
+ }
471
+ export interface SwipeActionsProps extends React.HTMLAttributes<HTMLElement> {
472
+ as?: React.ElementType;
473
+ /** A long swipe runs the edge action. */
474
+ full?: boolean;
475
+ /** How far (share of the row's width) a long swipe must go. */
476
+ fullAt?: number;
477
+ /** Opening one row shuts the others. */
478
+ single?: boolean;
479
+ /** A tiny buzz on phones when a long swipe is ready. */
480
+ haptic?: boolean;
481
+ /** A removed row is hidden, not taken out of the page (default true here: React owns the rows). */
482
+ keepRows?: boolean;
483
+ /** Return false to keep a row whose action has remove: true. */
484
+ onAction?: (action: string, ctx: SwipeContext, sw: SwipeHandle) => boolean | void;
485
+ onOpen?: (row: HTMLElement, side: 'start' | 'end', sw: SwipeHandle) => void;
486
+ onClose?: (row: HTMLElement, sw: SwipeHandle) => void;
487
+ }
488
+ /** <SwipeActions onAction={…}>{rows}</SwipeActions> */
489
+ export const SwipeActions: React.ForwardRefExoticComponent<SwipeActionsProps & React.RefAttributes<HTMLElement>>;
490
+
491
+ /* ---------------- Kanban ---------------- */
492
+ export interface KanbanColumn { id: string | number; title: string; color?: string; limit?: number }
493
+ export interface KanbanCard {
494
+ id: string | number;
495
+ column: string | number;
496
+ title?: string;
497
+ text?: string;
498
+ tags?: (string | { label: string; tone?: string })[];
499
+ /** Trusted HTML (built-in card only). */
500
+ meta?: string;
501
+ color?: string;
502
+ [key: string]: unknown;
503
+ }
504
+ export interface KanbanMove { from: string; to: string; index: number; fromIndex: number }
505
+ export interface KanbanHandle {
506
+ readonly el: HTMLElement;
507
+ cards(): KanbanCard[];
508
+ add(card: KanbanCard, index?: number): KanbanCard | null;
509
+ update(id: string | number, patch: Partial<KanbanCard>): KanbanCard | null;
510
+ remove(id: string | number): KanbanHandle;
511
+ move(id: string | number, column: string | number, index?: number): KanbanHandle;
512
+ setCards(cards: KanbanCard[]): KanbanHandle;
513
+ destroy(): void;
514
+ }
515
+ export interface KanbanProps<T extends KanbanCard = KanbanCard> extends HostProps {
516
+ columns: KanbanColumn[];
517
+ /** In the order they show. Applied in place when it changes. */
518
+ cards: T[];
519
+ /** Draw each card with React. */
520
+ renderCard?: (card: T) => React.ReactNode;
521
+ /** Or: trusted HTML for each card. */
522
+ render?: (card: T) => string;
523
+ /** A full column takes no more cards. */
524
+ strictLimit?: boolean;
525
+ canDrop?: (card: T, columnId: string) => boolean;
526
+ /** After a drop; return false to put it back. */
527
+ onMove?: (card: T, move: KanbanMove, kb: KanbanHandle) => boolean | void;
528
+ onOpen?: (card: T, el: HTMLElement, kb: KanbanHandle) => void;
529
+ /** Shows an "Add card" button under each column. */
530
+ onAdd?: (columnId: string, kb: KanbanHandle) => void;
531
+ words?: Words<'empty' | 'add' | 'hint' | 'grabbed' | 'moving' | 'dropped' | 'cancelled' | 'refused' | 'full'>;
532
+ }
533
+ /** <Kanban columns={…} cards={…} renderCard={(c) => <Card c={c} />} /> */
534
+ export const Kanban: React.ForwardRefExoticComponent<KanbanProps<any> & Ref<KanbanHandle>>;
535
+
536
+ /* ---------------- Notifications ---------------- */
537
+ export interface NotificationItem {
538
+ id?: string | number;
539
+ /** Date | ms | ISO string (default: now). */
540
+ time?: Date | number | string;
541
+ title?: string;
542
+ body?: string;
543
+ /** A small word after the time. */
544
+ meta?: string;
545
+ person?: Person;
546
+ icon?: string;
547
+ tone?: string;
548
+ /** Trusted markup instead of person + title. */
549
+ html?: string;
550
+ /** The row becomes a link. */
551
+ href?: string;
552
+ read?: boolean;
553
+ actions?: { id: string; label: string; variant?: string; done?: string }[];
554
+ dismissible?: boolean;
555
+ [key: string]: unknown;
556
+ }
557
+ export interface NotificationsHandle {
558
+ readonly root: HTMLElement;
559
+ readonly items: NotificationItem[];
560
+ readonly unread: number;
561
+ readonly filter: 'all' | 'unread';
562
+ add(item: NotificationItem | NotificationItem[]): void;
563
+ update(id: string | number, patch: Partial<NotificationItem>): boolean;
564
+ read(ids: string | number | (string | number)[], read?: boolean): number;
565
+ readAll(): void;
566
+ remove(id: string | number): void;
567
+ setFilter(filter: 'all' | 'unread'): void;
568
+ setItems(items: NotificationItem[]): void;
569
+ destroy(): void;
570
+ }
571
+ export interface NotificationsProps extends HostProps {
572
+ /** Applied in place when it changes. */
573
+ items: NotificationItem[];
574
+ /** Today · Yesterday · Earlier. */
575
+ group?: boolean;
576
+ filter?: 'all' | 'unread';
577
+ header?: boolean;
578
+ tabs?: boolean;
579
+ markAll?: boolean;
580
+ dismissible?: boolean;
581
+ /** The list scrolls past this; 0 = grow with the list. */
582
+ height?: number | string;
583
+ /** No border or background. */
584
+ plain?: boolean;
585
+ locale?: string;
586
+ /** Your own time text. */
587
+ when?: (date: Date) => string;
588
+ emptyIcon?: string;
589
+ words?: Words<'title' | 'all' | 'unread' | 'markAll' | 'today' | 'yesterday' | 'earlier' | 'now' | 'empty' | 'emptyBody' | 'emptyUnread' | 'emptyUnreadBody' | 'newer' | 'dismiss' | 'unreadMark' | 'fresh' | 'allRead' | 'dismissed' | 'failed'>;
590
+ onOpen?: (item: NotificationItem, nf: NotificationsHandle) => void;
591
+ /** Resolve to a short result ("Accepted"), false to undo, or nothing. */
592
+ onAction?: (item: NotificationItem, actionId: string, nf: NotificationsHandle) => Promise<string | false | void> | string | false | void;
593
+ onDismiss?: (item: NotificationItem, nf: NotificationsHandle) => void;
594
+ onChange?: (unread: number, nf: NotificationsHandle) => void;
595
+ }
596
+ /** <Notifications items={…} /> */
597
+ export const Notifications: React.ForwardRefExoticComponent<NotificationsProps & Ref<NotificationsHandle>>;
598
+
599
+ /* ---------------- Activity ---------------- */
600
+ export interface ActivityItem {
601
+ id?: string | number;
602
+ time?: Date | number | string;
603
+ /** Bold before the text; an object also gives an avatar. */
604
+ who?: string | Person;
605
+ what?: string;
606
+ /** Bold text instead of the name. */
607
+ title?: string;
608
+ detail?: string;
609
+ icon?: string;
610
+ tone?: string;
611
+ /** Trusted markup instead of who + what. */
612
+ html?: string;
613
+ [key: string]: unknown;
614
+ }
615
+ export interface ActivityHandle {
616
+ readonly root: HTMLElement;
617
+ readonly items: ActivityItem[];
618
+ add(item: ActivityItem | ActivityItem[]): void;
619
+ remove(id: string | number): ActivityHandle;
620
+ set(items: ActivityItem[]): ActivityHandle;
621
+ play(): ActivityHandle;
622
+ destroy(): void;
623
+ }
624
+ export interface ActivityProps extends HostProps {
625
+ /** Newest first. New ones at the top are added with the push-down motion. */
626
+ items: ActivityItem[];
627
+ marks?: 'auto' | 'icon' | 'avatar' | 'dot';
628
+ /** Halo on the newest mark. */
629
+ latest?: boolean;
630
+ /** Keep at most this many (0 = all). */
631
+ max?: number;
632
+ /** Draw the line + rise in: when it scrolls into view, at once, or not at all. */
633
+ intro?: 'view' | boolean;
634
+ locale?: string;
635
+ format?: (date: Date) => string;
636
+ /** Seconds between time updates (0 = never). */
637
+ refresh?: number;
638
+ label?: string;
639
+ words?: Words<'label' | 'now' | 'added' | 'more'>;
640
+ }
641
+ /** <Activity items={…} /> */
642
+ export const Activity: React.ForwardRefExoticComponent<ActivityProps & Ref<ActivityHandle>>;
643
+
644
+ /* ---------------- Pagination ---------------- */
645
+ export interface PaginationHandle {
646
+ readonly root: HTMLElement;
647
+ readonly page: number;
648
+ readonly pageSize: number;
649
+ readonly pages: number;
650
+ readonly total: number;
651
+ go(page: number): boolean;
652
+ next(): boolean;
653
+ prev(): boolean;
654
+ setTotal(total: number): number;
655
+ destroy(): void;
656
+ }
657
+ export interface PaginationProps extends HostProps {
658
+ /** Number of items. */
659
+ total: number;
660
+ /** The page, from 1 (controlled). */
661
+ value?: number;
662
+ /** The page to start on (vanilla `page`). */
663
+ defaultValue?: number;
664
+ pageSize?: number;
665
+ /** Numbers either side of the current one. */
666
+ siblings?: number;
667
+ /** Numbers always shown at each end. */
668
+ boundaries?: number;
669
+ /** A page-size list; null for none. */
670
+ sizes?: number[] | null;
671
+ /** “21–30 of 240”. */
672
+ info?: boolean;
673
+ look?: 'numbers' | 'simple';
674
+ compact?: boolean | 'auto';
675
+ compactAt?: number;
676
+ words?: Words<'label' | 'prev' | 'next' | 'perPage' | 'none' | 'page' | 'pageOf' | 'info' | 'num'>;
677
+ onChange?: (page: number, pageSize: number, p: PaginationHandle) => void;
678
+ }
679
+ /** <Pagination total={240} value={page} onChange={setPage} /> */
680
+ export const Pagination: React.ForwardRefExoticComponent<PaginationProps & Ref<PaginationHandle>>;
681
+
682
+ /* ---------------- Breadcrumbs ---------------- */
683
+ export interface Crumb { label: string; href?: string; icon?: string; id?: string | number }
684
+ export interface BreadcrumbsHandle { readonly root: HTMLElement; readonly items: Crumb[]; set(items: Crumb[], options?: { animate?: boolean }): void; expand(): void; destroy(): void }
685
+ export interface BreadcrumbsProps extends HostProps {
686
+ /** No href → a button; the last one is the current page. Set in place when it changes. */
687
+ items: Crumb[];
688
+ /** More steps than this fold into “…” (0: only when the row does not fit). */
689
+ max?: number;
690
+ separator?: 'chevron' | 'slash' | 'dot';
691
+ size?: '' | 'sm' | 'lg';
692
+ words?: Words<'label' | 'more'>;
693
+ /** A click on a step (call e.preventDefault() for links you route yourself). */
694
+ onNavigate?: (item: Crumb, index: number, event: MouseEvent) => void;
695
+ }
696
+ /** <Breadcrumbs items={…} onNavigate={…} /> */
697
+ export const Breadcrumbs: React.ForwardRefExoticComponent<BreadcrumbsProps & Ref<BreadcrumbsHandle>>;
698
+
699
+ /* ---------------- Skeleton ---------------- */
700
+ export interface SkeletonHandle {
701
+ readonly root: HTMLElement;
702
+ readonly content: HTMLElement;
703
+ readonly busy: boolean;
704
+ reveal(content?: undefined, options?: { stagger?: boolean }): Promise<void>;
705
+ loading(on?: boolean): Promise<void>;
706
+ destroy(options?: { keep?: boolean }): void;
707
+ }
708
+ export interface SkeletonProps extends HostProps {
709
+ /** The real content. */
710
+ children?: React.ReactNode;
711
+ /** true: placeholders; false: the content rises into place (default true). */
712
+ loading?: boolean;
713
+ /** custom: every element in the children with data-sk becomes a grey block of its own size. */
714
+ look?: 'list' | 'card' | 'text' | 'table' | 'custom';
715
+ rows?: number;
716
+ avatar?: boolean;
717
+ media?: boolean;
718
+ lines?: number;
719
+ cols?: number;
720
+ /** The light that sweeps across the blocks. */
721
+ shimmer?: boolean;
722
+ /** Added to what screen readers hear: “Team: Loading…”. */
723
+ label?: string;
724
+ words?: Words<'loading' | 'loaded'>;
725
+ }
726
+ /** <Skeleton loading={!data}>{data && <List data={data} />}</Skeleton> */
727
+ export const Skeleton: React.ForwardRefExoticComponent<SkeletonProps & Ref<SkeletonHandle>>;
728
+
729
+ /* ---------------- Alert ---------------- */
730
+ export interface AlertAction { label: string; primary?: boolean; run?: (a: AlertHandle, button: HTMLButtonElement) => unknown }
731
+ export interface AlertHandle {
732
+ readonly root: HTMLElement;
733
+ readonly open: boolean;
734
+ readonly tone: 'info' | 'good' | 'warn' | 'bad';
735
+ update(next: { tone?: 'info' | 'good' | 'warn' | 'bad'; title?: string; icon?: string | false; actions?: AlertAction[] }): AlertHandle;
736
+ close(): Promise<void>;
737
+ show(): Promise<void>;
738
+ shake(): AlertHandle;
739
+ destroy(): void;
740
+ }
741
+ export interface AlertProps extends HostProps {
742
+ /** The message (vanilla `body`). */
743
+ children?: React.ReactNode;
744
+ tone?: 'info' | 'good' | 'warn' | 'bad';
745
+ title?: string;
746
+ /** Default per tone (info · check · alert · close); false for none. */
747
+ icon?: string | false;
748
+ look?: 'soft' | 'outline' | 'solid' | 'banner';
749
+ /** A close button (and Esc while focus is inside). */
750
+ dismissible?: boolean;
751
+ /** run may return a Promise: the button waits until it settles. */
752
+ actions?: AlertAction[];
753
+ /** false folds it away; true grows it back (default true). */
754
+ open?: boolean;
755
+ words?: Words<'close'>;
756
+ /** After it closed from inside (✕ or Esc): set open to false there. */
757
+ onClose?: (a: AlertHandle) => void;
758
+ }
759
+ /** <Alert tone="good" title="Saved">Your booking is confirmed.</Alert> */
760
+ export const Alert: React.ForwardRefExoticComponent<AlertProps & Ref<AlertHandle>>;
761
+
762
+ export {};