@bmsuisse/ui 0.12.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 +147 -1
- package/dist/index.js +398 -197
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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;
|
|
@@ -836,6 +918,52 @@ declare function SidebarNav({ children, className, ...rest }: SidebarNavProps):
|
|
|
836
918
|
*/
|
|
837
919
|
declare function useSidebarCollapsed(): boolean;
|
|
838
920
|
|
|
921
|
+
/** The minimal shape this component needs to render one chip in the stepper. */
|
|
922
|
+
interface StepperStep {
|
|
923
|
+
/** 1-based step number, also used as the React key and navigation target. */
|
|
924
|
+
n: number;
|
|
925
|
+
/** Visible label under the chip. */
|
|
926
|
+
label: string;
|
|
927
|
+
/** Small uppercase caption under the label (e.g. a phase/section name). */
|
|
928
|
+
phase: string;
|
|
929
|
+
}
|
|
930
|
+
interface StepperProps {
|
|
931
|
+
/** The current step number (1-based, matches a `StepperStep.n`). */
|
|
932
|
+
step: number;
|
|
933
|
+
/** Highest step number reachable so far -- steps beyond this aren't clickable. */
|
|
934
|
+
maxStep: number;
|
|
935
|
+
/** Called with a step's `n` when a navigable chip is clicked. */
|
|
936
|
+
onNavigate: (n: number) => void;
|
|
937
|
+
/** Called when the trailing "new" button is clicked. Omit to hide that button entirely. */
|
|
938
|
+
onNew?: () => void;
|
|
939
|
+
/** The steps to render, in order. */
|
|
940
|
+
steps: StepperStep[];
|
|
941
|
+
/** Accessible label for the stepper's `<nav>`. @default "Steps" */
|
|
942
|
+
navLabel?: string;
|
|
943
|
+
/** Visible text and title of the trailing `onNew` button. Only relevant when `onNew` is passed. @default "New" */
|
|
944
|
+
newLabel?: string;
|
|
945
|
+
/** `data-testid` for the horizontally-scrolling steps region. @default "stepper-scroll" */
|
|
946
|
+
scrollTestId?: string;
|
|
947
|
+
/** `data-testid` for the trailing `onNew` button, when rendered. */
|
|
948
|
+
newTestId?: string;
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* Numbered-chip wizard progress indicator: a horizontally-scrolling row of
|
|
952
|
+
* step chips (done/active/upcoming, connected by a line that fills in as
|
|
953
|
+
* steps complete) plus an optional trailing "start over" button. Replaces
|
|
954
|
+
* the same shape hand-rolled independently by more than one multi-step
|
|
955
|
+
* wizard.
|
|
956
|
+
*
|
|
957
|
+
* Note: the original OneSales `Stepper` this was ported from also supported
|
|
958
|
+
* a one-off `tinderSubStep` prop that injected a bespoke "matcher" chip
|
|
959
|
+
* between two specific steps for a single screen's own sub-flow. That was
|
|
960
|
+
* deliberately left out of this generic version -- it doesn't generalize
|
|
961
|
+
* meaningfully beyond that one screen. Don't re-add it here; a consumer
|
|
962
|
+
* that needs a one-off extra chip should compose its own around this
|
|
963
|
+
* component instead.
|
|
964
|
+
*/
|
|
965
|
+
declare function Stepper({ step, maxStep, onNavigate, onNew, steps, navLabel, newLabel, scrollTestId, newTestId, }: StepperProps): react.JSX.Element;
|
|
966
|
+
|
|
839
967
|
/** Merges conditional class names, then dedupes conflicting Tailwind utility classes. */
|
|
840
968
|
declare function cn(...inputs: ClassValue[]): string;
|
|
841
969
|
|
|
@@ -845,4 +973,22 @@ declare function cn(...inputs: ClassValue[]): string;
|
|
|
845
973
|
*/
|
|
846
974
|
declare function useMediaQuery(query: string): boolean;
|
|
847
975
|
|
|
848
|
-
|
|
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 };
|