@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/signature/signature.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\n\r\nimport { cubicBezier, easingPoints, prefersReducedMotion, signatureDraw, type SignatureSpeed } from \"../../../lib/motion.mjs\"\r\nimport { tv, type VariantProps } from \"../../../lib/tv.mjs\"\r\n\r\n/*\r\n * A handwritten signature that writes itself, stroke by stroke, at the pace a hand signs. The\r\n * children are the strokes: one <path> per pen stroke, in the order they were written. The pen is\r\n * the component's: ink, weight and round ends override whatever an SVG export wrote on a path.\r\n */\r\nexport const signatureVariants = tv({\r\n base: [\r\n \"block w-fit shrink-0 overflow-visible text-foreground fill-none stroke-current\",\r\n \"[stroke-linecap:round] [stroke-linejoin:round]\",\r\n // The nib keeps its on-screen weight however far the drawing is scaled: the weight in screen\r\n // pixels, divided by the screen pixels per drawing unit (measured on the client).\r\n \"[stroke-width:calc(var(--signature-weight)/var(--signature-scale,1))]\",\r\n \"[&_*]:fill-none [&_*]:stroke-current [&_*]:[stroke-width:inherit]\",\r\n \"opacity-0 data-ready:opacity-100\",\r\n ],\r\n variants: {\r\n size: {\r\n sm: \"h-10 [--signature-weight:1.25px]\",\r\n md: \"h-14 [--signature-weight:1.6px]\",\r\n lg: \"h-20 [--signature-weight:2px]\",\r\n },\r\n },\r\n defaultVariants: { size: \"md\" },\r\n})\r\n\r\nexport interface SignatureProps\r\n extends Omit<React.ComponentProps<\"svg\">, \"aria-label\">,\r\n VariantProps<typeof signatureVariants> {\r\n /** What the signature says, read out in place of the drawing. */\r\n \"aria-label\": string\r\n /** The drawing's box. Leave it out and it fits itself to its ink; pass it to reserve the width. */\r\n viewBox?: string\r\n /** Time for the whole signature and the lift between strokes (900, 1600 or 2800ms). */\r\n speed?: SignatureSpeed\r\n /** Milliseconds the pen waits, once on screen, before it touches down. */\r\n delay?: number\r\n /** Renders the finished drawing with no writing, as under reduced motion. */\r\n static?: boolean\r\n}\r\n\r\nconst easeStroke = cubicBezier(easingPoints.sine)\r\n\r\nexport function Signature({\r\n size,\r\n speed = \"base\",\r\n delay = 0,\r\n static: isStatic = false,\r\n viewBox,\r\n className,\r\n children,\r\n ref,\r\n ...props\r\n}: SignatureProps) {\r\n const svgRef = React.useRef<SVGSVGElement | null>(null)\r\n const [fitted, setFitted] = React.useState<string | null>(null)\r\n const [ready, setReady] = React.useState(false)\r\n const box = viewBox ?? fitted ?? undefined\r\n // What the strokes are, so a parent re-render with the same drawing never restarts the pen.\r\n const strokesKey = React.Children.toArray(children)\r\n .map((child) => (React.isValidElement<{ d?: string }>(child) ? (child.props.d ?? \"\") : \"\"))\r\n .join(\"|\")\r\n\r\n const setRef = React.useCallback(\r\n (node: SVGSVGElement | null) => {\r\n svgRef.current = node\r\n if (typeof ref === \"function\") ref(node)\r\n else if (ref) ref.current = node\r\n },\r\n [ref],\r\n )\r\n\r\n // Fit the box to the ink when no viewBox was given.\r\n React.useLayoutEffect(() => {\r\n const svg = svgRef.current\r\n if (!svg || viewBox) return\r\n const ink = svg.getBBox()\r\n const pad = 4\r\n setFitted(\r\n [ink.x - pad, ink.y - pad, ink.width + pad * 2, ink.height + pad * 2].map((n) => Math.round(n * 10) / 10).join(\" \"),\r\n )\r\n }, [viewBox, strokesKey])\r\n\r\n // Keep --signature-scale (screen px per drawing unit) current as the drawing resizes.\r\n React.useLayoutEffect(() => {\r\n const svg = svgRef.current\r\n if (!svg || !box) return\r\n const height = Number(box.split(/[\\s,]+/)[3])\r\n if (!height) return\r\n const measure = () => {\r\n const scale = svg.getBoundingClientRect().height / height\r\n if (scale > 0) svg.style.setProperty(\"--signature-scale\", String(scale))\r\n }\r\n measure()\r\n const observer = new ResizeObserver(measure)\r\n observer.observe(svg)\r\n return () => observer.disconnect()\r\n }, [box])\r\n\r\n // Prepare the strokes, then write them once a tenth of the drawing is on screen.\r\n React.useLayoutEffect(() => {\r\n const svg = svgRef.current\r\n if (!svg || !box) return\r\n const paths = Array.from(svg.querySelectorAll<SVGGeometryElement>(\"path\"))\r\n const lengths = paths.map((path) => path.getTotalLength())\r\n const finished = isStatic || prefersReducedMotion()\r\n\r\n paths.forEach((path, index) => {\r\n const length = lengths[index]\r\n path.style.strokeDasharray = finished ? \"\" : String(length)\r\n path.style.strokeDashoffset = finished ? \"\" : String(length)\r\n })\r\n setReady(true)\r\n if (finished || paths.length === 0) return\r\n\r\n const { duration, lift } = signatureDraw[speed]\r\n const lifts = lift * (paths.length - 1)\r\n const drawTime = Math.max(duration - lifts, duration * 0.5)\r\n const total = lengths.reduce((sum, length) => sum + length, 0) || 1\r\n // Each stroke's slot in the timeline: a share of the drawing time by length, then a lift.\r\n let cursor = 0\r\n const slots = lengths.map((length) => {\r\n const start = cursor\r\n const span = (length / total) * drawTime\r\n cursor += span + lift\r\n return { start, span }\r\n })\r\n\r\n let frame = 0\r\n let timer = 0\r\n let started = 0\r\n const tick = (now: number) => {\r\n if (!started) started = now\r\n const elapsed = now - started\r\n paths.forEach((path, index) => {\r\n const { start, span } = slots[index]\r\n const progress = span ? Math.min(Math.max((elapsed - start) / span, 0), 1) : elapsed >= start ? 1 : 0\r\n path.style.strokeDashoffset = String(lengths[index] * (1 - easeStroke(progress)))\r\n })\r\n if (elapsed < cursor) frame = requestAnimationFrame(tick)\r\n }\r\n\r\n const observer = new IntersectionObserver(\r\n ([entry]) => {\r\n if (!entry.isIntersecting) return\r\n observer.disconnect()\r\n timer = window.setTimeout(() => {\r\n frame = requestAnimationFrame(tick)\r\n }, delay)\r\n },\r\n { threshold: 0.1 },\r\n )\r\n observer.observe(svg)\r\n return () => {\r\n observer.disconnect()\r\n window.clearTimeout(timer)\r\n cancelAnimationFrame(frame)\r\n }\r\n }, [box, speed, delay, isStatic, strokesKey])\r\n\r\n return (\r\n <svg\r\n ref={setRef}\r\n role=\"img\"\r\n viewBox={box}\r\n data-slot=\"signature\"\r\n data-ready={ready || undefined}\r\n className={signatureVariants({ size, className })}\r\n {...props}\r\n >\r\n {children}\r\n </svg>\r\n )\r\n}\r\n"],"mappings":";AAuKI;AArKJ,YAAY,WAAW;AAEvB,SAAS,aAAa,cAAc,sBAAsB,qBAA0C;AACpG,SAAS,UAA6B;AAO/B,MAAM,oBAAoB,GAAG;AAAA,EAClC,MAAM;AAAA,IACJ;AAAA,IACA;AAAA;AAAA;AAAA,IAGA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,UAAU;AAAA,IACR,M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EACH;AAEJ;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SignaturePad,
|
|
3
|
+
SignaturePadActions,
|
|
4
|
+
SignaturePadUndo,
|
|
5
|
+
SignaturePadClear,
|
|
6
|
+
signaturePadVariants
|
|
7
|
+
} from "./signature-pad.mjs";
|
|
8
|
+
import { signatureViewBox, signatureToSvg, strokeToPath } from "./strokes.mjs";
|
|
9
|
+
export {
|
|
10
|
+
SignaturePad,
|
|
11
|
+
SignaturePadActions,
|
|
12
|
+
SignaturePadClear,
|
|
13
|
+
SignaturePadUndo,
|
|
14
|
+
signaturePadVariants,
|
|
15
|
+
signatureToSvg,
|
|
16
|
+
signatureViewBox,
|
|
17
|
+
strokeToPath
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/signature-pad/index.ts"],"sourcesContent":["export {\n SignaturePad,\n SignaturePadActions,\n SignaturePadUndo,\n SignaturePadClear,\n signaturePadVariants,\n type SignaturePadProps,\n} from \"./signature-pad.mjs\"\nexport { signatureViewBox, signatureToSvg, strokeToPath, type Point } from \"./strokes.mjs\"\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,kBAAkB,gBAAgB,oBAAgC;","names":[]}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { PenNib } from "atoms-icons";
|
|
5
|
+
import { Button } from "../button/index.mjs";
|
|
6
|
+
import { useControllableState } from "../input/use-controllable-state.mjs";
|
|
7
|
+
import { createContext } from "../../../lib/create-context.mjs";
|
|
8
|
+
import { useFieldContext } from "../../../lib/field-context.mjs";
|
|
9
|
+
import { tv } from "../../../lib/tv.mjs";
|
|
10
|
+
import { strokeToPath, signatureToSvg } from "./strokes.mjs";
|
|
11
|
+
const signaturePadVariants = tv({
|
|
12
|
+
slots: {
|
|
13
|
+
root: [
|
|
14
|
+
"group/signature-pad relative isolate h-40 w-full overflow-hidden select-none rounded-md border",
|
|
15
|
+
"bg-[var(--surface,var(--background))] transition-[border-color,box-shadow] duration-fast ease-out outline-none"
|
|
16
|
+
],
|
|
17
|
+
placeholder: "text-sm leading-none opacity-0 transition-opacity duration-fast ease-out group-data-empty/signature-pad:opacity-100",
|
|
18
|
+
guide: [
|
|
19
|
+
"pointer-events-none absolute inset-x-5 bottom-8 flex items-end gap-2 pb-1.5 border-b border-border",
|
|
20
|
+
"text-muted-foreground [&>svg]:size-3.5 [&>svg]:shrink-0"
|
|
21
|
+
],
|
|
22
|
+
surface: [
|
|
23
|
+
"absolute inset-0 size-full cursor-crosshair touch-none text-foreground",
|
|
24
|
+
"fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:2]"
|
|
25
|
+
],
|
|
26
|
+
actions: [
|
|
27
|
+
"absolute top-1.5 right-1.5 z-10 flex items-center gap-0.5 transition-opacity duration-fast ease-out",
|
|
28
|
+
"group-data-empty/signature-pad:pointer-events-none group-data-empty/signature-pad:opacity-0"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
variants: {
|
|
32
|
+
hasError: {
|
|
33
|
+
true: { root: "border-destructive focus-within:border-destructive focus-within:destructive-ring" },
|
|
34
|
+
false: { root: "border-input focus-within:border-focus focus-within:focus-ring" }
|
|
35
|
+
},
|
|
36
|
+
disabled: {
|
|
37
|
+
true: { root: "pointer-events-none opacity-50", surface: "cursor-not-allowed" },
|
|
38
|
+
false: {}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
defaultVariants: { hasError: false, disabled: false }
|
|
42
|
+
});
|
|
43
|
+
const [SignaturePadProvider, useSignaturePad] = createContext("SignaturePad");
|
|
44
|
+
const EMPTY = [];
|
|
45
|
+
function SignaturePad({
|
|
46
|
+
value,
|
|
47
|
+
defaultValue = EMPTY,
|
|
48
|
+
onValueChange,
|
|
49
|
+
name,
|
|
50
|
+
placeholder = "Sign here",
|
|
51
|
+
hasError,
|
|
52
|
+
disabled,
|
|
53
|
+
className,
|
|
54
|
+
children,
|
|
55
|
+
onKeyDown,
|
|
56
|
+
"aria-label": ariaLabel,
|
|
57
|
+
"aria-labelledby": ariaLabelledby,
|
|
58
|
+
...props
|
|
59
|
+
}) {
|
|
60
|
+
const field = useFieldContext();
|
|
61
|
+
const isError = hasError ?? field?.hasError ?? false;
|
|
62
|
+
const isDisabled = disabled ?? field?.disabled ?? false;
|
|
63
|
+
const slots = signaturePadVariants({ hasError: isError, disabled: isDisabled });
|
|
64
|
+
const [strokes, setStrokes] = useControllableState({ prop: value, defaultProp: defaultValue, onChange: onValueChange });
|
|
65
|
+
const [live, setLive] = React.useState(null);
|
|
66
|
+
const points = React.useRef([]);
|
|
67
|
+
const pointerId = React.useRef(null);
|
|
68
|
+
const rootRef = React.useRef(null);
|
|
69
|
+
const undo = React.useCallback(() => setStrokes(strokes.slice(0, -1)), [setStrokes, strokes]);
|
|
70
|
+
const clear = React.useCallback(() => setStrokes(EMPTY), [setStrokes]);
|
|
71
|
+
const at = (event) => {
|
|
72
|
+
const box = event.currentTarget.getBoundingClientRect();
|
|
73
|
+
return [event.clientX - box.left, event.clientY - box.top];
|
|
74
|
+
};
|
|
75
|
+
const onPointerDown = (event) => {
|
|
76
|
+
if (isDisabled || pointerId.current !== null) return;
|
|
77
|
+
if (event.pointerType === "mouse" && event.button !== 0) return;
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
rootRef.current?.focus({ preventScroll: true });
|
|
80
|
+
try {
|
|
81
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
pointerId.current = event.pointerId;
|
|
85
|
+
points.current = [at(event)];
|
|
86
|
+
setLive(strokeToPath(points.current));
|
|
87
|
+
};
|
|
88
|
+
const onPointerMove = (event) => {
|
|
89
|
+
if (event.pointerId !== pointerId.current) return;
|
|
90
|
+
const box = event.currentTarget.getBoundingClientRect();
|
|
91
|
+
const samples = event.nativeEvent.getCoalescedEvents?.() ?? [];
|
|
92
|
+
for (const sample of samples.length ? samples : [event.nativeEvent]) {
|
|
93
|
+
points.current.push([sample.clientX - box.left, sample.clientY - box.top]);
|
|
94
|
+
}
|
|
95
|
+
setLive(strokeToPath(points.current));
|
|
96
|
+
};
|
|
97
|
+
const finish = (event) => {
|
|
98
|
+
if (event.pointerId !== pointerId.current) return;
|
|
99
|
+
pointerId.current = null;
|
|
100
|
+
const path = strokeToPath(points.current);
|
|
101
|
+
points.current = [];
|
|
102
|
+
setLive(null);
|
|
103
|
+
if (path) setStrokes([...strokes, path]);
|
|
104
|
+
};
|
|
105
|
+
const drawing = live !== null;
|
|
106
|
+
const empty = strokes.length === 0 && !drawing;
|
|
107
|
+
const signed = strokes.length > 0;
|
|
108
|
+
const [wasSigned, setWasSigned] = React.useState(signed);
|
|
109
|
+
const [announcement, setAnnouncement] = React.useState("");
|
|
110
|
+
if (signed !== wasSigned) {
|
|
111
|
+
setWasSigned(signed);
|
|
112
|
+
setAnnouncement(signed ? "Signed" : "Cleared");
|
|
113
|
+
}
|
|
114
|
+
const labelledBy = ariaLabelledby ?? (ariaLabel ? void 0 : field?.labelledBy);
|
|
115
|
+
const label = ariaLabel ?? (labelledBy ? void 0 : "Signature");
|
|
116
|
+
return /* @__PURE__ */ jsx(SignaturePadProvider, { strokes, undo, clear, disabled: isDisabled, slots, children: /* @__PURE__ */ jsxs(
|
|
117
|
+
"div",
|
|
118
|
+
{
|
|
119
|
+
ref: rootRef,
|
|
120
|
+
role: "group",
|
|
121
|
+
tabIndex: -1,
|
|
122
|
+
"aria-label": label,
|
|
123
|
+
"aria-labelledby": labelledBy,
|
|
124
|
+
"aria-describedby": field?.describedBy,
|
|
125
|
+
"data-slot": "signature-pad",
|
|
126
|
+
"data-empty": empty || void 0,
|
|
127
|
+
"data-drawing": drawing || void 0,
|
|
128
|
+
"data-disabled": isDisabled || void 0,
|
|
129
|
+
className: slots.root({ className }),
|
|
130
|
+
onKeyDown: (event) => {
|
|
131
|
+
onKeyDown?.(event);
|
|
132
|
+
if (event.defaultPrevented || isDisabled) return;
|
|
133
|
+
if ((event.metaKey || event.ctrlKey) && !event.shiftKey && event.key.toLowerCase() === "z" && strokes.length) {
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
undo();
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
...props,
|
|
139
|
+
children: [
|
|
140
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "signature-pad-guide", "aria-hidden": true, className: slots.guide(), children: [
|
|
141
|
+
/* @__PURE__ */ jsx(PenNib, {}),
|
|
142
|
+
/* @__PURE__ */ jsx("span", { className: slots.placeholder(), children: placeholder })
|
|
143
|
+
] }),
|
|
144
|
+
/* @__PURE__ */ jsx("span", { role: "status", "aria-live": "polite", className: "sr-only", children: announcement }),
|
|
145
|
+
/* @__PURE__ */ jsxs(
|
|
146
|
+
"svg",
|
|
147
|
+
{
|
|
148
|
+
"data-slot": "signature-pad-surface",
|
|
149
|
+
"aria-hidden": true,
|
|
150
|
+
className: slots.surface(),
|
|
151
|
+
onPointerDown,
|
|
152
|
+
onPointerMove,
|
|
153
|
+
onPointerUp: finish,
|
|
154
|
+
onPointerCancel: finish,
|
|
155
|
+
children: [
|
|
156
|
+
strokes.map((d, index) => /* @__PURE__ */ jsx("path", { d }, index)),
|
|
157
|
+
live && /* @__PURE__ */ jsx("path", { d: live })
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
children,
|
|
162
|
+
name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: signatureToSvg(strokes) })
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
) });
|
|
166
|
+
}
|
|
167
|
+
function SignaturePadActions({ className, ...props }) {
|
|
168
|
+
const { slots } = useSignaturePad("SignaturePadActions");
|
|
169
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "signature-pad-actions", className: slots.actions({ className }), ...props });
|
|
170
|
+
}
|
|
171
|
+
function PadButton({
|
|
172
|
+
action,
|
|
173
|
+
slot,
|
|
174
|
+
label,
|
|
175
|
+
children,
|
|
176
|
+
onClick,
|
|
177
|
+
...props
|
|
178
|
+
}) {
|
|
179
|
+
const pad = useSignaturePad(slot);
|
|
180
|
+
return /* @__PURE__ */ jsx(
|
|
181
|
+
Button,
|
|
182
|
+
{
|
|
183
|
+
type: "button",
|
|
184
|
+
variant: "ghost",
|
|
185
|
+
size: "sm",
|
|
186
|
+
"data-slot": slot,
|
|
187
|
+
disabled: pad.disabled || pad.strokes.length === 0,
|
|
188
|
+
onClick: (event) => {
|
|
189
|
+
onClick?.(event);
|
|
190
|
+
if (!event.defaultPrevented) pad[action]();
|
|
191
|
+
},
|
|
192
|
+
...props,
|
|
193
|
+
children: children ?? label
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
function SignaturePadUndo(props) {
|
|
198
|
+
return /* @__PURE__ */ jsx(PadButton, { action: "undo", slot: "signature-pad-undo", label: "Undo", ...props });
|
|
199
|
+
}
|
|
200
|
+
function SignaturePadClear(props) {
|
|
201
|
+
return /* @__PURE__ */ jsx(PadButton, { action: "clear", slot: "signature-pad-clear", label: "Clear", ...props });
|
|
202
|
+
}
|
|
203
|
+
export {
|
|
204
|
+
SignaturePad,
|
|
205
|
+
SignaturePadActions,
|
|
206
|
+
SignaturePadClear,
|
|
207
|
+
SignaturePadUndo,
|
|
208
|
+
signaturePadVariants
|
|
209
|
+
};
|
|
210
|
+
//# sourceMappingURL=signature-pad.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/signature-pad/signature-pad.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport { PenNib } from \"atoms-icons\"\r\n\r\nimport { Button, type ButtonProps } from \"../button/index.mjs\"\r\nimport { useControllableState } from \"../input/use-controllable-state.mjs\"\r\nimport { createContext } from \"../../../lib/create-context.mjs\"\r\nimport { useFieldContext } from \"../../../lib/field-context.mjs\"\r\nimport { tv } from \"../../../lib/tv.mjs\"\r\n\r\nimport { strokeToPath, signatureToSvg, type Point } from \"./strokes.mjs\"\r\n\r\n/*\r\n * A page to sign on with a mouse, a finger or a stylus. Each pen stroke is kept as one smooth SVG\r\n * path, in writing order, so a Signature can play the hand back and a form can submit it.\r\n */\r\nexport const signaturePadVariants = tv({\r\n slots: {\r\n root: [\r\n \"group/signature-pad relative isolate h-40 w-full overflow-hidden select-none rounded-md border\",\r\n \"bg-[var(--surface,var(--background))] transition-[border-color,box-shadow] duration-fast ease-out outline-none\",\r\n ],\r\n placeholder:\r\n \"text-sm leading-none opacity-0 transition-opacity duration-fast ease-out group-data-empty/signature-pad:opacity-100\",\r\n guide: [\r\n \"pointer-events-none absolute inset-x-5 bottom-8 flex items-end gap-2 pb-1.5 border-b border-border\",\r\n \"text-muted-foreground [&>svg]:size-3.5 [&>svg]:shrink-0\",\r\n ],\r\n surface: [\r\n \"absolute inset-0 size-full cursor-crosshair touch-none text-foreground\",\r\n \"fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:2]\",\r\n ],\r\n actions: [\r\n \"absolute top-1.5 right-1.5 z-10 flex items-center gap-0.5 transition-opacity duration-fast ease-out\",\r\n \"group-data-empty/signature-pad:pointer-events-none group-data-empty/signature-pad:opacity-0\",\r\n ],\r\n },\r\n variants: {\r\n hasError: {\r\n true: { root: \"border-destructive focus-within:border-destructive focus-within:destructive-ring\" },\r\n false: { root: \"border-input focus-within:border-focus focus-within:focus-ring\" },\r\n },\r\n disabled: {\r\n true: { root: \"pointer-events-none opacity-50\", surface: \"cursor-not-allowed\" },\r\n false: {},\r\n },\r\n },\r\n defaultVariants: { hasError: false, disabled: false },\r\n})\r\n\r\ninterface SignaturePadContextValue {\r\n strokes: string[]\r\n undo: () => void\r\n clear: () => void\r\n disabled: boolean\r\n slots: ReturnType<typeof signaturePadVariants>\r\n}\r\n\r\nconst [SignaturePadProvider, useSignaturePad] = createContext<SignaturePadContextValue>(\"SignaturePad\")\r\n\r\nexport interface SignaturePadProps extends Omit<React.ComponentProps<\"div\">, \"defaultValue\" | \"placeholder\"> {\r\n /** The strokes, one SVG path per pen stroke in writing order (controlled). */\r\n value?: string[]\r\n /** The strokes to start from (uncontrolled). */\r\n defaultValue?: string[]\r\n /** Called when a stroke lands, and on undo and clear, with every stroke so far. */\r\n onValueChange?: (strokes: string[]) => void\r\n /** Submits the drawing under this name as a standalone SVG document (see `signatureToSvg`). */\r\n name?: string\r\n /** The text on the baseline while the page is empty. */\r\n placeholder?: React.ReactNode\r\n /** Paints the destructive frame. Falls back to the enclosing Field's error state. */\r\n hasError?: boolean\r\n /** Stops the pen and dims the pad. Falls back to the enclosing Field's disabled state. */\r\n disabled?: boolean\r\n}\r\n\r\nconst EMPTY: string[] = []\r\n\r\nexport function SignaturePad({\r\n value,\r\n defaultValue = EMPTY,\r\n onValueChange,\r\n name,\r\n placeholder = \"Sign here\",\r\n hasError,\r\n disabled,\r\n className,\r\n children,\r\n onKeyDown,\r\n \"aria-label\": ariaLabel,\r\n \"aria-labelledby\": ariaLabelledby,\r\n ...props\r\n}: SignaturePadProps) {\r\n const field = useFieldContext()\r\n const isError = hasError ?? field?.hasError ?? false\r\n const isDisabled = disabled ?? field?.disabled ?? false\r\n const slots = signaturePadVariants({ hasError: isError, disabled: isDisabled })\r\n\r\n const [strokes, setStrokes] = useControllableState({ prop: value, defaultProp: defaultValue, onChange: onValueChange })\r\n const [live, setLive] = React.useState<string | null>(null)\r\n const points = React.useRef<Point[]>([])\r\n const pointerId = React.useRef<number | null>(null)\r\n const rootRef = React.useRef<HTMLDivElement>(null)\r\n\r\n const undo = React.useCallback(() => setStrokes(strokes.slice(0, -1)), [setStrokes, strokes])\r\n const clear = React.useCallback(() => setStrokes(EMPTY), [setStrokes])\r\n\r\n const at = (event: React.PointerEvent<SVGSVGElement>): Point => {\r\n const box = event.currentTarget.getBoundingClientRect()\r\n return [event.clientX - box.left, event.clientY - box.top]\r\n }\r\n\r\n const onPointerDown = (event: React.PointerEvent<SVGSVGElement>) => {\r\n if (isDisabled || pointerId.current !== null) return\r\n if (event.pointerType === \"mouse\" && event.button !== 0) return\r\n event.preventDefault()\r\n rootRef.current?.focus({ preventScroll: true })\r\n try {\r\n event.currentTarget.setPointerCapture(event.pointerId)\r\n } catch {\r\n // A pointer the browser no longer tracks can't be captured; the stroke still draws.\r\n }\r\n pointerId.current = event.pointerId\r\n points.current = [at(event)]\r\n setLive(strokeToPath(points.current))\r\n }\r\n\r\n const onPointerMove = (event: React.PointerEvent<SVGSVGElement>) => {\r\n if (event.pointerId !== pointerId.current) return\r\n const box = event.currentTarget.getBoundingClientRect()\r\n const samples = event.nativeEvent.getCoalescedEvents?.() ?? []\r\n for (const sample of samples.length ? samples : [event.nativeEvent]) {\r\n points.current.push([sample.clientX - box.left, sample.clientY - box.top])\r\n }\r\n setLive(strokeToPath(points.current))\r\n }\r\n\r\n const finish = (event: React.PointerEvent<SVGSVGElement>) => {\r\n if (event.pointerId !== pointerId.current) return\r\n pointerId.current = null\r\n const path = strokeToPath(points.current)\r\n points.current = []\r\n setLive(null)\r\n if (path) setStrokes([...strokes, path])\r\n }\r\n\r\n const drawing = live !== null\r\n const empty = strokes.length === 0 && !drawing\r\n\r\n // One polite word when the page goes from blank to signed, or is cleared; nothing on mount.\r\n const signed = strokes.length > 0\r\n const [wasSigned, setWasSigned] = React.useState(signed)\r\n const [announcement, setAnnouncement] = React.useState(\"\")\r\n if (signed !== wasSigned) {\r\n setWasSigned(signed)\r\n setAnnouncement(signed ? \"Signed\" : \"Cleared\")\r\n }\r\n\r\n // Named by its Field's label (and described by its hint) like an Input; \"Signature\" otherwise.\r\n const labelledBy = ariaLabelledby ?? (ariaLabel ? undefined : field?.labelledBy)\r\n const label = ariaLabel ?? (labelledBy ? undefined : \"Signature\")\r\n\r\n return (\r\n <SignaturePadProvider strokes={strokes} undo={undo} clear={clear} disabled={isDisabled} slots={slots}>\r\n <div\r\n ref={rootRef}\r\n role=\"group\"\r\n tabIndex={-1}\r\n aria-label={label}\r\n aria-labelledby={labelledBy}\r\n aria-describedby={field?.describedBy}\r\n data-slot=\"signature-pad\"\r\n data-empty={empty || undefined}\r\n data-drawing={drawing || undefined}\r\n data-disabled={isDisabled || undefined}\r\n className={slots.root({ className })}\r\n onKeyDown={(event) => {\r\n onKeyDown?.(event)\r\n if (event.defaultPrevented || isDisabled) return\r\n if ((event.metaKey || event.ctrlKey) && !event.shiftKey && event.key.toLowerCase() === \"z\" && strokes.length) {\r\n event.preventDefault()\r\n undo()\r\n }\r\n }}\r\n {...props}\r\n >\r\n <div data-slot=\"signature-pad-guide\" aria-hidden className={slots.guide()}>\r\n <PenNib />\r\n <span className={slots.placeholder()}>{placeholder}</span>\r\n </div>\r\n <span role=\"status\" aria-live=\"polite\" className=\"sr-only\">\r\n {announcement}\r\n </span>\r\n <svg\r\n data-slot=\"signature-pad-surface\"\r\n aria-hidden\r\n className={slots.surface()}\r\n onPointerDown={onPointerDown}\r\n onPointerMove={onPointerMove}\r\n onPointerUp={finish}\r\n onPointerCancel={finish}\r\n >\r\n {strokes.map((d, index) => (\r\n <path key={index} d={d} />\r\n ))}\r\n {live && <path d={live} />}\r\n </svg>\r\n {children}\r\n {name && <input type=\"hidden\" name={name} value={signatureToSvg(strokes)} />}\r\n </div>\r\n </SignaturePadProvider>\r\n )\r\n}\r\n\r\n/** The top-right corner holding Undo and Clear, hidden while the pad is empty. */\r\nexport function SignaturePadActions({ className, ...props }: React.ComponentProps<\"div\">) {\r\n const { slots } = useSignaturePad(\"SignaturePadActions\")\r\n return <div data-slot=\"signature-pad-actions\" className={slots.actions({ className })} {...props} />\r\n}\r\n\r\nfunction PadButton({\r\n action,\r\n slot,\r\n label,\r\n children,\r\n onClick,\r\n ...props\r\n}: ButtonProps & { action: \"undo\" | \"clear\"; slot: string; label: string }) {\r\n const pad = useSignaturePad(slot)\r\n return (\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n size=\"sm\"\r\n data-slot={slot}\r\n disabled={pad.disabled || pad.strokes.length === 0}\r\n onClick={(event) => {\r\n onClick?.(event)\r\n if (!event.defaultPrevented) pad[action]()\r\n }}\r\n {...props}\r\n >\r\n {children ?? label}\r\n </Button>\r\n )\r\n}\r\n\r\n/** A ghost sm Button that takes back the last stroke (also Cmd/Ctrl+Z while the pad has focus). */\r\nexport function SignaturePadUndo(props: ButtonProps) {\r\n return <PadButton action=\"undo\" slot=\"signature-pad-undo\" label=\"Undo\" {...props} />\r\n}\r\n\r\n/** A ghost sm Button that wipes the page. */\r\nexport function SignaturePadClear(props: ButtonProps) {\r\n return <PadButton action=\"clear\" slot=\"signature-pad-clear\" label=\"Clear\" {...props} />\r\n}\r\n"],"mappings":";AA4LQ,SACE,KADF;AA1LR,YAAY,WAAW;AACvB,SAAS,cAAc;AAEvB,SAAS,cAAgC;AACzC,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,UAAU;AAEnB,SAAS,cAAc,sBAAkC;AAMlD,MAAM,uBAAuB,GAAG;AAAA,EACrC,OAAO;AAAA,IACL,MAAM;AAAA,MACJ;AAAA,MACA;AAAA,IACF;AAAA,IACA,aACE;AAAA,IACF,OAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,MACP;AAAA,MACA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,MACP;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,UAAU;AAAA,IACR,UAAU;AAAA,MACR,MAAM,EAAE,MAAM,mFAAmF;AAAA,MACjG,OAAO,EAAE,MAAM,iEAAiE;AAAA,IAClF;AAAA,IACA,UAAU;AAAA,MACR,MAAM,EAAE,MAAM,kCAAk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QAAQ,oBAAC,WAAM,MAAK,UAAS,MAAY,OAAO,eAAe,OAAO,GAAG;AAAA;AAAA;AAAA,EAC5E,GACF;AAEJ;AAGO,SAAS,oBAAoB,EAAE,WAAW,GAAG,MAAM,GAAgC;AACxF,QAAM,EAAE,MAAM,IAAI,gBAAgB,qBAAqB;AACvD,SAAO,oBAAC,SAAI,aAAU,yBAAwB,WAAW,MAAM,QAAQ,EAAE,UAAU,CAAC,GAAI,GAAG,OAAO;AACpG;AAEA,SAAS,UAAU;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAA4E;AAC1E,QAAM,MAAM,gBAAgB,IAAI;AAChC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,aAAW;AAAA,MACX,UAAU,IAAI,YAAY,IAAI,QAAQ,WAAW;AAAA,MACjD,SAAS,CAAC,UAAU;AAClB,kBAAU,KAAK;AACf,YAAI,CAAC,MAAM,iBAAkB,KAAI,MAAM,EAAE;AAAA,MAC3C;AAAA,MACC,GAAG;AAAA,MAEH,sBAAY;AAAA;AAAA,EACf;AAEJ;AAGO,SAAS,iBAAiB,OAAoB;AACnD,SAAO,oBAAC,aAAU,QAAO,QAAO,MAAK,sBAAqB,OAAM,QAAQ,GAAG,OAAO;AACpF;AAGO,SAAS,kBAAkB,OAAoB;AACpD,SAAO,oBAAC,aAAU,QAAO,SAAQ,MAAK,uBAAsB,OAAM,SAAS,GAAG,OAAO;AACvF;","names":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const round = (n) => Math.round(n * 10) / 10;
|
|
2
|
+
const pt = ([x, y]) => `${round(x)} ${round(y)}`;
|
|
3
|
+
function simplify(points, min = 1.5) {
|
|
4
|
+
if (points.length < 3) return points;
|
|
5
|
+
const kept = [points[0]];
|
|
6
|
+
for (let i = 1; i < points.length - 1; i++) {
|
|
7
|
+
const [x, y] = points[i];
|
|
8
|
+
const [lx, ly] = kept[kept.length - 1];
|
|
9
|
+
if (Math.hypot(x - lx, y - ly) >= min) kept.push(points[i]);
|
|
10
|
+
}
|
|
11
|
+
kept.push(points[points.length - 1]);
|
|
12
|
+
return kept;
|
|
13
|
+
}
|
|
14
|
+
function strokeToPath(input) {
|
|
15
|
+
const points = simplify(input);
|
|
16
|
+
if (points.length === 0) return "";
|
|
17
|
+
if (points.length === 1) {
|
|
18
|
+
const [x, y] = points[0];
|
|
19
|
+
return `M${pt([x, y])}L${pt([x + 0.1, y])}`;
|
|
20
|
+
}
|
|
21
|
+
if (points.length === 2) return `M${pt(points[0])}L${pt(points[1])}`;
|
|
22
|
+
let d = `M${pt(points[0])}`;
|
|
23
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
24
|
+
const p0 = points[i - 1] ?? points[i];
|
|
25
|
+
const p1 = points[i];
|
|
26
|
+
const p2 = points[i + 1];
|
|
27
|
+
const p3 = points[i + 2] ?? p2;
|
|
28
|
+
const c1 = [p1[0] + (p2[0] - p0[0]) / 6, p1[1] + (p2[1] - p0[1]) / 6];
|
|
29
|
+
const c2 = [p2[0] - (p3[0] - p1[0]) / 6, p2[1] - (p3[1] - p1[1]) / 6];
|
|
30
|
+
d += `C${pt(c1)} ${pt(c2)} ${pt(p2)}`;
|
|
31
|
+
}
|
|
32
|
+
return d;
|
|
33
|
+
}
|
|
34
|
+
function pathPoints(d) {
|
|
35
|
+
const numbers = d.match(/-?\d*\.?\d+(?:e-?\d+)?/gi)?.map(Number) ?? [];
|
|
36
|
+
const points = [];
|
|
37
|
+
for (let i = 0; i + 1 < numbers.length; i += 2) points.push([numbers[i], numbers[i + 1]]);
|
|
38
|
+
return points;
|
|
39
|
+
}
|
|
40
|
+
function signatureViewBox(strokes, padding = 4) {
|
|
41
|
+
const points = strokes.flatMap(pathPoints);
|
|
42
|
+
if (points.length === 0) return "0 0 0 0";
|
|
43
|
+
let minX = Infinity;
|
|
44
|
+
let minY = Infinity;
|
|
45
|
+
let maxX = -Infinity;
|
|
46
|
+
let maxY = -Infinity;
|
|
47
|
+
for (const [x, y] of points) {
|
|
48
|
+
minX = Math.min(minX, x);
|
|
49
|
+
minY = Math.min(minY, y);
|
|
50
|
+
maxX = Math.max(maxX, x);
|
|
51
|
+
maxY = Math.max(maxY, y);
|
|
52
|
+
}
|
|
53
|
+
return [minX - padding, minY - padding, maxX - minX + padding * 2, maxY - minY + padding * 2].map(round).join(" ");
|
|
54
|
+
}
|
|
55
|
+
function signatureToSvg(strokes) {
|
|
56
|
+
if (strokes.length === 0) return "";
|
|
57
|
+
const viewBox = signatureViewBox(strokes);
|
|
58
|
+
const [, , width, height] = viewBox.split(" ");
|
|
59
|
+
const paths = strokes.map((d) => `<path d="${d}"/>`).join("");
|
|
60
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${viewBox}" width="${width}" height="${height}" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${paths}</svg>`;
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
signatureToSvg,
|
|
64
|
+
signatureViewBox,
|
|
65
|
+
simplify,
|
|
66
|
+
strokeToPath
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=strokes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/signature-pad/strokes.ts"],"sourcesContent":["/*\n * Pen strokes as SVG paths. A stroke is the list of points the pen touched; it is kept as one\n * smooth path (a Catmull-Rom spline through the points, written as cubic Béziers) so a Signature\n * can replay it and a form can submit it as plain text.\n */\n\nexport type Point = readonly [x: number, y: number]\n\nconst round = (n: number) => Math.round(n * 10) / 10\nconst pt = ([x, y]: Point) => `${round(x)} ${round(y)}`\n\n/** Drops points closer than `min` px to the last kept one, so a slow pen doesn't bloat the path. */\nexport function simplify(points: Point[], min = 1.5): Point[] {\n if (points.length < 3) return points\n const kept: Point[] = [points[0]]\n for (let i = 1; i < points.length - 1; i++) {\n const [x, y] = points[i]\n const [lx, ly] = kept[kept.length - 1]\n if (Math.hypot(x - lx, y - ly) >= min) kept.push(points[i])\n }\n kept.push(points[points.length - 1])\n return kept\n}\n\n/** A smooth path through the points. A single touch becomes a dot the round cap can draw. */\nexport function strokeToPath(input: Point[]): string {\n const points = simplify(input)\n if (points.length === 0) return \"\"\n if (points.length === 1) {\n const [x, y] = points[0]\n return `M${pt([x, y])}L${pt([x + 0.1, y])}`\n }\n if (points.length === 2) return `M${pt(points[0])}L${pt(points[1])}`\n\n let d = `M${pt(points[0])}`\n for (let i = 0; i < points.length - 1; i++) {\n const p0 = points[i - 1] ?? points[i]\n const p1 = points[i]\n const p2 = points[i + 1]\n const p3 = points[i + 2] ?? p2\n const c1: Point = [p1[0] + (p2[0] - p0[0]) / 6, p1[1] + (p2[1] - p0[1]) / 6]\n const c2: Point = [p2[0] - (p3[0] - p1[0]) / 6, p2[1] - (p3[1] - p1[1]) / 6]\n d += `C${pt(c1)} ${pt(c2)} ${pt(p2)}`\n }\n return d\n}\n\n/** Every coordinate pair in a path written by `strokeToPath` (or any absolute M/L/C path). */\nfunction pathPoints(d: string): Point[] {\n const numbers = d.match(/-?\\d*\\.?\\d+(?:e-?\\d+)?/gi)?.map(Number) ?? []\n const points: Point[] = []\n for (let i = 0; i + 1 < numbers.length; i += 2) points.push([numbers[i], numbers[i + 1]])\n return points\n}\n\n/**\n * The box around the ink, padded, as a viewBox string: pass it to a Signature to reserve its width\n * from the first paint. Control points are included, so the box never clips a curve.\n */\nexport function signatureViewBox(strokes: string[], padding = 4): string {\n const points = strokes.flatMap(pathPoints)\n if (points.length === 0) return \"0 0 0 0\"\n let minX = Infinity\n let minY = Infinity\n let maxX = -Infinity\n let maxY = -Infinity\n for (const [x, y] of points) {\n minX = Math.min(minX, x)\n minY = Math.min(minY, y)\n maxX = Math.max(maxX, x)\n maxY = Math.max(maxY, y)\n }\n return [minX - padding, minY - padding, maxX - minX + padding * 2, maxY - minY + padding * 2]\n .map(round)\n .join(\" \")\n}\n\n/** The drawing as a standalone SVG document with currentColor ink; \"\" for no strokes. */\nexport function signatureToSvg(strokes: string[]): string {\n if (strokes.length === 0) return \"\"\n const viewBox = signatureViewBox(strokes)\n const [, , width, height] = viewBox.split(\" \")\n const paths = strokes.map((d) => `<path d=\"${d}\"/>`).join(\"\")\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"${viewBox}\" width=\"${width}\" height=\"${height}\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">${paths}</svg>`\n}\n"],"mappings":"AAQA,MAAM,QAAQ,CAAC,MAAc,KAAK,MAAM,IAAI,EAAE,IAAI;AAClD,MAAM,KAAK,CAAC,CAAC,GAAG,CAAC,MAAa,GAAG,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAG9C,SAAS,SAAS,QAAiB,MAAM,KAAc;AAC5D,MAAI,OAAO,SAAS,EAAG,QAAO;AAC9B,QAAM,OAAgB,CAAC,OAAO,CAAC,CAAC;AAChC,WAAS,IAAI,GAAG,IAAI,OAAO,SAAS,GAAG,KAAK;AAC1C,UAAM,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC;AACvB,UAAM,CAAC,IAAI,EAAE,IAAI,KAAK,KAAK,SAAS,CAAC;AACrC,QAAI,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,KAAK,IAAK,MAAK,KAAK,OAAO,CAAC,CAAC;AAAA,EAC5D;AACA,OAAK,KAAK,OAAO,OAAO,SAAS,CAAC,CAAC;AACnC,SAAO;AACT;AAGO,SAAS,aAAa,OAAwB;AACnD,QAAM,SAAS,SAAS,KAAK;AAC7B,MAAI,OAAO,WAAW,EAAG,QAAO;AAChC,MAAI,OAAO,WAAW,GAAG;AACvB,UAAM,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC;AACvB,WAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,G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AAO;AACX,MAAI,OAAO;AACX,MAAI,OAAO;AACX,MAAI,OAAO;AACX,aAAW,CAAC,GAAG,CAAC,KAAK,QAAQ;AAC3B,WAAO,KAAK,IAAI,MAAM,CAAC;AACvB,WAAO,KAAK,IAAI,MAAM,CAAC;AACvB,WAAO,KAAK,IAAI,MAAM,CAAC;AACvB,WAAO,KAAK,IAAI,MAAM,CAAC;AAAA,EACzB;AACA,SAAO,CAAC,OAAO,SAAS,OAAO,SAAS,OAAO,OAAO,UAAU,GAAG,OAAO,OAAO,UAAU,CAAC,EACzF,IAAI,KAAK,EACT,KAAK,GAAG;AACb;AAGO,SAAS,eAAe,SAA2B;AACxD,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,QAAM,UAAU,iBAAiB,OAAO;AACxC,QAAM,CAAC,EAAE,EAAE,OAAO,MAAM,IAAI,QAAQ,MAAM,GAAG;AAC7C,QAAM,QAAQ,QAAQ,IAAI,CAAC,MAAM,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE;AAC5D,SAAO,oDAAoD,OAAO,YAAY,KAAK,aAAa,MAAM,uGAAuG,KAAK;AACpN;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/skeleton/index.ts"],"sourcesContent":["export {\n Skeleton,\n skeletonVariants,\n type SkeletonProps,\n type SkeletonVariant,\n type SkeletonAnimation,\n} from \"./skeleton.mjs\"\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAIK;","names":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { tv } from "../../../lib/tv.mjs";
|
|
3
|
+
import { cn } from "../../../lib/utils.mjs";
|
|
4
|
+
const skeletonVariants = tv({
|
|
5
|
+
base: "block shrink-0 bg-muted relative overflow-hidden",
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
rectangle: "rounded-md",
|
|
9
|
+
circle: "aspect-square rounded-full",
|
|
10
|
+
text: "h-[1lh] rounded-sm"
|
|
11
|
+
},
|
|
12
|
+
animation: {
|
|
13
|
+
shimmer: [
|
|
14
|
+
"after:absolute after:inset-0 after:animate-shimmer after:bg-gradient-to-r after:from-transparent after:via-foreground/10 after:to-transparent after:[will-change:transform]",
|
|
15
|
+
"motion-reduce:after:animate-none motion-reduce:after:hidden"
|
|
16
|
+
],
|
|
17
|
+
pulse: "animate-pulse motion-reduce:animate-none",
|
|
18
|
+
none: ""
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: { variant: "rectangle", animation: "shimmer" }
|
|
22
|
+
});
|
|
23
|
+
function Skeleton({ variant = "rectangle", animation = "shimmer", lines, className, ...props }) {
|
|
24
|
+
if (variant === "text" && lines && lines > 1) {
|
|
25
|
+
return /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: cn("flex w-full flex-col gap-2.5", className), ...props, children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx(
|
|
26
|
+
"span",
|
|
27
|
+
{
|
|
28
|
+
"data-slot": "skeleton",
|
|
29
|
+
"aria-hidden": true,
|
|
30
|
+
className: skeletonVariants({
|
|
31
|
+
variant,
|
|
32
|
+
animation,
|
|
33
|
+
className: index === lines - 1 ? "w-3/5" : "w-full"
|
|
34
|
+
})
|
|
35
|
+
},
|
|
36
|
+
index
|
|
37
|
+
)) });
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
"data-slot": "skeleton",
|
|
43
|
+
"aria-hidden": true,
|
|
44
|
+
className: skeletonVariants({
|
|
45
|
+
variant,
|
|
46
|
+
animation,
|
|
47
|
+
// A text line is full width unless the caller sets one (tailwind-merge keeps the last).
|
|
48
|
+
className: cn(variant === "text" && "w-full", className)
|
|
49
|
+
}),
|
|
50
|
+
...props
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
Skeleton,
|
|
56
|
+
skeletonVariants
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=skeleton.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/skeleton/skeleton.tsx"],"sourcesContent":["import * as React from \"react\"\r\n\r\nimport { tv, type VariantProps } from \"../../../lib/tv.mjs\"\r\nimport { cn } from \"../../../lib/utils.mjs\"\r\n\r\n/*\r\n * A loading placeholder that mirrors the shape of the content it stands in for. The fill is the\r\n * muted role, so it re-themes everywhere; the shimmer rides the shared --animate-shimmer token.\r\n */\r\nexport const skeletonVariants = tv({\r\n base: \"block shrink-0 bg-muted relative overflow-hidden\",\r\n variants: {\r\n variant: {\r\n rectangle: \"rounded-md\",\r\n circle: \"aspect-square rounded-full\",\r\n text: \"h-[1lh] rounded-sm\",\r\n },\r\n animation: {\r\n shimmer: [\r\n \"after:absolute after:inset-0 after:animate-shimmer after:bg-gradient-to-r after:from-transparent after:via-foreground/10 after:to-transparent after:[will-change:transform]\",\r\n \"motion-reduce:after:animate-none motion-reduce:after:hidden\",\r\n ],\r\n pulse: \"animate-pulse motion-reduce:animate-none\",\r\n none: \"\",\r\n },\r\n },\r\n defaultVariants: { variant: \"rectangle\", animation: \"shimmer\" },\r\n})\r\n\r\nexport type SkeletonVariant = NonNullable<VariantProps<typeof skeletonVariants>[\"variant\"]>\r\nexport type SkeletonAnimation = NonNullable<VariantProps<typeof skeletonVariants>[\"animation\"]>\r\n\r\nexport interface SkeletonProps extends React.ComponentProps<\"div\">, VariantProps<typeof skeletonVariants> {\r\n /** With `variant=\"text\"`, stacks this many lines (the last at 60%); `className` styles the group. */\r\n lines?: number\r\n}\r\n\r\n/** A decorative, `aria-hidden` placeholder; set `aria-busy` on the loading region instead. */\r\nexport function Skeleton({ variant = \"rectangle\", animation = \"shimmer\", lines, className, ...props }: SkeletonProps) {\r\n if (variant === \"text\" && lines && lines > 1) {\r\n return (\r\n <div aria-hidden className={cn(\"flex w-full flex-col gap-2.5\", className)} {...props}>\r\n {Array.from({ length: lines }, (_, index) => (\r\n <span\r\n key={index}\r\n data-slot=\"skeleton\"\r\n aria-hidden\r\n className={skeletonVariants({\r\n variant,\r\n animation,\r\n className: index === lines - 1 ? \"w-3/5\" : \"w-full\",\r\n })}\r\n />\r\n ))}\r\n </div>\r\n )\r\n }\r\n\r\n return (\r\n <div\r\n data-slot=\"skeleton\"\r\n aria-hidden\r\n className={skeletonVariants({\r\n variant,\r\n animation,\r\n // A text line is full width unless the caller sets one (tailwind-merge keeps the last).\r\n className: cn(variant === \"text\" && \"w-full\", className),\r\n })}\r\n {...props}\r\n />\r\n )\r\n}\r\n"],"mappings":"AA2CU;AAzCV,SAAS,UAA6B;AACtC,SAAS,UAAU;AAMZ,MAAM,mBAAmB,GAAG;AAAA,EACjC,MAAM;AAAA,EACN,UAAU;AAAA,IACR,SAAS;AAAA,MACP,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,IACA,WAAW;AAAA,MACT,SAAS;AAAA,QACP;AAAA,QACA;AAAA,MACF;AAAA,MACA,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,SAAS,aAAa,WAAW,UAAU;AAChE,CAAC;AAWM,SAAS,SAAS,EAAE,UAAU,aAAa,YAAY,WAAW,OAAO,WAAW,GAAG,MAAM,GAAkB;AACpH,MAAI,YAAY,UAAU,SAAS,QAAQ,GAAG;AAC5C,WACE,oBAAC,SAAI,eAAW,MAAC,WAAW,GAAG,gCAAgC,SAAS,GAAI,GAAG,OAC5E,gBAAM,KAAK,EAAE,QAAQ,MAAM,GAAG,CAAC,GAAG,UACjC;AAAA,MAAC;AAAA;AAAA,QAEC,aAAU;AAAA,QACV,eAAW;AAAA,QACX,WAAW,iBAAiB;AAAA,UAC1B;AAAA,UACA;AAAA,UACA,WAAW,UAAU,QAAQ,IAAI,UAAU;AAAA,QAC7C,CAAC;AAAA;AAAA,MAPI;AAAA,IAQP,CACD,GACH;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,eAAW;AAAA,MACX,WAAW,iBAAiB;AAAA,QAC1B;AAAA,QACA;AAAA;AAAA,QAEA,WAAW,GAAG,YAAY,UAAU,UAAU,SAAS;AAAA,MACzD,CAAC;AAAA,MACA,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Slide,
|
|
3
|
+
SlideEyebrow,
|
|
4
|
+
SlideTitle,
|
|
5
|
+
SlideText,
|
|
6
|
+
SlideList,
|
|
7
|
+
SlideImage,
|
|
8
|
+
SlideFooter,
|
|
9
|
+
SlideNumber,
|
|
10
|
+
SlidePositionContext,
|
|
11
|
+
slideVariants
|
|
12
|
+
} from "./slide.mjs";
|
|
13
|
+
export {
|
|
14
|
+
Slide,
|
|
15
|
+
SlideEyebrow,
|
|
16
|
+
SlideFooter,
|
|
17
|
+
SlideImage,
|
|
18
|
+
SlideList,
|
|
19
|
+
SlideNumber,
|
|
20
|
+
SlidePositionContext,
|
|
21
|
+
SlideText,
|
|
22
|
+
SlideTitle,
|
|
23
|
+
slideVariants
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/slide/index.ts"],"sourcesContent":["export {\n Slide,\n SlideEyebrow,\n SlideTitle,\n SlideText,\n SlideList,\n SlideImage,\n SlideFooter,\n SlideNumber,\n SlidePositionContext,\n slideVariants,\n type SlideProps,\n type SlideLayout,\n type SlideImageProps,\n type SlideNumberProps,\n} from \"./slide.mjs\"\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;","names":[]}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { tv } from "../../../lib/tv.mjs";
|
|
5
|
+
import { cn } from "../../../lib/utils.mjs";
|
|
6
|
+
const pageInk = "bg-background text-foreground [--slide-ink-2:var(--body)] [--slide-ink-3:var(--muted-foreground)]";
|
|
7
|
+
const slideVariants = tv({
|
|
8
|
+
slots: {
|
|
9
|
+
frame: "group/slide relative w-full overflow-hidden [aspect-ratio:var(--slide-ratio)] select-none bg-background [--surface:var(--background)]",
|
|
10
|
+
canvas: [
|
|
11
|
+
"absolute top-1/2 left-1/2 flex h-(--slide-h) w-(--slide-w) origin-center flex-col [translate:-50%_-50%] scale-(--slide-scale)",
|
|
12
|
+
"opacity-0 group-data-[ready]/slide:opacity-100"
|
|
13
|
+
],
|
|
14
|
+
eyebrow: "text-2xl font-semibold tracking-widest text-(--slide-ink-3) uppercase",
|
|
15
|
+
title: "font-heading tracking-tight text-balance",
|
|
16
|
+
text: "max-w-[30ch] text-4xl leading-snug text-pretty text-(--slide-ink-2)",
|
|
17
|
+
list: [
|
|
18
|
+
"flex flex-col gap-6 text-4xl leading-snug text-(--slide-ink-2)",
|
|
19
|
+
"[&>li]:flex [&>li]:gap-6 [&>li]:before:mt-[0.55em] [&>li]:before:size-3 [&>li]:before:shrink-0 [&>li]:before:rounded-pill [&>li]:before:bg-current [&>li]:before:opacity-40 [&>li]:before:content-['']"
|
|
20
|
+
],
|
|
21
|
+
image: [
|
|
22
|
+
"min-h-0 overflow-hidden bg-muted [--surface:var(--muted)]",
|
|
23
|
+
"after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:ring-2 after:ring-media-edge after:ring-inset",
|
|
24
|
+
"[&>img]:absolute [&>img]:inset-0 [&>img]:size-full [&>img]:object-cover"
|
|
25
|
+
],
|
|
26
|
+
footer: "mt-auto flex items-center justify-between gap-8 text-2xl text-(--slide-ink-3)",
|
|
27
|
+
number: "tabular-nums"
|
|
28
|
+
},
|
|
29
|
+
variants: {
|
|
30
|
+
layout: {
|
|
31
|
+
title: { canvas: [pageInk, "justify-end gap-10 p-32"], title: "text-9xl leading-none font-semibold", image: "relative rounded-4xl" },
|
|
32
|
+
section: {
|
|
33
|
+
canvas: [
|
|
34
|
+
"justify-center gap-10 p-32 bg-foreground text-background [--surface:var(--foreground)]",
|
|
35
|
+
"[--slide-ink-2:color-mix(in_oklab,var(--background)_78%,transparent)] [--slide-ink-3:color-mix(in_oklab,var(--background)_56%,transparent)]"
|
|
36
|
+
],
|
|
37
|
+
title: "text-9xl leading-none font-semibold",
|
|
38
|
+
footer: "absolute inset-x-32 bottom-24",
|
|
39
|
+
image: "relative rounded-4xl"
|
|
40
|
+
},
|
|
41
|
+
content: { canvas: [pageInk, "gap-14 p-32"], title: "text-8xl leading-[1.05] font-semibold", image: "relative rounded-4xl" },
|
|
42
|
+
split: {
|
|
43
|
+
canvas: [pageInk, "justify-center gap-10 py-32 pr-[calc(var(--slide-w)/2+3rem)] pl-32"],
|
|
44
|
+
title: "text-8xl leading-[1.05] font-semibold",
|
|
45
|
+
image: "absolute inset-y-24 right-24 left-1/2 ml-12 rounded-4xl",
|
|
46
|
+
footer: "absolute bottom-20 left-32 right-[calc(50%+3rem)]"
|
|
47
|
+
},
|
|
48
|
+
image: {
|
|
49
|
+
canvas: [
|
|
50
|
+
"bg-background justify-end gap-8 p-32 text-white",
|
|
51
|
+
"[--slide-ink-2:color-mix(in_oklab,white_82%,transparent)] [--slide-ink-3:color-mix(in_oklab,white_64%,transparent)]",
|
|
52
|
+
"before:pointer-events-none before:absolute before:inset-0 before:z-1 before:bg-linear-to-t before:from-black/75 before:via-black/20 before:to-transparent",
|
|
53
|
+
"[&>:not([data-slot=slide-image])]:relative [&>:not([data-slot=slide-image])]:z-2"
|
|
54
|
+
],
|
|
55
|
+
title: "text-8xl leading-[1.05] font-semibold",
|
|
56
|
+
image: "absolute inset-0 rounded-none after:hidden"
|
|
57
|
+
},
|
|
58
|
+
quote: {
|
|
59
|
+
canvas: [pageInk, "justify-center gap-12 px-40 py-32"],
|
|
60
|
+
title: "text-7xl leading-tight font-medium before:content-['\u201C'] after:content-['\u201D']",
|
|
61
|
+
footer: "absolute inset-x-40 bottom-24",
|
|
62
|
+
image: "relative rounded-4xl"
|
|
63
|
+
},
|
|
64
|
+
blank: { canvas: [pageInk, "p-0"], image: "relative rounded-4xl" }
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
defaultVariants: { layout: "content" }
|
|
68
|
+
});
|
|
69
|
+
const SlideLayoutContext = React.createContext("content");
|
|
70
|
+
const SlidePositionContext = React.createContext(null);
|
|
71
|
+
function Slide({
|
|
72
|
+
layout = "content",
|
|
73
|
+
width = 1920,
|
|
74
|
+
height = 1080,
|
|
75
|
+
canvasClassName,
|
|
76
|
+
className,
|
|
77
|
+
style,
|
|
78
|
+
children,
|
|
79
|
+
ref,
|
|
80
|
+
...props
|
|
81
|
+
}) {
|
|
82
|
+
const frameRef = React.useRef(null);
|
|
83
|
+
const slots = slideVariants({ layout });
|
|
84
|
+
const setRef = React.useCallback(
|
|
85
|
+
(node) => {
|
|
86
|
+
frameRef.current = node;
|
|
87
|
+
if (typeof ref === "function") ref(node);
|
|
88
|
+
else if (ref) ref.current = node;
|
|
89
|
+
},
|
|
90
|
+
[ref]
|
|
91
|
+
);
|
|
92
|
+
React.useLayoutEffect(() => {
|
|
93
|
+
const frame = frameRef.current;
|
|
94
|
+
if (!frame) return;
|
|
95
|
+
const apply = (frameWidth) => {
|
|
96
|
+
const scale = frameWidth / width;
|
|
97
|
+
frame.style.setProperty("--slide-scale", String(scale));
|
|
98
|
+
if (scale > 0) frame.setAttribute("data-ready", "");
|
|
99
|
+
};
|
|
100
|
+
apply(frame.getBoundingClientRect().width);
|
|
101
|
+
const observer = new ResizeObserver(([entry]) => apply(entry.contentRect.width));
|
|
102
|
+
observer.observe(frame);
|
|
103
|
+
return () => observer.disconnect();
|
|
104
|
+
}, [width]);
|
|
105
|
+
return /* @__PURE__ */ jsx(SlideLayoutContext.Provider, { value: layout, children: /* @__PURE__ */ jsx(
|
|
106
|
+
"div",
|
|
107
|
+
{
|
|
108
|
+
ref: setRef,
|
|
109
|
+
"data-slot": "slide",
|
|
110
|
+
"data-layout": layout,
|
|
111
|
+
className: slots.frame({ className }),
|
|
112
|
+
style: {
|
|
113
|
+
"--slide-ratio": `${width} / ${height}`,
|
|
114
|
+
"--slide-w": `${width}px`,
|
|
115
|
+
"--slide-h": `${height}px`,
|
|
116
|
+
...style
|
|
117
|
+
},
|
|
118
|
+
...props,
|
|
119
|
+
children: /* @__PURE__ */ jsx("div", { "data-slot": "slide-canvas", className: slots.canvas({ className: canvasClassName }), children })
|
|
120
|
+
}
|
|
121
|
+
) });
|
|
122
|
+
}
|
|
123
|
+
const useSlots = () => slideVariants({ layout: React.useContext(SlideLayoutContext) });
|
|
124
|
+
function SlideEyebrow({ className, ...props }) {
|
|
125
|
+
return /* @__PURE__ */ jsx("p", { "data-slot": "slide-eyebrow", className: useSlots().eyebrow({ className }), ...props });
|
|
126
|
+
}
|
|
127
|
+
function SlideTitle({ className, ...props }) {
|
|
128
|
+
return /* @__PURE__ */ jsx("h2", { "data-slot": "slide-title", className: useSlots().title({ className }), ...props });
|
|
129
|
+
}
|
|
130
|
+
function SlideText({ className, ...props }) {
|
|
131
|
+
return /* @__PURE__ */ jsx("p", { "data-slot": "slide-text", className: useSlots().text({ className }), ...props });
|
|
132
|
+
}
|
|
133
|
+
function SlideList({ className, ...props }) {
|
|
134
|
+
return /* @__PURE__ */ jsx("ul", { "data-slot": "slide-list", className: useSlots().list({ className }), ...props });
|
|
135
|
+
}
|
|
136
|
+
function SlideImage({ src, alt, className, ...props }) {
|
|
137
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "slide-image", className: useSlots().image({ className }), ...props, children: /* @__PURE__ */ jsx("img", { src, alt, draggable: false }) });
|
|
138
|
+
}
|
|
139
|
+
function SlideFooter({ className, ...props }) {
|
|
140
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "slide-footer", className: useSlots().footer({ className }), ...props });
|
|
141
|
+
}
|
|
142
|
+
function SlideNumber({ total = false, className, children, ...props }) {
|
|
143
|
+
const position = React.useContext(SlidePositionContext);
|
|
144
|
+
const content = children ?? (position ? total ? `${position.index + 1} / ${position.total}` : position.index + 1 : null);
|
|
145
|
+
return /* @__PURE__ */ jsx("span", { "data-slot": "slide-number", className: cn(useSlots().number(), className), ...props, children: content });
|
|
146
|
+
}
|
|
147
|
+
export {
|
|
148
|
+
Slide,
|
|
149
|
+
SlideEyebrow,
|
|
150
|
+
SlideFooter,
|
|
151
|
+
SlideImage,
|
|
152
|
+
SlideList,
|
|
153
|
+
SlideNumber,
|
|
154
|
+
SlidePositionContext,
|
|
155
|
+
SlideText,
|
|
156
|
+
SlideTitle,
|
|
157
|
+
slideVariants
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=slide.mjs.map
|