@bmsuisse/ui 0.13.0 → 0.15.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 CHANGED
@@ -209,6 +209,41 @@ interface ConfirmDialogProps {
209
209
  */
210
210
  declare const ConfirmDialog: ({ open, onOpenChange, title, description, confirmLabel, cancelLabel, onConfirm, variant, confirmTestId, cancelTestId, }: ConfirmDialogProps) => ReactElement;
211
211
 
212
+ interface DialogActionsProps {
213
+ /**
214
+ * The dialog's non-cancel actions, ordered from *nearest to Cancel* to
215
+ * *most primary* — e.g. `[secondaryAction, primaryAction]`. For a plain
216
+ * two-button confirm dialog, pass a single primary action here.
217
+ */
218
+ actions: ReactNode[];
219
+ /** The dismissive/cancel action. */
220
+ cancel: ReactNode;
221
+ }
222
+ /**
223
+ * Renders `actions` and `cancel` in the order the current platform's own
224
+ * dialogs use — Windows puts Cancel on the right (trailing), every other
225
+ * platform we target (iOS/iPadOS, macOS, Android, Linux) puts it on the
226
+ * left (leading) — instead of a fixed order every caller has to get right
227
+ * itself. `ConfirmDialog` and `QuestionDialog` use this internally; use it
228
+ * directly for any other dialog/panel footer with the same
229
+ * actions-plus-cancel shape.
230
+ *
231
+ * Matches native multi-button "Save changes?"-style dialogs: the most
232
+ * primary action sits at the edge *opposite* Cancel (Windows:
233
+ * `Save · Don't Save · Cancel`; iOS/macOS: `Cancel · Don't Save · Save`),
234
+ * not next to it. `actions` is reversed when Cancel sits on the right
235
+ * (Windows), so the last element of `actions` — the primary action — is
236
+ * always the one furthest from Cancel, and the first element is always the
237
+ * one nearest Cancel, regardless of platform — a caller picks the order
238
+ * once, by meaning, and doesn't have to reason about which edge Cancel
239
+ * lands on.
240
+ *
241
+ * Renders no wrapping element of its own — nest it inside the caller's own
242
+ * footer container (e.g. `DialogFooter`, or `Modal`'s `footer` prop) for
243
+ * layout/spacing.
244
+ */
245
+ declare function DialogActions({ actions, cancel }: DialogActionsProps): ReactElement;
246
+
212
247
  interface FormModalProps {
213
248
  /** Whether the modal is open. Fully controlled — no internal open state. */
214
249
  open: boolean;
@@ -313,6 +348,53 @@ interface ResponsivePanelProps {
313
348
  */
314
349
  declare const ResponsivePanel: ({ open, onOpenChange, title, description, children, footer, className, breakpoint, size, resizable, draggable, closeOnOutsideClick, }: ResponsivePanelProps) => ReactElement;
315
350
 
351
+ interface QuestionDialogAction {
352
+ /** Button label. */
353
+ label: string;
354
+ /** Called when this action is clicked. May return a promise; the dialog waits for it before closing. */
355
+ onClick: () => void | Promise<void>;
356
+ /** Visual style of this action's button. Defaults to `"default"`. */
357
+ variant?: ButtonProps["variant"];
358
+ /** Forwarded to this action's `Button`, for test targeting. */
359
+ testId?: string;
360
+ }
361
+ interface QuestionDialogProps {
362
+ /** Whether the dialog is open. Fully controlled — no internal open state. */
363
+ open: boolean;
364
+ /** Called when Radix wants to change the open state (backdrop click, Esc, close button, Cancel). */
365
+ onOpenChange: (open: boolean) => void;
366
+ /** Dialog title. */
367
+ title: string;
368
+ /** Optional supporting copy shown under the title. */
369
+ description?: string;
370
+ /**
371
+ * The dialog's non-cancel actions, ordered from *nearest Cancel* to *most
372
+ * primary* (see `DialogActions`) — e.g.
373
+ * `[{ label: "Don't Save", ... }, { label: "Save", ... }]` puts "Save",
374
+ * the primary action, at the edge opposite Cancel on every platform,
375
+ * matching native "Save changes?"-style dialogs.
376
+ */
377
+ actions: QuestionDialogAction[];
378
+ /** Label for the cancel button. Defaults to `"Cancel"`. */
379
+ cancelLabel?: string;
380
+ /** Forwarded to the cancel button, for test targeting. */
381
+ cancelTestId?: string;
382
+ }
383
+ /**
384
+ * A dialog asking a question with any number of actions plus a Cancel —
385
+ * `ConfirmDialog` generalized past the fixed confirm/cancel pair, for
386
+ * prompts like "Save changes before closing?" (Don't Save / Cancel / Save).
387
+ * Like `ConfirmDialog`, it closes itself automatically after a successful
388
+ * action click — if the clicked action's `onClick` throws/rejects, the
389
+ * dialog stays open (and the error isn't swallowed) so a caller can surface
390
+ * its own error UI. Cancel always closes immediately.
391
+ *
392
+ * Button order follows the current platform's own convention via
393
+ * `DialogActions` — pick `actions`' order by *meaning* (least to most
394
+ * primary), not by which edge Cancel happens to land on.
395
+ */
396
+ declare const QuestionDialog: ({ open, onOpenChange, title, description, actions, cancelLabel, cancelTestId, }: QuestionDialogProps) => ReactElement;
397
+
316
398
  interface FormFieldProps {
317
399
  /** Visible label text for the field. */
318
400
  label: string;
@@ -891,4 +973,22 @@ declare function cn(...inputs: ClassValue[]): string;
891
973
  */
892
974
  declare function useMediaQuery(query: string): boolean;
893
975
 
894
- 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, 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, badgeVariants, buttonVariants, cn, loadingSpinnerIconVariants, sheetVariants, useMediaQuery, useSidebarCollapsed };
976
+ /**
977
+ * Whether the current runtime is Windows, based on the UA string. Returns
978
+ * `false` outside a browser (SSR, tests) so platform-dependent UI falls back
979
+ * to the non-Windows default rather than guessing.
980
+ */
981
+ declare function isWindowsPlatform(): boolean;
982
+ type ConfirmButtonPlacement = "leading" | "trailing";
983
+ /**
984
+ * Where a dialog's affirmative/confirm button should sit, matching each
985
+ * platform's own system convention: Windows dialogs place OK/Save on the
986
+ * left (Cancel on the right); every other platform we target — iOS/iPadOS,
987
+ * macOS, Android, Linux — places the affirmative action on the right (the
988
+ * iOS/macOS Human Interface Guidelines require this, and it's the de facto
989
+ * default everywhere else too). Windows is the one exception, so this is
990
+ * driven entirely by `isWindowsPlatform`.
991
+ */
992
+ declare function getConfirmButtonPlacement(): ConfirmButtonPlacement;
993
+
994
+ 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, type ConfirmButtonPlacement, ConfirmDialog, type ConfirmDialogProps, Dialog, DialogActions, type DialogActionsProps, 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, SheetClose, SheetContent, type SheetContentProps, SheetDescription, SheetFooter, SheetHeader, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarNav, type SidebarNavProps, type SidebarProps, Skeleton, Sparkline, 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, badgeVariants, buttonVariants, cn, getConfirmButtonPlacement, isWindowsPlatform, loadingSpinnerIconVariants, sheetVariants, useMediaQuery, useSidebarCollapsed };