@ceebee/ui 0.4.0 → 0.5.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/dist/client.d.ts CHANGED
@@ -148,7 +148,7 @@ interface TextInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'si
148
148
  /** Marks invalid when used outside a Field; inside one, the Field decides. */
149
149
  invalid?: boolean;
150
150
  }
151
- declare const TextInput: react.ForwardRefExoticComponent<TextInputProps & react.RefAttributes<HTMLInputElement>>;
151
+ declare const Input: react.ForwardRefExoticComponent<TextInputProps & react.RefAttributes<HTMLInputElement>>;
152
152
  interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
153
153
  invalid?: boolean;
154
154
  }
@@ -208,10 +208,18 @@ interface RadioGroupProps<T extends string = string> {
208
208
  /** Names the group for assistive technology when it is not inside a Field. */
209
209
  label?: string;
210
210
  direction?: 'column' | 'row';
211
+ /**
212
+ * `segmented` draws the group as one track of adjoining cells instead of a
213
+ * list of dots. Appearance and geometry only — the role, the keyboard, and
214
+ * the value it reports are a radiogroup's either way (ADR 0014). Reach for it
215
+ * where the options are few enough to show at once, which is where a dropdown
216
+ * is the wrong control anyway.
217
+ */
218
+ variant?: 'list' | 'segmented';
211
219
  disabled?: boolean;
212
220
  className?: string;
213
221
  }
