@bmsuisse/ui 0.11.0 → 0.12.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 +139 -5
- package/dist/index.js +588 -106
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -252,7 +252,7 @@ declare const desktopSizeClasses: {
|
|
|
252
252
|
readonly sm: "max-w-md";
|
|
253
253
|
readonly md: "max-w-xl";
|
|
254
254
|
readonly lg: "max-w-2xl";
|
|
255
|
-
readonly xl: "max-w-
|
|
255
|
+
readonly xl: "max-w-7xl";
|
|
256
256
|
};
|
|
257
257
|
type ResponsivePanelSize = keyof typeof desktopSizeClasses;
|
|
258
258
|
interface ResponsivePanelProps {
|
|
@@ -341,6 +341,15 @@ interface FormFieldProps {
|
|
|
341
341
|
*/
|
|
342
342
|
declare function FormField({ label, htmlFor, error, description, required, children, className, }: FormFieldProps): ReactElement;
|
|
343
343
|
|
|
344
|
+
/** A column shown in a grid-style option popup (see `renderGridOptions`). `key`
|
|
345
|
+
* selects what each row shows in that column: the literal string `"label"` reads
|
|
346
|
+
* the option's own `label`, anything else reads `option.data?.[key]`. */
|
|
347
|
+
interface GridColumn {
|
|
348
|
+
key: string;
|
|
349
|
+
header: string;
|
|
350
|
+
className?: string;
|
|
351
|
+
}
|
|
352
|
+
|
|
344
353
|
interface ComboboxOption {
|
|
345
354
|
value: string;
|
|
346
355
|
label: string;
|
|
@@ -350,8 +359,13 @@ interface ComboboxOption {
|
|
|
350
359
|
* on the base props). Options sharing a `group` must be contiguous in `options` —
|
|
351
360
|
* the component renders a header the first time a group key is seen and does not
|
|
352
361
|
* re-sort the list, so interleaved groups would render more than one header for the
|
|
353
|
-
* same key. Ungrouped options (no `group`) render individually, with no header.
|
|
362
|
+
* same key. Ungrouped options (no `group`) render individually, with no header.
|
|
363
|
+
* Ignored when `columns` is set (see that prop's own doc). */
|
|
354
364
|
group?: string;
|
|
365
|
+
/** Extra fields for this option, surfaced as additional columns when the
|
|
366
|
+
* base props' `columns` is set — e.g. `{ email: "a@b.com", role: "Admin" }`.
|
|
367
|
+
* Ignored otherwise. */
|
|
368
|
+
data?: Record<string, ReactNode>;
|
|
355
369
|
}
|
|
356
370
|
interface ComboboxBaseProps {
|
|
357
371
|
/** The full option list. Filtering happens client-side against `label`. */
|
|
@@ -393,6 +407,15 @@ interface ComboboxBaseProps {
|
|
|
393
407
|
* selected option was found by an earlier query and isn't part of the current
|
|
394
408
|
* result page. Ignored once a matching option is found in `options`. */
|
|
395
409
|
selectedLabel?: string;
|
|
410
|
+
/** Renders the popup's option list as a multi-column grid instead of a flat
|
|
411
|
+
* label list — one column per entry here, each reading either the option's
|
|
412
|
+
* own `label` (`key: "label"`) or `option.data[key]`. Useful when users need
|
|
413
|
+
* more context than a label to tell options apart (e.g. an id/email/role
|
|
414
|
+
* table instead of a bare name). Mutually exclusive with `group` — a grid
|
|
415
|
+
* row has no natural place for a group header spanning several unrelated
|
|
416
|
+
* columns, so `group` is ignored on every option while this is set. The
|
|
417
|
+
* popup grows to fit the columns (at least as wide as the trigger). */
|
|
418
|
+
columns?: GridColumn[];
|
|
396
419
|
}
|
|
397
420
|
interface ComboboxSingleProps extends ComboboxBaseProps {
|
|
398
421
|
/** Omitted or `false` for the (default) single-select shape below. */
|
|
@@ -436,8 +459,13 @@ interface TagComboboxOption {
|
|
|
436
459
|
* plus a tri-state "select all" checkbox (unchecked/checked/indeterminate, reflecting
|
|
437
460
|
* how many of the group's members are selected — toggling it selects or clears the
|
|
438
461
|
* whole group). Options sharing a `group` must be contiguous in `options` — see
|
|
439
|
-
* `Combobox`'s own `group` doc for the same constraint and the reasoning behind it.
|
|
462
|
+
* `Combobox`'s own `group` doc for the same constraint and the reasoning behind it.
|
|
463
|
+
* Ignored when `columns` is set (see that prop's own doc). */
|
|
440
464
|
group?: string;
|
|
465
|
+
/** Extra fields for this option, surfaced as additional columns when
|
|
466
|
+
* `columns` is set — e.g. `{ email: "a@b.com", role: "Admin" }`. Ignored
|
|
467
|
+
* otherwise. */
|
|
468
|
+
data?: Record<string, ReactNode>;
|
|
441
469
|
}
|
|
442
470
|
interface TagComboboxProps {
|
|
443
471
|
/** The full option list. Filtering happens client-side against `label`,
|
|
@@ -475,6 +503,10 @@ interface TagComboboxProps {
|
|
|
475
503
|
/** Display label for a group key (`TagComboboxOption.group`). Falls back to the raw
|
|
476
504
|
* key when an entry is missing. Only relevant when at least one option sets `group`. */
|
|
477
505
|
groupLabels?: Record<string, string>;
|
|
506
|
+
/** Renders the popup's option list as a multi-column grid instead of a flat
|
|
507
|
+
* label list — see `Combobox`'s own `columns` doc for the full contract
|
|
508
|
+
* (including its interaction with `group`, and the widened popup). */
|
|
509
|
+
columns?: GridColumn[];
|
|
478
510
|
}
|
|
479
511
|
/**
|
|
480
512
|
* A tags-and-search multi-select: selected options render as removable chips
|
|
@@ -487,7 +519,7 @@ interface TagComboboxProps {
|
|
|
487
519
|
* built on the same `Popover`/keyboard-nav shape rather than forking it,
|
|
488
520
|
* so both patterns share one mental model.
|
|
489
521
|
*/
|
|
490
|
-
declare function TagCombobox({ options, value, onChange, placeholder, emptyMessage, disabled, loading, loadingMessage, className, id, onSearchChange, container, groupLabels, ...rest }: TagComboboxProps): ReactElement;
|
|
522
|
+
declare function TagCombobox({ options, value, onChange, placeholder, emptyMessage, disabled, loading, loadingMessage, className, id, onSearchChange, container, groupLabels, columns, ...rest }: TagComboboxProps): ReactElement;
|
|
491
523
|
|
|
492
524
|
type AlertBoxVariant = "error" | "warning" | "info" | "success";
|
|
493
525
|
interface AlertBoxProps {
|
|
@@ -598,6 +630,108 @@ interface SearchBarProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "ty
|
|
|
598
630
|
*/
|
|
599
631
|
declare function SearchBar({ value, onChange, isLoading, onClear, clearLabel, inputRef, className, ...props }: SearchBarProps): ReactElement;
|
|
600
632
|
|
|
633
|
+
interface KpiCardProps {
|
|
634
|
+
label: string;
|
|
635
|
+
value?: string | number | null;
|
|
636
|
+
icon?: ComponentType<{
|
|
637
|
+
className?: string;
|
|
638
|
+
}>;
|
|
639
|
+
badge?: {
|
|
640
|
+
text: string;
|
|
641
|
+
positive?: boolean;
|
|
642
|
+
};
|
|
643
|
+
badgeLabel?: string;
|
|
644
|
+
/** @default "default" */
|
|
645
|
+
variant?: "hero" | "mini" | "default" | "donut";
|
|
646
|
+
loading?: boolean;
|
|
647
|
+
sub?: string;
|
|
648
|
+
/** Colors `sub` on the mini variant — "warn"/"danger" flag something worth acting on (overdue, at-risk), "default" stays muted. */
|
|
649
|
+
subTone?: "default" | "warn" | "danger";
|
|
650
|
+
/** Makes the icon (mini variant) or the whole card clickable. */
|
|
651
|
+
href?: string;
|
|
652
|
+
sparkline?: number[];
|
|
653
|
+
/** @default "var(--color-primary, #3b82f6)" */
|
|
654
|
+
sparklineColor?: string;
|
|
655
|
+
/** Hero variant only: 0-100 achievement-vs-target bar rendered under `sub`. */
|
|
656
|
+
progress?: number;
|
|
657
|
+
progressLabel?: string;
|
|
658
|
+
/** Donut variant only: the proportions to render as a ring chart, with a legend listing each segment's share. */
|
|
659
|
+
segments?: DonutSegment[];
|
|
660
|
+
/** Donut variant only: big label centered in the ring. Defaults to the sum of `segments`' values. */
|
|
661
|
+
centerValue?: string;
|
|
662
|
+
/** For E2E tests to target a specific tile unambiguously when `label` also appears elsewhere on the page (e.g. a chart legend). */
|
|
663
|
+
testId?: string;
|
|
664
|
+
}
|
|
665
|
+
interface DonutSegment {
|
|
666
|
+
label: string;
|
|
667
|
+
value: number;
|
|
668
|
+
/** @default a color from the built-in palette, cycling by index */
|
|
669
|
+
color?: string;
|
|
670
|
+
}
|
|
671
|
+
declare function DonutChart({ data, size, thickness, centerValue, centerLabel, }: {
|
|
672
|
+
data: DonutSegment[];
|
|
673
|
+
size?: number;
|
|
674
|
+
thickness?: number;
|
|
675
|
+
centerValue?: string;
|
|
676
|
+
centerLabel?: string;
|
|
677
|
+
}): ReactElement | null;
|
|
678
|
+
declare function Sparkline({ data, color }: {
|
|
679
|
+
data: number[];
|
|
680
|
+
color: string;
|
|
681
|
+
}): ReactElement | null;
|
|
682
|
+
/**
|
|
683
|
+
* Dashboard KPI tile in three variants — `hero` (large, primary-colored,
|
|
684
|
+
* for the single headline metric), `default` (bordered card for a KPI
|
|
685
|
+
* grid), and `mini` (compact, for dense grids of secondary metrics).
|
|
686
|
+
* Optionally shows a badge, a trend sparkline, and (hero only) a
|
|
687
|
+
* progress-vs-target bar.
|
|
688
|
+
*/
|
|
689
|
+
declare const KpiCard: react.NamedExoticComponent<KpiCardProps>;
|
|
690
|
+
|
|
691
|
+
interface SearchPanelMode {
|
|
692
|
+
key: string;
|
|
693
|
+
label: string;
|
|
694
|
+
icon?: ComponentType<{
|
|
695
|
+
className?: string;
|
|
696
|
+
}>;
|
|
697
|
+
}
|
|
698
|
+
interface SearchPanelProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "onChange" | "size"> {
|
|
699
|
+
value: string;
|
|
700
|
+
onChange: (value: string) => void;
|
|
701
|
+
/** Swaps the leading search icon for a spinner while a search request is in flight. */
|
|
702
|
+
isLoading?: boolean;
|
|
703
|
+
/** Extra content after the input, e.g. a mic button. */
|
|
704
|
+
trailingSlot?: ReactNode;
|
|
705
|
+
/** Keyboard-shortcut hint rendered after `trailingSlot`, e.g. `"⌘K"`. Omit to hide it. */
|
|
706
|
+
shortcutHint?: string;
|
|
707
|
+
/** Mode-switcher pills rendered below the input row (e.g. "Search" / "Ask AI"). Omit to hide the row entirely. */
|
|
708
|
+
modes?: SearchPanelMode[];
|
|
709
|
+
activeMode?: string;
|
|
710
|
+
onModeChange?: (key: string) => void;
|
|
711
|
+
/** Squares the panel's bottom corners so a results dropdown anchored directly below it reads as one continuous surface. */
|
|
712
|
+
expanded?: boolean;
|
|
713
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
714
|
+
className?: string;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Bordered search card: an input row (leading icon/spinner, input, optional
|
|
718
|
+
* trailing slot and keyboard-shortcut hint) plus an optional row of
|
|
719
|
+
* mode-switcher pills below it. Headless on results — the caller renders
|
|
720
|
+
* whatever dropdown or inline results belong under it.
|
|
721
|
+
*/
|
|
722
|
+
declare function SearchPanel({ value, onChange, isLoading, trailingSlot, shortcutHint, modes, activeMode, onModeChange, expanded, inputRef, className, ...props }: SearchPanelProps): ReactElement;
|
|
723
|
+
|
|
724
|
+
interface SearchTriggerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
725
|
+
/** Accessible label, also used as the tooltip text by callers that wrap this in one. @default "Search" */
|
|
726
|
+
label?: string;
|
|
727
|
+
}
|
|
728
|
+
/**
|
|
729
|
+
* Icon-only header button that opens a search overlay (a `SearchPanel`, a
|
|
730
|
+
* dropdown, a `Sheet` — this owns no state or panel of its own). For a
|
|
731
|
+
* full-width always-visible input instead, use `SearchBar`.
|
|
732
|
+
*/
|
|
733
|
+
declare function SearchTrigger({ label, ...props }: SearchTriggerProps): ReactElement;
|
|
734
|
+
|
|
601
735
|
/** Shape a `lucide-react` icon component satisfies — `NavItem` sizes and colors it itself. */
|
|
602
736
|
interface NavIconProps {
|
|
603
737
|
className?: string;
|
|
@@ -711,4 +845,4 @@ declare function cn(...inputs: ClassValue[]): string;
|
|
|
711
845
|
*/
|
|
712
846
|
declare function useMediaQuery(query: string): boolean;
|
|
713
847
|
|
|
714
|
-
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, ResponsivePanel, type ResponsivePanelProps, type ResponsivePanelSize, 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, useMediaQuery, useSidebarCollapsed };
|
|
848
|
+
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 GridColumn as ComboboxColumn, type ComboboxMultiProps, type ComboboxOption, type ComboboxProps, type ComboboxSingleProps, ConfirmDialog, type ConfirmDialogProps, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DonutChart, type DonutSegment, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FormField, type FormFieldProps, FormModal, type FormModalProps, Input, type InputProps, KpiCard, type KpiCardProps, Label, LoadingOverlay, type LoadingOverlayProps, LoadingSpinner, type LoadingSpinnerProps, Modal, type ModalProps, NavGroup, type NavGroupProps, type NavIconProps, NavItem, type NavItemProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ResponsivePanel, type ResponsivePanelProps, type ResponsivePanelSize, ScrollArea, ScrollBar, SearchBar, type SearchBarProps, SearchPanel, type SearchPanelMode, type SearchPanelProps, SearchTrigger, type SearchTriggerProps, 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, Sparkline, 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, useMediaQuery, useSidebarCollapsed };
|