@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/input/password-input.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport { Eye, EyeSlash } from \"atoms-icons\"\r\n\r\nimport { type ControlSize, type Density } from \"../../../lib/density.mjs\"\r\nimport { cn } from \"../../../lib/utils.mjs\"\r\n\r\nimport { InputField, InputRoot, InputSuffixButton, type InputFieldProps, type InputRootProps } from \"./input.mjs\"\r\n\r\nconst glyph = \"absolute size-4 transition-[opacity,scale,filter] duration-fast ease-out\"\r\nconst shown = \"opacity-100 scale-100 blur-[0px]\"\r\nconst hidden = \"opacity-0 scale-[0.25] blur-[4px]\"\r\n\r\nexport interface PasswordInputProps extends Omit<InputFieldProps, \"type\"> {\r\n /** Height 32, 36 or 40px. Unset, it comes from a container or the density. */\r\n size?: ControlSize\r\n /** As on `InputRoot`. */\r\n variant?: InputRootProps[\"variant\"]\r\n /** Destructive border and ring, and `aria-invalid` on the input. Inherited from a `Field`. */\r\n hasError?: boolean\r\n /** As on `InputRoot`. */\r\n density?: Density\r\n /** Merged onto the wrapping `InputRoot`; `className` goes to the `<input>`. */\r\n rootClassName?: string\r\n}\r\n\r\nexport function PasswordInput({\r\n size,\r\n variant,\r\n hasError,\r\n density,\r\n disabled,\r\n rootClassName,\r\n ...props\r\n}: PasswordInputProps) {\r\n const [visible, setVisible] = React.useState(false)\r\n\r\n return (\r\n <InputRoot\r\n size={size}\r\n variant={variant}\r\n hasError={hasError}\r\n density={density}\r\n disabled={disabled}\r\n className={rootClassName}\r\n >\r\n <InputField type={visible ? \"text\" : \"password\"} autoComplete=\"current-password\" {...props} />\r\n <InputSuffixButton\r\n aria-label={visible ? \"Hide password\" : \"Show password\"}\r\n onClick={() => setVisible((v) => !v)}\r\n >\r\n {/* Both glyphs stay mounted and cross-fade. */}\r\n <span className=\"relative flex size-4 items-center justify-center\">\r\n <Eye className={cn(glyph, visible ? hidden : shown)} />\r\n <EyeSlash className={cn(glyph, visible ? shown : hidden)} />\r\n </span>\r\n </InputSuffixButton>\r\n </InputRoot>\r\n )\r\n}\r\n"],"mappings":";AA+CM,cAME,YANF;AA7CN,YAAY,WAAW;AACvB,SAAS,KAAK,gBAAgB;AAG9B,SAAS,UAAU;AAEnB,SAAS,YAAY,WAAW,yBAAoE;AAEpG,MAAM,QAAQ;AACd,MAAM,QAAQ;AACd,MAAM,SAAS;AAeR,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAuB;AACrB,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAS,KAAK;AAElD,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MAEX;AAAA,4BAAC,cAAW,MAAM,UAAU,SAAS,YAAY,cAAa,oBAAoB,GAAG,OAAO;AAAA,QAC5F;AAAA,UAAC;AAAA;AAAA,YACC,cAAY,UAAU,kBAAkB;AAAA,YACxC,SAAS,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;AAAA,YAGnC,+BAAC,UAAK,WAAU,oDACd;AAAA,kCAAC,OAAI,WAAW,GAAG,OAAO,UAAU,SAAS,KAAK,GAAG;AAAA,cACrD,oBAAC,YAAS,WAAW,GAAG,OAAO,UAAU,QAAQ,MAAM,GAAG;AAAA,eAC5D;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
const rows = `
|
|
2
|
+
AF|Afghanistan|93
|
|
3
|
+
AL|Albania|355
|
|
4
|
+
DZ|Algeria|213
|
|
5
|
+
AD|Andorra|376
|
|
6
|
+
AO|Angola|244
|
|
7
|
+
AG|Antigua and Barbuda|1
|
|
8
|
+
AR|Argentina|54
|
|
9
|
+
AM|Armenia|374
|
|
10
|
+
AW|Aruba|297
|
|
11
|
+
AU|Australia|61
|
|
12
|
+
AT|Austria|43
|
|
13
|
+
AZ|Azerbaijan|994
|
|
14
|
+
BS|Bahamas|1
|
|
15
|
+
BH|Bahrain|973
|
|
16
|
+
BD|Bangladesh|880
|
|
17
|
+
BB|Barbados|1
|
|
18
|
+
BY|Belarus|375
|
|
19
|
+
BE|Belgium|32
|
|
20
|
+
BZ|Belize|501
|
|
21
|
+
BJ|Benin|229
|
|
22
|
+
BT|Bhutan|975
|
|
23
|
+
BO|Bolivia|591
|
|
24
|
+
BA|Bosnia and Herzegovina|387
|
|
25
|
+
BW|Botswana|267
|
|
26
|
+
BR|Brazil|55
|
|
27
|
+
BN|Brunei|673
|
|
28
|
+
BG|Bulgaria|359
|
|
29
|
+
BF|Burkina Faso|226
|
|
30
|
+
BI|Burundi|257
|
|
31
|
+
KH|Cambodia|855
|
|
32
|
+
CM|Cameroon|237
|
|
33
|
+
CA|Canada|1
|
|
34
|
+
CV|Cape Verde|238
|
|
35
|
+
CF|Central African Republic|236
|
|
36
|
+
TD|Chad|235
|
|
37
|
+
CL|Chile|56
|
|
38
|
+
CN|China|86
|
|
39
|
+
CO|Colombia|57
|
|
40
|
+
KM|Comoros|269
|
|
41
|
+
CG|Congo - Brazzaville|242
|
|
42
|
+
CD|Congo - Kinshasa|243
|
|
43
|
+
CR|Costa Rica|506
|
|
44
|
+
CI|C\xF4te d\u2019Ivoire|225
|
|
45
|
+
HR|Croatia|385
|
|
46
|
+
CU|Cuba|53
|
|
47
|
+
CW|Cura\xE7ao|599
|
|
48
|
+
CY|Cyprus|357
|
|
49
|
+
CZ|Czechia|420
|
|
50
|
+
DK|Denmark|45
|
|
51
|
+
DJ|Djibouti|253
|
|
52
|
+
DM|Dominica|1
|
|
53
|
+
DO|Dominican Republic|1
|
|
54
|
+
EC|Ecuador|593
|
|
55
|
+
EG|Egypt|20
|
|
56
|
+
SV|El Salvador|503
|
|
57
|
+
GQ|Equatorial Guinea|240
|
|
58
|
+
ER|Eritrea|291
|
|
59
|
+
EE|Estonia|372
|
|
60
|
+
SZ|Eswatini|268
|
|
61
|
+
ET|Ethiopia|251
|
|
62
|
+
FJ|Fiji|679
|
|
63
|
+
FI|Finland|358
|
|
64
|
+
FR|France|33
|
|
65
|
+
GA|Gabon|241
|
|
66
|
+
GM|Gambia|220
|
|
67
|
+
GE|Georgia|995
|
|
68
|
+
DE|Germany|49
|
|
69
|
+
GH|Ghana|233
|
|
70
|
+
GR|Greece|30
|
|
71
|
+
GD|Grenada|1
|
|
72
|
+
GT|Guatemala|502
|
|
73
|
+
GN|Guinea|224
|
|
74
|
+
GW|Guinea-Bissau|245
|
|
75
|
+
GY|Guyana|592
|
|
76
|
+
HT|Haiti|509
|
|
77
|
+
HN|Honduras|504
|
|
78
|
+
HK|Hong Kong|852
|
|
79
|
+
HU|Hungary|36
|
|
80
|
+
IS|Iceland|354
|
|
81
|
+
IN|India|91
|
|
82
|
+
ID|Indonesia|62
|
|
83
|
+
IR|Iran|98
|
|
84
|
+
IQ|Iraq|964
|
|
85
|
+
IE|Ireland|353
|
|
86
|
+
IL|Israel|972
|
|
87
|
+
IT|Italy|39
|
|
88
|
+
JM|Jamaica|1
|
|
89
|
+
JP|Japan|81
|
|
90
|
+
JO|Jordan|962
|
|
91
|
+
KZ|Kazakhstan|7
|
|
92
|
+
KE|Kenya|254
|
|
93
|
+
KI|Kiribati|686
|
|
94
|
+
KW|Kuwait|965
|
|
95
|
+
KG|Kyrgyzstan|996
|
|
96
|
+
LA|Laos|856
|
|
97
|
+
LV|Latvia|371
|
|
98
|
+
LB|Lebanon|961
|
|
99
|
+
LS|Lesotho|266
|
|
100
|
+
LR|Liberia|231
|
|
101
|
+
LY|Libya|218
|
|
102
|
+
LI|Liechtenstein|423
|
|
103
|
+
LT|Lithuania|370
|
|
104
|
+
LU|Luxembourg|352
|
|
105
|
+
MO|Macao|853
|
|
106
|
+
MG|Madagascar|261
|
|
107
|
+
MW|Malawi|265
|
|
108
|
+
MY|Malaysia|60
|
|
109
|
+
MV|Maldives|960
|
|
110
|
+
ML|Mali|223
|
|
111
|
+
MT|Malta|356
|
|
112
|
+
MH|Marshall Islands|692
|
|
113
|
+
MR|Mauritania|222
|
|
114
|
+
MU|Mauritius|230
|
|
115
|
+
MX|Mexico|52
|
|
116
|
+
FM|Micronesia|691
|
|
117
|
+
MD|Moldova|373
|
|
118
|
+
MC|Monaco|377
|
|
119
|
+
MN|Mongolia|976
|
|
120
|
+
ME|Montenegro|382
|
|
121
|
+
MA|Morocco|212
|
|
122
|
+
MZ|Mozambique|258
|
|
123
|
+
MM|Myanmar|95
|
|
124
|
+
NA|Namibia|264
|
|
125
|
+
NR|Nauru|674
|
|
126
|
+
NP|Nepal|977
|
|
127
|
+
NL|Netherlands|31
|
|
128
|
+
NZ|New Zealand|64
|
|
129
|
+
NI|Nicaragua|505
|
|
130
|
+
NE|Niger|227
|
|
131
|
+
NG|Nigeria|234
|
|
132
|
+
KP|North Korea|850
|
|
133
|
+
MK|North Macedonia|389
|
|
134
|
+
NO|Norway|47
|
|
135
|
+
OM|Oman|968
|
|
136
|
+
PK|Pakistan|92
|
|
137
|
+
PW|Palau|680
|
|
138
|
+
PS|Palestine|970
|
|
139
|
+
PA|Panama|507
|
|
140
|
+
PG|Papua New Guinea|675
|
|
141
|
+
PY|Paraguay|595
|
|
142
|
+
PE|Peru|51
|
|
143
|
+
PH|Philippines|63
|
|
144
|
+
PL|Poland|48
|
|
145
|
+
PT|Portugal|351
|
|
146
|
+
PR|Puerto Rico|1
|
|
147
|
+
QA|Qatar|974
|
|
148
|
+
RO|Romania|40
|
|
149
|
+
RU|Russia|7
|
|
150
|
+
RW|Rwanda|250
|
|
151
|
+
KN|Saint Kitts and Nevis|1
|
|
152
|
+
LC|Saint Lucia|1
|
|
153
|
+
VC|Saint Vincent and the Grenadines|1
|
|
154
|
+
WS|Samoa|685
|
|
155
|
+
SM|San Marino|378
|
|
156
|
+
ST|S\xE3o Tom\xE9 and Pr\xEDncipe|239
|
|
157
|
+
SA|Saudi Arabia|966
|
|
158
|
+
SN|Senegal|221
|
|
159
|
+
RS|Serbia|381
|
|
160
|
+
SC|Seychelles|248
|
|
161
|
+
SL|Sierra Leone|232
|
|
162
|
+
SG|Singapore|65
|
|
163
|
+
SK|Slovakia|421
|
|
164
|
+
SI|Slovenia|386
|
|
165
|
+
SB|Solomon Islands|677
|
|
166
|
+
SO|Somalia|252
|
|
167
|
+
ZA|South Africa|27
|
|
168
|
+
KR|South Korea|82
|
|
169
|
+
SS|South Sudan|211
|
|
170
|
+
ES|Spain|34
|
|
171
|
+
LK|Sri Lanka|94
|
|
172
|
+
SD|Sudan|249
|
|
173
|
+
SR|Suriname|597
|
|
174
|
+
SE|Sweden|46
|
|
175
|
+
CH|Switzerland|41
|
|
176
|
+
SY|Syria|963
|
|
177
|
+
TW|Taiwan|886
|
|
178
|
+
TJ|Tajikistan|992
|
|
179
|
+
TZ|Tanzania|255
|
|
180
|
+
TH|Thailand|66
|
|
181
|
+
TL|Timor-Leste|670
|
|
182
|
+
TG|Togo|228
|
|
183
|
+
TO|Tonga|676
|
|
184
|
+
TT|Trinidad and Tobago|1
|
|
185
|
+
TN|Tunisia|216
|
|
186
|
+
TR|Turkey|90
|
|
187
|
+
TM|Turkmenistan|993
|
|
188
|
+
TV|Tuvalu|688
|
|
189
|
+
UG|Uganda|256
|
|
190
|
+
UA|Ukraine|380
|
|
191
|
+
AE|United Arab Emirates|971
|
|
192
|
+
GB|United Kingdom|44
|
|
193
|
+
US|United States|1
|
|
194
|
+
UY|Uruguay|598
|
|
195
|
+
UZ|Uzbekistan|998
|
|
196
|
+
VU|Vanuatu|678
|
|
197
|
+
VA|Vatican City|39
|
|
198
|
+
VE|Venezuela|58
|
|
199
|
+
VN|Vietnam|84
|
|
200
|
+
YE|Yemen|967
|
|
201
|
+
ZM|Zambia|260
|
|
202
|
+
ZW|Zimbabwe|263
|
|
203
|
+
`;
|
|
204
|
+
const phoneCountries = rows.trim().split("\n").map((row) => {
|
|
205
|
+
const [iso2, name, dialCode] = row.split("|");
|
|
206
|
+
return { iso2, name, dialCode };
|
|
207
|
+
});
|
|
208
|
+
function findPhoneCountry(iso2) {
|
|
209
|
+
const code = iso2.toUpperCase();
|
|
210
|
+
return phoneCountries.find((country) => country.iso2 === code);
|
|
211
|
+
}
|
|
212
|
+
export {
|
|
213
|
+
findPhoneCountry,
|
|
214
|
+
phoneCountries
|
|
215
|
+
};
|
|
216
|
+
//# sourceMappingURL=phone-input-countries.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/input/phone-input-countries.ts"],"sourcesContent":["/*\n * Countries for PhoneInput: ISO 3166-1 alpha-2 code, English name and international dial code,\n * sorted by name. Plain facts, one `CODE|Name|dial` row each, parsed once at load.\n */\n\nexport interface PhoneCountry {\n iso2: string\n name: string\n dialCode: string\n}\n\nconst rows = `\nAF|Afghanistan|93\nAL|Albania|355\nDZ|Algeria|213\nAD|Andorra|376\nAO|Angola|244\nAG|Antigua and Barbuda|1\nAR|Argentina|54\nAM|Armenia|374\nAW|Aruba|297\nAU|Australia|61\nAT|Austria|43\nAZ|Azerbaijan|994\nBS|Bahamas|1\nBH|Bahrain|973\nBD|Bangladesh|880\nBB|Barbados|1\nBY|Belarus|375\nBE|Belgium|32\nBZ|Belize|501\nBJ|Benin|229\nBT|Bhutan|975\nBO|Bolivia|591\nBA|Bosnia and Herzegovina|387\nBW|Botswana|267\nBR|Brazil|55\nBN|Brunei|673\nBG|Bulgaria|359\nBF|Burkina Faso|226\nBI|Burundi|257\nKH|Cambodia|855\nCM|Cameroon|237\nCA|Canada|1\nCV|Cape Verde|238\nCF|Central African Republic|236\nTD|Chad|235\nCL|Chile|56\nCN|China|86\nCO|Colombia|57\nKM|Comoros|269\nCG|Congo - Brazzaville|242\nCD|Congo - Kinshasa|243\nCR|Costa Rica|506\nCI|Côte d’Ivoire|225\nHR|Croatia|385\nCU|Cuba|53\nCW|Curaçao|599\nCY|Cyprus|357\nCZ|Czechia|420\nDK|Denmark|45\nDJ|Djibouti|253\nDM|Dominica|1\nDO|Dominican Republic|1\nEC|Ecuador|593\nEG|Egypt|20\nSV|El Salvador|503\nGQ|Equatorial Guinea|240\nER|Eritrea|291\nEE|Estonia|372\nSZ|Eswatini|268\nET|Ethiopia|251\nFJ|Fiji|679\nFI|Finland|358\nFR|France|33\nGA|Gabon|241\nGM|Gambia|220\nGE|Georgia|995\nDE|Germany|49\nGH|Ghana|233\nGR|Greece|30\nGD|Grenada|1\nGT|Guatemala|502\nGN|Guinea|224\nGW|Guinea-Bissau|245\nGY|Guyana|592\nHT|Haiti|509\nHN|Honduras|504\nHK|Hong Kong|852\nHU|Hungary|36\nIS|Iceland|354\nIN|India|91\nID|Indonesia|62\nIR|Iran|98\nIQ|Iraq|964\nIE|Ireland|353\nIL|Israel|972\nIT|Italy|39\nJM|Jamaica|1\nJP|Japan|81\nJO|Jordan|962\nKZ|Kazakhstan|7\nKE|Kenya|254\nKI|Kiribati|686\nKW|Kuwait|965\nKG|Kyrgyzstan|996\nLA|Laos|856\nLV|Latvia|371\nLB|Lebanon|961\nLS|Lesotho|266\nLR|Liberia|231\nLY|Libya|218\nLI|Liechtenstein|423\nLT|Lithuania|370\nLU|Luxembourg|352\nMO|Macao|853\nMG|Madagascar|261\nMW|Malawi|265\nMY|Malaysia|60\nMV|Maldives|960\nML|Mali|223\nMT|Malta|356\nMH|Marshall Islands|692\nMR|Mauritania|222\nMU|Mauritius|230\nMX|Mexico|52\nFM|Micronesia|691\nMD|Moldova|373\nMC|Monaco|377\nMN|Mongolia|976\nME|Montenegro|382\nMA|Morocco|212\nMZ|Mozambique|258\nMM|Myanmar|95\nNA|Namibia|264\nNR|Nauru|674\nNP|Nepal|977\nNL|Netherlands|31\nNZ|New Zealand|64\nNI|Nicaragua|505\nNE|Niger|227\nNG|Nigeria|234\nKP|North Korea|850\nMK|North Macedonia|389\nNO|Norway|47\nOM|Oman|968\nPK|Pakistan|92\nPW|Palau|680\nPS|Palestine|970\nPA|Panama|507\nPG|Papua New Guinea|675\nPY|Paraguay|595\nPE|Peru|51\nPH|Philippines|63\nPL|Poland|48\nPT|Portugal|351\nPR|Puerto Rico|1\nQA|Qatar|974\nRO|Romania|40\nRU|Russia|7\nRW|Rwanda|250\nKN|Saint Kitts and Nevis|1\nLC|Saint Lucia|1\nVC|Saint Vincent and the Grenadines|1\nWS|Samoa|685\nSM|San Marino|378\nST|São Tomé and Príncipe|239\nSA|Saudi Arabia|966\nSN|Senegal|221\nRS|Serbia|381\nSC|Seychelles|248\nSL|Sierra Leone|232\nSG|Singapore|65\nSK|Slovakia|421\nSI|Slovenia|386\nSB|Solomon Islands|677\nSO|Somalia|252\nZA|South Africa|27\nKR|South Korea|82\nSS|South Sudan|211\nES|Spain|34\nLK|Sri Lanka|94\nSD|Sudan|249\nSR|Suriname|597\nSE|Sweden|46\nCH|Switzerland|41\nSY|Syria|963\nTW|Taiwan|886\nTJ|Tajikistan|992\nTZ|Tanzania|255\nTH|Thailand|66\nTL|Timor-Leste|670\nTG|Togo|228\nTO|Tonga|676\nTT|Trinidad and Tobago|1\nTN|Tunisia|216\nTR|Turkey|90\nTM|Turkmenistan|993\nTV|Tuvalu|688\nUG|Uganda|256\nUA|Ukraine|380\nAE|United Arab Emirates|971\nGB|United Kingdom|44\nUS|United States|1\nUY|Uruguay|598\nUZ|Uzbekistan|998\nVU|Vanuatu|678\nVA|Vatican City|39\nVE|Venezuela|58\nVN|Vietnam|84\nYE|Yemen|967\nZM|Zambia|260\nZW|Zimbabwe|263\n`\n\nexport const phoneCountries: PhoneCountry[] = rows\n .trim()\n .split(\"\\n\")\n .map((row) => {\n const [iso2, name, dialCode] = row.split(\"|\")\n return { iso2, name, dialCode }\n })\n\nexport function findPhoneCountry(iso2: string): PhoneCountry | undefined {\n const code = iso2.toUpperCase()\n return phoneCountries.find((country) => country.iso2 === code)\n}\n"],"mappings":"AAWA,MAAM,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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":[]}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { CaretDown, Check, MagnifyingGlass } from "atoms-icons";
|
|
5
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
6
|
+
import { FlagArtwork } from "../flag/index.mjs";
|
|
7
|
+
import { useControlSize } from "../../../lib/density.mjs";
|
|
8
|
+
import { FieldContextProvider, useFieldContext } from "../../../lib/field-context.mjs";
|
|
9
|
+
import { tv } from "../../../lib/tv.mjs";
|
|
10
|
+
import { InputField, InputPrefix, InputRoot } from "./input.mjs";
|
|
11
|
+
import { findPhoneCountry, phoneCountries } from "./phone-input-countries.mjs";
|
|
12
|
+
import { useControllableState } from "./use-controllable-state.mjs";
|
|
13
|
+
const phoneInputVariants = tv({
|
|
14
|
+
slots: {
|
|
15
|
+
country: [
|
|
16
|
+
"group flex shrink-0 cursor-pointer items-center gap-1.5 self-stretch border-r border-input text-muted-foreground",
|
|
17
|
+
"transition-colors duration-fast ease-out hover:bg-accent hover:text-foreground",
|
|
18
|
+
"focus-visible:outline-none focus-visible:bg-accent focus-visible:text-foreground disabled:pointer-events-none"
|
|
19
|
+
],
|
|
20
|
+
flag: [
|
|
21
|
+
"relative inline-flex size-5 shrink-0 overflow-hidden rounded-full",
|
|
22
|
+
"after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:ring-1 after:ring-inset after:ring-media-edge"
|
|
23
|
+
],
|
|
24
|
+
caret: "size-3 shrink-0 caret-turn-fast group-data-[state=open]:rotate-180",
|
|
25
|
+
dial: "shrink-0 select-none tabular-nums text-muted-foreground text-sm pointer-coarse:text-base",
|
|
26
|
+
popover: [
|
|
27
|
+
"z-50 w-72 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-lg [--surface:var(--popover)]",
|
|
28
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
29
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
30
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",
|
|
31
|
+
"data-[state=open]:duration-fast data-[state=closed]:duration-[100ms] ease-out"
|
|
32
|
+
],
|
|
33
|
+
search: "border-b border-border p-1.5",
|
|
34
|
+
list: "max-h-64 overflow-y-auto overscroll-contain p-1.5",
|
|
35
|
+
option: [
|
|
36
|
+
"flex w-full cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-2 text-left text-sm outline-none",
|
|
37
|
+
"transition-colors duration-fast ease-out data-[active=true]:bg-accent data-[active=true]:text-accent-foreground",
|
|
38
|
+
// Rows off screen skip layout. The intrinsic size is the content box (py-2 is added on top),
|
|
39
|
+
// so 1.25rem makes a skipped row the same 2.25rem as a drawn one and the scroll height holds.
|
|
40
|
+
"[content-visibility:auto] [contain-intrinsic-size:auto_1.25rem]"
|
|
41
|
+
],
|
|
42
|
+
optionName: "flex-1 truncate",
|
|
43
|
+
optionDial: "shrink-0 tabular-nums text-muted-foreground",
|
|
44
|
+
check: "size-4 shrink-0 text-foreground",
|
|
45
|
+
empty: "px-3 py-6 text-center text-sm text-muted-foreground"
|
|
46
|
+
},
|
|
47
|
+
variants: {
|
|
48
|
+
size: {
|
|
49
|
+
sm: { country: "-ml-2.5 pl-2.5 pr-2.5 text-xs" },
|
|
50
|
+
md: { country: "-ml-3 pl-3 pr-3 text-xs" },
|
|
51
|
+
lg: { country: "-ml-3.5 pl-3.5 pr-3.5 text-sm" }
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
defaultVariants: { size: "sm" }
|
|
55
|
+
});
|
|
56
|
+
const slots = phoneInputVariants();
|
|
57
|
+
function toPayload(country, nationalNumber) {
|
|
58
|
+
const digits = nationalNumber.replace(/\D/g, "");
|
|
59
|
+
return {
|
|
60
|
+
country: country.iso2,
|
|
61
|
+
dialCode: country.dialCode,
|
|
62
|
+
nationalNumber,
|
|
63
|
+
e164: digits ? `+${country.dialCode}${digits}` : ""
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const fold = (text) => text.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase();
|
|
67
|
+
const searchKeys = new Map(phoneCountries.map((country) => [country.iso2, fold(country.name)]));
|
|
68
|
+
function filterCountries(query) {
|
|
69
|
+
const q = fold(query.trim());
|
|
70
|
+
if (!q) return phoneCountries;
|
|
71
|
+
if (/^\+?\d+$/.test(q)) {
|
|
72
|
+
const digits = q.replace("+", "");
|
|
73
|
+
return phoneCountries.filter((country) => country.dialCode.startsWith(digits));
|
|
74
|
+
}
|
|
75
|
+
return phoneCountries.filter(
|
|
76
|
+
(country) => searchKeys.get(country.iso2).includes(q) || country.iso2.toLowerCase() === q
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
function CountryFlag({ iso2 }) {
|
|
80
|
+
return /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: slots.flag(), children: /* @__PURE__ */ jsx(FlagArtwork, { code: iso2, className: "size-full", preserveAspectRatio: "xMidYMid slice" }) });
|
|
81
|
+
}
|
|
82
|
+
function assignRef(ref, value) {
|
|
83
|
+
if (typeof ref === "function") ref(value);
|
|
84
|
+
else if (ref) ref.current = value;
|
|
85
|
+
}
|
|
86
|
+
const PAGE = 8;
|
|
87
|
+
function CountryList({
|
|
88
|
+
selected,
|
|
89
|
+
onPick,
|
|
90
|
+
searchRef
|
|
91
|
+
}) {
|
|
92
|
+
const listId = React.useId();
|
|
93
|
+
const listRef = React.useRef(null);
|
|
94
|
+
const [query, setQuery] = React.useState("");
|
|
95
|
+
const [active, setActive] = React.useState(selected);
|
|
96
|
+
const scrollToActive = React.useRef(true);
|
|
97
|
+
const opened = React.useRef(false);
|
|
98
|
+
const results = React.useMemo(() => filterCountries(query), [query]);
|
|
99
|
+
const activeIndex = results.findIndex((country) => country.iso2 === active);
|
|
100
|
+
React.useEffect(() => {
|
|
101
|
+
if (!scrollToActive.current) return;
|
|
102
|
+
const list = listRef.current;
|
|
103
|
+
const row = list?.querySelector(`[data-value="${active}"]`);
|
|
104
|
+
if (!list || !row) return;
|
|
105
|
+
const pad = 6;
|
|
106
|
+
const top = row.offsetTop - list.offsetTop - list.clientTop;
|
|
107
|
+
const bottom = top + row.offsetHeight;
|
|
108
|
+
if (!opened.current) {
|
|
109
|
+
opened.current = true;
|
|
110
|
+
list.scrollTop = top - (list.clientHeight - row.offsetHeight) / 2;
|
|
111
|
+
} else if (top < list.scrollTop + pad) {
|
|
112
|
+
list.scrollTop = top - pad;
|
|
113
|
+
} else if (bottom > list.scrollTop + list.clientHeight - pad) {
|
|
114
|
+
list.scrollTop = bottom - list.clientHeight + pad;
|
|
115
|
+
}
|
|
116
|
+
}, [active, results]);
|
|
117
|
+
const moveTo = (index) => {
|
|
118
|
+
const next = results[Math.max(0, Math.min(results.length - 1, index))];
|
|
119
|
+
if (!next) return;
|
|
120
|
+
scrollToActive.current = true;
|
|
121
|
+
setActive(next.iso2);
|
|
122
|
+
};
|
|
123
|
+
const onKeyDown = (event) => {
|
|
124
|
+
switch (event.key) {
|
|
125
|
+
case "ArrowDown":
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
moveTo(activeIndex + 1);
|
|
128
|
+
break;
|
|
129
|
+
case "ArrowUp":
|
|
130
|
+
event.preventDefault();
|
|
131
|
+
moveTo(activeIndex < 0 ? 0 : activeIndex - 1);
|
|
132
|
+
break;
|
|
133
|
+
case "PageDown":
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
moveTo(activeIndex + PAGE);
|
|
136
|
+
break;
|
|
137
|
+
case "PageUp":
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
moveTo(activeIndex - PAGE);
|
|
140
|
+
break;
|
|
141
|
+
case "Enter": {
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
const country = results[activeIndex];
|
|
144
|
+
if (country) onPick(country);
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
150
|
+
/* @__PURE__ */ jsx("div", { className: slots.search(), children: /* @__PURE__ */ jsxs(InputRoot, { size: "sm", children: [
|
|
151
|
+
/* @__PURE__ */ jsx(InputPrefix, { children: /* @__PURE__ */ jsx(MagnifyingGlass, {}) }),
|
|
152
|
+
/* @__PURE__ */ jsx(
|
|
153
|
+
InputField,
|
|
154
|
+
{
|
|
155
|
+
ref: searchRef,
|
|
156
|
+
placeholder: "Search countries\u2026",
|
|
157
|
+
"aria-label": "Search countries",
|
|
158
|
+
"aria-controls": listId,
|
|
159
|
+
"aria-activedescendant": activeIndex >= 0 ? `${listId}-${active}` : void 0,
|
|
160
|
+
autoComplete: "off",
|
|
161
|
+
value: query,
|
|
162
|
+
onChange: (event) => {
|
|
163
|
+
const next = event.target.value;
|
|
164
|
+
setQuery(next);
|
|
165
|
+
scrollToActive.current = true;
|
|
166
|
+
setActive(filterCountries(next)[0]?.iso2 ?? "");
|
|
167
|
+
},
|
|
168
|
+
onKeyDown
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
] }) }),
|
|
172
|
+
/* @__PURE__ */ jsx("div", { ref: listRef, id: listId, role: "listbox", "aria-label": "Countries", className: slots.list(), children: results.length === 0 ? /* @__PURE__ */ jsx("p", { className: slots.empty(), children: "No countries found." }) : results.map((country) => /* @__PURE__ */ jsxs(
|
|
173
|
+
"button",
|
|
174
|
+
{
|
|
175
|
+
id: `${listId}-${country.iso2}`,
|
|
176
|
+
type: "button",
|
|
177
|
+
role: "option",
|
|
178
|
+
tabIndex: -1,
|
|
179
|
+
"data-value": country.iso2,
|
|
180
|
+
"aria-selected": country.iso2 === selected,
|
|
181
|
+
"data-active": country.iso2 === active,
|
|
182
|
+
className: slots.option(),
|
|
183
|
+
onPointerMove: () => {
|
|
184
|
+
if (country.iso2 === active) return;
|
|
185
|
+
scrollToActive.current = false;
|
|
186
|
+
setActive(country.iso2);
|
|
187
|
+
},
|
|
188
|
+
onClick: () => onPick(country),
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ jsx(CountryFlag, { iso2: country.iso2 }),
|
|
191
|
+
/* @__PURE__ */ jsx("span", { className: slots.optionName(), children: country.name }),
|
|
192
|
+
/* @__PURE__ */ jsxs("span", { className: slots.optionDial(), children: [
|
|
193
|
+
"+",
|
|
194
|
+
country.dialCode
|
|
195
|
+
] }),
|
|
196
|
+
country.iso2 === selected && /* @__PURE__ */ jsx(Check, { "aria-hidden": true, className: slots.check() })
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
country.iso2
|
|
200
|
+
)) })
|
|
201
|
+
] });
|
|
202
|
+
}
|
|
203
|
+
const fallbackCountry = findPhoneCountry("US");
|
|
204
|
+
function PhoneInput({
|
|
205
|
+
country: countryProp,
|
|
206
|
+
defaultCountry = "US",
|
|
207
|
+
onCountryChange,
|
|
208
|
+
value: valueProp,
|
|
209
|
+
defaultValue = "",
|
|
210
|
+
onValueChange,
|
|
211
|
+
onChange,
|
|
212
|
+
placeholder = "Phone number",
|
|
213
|
+
size,
|
|
214
|
+
density,
|
|
215
|
+
hasError,
|
|
216
|
+
disabled,
|
|
217
|
+
rootClassName,
|
|
218
|
+
className,
|
|
219
|
+
ref,
|
|
220
|
+
...props
|
|
221
|
+
}) {
|
|
222
|
+
const field = useFieldContext();
|
|
223
|
+
const resolvedSize = useControlSize(size, density);
|
|
224
|
+
const isDisabled = disabled ?? field?.disabled ?? false;
|
|
225
|
+
const [iso2, setIso2] = useControllableState({
|
|
226
|
+
prop: countryProp?.toUpperCase(),
|
|
227
|
+
defaultProp: defaultCountry.toUpperCase(),
|
|
228
|
+
onChange: onCountryChange
|
|
229
|
+
});
|
|
230
|
+
const [nationalNumber, setNationalNumber] = useControllableState({
|
|
231
|
+
prop: valueProp,
|
|
232
|
+
defaultProp: defaultValue,
|
|
233
|
+
onChange: onValueChange
|
|
234
|
+
});
|
|
235
|
+
const country = findPhoneCountry(iso2) ?? fallbackCountry;
|
|
236
|
+
const [open, setOpen] = React.useState(false);
|
|
237
|
+
const fieldRef = React.useRef(null);
|
|
238
|
+
const searchRef = React.useRef(null);
|
|
239
|
+
const picked = React.useRef(false);
|
|
240
|
+
const pick = (next) => {
|
|
241
|
+
picked.current = true;
|
|
242
|
+
setOpen(false);
|
|
243
|
+
if (next.iso2 === country.iso2) return;
|
|
244
|
+
setIso2(next.iso2);
|
|
245
|
+
onChange?.(toPayload(next, nationalNumber));
|
|
246
|
+
};
|
|
247
|
+
return /* @__PURE__ */ jsxs(
|
|
248
|
+
InputRoot,
|
|
249
|
+
{
|
|
250
|
+
size: resolvedSize,
|
|
251
|
+
hasError,
|
|
252
|
+
disabled: isDisabled,
|
|
253
|
+
className: rootClassName,
|
|
254
|
+
children: [
|
|
255
|
+
/* @__PURE__ */ jsxs(PopoverPrimitive.Root, { open, onOpenChange: setOpen, children: [
|
|
256
|
+
/* @__PURE__ */ jsxs(
|
|
257
|
+
PopoverPrimitive.Trigger,
|
|
258
|
+
{
|
|
259
|
+
type: "button",
|
|
260
|
+
"data-slot": "phone-input-country",
|
|
261
|
+
"aria-label": `Country: ${country.name} (+${country.dialCode})`,
|
|
262
|
+
disabled: isDisabled,
|
|
263
|
+
className: phoneInputVariants({ size: resolvedSize }).country(),
|
|
264
|
+
children: [
|
|
265
|
+
/* @__PURE__ */ jsx(CountryFlag, { iso2: country.iso2 }),
|
|
266
|
+
/* @__PURE__ */ jsx(CaretDown, { "aria-hidden": true, className: slots.caret() })
|
|
267
|
+
]
|
|
268
|
+
}
|
|
269
|
+
),
|
|
270
|
+
/* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
271
|
+
PopoverPrimitive.Content,
|
|
272
|
+
{
|
|
273
|
+
"data-slot": "phone-input-popover",
|
|
274
|
+
side: "bottom",
|
|
275
|
+
align: "start",
|
|
276
|
+
sideOffset: 6,
|
|
277
|
+
collisionPadding: 8,
|
|
278
|
+
className: slots.popover(),
|
|
279
|
+
onOpenAutoFocus: (event) => {
|
|
280
|
+
event.preventDefault();
|
|
281
|
+
searchRef.current?.focus();
|
|
282
|
+
},
|
|
283
|
+
onCloseAutoFocus: (event) => {
|
|
284
|
+
if (!picked.current) return;
|
|
285
|
+
picked.current = false;
|
|
286
|
+
event.preventDefault();
|
|
287
|
+
fieldRef.current?.focus();
|
|
288
|
+
},
|
|
289
|
+
children: /* @__PURE__ */ jsx(FieldContextProvider, { value: null, children: /* @__PURE__ */ jsx(CountryList, { selected: country.iso2, onPick: pick, searchRef }) })
|
|
290
|
+
}
|
|
291
|
+
) })
|
|
292
|
+
] }),
|
|
293
|
+
/* @__PURE__ */ jsxs("span", { "data-slot": "phone-input-dial", "aria-hidden": true, className: slots.dial(), children: [
|
|
294
|
+
"+",
|
|
295
|
+
country.dialCode
|
|
296
|
+
] }),
|
|
297
|
+
/* @__PURE__ */ jsx(
|
|
298
|
+
InputField,
|
|
299
|
+
{
|
|
300
|
+
ref: (node) => {
|
|
301
|
+
fieldRef.current = node;
|
|
302
|
+
assignRef(ref, node);
|
|
303
|
+
},
|
|
304
|
+
type: "tel",
|
|
305
|
+
inputMode: "tel",
|
|
306
|
+
autoComplete: "tel-national",
|
|
307
|
+
placeholder,
|
|
308
|
+
className: ["tabular-nums", className].filter(Boolean).join(" "),
|
|
309
|
+
value: nationalNumber,
|
|
310
|
+
onChange: (event) => {
|
|
311
|
+
const next = event.target.value;
|
|
312
|
+
setNationalNumber(next);
|
|
313
|
+
onChange?.(toPayload(country, next));
|
|
314
|
+
},
|
|
315
|
+
...props
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
export {
|
|
323
|
+
PhoneInput,
|
|
324
|
+
phoneInputVariants
|
|
325
|
+
};
|
|
326
|
+
//# sourceMappingURL=phone-input.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/input/phone-input.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { CaretDown, Check, MagnifyingGlass } from \"atoms-icons\"\nimport { Popover as PopoverPrimitive } from \"radix-ui\"\n\nimport { FlagArtwork } from \"../flag/index.mjs\"\nimport { useControlSize, type ControlSize, type Density } from \"../../../lib/density.mjs\"\nimport { FieldContextProvider, useFieldContext } from \"../../../lib/field-context.mjs\"\nimport { tv } from \"../../../lib/tv.mjs\"\n\nimport { InputField, InputPrefix, InputRoot, type InputFieldProps } from \"./input.mjs\"\nimport { findPhoneCountry, phoneCountries, type PhoneCountry } from \"./phone-input-countries.mjs\"\nimport { useControllableState } from \"./use-controllable-state.mjs\"\n\n/*\n * A phone number field with a searchable country picker in front. The country segment shows a\n * round flag and opens a list; the dial code sits as a fixed prefix, and the field holds the\n * national number as typed. `onChange` reports the whole number, with `e164` as the value to store.\n */\n\nconst phoneInputVariants = tv({\n slots: {\n country: [\n \"group flex shrink-0 cursor-pointer items-center gap-1.5 self-stretch border-r border-input text-muted-foreground\",\n \"transition-colors duration-fast ease-out hover:bg-accent hover:text-foreground\",\n \"focus-visible:outline-none focus-visible:bg-accent focus-visible:text-foreground disabled:pointer-events-none\",\n ],\n flag: [\n \"relative inline-flex size-5 shrink-0 overflow-hidden rounded-full\",\n \"after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:ring-1 after:ring-inset after:ring-media-edge\",\n ],\n caret: \"size-3 shrink-0 caret-turn-fast group-data-[state=open]:rotate-180\",\n dial: \"shrink-0 select-none tabular-nums text-muted-foreground text-sm pointer-coarse:text-base\",\n popover: [\n \"z-50 w-72 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-lg [--surface:var(--popover)]\",\n \"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n \"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2\",\n \"data-[state=open]:duration-fast data-[state=closed]:duration-[100ms] ease-out\",\n ],\n search: \"border-b border-border p-1.5\",\n list: \"max-h-64 overflow-y-auto overscroll-contain p-1.5\",\n option: [\n \"flex w-full cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-2 text-left text-sm outline-none\",\n \"transition-colors duration-fast ease-out data-[active=true]:bg-accent data-[active=true]:text-accent-foreground\",\n // Rows off screen skip layout. The intrinsic size is the content box (py-2 is added on top),\n // so 1.25rem makes a skipped row the same 2.25rem as a drawn one and the scroll height holds.\n \"[content-visibility:auto] [contain-intrinsic-size:auto_1.25rem]\",\n ],\n optionName: \"flex-1 truncate\",\n optionDial: \"shrink-0 tabular-nums text-muted-foreground\",\n check: \"size-4 shrink-0 text-foreground\",\n empty: \"px-3 py-6 text-center text-sm text-muted-foreground\",\n },\n variants: {\n size: {\n sm: { country: \"-ml-2.5 pl-2.5 pr-2.5 text-xs\" },\n md: { country: \"-ml-3 pl-3 pr-3 text-xs\" },\n lg: { country: \"-ml-3.5 pl-3.5 pr-3.5 text-sm\" },\n },\n },\n defaultVariants: { size: \"sm\" },\n})\n\nconst slots = phoneInputVariants()\n\n/* ─── Data helpers ──────────────────────────────────────────────────────── */\n\nexport interface PhoneChangePayload {\n /** ISO 3166-1 alpha-2 code, upper case. */\n country: string\n /** Digits only, without the `+`. */\n dialCode: string\n /** The national number as typed. */\n nationalNumber: string\n /** `+` dial code and the national digits, or `\"\"` when there are no digits. Store this. */\n e164: string\n}\n\nfunction toPayload(country: PhoneCountry, nationalNumber: string): PhoneChangePayload {\n const digits = nationalNumber.replace(/\\D/g, \"\")\n return {\n country: country.iso2,\n dialCode: country.dialCode,\n nationalNumber,\n e164: digits ? `+${country.dialCode}${digits}` : \"\",\n }\n}\n\nconst fold = (text: string) => text.normalize(\"NFD\").replace(/[̀-ͯ]/g, \"\").toLowerCase()\nconst searchKeys = new Map(phoneCountries.map((country) => [country.iso2, fold(country.name)]))\n\n/** By name (accents ignored), ISO code, or dial code when the query is digits. */\nfunction filterCountries(query: string) {\n const q = fold(query.trim())\n if (!q) return phoneCountries\n if (/^\\+?\\d+$/.test(q)) {\n const digits = q.replace(\"+\", \"\")\n return phoneCountries.filter((country) => country.dialCode.startsWith(digits))\n }\n return phoneCountries.filter(\n (country) => searchKeys.get(country.iso2)!.includes(q) || country.iso2.toLowerCase() === q,\n )\n}\n\nfunction CountryFlag({ iso2 }: { iso2: string }) {\n return (\n <span aria-hidden className={slots.flag()}>\n <FlagArtwork code={iso2} className=\"size-full\" preserveAspectRatio=\"xMidYMid slice\" />\n </span>\n )\n}\n\nfunction assignRef<T>(ref: React.Ref<T> | undefined, value: T | null) {\n if (typeof ref === \"function\") ref(value)\n else if (ref) (ref as React.RefObject<T | null>).current = value\n}\n\n/* ─── Country list ──────────────────────────────────────────────────────── */\n\nconst PAGE = 8\n\nfunction CountryList({\n selected,\n onPick,\n searchRef,\n}: {\n selected: string\n onPick: (country: PhoneCountry) => void\n searchRef: React.RefObject<HTMLInputElement | null>\n}) {\n const listId = React.useId()\n const listRef = React.useRef<HTMLDivElement>(null)\n const [query, setQuery] = React.useState(\"\")\n const [active, setActive] = React.useState(selected)\n // Keyboard moves scroll the active row into view; a hover never scrolls. Opening centres it.\n const scrollToActive = React.useRef(true)\n const opened = React.useRef(false)\n\n const results = React.useMemo(() => filterCountries(query), [query])\n const activeIndex = results.findIndex((country) => country.iso2 === active)\n\n React.useEffect(() => {\n if (!scrollToActive.current) return\n const list = listRef.current\n const row = list?.querySelector<HTMLElement>(`[data-value=\"${active}\"]`)\n if (!list || !row) return\n // Layout offsets, not rects: the popover is still scaling in while this runs.\n const pad = 6\n const top = row.offsetTop - list.offsetTop - list.clientTop\n const bottom = top + row.offsetHeight\n if (!opened.current) {\n opened.current = true\n list.scrollTop = top - (list.clientHeight - row.offsetHeight) / 2\n } else if (top < list.scrollTop + pad) {\n list.scrollTop = top - pad\n } else if (bottom > list.scrollTop + list.clientHeight - pad) {\n list.scrollTop = bottom - list.clientHeight + pad\n }\n }, [active, results])\n\n const moveTo = (index: number) => {\n const next = results[Math.max(0, Math.min(results.length - 1, index))]\n if (!next) return\n scrollToActive.current = true\n setActive(next.iso2)\n }\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault()\n moveTo(activeIndex + 1)\n break\n case \"ArrowUp\":\n event.preventDefault()\n moveTo(activeIndex < 0 ? 0 : activeIndex - 1)\n break\n case \"PageDown\":\n event.preventDefault()\n moveTo(activeIndex + PAGE)\n break\n case \"PageUp\":\n event.preventDefault()\n moveTo(activeIndex - PAGE)\n break\n case \"Enter\": {\n event.preventDefault()\n const country = results[activeIndex]\n if (country) onPick(country)\n break\n }\n }\n }\n\n return (\n <>\n <div className={slots.search()}>\n <InputRoot size=\"sm\">\n <InputPrefix>\n <MagnifyingGlass />\n </InputPrefix>\n <InputField\n ref={searchRef}\n placeholder=\"Search countries…\"\n aria-label=\"Search countries\"\n aria-controls={listId}\n aria-activedescendant={activeIndex >= 0 ? `${listId}-${active}` : undefined}\n autoComplete=\"off\"\n value={query}\n onChange={(event) => {\n const next = event.target.value\n setQuery(next)\n scrollToActive.current = true\n setActive(filterCountries(next)[0]?.iso2 ?? \"\")\n }}\n onKeyDown={onKeyDown}\n />\n </InputRoot>\n </div>\n <div ref={listRef} id={listId} role=\"listbox\" aria-label=\"Countries\" className={slots.list()}>\n {results.length === 0 ? (\n <p className={slots.empty()}>No countries found.</p>\n ) : (\n results.map((country) => (\n <button\n key={country.iso2}\n id={`${listId}-${country.iso2}`}\n type=\"button\"\n role=\"option\"\n tabIndex={-1}\n data-value={country.iso2}\n aria-selected={country.iso2 === selected}\n data-active={country.iso2 === active}\n className={slots.option()}\n onPointerMove={() => {\n if (country.iso2 === active) return\n scrollToActive.current = false\n setActive(country.iso2)\n }}\n onClick={() => onPick(country)}\n >\n <CountryFlag iso2={country.iso2} />\n <span className={slots.optionName()}>{country.name}</span>\n <span className={slots.optionDial()}>+{country.dialCode}</span>\n {country.iso2 === selected && <Check aria-hidden className={slots.check()} />}\n </button>\n ))\n )}\n </div>\n </>\n )\n}\n\n/* ─── PhoneInput ────────────────────────────────────────────────────────── */\n\nexport interface PhoneInputProps\n extends Omit<InputFieldProps, \"value\" | \"defaultValue\" | \"onChange\" | \"type\" | \"size\"> {\n /** Controlled country, an ISO 3166-1 alpha-2 code. */\n country?: string\n /** Initial country, uncontrolled. */\n defaultCountry?: string\n /** Called when another country is picked. */\n onCountryChange?: (iso2: string) => void\n /** Controlled national number. */\n value?: string\n /** Initial national number, uncontrolled. */\n defaultValue?: string\n /** Called with the national number as typed. */\n onValueChange?: (nationalNumber: string) => void\n /** Called on any change with the whole number. Store `e164`. */\n onChange?: (payload: PhoneChangePayload) => void\n /** Height 32, 36 or 40px. Unset, it comes from a container or the density. */\n size?: ControlSize\n /** Only picks the default `size`. An explicit `size` wins. */\n density?: Density\n /** Destructive border and ring, and `aria-invalid` on the input. Inherited from a `Field`. */\n hasError?: boolean\n /** Merged onto the wrapping `InputRoot`; `className` goes to the `<input>`. */\n rootClassName?: string\n}\n\nconst fallbackCountry = findPhoneCountry(\"US\")!\n\nexport function PhoneInput({\n country: countryProp,\n defaultCountry = \"US\",\n onCountryChange,\n value: valueProp,\n defaultValue = \"\",\n onValueChange,\n onChange,\n placeholder = \"Phone number\",\n size,\n density,\n hasError,\n disabled,\n rootClassName,\n className,\n ref,\n ...props\n}: PhoneInputProps) {\n const field = useFieldContext()\n const resolvedSize = useControlSize(size, density)\n const isDisabled = disabled ?? field?.disabled ?? false\n\n const [iso2, setIso2] = useControllableState({\n prop: countryProp?.toUpperCase(),\n defaultProp: defaultCountry.toUpperCase(),\n onChange: onCountryChange,\n })\n const [nationalNumber, setNationalNumber] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue,\n onChange: onValueChange,\n })\n const country = findPhoneCountry(iso2) ?? fallbackCountry\n\n const [open, setOpen] = React.useState(false)\n const fieldRef = React.useRef<HTMLInputElement | null>(null)\n const searchRef = React.useRef<HTMLInputElement | null>(null)\n const picked = React.useRef(false)\n\n const pick = (next: PhoneCountry) => {\n picked.current = true\n setOpen(false)\n if (next.iso2 === country.iso2) return\n setIso2(next.iso2)\n onChange?.(toPayload(next, nationalNumber))\n }\n\n return (\n <InputRoot\n size={resolvedSize}\n hasError={hasError}\n disabled={isDisabled}\n className={rootClassName}\n >\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <PopoverPrimitive.Trigger\n type=\"button\"\n data-slot=\"phone-input-country\"\n aria-label={`Country: ${country.name} (+${country.dialCode})`}\n disabled={isDisabled}\n className={phoneInputVariants({ size: resolvedSize }).country()}\n >\n <CountryFlag iso2={country.iso2} />\n <CaretDown aria-hidden className={slots.caret()} />\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n data-slot=\"phone-input-popover\"\n side=\"bottom\"\n align=\"start\"\n sideOffset={6}\n collisionPadding={8}\n className={slots.popover()}\n onOpenAutoFocus={(event) => {\n event.preventDefault()\n searchRef.current?.focus()\n }}\n onCloseAutoFocus={(event) => {\n // After a pick, typing carries on in the number; Escape or an outside press returns to the button.\n if (!picked.current) return\n picked.current = false\n event.preventDefault()\n fieldRef.current?.focus()\n }}\n >\n {/* The list's search box isn't the labelled phone field: it takes nothing from a `Field`. */}\n <FieldContextProvider value={null}>\n <CountryList selected={country.iso2} onPick={pick} searchRef={searchRef} />\n </FieldContextProvider>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n <span data-slot=\"phone-input-dial\" aria-hidden className={slots.dial()}>\n +{country.dialCode}\n </span>\n <InputField\n ref={(node) => {\n fieldRef.current = node\n assignRef(ref, node)\n }}\n type=\"tel\"\n inputMode=\"tel\"\n autoComplete=\"tel-national\"\n placeholder={placeholder}\n className={[\"tabular-nums\", className].filter(Boolean).join(\" \")}\n value={nationalNumber}\n onChange={(event) => {\n const next = event.target.value\n setNationalNumber(next)\n onChange?.(toPayload(country, next))\n }}\n {...props}\n />\n </InputRoot>\n )\n}\n\nexport { phoneInputVariants }\n"],"mappings":";AA6GM,SAwFF,UAxFE,KA0FE,YA1FF;AA3GN,YAAY,WAAW;AACvB,SAAS,WAAW,OAAO,uBAAuB;AAClD,SAAS,WAAW,wBAAwB;AAE5C,SAAS,mBAAmB;AAC5B,SAAS,sBAAsD;AAC/D,SAAS,sBAAsB,uBAAuB;AACtD,SAAS,UAAU;AAEnB,SAAS,YAAY,aAAa,iBAAuC;AACzE,SAAS,kBAAkB,sBAAyC;AACpE,SAAS,4BAA4B;AAQrC,MAAM,qBAAqB,GAAG;AAAA,EAC5B,OAAO;AAAA,IACL,SAAS;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,MAAM;AAAA,MACJ;AAAA,MACA;AAAA,IACF;AAAA,IACA,OAAO;AAAA,IACP,MAAM;AAAA,IACN,SAAS;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,MACN;AAAA,MACA;AAAA;AAAA;AAAA,MAGA;AAAA,IACF;AAAA,IACA,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,IAAI,EAAE,SAAS,gCAAgC;AAAA,MAC/C,IAAI,EAAE,SAAS,0BAA0B;AAAA,MACzC,IAAI,EAAE,SAAS,gCAAgC;AAAA,IACjD;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,MAAM,KAAK;AAChC,CAAC;AAED,MAAM,QAAQ,mBAAmB;AAejC,SAAS,UAAU,SAAuB,gBAA4C;AACpF,QAAM,SAAS,eAAe,QAAQ,OAAO,EA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M,eAAe;AACrB,yBAAS,SAAS,MAAM;AAAA,cAC1B;AAAA,cAGA,8BAAC,wBAAqB,OAAO,MAC3B,8BAAC,eAAY,UAAU,QAAQ,MAAM,QAAQ,MAAM,WAAsB,GAC3E;AAAA;AAAA,UACF,GACF;AAAA,WACF;AAAA,QACA,qBAAC,UAAK,aAAU,oBAAmB,eAAW,MAAC,WAAW,MAAM,KAAK,GAAG;AAAA;AAAA,UACpE,QAAQ;AAAA,WACZ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,KAAK,CAAC,SAAS;AACb,uBAAS,UAAU;AACnB,wBAAU,KAAK,IAAI;AAAA,YACrB;AAAA,YACA,MAAK;AAAA,YACL,WAAU;AAAA,YACV,cAAa;AAAA,YACb;AAAA,YACA,WAAW,CAAC,gBAAgB,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,YAC/D,OAAO;AAAA,YACP,UAAU,CAAC,UAAU;AACnB,oBAAM,OAAO,MAAM,OAAO;AAC1B,gCAAkB,IAAI;AACtB,yBAAW,UAAU,SAAS,IAAI,CAAC;AAAA,YACrC;AAAA,YACC,GAAG;AAAA;AAAA,QACN;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
function useControllableState({
|
|
4
|
+
prop,
|
|
5
|
+
defaultProp,
|
|
6
|
+
onChange
|
|
7
|
+
}) {
|
|
8
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultProp);
|
|
9
|
+
const isControlled = prop !== void 0;
|
|
10
|
+
const value = isControlled ? prop : uncontrolled;
|
|
11
|
+
const setValue = React.useCallback(
|
|
12
|
+
(next) => {
|
|
13
|
+
if (Object.is(next, value)) return;
|
|
14
|
+
if (!isControlled) setUncontrolled(next);
|
|
15
|
+
onChange?.(next);
|
|
16
|
+
},
|
|
17
|
+
[isControlled, onChange, value]
|
|
18
|
+
);
|
|
19
|
+
return [value, setValue];
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
useControllableState
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=use-controllable-state.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/input/use-controllable-state.ts"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\n/**\n * A value the parent may own. Private to Input until a shared `@/lib/controllable` exists:\n * controlled when `prop` is defined, otherwise it keeps its own state seeded from `defaultProp`.\n * `onChange` fires for every change requested through the setter, in both modes.\n */\nexport function useControllableState<T>({\n prop,\n defaultProp,\n onChange,\n}: {\n prop: T | undefined\n defaultProp: T\n onChange?: (value: T) => void\n}) {\n const [uncontrolled, setUncontrolled] = React.useState<T>(defaultProp)\n const isControlled = prop !== undefined\n const value = isControlled ? (prop as T) : uncontrolled\n\n const setValue = React.useCallback(\n (next: T) => {\n if (Object.is(next, value)) return\n if (!isControlled) setUncontrolled(next)\n onChange?.(next)\n },\n [isControlled, onChange, value],\n )\n\n return [value, setValue] as const\n}\n"],"mappings":";AAEA,YAAY,WAAW;AAOhB,SAAS,qBAAwB;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,QAAM,CAAC,cAAc,eAAe,IAAI,MAAM,SAAY,WAAW;AACrE,QAAM,eAAe,SAAS;AAC9B,QAAM,QAAQ,eAAgB,OAAa;AAE3C,QAAM,WAAW,MAAM;AAAA,IACrB,CAAC,SAAY;AACX,UAAI,OAAO,GAAG,MAAM,KAAK,EAAG;AAC5B,UAAI,CAAC,aAAc,iBAAgB,IAAI;AACvC,iBAAW,IAAI;AAAA,IACjB;AAAA,IACA,CAAC,cAAc,UAAU,KAAK;AAAA,EAChC;AAEA,SAAO,CAAC,OAAO,QAAQ;AACzB;","names":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { duration } from "../../../lib/motion.mjs";
|
|
4
|
+
const HOLD_DELAY = duration.slow;
|
|
5
|
+
const HOLD_REPEAT = Math.round(duration.fast / 3);
|
|
6
|
+
function useHoldRepeat(action) {
|
|
7
|
+
const latest = React.useRef(action);
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
latest.current = action;
|
|
10
|
+
});
|
|
11
|
+
const timer = React.useRef(null);
|
|
12
|
+
const stop = React.useCallback(() => {
|
|
13
|
+
if (timer.current !== null) {
|
|
14
|
+
clearTimeout(timer.current);
|
|
15
|
+
clearInterval(timer.current);
|
|
16
|
+
timer.current = null;
|
|
17
|
+
}
|
|
18
|
+
}, []);
|
|
19
|
+
React.useEffect(() => stop, [stop]);
|
|
20
|
+
const start = React.useCallback(
|
|
21
|
+
(direction) => {
|
|
22
|
+
stop();
|
|
23
|
+
latest.current(direction);
|
|
24
|
+
timer.current = setTimeout(() => {
|
|
25
|
+
timer.current = setInterval(() => latest.current(direction), HOLD_REPEAT);
|
|
26
|
+
}, HOLD_DELAY);
|
|
27
|
+
},
|
|
28
|
+
[stop]
|
|
29
|
+
);
|
|
30
|
+
return { start, stop };
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
useHoldRepeat
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=use-hold-repeat.mjs.map
|