214
- declare function RadioGroup<T extends string = string>({ options, value, defaultValue, onValueChange, name, label, direction, disabled, className, }: RadioGroupProps<T>): react.JSX.Element;
222
+ declare function RadioGroup<T extends string = string>({ options, value, defaultValue, onValueChange, name, label, direction, variant, disabled, className, }: RadioGroupProps<T>): react.JSX.Element;
215
223
  interface SwitchProps {
216
224
  label: ReactNode;
217
225
  checked?: boolean;
@@ -231,26 +239,48 @@ interface ComboboxOption {
231
239
  value: string;
232
240
  label: string;
233
241
  description?: ReactNode;
242
+ disabled?: boolean;
234
243
  }
244
+ /**
245
+ * Fetches the options for a query. Receiving one puts the AutoComplete in async mode:
246
+ * the built-in match is switched off, because whatever answered the query has
247
+ * already decided what matches and filtering the reply again would drop rows whose
248
+ * label does not happen to contain what was typed.
249
+ *
250
+ * The `signal` aborts when a newer query supersedes this one. Replies are also
251
+ * discarded by sequence, so a slow "a" landing after a fast "abc" cannot overwrite
252
+ * the newer list — the failure that makes an async picker show the wrong rows.
253
+ */
254
+ type ComboboxLoader = (query: string, signal: AbortSignal) => Promise<ComboboxOption[]>;
235
255
  interface ComboboxProps {
236
- items: ComboboxOption[];
256
+ /** The whole list, filtered in the browser. Omit when `loadItems` is given. */
257
+ items?: ComboboxOption[];
258
+ /** Asks somewhere else for the options instead of holding them all (ADR 0006). */
259
+ loadItems?: ComboboxLoader;
260
+ /** How long typing has to stop before `loadItems` is asked. */
261
+ loadDelay?: number;
237
262
  value?: string | null;
238
263
  defaultValue?: string | null;
239
264
  onValueChange?: (value: string | null) => void;
240
265
  placeholder?: string;
241
266
  /** Shown when the query matches nothing. */
242
267
  emptyMessage?: ReactNode;
268
+ /** Shown while `loadItems` is outstanding. */
269
+ loadingMessage?: ReactNode;
270
+ /** Shown when `loadItems` rejects. */
271
+ errorMessage?: ReactNode;
243
272
  size?: Size;
244
273
  disabled?: boolean;
245
274
  invalid?: boolean;
246
275
  name?: string;
276
+ id?: string;
247
277
  className?: string;
248
278
  }
249
279
  /**
250
280
  * A Select you can type into. Reach for it past roughly a dozen options — below that, scanning a
251
281
  * list is faster than typing, and Select is the simpler component.
252
282
  */
253
- declare function Combobox({ items, value, defaultValue, onValueChange, placeholder, emptyMessage, size, disabled, invalid, name, className, }: ComboboxProps): react.JSX.Element;
283
+ declare function AutoComplete({ items, loadItems, loadDelay, value, defaultValue, onValueChange, placeholder, emptyMessage, loadingMessage, errorMessage, size, disabled, invalid, name, id, className, }: ComboboxProps): react.JSX.Element;
254
284
 
255
285
  interface DateInputProps {
256
286
  value?: Date | null;
@@ -271,7 +301,7 @@ interface DateInputProps {
271
301
  * Typing and picking, both. Typing is what fast people do and what a date of birth needs; the
272
302
  * calendar is for "the second Tuesday" questions a text field cannot answer.
273
303
  */
274
- declare function DateInput({ value, defaultValue, onValueChange, min, max, format, weekStartsOn, size, disabled, invalid, placeholder, className, }: DateInputProps): react.JSX.Element;
304
+ declare function DatePicker({ value, defaultValue, onValueChange, min, max, format, weekStartsOn, size, disabled, invalid, placeholder, className, }: DateInputProps): react.JSX.Element;
275
305
 
276
306
  /** Date arithmetic for the picker. Pure, and dealing only in local calendar days. */
277
307
  interface DayCell {
@@ -325,10 +355,10 @@ interface TimeInputProps {
325
355
  className?: string;
326
356
  }
327
357
  /**
328
- * The DateInput's sibling. Typing accepts what people actually type — `9`, `0930`, `9:30`,
358
+ * The DatePicker's sibling. Typing accepts what people actually type — `9`, `0930`, `9:30`,
329
359
  * `9pm` — and the list is a convenience on top, never the only way to answer.
330
360
  */
331
- declare function TimeInput({ value, defaultValue, onValueChange, min, max, step, size, disabled, invalid, placeholder, className, }: TimeInputProps): react.JSX.Element;
361
+ declare function TimePicker({ value, defaultValue, onValueChange, min, max, step, size, disabled, invalid, placeholder, className, }: TimeInputProps): react.JSX.Element;
332
362
 
333
363
  /** File acceptance rules, kept pure: what gets rejected and why is worth asserting. */
334
364
  interface FileRules {
@@ -355,7 +385,7 @@ declare function partitionFiles(incoming: File[], existing: File[], rules: FileR
355
385
  /** The " — PDF up to 5 MB" tail under the drop zone. Empty when there is nothing to say. */
356
386
  declare function describeAccept(rules: FileRules): string;
357
387
 
358
- interface FileDropProps extends FileRules {
388
+ interface UploadProps extends FileRules {
359
389
  onFilesChange: (files: File[]) => void;
360
390
  files?: File[];
361
391
  /** Rejections are surfaced rather than swallowed — a file that vanishes silently reads as a bug. */
@@ -367,7 +397,7 @@ interface FileDropProps extends FileRules {
367
397
  children?: ReactNode;
368
398
  className?: string;
369
399
  }
370
- declare function FileDrop({ onFilesChange, files, onReject, accept, maxSize, maxFiles, multiple, disabled, children, className, }: FileDropProps): react.JSX.Element;
400
+ declare function Upload({ onFilesChange, files, onReject, accept, maxSize, maxFiles, multiple, disabled, children, className, }: UploadProps): react.JSX.Element;
371
401
 
372
402
  /** Numeric input arithmetic, kept pure so the awkward cases are asserted, not hoped for. */
373
403
  interface NumberBounds {
@@ -404,7 +434,7 @@ interface NumberInputProps extends NumberBounds {
404
434
  * A text input that speaks numbers, not `<input type="number">`: that one scrolls its value
405
435
  * away under the wheel, accepts 'e' and '+', and formats inconsistently across locales.
406
436
  */
407
- declare function NumberInput({ value, defaultValue, onValueChange, min, max, step, size, disabled, invalid, name, placeholder, suffix, className, }: NumberInputProps): react.JSX.Element;
437
+ declare function InputNumber({ value, defaultValue, onValueChange, min, max, step, size, disabled, invalid, name, placeholder, suffix, className, }: NumberInputProps): react.JSX.Element;
408
438
 
409
439
  interface DialogProps {
410
440
  open?: boolean;
@@ -426,9 +456,28 @@ interface DialogProps {
426
456
  * (ADR 0003). Enter and exit are CSS transitions driven by Base UI's own state attributes,
427
457
  * because Base UI owns this element's mount lifecycle — motion is used where we own it.
428
458
  */
429
- declare function Dialog({ open, defaultOpen, onOpenChange, title, description, children, footer, size, placement, trigger, className, }: DialogProps): react.JSX.Element;
459
+ declare function Modal({ open, defaultOpen, onOpenChange, title, description, children, footer, size, placement, trigger, className, }: DialogProps): react.JSX.Element;
430
460
  declare const DialogClose: react.ForwardRefExoticComponent<Omit<_base_ui_react.AlertDialogCloseProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
431
461
 
462
+ interface DrawerProps {
463
+ open?: boolean;
464
+ defaultOpen?: boolean;
465
+ onOpenChange?: (open: boolean) => void;
466
+ title: ReactNode;
467
+ description?: ReactNode;
468
+ children?: ReactNode;
469
+ footer?: ReactNode;
470
+ /** The element that opens it. Omit for a fully controlled drawer. */
471
+ trigger?: ReactNode;
472
+ className?: string;
473
+ }
474
+ /**
475
+ * Modal navigation or task panel anchored to the inline end edge. Base UI supplies
476
+ * focus trapping, dismissal, scroll locking, and accessible dialog semantics.
477
+ */
478
+ declare function Drawer({ open, defaultOpen, onOpenChange, title, description, children, footer, trigger, className, }: DrawerProps): react.JSX.Element;
479
+ declare const DrawerClose: react.ForwardRefExoticComponent<Omit<_base_ui_react.AlertDialogCloseProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
480
+
432
481
  /** Command matching and ranking. Pure — search that ranks badly is a bug you can only see in a test. */
433
482
  interface Command {
434
483
  id: string;
@@ -515,9 +564,70 @@ interface TooltipProps {
515
564
  /** Plain text. A tooltip that needs markup is a Popover — screen readers read this as a label. */
516
565
  label: string;
517
566
  side?: Side;
567
+ align?: Align;
568
+ /** Distance from the anchor, in px. */
569
+ sideOffset?: number;
570
+ showArrow?: boolean;
518
571
  delay?: number;
519
572
  }
520
- declare function Tooltip({ children, label, side, delay }: TooltipProps): react.JSX.Element;
573
+ declare function Tooltip({ children, label, side, align, sideOffset, showArrow, delay, }: TooltipProps): react.JSX.Element;
574
+
575
+ interface TagProps {
576
+ children: ReactNode;
577
+ tone?: Tone;
578
+ variant?: 'soft' | 'solid' | 'outline';
579
+ size?: 'sm' | 'md';
580
+ icon?: ReactNode;
581
+ /** Makes the tag itself pressable — filtering by it, or opening what it names. */
582
+ onClick?: () => void;
583
+ /** Whether a pressable tag is currently on. Reported as `aria-pressed`. */
584
+ pressed?: boolean;
585
+ /** Adds a control that takes the tag away. Not the same as pressing it. */
586
+ onClose?: () => void;
587
+ /** Render something else in the tag's place — a router's own Link. */
588
+ render?: ReactElement;
589
+ className?: string;
590
+ }
591
+ /**
592
+ * A label you can do something to.
593
+ *
594
+ * `Badge` is the one you cannot: it says what something is and nothing more, and
595
+ * its own note says that a label which can be pressed or removed is this instead.
596
+ * That is the whole boundary between them — not the size, not the colour, but
597
+ * whether there is anything to press (ADR 0014). They share the look and differ
598
+ * in what they are.
599
+ *
600
+ * Pressing and removing are also two different things, so they are two props. A
601
+ * tag that filters by its own value and a tag that takes itself off a list are
602
+ * not the same gesture, and one component that guessed which you meant would be
603
+ * wrong half the time.
604
+ */
605
+ declare function Tag({ children, tone, variant, size, icon, onClick, pressed, onClose, render, className, }: TagProps): react.JSX.Element;
606
+
607
+ interface RateProps {
608
+ /** 0 means nothing chosen, which is different from choosing the lowest score. */
609
+ value: number;
610
+ onValueChange?: (value: number) => void;
611
+ count?: number;
612
+ size?: number;
613
+ /** Shows a score without offering to change it. */
614
+ readOnly?: boolean;
615
+ /** Names the group when it is not inside a Field. */
616
+ label?: string;
617
+ className?: string;
618
+ }
619
+ /**
620
+ * A score out of a few, set by pressing one of them.
621
+ *
622
+ * A radiogroup, not a row of buttons: exactly one of a small visible set is the
623
+ * definition of one, and it buys the arrow keys and the announced position for
624
+ * free. Read-only it is not a group at all — there is nothing to choose, so it
625
+ * is an image with a label saying what it shows.
626
+ *
627
+ * Pressing the current score again clears it. Nought stars and one star are
628
+ * different answers, and without this there is no way back to the first.
629
+ */
630
+ declare function Rate({ value, onValueChange, count, size, readOnly, label, className, }: RateProps): react.JSX.Element;
521
631
 
522
632
  interface AlertProps {
523
633
  title?: ReactNode;
@@ -614,7 +724,7 @@ type DropdownMenuProps = DropdownMenuBaseProps & ({
614
724
  sections: MenuSection[];
615
725
  });
616
726
  /** Typeahead, roving focus, and dismissal are Base UI's; the surface and the rhythm are ours. */
617
- declare function DropdownMenu({ trigger, items, sections, align, side, className }: DropdownMenuProps): react.JSX.Element;
727
+ declare function Dropdown({ trigger, items, sections, align, side, className }: DropdownMenuProps): react.JSX.Element;
618
728
 
619
729
  interface NavItem {
620
730
  label: ReactNode;
@@ -647,7 +757,7 @@ interface SidebarProps {
647
757
  */
648
758
  declare function Sidebar({ sections, header, footer, collapsed, onCollapsedChange, className }: SidebarProps): react.JSX.Element;
649
759
  interface TopBarProps {
650
- /** Page title, or a Breadcrumbs trail. */
760
+ /** Page title, or a Breadcrumb trail. */
651
761
  title?: ReactNode;
652
762
  subtitle?: ReactNode;
653
763
  /** Search, filters — anything that belongs in the middle. */
@@ -707,7 +817,7 @@ interface DataTableProps<Row> {
707
817
  sort?: SortState | null;
708
818
  onSortChange?: (sort: SortState | null) => void;
709
819
  onRowClick?: (row: Row) => void;
710
- /** Rendered in place of the body when there are no rows — an EmptyState, usually. */
820
+ /** Rendered in place of the body when there are no rows — an Empty, usually. */
711
821
  empty?: ReactNode;
712
822
  className?: string;
713
823
  }
@@ -715,8 +825,8 @@ interface DataTableProps<Row> {
715
825
  * A table, not a grid: no virtualisation, no column resizing, no editing. It renders rows and
716
826
  * sorts by a column, and anything past that is a product feature rather than a design system one.
717
827
  */
718
- declare function DataTable<Row>({ columns, rows, rowKey, label, sort, onSortChange, onRowClick, empty, className, }: DataTableProps<Row>): react.JSX.Element;
719
- declare namespace DataTable {
828
+ declare function Table<Row>({ columns, rows, rowKey, label, sort, onSortChange, onRowClick, empty, className, }: DataTableProps<Row>): react.JSX.Element;
829
+ declare namespace Table {
720
830
  var Skeleton: typeof DataTableSkeleton;
721
831
  }
722
832
  interface DataTableSkeletonProps {
@@ -939,4 +1049,4 @@ interface StaggerProps {
939
1049
  /** Wraps each child in a Reveal with an increasing delay — the list arrives, it does not pop. */
940
1050
  declare function Stagger({ children, step, from, onView, className }: StaggerProps): react.JSX.Element;
941
1051
 
942
- export { Alert, type AlertProps, type Align, type AutoplayConditions, Button, type ButtonProps, Carousel, type CarouselProps, type CarouselSkeletonProps, type CarouselSlideProps, Checkbox, type CheckboxProps, Checklist, type ChecklistProps, type ChecklistTask, Coachmark, type CoachmarkProps, type Column, Combobox, type ComboboxOption, type ComboboxProps, type Command, CommandPalette, type CommandPaletteProps, DEFAULT_LABELS, DataTable, type DataTableProps, type DataTableSkeletonProps, DateInput, type DateInputProps, type DayCell, Dialog, DialogClose, type DialogProps, DropdownMenu, type DropdownMenuProps, type DurationToken, Field, type FieldProps, FileDrop, type FileDropProps, type FileRules, Image, type ImageProps, type Labels, LabelsProvider, type LabelsProviderProps, type MenuItem, type MenuSection, type MotionHelpers, MotionProvider, type MotionProviderProps, type MotionSettings, type NavItem, type NavSection, type NumberBounds, NumberInput, type NumberInputProps, type PageRange, Pagination, type PaginationProps, type PaletteCommand, Popover, type PopoverProps, RadioGroup, type RadioGroupProps, type RadioOption, type RankedCommand, type Rejection, Reveal, type RevealProps, type SeenStore, Select, type SelectOption, type SelectProps, type Side, Sidebar, type SidebarProps, type SortDirection, type SortState, type SpringPreset, Stagger, type StaggerProps, type StepTarget, Switch, type SwitchProps, type TabItem, Tabs, type TabsProps, TextInput, type TextInputProps, Textarea, type TextareaProps, type ThemeChoice, ThemeProvider, TimeInput, type TimeInputProps, type TimeValue, type ToastOptions, type ToastPosition, ToastProvider, type ToastProviderProps, Tooltip, type TooltipProps, TopBar, type TopBarProps, Tour, type TourAction, type TourProps, type TourState, type TourStatus, type TourStep, ariaSortFor, canStep, clamp, decimalPlaces, describeAccept, filterCommands, formatISO, formatTime, groupCommands, hasEnded, initialTourState, isOutOfRange, isSameDay, isTimeOutOfRange, matchesAccept, monthMatrix, nextSort, pageRange, parseDateInput, parseNumber, parseTime, partitionFiles, rankCommand, resolveTarget, shouldAutoplay, startOfDay, stepBy, timeOptions, timeToMinutes, tourReducer, useFieldWiring, useLabels, useMotionSettings, useTheme, useToast };
1052
+ export { Alert, type AlertProps, type Align, AutoComplete, type AutoplayConditions, Button, type ButtonProps, Carousel, type CarouselProps, type CarouselSkeletonProps, type CarouselSlideProps, Checkbox, type CheckboxProps, Checklist, type ChecklistProps, type ChecklistTask, Coachmark, type CoachmarkProps, type Column, type ComboboxOption, type ComboboxProps, type Command, CommandPalette, type CommandPaletteProps, DEFAULT_LABELS, type DataTableProps, type DataTableSkeletonProps, type DateInputProps, DatePicker, type DayCell, DialogClose, type DialogProps, Drawer, DrawerClose, type DrawerProps, Dropdown, type DropdownMenuProps, type DurationToken, Field, type FieldProps, type FileRules, Image, type ImageProps, Input, InputNumber, type Labels, LabelsProvider, type LabelsProviderProps, type MenuItem, type MenuSection, Modal, type MotionHelpers, MotionProvider, type MotionProviderProps, type MotionSettings, type NavItem, type NavSection, type NumberBounds, type NumberInputProps, type PageRange, Pagination, type PaginationProps, type PaletteCommand, Popover, type PopoverProps, RadioGroup, type RadioGroupProps, type RadioOption, type RankedCommand, Rate, type RateProps, type Rejection, Reveal, type RevealProps, type SeenStore, Select, type SelectOption, type SelectProps, type Side, Sidebar, type SidebarProps, type SortDirection, type SortState, type SpringPreset, Stagger, type StaggerProps, type StepTarget, Switch, type SwitchProps, type TabItem, Table, Tabs, type TabsProps, Tag, type TagProps, type TextInputProps, Textarea, type TextareaProps, type ThemeChoice, ThemeProvider, type TimeInputProps, TimePicker, type TimeValue, type ToastOptions, type ToastPosition, ToastProvider, type ToastProviderProps, Tooltip, type TooltipProps, TopBar, type TopBarProps, Tour, type TourAction, type TourProps, type TourState, type TourStatus, type TourStep, Upload, type UploadProps, ariaSortFor, canStep, clamp, decimalPlaces, describeAccept, filterCommands, formatISO, formatTime, groupCommands, hasEnded, initialTourState, isOutOfRange, isSameDay, isTimeOutOfRange, matchesAccept, monthMatrix, nextSort, pageRange, parseDateInput, parseNumber, parseTime, partitionFiles, rankCommand, resolveTarget, shouldAutoplay, startOfDay, stepBy, timeOptions, timeToMinutes, tourReducer, useFieldWiring, useLabels, useMotionSettings, useTheme, useToast };