@assure-one/design-system 1.12.0 → 1.13.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 +22 -7
- package/dist/index.js +192 -85
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2313,22 +2313,37 @@ interface TextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaEl
|
|
|
2313
2313
|
}
|
|
2314
2314
|
declare const Textarea: React$1.ForwardRefExoticComponent<TextareaProps & React$1.RefAttributes<HTMLTextAreaElement>>;
|
|
2315
2315
|
|
|
2316
|
-
type ToastVariant = "default" | "success" | "destructive" | "warning";
|
|
2316
|
+
type ToastVariant = "default" | "success" | "destructive" | "warning" | "info" | "loading";
|
|
2317
2317
|
interface ToastAction {
|
|
2318
2318
|
label: string;
|
|
2319
2319
|
onClick: () => void;
|
|
2320
2320
|
}
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
title:
|
|
2324
|
-
description?:
|
|
2321
|
+
/** Options accepted by `toast()` and (partially) by `update()`. */
|
|
2322
|
+
interface ToastOptions {
|
|
2323
|
+
title: React.ReactNode;
|
|
2324
|
+
description?: React.ReactNode;
|
|
2325
2325
|
variant?: ToastVariant;
|
|
2326
|
+
/** Auto-dismiss after N ms. `0` = sticky. `loading` defaults to sticky. */
|
|
2326
2327
|
duration?: number;
|
|
2327
2328
|
action?: ToastAction;
|
|
2329
|
+
/**
|
|
2330
|
+
* When set, a new toast with the same key updates the existing one in place
|
|
2331
|
+
* instead of stacking a duplicate (e.g. repeated "Saving…" feedback).
|
|
2332
|
+
*/
|
|
2333
|
+
dedupeKey?: string;
|
|
2328
2334
|
}
|
|
2335
|
+
/** Per-state copy for `promise()` — a string title, full options, or a
|
|
2336
|
+
* builder that receives the resolved value / thrown error. */
|
|
2337
|
+
type PromiseToast<T> = string | ToastOptions | ((arg: T) => string | ToastOptions);
|
|
2329
2338
|
interface ToastContextValue {
|
|
2330
|
-
toast: (options:
|
|
2339
|
+
toast: (options: ToastOptions) => string;
|
|
2331
2340
|
dismiss: (id?: string) => void;
|
|
2341
|
+
update: (id: string, patch: Partial<ToastOptions>) => void;
|
|
2342
|
+
promise: <T>(promise: Promise<T>, copy: {
|
|
2343
|
+
loading: string | ToastOptions;
|
|
2344
|
+
success: PromiseToast<T>;
|
|
2345
|
+
error: PromiseToast<unknown>;
|
|
2346
|
+
}) => Promise<T>;
|
|
2332
2347
|
}
|
|
2333
2348
|
declare function useToast(): ToastContextValue;
|
|
2334
2349
|
interface ToastProviderProps {
|
|
@@ -5040,4 +5055,4 @@ declare namespace SignatureEditor {
|
|
|
5040
5055
|
|
|
5041
5056
|
declare function cn(...inputs: ClassValue[]): string;
|
|
5042
5057
|
|
|
5043
|
-
export { AIReceiptPanel, type AIReceiptPanelProps, type AIReceiptResult, Accordion, AccordionContent, AccordionItem, AccordionTrigger, type ActivityDotVariant, ActivityEventItem, type ActivityEventItemProps, ActivityItem, type ActivityItemProps, ActivityList, type ActivityListProps, type AgreementFirm, AgreementPaneHeading, type AgreementPaneHeadingProps, type AgreementStatus, type AgreementStep, AgreementViewer, type AgreementViewerProps, AiDraftCard, type AiDraftCardProps, type AiDraftState, Alert, AlertCircleIcon, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, AlertTriangleIcon, AlertTriangleSolidIcon, AppHeader, AppHeaderActions, type AppHeaderActionsProps, AppHeaderBreadcrumb, type AppHeaderBreadcrumbProps, type AppHeaderProps, AppHeaderSearch, type AppHeaderSearchProps, AppHeaderTitle, type AppHeaderTitleProps, AreaChart, type AreaChartProps, type AreaPoint, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowRightSmallIcon, ArrowUpIcon, AspectRatio, Assignee, AssureAuditBrandIcon, AssureBooksBrandIcon, AssureProBrandIcon, AssureTaxBrandIcon, AtSignIcon, AttachmentChip, type AttachmentChipProps, AttentionItem, type AttentionItemProps, type AttentionUrgency, Avatar, Badge, type BadgeProps, BarChartIcon, BellIcon, Blockquote, BoldIcon, BottomNav, type BottomNavProps, type BottomNavTab, type BrandIconProps, Breadcrumb, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbList, type BreadcrumbListProps, BreadcrumbPage, type BreadcrumbPageProps, type BreadcrumbProps, BreadcrumbSeparator, type BreadcrumbSeparatorProps, BriefcaseIcon, Building2Icon, BuildingIcon, BulkActionBar, BulkActionBarAction, type BulkActionBarActionProps, type BulkActionBarProps, BulkActionBarSeparator, type BulkActionBarVariant, Button, type ButtonProps, COUNTRY_CODES, Calendar, type CalendarHighlight, type CalendarHighlightColor, CalendarIcon, type CalendarProps, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CardVariants, CategoryDivider, type CategoryDividerProps, CategoryTag, type CategoryTagProps, type CategoryTone, type CellValue, type ChannelTabItem, ChannelTabs, type ChannelTabsProps, type ChannelTone, ChatBubbleIcon, CheckCircle2Icon, CheckCircleSolidIcon, CheckIcon, Checkbox, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsUpDownIcon, CircleDotIcon, CircleIcon, ClientRailGroupHeader, type ClientRailGroupHeaderProps, ClientRailItem, type ClientRailItemProps, ClientSelect, type ClientSelectOption, ClipboardCheckIcon, ClockIcon, CloseIcon, Collapsible, CollapsibleContent, CollapsibleTrigger, ComingSoon, type ComingSoonProps, CommandIcon, type CommandItem, CommandPalette, ConfirmActionButton, type ConfirmActionButtonProps, Content, type ContentProps, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, CopyIcon, CornerDownLeftIcon, type CountryCode, CountryFlag, CountrySelect, CreditCardIcon, DATE_DISPLAY_PLACEHOLDER, DangerAction, type DangerActionProps, Dash, DashGrid, type DashGridProps, type DashWidget, DataItem, DataTable, DataTableBody, type DataTableBodyProps, DataTableCell, DataTableCellDue, type DataTableCellDueProps, DataTableCellId, DataTableCellMono, DataTableCellName, type DataTableCellProps, DataTableCheckbox, type DataTableCheckboxProps, DataTableHead, type DataTableHeadProps, DataTableHeader, type DataTableHeaderProps, DataTablePagination, type DataTablePaginationProps, type DataTableProps, DataTableResultsCount, type DataTableResultsCountProps, DataTableRow, type DataTableRowProps, DataTableSearch, type DataTableSearchProps, DataTableSpacer, type DataTableSpacerProps, DataTableToolbar, type DataTableToolbarProps, DataTableView, type DataTableViewColumn, type DataTableViewFilter, type DataTableViewProps, DatePicker, DateRangePicker, type DateRangeValue, DetailGrid, type DetailGridProps, DetailMain, type DetailMainProps, DetailSpine, DetailSpineHeader, type DetailSpineHeaderProps, type DetailSpineProps, DetailSpineSection, type DetailSpineSectionProps, DetailSpineStats, type DetailSpineStatsProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DismissibleChip, DocumentDetailActions, type DocumentDetailActionsProps, DocumentDetailBody, type DocumentDetailBodyProps, DocumentDetailHeader, type DocumentDetailHeaderProps, DocumentDetailMetaRow, type DocumentDetailMetaRowProps, DocumentDetailPanel, type DocumentDetailPanelProps, DocumentDetailRequester, type DocumentDetailRequesterProps, DocumentDetailTitle, type DocumentDetailTitleProps, DocumentFileCard, type DocumentFileCardProps, DocumentFileRow, type DocumentFileRowProps, DocumentIcon, type DocumentItemState, DocumentList, type DocumentListProps, DocumentListSection, type DocumentListSectionProps, type DocumentRequestActivityKind, type DocumentRequestAssigneeOption, DocumentRequestCard, type DocumentRequestCardProps, DocumentRequestDetail, type DocumentRequestDetailActivityEvent, type DocumentRequestDetailComment, type DocumentRequestDetailDoc, type DocumentRequestDetailProps, type DocumentRequestDetailTab, DocumentRequestField, type DocumentRequestFieldProps, type DocumentRequestItemSummary, type DocumentRequestReviewStatusOption, type DocumentRequestTone, DocumentRow, type DocumentRowProps, type DocumentSource, DocumentSourceFilter, type DocumentSourceFilterProps, type DocumentSourceFilterValue, DocumentSourceTag, type DocumentSourceTagProps, DocumentsWorkspaceLayout, type DocumentsWorkspaceLayoutProps, DollarSignIcon, DonutChart, type DonutChartProps, type DonutSegment, DownloadIcon, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmailMessageCard, type EmailMessageCardProps, EmptyState, type EmptyStateProps, EngagementCard, type EngagementCardProps, EngagementTimeline, type EngagementTimelineProps, EngagementTimelineStep, type EngagementTimelineStepProps, ExtractIcon, EyeIcon, EyeOffIcon, Eyebrow, type EyebrowProps, FileChip, type FileChipProps, FileIcon, type FileKind, FileReturnIcon, FileTextIcon, FileTypeBadge, type FileTypeBadgeProps, type FileTypeTone, FileUpload, FilterChip, type FilterChipProps, FilterIcon, FlagIcon, FolderClosedIcon, type FolderNode, FolderOpenIcon, FolderPlusIcon, FolderTree, type FolderTreeProps, FolderUpIcon, FormError, FormSection, FormSuccess, GlobeIcon, GoogleBrandIcon, HelpCircleIcon, HistoryIcon, HomeIcon, HoverCard, HoverCardContent, HoverCardPortal, HoverCardTrigger, IconAction, type IconActionProps, IconTile, type IconTileProps, InboxIcon, InfoCircleSolidIcon, InfoIcon, Input, type InputVariants, IntentBadge, type IntentBadgeProps, type IntentTone, ItalicIcon, Kanban, KanbanCard, type KanbanCardProps, KanbanColumn, type KanbanColumnProps, KanbanIcon, type KanbanProps, KbdHint, type KbdHintProps, KeyIcon, type KeyboardShortcut, type KeyboardShortcutSection, KeyboardShortcutsDialog, type KeyboardShortcutsDialogProps, KpiCard, type KpiCardProps, type KpiDelta, Label, LandmarkIcon, LayoutDashboardIcon, LayoutGridIcon, LayoutListIcon, LightningIcon, Link2Icon, LinkAction, type LinkActionProps, LinkButton, LinkIcon, ListChecksIcon, ListIcon, ListOrderedIcon, LoaderIcon, LoadingRows, LockIcon, LockKeyholeIcon, LockOpenIcon, LogOutIcon, Logo, MailIcon, Main, type MainProps, MapPinIcon, MasterDetailLayout, type MasterDetailLayoutProps, MenuIcon, MessageBubble, MessageBubbleAction, type MessageBubbleActionProps, type MessageBubbleProps, MessageBubbleTombstone, type MessageBubbleTombstoneProps, MessageCircleIcon, MessageCircleWarningIcon, MessageComposer, type MessageComposerProps, MetadataGrid, MicrosoftBrandIcon, MinusIcon, type MissingDocumentItem, MissingDocumentsPanel, type MissingDocumentsPanelProps, MoneyCell, MonitorIcon, MoonIcon, MoreHorizontalIcon, MoveIcon, MultiFilterPill, MultiSelectField, MutedSpec, type MutedSpecProps, NewMenu, type NewMenuAction, type NewMenuGroup, type NewMenuProps, NotificationFilter, type NotificationFilterProps, type NotificationFilterValue, NotificationItem, type NotificationItemProps, NotificationList, type NotificationListProps, NotificationPanel, NotificationPanelFooter, type NotificationPanelFooterProps, NotificationPanelHeader, type NotificationPanelHeaderProps, type NotificationPanelProps, Numeric, type NumericProps, OTPInput, PageHeader, type PageHeaderProps, PageHeaderSep, type PageHeaderSepProps, PageHeaderSpec, type PageHeaderSpecProps, Pagination, type PaginationProps, PaletteIcon, PanelLeftCloseIcon, PanelLeftIcon, PaperclipIcon, PauseIcon, PdfPreview, type PdfPreviewProps, PenSignIcon, PenToolIcon, PencilIcon, PhoneCountryInput, PhoneIcon, PhoneInput, type PillStatus, PlayIcon, PlusIcon, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverPortal, PopoverTrigger, PrimaryAction, type PrimaryActionProps, type Priority, PriorityIcon, type PriorityIconProps, ProgressBar, type ProgressBarProps, ProgressRing, type ProgressRingProps, ProposalAddOn, type ProposalAddOnProps, type ProposalBillingMode, type ProposalBillingRow, ProposalBillingTerms, type ProposalBillingTermsProps, ProposalConsentGate, type ProposalConsentGateProps, ProposalCustomPage, type ProposalCustomPageKind, type ProposalCustomPageProps, ProposalNote, type ProposalNoteProps, ProposalPackageCard, type ProposalPackageCardProps, type ProposalPackageMode, ProposalPaymentCapture, type ProposalPaymentCaptureProps, ProposalPricingSummary, type ProposalPricingSummaryProps, ProposalServiceRow, type ProposalServiceRowProps, ProposalSignatureBlock, type ProposalSignatureBlockProps, type ProposalSigner, ProposalSignerList, type ProposalSignerListProps, type ProposalSignerStatus, type QuickReplyChip, RadioGroup, RadioGroupItem, type RankedBar, RankedBars, type RankedBarsProps, ReceiptIcon, ReplyIcon, ResponsiveDialog, type ResponsiveDialogProps, RotateCcwIcon, RouteTransition, type RouteTransitionProps, SERVICE_TONES, SaveIcon, ScrollArea, ScrollBar, SearchIcon, SearchInput, type SearchInputVariants, SearchSelect, type SearchSelectOption, SecondaryAction, type SecondaryActionProps, Section, SectionHead, SectionHeader, SegmentedProgress, type SegmentedProgressProps, type SegmentedTone, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOption, type SelectProps, SelectRoot, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectableKpiCard, type SelectableKpiCardProps, SendIcon, Separator, type ServiceTone, SettingsIcon, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Shell, type ShellProps, ShieldIcon, SideDrawer, Sidebar, SidebarBrand, type SidebarBrandProps, SidebarBrandSwitcher, type SidebarBrandSwitcherItem, type SidebarBrandSwitcherProps, SidebarBrandSwitcherTile, SidebarBrandText, type SidebarBrandTextProps, SidebarFooter, type SidebarFooterProps, SidebarLink, SidebarLinkAction, type SidebarLinkActionProps, SidebarLinkBadge, type SidebarLinkBadgeProps, type SidebarLinkBadgeVariants, SidebarLinkGroup, type SidebarLinkGroupProps, SidebarLinkLabel, type SidebarLinkLabelProps, type SidebarLinkProps, SidebarPinButton, type SidebarPinButtonProps, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarSection, type SidebarSectionProps, type SidebarState, SidebarTrigger, type SidebarTriggerProps, SidebarUser, type SidebarUserProps, SignatureEditor, type SignatureEditorProps, Skeleton, SkeletonCircle, SkeletonText, SlashIcon, Slider, SmartphoneIcon, type SortDirection, SparkleIcon, SparklesIcon, Spinner, type SpinnerProps, SpreadsheetPreview, type SpreadsheetPreviewProps, StackedBarChart, type StackedBarChartProps, type StackedBarDatum, type StackedBarSeries, StagePill, StarIcon, StarRating, type StarRatingProps, Stat, StatusDot, type StatusDotProps, StatusIcon, type StatusIconProps, StatusPill, type StatusPillProps, type StatusState, type Step, Stepper, type StepperProps, StickyActionBar, type StickyActionBarProps, StopIcon, StrikethroughIcon, SubmitButton, SuggestionPills, type SuggestionPillsProps, SuiteProgress, type SuiteProgressProps, type SuiteProgressSize, type SuiteProgressTone, SunIcon, Switch, Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, TableIcon, type TableProps, TableRow, type TableRowData, type TableRowProps, type TableTone, Tabs, TabsContent, TabsList, TabsTrigger, TagIcon, TagsCell, TeamIcon, TeamMemberSelect, Textarea, type TextareaVariants, TimeLogger, TimeLoggerActions, type TimeLoggerActionsProps, TimeLoggerBillable, type TimeLoggerBillableProps, TimeLoggerContextRow, type TimeLoggerContextRowProps, TimeLoggerEntry, TimeLoggerEntryList, type TimeLoggerEntryListProps, type TimeLoggerEntryProps, TimeLoggerField, type TimeLoggerFieldProps, TimeLoggerFooter, type TimeLoggerFooterProps, TimeLoggerHeader, type TimeLoggerHeaderProps, TimeLoggerNotes, type TimeLoggerNotesProps, type TimeLoggerPhase, type TimeLoggerProps, type TimeLoggerTier, TimeLoggerTimer, type TimeLoggerTimerProps, type TimelineState, ToastProvider, ToggleGroup, ToggleGroupItem, Toolbar, type ToolbarProps, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, Trash2Icon, TrashIcon, TrendingDownIcon, TrendingUpIcon, UnderlineIcon, UploadIcon, type UseStopwatchReturn, UserCircleIcon, UserIcon, UsersIcon, VisuallyHidden, WorkflowIcon, XCircleSolidIcon, XIcon, YEAR_DISPLAY_PLACEHOLDER, ZoomInIcon, ZoomOutIcon, alertVariants, applyMask, applyYearMask, attachmentChipVariants, badgeVariants, buttonVariants, cardVariants, cn, dateToIso, displayToIso, fileTypeBadgeVariants, fileTypeFromName, filterChipVariants, formatClock, formatCurrency, formatDuration, getFlagEmoji, iconTileVariants, inputVariants, isoToDate, isoToDisplay, isoToYear, labelVariants, parseDuration, parsePhoneForEditing, progressBarVariants, progressRingVariants, searchInputVariants, serviceToneLabel, serviceToneStyle, sidebarLinkBadgeVariants, spinnerVariants, starRatingVariants, statusDotVariants, suiteProgressFillVariants, textareaVariants, useSidebarPeekLock, useSidebarState, useStopwatch, useToast, yearToIso };
|
|
5058
|
+
export { AIReceiptPanel, type AIReceiptPanelProps, type AIReceiptResult, Accordion, AccordionContent, AccordionItem, AccordionTrigger, type ActivityDotVariant, ActivityEventItem, type ActivityEventItemProps, ActivityItem, type ActivityItemProps, ActivityList, type ActivityListProps, type AgreementFirm, AgreementPaneHeading, type AgreementPaneHeadingProps, type AgreementStatus, type AgreementStep, AgreementViewer, type AgreementViewerProps, AiDraftCard, type AiDraftCardProps, type AiDraftState, Alert, AlertCircleIcon, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, AlertTriangleIcon, AlertTriangleSolidIcon, AppHeader, AppHeaderActions, type AppHeaderActionsProps, AppHeaderBreadcrumb, type AppHeaderBreadcrumbProps, type AppHeaderProps, AppHeaderSearch, type AppHeaderSearchProps, AppHeaderTitle, type AppHeaderTitleProps, AreaChart, type AreaChartProps, type AreaPoint, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowRightSmallIcon, ArrowUpIcon, AspectRatio, Assignee, AssureAuditBrandIcon, AssureBooksBrandIcon, AssureProBrandIcon, AssureTaxBrandIcon, AtSignIcon, AttachmentChip, type AttachmentChipProps, AttentionItem, type AttentionItemProps, type AttentionUrgency, Avatar, Badge, type BadgeProps, BarChartIcon, BellIcon, Blockquote, BoldIcon, BottomNav, type BottomNavProps, type BottomNavTab, type BrandIconProps, Breadcrumb, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbList, type BreadcrumbListProps, BreadcrumbPage, type BreadcrumbPageProps, type BreadcrumbProps, BreadcrumbSeparator, type BreadcrumbSeparatorProps, BriefcaseIcon, Building2Icon, BuildingIcon, BulkActionBar, BulkActionBarAction, type BulkActionBarActionProps, type BulkActionBarProps, BulkActionBarSeparator, type BulkActionBarVariant, Button, type ButtonProps, COUNTRY_CODES, Calendar, type CalendarHighlight, type CalendarHighlightColor, CalendarIcon, type CalendarProps, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CardVariants, CategoryDivider, type CategoryDividerProps, CategoryTag, type CategoryTagProps, type CategoryTone, type CellValue, type ChannelTabItem, ChannelTabs, type ChannelTabsProps, type ChannelTone, ChatBubbleIcon, CheckCircle2Icon, CheckCircleSolidIcon, CheckIcon, Checkbox, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsUpDownIcon, CircleDotIcon, CircleIcon, ClientRailGroupHeader, type ClientRailGroupHeaderProps, ClientRailItem, type ClientRailItemProps, ClientSelect, type ClientSelectOption, ClipboardCheckIcon, ClockIcon, CloseIcon, Collapsible, CollapsibleContent, CollapsibleTrigger, ComingSoon, type ComingSoonProps, CommandIcon, type CommandItem, CommandPalette, ConfirmActionButton, type ConfirmActionButtonProps, Content, type ContentProps, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, CopyIcon, CornerDownLeftIcon, type CountryCode, CountryFlag, CountrySelect, CreditCardIcon, DATE_DISPLAY_PLACEHOLDER, DangerAction, type DangerActionProps, Dash, DashGrid, type DashGridProps, type DashWidget, DataItem, DataTable, DataTableBody, type DataTableBodyProps, DataTableCell, DataTableCellDue, type DataTableCellDueProps, DataTableCellId, DataTableCellMono, DataTableCellName, type DataTableCellProps, DataTableCheckbox, type DataTableCheckboxProps, DataTableHead, type DataTableHeadProps, DataTableHeader, type DataTableHeaderProps, DataTablePagination, type DataTablePaginationProps, type DataTableProps, DataTableResultsCount, type DataTableResultsCountProps, DataTableRow, type DataTableRowProps, DataTableSearch, type DataTableSearchProps, DataTableSpacer, type DataTableSpacerProps, DataTableToolbar, type DataTableToolbarProps, DataTableView, type DataTableViewColumn, type DataTableViewFilter, type DataTableViewProps, DatePicker, DateRangePicker, type DateRangeValue, DetailGrid, type DetailGridProps, DetailMain, type DetailMainProps, DetailSpine, DetailSpineHeader, type DetailSpineHeaderProps, type DetailSpineProps, DetailSpineSection, type DetailSpineSectionProps, DetailSpineStats, type DetailSpineStatsProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DismissibleChip, DocumentDetailActions, type DocumentDetailActionsProps, DocumentDetailBody, type DocumentDetailBodyProps, DocumentDetailHeader, type DocumentDetailHeaderProps, DocumentDetailMetaRow, type DocumentDetailMetaRowProps, DocumentDetailPanel, type DocumentDetailPanelProps, DocumentDetailRequester, type DocumentDetailRequesterProps, DocumentDetailTitle, type DocumentDetailTitleProps, DocumentFileCard, type DocumentFileCardProps, DocumentFileRow, type DocumentFileRowProps, DocumentIcon, type DocumentItemState, DocumentList, type DocumentListProps, DocumentListSection, type DocumentListSectionProps, type DocumentRequestActivityKind, type DocumentRequestAssigneeOption, DocumentRequestCard, type DocumentRequestCardProps, DocumentRequestDetail, type DocumentRequestDetailActivityEvent, type DocumentRequestDetailComment, type DocumentRequestDetailDoc, type DocumentRequestDetailProps, type DocumentRequestDetailTab, DocumentRequestField, type DocumentRequestFieldProps, type DocumentRequestItemSummary, type DocumentRequestReviewStatusOption, type DocumentRequestTone, DocumentRow, type DocumentRowProps, type DocumentSource, DocumentSourceFilter, type DocumentSourceFilterProps, type DocumentSourceFilterValue, DocumentSourceTag, type DocumentSourceTagProps, DocumentsWorkspaceLayout, type DocumentsWorkspaceLayoutProps, DollarSignIcon, DonutChart, type DonutChartProps, type DonutSegment, DownloadIcon, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmailMessageCard, type EmailMessageCardProps, EmptyState, type EmptyStateProps, EngagementCard, type EngagementCardProps, EngagementTimeline, type EngagementTimelineProps, EngagementTimelineStep, type EngagementTimelineStepProps, ExtractIcon, EyeIcon, EyeOffIcon, Eyebrow, type EyebrowProps, FileChip, type FileChipProps, FileIcon, type FileKind, FileReturnIcon, FileTextIcon, FileTypeBadge, type FileTypeBadgeProps, type FileTypeTone, FileUpload, FilterChip, type FilterChipProps, FilterIcon, FlagIcon, FolderClosedIcon, type FolderNode, FolderOpenIcon, FolderPlusIcon, FolderTree, type FolderTreeProps, FolderUpIcon, FormError, FormSection, FormSuccess, GlobeIcon, GoogleBrandIcon, HelpCircleIcon, HistoryIcon, HomeIcon, HoverCard, HoverCardContent, HoverCardPortal, HoverCardTrigger, IconAction, type IconActionProps, IconTile, type IconTileProps, InboxIcon, InfoCircleSolidIcon, InfoIcon, Input, type InputVariants, IntentBadge, type IntentBadgeProps, type IntentTone, ItalicIcon, Kanban, KanbanCard, type KanbanCardProps, KanbanColumn, type KanbanColumnProps, KanbanIcon, type KanbanProps, KbdHint, type KbdHintProps, KeyIcon, type KeyboardShortcut, type KeyboardShortcutSection, KeyboardShortcutsDialog, type KeyboardShortcutsDialogProps, KpiCard, type KpiCardProps, type KpiDelta, Label, LandmarkIcon, LayoutDashboardIcon, LayoutGridIcon, LayoutListIcon, LightningIcon, Link2Icon, LinkAction, type LinkActionProps, LinkButton, LinkIcon, ListChecksIcon, ListIcon, ListOrderedIcon, LoaderIcon, LoadingRows, LockIcon, LockKeyholeIcon, LockOpenIcon, LogOutIcon, Logo, MailIcon, Main, type MainProps, MapPinIcon, MasterDetailLayout, type MasterDetailLayoutProps, MenuIcon, MessageBubble, MessageBubbleAction, type MessageBubbleActionProps, type MessageBubbleProps, MessageBubbleTombstone, type MessageBubbleTombstoneProps, MessageCircleIcon, MessageCircleWarningIcon, MessageComposer, type MessageComposerProps, MetadataGrid, MicrosoftBrandIcon, MinusIcon, type MissingDocumentItem, MissingDocumentsPanel, type MissingDocumentsPanelProps, MoneyCell, MonitorIcon, MoonIcon, MoreHorizontalIcon, MoveIcon, MultiFilterPill, MultiSelectField, MutedSpec, type MutedSpecProps, NewMenu, type NewMenuAction, type NewMenuGroup, type NewMenuProps, NotificationFilter, type NotificationFilterProps, type NotificationFilterValue, NotificationItem, type NotificationItemProps, NotificationList, type NotificationListProps, NotificationPanel, NotificationPanelFooter, type NotificationPanelFooterProps, NotificationPanelHeader, type NotificationPanelHeaderProps, type NotificationPanelProps, Numeric, type NumericProps, OTPInput, PageHeader, type PageHeaderProps, PageHeaderSep, type PageHeaderSepProps, PageHeaderSpec, type PageHeaderSpecProps, Pagination, type PaginationProps, PaletteIcon, PanelLeftCloseIcon, PanelLeftIcon, PaperclipIcon, PauseIcon, PdfPreview, type PdfPreviewProps, PenSignIcon, PenToolIcon, PencilIcon, PhoneCountryInput, PhoneIcon, PhoneInput, type PillStatus, PlayIcon, PlusIcon, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverPortal, PopoverTrigger, PrimaryAction, type PrimaryActionProps, type Priority, PriorityIcon, type PriorityIconProps, ProgressBar, type ProgressBarProps, ProgressRing, type ProgressRingProps, ProposalAddOn, type ProposalAddOnProps, type ProposalBillingMode, type ProposalBillingRow, ProposalBillingTerms, type ProposalBillingTermsProps, ProposalConsentGate, type ProposalConsentGateProps, ProposalCustomPage, type ProposalCustomPageKind, type ProposalCustomPageProps, ProposalNote, type ProposalNoteProps, ProposalPackageCard, type ProposalPackageCardProps, type ProposalPackageMode, ProposalPaymentCapture, type ProposalPaymentCaptureProps, ProposalPricingSummary, type ProposalPricingSummaryProps, ProposalServiceRow, type ProposalServiceRowProps, ProposalSignatureBlock, type ProposalSignatureBlockProps, type ProposalSigner, ProposalSignerList, type ProposalSignerListProps, type ProposalSignerStatus, type QuickReplyChip, RadioGroup, RadioGroupItem, type RankedBar, RankedBars, type RankedBarsProps, ReceiptIcon, ReplyIcon, ResponsiveDialog, type ResponsiveDialogProps, RotateCcwIcon, RouteTransition, type RouteTransitionProps, SERVICE_TONES, SaveIcon, ScrollArea, ScrollBar, SearchIcon, SearchInput, type SearchInputVariants, SearchSelect, type SearchSelectOption, SecondaryAction, type SecondaryActionProps, Section, SectionHead, SectionHeader, SegmentedProgress, type SegmentedProgressProps, type SegmentedTone, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOption, type SelectProps, SelectRoot, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectableKpiCard, type SelectableKpiCardProps, SendIcon, Separator, type ServiceTone, SettingsIcon, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Shell, type ShellProps, ShieldIcon, SideDrawer, Sidebar, SidebarBrand, type SidebarBrandProps, SidebarBrandSwitcher, type SidebarBrandSwitcherItem, type SidebarBrandSwitcherProps, SidebarBrandSwitcherTile, SidebarBrandText, type SidebarBrandTextProps, SidebarFooter, type SidebarFooterProps, SidebarLink, SidebarLinkAction, type SidebarLinkActionProps, SidebarLinkBadge, type SidebarLinkBadgeProps, type SidebarLinkBadgeVariants, SidebarLinkGroup, type SidebarLinkGroupProps, SidebarLinkLabel, type SidebarLinkLabelProps, type SidebarLinkProps, SidebarPinButton, type SidebarPinButtonProps, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarSection, type SidebarSectionProps, type SidebarState, SidebarTrigger, type SidebarTriggerProps, SidebarUser, type SidebarUserProps, SignatureEditor, type SignatureEditorProps, Skeleton, SkeletonCircle, SkeletonText, SlashIcon, Slider, SmartphoneIcon, type SortDirection, SparkleIcon, SparklesIcon, Spinner, type SpinnerProps, SpreadsheetPreview, type SpreadsheetPreviewProps, StackedBarChart, type StackedBarChartProps, type StackedBarDatum, type StackedBarSeries, StagePill, StarIcon, StarRating, type StarRatingProps, Stat, StatusDot, type StatusDotProps, StatusIcon, type StatusIconProps, StatusPill, type StatusPillProps, type StatusState, type Step, Stepper, type StepperProps, StickyActionBar, type StickyActionBarProps, StopIcon, StrikethroughIcon, SubmitButton, SuggestionPills, type SuggestionPillsProps, SuiteProgress, type SuiteProgressProps, type SuiteProgressSize, type SuiteProgressTone, SunIcon, Switch, Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, TableIcon, type TableProps, TableRow, type TableRowData, type TableRowProps, type TableTone, Tabs, TabsContent, TabsList, TabsTrigger, TagIcon, TagsCell, TeamIcon, TeamMemberSelect, Textarea, type TextareaVariants, TimeLogger, TimeLoggerActions, type TimeLoggerActionsProps, TimeLoggerBillable, type TimeLoggerBillableProps, TimeLoggerContextRow, type TimeLoggerContextRowProps, TimeLoggerEntry, TimeLoggerEntryList, type TimeLoggerEntryListProps, type TimeLoggerEntryProps, TimeLoggerField, type TimeLoggerFieldProps, TimeLoggerFooter, type TimeLoggerFooterProps, TimeLoggerHeader, type TimeLoggerHeaderProps, TimeLoggerNotes, type TimeLoggerNotesProps, type TimeLoggerPhase, type TimeLoggerProps, type TimeLoggerTier, TimeLoggerTimer, type TimeLoggerTimerProps, type TimelineState, type ToastAction, type ToastContextValue, type ToastOptions, ToastProvider, type ToastVariant, ToggleGroup, ToggleGroupItem, Toolbar, type ToolbarProps, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, Trash2Icon, TrashIcon, TrendingDownIcon, TrendingUpIcon, UnderlineIcon, UploadIcon, type UseStopwatchReturn, UserCircleIcon, UserIcon, UsersIcon, VisuallyHidden, WorkflowIcon, XCircleSolidIcon, XIcon, YEAR_DISPLAY_PLACEHOLDER, ZoomInIcon, ZoomOutIcon, alertVariants, applyMask, applyYearMask, attachmentChipVariants, badgeVariants, buttonVariants, cardVariants, cn, dateToIso, displayToIso, fileTypeBadgeVariants, fileTypeFromName, filterChipVariants, formatClock, formatCurrency, formatDuration, getFlagEmoji, iconTileVariants, inputVariants, isoToDate, isoToDisplay, isoToYear, labelVariants, parseDuration, parsePhoneForEditing, progressBarVariants, progressRingVariants, searchInputVariants, serviceToneLabel, serviceToneStyle, sidebarLinkBadgeVariants, spinnerVariants, starRatingVariants, statusDotVariants, suiteProgressFillVariants, textareaVariants, useSidebarPeekLock, useSidebarState, useStopwatch, useToast, yearToIso };
|
package/dist/index.js
CHANGED
|
@@ -9481,17 +9481,44 @@ function useToast() {
|
|
|
9481
9481
|
if (!ctx) throw new Error("useToast must be used within <ToastProvider>");
|
|
9482
9482
|
return ctx;
|
|
9483
9483
|
}
|
|
9484
|
+
var DEFAULT_DURATION = 5e3;
|
|
9485
|
+
var MAX_VISIBLE = 3;
|
|
9484
9486
|
var toastCount = 0;
|
|
9487
|
+
function toOptions(input) {
|
|
9488
|
+
return typeof input === "string" ? { title: input } : input;
|
|
9489
|
+
}
|
|
9485
9490
|
function ToastProvider({ children }) {
|
|
9486
9491
|
const [toasts, setToasts] = useState([]);
|
|
9487
9492
|
const removeToast = useCallback((id) => {
|
|
9488
9493
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
9489
9494
|
}, []);
|
|
9490
9495
|
const addToast = useCallback((options) => {
|
|
9496
|
+
const variant = options.variant ?? "default";
|
|
9497
|
+
const duration = options.duration ?? (variant === "loading" ? 0 : DEFAULT_DURATION);
|
|
9491
9498
|
const id = `toast-${++toastCount}`;
|
|
9492
|
-
setToasts((prev) =>
|
|
9499
|
+
setToasts((prev) => {
|
|
9500
|
+
if (options.dedupeKey) {
|
|
9501
|
+
const existing = prev.find((t) => t.dedupeKey === options.dedupeKey);
|
|
9502
|
+
if (existing) {
|
|
9503
|
+
return prev.map(
|
|
9504
|
+
(t) => t.dedupeKey === options.dedupeKey ? { ...t, ...options, variant, duration, seq: t.seq + 1 } : t
|
|
9505
|
+
);
|
|
9506
|
+
}
|
|
9507
|
+
}
|
|
9508
|
+
return [...prev, { id, seq: 0, ...options, variant, duration }];
|
|
9509
|
+
});
|
|
9493
9510
|
return id;
|
|
9494
9511
|
}, []);
|
|
9512
|
+
const update = useCallback((id, patch) => {
|
|
9513
|
+
setToasts(
|
|
9514
|
+
(prev) => prev.map((t) => {
|
|
9515
|
+
if (t.id !== id) return t;
|
|
9516
|
+
const variant = patch.variant ?? t.variant;
|
|
9517
|
+
const duration = patch.duration ?? (patch.variant && patch.variant !== "loading" ? DEFAULT_DURATION : t.duration);
|
|
9518
|
+
return { ...t, ...patch, variant, duration, seq: t.seq + 1 };
|
|
9519
|
+
})
|
|
9520
|
+
);
|
|
9521
|
+
}, []);
|
|
9495
9522
|
const dismiss = useCallback((id) => {
|
|
9496
9523
|
if (id === void 0) {
|
|
9497
9524
|
setToasts([]);
|
|
@@ -9499,9 +9526,20 @@ function ToastProvider({ children }) {
|
|
|
9499
9526
|
}
|
|
9500
9527
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
9501
9528
|
}, []);
|
|
9529
|
+
const promise = useCallback(
|
|
9530
|
+
(p, copy) => {
|
|
9531
|
+
const id = addToast({ ...toOptions(copy.loading), variant: "loading", duration: 0 });
|
|
9532
|
+
p.then(
|
|
9533
|
+
(value2) => update(id, { ...toOptions(typeof copy.success === "function" ? copy.success(value2) : copy.success), variant: "success" }),
|
|
9534
|
+
(err) => update(id, { ...toOptions(typeof copy.error === "function" ? copy.error(err) : copy.error), variant: "destructive", duration: 6e3 })
|
|
9535
|
+
);
|
|
9536
|
+
return p;
|
|
9537
|
+
},
|
|
9538
|
+
[addToast, update]
|
|
9539
|
+
);
|
|
9502
9540
|
const value = useMemo(
|
|
9503
|
-
() => ({ toast: addToast, dismiss }),
|
|
9504
|
-
[addToast, dismiss]
|
|
9541
|
+
() => ({ toast: addToast, dismiss, update, promise }),
|
|
9542
|
+
[addToast, dismiss, update, promise]
|
|
9505
9543
|
);
|
|
9506
9544
|
return /* @__PURE__ */ jsxs(ToastContext, { value, children: [
|
|
9507
9545
|
children,
|
|
@@ -9512,7 +9550,7 @@ function ToastProvider({ children }) {
|
|
|
9512
9550
|
role: "region",
|
|
9513
9551
|
"aria-live": "polite",
|
|
9514
9552
|
"aria-label": "Notifications",
|
|
9515
|
-
children: toasts.map((t) => /* @__PURE__ */ jsx(ToastItem, { toast: t, onDismiss: removeToast }, t.id))
|
|
9553
|
+
children: toasts.slice(0, MAX_VISIBLE).map((t) => /* @__PURE__ */ jsx(ToastItem, { toast: t, onDismiss: removeToast }, t.id))
|
|
9516
9554
|
}
|
|
9517
9555
|
)
|
|
9518
9556
|
] });
|
|
@@ -9536,13 +9574,28 @@ var variantConfig = {
|
|
|
9536
9574
|
icon: "text-warning-fg",
|
|
9537
9575
|
bar: "bg-warning-fg",
|
|
9538
9576
|
Icon: AlertTriangleSolidIcon
|
|
9577
|
+
},
|
|
9578
|
+
info: {
|
|
9579
|
+
chip: "bg-info/12",
|
|
9580
|
+
icon: "text-info",
|
|
9581
|
+
bar: "bg-info",
|
|
9582
|
+
Icon: InfoCircleSolidIcon
|
|
9583
|
+
},
|
|
9584
|
+
loading: {
|
|
9585
|
+
chip: "bg-pro-bg",
|
|
9586
|
+
icon: "text-pro-fg",
|
|
9587
|
+
bar: "bg-pro-fg",
|
|
9588
|
+
Icon: LoaderIcon,
|
|
9589
|
+
spin: true
|
|
9539
9590
|
}
|
|
9540
9591
|
};
|
|
9592
|
+
var SWIPE_DISMISS_PX = 72;
|
|
9541
9593
|
function ToastItem({ toast, onDismiss }) {
|
|
9542
|
-
const timerRef = useRef(void 0);
|
|
9543
9594
|
const [exiting, setExiting] = useState(false);
|
|
9544
|
-
const
|
|
9545
|
-
const
|
|
9595
|
+
const cardRef = useRef(null);
|
|
9596
|
+
const barRef = useRef(null);
|
|
9597
|
+
const pausedRef = useRef(false);
|
|
9598
|
+
const duration = toast.duration;
|
|
9546
9599
|
const showProgress = duration > 0;
|
|
9547
9600
|
const close = useCallback(() => {
|
|
9548
9601
|
setExiting(true);
|
|
@@ -9550,93 +9603,147 @@ function ToastItem({ toast, onDismiss }) {
|
|
|
9550
9603
|
}, [toast.id, onDismiss]);
|
|
9551
9604
|
useEffect(() => {
|
|
9552
9605
|
if (!showProgress) return;
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9606
|
+
let raf = 0;
|
|
9607
|
+
let remaining = duration;
|
|
9608
|
+
let last = performance.now();
|
|
9609
|
+
const tick = (now) => {
|
|
9610
|
+
const dt = now - last;
|
|
9611
|
+
last = now;
|
|
9612
|
+
if (!pausedRef.current) {
|
|
9613
|
+
remaining -= dt;
|
|
9614
|
+
if (barRef.current) {
|
|
9615
|
+
barRef.current.style.width = `${Math.max(0, Math.min(100, (duration - remaining) / duration * 100))}%`;
|
|
9616
|
+
}
|
|
9617
|
+
if (remaining <= 0) {
|
|
9618
|
+
close();
|
|
9619
|
+
return;
|
|
9620
|
+
}
|
|
9621
|
+
}
|
|
9622
|
+
raf = requestAnimationFrame(tick);
|
|
9623
|
+
};
|
|
9624
|
+
raf = requestAnimationFrame(tick);
|
|
9559
9625
|
return () => cancelAnimationFrame(raf);
|
|
9560
|
-
}, [showProgress]);
|
|
9561
|
-
const
|
|
9562
|
-
|
|
9563
|
-
"
|
|
9564
|
-
{
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9626
|
+
}, [duration, showProgress, close, toast.seq]);
|
|
9627
|
+
const dragRef = useRef(null);
|
|
9628
|
+
const onPointerDown = (e) => {
|
|
9629
|
+
if (e.target.closest("button")) return;
|
|
9630
|
+
dragRef.current = { startX: e.clientX, dx: 0 };
|
|
9631
|
+
pausedRef.current = true;
|
|
9632
|
+
cardRef.current?.setPointerCapture(e.pointerId);
|
|
9633
|
+
};
|
|
9634
|
+
const onPointerMove = (e) => {
|
|
9635
|
+
const drag = dragRef.current;
|
|
9636
|
+
if (!drag || !cardRef.current) return;
|
|
9637
|
+
drag.dx = Math.max(0, e.clientX - drag.startX);
|
|
9638
|
+
cardRef.current.style.transform = `translateX(${drag.dx}px)`;
|
|
9639
|
+
cardRef.current.style.opacity = `${Math.max(0.3, 1 - drag.dx / 240)}`;
|
|
9640
|
+
};
|
|
9641
|
+
const endDrag = (e) => {
|
|
9642
|
+
const drag = dragRef.current;
|
|
9643
|
+
dragRef.current = null;
|
|
9644
|
+
cardRef.current?.releasePointerCapture?.(e.pointerId);
|
|
9645
|
+
if (!drag || !cardRef.current) return;
|
|
9646
|
+
if (drag.dx >= SWIPE_DISMISS_PX) {
|
|
9647
|
+
close();
|
|
9648
|
+
return;
|
|
9649
|
+
}
|
|
9650
|
+
cardRef.current.style.transform = "";
|
|
9651
|
+
cardRef.current.style.opacity = "";
|
|
9652
|
+
pausedRef.current = false;
|
|
9653
|
+
};
|
|
9654
|
+
const { chip, icon, bar, Icon: Icon3, spin } = variantConfig[toast.variant];
|
|
9655
|
+
return (
|
|
9656
|
+
// Pointer/hover handlers add pause-on-hover + swipe-to-dismiss as progressive
|
|
9657
|
+
// enhancement only — keyboard/AT users dismiss via the explicit Dismiss
|
|
9658
|
+
// button below, and the live region (role=status) still announces content.
|
|
9659
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
9660
|
+
/* @__PURE__ */ jsxs(
|
|
9661
|
+
"div",
|
|
9662
|
+
{
|
|
9663
|
+
ref: cardRef,
|
|
9664
|
+
role: "status",
|
|
9665
|
+
"data-state": exiting ? "closed" : "open",
|
|
9666
|
+
onPointerDown,
|
|
9667
|
+
onPointerMove,
|
|
9668
|
+
onPointerUp: endDrag,
|
|
9669
|
+
onPointerCancel: endDrag,
|
|
9670
|
+
onMouseEnter: () => {
|
|
9671
|
+
pausedRef.current = true;
|
|
9672
|
+
},
|
|
9673
|
+
onMouseLeave: () => {
|
|
9674
|
+
if (!dragRef.current) pausedRef.current = false;
|
|
9675
|
+
},
|
|
9676
|
+
onFocusCapture: () => {
|
|
9677
|
+
pausedRef.current = true;
|
|
9678
|
+
},
|
|
9679
|
+
onBlurCapture: () => {
|
|
9680
|
+
if (!dragRef.current) pausedRef.current = false;
|
|
9681
|
+
},
|
|
9682
|
+
className: cn(
|
|
9683
|
+
"bg-surface border-rule text-fg rounded-card shadow-card pointer-events-auto relative w-80 touch-none overflow-hidden border p-4",
|
|
9684
|
+
"font-body select-none",
|
|
9685
|
+
// Unified data-state animation (spec §5.27) — same model as Dialog/Tooltip:
|
|
9686
|
+
// open → fade+slide in over --duration-overlay (200ms), ease-out-quart
|
|
9687
|
+
// close → fade+slide out over --duration-fast (150ms), ease-in
|
|
9688
|
+
"data-[state=open]:animate-in data-[state=open]:slide-in-from-right-8 data-[state=open]:fade-in-0",
|
|
9689
|
+
"data-[state=open]:duration-[var(--duration-overlay)] data-[state=open]:ease-[var(--ease-out-quart)]",
|
|
9690
|
+
"data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right-8 data-[state=closed]:fade-out-0",
|
|
9691
|
+
"data-[state=closed]:duration-[var(--duration-fast)] data-[state=closed]:ease-[var(--ease-in)]",
|
|
9692
|
+
"motion-reduce:animate-none"
|
|
9693
|
+
),
|
|
9694
|
+
children: [
|
|
9695
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
9696
|
+
/* @__PURE__ */ jsx(
|
|
9697
|
+
"span",
|
|
9698
|
+
{
|
|
9699
|
+
className: cn(
|
|
9700
|
+
"inline-flex size-8 shrink-0 items-center justify-center rounded-[9px]",
|
|
9701
|
+
chip,
|
|
9702
|
+
icon
|
|
9703
|
+
),
|
|
9704
|
+
"aria-hidden": "true",
|
|
9705
|
+
children: /* @__PURE__ */ jsx(Icon3, { className: cn("size-5", spin && "animate-spin motion-reduce:animate-none") })
|
|
9706
|
+
}
|
|
9707
|
+
),
|
|
9708
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
9709
|
+
/* @__PURE__ */ jsx("p", { className: "text-fg text-sm leading-tight font-semibold", children: toast.title }),
|
|
9710
|
+
toast.description && /* @__PURE__ */ jsx("p", { className: "text-fg-3 mt-0.5 text-sm leading-snug", children: toast.description }),
|
|
9711
|
+
toast.action && /* @__PURE__ */ jsx(
|
|
9712
|
+
"button",
|
|
9713
|
+
{
|
|
9714
|
+
type: "button",
|
|
9715
|
+
onClick: () => {
|
|
9716
|
+
toast.action?.onClick();
|
|
9717
|
+
close();
|
|
9718
|
+
},
|
|
9719
|
+
className: cn(
|
|
9720
|
+
"text-pro-fg mt-2 text-sm font-semibold",
|
|
9721
|
+
"transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out-quart)] hover:underline motion-reduce:transition-none",
|
|
9722
|
+
"focus-visible:[box-shadow:var(--shadow-focus-ring)] rounded-sm focus-visible:outline-none"
|
|
9723
|
+
),
|
|
9724
|
+
children: toast.action.label
|
|
9725
|
+
}
|
|
9726
|
+
)
|
|
9727
|
+
] }),
|
|
9728
|
+
/* @__PURE__ */ jsx(
|
|
9597
9729
|
"button",
|
|
9598
9730
|
{
|
|
9599
9731
|
type: "button",
|
|
9600
|
-
onClick:
|
|
9601
|
-
toast.action?.onClick();
|
|
9602
|
-
close();
|
|
9603
|
-
},
|
|
9732
|
+
onClick: close,
|
|
9604
9733
|
className: cn(
|
|
9605
|
-
"text-
|
|
9606
|
-
"transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out-quart)]
|
|
9607
|
-
"focus-visible:[box-shadow:var(--shadow-focus-ring)]
|
|
9734
|
+
"text-fg-4 hover:text-fg-2 rounded-icon -mr-1 inline-flex size-5 shrink-0 items-center justify-center",
|
|
9735
|
+
"transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out-quart)] motion-reduce:transition-none",
|
|
9736
|
+
"focus-visible:[box-shadow:var(--shadow-focus-ring)] focus-visible:outline-none"
|
|
9608
9737
|
),
|
|
9609
|
-
|
|
9738
|
+
"aria-label": "Dismiss",
|
|
9739
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "size-3.5", "aria-hidden": "true" })
|
|
9610
9740
|
}
|
|
9611
9741
|
)
|
|
9612
9742
|
] }),
|
|
9613
|
-
/* @__PURE__ */ jsx(
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
onClick: close,
|
|
9618
|
-
className: cn(
|
|
9619
|
-
"text-fg-4 hover:text-fg-2 rounded-icon -mr-1 inline-flex size-5 shrink-0 items-center justify-center",
|
|
9620
|
-
"transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out-quart)] motion-reduce:transition-none",
|
|
9621
|
-
"focus-visible:[box-shadow:var(--shadow-focus-ring)] focus-visible:outline-none"
|
|
9622
|
-
),
|
|
9623
|
-
"aria-label": "Dismiss",
|
|
9624
|
-
children: /* @__PURE__ */ jsx(XIcon, { className: "size-3.5", "aria-hidden": "true" })
|
|
9625
|
-
}
|
|
9626
|
-
)
|
|
9627
|
-
] }),
|
|
9628
|
-
showProgress && /* @__PURE__ */ jsx("div", { className: "bg-rule absolute inset-x-0 bottom-0 h-1", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
9629
|
-
"div",
|
|
9630
|
-
{
|
|
9631
|
-
className: cn(
|
|
9632
|
-
"h-full transition-[width] ease-linear motion-reduce:transition-none",
|
|
9633
|
-
bar
|
|
9634
|
-
),
|
|
9635
|
-
style: { width: filled ? "100%" : "0%", transitionDuration: `${duration}ms` }
|
|
9636
|
-
}
|
|
9637
|
-
) })
|
|
9638
|
-
]
|
|
9639
|
-
}
|
|
9743
|
+
showProgress && /* @__PURE__ */ jsx("div", { className: "bg-rule absolute inset-x-0 bottom-0 h-1", "aria-hidden": "true", children: /* @__PURE__ */ jsx("div", { ref: barRef, className: cn("h-full", bar), style: { width: "0%" } }) })
|
|
9744
|
+
]
|
|
9745
|
+
}
|
|
9746
|
+
)
|
|
9640
9747
|
);
|
|
9641
9748
|
}
|
|
9642
9749
|
var itemVariants = cva(
|