@bmsuisse/ui 0.16.2 → 0.17.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 +114 -7
- package/dist/index.js +567 -311
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -434,6 +434,20 @@ interface GridColumn {
|
|
|
434
434
|
className?: string;
|
|
435
435
|
}
|
|
436
436
|
|
|
437
|
+
/** Structured error shown by `ErrorState`/`InlineError`. */
|
|
438
|
+
interface ErrorInfo {
|
|
439
|
+
/** Short headline, e.g. "Couldn't load data". */
|
|
440
|
+
title?: string;
|
|
441
|
+
/** Human-readable explanation. */
|
|
442
|
+
message?: string;
|
|
443
|
+
/** Technical details (stack, response body) — shown behind a "Show details" toggle. */
|
|
444
|
+
details?: string;
|
|
445
|
+
}
|
|
446
|
+
/** What components accept for their `error` prop — pass a TanStack Query / SWR / `catch` error straight through. */
|
|
447
|
+
type ErrorInput = ErrorInfo | Error | string | null | undefined | false;
|
|
448
|
+
/** Normalizes any `ErrorInput` (or a raw thrown value) to an `ErrorInfo`; `undefined` when there is no error. */
|
|
449
|
+
declare function toErrorInfo(error: unknown): ErrorInfo | undefined;
|
|
450
|
+
|
|
437
451
|
interface ComboboxOption {
|
|
438
452
|
value: string;
|
|
439
453
|
label: string;
|
|
@@ -467,6 +481,10 @@ interface ComboboxBaseProps {
|
|
|
467
481
|
loading?: boolean;
|
|
468
482
|
/** Trigger text shown while `loading` is true. Defaults to `"Loading…"`. */
|
|
469
483
|
loadingMessage?: string;
|
|
484
|
+
/** The options fetch failed. The trigger stays openable and the list shows an `InlineError` (with Retry when `onRetry` is set) instead of the options. */
|
|
485
|
+
error?: ErrorInput;
|
|
486
|
+
/** Re-runs the failed options fetch. */
|
|
487
|
+
onRetry?: () => void;
|
|
470
488
|
/** Shows a clear ("x") affordance on the trigger when a value is selected. Defaults to `true`. */
|
|
471
489
|
clearable?: boolean;
|
|
472
490
|
className?: string;
|
|
@@ -570,6 +588,10 @@ interface TagComboboxProps {
|
|
|
570
588
|
loading?: boolean;
|
|
571
589
|
/** Message shown in the option list while `loading` is true. Defaults to `"Loading…"`. */
|
|
572
590
|
loadingMessage?: string;
|
|
591
|
+
/** The options fetch failed. The list shows an `InlineError` (with Retry when `onRetry` is set) instead of the options. */
|
|
592
|
+
error?: ErrorInput;
|
|
593
|
+
/** Re-runs the failed options fetch. */
|
|
594
|
+
onRetry?: () => void;
|
|
573
595
|
className?: string;
|
|
574
596
|
id?: string;
|
|
575
597
|
/** Forwarded to the field, for test targeting (e.g. Playwright/Testing Library). */
|
|
@@ -603,7 +625,7 @@ interface TagComboboxProps {
|
|
|
603
625
|
* built on the same `Popover`/keyboard-nav shape rather than forking it,
|
|
604
626
|
* so both patterns share one mental model.
|
|
605
627
|
*/
|
|
606
|
-
declare function TagCombobox({ options, value, onChange, placeholder, emptyMessage, disabled, loading, loadingMessage, className, id, onSearchChange, container, groupLabels, columns, ...rest }: TagComboboxProps): ReactElement;
|
|
628
|
+
declare function TagCombobox({ options, value, onChange, placeholder, emptyMessage, disabled, loading, loadingMessage, error, onRetry, className, id, onSearchChange, container, groupLabels, columns, ...rest }: TagComboboxProps): ReactElement;
|
|
607
629
|
|
|
608
630
|
type AlertBoxVariant = "error" | "warning" | "info" | "success";
|
|
609
631
|
interface AlertBoxProps {
|
|
@@ -616,7 +638,7 @@ interface AlertBoxProps {
|
|
|
616
638
|
className?: string;
|
|
617
639
|
/**
|
|
618
640
|
* Overrides the default variant icon entirely. Pass `null` to hide the
|
|
619
|
-
* icon. Defaults to a variant-specific
|
|
641
|
+
* icon. Defaults to a variant-specific heroicons icon.
|
|
620
642
|
*/
|
|
621
643
|
icon?: ReactNode;
|
|
622
644
|
}
|
|
@@ -692,11 +714,86 @@ interface LoadingOverlayProps extends HTMLAttributes<HTMLDivElement>, Pick<Loadi
|
|
|
692
714
|
/** Centers a larger `LoadingSpinner` inside a full container/page — use as a route or panel loading state. */
|
|
693
715
|
declare const LoadingOverlay: ({ size, label, className, ...props }: LoadingOverlayProps) => ReactElement;
|
|
694
716
|
|
|
717
|
+
/** Returns `true` only once `active` has been true for `delayMs` — avoids a spinner flash on fast responses. */
|
|
718
|
+
declare function useDelayedFlag(active: boolean, delayMs?: number): boolean;
|
|
719
|
+
interface LoadingStateProps extends HTMLAttributes<HTMLDivElement> {
|
|
720
|
+
/** `skeleton` (default) shows placeholder lines; `spinner` shows a centered spinner. */
|
|
721
|
+
variant?: "skeleton" | "spinner";
|
|
722
|
+
/** Skeleton line count. Defaults to 3. */
|
|
723
|
+
lines?: number;
|
|
724
|
+
label?: string;
|
|
725
|
+
/** Wait this long before showing anything. Defaults to 150ms; pass 0 to show immediately. */
|
|
726
|
+
delayMs?: number;
|
|
727
|
+
}
|
|
728
|
+
/** Initial-load placeholder for a content area. Announces itself as `role="status"`. */
|
|
729
|
+
declare const LoadingState: ({ variant, lines, label, delayMs, className, ...props }: LoadingStateProps) => ReactElement;
|
|
730
|
+
/** Thin indeterminate bar for a refetch over already-visible data. Place inside a `relative` container. */
|
|
731
|
+
declare const RefreshBar: ({ active, className }: {
|
|
732
|
+
active: boolean;
|
|
733
|
+
className?: string;
|
|
734
|
+
}) => ReactElement | null;
|
|
735
|
+
|
|
736
|
+
interface ErrorStateLabels {
|
|
737
|
+
title: string;
|
|
738
|
+
retry: string;
|
|
739
|
+
showDetails: string;
|
|
740
|
+
}
|
|
741
|
+
declare const defaultErrorStateLabels: ErrorStateLabels;
|
|
742
|
+
interface ErrorStateProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
743
|
+
error: ErrorInput;
|
|
744
|
+
/** Shows a Retry button when set. */
|
|
745
|
+
onRetry?: () => void;
|
|
746
|
+
/** `block` (default) is a centered panel for a whole content area; `compact` is a left-aligned tinted box for cards/popovers. */
|
|
747
|
+
variant?: "block" | "compact";
|
|
748
|
+
labels?: Partial<ErrorStateLabels>;
|
|
749
|
+
}
|
|
750
|
+
/** Content-area error: icon, title, message, optional collapsible details and a Retry button. Renders nothing when `error` is empty. */
|
|
751
|
+
declare const ErrorState: ({ error, onRetry, variant, labels, className, ...props }: ErrorStateProps) => ReactElement | null;
|
|
752
|
+
interface InlineErrorProps extends Omit<HTMLAttributes<HTMLSpanElement>, "title"> {
|
|
753
|
+
error: ErrorInput;
|
|
754
|
+
onRetry?: () => void;
|
|
755
|
+
labels?: Partial<Pick<ErrorStateLabels, "title" | "retry">>;
|
|
756
|
+
}
|
|
757
|
+
/** One-line error for tight spaces (dropdowns, filters, tree nodes, stale-data banners): "⚠ message · Retry". */
|
|
758
|
+
declare const InlineError: ({ error, onRetry, labels, className, ...props }: InlineErrorProps) => ReactElement | null;
|
|
759
|
+
|
|
760
|
+
interface AsyncBoundaryProps {
|
|
761
|
+
/** A request is in flight. */
|
|
762
|
+
loading?: boolean;
|
|
763
|
+
error?: ErrorInput;
|
|
764
|
+
onRetry?: () => void;
|
|
765
|
+
/** The request finished with no data. Renders `emptyContent`. */
|
|
766
|
+
empty?: boolean;
|
|
767
|
+
emptyContent?: ReactNode;
|
|
768
|
+
/** Placeholder for the first load. Defaults to `<LoadingState />`. */
|
|
769
|
+
loadingContent?: ReactNode;
|
|
770
|
+
/**
|
|
771
|
+
* Whether `children` already has data to show (stale or previous), e.g. `hasData={query.data !== undefined}`.
|
|
772
|
+
* When true, a refetch keeps the content with a refresh bar and an error becomes a slim banner above it.
|
|
773
|
+
* Defaults to `false`: `loading` shows the skeleton and `error` the ErrorState, so children never
|
|
774
|
+
* render without data.
|
|
775
|
+
*/
|
|
776
|
+
hasData?: boolean;
|
|
777
|
+
children: ReactNode;
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Standard loading → error → empty → content switch for server-fetched data.
|
|
781
|
+
* First load: skeleton. Refetch: content + thin bar. Error without data: `ErrorState`.
|
|
782
|
+
* Error with stale data: content under an `InlineError` banner.
|
|
783
|
+
*/
|
|
784
|
+
declare const AsyncBoundary: ({ loading, error, onRetry, empty, emptyContent, loadingContent, hasData, children, }: AsyncBoundaryProps) => ReactElement;
|
|
785
|
+
|
|
695
786
|
interface SearchBarProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "onChange" | "size"> {
|
|
696
787
|
value: string;
|
|
697
788
|
onChange: (value: string) => void;
|
|
698
789
|
/** Swaps the leading search icon for a spinner while a search request is in flight. */
|
|
790
|
+
loading?: boolean;
|
|
791
|
+
/** @deprecated Use `loading`. */
|
|
699
792
|
isLoading?: boolean;
|
|
793
|
+
/** A failed search request. Marks the input invalid and shows an `InlineError` below it. */
|
|
794
|
+
error?: ErrorInput;
|
|
795
|
+
/** Shows a Retry action in the error line. */
|
|
796
|
+
onRetry?: () => void;
|
|
700
797
|
/** Called when the clear (×) button is pressed. Defaults to `onChange("")`. Pass `false` to hide the button entirely, even with a non-empty value. */
|
|
701
798
|
onClear?: (() => void) | false;
|
|
702
799
|
/** Accessible label for the clear button. @default "Clear search" */
|
|
@@ -712,7 +809,7 @@ interface SearchBarProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "ty
|
|
|
712
809
|
* unlike `Combobox`, this has no dropdown/result list of its own, just the
|
|
713
810
|
* input chrome; the caller owns whatever renders the results.
|
|
714
811
|
*/
|
|
715
|
-
declare function SearchBar({ value, onChange, isLoading, onClear, clearLabel, inputRef, className, ...props }: SearchBarProps): ReactElement;
|
|
812
|
+
declare function SearchBar({ value, onChange, loading, isLoading, error, onRetry, onClear, clearLabel, inputRef, className, ...props }: SearchBarProps): ReactElement;
|
|
716
813
|
|
|
717
814
|
interface KpiCardProps {
|
|
718
815
|
label: string;
|
|
@@ -728,6 +825,10 @@ interface KpiCardProps {
|
|
|
728
825
|
/** @default "default" */
|
|
729
826
|
variant?: "hero" | "mini" | "default" | "donut";
|
|
730
827
|
loading?: boolean;
|
|
828
|
+
/** The metric failed to load: replaces the value with "—" and a warning marker (message in its tooltip) in every variant. */
|
|
829
|
+
error?: ErrorInput;
|
|
830
|
+
/** Shows a Retry link under the error marker. */
|
|
831
|
+
onRetry?: () => void;
|
|
731
832
|
sub?: string;
|
|
732
833
|
/** Colors `sub` on the mini variant — "warn"/"danger" flag something worth acting on (overdue, at-risk), "default" stays muted. */
|
|
733
834
|
subTone?: "default" | "warn" | "danger";
|
|
@@ -785,7 +886,13 @@ interface SearchPanelProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "
|
|
|
785
886
|
value: string;
|
|
786
887
|
onChange: (value: string) => void;
|
|
787
888
|
/** Swaps the leading search icon for a spinner while a search request is in flight. */
|
|
889
|
+
loading?: boolean;
|
|
890
|
+
/** @deprecated Use `loading`. */
|
|
788
891
|
isLoading?: boolean;
|
|
892
|
+
/** A failed search request. Shows an `InlineError` row below the input. */
|
|
893
|
+
error?: ErrorInput;
|
|
894
|
+
/** Shows a Retry action in the error row. */
|
|
895
|
+
onRetry?: () => void;
|
|
789
896
|
/** Extra content after the input, e.g. a mic button. */
|
|
790
897
|
trailingSlot?: ReactNode;
|
|
791
898
|
/** Keyboard-shortcut hint rendered after `trailingSlot`, e.g. `"⌘K"`. Omit to hide it. */
|
|
@@ -805,7 +912,7 @@ interface SearchPanelProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "
|
|
|
805
912
|
* mode-switcher pills below it. Headless on results — the caller renders
|
|
806
913
|
* whatever dropdown or inline results belong under it.
|
|
807
914
|
*/
|
|
808
|
-
declare function SearchPanel({ value, onChange, isLoading, trailingSlot, shortcutHint, modes, activeMode, onModeChange, expanded, inputRef, className, ...props }: SearchPanelProps): ReactElement;
|
|
915
|
+
declare function SearchPanel({ value, onChange, loading, isLoading, error, onRetry, trailingSlot, shortcutHint, modes, activeMode, onModeChange, expanded, inputRef, className, ...props }: SearchPanelProps): ReactElement;
|
|
809
916
|
|
|
810
917
|
interface SearchTriggerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
811
918
|
/** Accessible label, also used as the tooltip text by callers that wrap this in one. @default "Search" */
|
|
@@ -818,7 +925,7 @@ interface SearchTriggerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement
|
|
|
818
925
|
*/
|
|
819
926
|
declare function SearchTrigger({ label, ...props }: SearchTriggerProps): ReactElement;
|
|
820
927
|
|
|
821
|
-
/** Shape a
|
|
928
|
+
/** Shape a `@heroicons/react` icon component satisfies — `NavItem` sizes and colors it itself. */
|
|
822
929
|
interface NavIconProps {
|
|
823
930
|
className?: string;
|
|
824
931
|
strokeWidth?: string | number;
|
|
@@ -929,7 +1036,7 @@ interface AiButtonProps extends Omit<ButtonProps, "variant"> {
|
|
|
929
1036
|
variant?: AiButtonVariant;
|
|
930
1037
|
/** Swaps the leading icon for a spinner and disables the button while an AI call is in flight. */
|
|
931
1038
|
loading?: boolean;
|
|
932
|
-
/** Leading icon. @default
|
|
1039
|
+
/** Leading icon. @default SparklesIcon */
|
|
933
1040
|
icon?: ElementType<NavIconProps>;
|
|
934
1041
|
}
|
|
935
1042
|
/**
|
|
@@ -1196,4 +1303,4 @@ type ConfirmButtonPlacement = "leading" | "trailing";
|
|
|
1196
1303
|
*/
|
|
1197
1304
|
declare function getConfirmButtonPlacement(): ConfirmButtonPlacement;
|
|
1198
1305
|
|
|
1199
|
-
export { AiButton, type AiButtonProps, type AiButtonVariant, AiExplainButton, type AiExplainButtonProps, 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, type ConfirmButtonPlacement, ConfirmDialog, type ConfirmDialogProps, Dialog, DialogActions, type DialogActionsProps, DialogBody, 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, QuestionDialog, type QuestionDialogAction, type QuestionDialogProps, 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, SheetBody, SheetClose, SheetContent, type SheetContentProps, SheetDescription, SheetFooter, SheetHeader, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarNav, type SidebarNavProps, type SidebarProps, Skeleton, Sparkline, type SpeechRecognitionEngine, type SpeechRecognitionEngineFactory, type SpeechRecognitionState, StatusBadge, type StatusBadgeProps, type StatusTone, Stepper, type StepperProps, type StepperStep, 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, type UseSpeechRecognitionOptions, VoiceInputButton, type VoiceInputButtonProps, VoiceTranscript, type VoiceTranscriptProps, badgeVariants, buttonVariants, cn, describeSpeechError, getConfirmButtonPlacement, isWindowsPlatform, loadingSpinnerIconVariants, sheetVariants, useMediaQuery, useSidebarCollapsed, useSpeechRecognition };
|
|
1306
|
+
export { AiButton, type AiButtonProps, type AiButtonVariant, AiExplainButton, type AiExplainButtonProps, AlertBox, type AlertBoxProps, type AlertBoxVariant, AsyncBoundary, type AsyncBoundaryProps, 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, type ConfirmButtonPlacement, ConfirmDialog, type ConfirmDialogProps, Dialog, DialogActions, type DialogActionsProps, DialogBody, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DonutChart, type DonutSegment, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type ErrorInfo, type ErrorInput, ErrorState, type ErrorStateLabels, type ErrorStateProps, FormField, type FormFieldProps, FormModal, type FormModalProps, InlineError, type InlineErrorProps, Input, type InputProps, KpiCard, type KpiCardProps, Label, LoadingOverlay, type LoadingOverlayProps, LoadingSpinner, type LoadingSpinnerProps, LoadingState, type LoadingStateProps, Modal, type ModalProps, NavGroup, type NavGroupProps, type NavIconProps, NavItem, type NavItemProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, QuestionDialog, type QuestionDialogAction, type QuestionDialogProps, RefreshBar, 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, SheetBody, SheetClose, SheetContent, type SheetContentProps, SheetDescription, SheetFooter, SheetHeader, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarNav, type SidebarNavProps, type SidebarProps, Skeleton, Sparkline, type SpeechRecognitionEngine, type SpeechRecognitionEngineFactory, type SpeechRecognitionState, StatusBadge, type StatusBadgeProps, type StatusTone, Stepper, type StepperProps, type StepperStep, 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, type UseSpeechRecognitionOptions, VoiceInputButton, type VoiceInputButtonProps, VoiceTranscript, type VoiceTranscriptProps, badgeVariants, buttonVariants, cn, defaultErrorStateLabels, describeSpeechError, getConfirmButtonPlacement, isWindowsPlatform, loadingSpinnerIconVariants, sheetVariants, toErrorInfo, useDelayedFlag, useMediaQuery, useSidebarCollapsed, useSpeechRecognition };
|