@bmsuisse/ui 0.6.3 → 0.8.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/index.d.ts +167 -2
- package/dist/index.js +537 -46
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ButtonHTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, TextareaHTMLAttributes, HTMLAttributes, ReactElement, ComponentPropsWithoutRef, TdHTMLAttributes, ThHTMLAttributes, ReactNode, ComponentProps, ComponentType, Ref } from 'react';
|
|
2
|
+
import { ButtonHTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, TextareaHTMLAttributes, HTMLAttributes, ReactElement, ComponentPropsWithoutRef, TdHTMLAttributes, ThHTMLAttributes, ReactNode, ComponentProps, ComponentType, Ref, ElementType } from 'react';
|
|
3
3
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
@@ -356,6 +356,67 @@ type ComboboxProps = ComboboxSingleProps | ComboboxMultiProps;
|
|
|
356
356
|
*/
|
|
357
357
|
declare function Combobox(props: ComboboxProps): ReactElement;
|
|
358
358
|
|
|
359
|
+
interface TagComboboxOption {
|
|
360
|
+
value: string;
|
|
361
|
+
label: string;
|
|
362
|
+
disabled?: boolean;
|
|
363
|
+
/** Groups this option under a header with the given key, rendered as a bold label
|
|
364
|
+
* plus a tri-state "select all" checkbox (unchecked/checked/indeterminate, reflecting
|
|
365
|
+
* how many of the group's members are selected — toggling it selects or clears the
|
|
366
|
+
* whole group). Options sharing a `group` must be contiguous in `options` — see
|
|
367
|
+
* `Combobox`'s own `group` doc for the same constraint and the reasoning behind it. */
|
|
368
|
+
group?: string;
|
|
369
|
+
}
|
|
370
|
+
interface TagComboboxProps {
|
|
371
|
+
/** The full option list. Filtering happens client-side against `label`,
|
|
372
|
+
* unless `onSearchChange` is given (see below). */
|
|
373
|
+
options: TagComboboxOption[];
|
|
374
|
+
/** Selected options' `value`s. */
|
|
375
|
+
value: string[];
|
|
376
|
+
/** Called with the full updated selection after a toggle or a chip removal. */
|
|
377
|
+
onChange: (value: string[]) => void;
|
|
378
|
+
/** Shown in the field when nothing is selected and nothing is typed. Defaults to `"Select…"`. */
|
|
379
|
+
placeholder?: string;
|
|
380
|
+
/** Shown when the search term matches nothing. Defaults to `"No matches."`. */
|
|
381
|
+
emptyMessage?: string;
|
|
382
|
+
disabled?: boolean;
|
|
383
|
+
/** Shows `loadingMessage` in the option list instead of `emptyMessage`, for a
|
|
384
|
+
* combobox whose `options` are still being fetched (e.g. a server search whose
|
|
385
|
+
* request hasn't resolved yet). Defaults to `false`. */
|
|
386
|
+
loading?: boolean;
|
|
387
|
+
/** Message shown in the option list while `loading` is true. Defaults to `"Loading…"`. */
|
|
388
|
+
loadingMessage?: string;
|
|
389
|
+
className?: string;
|
|
390
|
+
id?: string;
|
|
391
|
+
/** Forwarded to the field, for test targeting (e.g. Playwright/Testing Library). */
|
|
392
|
+
"data-testid"?: string;
|
|
393
|
+
/** Switches the search input to server-driven mode: called with the raw search
|
|
394
|
+
* text on every keystroke, and `options` is rendered as-is instead of being
|
|
395
|
+
* filtered locally against `label`. Omit for the default client-side filtering
|
|
396
|
+
* behavior — see `Combobox`'s own `onSearchChange` for the same contract. */
|
|
397
|
+
onSearchChange?: (search: string) => void;
|
|
398
|
+
/** Portal target for the popover, forwarded to the underlying `PopoverContent`.
|
|
399
|
+
* Needed when the combobox is opened from inside a modal Dialog/Sheet — pass the
|
|
400
|
+
* Dialog/Sheet content element so the popover portals inside it instead of
|
|
401
|
+
* `document.body`, which would otherwise fight with the Dialog's focus trap. */
|
|
402
|
+
container?: ComponentProps<typeof PopoverContent>["container"];
|
|
403
|
+
/** Display label for a group key (`TagComboboxOption.group`). Falls back to the raw
|
|
404
|
+
* key when an entry is missing. Only relevant when at least one option sets `group`. */
|
|
405
|
+
groupLabels?: Record<string, string>;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* A tags-and-search multi-select: selected options render as removable chips
|
|
409
|
+
* inline inside one bordered field, with a search input immediately after
|
|
410
|
+
* the last chip. Typing opens a popover listing matches below the field;
|
|
411
|
+
* picking one adds a chip right where the caret was and clears the search
|
|
412
|
+
* term so the user can keep typing. Complements `Combobox`'s `multiple`
|
|
413
|
+
* mode (a trigger button + a summary count) for the case where every
|
|
414
|
+
* individual selection needs to stay visible and removable at a glance —
|
|
415
|
+
* built on the same `Popover`/keyboard-nav shape rather than forking it,
|
|
416
|
+
* so both patterns share one mental model.
|
|
417
|
+
*/
|
|
418
|
+
declare function TagCombobox({ options, value, onChange, placeholder, emptyMessage, disabled, loading, loadingMessage, className, id, onSearchChange, container, groupLabels, ...rest }: TagComboboxProps): ReactElement;
|
|
419
|
+
|
|
359
420
|
type AlertBoxVariant = "error" | "warning" | "info" | "success";
|
|
360
421
|
interface AlertBoxProps {
|
|
361
422
|
/** Determines the color scheme and the default icon. */
|
|
@@ -465,7 +526,111 @@ interface SearchBarProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "ty
|
|
|
465
526
|
*/
|
|
466
527
|
declare function SearchBar({ value, onChange, isLoading, onClear, clearLabel, inputRef, className, ...props }: SearchBarProps): ReactElement;
|
|
467
528
|
|
|
529
|
+
/** Shape a `lucide-react` icon component satisfies — `NavItem` sizes and colors it itself. */
|
|
530
|
+
interface NavIconProps {
|
|
531
|
+
className?: string;
|
|
532
|
+
strokeWidth?: string | number;
|
|
533
|
+
"aria-hidden"?: boolean | "true" | "false";
|
|
534
|
+
}
|
|
535
|
+
type NavItemProps<T extends ElementType = "a"> = {
|
|
536
|
+
/** The element (or router `Link`) this renders as, e.g. `as={Link} to="/overview"`. @default "a" */
|
|
537
|
+
as?: T;
|
|
538
|
+
icon?: ElementType<NavIconProps>;
|
|
539
|
+
label: ReactNode;
|
|
540
|
+
/** Highlights this row as the current page. The caller computes this from its own router — `NavItem` has no router opinion. */
|
|
541
|
+
active?: boolean;
|
|
542
|
+
/** Rendered after the label, and again in the collapsed-rail tooltip — e.g. an experimental-status `Badge`. */
|
|
543
|
+
badge?: ReactNode;
|
|
544
|
+
className?: string;
|
|
545
|
+
} & Omit<ComponentPropsWithoutRef<T>, "as" | "className">;
|
|
546
|
+
/**
|
|
547
|
+
* One row inside a `Sidebar`/`NavGroup`. Polymorphic via `as` so it renders a
|
|
548
|
+
* plain `<a>` by default or a router's own `Link` (extra props like `to`/
|
|
549
|
+
* `href` pass straight through). When the nearest `Sidebar` is rail-
|
|
550
|
+
* collapsed, the row shrinks to icon-only and shows `label`/`badge` in a
|
|
551
|
+
* hover tooltip instead.
|
|
552
|
+
*/
|
|
553
|
+
declare function NavItem<T extends ElementType = "a">({ as, icon: Icon, label, active, badge, className, ...rest }: NavItemProps<T>): ReactElement;
|
|
554
|
+
|
|
555
|
+
interface NavGroupProps {
|
|
556
|
+
/** Section header. Omit for a flat group with no header/collapse affordance. */
|
|
557
|
+
label?: ReactNode;
|
|
558
|
+
/** Uncontrolled starting collapsed state. @default false */
|
|
559
|
+
defaultCollapsed?: boolean;
|
|
560
|
+
/** Controlled collapsed state. */
|
|
561
|
+
collapsed?: boolean;
|
|
562
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
563
|
+
children: ReactNode;
|
|
564
|
+
className?: string;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* A labeled, independently collapsible section of `NavItem`s inside a
|
|
568
|
+
* `Sidebar`. This group's own collapsed state (items hidden/shown) is
|
|
569
|
+
* separate from the sidebar's rail-collapse: when the sidebar itself is
|
|
570
|
+
* rail-collapsed, this group's header shrinks to a thin divider (its items
|
|
571
|
+
* stay visible as icons) rather than disappearing, since there's no room for
|
|
572
|
+
* a clickable label to toggle.
|
|
573
|
+
*/
|
|
574
|
+
declare function NavGroup({ label, defaultCollapsed, collapsed, onCollapsedChange, children, className, }: NavGroupProps): ReactElement;
|
|
575
|
+
|
|
576
|
+
interface SidebarProps {
|
|
577
|
+
/** Rail-collapse the whole sidebar to an icon-only strip. Controlled. */
|
|
578
|
+
collapsed?: boolean;
|
|
579
|
+
/** Renders a built-in collapse/expand toggle button and fires when it's clicked. Omit to hide the toggle and drive `collapsed` some other way. */
|
|
580
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
581
|
+
/** Lets the user drag the trailing edge to resize. @default false */
|
|
582
|
+
resizable?: boolean;
|
|
583
|
+
/** Controlled width in px (only meaningful while expanded). */
|
|
584
|
+
width?: number;
|
|
585
|
+
onWidthChange?: (width: number) => void;
|
|
586
|
+
/** Uncontrolled starting width in px, and the double-click-to-reset target. @default 240 */
|
|
587
|
+
defaultWidth?: number;
|
|
588
|
+
minWidth?: number;
|
|
589
|
+
maxWidth?: number;
|
|
590
|
+
/** Width of the icon-only rail. @default 56 */
|
|
591
|
+
railWidth?: number;
|
|
592
|
+
/** Logo/wordmark slot. Pass a function to swap in a compact mark once `collapsed` — the shared component only owns the collapse *toggle button*, not your branding. */
|
|
593
|
+
header?: ReactNode | ((collapsed: boolean) => ReactNode);
|
|
594
|
+
/** Pinned below the scrollable nav area (e.g. a user-profile row), outside the scroll-fade. */
|
|
595
|
+
footer?: ReactNode | ((collapsed: boolean) => ReactNode);
|
|
596
|
+
children: ReactNode;
|
|
597
|
+
className?: string;
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* App shell's left navigation panel: fixed-width or drag-resizable, with an
|
|
601
|
+
* optional icon-only rail-collapse mode (tooltips on hover, via `NavItem`).
|
|
602
|
+
* Renders `children` (typically one or more `NavGroup`s of `NavItem`s)
|
|
603
|
+
* inside a scrollable area with a bottom scroll-fade once content overflows.
|
|
604
|
+
*
|
|
605
|
+
* For a mobile drawer, don't reuse `Sidebar` itself (its resize handle and
|
|
606
|
+
* rail-collapse don't apply there) — render the same `NavGroup`/`NavItem`
|
|
607
|
+
* children inside a `Sheet`, wrapped in the separately-exported `SidebarNav`
|
|
608
|
+
* for the scroll-fade behavior.
|
|
609
|
+
*/
|
|
610
|
+
declare function Sidebar({ collapsed, onCollapsedChange, resizable, width, onWidthChange, defaultWidth, minWidth, maxWidth, railWidth, header, footer, children, className, }: SidebarProps): ReactElement;
|
|
611
|
+
type SidebarNavProps = {
|
|
612
|
+
children: ReactNode;
|
|
613
|
+
className?: string;
|
|
614
|
+
} & Omit<ComponentPropsWithoutRef<"div">, "className" | "children" | "ref">;
|
|
615
|
+
/**
|
|
616
|
+
* The scrollable nav-item area, with a bottom scroll-fade once content
|
|
617
|
+
* overflows. Used internally by `Sidebar`; exported separately so a mobile
|
|
618
|
+
* drawer can wrap the same `NavGroup`/`NavItem` children in it without the
|
|
619
|
+
* rest of the `Sidebar` shell. Extra props (`onClick`, `data-testid`, …)
|
|
620
|
+
* forward to the scrollable element itself — e.g. `onClick` to close a
|
|
621
|
+
* mobile drawer when any nav link inside is tapped.
|
|
622
|
+
*/
|
|
623
|
+
declare function SidebarNav({ children, className, ...rest }: SidebarNavProps): ReactElement;
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Whether the nearest ancestor `<Sidebar>` is rail-collapsed. Defaults to
|
|
627
|
+
* `false` when there is no ancestor `<Sidebar>` — this is what lets
|
|
628
|
+
* `NavGroup`/`NavItem` be reused standalone inside a mobile drawer (`Sheet`),
|
|
629
|
+
* which is never rail-collapsed.
|
|
630
|
+
*/
|
|
631
|
+
declare function useSidebarCollapsed(): boolean;
|
|
632
|
+
|
|
468
633
|
/** Merges conditional class names, then dedupes conflicting Tailwind utility classes. */
|
|
469
634
|
declare function cn(...inputs: ClassValue[]): string;
|
|
470
635
|
|
|
471
|
-
export { AlertBox, type AlertBoxProps, type AlertBoxVariant, Badge, type BadgeProps, Button, ButtonGroup, type ButtonGroupOption, type ButtonGroupProps, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Combobox, type ComboboxMultiProps, type ComboboxOption, type ComboboxProps, type ComboboxSingleProps, ConfirmDialog, type ConfirmDialogProps, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FormField, type FormFieldProps, FormModal, type FormModalProps, Input, type InputProps, Label, LoadingOverlay, type LoadingOverlayProps, LoadingSpinner, type LoadingSpinnerProps, Modal, type ModalProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ScrollArea, ScrollBar, SearchBar, type SearchBarProps, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, type SelectTriggerProps, SelectValue, Separator, Sheet, SheetClose, SheetContent, type SheetContentProps, SheetDescription, SheetFooter, SheetHeader, SheetPortal, SheetTitle, SheetTrigger, Skeleton, StatusBadge, type StatusBadgeProps, type StatusTone, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, loadingSpinnerIconVariants, sheetVariants };
|
|
636
|
+
export { AlertBox, type AlertBoxProps, type AlertBoxVariant, Badge, type BadgeProps, Button, ButtonGroup, type ButtonGroupOption, type ButtonGroupProps, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Combobox, type ComboboxMultiProps, type ComboboxOption, type ComboboxProps, type ComboboxSingleProps, ConfirmDialog, type ConfirmDialogProps, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FormField, type FormFieldProps, FormModal, type FormModalProps, Input, type InputProps, Label, LoadingOverlay, type LoadingOverlayProps, LoadingSpinner, type LoadingSpinnerProps, Modal, type ModalProps, NavGroup, type NavGroupProps, type NavIconProps, NavItem, type NavItemProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ScrollArea, ScrollBar, SearchBar, type SearchBarProps, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, type SelectTriggerProps, SelectValue, Separator, Sheet, SheetClose, SheetContent, type SheetContentProps, SheetDescription, SheetFooter, SheetHeader, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarNav, type SidebarNavProps, type SidebarProps, Skeleton, StatusBadge, type StatusBadgeProps, type StatusTone, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagCombobox, type TagComboboxOption, type TagComboboxProps, Textarea, type TextareaProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, loadingSpinnerIconVariants, sheetVariants, useSidebarCollapsed };
|