@thalavaisankar/atoms 0.0.0-stage → 0.2.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/LICENSE +24 -0
- package/README.md +196 -2
- package/THIRD_PARTY_NOTICES.md +275 -0
- package/dist/blocks/index.d.mts +2 -0
- package/dist/blocks/index.mjs +1 -0
- package/dist/blocks/index.mjs.map +1 -0
- package/dist/components/ui/accordion/accordion.mjs +194 -0
- package/dist/components/ui/accordion/accordion.mjs.map +1 -0
- package/dist/components/ui/accordion/index.mjs +15 -0
- package/dist/components/ui/accordion/index.mjs.map +1 -0
- package/dist/components/ui/activity-feed/activity-feed.mjs +287 -0
- package/dist/components/ui/activity-feed/activity-feed.mjs.map +1 -0
- package/dist/components/ui/activity-feed/index.mjs +39 -0
- package/dist/components/ui/activity-feed/index.mjs.map +1 -0
- package/dist/components/ui/alert/alert.mjs +128 -0
- package/dist/components/ui/alert/alert.mjs.map +1 -0
- package/dist/components/ui/alert/index.mjs +17 -0
- package/dist/components/ui/alert/index.mjs.map +1 -0
- package/dist/components/ui/animated-label/animated-label.mjs +89 -0
- package/dist/components/ui/animated-label/animated-label.mjs.map +1 -0
- package/dist/components/ui/animated-label/index.mjs +9 -0
- package/dist/components/ui/animated-label/index.mjs.map +1 -0
- package/dist/components/ui/animated-number/animated-number.mjs +101 -0
- package/dist/components/ui/animated-number/animated-number.mjs.map +1 -0
- package/dist/components/ui/animated-number/index.mjs +5 -0
- package/dist/components/ui/animated-number/index.mjs.map +1 -0
- package/dist/components/ui/avatar/avatar.mjs +130 -0
- package/dist/components/ui/avatar/avatar.mjs.map +1 -0
- package/dist/components/ui/avatar/index.mjs +17 -0
- package/dist/components/ui/avatar/index.mjs.map +1 -0
- package/dist/components/ui/avatar-group/avatar-group.mjs +49 -0
- package/dist/components/ui/avatar-group/avatar-group.mjs.map +1 -0
- package/dist/components/ui/avatar-group/index.mjs +5 -0
- package/dist/components/ui/avatar-group/index.mjs.map +1 -0
- package/dist/components/ui/badge/badge-motion.mjs +108 -0
- package/dist/components/ui/badge/badge-motion.mjs.map +1 -0
- package/dist/components/ui/badge/badge.mjs +314 -0
- package/dist/components/ui/badge/badge.mjs.map +1 -0
- package/dist/components/ui/badge/index.mjs +27 -0
- package/dist/components/ui/badge/index.mjs.map +1 -0
- package/dist/components/ui/badge/readable-ink.mjs +36 -0
- package/dist/components/ui/badge/readable-ink.mjs.map +1 -0
- package/dist/components/ui/badge-group/badge-group.mjs +132 -0
- package/dist/components/ui/badge-group/badge-group.mjs.map +1 -0
- package/dist/components/ui/badge-group/index.mjs +5 -0
- package/dist/components/ui/badge-group/index.mjs.map +1 -0
- package/dist/components/ui/breadcrumb/breadcrumb.mjs +108 -0
- package/dist/components/ui/breadcrumb/breadcrumb.mjs.map +1 -0
- package/dist/components/ui/breadcrumb/index.mjs +19 -0
- package/dist/components/ui/breadcrumb/index.mjs.map +1 -0
- package/dist/components/ui/button/button-variants.mjs +80 -0
- package/dist/components/ui/button/button-variants.mjs.map +1 -0
- package/dist/components/ui/button/button.mjs +74 -0
- package/dist/components/ui/button/button.mjs.map +1 -0
- package/dist/components/ui/button/index.mjs +17 -0
- package/dist/components/ui/button/index.mjs.map +1 -0
- package/dist/components/ui/button/social-button.mjs +45 -0
- package/dist/components/ui/button/social-button.mjs.map +1 -0
- package/dist/components/ui/button/social-logos.mjs +179 -0
- package/dist/components/ui/button/social-logos.mjs.map +1 -0
- package/dist/components/ui/button/split-button.mjs +72 -0
- package/dist/components/ui/button/split-button.mjs.map +1 -0
- package/dist/components/ui/button-group/button-group.mjs +58 -0
- package/dist/components/ui/button-group/button-group.mjs.map +1 -0
- package/dist/components/ui/button-group/index.mjs +11 -0
- package/dist/components/ui/button-group/index.mjs.map +1 -0
- package/dist/components/ui/card/card.mjs +131 -0
- package/dist/components/ui/card/card.mjs.map +1 -0
- package/dist/components/ui/card/index.mjs +23 -0
- package/dist/components/ui/card/index.mjs.map +1 -0
- package/dist/components/ui/chart/bar-list.mjs +87 -0
- package/dist/components/ui/chart/bar-list.mjs.map +1 -0
- package/dist/components/ui/chart/chart-colors.mjs +68 -0
- package/dist/components/ui/chart/chart-colors.mjs.map +1 -0
- package/dist/components/ui/chart/chart-geometry.mjs +152 -0
- package/dist/components/ui/chart/chart-geometry.mjs.map +1 -0
- package/dist/components/ui/chart/chart-specialized.mjs +194 -0
- package/dist/components/ui/chart/chart-specialized.mjs.map +1 -0
- package/dist/components/ui/chart/chart.mjs +648 -0
- package/dist/components/ui/chart/chart.mjs.map +1 -0
- package/dist/components/ui/chart/index.mjs +88 -0
- package/dist/components/ui/chart/index.mjs.map +1 -0
- package/dist/components/ui/chart/radial-meter.mjs +142 -0
- package/dist/components/ui/chart/radial-meter.mjs.map +1 -0
- package/dist/components/ui/chart/types.mjs +1 -0
- package/dist/components/ui/chart/types.mjs.map +1 -0
- package/dist/components/ui/checkbox/checkbox.mjs +183 -0
- package/dist/components/ui/checkbox/checkbox.mjs.map +1 -0
- package/dist/components/ui/checkbox/index.mjs +11 -0
- package/dist/components/ui/checkbox/index.mjs.map +1 -0
- package/dist/components/ui/checklist/checklist.mjs +353 -0
- package/dist/components/ui/checklist/checklist.mjs.map +1 -0
- package/dist/components/ui/checklist/index.mjs +33 -0
- package/dist/components/ui/checklist/index.mjs.map +1 -0
- package/dist/components/ui/chip/chip.mjs +202 -0
- package/dist/components/ui/chip/chip.mjs.map +1 -0
- package/dist/components/ui/chip/index.mjs +13 -0
- package/dist/components/ui/chip/index.mjs.map +1 -0
- package/dist/components/ui/chip-group/chip-group.mjs +204 -0
- package/dist/components/ui/chip-group/chip-group.mjs.map +1 -0
- package/dist/components/ui/chip-group/index.mjs +11 -0
- package/dist/components/ui/chip-group/index.mjs.map +1 -0
- package/dist/components/ui/code-snippet/code-highlighter.mjs +16 -0
- package/dist/components/ui/code-snippet/code-highlighter.mjs.map +1 -0
- package/dist/components/ui/code-snippet/code-snippet.mjs +437 -0
- package/dist/components/ui/code-snippet/code-snippet.mjs.map +1 -0
- package/dist/components/ui/code-snippet/index.mjs +17 -0
- package/dist/components/ui/code-snippet/index.mjs.map +1 -0
- package/dist/components/ui/code-snippet/labels.mjs +16 -0
- package/dist/components/ui/code-snippet/labels.mjs.map +1 -0
- package/dist/components/ui/code-snippet/tokenize.mjs +715 -0
- package/dist/components/ui/code-snippet/tokenize.mjs.map +1 -0
- package/dist/components/ui/code-snippet/types.mjs +1 -0
- package/dist/components/ui/code-snippet/types.mjs.map +1 -0
- package/dist/components/ui/collapsible/collapsible.mjs +85 -0
- package/dist/components/ui/collapsible/collapsible.mjs.map +1 -0
- package/dist/components/ui/collapsible/index.mjs +15 -0
- package/dist/components/ui/collapsible/index.mjs.map +1 -0
- package/dist/components/ui/color-picker/color-picker.mjs +852 -0
- package/dist/components/ui/color-picker/color-picker.mjs.map +1 -0
- package/dist/components/ui/color-picker/index.mjs +47 -0
- package/dist/components/ui/color-picker/index.mjs.map +1 -0
- package/dist/components/ui/combobox/combobox.mjs +745 -0
- package/dist/components/ui/combobox/combobox.mjs.map +1 -0
- package/dist/components/ui/combobox/index.mjs +27 -0
- package/dist/components/ui/combobox/index.mjs.map +1 -0
- package/dist/components/ui/command/command.mjs +439 -0
- package/dist/components/ui/command/command.mjs.map +1 -0
- package/dist/components/ui/command/index.mjs +31 -0
- package/dist/components/ui/command/index.mjs.map +1 -0
- package/dist/components/ui/compare-slider/compare-slider.mjs +335 -0
- package/dist/components/ui/compare-slider/compare-slider.mjs.map +1 -0
- package/dist/components/ui/compare-slider/index.mjs +17 -0
- package/dist/components/ui/compare-slider/index.mjs.map +1 -0
- package/dist/components/ui/context-menu/context-menu.mjs +184 -0
- package/dist/components/ui/context-menu/context-menu.mjs.map +1 -0
- package/dist/components/ui/context-menu/index.mjs +37 -0
- package/dist/components/ui/context-menu/index.mjs.map +1 -0
- package/dist/components/ui/data-table/active-filters.mjs +69 -0
- package/dist/components/ui/data-table/active-filters.mjs.map +1 -0
- package/dist/components/ui/data-table/body-row.mjs +118 -0
- package/dist/components/ui/data-table/body-row.mjs.map +1 -0
- package/dist/components/ui/data-table/cards.mjs +76 -0
- package/dist/components/ui/data-table/cards.mjs.map +1 -0
- package/dist/components/ui/data-table/data-table.mjs +680 -0
- package/dist/components/ui/data-table/data-table.mjs.map +1 -0
- package/dist/components/ui/data-table/empty.mjs +26 -0
- package/dist/components/ui/data-table/empty.mjs.map +1 -0
- package/dist/components/ui/data-table/expand.mjs +70 -0
- package/dist/components/ui/data-table/expand.mjs.map +1 -0
- package/dist/components/ui/data-table/faceted-filter.mjs +112 -0
- package/dist/components/ui/data-table/faceted-filter.mjs.map +1 -0
- package/dist/components/ui/data-table/features.mjs +96 -0
- package/dist/components/ui/data-table/features.mjs.map +1 -0
- package/dist/components/ui/data-table/grip.mjs +37 -0
- package/dist/components/ui/data-table/grip.mjs.map +1 -0
- package/dist/components/ui/data-table/header-cell.mjs +85 -0
- package/dist/components/ui/data-table/header-cell.mjs.map +1 -0
- package/dist/components/ui/data-table/index.mjs +55 -0
- package/dist/components/ui/data-table/index.mjs.map +1 -0
- package/dist/components/ui/data-table/labels.mjs +55 -0
- package/dist/components/ui/data-table/labels.mjs.map +1 -0
- package/dist/components/ui/data-table/load-more.mjs +56 -0
- package/dist/components/ui/data-table/load-more.mjs.map +1 -0
- package/dist/components/ui/data-table/move-item.mjs +11 -0
- package/dist/components/ui/data-table/move-item.mjs.map +1 -0
- package/dist/components/ui/data-table/persist.mjs +65 -0
- package/dist/components/ui/data-table/persist.mjs.map +1 -0
- package/dist/components/ui/data-table/selection-bar.mjs +51 -0
- package/dist/components/ui/data-table/selection-bar.mjs.map +1 -0
- package/dist/components/ui/data-table/tabs.mjs +48 -0
- package/dist/components/ui/data-table/tabs.mjs.map +1 -0
- package/dist/components/ui/data-table/toolbar.mjs +92 -0
- package/dist/components/ui/data-table/toolbar.mjs.map +1 -0
- package/dist/components/ui/data-table/use-reorder.mjs +239 -0
- package/dist/components/ui/data-table/use-reorder.mjs.map +1 -0
- package/dist/components/ui/data-table/use-reveal.mjs +24 -0
- package/dist/components/ui/data-table/use-reveal.mjs.map +1 -0
- package/dist/components/ui/data-table/use-table-state.mjs +38 -0
- package/dist/components/ui/data-table/use-table-state.mjs.map +1 -0
- package/dist/components/ui/data-table/view-options.mjs +66 -0
- package/dist/components/ui/data-table/view-options.mjs.map +1 -0
- package/dist/components/ui/date-picker/calendar.mjs +466 -0
- package/dist/components/ui/date-picker/calendar.mjs.map +1 -0
- package/dist/components/ui/date-picker/date-picker.mjs +366 -0
- package/dist/components/ui/date-picker/date-picker.mjs.map +1 -0
- package/dist/components/ui/date-picker/index.mjs +17 -0
- package/dist/components/ui/date-picker/index.mjs.map +1 -0
- package/dist/components/ui/date-picker/presets.mjs +49 -0
- package/dist/components/ui/date-picker/presets.mjs.map +1 -0
- package/dist/components/ui/description-list/description-list.mjs +40 -0
- package/dist/components/ui/description-list/description-list.mjs.map +1 -0
- package/dist/components/ui/description-list/index.mjs +15 -0
- package/dist/components/ui/description-list/index.mjs.map +1 -0
- package/dist/components/ui/dialog/dialog-stepper.mjs +23 -0
- package/dist/components/ui/dialog/dialog-stepper.mjs.map +1 -0
- package/dist/components/ui/dialog/dialog.mjs +343 -0
- package/dist/components/ui/dialog/dialog.mjs.map +1 -0
- package/dist/components/ui/dialog/focus-return.mjs +21 -0
- package/dist/components/ui/dialog/focus-return.mjs.map +1 -0
- package/dist/components/ui/dialog/index.mjs +33 -0
- package/dist/components/ui/dialog/index.mjs.map +1 -0
- package/dist/components/ui/divider/divider.mjs +130 -0
- package/dist/components/ui/divider/divider.mjs.map +1 -0
- package/dist/components/ui/divider/index.mjs +6 -0
- package/dist/components/ui/divider/index.mjs.map +1 -0
- package/dist/components/ui/dock/dock.mjs +444 -0
- package/dist/components/ui/dock/dock.mjs.map +1 -0
- package/dist/components/ui/dock/index.mjs +19 -0
- package/dist/components/ui/dock/index.mjs.map +1 -0
- package/dist/components/ui/document-editor/block-actions.mjs +118 -0
- package/dist/components/ui/document-editor/block-actions.mjs.map +1 -0
- package/dist/components/ui/document-editor/block-commands.mjs +182 -0
- package/dist/components/ui/document-editor/block-commands.mjs.map +1 -0
- package/dist/components/ui/document-editor/block-handle.mjs +387 -0
- package/dist/components/ui/document-editor/block-handle.mjs.map +1 -0
- package/dist/components/ui/document-editor/block-morph.mjs +95 -0
- package/dist/components/ui/document-editor/block-morph.mjs.map +1 -0
- package/dist/components/ui/document-editor/block-selection.mjs +81 -0
- package/dist/components/ui/document-editor/block-selection.mjs.map +1 -0
- package/dist/components/ui/document-editor/blocks.mjs +30 -0
- package/dist/components/ui/document-editor/blocks.mjs.map +1 -0
- package/dist/components/ui/document-editor/bubble-menu.mjs +120 -0
- package/dist/components/ui/document-editor/bubble-menu.mjs.map +1 -0
- package/dist/components/ui/document-editor/code-block.mjs +89 -0
- package/dist/components/ui/document-editor/code-block.mjs.map +1 -0
- package/dist/components/ui/document-editor/collaboration-types.mjs +9 -0
- package/dist/components/ui/document-editor/collaboration-types.mjs.map +1 -0
- package/dist/components/ui/document-editor/collaboration.mjs +198 -0
- package/dist/components/ui/document-editor/collaboration.mjs.map +1 -0
- package/dist/components/ui/document-editor/columns.mjs +52 -0
- package/dist/components/ui/document-editor/columns.mjs.map +1 -0
- package/dist/components/ui/document-editor/contents.mjs +60 -0
- package/dist/components/ui/document-editor/contents.mjs.map +1 -0
- package/dist/components/ui/document-editor/date-chip.mjs +115 -0
- package/dist/components/ui/document-editor/date-chip.mjs.map +1 -0
- package/dist/components/ui/document-editor/date-words.mjs +101 -0
- package/dist/components/ui/document-editor/date-words.mjs.map +1 -0
- package/dist/components/ui/document-editor/doc-labels.mjs +19 -0
- package/dist/components/ui/document-editor/doc-labels.mjs.map +1 -0
- package/dist/components/ui/document-editor/document-editor.mjs +496 -0
- package/dist/components/ui/document-editor/document-editor.mjs.map +1 -0
- package/dist/components/ui/document-editor/emoji-suggest.mjs +81 -0
- package/dist/components/ui/document-editor/emoji-suggest.mjs.map +1 -0
- package/dist/components/ui/document-editor/focus-mode.mjs +32 -0
- package/dist/components/ui/document-editor/focus-mode.mjs.map +1 -0
- package/dist/components/ui/document-editor/geometry.mjs +35 -0
- package/dist/components/ui/document-editor/geometry.mjs.map +1 -0
- package/dist/components/ui/document-editor/ghost-text.mjs +154 -0
- package/dist/components/ui/document-editor/ghost-text.mjs.map +1 -0
- package/dist/components/ui/document-editor/gliding-caret.mjs +118 -0
- package/dist/components/ui/document-editor/gliding-caret.mjs.map +1 -0
- package/dist/components/ui/document-editor/headings.mjs +64 -0
- package/dist/components/ui/document-editor/headings.mjs.map +1 -0
- package/dist/components/ui/document-editor/image.mjs +318 -0
- package/dist/components/ui/document-editor/image.mjs.map +1 -0
- package/dist/components/ui/document-editor/index.mjs +131 -0
- package/dist/components/ui/document-editor/index.mjs.map +1 -0
- package/dist/components/ui/document-editor/labels.mjs +96 -0
- package/dist/components/ui/document-editor/labels.mjs.map +1 -0
- package/dist/components/ui/document-editor/link-card.mjs +138 -0
- package/dist/components/ui/document-editor/link-card.mjs.map +1 -0
- package/dist/components/ui/document-editor/mentions.mjs +105 -0
- package/dist/components/ui/document-editor/mentions.mjs.map +1 -0
- package/dist/components/ui/document-editor/outline.mjs +138 -0
- package/dist/components/ui/document-editor/outline.mjs.map +1 -0
- package/dist/components/ui/document-editor/section-fold.mjs +124 -0
- package/dist/components/ui/document-editor/section-fold.mjs.map +1 -0
- package/dist/components/ui/document-editor/slash-command.mjs +210 -0
- package/dist/components/ui/document-editor/slash-command.mjs.map +1 -0
- package/dist/components/ui/document-editor/suggest-list.mjs +187 -0
- package/dist/components/ui/document-editor/suggest-list.mjs.map +1 -0
- package/dist/components/ui/document-editor/table.mjs +242 -0
- package/dist/components/ui/document-editor/table.mjs.map +1 -0
- package/dist/components/ui/document-editor/templates.mjs +66 -0
- package/dist/components/ui/document-editor/templates.mjs.map +1 -0
- package/dist/components/ui/document-editor/toggle.mjs +176 -0
- package/dist/components/ui/document-editor/toggle.mjs.map +1 -0
- package/dist/components/ui/document-editor/typography-rules.mjs +8 -0
- package/dist/components/ui/document-editor/typography-rules.mjs.map +1 -0
- package/dist/components/ui/document-editor/use-editor-value.mjs +34 -0
- package/dist/components/ui/document-editor/use-editor-value.mjs.map +1 -0
- package/dist/components/ui/drawer/drawer-nav.mjs +153 -0
- package/dist/components/ui/drawer/drawer-nav.mjs.map +1 -0
- package/dist/components/ui/drawer/drawer.mjs +334 -0
- package/dist/components/ui/drawer/drawer.mjs.map +1 -0
- package/dist/components/ui/drawer/index.mjs +37 -0
- package/dist/components/ui/drawer/index.mjs.map +1 -0
- package/dist/components/ui/drawer/use-swipe-to-close.mjs +77 -0
- package/dist/components/ui/drawer/use-swipe-to-close.mjs.map +1 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.mjs +567 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.mjs.map +1 -0
- package/dist/components/ui/dropdown-menu/index.mjs +43 -0
- package/dist/components/ui/dropdown-menu/index.mjs.map +1 -0
- package/dist/components/ui/editable-text/editable-text.mjs +148 -0
- package/dist/components/ui/editable-text/editable-text.mjs.map +1 -0
- package/dist/components/ui/editable-text/index.mjs +6 -0
- package/dist/components/ui/editable-text/index.mjs.map +1 -0
- package/dist/components/ui/emoji-picker/emoji-data.mjs +469 -0
- package/dist/components/ui/emoji-picker/emoji-data.mjs.map +1 -0
- package/dist/components/ui/emoji-picker/emoji-picker.mjs +464 -0
- package/dist/components/ui/emoji-picker/emoji-picker.mjs.map +1 -0
- package/dist/components/ui/emoji-picker/index.mjs +19 -0
- package/dist/components/ui/emoji-picker/index.mjs.map +1 -0
- package/dist/components/ui/empty-state/empty-state.mjs +110 -0
- package/dist/components/ui/empty-state/empty-state.mjs.map +1 -0
- package/dist/components/ui/empty-state/index.mjs +17 -0
- package/dist/components/ui/empty-state/index.mjs.map +1 -0
- package/dist/components/ui/event-calendar/calendar-math.mjs +256 -0
- package/dist/components/ui/event-calendar/calendar-math.mjs.map +1 -0
- package/dist/components/ui/event-calendar/context.mjs +51 -0
- package/dist/components/ui/event-calendar/context.mjs.map +1 -0
- package/dist/components/ui/event-calendar/editor.mjs +292 -0
- package/dist/components/ui/event-calendar/editor.mjs.map +1 -0
- package/dist/components/ui/event-calendar/event-block.mjs +55 -0
- package/dist/components/ui/event-calendar/event-block.mjs.map +1 -0
- package/dist/components/ui/event-calendar/event-calendar.mjs +438 -0
- package/dist/components/ui/event-calendar/event-calendar.mjs.map +1 -0
- package/dist/components/ui/event-calendar/event-keys.mjs +41 -0
- package/dist/components/ui/event-calendar/event-keys.mjs.map +1 -0
- package/dist/components/ui/event-calendar/index.mjs +37 -0
- package/dist/components/ui/event-calendar/index.mjs.map +1 -0
- package/dist/components/ui/event-calendar/month-grid.mjs +207 -0
- package/dist/components/ui/event-calendar/month-grid.mjs.map +1 -0
- package/dist/components/ui/event-calendar/narrow.mjs +193 -0
- package/dist/components/ui/event-calendar/narrow.mjs.map +1 -0
- package/dist/components/ui/event-calendar/time-grid.mjs +534 -0
- package/dist/components/ui/event-calendar/time-grid.mjs.map +1 -0
- package/dist/components/ui/expandable-search/expandable-search.mjs +174 -0
- package/dist/components/ui/expandable-search/expandable-search.mjs.map +1 -0
- package/dist/components/ui/expandable-search/index.mjs +6 -0
- package/dist/components/ui/expandable-search/index.mjs.map +1 -0
- package/dist/components/ui/field/field.mjs +444 -0
- package/dist/components/ui/field/field.mjs.map +1 -0
- package/dist/components/ui/field/index.mjs +21 -0
- package/dist/components/ui/field/index.mjs.map +1 -0
- package/dist/components/ui/file-card/file-card.mjs +198 -0
- package/dist/components/ui/file-card/file-card.mjs.map +1 -0
- package/dist/components/ui/file-card/file-icon.mjs +66 -0
- package/dist/components/ui/file-card/file-icon.mjs.map +1 -0
- package/dist/components/ui/file-card/file-types.mjs +70 -0
- package/dist/components/ui/file-card/file-types.mjs.map +1 -0
- package/dist/components/ui/file-card/index.mjs +32 -0
- package/dist/components/ui/file-card/index.mjs.map +1 -0
- package/dist/components/ui/file-preview/context.mjs +77 -0
- package/dist/components/ui/file-preview/context.mjs.map +1 -0
- package/dist/components/ui/file-preview/file-preview.mjs +865 -0
- package/dist/components/ui/file-preview/file-preview.mjs.map +1 -0
- package/dist/components/ui/file-preview/index.mjs +56 -0
- package/dist/components/ui/file-preview/index.mjs.map +1 -0
- package/dist/components/ui/file-preview/pdf.mjs +250 -0
- package/dist/components/ui/file-preview/pdf.mjs.map +1 -0
- package/dist/components/ui/file-preview/renderers.mjs +257 -0
- package/dist/components/ui/file-preview/renderers.mjs.map +1 -0
- package/dist/components/ui/file-upload/file-upload.mjs +633 -0
- package/dist/components/ui/file-upload/file-upload.mjs.map +1 -0
- package/dist/components/ui/file-upload/index.mjs +42 -0
- package/dist/components/ui/file-upload/index.mjs.map +1 -0
- package/dist/components/ui/file-upload/validate.mjs +111 -0
- package/dist/components/ui/file-upload/validate.mjs.map +1 -0
- package/dist/components/ui/flag/flag.mjs +39 -0
- package/dist/components/ui/flag/flag.mjs.map +1 -0
- package/dist/components/ui/flag/index.mjs +7 -0
- package/dist/components/ui/flag/index.mjs.map +1 -0
- package/dist/components/ui/floating-window/floating-window.mjs +255 -0
- package/dist/components/ui/floating-window/floating-window.mjs.map +1 -0
- package/dist/components/ui/floating-window/index.mjs +11 -0
- package/dist/components/ui/floating-window/index.mjs.map +1 -0
- package/dist/components/ui/form/form-section.mjs +87 -0
- package/dist/components/ui/form/form-section.mjs.map +1 -0
- package/dist/components/ui/form/form.mjs +205 -0
- package/dist/components/ui/form/form.mjs.map +1 -0
- package/dist/components/ui/form/index.mjs +29 -0
- package/dist/components/ui/form/index.mjs.map +1 -0
- package/dist/components/ui/globe/globe-data.mjs +9 -0
- package/dist/components/ui/globe/globe-data.mjs.map +1 -0
- package/dist/components/ui/globe/globe-math.mjs +269 -0
- package/dist/components/ui/globe/globe-math.mjs.map +1 -0
- package/dist/components/ui/globe/globe.mjs +719 -0
- package/dist/components/ui/globe/globe.mjs.map +1 -0
- package/dist/components/ui/globe/index.mjs +13 -0
- package/dist/components/ui/globe/index.mjs.map +1 -0
- package/dist/components/ui/highlight-match/highlight-children.mjs +13 -0
- package/dist/components/ui/highlight-match/highlight-children.mjs.map +1 -0
- package/dist/components/ui/highlight-match/highlight-match-variants.mjs +17 -0
- package/dist/components/ui/highlight-match/highlight-match-variants.mjs.map +1 -0
- package/dist/components/ui/highlight-match/highlight-match.mjs +37 -0
- package/dist/components/ui/highlight-match/highlight-match.mjs.map +1 -0
- package/dist/components/ui/highlight-match/index.mjs +15 -0
- package/dist/components/ui/highlight-match/index.mjs.map +1 -0
- package/dist/components/ui/highlight-match/match-ranges.mjs +50 -0
- package/dist/components/ui/highlight-match/match-ranges.mjs.map +1 -0
- package/dist/components/ui/histogram-slider/histogram-slider.mjs +83 -0
- package/dist/components/ui/histogram-slider/histogram-slider.mjs.map +1 -0
- package/dist/components/ui/histogram-slider/index.mjs +6 -0
- package/dist/components/ui/histogram-slider/index.mjs.map +1 -0
- package/dist/components/ui/hold-button/hold-button.mjs +258 -0
- package/dist/components/ui/hold-button/hold-button.mjs.map +1 -0
- package/dist/components/ui/hold-button/index.mjs +6 -0
- package/dist/components/ui/hold-button/index.mjs.map +1 -0
- package/dist/components/ui/hover-card/hover-card.mjs +111 -0
- package/dist/components/ui/hover-card/hover-card.mjs.map +1 -0
- package/dist/components/ui/hover-card/index.mjs +21 -0
- package/dist/components/ui/hover-card/index.mjs.map +1 -0
- package/dist/components/ui/ink-tray/index.mjs +29 -0
- package/dist/components/ui/ink-tray/index.mjs.map +1 -0
- package/dist/components/ui/ink-tray/ink-tray-art.mjs +68 -0
- package/dist/components/ui/ink-tray/ink-tray-art.mjs.map +1 -0
- package/dist/components/ui/ink-tray/ink-tray.mjs +350 -0
- package/dist/components/ui/ink-tray/ink-tray.mjs.map +1 -0
- package/dist/components/ui/input/index.mjs +41 -0
- package/dist/components/ui/input/index.mjs.map +1 -0
- package/dist/components/ui/input/input.mjs +268 -0
- package/dist/components/ui/input/input.mjs.map +1 -0
- package/dist/components/ui/input/number-input.mjs +272 -0
- package/dist/components/ui/input/number-input.mjs.map +1 -0
- package/dist/components/ui/input/password-input.mjs +49 -0
- package/dist/components/ui/input/password-input.mjs.map +1 -0
- package/dist/components/ui/input/phone-input-countries.mjs +216 -0
- package/dist/components/ui/input/phone-input-countries.mjs.map +1 -0
- package/dist/components/ui/input/phone-input.mjs +326 -0
- package/dist/components/ui/input/phone-input.mjs.map +1 -0
- package/dist/components/ui/input/use-controllable-state.mjs +24 -0
- package/dist/components/ui/input/use-controllable-state.mjs.map +1 -0
- package/dist/components/ui/input/use-hold-repeat.mjs +35 -0
- package/dist/components/ui/input/use-hold-repeat.mjs.map +1 -0
- package/dist/components/ui/input-group/index.mjs +11 -0
- package/dist/components/ui/input-group/index.mjs.map +1 -0
- package/dist/components/ui/input-group/input-group.mjs +78 -0
- package/dist/components/ui/input-group/input-group.mjs.map +1 -0
- package/dist/components/ui/island/index.mjs +23 -0
- package/dist/components/ui/island/index.mjs.map +1 -0
- package/dist/components/ui/island/island.mjs +328 -0
- package/dist/components/ui/island/island.mjs.map +1 -0
- package/dist/components/ui/kbd/index.mjs +6 -0
- package/dist/components/ui/kbd/index.mjs.map +1 -0
- package/dist/components/ui/kbd/kbd.mjs +73 -0
- package/dist/components/ui/kbd/kbd.mjs.map +1 -0
- package/dist/components/ui/keypad/index.mjs +23 -0
- package/dist/components/ui/keypad/index.mjs.map +1 -0
- package/dist/components/ui/keypad/keypad.mjs +345 -0
- package/dist/components/ui/keypad/keypad.mjs.map +1 -0
- package/dist/components/ui/label/index.mjs +7 -0
- package/dist/components/ui/label/index.mjs.map +1 -0
- package/dist/components/ui/label/label.mjs +117 -0
- package/dist/components/ui/label/label.mjs.map +1 -0
- package/dist/components/ui/lightbox/index.mjs +47 -0
- package/dist/components/ui/lightbox/index.mjs.map +1 -0
- package/dist/components/ui/lightbox/labels.mjs +23 -0
- package/dist/components/ui/lightbox/labels.mjs.map +1 -0
- package/dist/components/ui/lightbox/lightbox.mjs +1359 -0
- package/dist/components/ui/lightbox/lightbox.mjs.map +1 -0
- package/dist/components/ui/link/index.mjs +6 -0
- package/dist/components/ui/link/index.mjs.map +1 -0
- package/dist/components/ui/link/link.mjs +64 -0
- package/dist/components/ui/link/link.mjs.map +1 -0
- package/dist/components/ui/list/index.mjs +35 -0
- package/dist/components/ui/list/index.mjs.map +1 -0
- package/dist/components/ui/list/list.mjs +505 -0
- package/dist/components/ui/list/list.mjs.map +1 -0
- package/dist/components/ui/load-more/index.mjs +23 -0
- package/dist/components/ui/load-more/index.mjs.map +1 -0
- package/dist/components/ui/load-more/load-more.mjs +409 -0
- package/dist/components/ui/load-more/load-more.mjs.map +1 -0
- package/dist/components/ui/map/index.mjs +27 -0
- package/dist/components/ui/map/index.mjs.map +1 -0
- package/dist/components/ui/map/map-style.mjs +169 -0
- package/dist/components/ui/map/map-style.mjs.map +1 -0
- package/dist/components/ui/map/map.mjs +624 -0
- package/dist/components/ui/map/map.mjs.map +1 -0
- package/dist/components/ui/map-pin/index.mjs +6 -0
- package/dist/components/ui/map-pin/index.mjs.map +1 -0
- package/dist/components/ui/map-pin/map-pin.mjs +55 -0
- package/dist/components/ui/map-pin/map-pin.mjs.map +1 -0
- package/dist/components/ui/mention/index.mjs +29 -0
- package/dist/components/ui/mention/index.mjs.map +1 -0
- package/dist/components/ui/mention/mention.mjs +262 -0
- package/dist/components/ui/mention/mention.mjs.map +1 -0
- package/dist/components/ui/mention/split-mentions.mjs +24 -0
- package/dist/components/ui/mention/split-mentions.mjs.map +1 -0
- package/dist/components/ui/menubar/index.mjs +39 -0
- package/dist/components/ui/menubar/index.mjs.map +1 -0
- package/dist/components/ui/menubar/menubar.mjs +222 -0
- package/dist/components/ui/menubar/menubar.mjs.map +1 -0
- package/dist/components/ui/meter/index.mjs +21 -0
- package/dist/components/ui/meter/index.mjs.map +1 -0
- package/dist/components/ui/meter/meter.mjs +167 -0
- package/dist/components/ui/meter/meter.mjs.map +1 -0
- package/dist/components/ui/multi-select/index.mjs +25 -0
- package/dist/components/ui/multi-select/index.mjs.map +1 -0
- package/dist/components/ui/multi-select/multi-select.mjs +285 -0
- package/dist/components/ui/multi-select/multi-select.mjs.map +1 -0
- package/dist/components/ui/navigation-menu/index.mjs +41 -0
- package/dist/components/ui/navigation-menu/index.mjs.map +1 -0
- package/dist/components/ui/navigation-menu/navigation-menu.mjs +396 -0
- package/dist/components/ui/navigation-menu/navigation-menu.mjs.map +1 -0
- package/dist/components/ui/notebook-page/index.mjs +15 -0
- package/dist/components/ui/notebook-page/index.mjs.map +1 -0
- package/dist/components/ui/notebook-page/notebook-page.mjs +162 -0
- package/dist/components/ui/notebook-page/notebook-page.mjs.map +1 -0
- package/dist/components/ui/notification-inbox/index.mjs +47 -0
- package/dist/components/ui/notification-inbox/index.mjs.map +1 -0
- package/dist/components/ui/notification-inbox/notification-inbox.mjs +422 -0
- package/dist/components/ui/notification-inbox/notification-inbox.mjs.map +1 -0
- package/dist/components/ui/number-field/index.mjs +24 -0
- package/dist/components/ui/number-field/index.mjs.map +1 -0
- package/dist/components/ui/number-field/number-field.mjs +460 -0
- package/dist/components/ui/number-field/number-field.mjs.map +1 -0
- package/dist/components/ui/number-field/number-format.mjs +48 -0
- package/dist/components/ui/number-field/number-format.mjs.map +1 -0
- package/dist/components/ui/otp-input/index.mjs +9 -0
- package/dist/components/ui/otp-input/index.mjs.map +1 -0
- package/dist/components/ui/otp-input/otp-input.mjs +285 -0
- package/dist/components/ui/otp-input/otp-input.mjs.map +1 -0
- package/dist/components/ui/pager/index.mjs +7 -0
- package/dist/components/ui/pager/index.mjs.map +1 -0
- package/dist/components/ui/pager/pager.mjs +86 -0
- package/dist/components/ui/pager/pager.mjs.map +1 -0
- package/dist/components/ui/pagination/index.mjs +23 -0
- package/dist/components/ui/pagination/index.mjs.map +1 -0
- package/dist/components/ui/pagination/pagination.mjs +210 -0
- package/dist/components/ui/pagination/pagination.mjs.map +1 -0
- package/dist/components/ui/password-strength/index.mjs +21 -0
- package/dist/components/ui/password-strength/index.mjs.map +1 -0
- package/dist/components/ui/password-strength/password-rules.mjs +25 -0
- package/dist/components/ui/password-strength/password-rules.mjs.map +1 -0
- package/dist/components/ui/password-strength/password-strength.mjs +125 -0
- package/dist/components/ui/password-strength/password-strength.mjs.map +1 -0
- package/dist/components/ui/popover/index.mjs +31 -0
- package/dist/components/ui/popover/index.mjs.map +1 -0
- package/dist/components/ui/popover/popover.mjs +574 -0
- package/dist/components/ui/popover/popover.mjs.map +1 -0
- package/dist/components/ui/progress/index.mjs +15 -0
- package/dist/components/ui/progress/index.mjs.map +1 -0
- package/dist/components/ui/progress/progress.mjs +224 -0
- package/dist/components/ui/progress/progress.mjs.map +1 -0
- package/dist/components/ui/prose/index.mjs +6 -0
- package/dist/components/ui/prose/index.mjs.map +1 -0
- package/dist/components/ui/prose/prose.mjs +89 -0
- package/dist/components/ui/prose/prose.mjs.map +1 -0
- package/dist/components/ui/radio-group/index.mjs +15 -0
- package/dist/components/ui/radio-group/index.mjs.map +1 -0
- package/dist/components/ui/radio-group/radio-group.mjs +88 -0
- package/dist/components/ui/radio-group/radio-group.mjs.map +1 -0
- package/dist/components/ui/rating/index.mjs +6 -0
- package/dist/components/ui/rating/index.mjs.map +1 -0
- package/dist/components/ui/rating/rating.mjs +119 -0
- package/dist/components/ui/rating/rating.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/bubble-menu.mjs +120 -0
- package/dist/components/ui/rich-text-editor/bubble-menu.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/image-links.mjs +63 -0
- package/dist/components/ui/rich-text-editor/image-links.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/index.mjs +37 -0
- package/dist/components/ui/rich-text-editor/index.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/labels.mjs +27 -0
- package/dist/components/ui/rich-text-editor/labels.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/rich-text-editor.mjs +149 -0
- package/dist/components/ui/rich-text-editor/rich-text-editor.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/toolbar.mjs +325 -0
- package/dist/components/ui/rich-text-editor/toolbar.mjs.map +1 -0
- package/dist/components/ui/save-bar/index.mjs +13 -0
- package/dist/components/ui/save-bar/index.mjs.map +1 -0
- package/dist/components/ui/save-bar/save-bar.mjs +59 -0
- package/dist/components/ui/save-bar/save-bar.mjs.map +1 -0
- package/dist/components/ui/scroll-area/index.mjs +6 -0
- package/dist/components/ui/scroll-area/index.mjs.map +1 -0
- package/dist/components/ui/scroll-area/scroll-area.mjs +148 -0
- package/dist/components/ui/scroll-area/scroll-area.mjs.map +1 -0
- package/dist/components/ui/scroll-area/use-drag-scroll.mjs +134 -0
- package/dist/components/ui/scroll-area/use-drag-scroll.mjs.map +1 -0
- package/dist/components/ui/select/index.mjs +23 -0
- package/dist/components/ui/select/index.mjs.map +1 -0
- package/dist/components/ui/select/select.mjs +216 -0
- package/dist/components/ui/select/select.mjs.map +1 -0
- package/dist/components/ui/sheet/index.mjs +23 -0
- package/dist/components/ui/sheet/index.mjs.map +1 -0
- package/dist/components/ui/sheet/sheet.mjs +292 -0
- package/dist/components/ui/sheet/sheet.mjs.map +1 -0
- package/dist/components/ui/sidebar/index.mjs +122 -0
- package/dist/components/ui/sidebar/index.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-group.mjs +75 -0
- package/dist/components/ui/sidebar/sidebar-group.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-item.mjs +199 -0
- package/dist/components/ui/sidebar/sidebar-item.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-panels.mjs +182 -0
- package/dist/components/ui/sidebar/sidebar-panels.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-peek.mjs +324 -0
- package/dist/components/ui/sidebar/sidebar-peek.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-rich.mjs +65 -0
- package/dist/components/ui/sidebar/sidebar-rich.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-tree.mjs +224 -0
- package/dist/components/ui/sidebar/sidebar-tree.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar.mjs +205 -0
- package/dist/components/ui/sidebar/sidebar.mjs.map +1 -0
- package/dist/components/ui/sidebar/variants.mjs +396 -0
- package/dist/components/ui/sidebar/variants.mjs.map +1 -0
- package/dist/components/ui/signature/index.mjs +6 -0
- package/dist/components/ui/signature/index.mjs.map +1 -0
- package/dist/components/ui/signature/signature.mjs +145 -0
- package/dist/components/ui/signature/signature.mjs.map +1 -0
- package/dist/components/ui/signature-pad/index.mjs +19 -0
- package/dist/components/ui/signature-pad/index.mjs.map +1 -0
- package/dist/components/ui/signature-pad/signature-pad.mjs +210 -0
- package/dist/components/ui/signature-pad/signature-pad.mjs.map +1 -0
- package/dist/components/ui/signature-pad/strokes.mjs +68 -0
- package/dist/components/ui/signature-pad/strokes.mjs.map +1 -0
- package/dist/components/ui/skeleton/index.mjs +9 -0
- package/dist/components/ui/skeleton/index.mjs.map +1 -0
- package/dist/components/ui/skeleton/skeleton.mjs +58 -0
- package/dist/components/ui/skeleton/skeleton.mjs.map +1 -0
- package/dist/components/ui/slide/index.mjs +25 -0
- package/dist/components/ui/slide/index.mjs.map +1 -0
- package/dist/components/ui/slide/slide.mjs +159 -0
- package/dist/components/ui/slide/slide.mjs.map +1 -0
- package/dist/components/ui/slider/index.mjs +21 -0
- package/dist/components/ui/slider/index.mjs.map +1 -0
- package/dist/components/ui/slider/slider-input.mjs +449 -0
- package/dist/components/ui/slider/slider-input.mjs.map +1 -0
- package/dist/components/ui/slider/slider.mjs +235 -0
- package/dist/components/ui/slider/slider.mjs.map +1 -0
- package/dist/components/ui/slides/index.mjs +31 -0
- package/dist/components/ui/slides/index.mjs.map +1 -0
- package/dist/components/ui/slides/slides.mjs +890 -0
- package/dist/components/ui/slides/slides.mjs.map +1 -0
- package/dist/components/ui/smooth-anchors/index.mjs +17 -0
- package/dist/components/ui/smooth-anchors/index.mjs.map +1 -0
- package/dist/components/ui/smooth-anchors/smooth-anchors.mjs +75 -0
- package/dist/components/ui/smooth-anchors/smooth-anchors.mjs.map +1 -0
- package/dist/components/ui/smooth-anchors/smooth-scroll.mjs +87 -0
- package/dist/components/ui/smooth-anchors/smooth-scroll.mjs.map +1 -0
- package/dist/components/ui/spinner/index.mjs +6 -0
- package/dist/components/ui/spinner/index.mjs.map +1 -0
- package/dist/components/ui/spinner/spinner.mjs +49 -0
- package/dist/components/ui/spinner/spinner.mjs.map +1 -0
- package/dist/components/ui/stat/index.mjs +29 -0
- package/dist/components/ui/stat/index.mjs.map +1 -0
- package/dist/components/ui/stat/stat.mjs +226 -0
- package/dist/components/ui/stat/stat.mjs.map +1 -0
- package/dist/components/ui/status-bar/index.mjs +17 -0
- package/dist/components/ui/status-bar/index.mjs.map +1 -0
- package/dist/components/ui/status-bar/status-bar.mjs +96 -0
- package/dist/components/ui/status-bar/status-bar.mjs.map +1 -0
- package/dist/components/ui/stepper/index.mjs +25 -0
- package/dist/components/ui/stepper/index.mjs.map +1 -0
- package/dist/components/ui/stepper/stepper.mjs +235 -0
- package/dist/components/ui/stepper/stepper.mjs.map +1 -0
- package/dist/components/ui/steps/index.mjs +9 -0
- package/dist/components/ui/steps/index.mjs.map +1 -0
- package/dist/components/ui/steps/steps.mjs +70 -0
- package/dist/components/ui/steps/steps.mjs.map +1 -0
- package/dist/components/ui/swatch-grid/index.mjs +7 -0
- package/dist/components/ui/swatch-grid/index.mjs.map +1 -0
- package/dist/components/ui/swatch-grid/swatch-grid.mjs +110 -0
- package/dist/components/ui/swatch-grid/swatch-grid.mjs.map +1 -0
- package/dist/components/ui/switch/index.mjs +7 -0
- package/dist/components/ui/switch/index.mjs.map +1 -0
- package/dist/components/ui/switch/switch.mjs +79 -0
- package/dist/components/ui/switch/switch.mjs.map +1 -0
- package/dist/components/ui/tab-strip/index.mjs +13 -0
- package/dist/components/ui/tab-strip/index.mjs.map +1 -0
- package/dist/components/ui/tab-strip/tab-strip.mjs +244 -0
- package/dist/components/ui/tab-strip/tab-strip.mjs.map +1 -0
- package/dist/components/ui/table/index.mjs +27 -0
- package/dist/components/ui/table/index.mjs.map +1 -0
- package/dist/components/ui/table/table.mjs +290 -0
- package/dist/components/ui/table/table.mjs.map +1 -0
- package/dist/components/ui/table-of-contents/index.mjs +20 -0
- package/dist/components/ui/table-of-contents/index.mjs.map +1 -0
- package/dist/components/ui/table-of-contents/scroll-spy.mjs +60 -0
- package/dist/components/ui/table-of-contents/scroll-spy.mjs.map +1 -0
- package/dist/components/ui/table-of-contents/table-of-contents.mjs +371 -0
- package/dist/components/ui/table-of-contents/table-of-contents.mjs.map +1 -0
- package/dist/components/ui/table-of-contents/use-headings.mjs +40 -0
- package/dist/components/ui/table-of-contents/use-headings.mjs.map +1 -0
- package/dist/components/ui/tablet-frame/index.mjs +7 -0
- package/dist/components/ui/tablet-frame/index.mjs.map +1 -0
- package/dist/components/ui/tablet-frame/tablet-frame.mjs +48 -0
- package/dist/components/ui/tablet-frame/tablet-frame.mjs.map +1 -0
- package/dist/components/ui/tabs/index.mjs +25 -0
- package/dist/components/ui/tabs/index.mjs.map +1 -0
- package/dist/components/ui/tabs/tabs.mjs +382 -0
- package/dist/components/ui/tabs/tabs.mjs.map +1 -0
- package/dist/components/ui/tabs/use-tabs-indicator.mjs +90 -0
- package/dist/components/ui/tabs/use-tabs-indicator.mjs.map +1 -0
- package/dist/components/ui/tags-input/index.mjs +9 -0
- package/dist/components/ui/tags-input/index.mjs.map +1 -0
- package/dist/components/ui/tags-input/split.mjs +38 -0
- package/dist/components/ui/tags-input/split.mjs.map +1 -0
- package/dist/components/ui/tags-input/tags-input.mjs +328 -0
- package/dist/components/ui/tags-input/tags-input.mjs.map +1 -0
- package/dist/components/ui/terminal/index.mjs +41 -0
- package/dist/components/ui/terminal/index.mjs.map +1 -0
- package/dist/components/ui/terminal/terminal.mjs +287 -0
- package/dist/components/ui/terminal/terminal.mjs.map +1 -0
- package/dist/components/ui/textarea/index.mjs +21 -0
- package/dist/components/ui/textarea/index.mjs.map +1 -0
- package/dist/components/ui/textarea/textarea.mjs +244 -0
- package/dist/components/ui/textarea/textarea.mjs.map +1 -0
- package/dist/components/ui/theme-provider/index.mjs +6 -0
- package/dist/components/ui/theme-provider/index.mjs.map +1 -0
- package/dist/components/ui/theme-provider/theme-provider.mjs +70 -0
- package/dist/components/ui/theme-provider/theme-provider.mjs.map +1 -0
- package/dist/components/ui/toast/index.mjs +19 -0
- package/dist/components/ui/toast/index.mjs.map +1 -0
- package/dist/components/ui/toast/store.mjs +96 -0
- package/dist/components/ui/toast/store.mjs.map +1 -0
- package/dist/components/ui/toast/toast.mjs +395 -0
- package/dist/components/ui/toast/toast.mjs.map +1 -0
- package/dist/components/ui/toggle/index.mjs +13 -0
- package/dist/components/ui/toggle/index.mjs.map +1 -0
- package/dist/components/ui/toggle/toggle.mjs +123 -0
- package/dist/components/ui/toggle/toggle.mjs.map +1 -0
- package/dist/components/ui/toggle-group/index.mjs +11 -0
- package/dist/components/ui/toggle-group/index.mjs.map +1 -0
- package/dist/components/ui/toggle-group/toggle-group.mjs +243 -0
- package/dist/components/ui/toggle-group/toggle-group.mjs.map +1 -0
- package/dist/components/ui/toggletip/index.mjs +6 -0
- package/dist/components/ui/toggletip/index.mjs.map +1 -0
- package/dist/components/ui/toggletip/toggletip.mjs +95 -0
- package/dist/components/ui/toggletip/toggletip.mjs.map +1 -0
- package/dist/components/ui/toolbar/index.mjs +21 -0
- package/dist/components/ui/toolbar/index.mjs.map +1 -0
- package/dist/components/ui/toolbar/toolbar.mjs +130 -0
- package/dist/components/ui/toolbar/toolbar.mjs.map +1 -0
- package/dist/components/ui/tooltip/index.mjs +29 -0
- package/dist/components/ui/tooltip/index.mjs.map +1 -0
- package/dist/components/ui/tooltip/tooltip.mjs +640 -0
- package/dist/components/ui/tooltip/tooltip.mjs.map +1 -0
- package/dist/components/ui/tree/index.mjs +11 -0
- package/dist/components/ui/tree/index.mjs.map +1 -0
- package/dist/components/ui/tree/tree.mjs +450 -0
- package/dist/components/ui/tree/tree.mjs.map +1 -0
- package/dist/index.d.mts +19397 -0
- package/dist/index.mjs +157 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/color.mjs +78 -0
- package/dist/lib/color.mjs.map +1 -0
- package/dist/lib/create-context.mjs +31 -0
- package/dist/lib/create-context.mjs.map +1 -0
- package/dist/lib/date.mjs +116 -0
- package/dist/lib/date.mjs.map +1 -0
- package/dist/lib/density.mjs +79 -0
- package/dist/lib/density.mjs.map +1 -0
- package/dist/lib/field-context.mjs +13 -0
- package/dist/lib/field-context.mjs.map +1 -0
- package/dist/lib/filter.mjs +28 -0
- package/dist/lib/filter.mjs.map +1 -0
- package/dist/lib/gesture.mjs +38 -0
- package/dist/lib/gesture.mjs.map +1 -0
- package/dist/lib/hit-area.mjs +14 -0
- package/dist/lib/hit-area.mjs.map +1 -0
- package/dist/lib/labels.mjs +27 -0
- package/dist/lib/labels.mjs.map +1 -0
- package/dist/lib/morph-box.mjs +56 -0
- package/dist/lib/morph-box.mjs.map +1 -0
- package/dist/lib/motion.mjs +70 -0
- package/dist/lib/motion.mjs.map +1 -0
- package/dist/lib/pulse.mjs +69 -0
- package/dist/lib/pulse.mjs.map +1 -0
- package/dist/lib/roving-focus.mjs +74 -0
- package/dist/lib/roving-focus.mjs.map +1 -0
- package/dist/lib/theme.mjs +67 -0
- package/dist/lib/theme.mjs.map +1 -0
- package/dist/lib/tv.mjs +11 -0
- package/dist/lib/tv.mjs.map +1 -0
- package/dist/lib/utils.mjs +82 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/dist/styles.css +2 -0
- package/package.json +133 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/theme-provider/index.ts"],"sourcesContent":["export { ThemeProvider, useTheme, type ThemeProviderProps } from \"./theme-provider.mjs\"\n"],"mappings":"AAAA,SAAS,eAAe,gBAAyC;","names":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ThemeProvider as NextThemesProvider, useTheme } from "next-themes";
|
|
5
|
+
import { DEFAULT_THEME, THEMES } from "../../../lib/theme.mjs";
|
|
6
|
+
function ThemeProvider({ children, themes = [...THEMES], attribute = "class", ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsxs(
|
|
8
|
+
NextThemesProvider,
|
|
9
|
+
{
|
|
10
|
+
attribute,
|
|
11
|
+
defaultTheme: DEFAULT_THEME,
|
|
12
|
+
enableSystem: true,
|
|
13
|
+
disableTransitionOnChange: true,
|
|
14
|
+
themes,
|
|
15
|
+
...props,
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx(ThemeFallback, { themes, usesClass: [attribute].flat().includes("class") }),
|
|
18
|
+
/* @__PURE__ */ jsx(ThemeColorSync, {}),
|
|
19
|
+
children
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
function ThemeFallback({ themes, usesClass }) {
|
|
25
|
+
const { theme, setTheme } = useTheme();
|
|
26
|
+
const retired = React.useRef(null);
|
|
27
|
+
React.useEffect(() => {
|
|
28
|
+
if (theme && theme !== "system" && !themes.includes(theme)) {
|
|
29
|
+
retired.current = theme;
|
|
30
|
+
setTheme("light");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (retired.current && usesClass) document.documentElement.classList.remove(retired.current);
|
|
34
|
+
retired.current = null;
|
|
35
|
+
}, [theme, themes, usesClass, setTheme]);
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
function toRgb(color) {
|
|
39
|
+
const canvas = document.createElement("canvas");
|
|
40
|
+
canvas.width = canvas.height = 1;
|
|
41
|
+
const context = canvas.getContext("2d");
|
|
42
|
+
if (!context) return color;
|
|
43
|
+
context.fillStyle = color;
|
|
44
|
+
context.fillRect(0, 0, 1, 1);
|
|
45
|
+
const [r, g, b] = context.getImageData(0, 0, 1, 1).data;
|
|
46
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
47
|
+
}
|
|
48
|
+
function ThemeColorSync() {
|
|
49
|
+
const { resolvedTheme, forcedTheme } = useTheme();
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
if (!resolvedTheme) return;
|
|
52
|
+
const frame = requestAnimationFrame(() => {
|
|
53
|
+
const color = toRgb(getComputedStyle(document.body).backgroundColor);
|
|
54
|
+
let meta = document.querySelector('meta[name="theme-color"]:not([media])');
|
|
55
|
+
if (!meta) {
|
|
56
|
+
meta = document.createElement("meta");
|
|
57
|
+
meta.name = "theme-color";
|
|
58
|
+
document.head.appendChild(meta);
|
|
59
|
+
}
|
|
60
|
+
meta.content = color;
|
|
61
|
+
});
|
|
62
|
+
return () => cancelAnimationFrame(frame);
|
|
63
|
+
}, [resolvedTheme, forcedTheme]);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
ThemeProvider,
|
|
68
|
+
useTheme
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=theme-provider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/theme-provider/theme-provider.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { ThemeProvider as NextThemesProvider, useTheme, type ThemeProviderProps as NextThemesProps } from \"next-themes\"\n\nimport { DEFAULT_THEME, THEMES } from \"../../../lib/theme.mjs\"\n\n/*\n * Puts the theme on <html> as a class (light, dark or moonlight; light is the bare :root), remembers\n * the visitor's choice and follows their system's light/dark preference until they pick one. A thin\n * layer over next-themes with Atoms' themes and defaults, so it works in any React app.\n *\n * Every prop of next-themes passes through: `defaultTheme`, `forcedTheme`, `themes` (to add a theme\n * of your own), `storageKey` and so on. Theme and accent are separate axes, so the accent\n * (`data-accent` on <html>) is untouched by anything here.\n */\n\nexport type ThemeProviderProps = NextThemesProps\n\nexport function ThemeProvider({ children, themes = [...THEMES], attribute = \"class\", ...props }: ThemeProviderProps) {\n return (\n <NextThemesProvider\n attribute={attribute}\n defaultTheme={DEFAULT_THEME}\n enableSystem\n disableTransitionOnChange\n themes={themes}\n {...props}\n >\n <ThemeFallback themes={themes} usesClass={[attribute].flat().includes(\"class\")} />\n <ThemeColorSync />\n {children}\n </NextThemesProvider>\n )\n}\n\n/**\n * A stored theme that is no longer offered (renamed or removed) falls back to light. next-themes puts\n * the stale name on <html> (before paint, and again when it mounts) and only ever clears names it\n * knows, so the stale class is removed once the switch to light has rendered.\n */\nfunction ThemeFallback({ themes, usesClass }: { themes: string[]; usesClass: boolean }) {\n const { theme, setTheme } = useTheme()\n const retired = React.useRef<string | null>(null)\n React.useEffect(() => {\n if (theme && theme !== \"system\" && !themes.includes(theme)) {\n retired.current = theme\n setTheme(\"light\")\n return\n }\n if (retired.current && usesClass) document.documentElement.classList.remove(retired.current)\n retired.current = null\n }, [theme, themes, usesClass, setTheme])\n return null\n}\n\n/** The page background as rgb(), which every browser accepts in a theme-color meta tag. */\nfunction toRgb(color: string) {\n const canvas = document.createElement(\"canvas\")\n canvas.width = canvas.height = 1\n const context = canvas.getContext(\"2d\")\n if (!context) return color\n context.fillStyle = color\n context.fillRect(0, 0, 1, 1)\n const [r, g, b] = context.getImageData(0, 0, 1, 1).data\n return `rgb(${r}, ${g}, ${b})`\n}\n\n/** Keeps the browser's theme-color (the mobile address bar) in step with the page background. */\nfunction ThemeColorSync() {\n const { resolvedTheme, forcedTheme } = useTheme()\n React.useEffect(() => {\n if (!resolvedTheme) return\n const frame = requestAnimationFrame(() => {\n const color = toRgb(getComputedStyle(document.body).backgroundColor)\n let meta = document.querySelector<HTMLMetaElement>('meta[name=\"theme-color\"]:not([media])')\n if (!meta) {\n meta = document.createElement(\"meta\")\n meta.name = \"theme-color\"\n document.head.appendChild(meta)\n }\n meta.content = color\n })\n return () => cancelAnimationFrame(frame)\n }, [resolvedTheme, forcedTheme])\n return null\n}\n\nexport { useTheme }\n"],"mappings":";AAqBI,SAQE,KARF;AAnBJ,YAAY,WAAW;AACvB,SAAS,iBAAiB,oBAAoB,gBAA4D;AAE1G,SAAS,eAAe,cAAc;AAc/B,SAAS,cAAc,EAAE,UAAU,SAAS,CAAC,GAAG,MAAM,GAAG,YAAY,SAAS,GAAG,MAAM,GAAuB;AACnH,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,cAAc;AAAA,MACd,cAAY;AAAA,MACZ,2BAAyB;AAAA,MACzB;AAAA,MACC,GAAG;AAAA,MAEJ;AAAA,4BAAC,iBAAc,QAAgB,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,OAAO,GAAG;AAAA,QAChF,oBAAC,kBAAe;AAAA,QACf;AAAA;AAAA;AAAA,EACH;AAEJ;AAOA,SAAS,cAAc,EAAE,QAAQ,UAAU,GAA6C;AACtF,QAAM,EAAE,OAAO,SAAS,IAAI,SAAS;AACrC,QAAM,UAAU,MAAM,OAAsB,IAAI;AAChD,QAAM,UAAU,MAAM;AACpB,QAAI,SAAS,UAAU,YAAY,CAAC,OAAO,SAAS,KAAK,GAAG;AAC1D,cAAQ,UAAU;AAClB,eAAS,OAAO;AAChB;AAAA,IACF;AACA,QAAI,QAAQ,WAAW,UAAW,UAAS,gBAAgB,UAAU,OAAO,QAAQ,OAAO;AAC3F,YAAQ,UAAU;AAAA,EACpB,GAAG,CAAC,OAAO,QAAQ,WAAW,QAAQ,CAAC;AACvC,SAAO;AACT;AAGA,SAAS,MAAM,OAAe;AAC5B,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,QAAQ,OAAO,SAAS;AAC/B,QAAM,UAAU,OAAO,WAAW,IAAI;AACtC,MAAI,CAAC,QAAS,QAAO;AACrB,UAAQ,YAAY;AACpB,UAAQ,SAAS,GAAG,GAAG,GAAG,CAAC;AAC3B,QAAM,CAAC,GAAG,GAAG,CAAC,IAAI,QAAQ,aAAa,GAAG,GAAG,GAAG,CAAC,EAAE;AACnD,SAAO,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;AAC7B;AAGA,SAAS,iBAAiB;AACxB,QAAM,EAAE,eAAe,YAAY,IAAI,SAAS;AAChD,QAAM,UAAU,MAAM;AACpB,QAAI,CAAC,cAAe;AACpB,UAAM,QAAQ,sBAAsB,MAAM;AACxC,YAAM,QAAQ,MAAM,iBAAiB,SAAS,IAAI,EAAE,eAAe;AACnE,UAAI,OAAO,SAAS,cAA+B,uCAAuC;AAC1F,UAAI,CAAC,MAAM;AACT,eAAO,SAAS,cAAc,MAAM;AACpC,aAAK,OAAO;AACZ,iBAAS,KAAK,YAAY,IAAI;AAAA,MAChC;AACA,WAAK,UAAU;AAAA,IACjB,CAAC;AACD,WAAO,MAAM,qBAAqB,KAAK;AAAA,EACzC,GAAG,CAAC,eAAe,WAAW,CAAC;AAC/B,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Toaster, toastVariants, toastIcons, useToast, useToastStore } from "./toast.mjs";
|
|
2
|
+
import {
|
|
3
|
+
toast,
|
|
4
|
+
dismissToast,
|
|
5
|
+
TOAST_DURATION,
|
|
6
|
+
ANCHORED_TOAST_DURATION
|
|
7
|
+
} from "./store.mjs";
|
|
8
|
+
export {
|
|
9
|
+
ANCHORED_TOAST_DURATION,
|
|
10
|
+
TOAST_DURATION,
|
|
11
|
+
Toaster,
|
|
12
|
+
dismissToast,
|
|
13
|
+
toast,
|
|
14
|
+
toastIcons,
|
|
15
|
+
toastVariants,
|
|
16
|
+
useToast,
|
|
17
|
+
useToastStore
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/toast/index.ts"],"sourcesContent":["export { Toaster, toastVariants, toastIcons, useToast, useToastStore, type ToasterProps } from \"./toast.mjs\"\nexport {\n toast,\n dismissToast,\n TOAST_DURATION,\n ANCHORED_TOAST_DURATION,\n type ToastData,\n type ToastOptions,\n type ToastVariant,\n type ToastAppearance,\n type ToastAnchorRect,\n type ToastPromiseMessages,\n type ToastPromiseResult,\n} from \"./store.mjs\"\n"],"mappings":"AAAA,SAAS,SAAS,eAAe,YAAY,UAAU,qBAAwC;AAC/F;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAQK;","names":[]}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const TOAST_DURATION = 5e3;
|
|
2
|
+
const ANCHORED_TOAST_DURATION = 1500;
|
|
3
|
+
const EXIT_MS = 300;
|
|
4
|
+
let toasts = [];
|
|
5
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
6
|
+
let counter = 0;
|
|
7
|
+
const EMPTY = [];
|
|
8
|
+
function emit(next) {
|
|
9
|
+
toasts = next;
|
|
10
|
+
for (const listener of listeners) listener();
|
|
11
|
+
}
|
|
12
|
+
const toastStore = {
|
|
13
|
+
subscribe(listener) {
|
|
14
|
+
listeners.add(listener);
|
|
15
|
+
return () => {
|
|
16
|
+
listeners.delete(listener);
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
getSnapshot: () => toasts,
|
|
20
|
+
getServerSnapshot: () => EMPTY
|
|
21
|
+
};
|
|
22
|
+
function measure(anchor) {
|
|
23
|
+
if (!anchor) return void 0;
|
|
24
|
+
const r = anchor.getBoundingClientRect();
|
|
25
|
+
return { top: r.top, bottom: r.bottom, left: r.left, width: r.width };
|
|
26
|
+
}
|
|
27
|
+
function raise(options) {
|
|
28
|
+
const id = options.id ?? `toast-${++counter}`;
|
|
29
|
+
const { anchor, ...rest } = options;
|
|
30
|
+
const variant = options.variant ?? "default";
|
|
31
|
+
const existing = toasts.find((t) => t.id === id && !t.leaving);
|
|
32
|
+
if (existing) {
|
|
33
|
+
const progressing = existing.progress !== void 0 && options.progress !== void 0;
|
|
34
|
+
const cueKind = progressing ? null : variant === "destructive" || variant === "warning" ? "shake" : "pop";
|
|
35
|
+
const next = {
|
|
36
|
+
...rest,
|
|
37
|
+
id,
|
|
38
|
+
variant,
|
|
39
|
+
anchorRect: measure(anchor) ?? existing.anchorRect,
|
|
40
|
+
updates: existing.updates + 1,
|
|
41
|
+
cue: cueKind ? existing.cue + 1 : existing.cue,
|
|
42
|
+
cueKind: cueKind ?? existing.cueKind,
|
|
43
|
+
leaving: false
|
|
44
|
+
};
|
|
45
|
+
emit([...toasts.filter((t) => t.id !== id), next]);
|
|
46
|
+
return id;
|
|
47
|
+
}
|
|
48
|
+
emit([
|
|
49
|
+
...toasts.filter((t) => t.id !== id),
|
|
50
|
+
{ ...rest, id, variant, anchorRect: measure(anchor), updates: 0, cue: 0, cueKind: null, leaving: false }
|
|
51
|
+
]);
|
|
52
|
+
return id;
|
|
53
|
+
}
|
|
54
|
+
function dismissToast(id, how = "out") {
|
|
55
|
+
const targets = toasts.filter((t) => (id === void 0 || t.id === id) && !t.leaving).map((t) => t.id);
|
|
56
|
+
if (!targets.length) return;
|
|
57
|
+
emit(toasts.map((t) => targets.includes(t.id) ? { ...t, leaving: how } : t));
|
|
58
|
+
setTimeout(() => emit(toasts.filter((t) => !(targets.includes(t.id) && t.leaving))), EXIT_MS);
|
|
59
|
+
}
|
|
60
|
+
function normalize(message, options) {
|
|
61
|
+
if (message && typeof message === "object" && !("$$typeof" in message) && !Array.isArray(message)) {
|
|
62
|
+
return { ...message, ...options };
|
|
63
|
+
}
|
|
64
|
+
return { title: message, ...options };
|
|
65
|
+
}
|
|
66
|
+
function promise(work, messages, options) {
|
|
67
|
+
const run = typeof work === "function" ? work() : work;
|
|
68
|
+
const id = raise({ ...normalize(messages.loading, options), variant: "loading" });
|
|
69
|
+
const resolve = (message, value, variant) => {
|
|
70
|
+
const content = typeof message === "function" ? message(value) : message;
|
|
71
|
+
raise({ ...normalize(content, options), id, variant });
|
|
72
|
+
};
|
|
73
|
+
run.then(
|
|
74
|
+
(value) => resolve(messages.success, value, "success"),
|
|
75
|
+
(error) => resolve(messages.error, error, "destructive")
|
|
76
|
+
);
|
|
77
|
+
return run;
|
|
78
|
+
}
|
|
79
|
+
const shorthand = (variant) => (message, options) => raise({ ...normalize(message, options), variant });
|
|
80
|
+
const toast = Object.assign((message, options) => raise(normalize(message, options)), {
|
|
81
|
+
success: shorthand("success"),
|
|
82
|
+
warning: shorthand("warning"),
|
|
83
|
+
error: shorthand("destructive"),
|
|
84
|
+
info: shorthand("info"),
|
|
85
|
+
loading: shorthand("loading"),
|
|
86
|
+
promise,
|
|
87
|
+
dismiss: (id) => dismissToast(id)
|
|
88
|
+
});
|
|
89
|
+
export {
|
|
90
|
+
ANCHORED_TOAST_DURATION,
|
|
91
|
+
TOAST_DURATION,
|
|
92
|
+
dismissToast,
|
|
93
|
+
toast,
|
|
94
|
+
toastStore
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=store.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/toast/store.ts"],"sourcesContent":["import type * as React from \"react\"\n\nexport type ToastVariant = \"default\" | \"success\" | \"warning\" | \"destructive\" | \"info\" | \"loading\"\nexport type ToastAppearance = \"card\" | \"minimal\"\n\nexport interface ToastAnchorRect {\n top: number\n bottom: number\n left: number\n width: number\n}\n\nexport interface ToastOptions {\n /** A stable id. Raising it again while on screen updates that toast in place. */\n id?: string\n title?: React.ReactNode\n description?: React.ReactNode\n variant?: ToastVariant\n /** Auto-dismiss delay in ms. 1500 when anchored, Infinity for loading. */\n duration?: number\n action?: { label: string; onClick: () => void }\n appearance?: ToastAppearance\n countdown?: boolean\n /** 0 to 100: a progress bar under the text. */\n progress?: number\n /** Shows a small bubble beside this element instead of the stack. */\n anchor?: HTMLElement | null\n}\n\nexport interface ToastData extends Omit<ToastOptions, \"anchor\"> {\n id: string\n variant: ToastVariant\n /** Where an anchored bubble sits, measured when it was raised. */\n anchorRect?: ToastAnchorRect\n /** Bumped on every update in place: restarts the timer and the countdown. */\n updates: number\n /** Bumped when an update should replay a cue; its parity picks the a/b keyframes. */\n cue: number\n cueKind: \"pop\" | \"shake\" | null\n /** Set once a dismissal starts: the card plays its exit before it's removed. */\n leaving: false | \"out\" | \"swipe\"\n}\n\nexport const TOAST_DURATION = 5000\nexport const ANCHORED_TOAST_DURATION = 1500\nconst EXIT_MS = 300\n\ntype Listener = () => void\n\nlet toasts: ToastData[] = []\nconst listeners = new Set<Listener>()\nlet counter = 0\nconst EMPTY: ToastData[] = []\n\nfunction emit(next: ToastData[]) {\n toasts = next\n for (const listener of listeners) listener()\n}\n\nexport const toastStore = {\n subscribe(listener: Listener) {\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n getSnapshot: () => toasts,\n getServerSnapshot: () => EMPTY,\n}\n\nfunction measure(anchor: HTMLElement | null | undefined): ToastAnchorRect | undefined {\n if (!anchor) return undefined\n const r = anchor.getBoundingClientRect()\n return { top: r.top, bottom: r.bottom, left: r.left, width: r.width }\n}\n\nfunction raise(options: ToastOptions): string {\n const id = options.id ?? `toast-${++counter}`\n const { anchor, ...rest } = options\n const variant = options.variant ?? \"default\"\n const existing = toasts.find((t) => t.id === id && !t.leaving)\n if (existing) {\n // An update in place: the card moves to the front and replays a cue, except while a progress\n // bar advances, which should glide without a pop.\n const progressing = existing.progress !== undefined && options.progress !== undefined\n const cueKind = progressing ? null : variant === \"destructive\" || variant === \"warning\" ? \"shake\" : \"pop\"\n const next: ToastData = {\n ...rest,\n id,\n variant,\n anchorRect: measure(anchor) ?? existing.anchorRect,\n updates: existing.updates + 1,\n cue: cueKind ? existing.cue + 1 : existing.cue,\n cueKind: cueKind ?? existing.cueKind,\n leaving: false,\n }\n emit([...toasts.filter((t) => t.id !== id), next])\n return id\n }\n emit([\n ...toasts.filter((t) => t.id !== id),\n { ...rest, id, variant, anchorRect: measure(anchor), updates: 0, cue: 0, cueKind: null, leaving: false },\n ])\n return id\n}\n\n/** Starts the exit of one toast, or all of them; it's removed once the exit has played. */\nexport function dismissToast(id?: string, how: \"out\" | \"swipe\" = \"out\") {\n const targets = toasts.filter((t) => (id === undefined || t.id === id) && !t.leaving).map((t) => t.id)\n if (!targets.length) return\n emit(toasts.map((t) => (targets.includes(t.id) ? { ...t, leaving: how } : t)))\n setTimeout(() => emit(toasts.filter((t) => !(targets.includes(t.id) && t.leaving))), EXIT_MS)\n}\n\ntype Message = React.ReactNode | ToastOptions\n\nfunction normalize(message: Message | undefined, options?: ToastOptions): ToastOptions {\n if (message && typeof message === \"object\" && !(\"$$typeof\" in (message as object)) && !Array.isArray(message)) {\n return { ...(message as ToastOptions), ...options }\n }\n return { title: message as React.ReactNode, ...options }\n}\n\nexport interface ToastPromiseMessages<T> {\n loading: React.ReactNode | ToastOptions\n success: React.ReactNode | ToastOptions | ((value: T) => React.ReactNode | ToastOptions)\n error: React.ReactNode | ToastOptions | ((error: unknown) => React.ReactNode | ToastOptions)\n}\n\nexport type ToastPromiseResult<T> = Promise<T>\n\nfunction promise<T>(work: Promise<T> | (() => Promise<T>), messages: ToastPromiseMessages<T>, options?: ToastOptions) {\n const run = typeof work === \"function\" ? work() : work\n const id = raise({ ...normalize(messages.loading, options), variant: \"loading\" })\n const resolve = <V,>(message: unknown, value: V, variant: ToastVariant) => {\n const content = typeof message === \"function\" ? (message as (v: V) => Message)(value) : (message as Message)\n raise({ ...normalize(content, options), id, variant })\n }\n run.then(\n (value) => resolve(messages.success, value, \"success\"),\n (error) => resolve(messages.error, error, \"destructive\"),\n )\n return run\n}\n\ntype Shorthand = (message: Message, options?: ToastOptions) => string\n\nexport interface ToastFn {\n (message: Message, options?: ToastOptions): string\n success: Shorthand\n warning: Shorthand\n error: Shorthand\n info: Shorthand\n loading: Shorthand\n promise: typeof promise\n dismiss: (id?: string) => void\n}\n\nconst shorthand =\n (variant: ToastVariant): Shorthand =>\n (message, options) =>\n raise({ ...normalize(message, options), variant })\n\n/** Raises a toast from anywhere and returns its id. */\nexport const toast: ToastFn = Object.assign((message: Message, options?: ToastOptions) => raise(normalize(message, options)), {\n success: shorthand(\"success\"),\n warning: shorthand(\"warning\"),\n error: shorthand(\"destructive\"),\n info: shorthand(\"info\"),\n loading: shorthand(\"loading\"),\n promise,\n dismiss: (id?: string) => dismissToast(id),\n})\n"],"mappings":"AA2CO,MAAM,iBAAiB;AACvB,MAAM,0BAA0B;AACvC,MAAM,UAAU;AAIhB,IAAI,SAAsB,CAAC;AAC3B,MAAM,YAAY,oBAAI,IAAc;AACpC,IAAI,UAAU;AACd,MAAM,QAAqB,CAAC;AAE5B,SAAS,KAAK,MAAmB;AAC/B,WAAS;AACT,aAAW,YAAY,UAAW,UAAS;AAC7C;AAEO,MAAM,aAAa;AAAA,EACxB,UAAU,UAAoB;AAC5B,cAAU,IAAI,QAAQ;AACtB,WAAO,MAAM;AACX,gBAAU,OAAO,QAAQ;AAAA,IAC3B;AAAA,EACF;AAAA,EACA,aAAa,MAAM;AAAA,EACnB,mBAAmB,MAAM;AAC3B;AAEA,SAAS,QAAQ,QAAqE;AACpF,MAAI,CAAC,OAAQ,QAAO;AACpB,QAAM,IAAI,OAAO,sBAAsB;AACvC,SAAO,EAAE,KAAK,EAAE,KAAK,QAAQ,EAAE,QAAQ,MAAM,EAAE,MAAM,OAAO,EAAE,MAAM;AACtE;AAEA,SAAS,MAAM,SAA+B;AAC5C,QAAM,KAAK,QAAQ,MAAM,SAAS,EAAE,OAAO;AAC3C,QAAM,EAAE,QAAQ,GAAG,KAAK,IAAI;AAC5B,QAAM,UAAU,QAAQ,WAAW;AACnC,QAAM,WAAW,OAAO,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,CAAC,EAAE,OAAO;AAC7D,MAAI,UAAU;AAGZ,UAAM,cAAc,SAAS,aAAa,UAAa,QAAQ,aAAa;AAC5E,UAAM,UAAU,cAAc,OAAO,YAAY,iBAAiB,YAAY,YAAY,UAAU;AACpG,UAAM,OAAkB;AAAA,MACtB,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA,YAAY,QAAQ,MAAM,KAAK,SAAS;AAAA,MACxC,SAAS,SAAS,UAAU;AAAA,MAC5B,KAAK,UAAU,SAAS,MAAM,IAAI,SAAS;AAAA,MAC3C,SAAS,WAAW,SAAS;AAAA,MAC7B,SAAS;AAAA,IACX;AACA,SAAK,CAAC,GAAG,OAAO,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;AACjD,WAAO;AAAA,EACT;AACA,OAAK;AAAA,IACH,GAAG,OAAO,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE;AAAA,IACnC,EAAE,GAAG,MAAM,IAAI,SAAS,YAAY,QAAQ,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,MAAM,SAAS,MAAM;AAAA,EACzG,CAAC;AACD,SAAO;AACT;AAGO,SAAS,aAAa,IAAa,MAAuB,OAAO;AACtE,QAAM,UAAU,OAAO,OAAO,CAAC,OAAO,OAAO,UAAa,EAAE,OAAO,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE;AACrG,MAAI,CAAC,QAAQ,OAAQ;AACrB,OAAK,OAAO,IAAI,CAAC,MAAO,QAAQ,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,GAAG,SAAS,IAAI,IAAI,CAAE,CAAC;AAC7E,aAAW,MAAM,KAAK,OAAO,OAAO,CAAC,MAAM,EAAE,QAAQ,SAAS,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,OAAO;AAC9F;AAIA,SAAS,UAAU,SAA8B,SAAsC;AACrF,MAAI,WAAW,OAAO,YAAY,YAAY,EAAE,cAAe,YAAuB,CAAC,MAAM,QAAQ,OAAO,GAAG;AAC7G,WAAO,EAAE,GAAI,SAA0B,GAAG,QAAQ;AAAA,EACpD;AACA,SAAO,EAAE,OAAO,SAA4B,GAAG,QAAQ;AACzD;AAUA,SAAS,QAAW,MAAuC,UAAmC,SAAwB;AACpH,QAAM,MAAM,OAAO,SAAS,aAAa,KAAK,IAAI;AAClD,QAAM,KAAK,MAAM,EAAE,GAAG,UAAU,SAAS,SAAS,OAAO,GAAG,SAAS,UAAU,CAAC;AAChF,QAAM,UAAU,CAAK,SAAkB,OAAU,YAA0B;AACzE,UAAM,UAAU,OAAO,YAAY,aAAc,QAA8B,KAAK,IAAK;AACzF,UAAM,EAAE,GAAG,UAAU,SAAS,OAAO,GAAG,IAAI,QAAQ,CAAC;AAAA,EACvD;AACA,MAAI;AAAA,IACF,CAAC,UAAU,QAAQ,SAAS,SAAS,OAAO,SAAS;AAAA,IACrD,CAAC,UAAU,QAAQ,SAAS,OAAO,OAAO,aAAa;AAAA,EACzD;AACA,SAAO;AACT;AAeA,MAAM,YACJ,CAAC,YACD,CAAC,SAAS,YACR,MAAM,EAAE,GAAG,UAAU,SAAS,OAAO,GAAG,QAAQ,CAAC;AAG9C,MAAM,QAAiB,OAAO,OAAO,CAAC,SAAkB,YAA2B,MAAM,UAAU,SAAS,OAAO,CAAC,GAAG;AAAA,EAC5H,SAAS,UAAU,SAAS;AAAA,EAC5B,SAAS,UAAU,SAAS;AAAA,EAC5B,OAAO,UAAU,aAAa;AAAA,EAC9B,MAAM,UAAU,MAAM;AAAA,EACtB,SAAS,UAAU,SAAS;AAAA,EAC5B;AAAA,EACA,SAAS,CAAC,OAAgB,aAAa,EAAE;AAC3C,CAAC;","names":[]}
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Toast as ToastPrimitive } from "radix-ui";
|
|
5
|
+
import { CheckCircle, Info, Warning, X, XCircle } from "atoms-icons";
|
|
6
|
+
import { Button } from "../button/index.mjs";
|
|
7
|
+
import { Spinner } from "../spinner/index.mjs";
|
|
8
|
+
import { tv } from "../../../lib/tv.mjs";
|
|
9
|
+
import { cn } from "../../../lib/utils.mjs";
|
|
10
|
+
import {
|
|
11
|
+
ANCHORED_TOAST_DURATION,
|
|
12
|
+
TOAST_DURATION,
|
|
13
|
+
dismissToast,
|
|
14
|
+
toast,
|
|
15
|
+
toastStore
|
|
16
|
+
} from "./store.mjs";
|
|
17
|
+
const toastVariants = tv({
|
|
18
|
+
slots: {
|
|
19
|
+
viewport: "fixed bottom-[calc(1rem+env(safe-area-inset-bottom))] left-1/2 -translate-x-1/2 z-[100] w-[380px] max-w-[calc(100vw-2rem)] m-0 list-none p-0 outline-none",
|
|
20
|
+
item: "group/toast absolute bottom-0 left-0 right-0",
|
|
21
|
+
surface: [
|
|
22
|
+
"relative flex w-full overflow-hidden bg-popover p-4 [--surface:var(--popover)] shadow-lg ring-1 ring-inset ring-border",
|
|
23
|
+
"transition-[opacity,translate,scale,transform] duration-slow ease-out data-dragging:transition-none touch-none select-none",
|
|
24
|
+
"[--shake-distance:3px] motion-reduce:animate-none"
|
|
25
|
+
],
|
|
26
|
+
icon: "relative shrink-0",
|
|
27
|
+
iconLayer: "absolute inset-0 grid place-items-center transition-[opacity,scale,filter] duration-fast ease-out",
|
|
28
|
+
content: "flex min-w-0 flex-1 flex-col",
|
|
29
|
+
title: "text-sm leading-snug",
|
|
30
|
+
description: "text-sm text-pretty leading-snug text-muted-foreground",
|
|
31
|
+
close: [
|
|
32
|
+
"grid size-6 shrink-0 cursor-pointer place-items-center rounded-md",
|
|
33
|
+
"before:absolute before:left-1/2 before:top-1/2 before:-translate-x-1/2 before:-translate-y-1/2 before:content-[''] before:size-10 pointer-coarse:before:size-11",
|
|
34
|
+
"text-muted-foreground/60 transition-[color,background-color,scale] duration-fast ease-out hover:bg-accent hover:text-foreground",
|
|
35
|
+
"outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-1 [&_svg]:size-3.5 [&_svg]:pointer-events-none"
|
|
36
|
+
],
|
|
37
|
+
countdown: "pointer-events-none absolute inset-x-0 bottom-0 h-0.5 origin-left opacity-40 animate-toast-countdown",
|
|
38
|
+
progress: "h-1 w-full overflow-hidden rounded-full bg-foreground/10",
|
|
39
|
+
progressFill: "h-full w-full rounded-full transition-[translate] duration-base ease-out bg-foreground",
|
|
40
|
+
bubble: [
|
|
41
|
+
"pointer-events-none flex items-center gap-1.5 whitespace-nowrap rounded-lg bg-popover px-2.5 py-1.5 text-sm font-medium text-popover-foreground [--surface:var(--popover)] shadow-lg ring-1 ring-inset ring-border",
|
|
42
|
+
"data-[side=top]:origin-bottom data-[side=bottom]:origin-top transition-[opacity,scale,translate] duration-fast ease-out [--shake-distance:2px] motion-reduce:animate-none"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
variants: {
|
|
46
|
+
appearance: {
|
|
47
|
+
card: {
|
|
48
|
+
surface: "items-start gap-3 rounded-xl",
|
|
49
|
+
icon: "size-5 [&_svg]:size-5",
|
|
50
|
+
content: "gap-0.5 pr-5",
|
|
51
|
+
title: "font-semibold",
|
|
52
|
+
close: "absolute top-3 right-3",
|
|
53
|
+
progress: "mt-2.5"
|
|
54
|
+
},
|
|
55
|
+
minimal: {
|
|
56
|
+
surface: "items-center gap-2.5 rounded-lg px-3.5 py-2.5",
|
|
57
|
+
icon: "mt-0 size-4 [&_svg]:size-4",
|
|
58
|
+
content: "gap-0 pr-0",
|
|
59
|
+
title: "font-medium",
|
|
60
|
+
close: "relative top-auto right-auto -mr-1 transition-[color,background-color,opacity,scale] group-hover/toast:opacity-100 group-focus-within/toast:opacity-100 pointer-coarse:opacity-100 opacity-0",
|
|
61
|
+
progress: "mt-2"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
tone: {
|
|
65
|
+
default: { icon: "text-muted-foreground", countdown: "bg-foreground" },
|
|
66
|
+
loading: { icon: "text-muted-foreground", countdown: "bg-foreground" },
|
|
67
|
+
success: { icon: "text-success", countdown: "bg-success" },
|
|
68
|
+
warning: { icon: "text-warning", countdown: "bg-warning" },
|
|
69
|
+
destructive: { icon: "text-destructive", countdown: "bg-destructive" },
|
|
70
|
+
info: { icon: "text-info", countdown: "bg-info" }
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
defaultVariants: { appearance: "card", tone: "default" }
|
|
74
|
+
});
|
|
75
|
+
const toastIcons = {
|
|
76
|
+
success: /* @__PURE__ */ jsx(CheckCircle, {}),
|
|
77
|
+
warning: /* @__PURE__ */ jsx(Warning, {}),
|
|
78
|
+
destructive: /* @__PURE__ */ jsx(XCircle, {}),
|
|
79
|
+
info: /* @__PURE__ */ jsx(Info, {}),
|
|
80
|
+
loading: /* @__PURE__ */ jsx(Spinner, { "aria-hidden": "true" })
|
|
81
|
+
};
|
|
82
|
+
const STACK = 3;
|
|
83
|
+
const GAP = 16;
|
|
84
|
+
const PEEK = 14;
|
|
85
|
+
const SCALE_STEP = 0.05;
|
|
86
|
+
const EASE_STACK = "transform 300ms cubic-bezier(0.77, 0, 0.175, 1), opacity 160ms cubic-bezier(0.23, 1, 0.32, 1)";
|
|
87
|
+
function useToastStore() {
|
|
88
|
+
return React.useSyncExternalStore(toastStore.subscribe, toastStore.getSnapshot, toastStore.getServerSnapshot);
|
|
89
|
+
}
|
|
90
|
+
function useToast() {
|
|
91
|
+
const toasts = useToastStore();
|
|
92
|
+
return { toast, dismiss: toast.dismiss, toasts };
|
|
93
|
+
}
|
|
94
|
+
function Toaster({
|
|
95
|
+
appearance = "card",
|
|
96
|
+
countdown = false,
|
|
97
|
+
swipeDirection = "right",
|
|
98
|
+
swipeThreshold = 50,
|
|
99
|
+
hotkey = ["F8"],
|
|
100
|
+
label = "Notifications ({hotkey})",
|
|
101
|
+
className,
|
|
102
|
+
style,
|
|
103
|
+
onPointerEnter,
|
|
104
|
+
onPointerLeave,
|
|
105
|
+
onFocus,
|
|
106
|
+
onBlur,
|
|
107
|
+
...props
|
|
108
|
+
}) {
|
|
109
|
+
const all = useToastStore();
|
|
110
|
+
const stack = all.filter((t) => !t.anchorRect);
|
|
111
|
+
const bubbles = all.filter((t) => t.anchorRect);
|
|
112
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
113
|
+
const [heights, setHeights] = React.useState({});
|
|
114
|
+
const [announcement, setAnnouncement] = React.useState("");
|
|
115
|
+
const slots = toastVariants();
|
|
116
|
+
const setHeight = React.useCallback((id, height) => {
|
|
117
|
+
setHeights((h) => h[id] === height ? h : { ...h, [id]: height });
|
|
118
|
+
}, []);
|
|
119
|
+
const ordered = [...stack].reverse();
|
|
120
|
+
const visible = ordered.filter((t) => !t.leaving);
|
|
121
|
+
const front = visible[0];
|
|
122
|
+
const viewportHeight = expanded ? visible.reduce((sum, t, i) => sum + (heights[t.id] ?? 0) + (i ? GAP : 0), 0) : front ? heights[front.id] ?? 0 : 0;
|
|
123
|
+
const bubbleIds = bubbles.map((b) => b.id).join(" ");
|
|
124
|
+
React.useEffect(() => {
|
|
125
|
+
if (!bubbleIds) return;
|
|
126
|
+
const close = () => bubbleIds.split(" ").forEach((bubbleId) => dismissToast(bubbleId));
|
|
127
|
+
window.addEventListener("scroll", close, { capture: true, passive: true });
|
|
128
|
+
window.addEventListener("resize", close);
|
|
129
|
+
return () => {
|
|
130
|
+
window.removeEventListener("scroll", close, { capture: true });
|
|
131
|
+
window.removeEventListener("resize", close);
|
|
132
|
+
};
|
|
133
|
+
}, [bubbleIds]);
|
|
134
|
+
const lastBubble = bubbles.at(-1);
|
|
135
|
+
const bubbleText = lastBubble && !lastBubble.leaving && typeof lastBubble.title === "string" ? lastBubble.title : "";
|
|
136
|
+
if (bubbleText && bubbleText !== announcement) setAnnouncement(bubbleText);
|
|
137
|
+
return /* @__PURE__ */ jsxs(ToastPrimitive.Provider, { swipeDirection, swipeThreshold, label, children: [
|
|
138
|
+
ordered.map((t) => {
|
|
139
|
+
const index = visible.indexOf(t);
|
|
140
|
+
let offset = 0;
|
|
141
|
+
if (index > 0) {
|
|
142
|
+
offset = expanded ? visible.slice(0, index).reduce((sum, v) => sum + (heights[v.id] ?? 0) + GAP, 0) : index * PEEK;
|
|
143
|
+
}
|
|
144
|
+
const scale = expanded || index <= 0 ? 1 : 1 - index * SCALE_STEP;
|
|
145
|
+
const hidden = !expanded && index >= STACK;
|
|
146
|
+
return /* @__PURE__ */ jsx(
|
|
147
|
+
ToastItem,
|
|
148
|
+
{
|
|
149
|
+
data: t,
|
|
150
|
+
appearance: t.appearance ?? appearance,
|
|
151
|
+
countdown: t.countdown ?? countdown,
|
|
152
|
+
onHeight: setHeight,
|
|
153
|
+
style: {
|
|
154
|
+
transform: `translateY(${-offset}px) scale(${scale})`,
|
|
155
|
+
opacity: t.leaving || hidden ? 0 : 1,
|
|
156
|
+
zIndex: 30 - Math.max(index, 0),
|
|
157
|
+
transition: EASE_STACK
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
t.id
|
|
161
|
+
);
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ jsx(
|
|
164
|
+
ToastPrimitive.Viewport,
|
|
165
|
+
{
|
|
166
|
+
"data-slot": "toast-viewport",
|
|
167
|
+
hotkey,
|
|
168
|
+
label,
|
|
169
|
+
className: slots.viewport({ className }),
|
|
170
|
+
style: { height: viewportHeight, transition: "height 300ms cubic-bezier(0.77, 0, 0.175, 1)", ...style },
|
|
171
|
+
onPointerEnter: (event) => {
|
|
172
|
+
onPointerEnter?.(event);
|
|
173
|
+
setExpanded(true);
|
|
174
|
+
},
|
|
175
|
+
onPointerLeave: (event) => {
|
|
176
|
+
onPointerLeave?.(event);
|
|
177
|
+
setExpanded(false);
|
|
178
|
+
},
|
|
179
|
+
onFocus: (event) => {
|
|
180
|
+
onFocus?.(event);
|
|
181
|
+
setExpanded(true);
|
|
182
|
+
},
|
|
183
|
+
onBlur: (event) => {
|
|
184
|
+
onBlur?.(event);
|
|
185
|
+
if (!event.currentTarget.contains(event.relatedTarget)) setExpanded(false);
|
|
186
|
+
},
|
|
187
|
+
...props
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
bubbles.map((b) => /* @__PURE__ */ jsx(ToastBubble, { data: b }, b.id)),
|
|
191
|
+
/* @__PURE__ */ jsx("div", { "data-slot": "toast-announcer", role: "status", "aria-live": "polite", "aria-atomic": "true", className: "sr-only", children: announcement })
|
|
192
|
+
] });
|
|
193
|
+
}
|
|
194
|
+
function useEntered() {
|
|
195
|
+
const [entered, setEntered] = React.useState(false);
|
|
196
|
+
React.useEffect(() => {
|
|
197
|
+
const frame = requestAnimationFrame(() => setEntered(true));
|
|
198
|
+
const fallback = setTimeout(() => setEntered(true), 50);
|
|
199
|
+
return () => {
|
|
200
|
+
cancelAnimationFrame(frame);
|
|
201
|
+
clearTimeout(fallback);
|
|
202
|
+
};
|
|
203
|
+
}, []);
|
|
204
|
+
return entered;
|
|
205
|
+
}
|
|
206
|
+
function ToastItem({ data, appearance, countdown, onHeight, style }) {
|
|
207
|
+
const { id, variant, title, description, action, progress, duration: durationProp, leaving, updates, cue, cueKind } = data;
|
|
208
|
+
const slots = toastVariants({ appearance, tone: variant });
|
|
209
|
+
const entered = useEntered();
|
|
210
|
+
const [paused, setPaused] = React.useState(false);
|
|
211
|
+
const [drag, setDrag] = React.useState(null);
|
|
212
|
+
const persists = variant === "loading" || durationProp === Infinity;
|
|
213
|
+
const duration = persists ? Infinity : durationProp ?? TOAST_DURATION;
|
|
214
|
+
const remaining = React.useRef({ updates, left: duration });
|
|
215
|
+
React.useEffect(() => {
|
|
216
|
+
if (!Number.isFinite(duration) || paused || leaving) return;
|
|
217
|
+
if (remaining.current.updates !== updates) remaining.current = { updates, left: duration };
|
|
218
|
+
const started = performance.now();
|
|
219
|
+
const timer = setTimeout(() => dismissToast(id), remaining.current.left);
|
|
220
|
+
return () => {
|
|
221
|
+
clearTimeout(timer);
|
|
222
|
+
remaining.current.left = Math.max(0, remaining.current.left - (performance.now() - started));
|
|
223
|
+
};
|
|
224
|
+
}, [duration, paused, leaving, updates, id]);
|
|
225
|
+
const measure = React.useCallback(
|
|
226
|
+
(el) => {
|
|
227
|
+
if (!el) return;
|
|
228
|
+
onHeight(id, el.offsetHeight);
|
|
229
|
+
const observer = new ResizeObserver(() => onHeight(id, el.offsetHeight));
|
|
230
|
+
observer.observe(el);
|
|
231
|
+
return () => observer.disconnect();
|
|
232
|
+
},
|
|
233
|
+
[id, onHeight]
|
|
234
|
+
);
|
|
235
|
+
const cueClass = cue > 0 && cueKind ? cueKind === "shake" ? cue % 2 ? "animate-shake-a" : "animate-shake-b" : cue % 2 ? "animate-toast-pop-a" : "animate-toast-pop-b" : void 0;
|
|
236
|
+
const resting = entered && !leaving;
|
|
237
|
+
const motion = leaving === "swipe" ? "translate-x-full opacity-0" : resting ? void 0 : "translate-y-4 scale-[0.96] opacity-0";
|
|
238
|
+
const minimal = appearance === "minimal";
|
|
239
|
+
const showIcon = variant !== "default";
|
|
240
|
+
const closeButton = /* @__PURE__ */ jsx(ToastPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Close", "data-slot": "toast-close", className: slots.close(), children: /* @__PURE__ */ jsx(X, {}) }) });
|
|
241
|
+
const actionButton = action ? /* @__PURE__ */ jsx(ToastPrimitive.Action, { asChild: true, altText: action.label, children: /* @__PURE__ */ jsx(
|
|
242
|
+
Button,
|
|
243
|
+
{
|
|
244
|
+
variant: "secondary",
|
|
245
|
+
size: "sm",
|
|
246
|
+
"data-slot": "toast-action",
|
|
247
|
+
className: minimal ? "mt-0 shrink-0 self-center" : "mt-2 self-start",
|
|
248
|
+
onClick: () => {
|
|
249
|
+
action.onClick();
|
|
250
|
+
dismissToast(id);
|
|
251
|
+
},
|
|
252
|
+
children: action.label
|
|
253
|
+
}
|
|
254
|
+
) }) : null;
|
|
255
|
+
return /* @__PURE__ */ jsx(
|
|
256
|
+
ToastPrimitive.Root,
|
|
257
|
+
{
|
|
258
|
+
ref: measure,
|
|
259
|
+
open: true,
|
|
260
|
+
duration: Infinity,
|
|
261
|
+
type: variant === "destructive" ? "foreground" : "background",
|
|
262
|
+
"data-slot": "toast",
|
|
263
|
+
className: slots.item(),
|
|
264
|
+
style,
|
|
265
|
+
onOpenChange: (open) => {
|
|
266
|
+
if (!open) dismissToast(id);
|
|
267
|
+
},
|
|
268
|
+
onPause: () => setPaused(true),
|
|
269
|
+
onResume: () => setPaused(false),
|
|
270
|
+
onSwipeStart: (event) => event.preventDefault(),
|
|
271
|
+
onSwipeMove: (event) => {
|
|
272
|
+
event.preventDefault();
|
|
273
|
+
setDrag(event.detail.delta.x);
|
|
274
|
+
},
|
|
275
|
+
onSwipeCancel: (event) => {
|
|
276
|
+
event.preventDefault();
|
|
277
|
+
setDrag(null);
|
|
278
|
+
},
|
|
279
|
+
onSwipeEnd: (event) => {
|
|
280
|
+
event.preventDefault();
|
|
281
|
+
setDrag(null);
|
|
282
|
+
dismissToast(id, "swipe");
|
|
283
|
+
},
|
|
284
|
+
children: /* @__PURE__ */ jsxs(
|
|
285
|
+
"div",
|
|
286
|
+
{
|
|
287
|
+
"data-slot": "toast-surface",
|
|
288
|
+
"data-dragging": drag !== null || void 0,
|
|
289
|
+
className: slots.surface({ className: [motion, cueClass] }),
|
|
290
|
+
style: drag !== null ? { transform: `translateX(${Math.max(0, drag)}px)` } : void 0,
|
|
291
|
+
children: [
|
|
292
|
+
showIcon ? /* @__PURE__ */ jsx(ToastIcon, { variant, className: slots.icon(), layerClassName: slots.iconLayer() }) : null,
|
|
293
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "toast-content", className: slots.content(), children: [
|
|
294
|
+
title ? /* @__PURE__ */ jsx(ToastPrimitive.Title, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
295
|
+
"div",
|
|
296
|
+
{
|
|
297
|
+
"data-slot": "toast-title",
|
|
298
|
+
className: cn(
|
|
299
|
+
slots.title(),
|
|
300
|
+
updates > 0 && "animate-in fade-in-0 slide-in-from-bottom-1 duration-base motion-reduce:animate-none"
|
|
301
|
+
),
|
|
302
|
+
children: title
|
|
303
|
+
},
|
|
304
|
+
updates && cueKind ? String(title) : void 0
|
|
305
|
+
) }) : null,
|
|
306
|
+
description ? /* @__PURE__ */ jsx(ToastPrimitive.Description, { asChild: true, children: /* @__PURE__ */ jsx("div", { "data-slot": "toast-description", className: slots.description(), children: description }) }) : null,
|
|
307
|
+
progress !== void 0 ? /* @__PURE__ */ jsx("div", { "data-slot": "toast-progress", className: slots.progress(), children: /* @__PURE__ */ jsx(
|
|
308
|
+
"div",
|
|
309
|
+
{
|
|
310
|
+
className: slots.progressFill(),
|
|
311
|
+
style: { translate: `-${100 - Math.min(100, Math.max(0, progress))}% 0` }
|
|
312
|
+
}
|
|
313
|
+
) }) : null,
|
|
314
|
+
!minimal ? actionButton : null
|
|
315
|
+
] }),
|
|
316
|
+
minimal ? actionButton : null,
|
|
317
|
+
closeButton,
|
|
318
|
+
countdown && Number.isFinite(duration) ? /* @__PURE__ */ jsx(
|
|
319
|
+
"div",
|
|
320
|
+
{
|
|
321
|
+
"aria-hidden": "true",
|
|
322
|
+
"data-slot": "toast-countdown",
|
|
323
|
+
className: slots.countdown(),
|
|
324
|
+
style: {
|
|
325
|
+
"--toast-duration": `${duration}ms`,
|
|
326
|
+
animationPlayState: paused ? "paused" : "running"
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
updates
|
|
330
|
+
) : null
|
|
331
|
+
]
|
|
332
|
+
}
|
|
333
|
+
)
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
function ToastIcon({ variant, className, layerClassName }) {
|
|
338
|
+
const [shown, setShown] = React.useState({ current: variant, previous: null });
|
|
339
|
+
if (shown.current !== variant) setShown({ current: variant, previous: shown.current });
|
|
340
|
+
const layers = [shown.previous, shown.current].filter((v) => !!v && v !== "default");
|
|
341
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "toast-icon", className, children: layers.map((v) => /* @__PURE__ */ jsx(
|
|
342
|
+
"span",
|
|
343
|
+
{
|
|
344
|
+
className: cn(
|
|
345
|
+
layerClassName,
|
|
346
|
+
v === shown.current ? "opacity-100 scale-100 blur-[0px]" : "opacity-0 scale-50 blur-[2px]"
|
|
347
|
+
),
|
|
348
|
+
children: toastIcons[v]
|
|
349
|
+
},
|
|
350
|
+
v
|
|
351
|
+
)) });
|
|
352
|
+
}
|
|
353
|
+
function ToastBubble({ data }) {
|
|
354
|
+
const { id, variant, title, anchorRect, leaving, duration, cue, cueKind } = data;
|
|
355
|
+
const slots = toastVariants({ appearance: "minimal", tone: variant });
|
|
356
|
+
const entered = useEntered();
|
|
357
|
+
const updates = data.updates;
|
|
358
|
+
React.useEffect(() => {
|
|
359
|
+
if (leaving) return;
|
|
360
|
+
const timer = setTimeout(() => dismissToast(id), duration ?? ANCHORED_TOAST_DURATION);
|
|
361
|
+
return () => clearTimeout(timer);
|
|
362
|
+
}, [id, leaving, duration, updates]);
|
|
363
|
+
if (!anchorRect) return null;
|
|
364
|
+
const side = anchorRect.top < 56 ? "bottom" : "top";
|
|
365
|
+
const resting = entered && !leaving;
|
|
366
|
+
const cueClass = cue > 0 && cueKind ? cueKind === "shake" ? cue % 2 ? "animate-shake-a" : "animate-shake-b" : cue % 2 ? "animate-toast-pop-a" : "animate-toast-pop-b" : void 0;
|
|
367
|
+
return /* @__PURE__ */ jsxs(
|
|
368
|
+
"div",
|
|
369
|
+
{
|
|
370
|
+
"aria-hidden": "true",
|
|
371
|
+
"data-slot": "toast-bubble",
|
|
372
|
+
"data-side": side,
|
|
373
|
+
className: slots.bubble({
|
|
374
|
+
className: [resting ? void 0 : "scale-95 opacity-0", cueClass, "fixed z-[100]"]
|
|
375
|
+
}),
|
|
376
|
+
style: {
|
|
377
|
+
left: anchorRect.left + anchorRect.width / 2,
|
|
378
|
+
top: side === "top" ? anchorRect.top - 8 : anchorRect.bottom + 8,
|
|
379
|
+
translate: side === "top" ? "-50% -100%" : "-50% 0"
|
|
380
|
+
},
|
|
381
|
+
children: [
|
|
382
|
+
variant !== "default" ? /* @__PURE__ */ jsx("span", { className: slots.icon(), children: /* @__PURE__ */ jsx("span", { className: slots.iconLayer(), children: toastIcons[variant] }) }) : null,
|
|
383
|
+
title
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
export {
|
|
389
|
+
Toaster,
|
|
390
|
+
toastIcons,
|
|
391
|
+
toastVariants,
|
|
392
|
+
useToast,
|
|
393
|
+
useToastStore
|
|
394
|
+
};
|
|
395
|
+
//# sourceMappingURL=toast.mjs.map
|