@devalok/shilp-sutra 0.34.0 → 0.36.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 +21 -21
- package/dist/_chunks/badge-group.js +306 -246
- package/dist/_chunks/badge-group.js.map +1 -0
- package/dist/_chunks/chat.js +518 -0
- package/dist/_chunks/chat.js.map +1 -0
- package/dist/_chunks/date-picker.js +748 -0
- package/dist/_chunks/date-picker.js.map +1 -0
- package/dist/_chunks/document-preview.js +109 -90
- package/dist/_chunks/document-preview.js.map +1 -0
- package/dist/_chunks/file-preview.js +492 -504
- package/dist/_chunks/file-preview.js.map +1 -0
- package/dist/_chunks/framer.js +5564 -5613
- package/dist/_chunks/framer.js.map +1 -0
- package/dist/_chunks/image-preview.js +127 -88
- package/dist/_chunks/image-preview.js.map +1 -0
- package/dist/_chunks/keybinding.js +12 -14
- package/dist/_chunks/keybinding.js.map +1 -0
- package/dist/_chunks/link-context.js +19 -16
- package/dist/_chunks/link-context.js.map +1 -0
- package/dist/_chunks/mention-suggestion.js +353 -350
- package/dist/_chunks/mention-suggestion.js.map +1 -0
- package/dist/_chunks/motion-provider.js +26 -20
- package/dist/_chunks/motion-provider.js.map +1 -0
- package/dist/_chunks/popover.js +123 -0
- package/dist/_chunks/popover.js.map +1 -0
- package/dist/_chunks/primitives.js +7585 -6426
- package/dist/_chunks/primitives.js.map +1 -0
- package/dist/_chunks/rich-chat-input.js +2071 -0
- package/dist/_chunks/rich-chat-input.js.map +1 -0
- package/dist/_chunks/rolldown-runtime.js +21 -0
- package/dist/_chunks/shared.js +126 -0
- package/dist/_chunks/shared.js.map +1 -0
- package/dist/_chunks/sonner.js +605 -734
- package/dist/_chunks/sonner.js.map +1 -0
- package/dist/_chunks/stat-row.js +418 -440
- package/dist/_chunks/stat-row.js.map +1 -0
- package/dist/_chunks/tiptap.js +15850 -19964
- package/dist/_chunks/tiptap.js.map +1 -0
- package/dist/_chunks/tree-view.js +231 -290
- package/dist/_chunks/tree-view.js.map +1 -0
- package/dist/_chunks/use-calendar.js +161 -208
- package/dist/_chunks/use-calendar.js.map +1 -0
- package/dist/_chunks/vendor-client.js +314 -2199
- package/dist/_chunks/vendor-client.js.map +1 -0
- package/dist/_chunks/vendor-utils.js +1721 -2978
- package/dist/_chunks/vendor-utils.js.map +1 -0
- package/dist/ai/ai-command-provider.js +23 -17
- package/dist/ai/ai-command-provider.js.map +1 -0
- package/dist/ai/block-renderer.js +68 -51
- package/dist/ai/block-renderer.js.map +1 -0
- package/dist/ai/blocks/index.js +2 -12
- package/dist/ai/blocks/loading.d.ts.map +1 -1
- package/dist/ai/command-bar.js +470 -519
- package/dist/ai/command-bar.js.map +1 -0
- package/dist/ai/conversation.js +241 -227
- package/dist/ai/conversation.js.map +1 -0
- package/dist/ai/devadoot-icon.d.ts.map +1 -1
- package/dist/ai/index.js +181 -167
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/types.js +0 -1
- package/dist/composed/activity-feed.js +232 -202
- package/dist/composed/activity-feed.js.map +1 -0
- package/dist/composed/avatar-group.js +164 -222
- package/dist/composed/avatar-group.js.map +1 -0
- package/dist/composed/bulk-action-bar.js +166 -165
- package/dist/composed/bulk-action-bar.js.map +1 -0
- package/dist/composed/command-palette.js +290 -308
- package/dist/composed/command-palette.js.map +1 -0
- package/dist/composed/confirm-dialog.js +28 -48
- package/dist/composed/confirm-dialog.js.map +1 -0
- package/dist/composed/content-card.js +69 -108
- package/dist/composed/content-card.js.map +1 -0
- package/dist/composed/date-picker/index.js +3 -13
- package/dist/composed/deadline-indicator.js +68 -74
- package/dist/composed/deadline-indicator.js.map +1 -0
- package/dist/composed/emoji-picker.js +83 -110
- package/dist/composed/emoji-picker.js.map +1 -0
- package/dist/composed/empty-state.d.ts.map +1 -1
- package/dist/composed/empty-state.js +64 -103
- package/dist/composed/empty-state.js.map +1 -0
- package/dist/composed/error-boundary.js +129 -127
- package/dist/composed/error-boundary.js.map +1 -0
- package/dist/composed/file-preview.js +2 -12
- package/dist/composed/filter-bar.js +98 -130
- package/dist/composed/filter-bar.js.map +1 -0
- package/dist/composed/form-section.js +61 -45
- package/dist/composed/form-section.js.map +1 -0
- package/dist/composed/global-loading.js +34 -47
- package/dist/composed/global-loading.js.map +1 -0
- package/dist/composed/index.js +34 -92
- package/dist/composed/inline-edit.js +92 -107
- package/dist/composed/inline-edit.js.map +1 -0
- package/dist/composed/lib/string-utils.js +8 -8
- package/dist/composed/lib/string-utils.js.map +1 -0
- package/dist/composed/loading-skeleton.js +103 -171
- package/dist/composed/loading-skeleton.js.map +1 -0
- package/dist/composed/markdown-viewer.js +187 -139
- package/dist/composed/markdown-viewer.js.map +1 -0
- package/dist/composed/master-detail.js +147 -156
- package/dist/composed/master-detail.js.map +1 -0
- package/dist/composed/member-picker.js +46 -49
- package/dist/composed/member-picker.js.map +1 -0
- package/dist/composed/multi-select-popover.d.ts.map +1 -1
- package/dist/composed/multi-select-popover.js +185 -179
- package/dist/composed/multi-select-popover.js.map +1 -0
- package/dist/composed/page-header.js +54 -76
- package/dist/composed/page-header.js.map +1 -0
- package/dist/composed/page-skeletons.js +143 -127
- package/dist/composed/page-skeletons.js.map +1 -0
- package/dist/composed/priority-indicator.js +105 -111
- package/dist/composed/priority-indicator.js.map +1 -0
- package/dist/composed/responsive-overlay.js +36 -41
- package/dist/composed/responsive-overlay.js.map +1 -0
- package/dist/composed/rich-chat-input/attachment-strip.d.ts.map +1 -1
- package/dist/composed/rich-chat-input/reply-banner.d.ts.map +1 -1
- package/dist/composed/rich-chat-input/schedule-send.d.ts.map +1 -1
- package/dist/composed/rich-chat-input.d.ts.map +1 -1
- package/dist/composed/rich-chat-input.js +2 -1860
- package/dist/composed/rich-text-editor.js +561 -424
- package/dist/composed/rich-text-editor.js.map +1 -0
- package/dist/composed/schedule-view.js +134 -185
- package/dist/composed/schedule-view.js.map +1 -0
- package/dist/composed/simple-tooltip.js +21 -21
- package/dist/composed/simple-tooltip.js.map +1 -0
- package/dist/composed/status-badge.d.ts.map +1 -1
- package/dist/composed/status-badge.js +133 -137
- package/dist/composed/status-badge.js.map +1 -0
- package/dist/hooks/index.js +7 -12
- package/dist/hooks/use-color-mode.js +28 -25
- package/dist/hooks/use-color-mode.js.map +1 -0
- package/dist/hooks/use-mobile.js +13 -13
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/hooks/use-toast.js +2 -4
- package/dist/hooks/use-touch-device.js +9 -11
- package/dist/hooks/use-touch-device.js.map +1 -0
- package/dist/hooks/use-viewport-height.js +14 -14
- package/dist/hooks/use-viewport-height.js.map +1 -0
- package/dist/motion/check-motion-provider.d.ts +3 -0
- package/dist/motion/check-motion-provider.d.ts.map +1 -0
- package/dist/motion/index.js +17 -11
- package/dist/motion/index.js.map +1 -0
- package/dist/motion/primitives-index.js +226 -186
- package/dist/motion/primitives-index.js.map +1 -0
- package/dist/primitives/react-accordion.d.ts +114 -114
- package/dist/primitives/react-alert-dialog.d.ts +51 -51
- package/dist/primitives/react-aspect-ratio.d.ts +11 -11
- package/dist/primitives/react-avatar.d.ts +24 -24
- package/dist/primitives/react-checkbox.d.ts +50 -50
- package/dist/primitives/react-collapsible.d.ts +33 -33
- package/dist/primitives/react-context-menu.d.ts +96 -96
- package/dist/primitives/react-dialog.d.ts +103 -103
- package/dist/primitives/react-dropdown-menu.d.ts +97 -97
- package/dist/primitives/react-hover-card.d.ts +79 -79
- package/dist/primitives/react-label.d.ts +10 -10
- package/dist/primitives/react-menu.d.ts +169 -169
- package/dist/primitives/react-menubar.d.ts +115 -115
- package/dist/primitives/react-navigation-menu.d.ts +126 -126
- package/dist/primitives/react-popover.d.ts +85 -85
- package/dist/primitives/react-progress.d.ts +19 -19
- package/dist/primitives/react-radio-group.d.ts +58 -58
- package/dist/primitives/react-roving-focus.d.ts +49 -49
- package/dist/primitives/react-select.d.ts +137 -137
- package/dist/primitives/react-separator.d.ts +21 -21
- package/dist/primitives/react-slider.d.ts +75 -75
- package/dist/primitives/react-switch.d.ts +21 -21
- package/dist/primitives/react-tabs.d.ts +56 -56
- package/dist/primitives/react-toast.d.ts +120 -120
- package/dist/primitives/react-toggle-group.d.ts +75 -75
- package/dist/primitives/react-toggle.d.ts +24 -24
- package/dist/primitives/react-tooltip.d.ts +101 -101
- package/dist/primitives/react-visually-hidden.d.ts +22 -22
- package/dist/shell/app-command-palette.d.ts +2 -0
- package/dist/shell/app-command-palette.d.ts.map +1 -1
- package/dist/shell/app-command-palette.js +94 -238
- package/dist/shell/app-command-palette.js.map +1 -0
- package/dist/shell/bottom-navbar.js +150 -190
- package/dist/shell/bottom-navbar.js.map +1 -0
- package/dist/shell/command-registry.js +13 -14
- package/dist/shell/command-registry.js.map +1 -0
- package/dist/shell/index.js +10 -20
- package/dist/shell/link-context.js +2 -5
- package/dist/shell/notification-center.d.ts.map +1 -1
- package/dist/shell/notification-center.js +263 -259
- package/dist/shell/notification-center.js.map +1 -0
- package/dist/shell/notification-preferences.js +241 -184
- package/dist/shell/notification-preferences.js.map +1 -0
- package/dist/shell/sidebar.js +251 -281
- package/dist/shell/sidebar.js.map +1 -0
- package/dist/shell/top-bar.js +203 -237
- package/dist/shell/top-bar.js.map +1 -0
- package/dist/tailwind/index.cjs +473 -442
- package/dist/tailwind/index.js +2 -4
- package/dist/tailwind/preset.d.ts.map +1 -1
- package/dist/tailwind/preset.js +490 -459
- package/dist/tailwind/preset.js.map +1 -0
- package/dist/tokens/index.css +4 -4
- package/dist/tokens/primitives.css +442 -442
- package/dist/tokens/semantic.css +742 -547
- package/dist/tokens/typography-semantic.css +123 -100
- package/dist/tokens/typography.css +422 -422
- package/dist/ui/accordion.js +52 -60
- package/dist/ui/accordion.js.map +1 -0
- package/dist/ui/alert-dialog.d.ts +6 -2
- package/dist/ui/alert-dialog.d.ts.map +1 -1
- package/dist/ui/alert-dialog.js +112 -156
- package/dist/ui/alert-dialog.js.map +1 -0
- package/dist/ui/alert.d.ts +3 -2
- package/dist/ui/alert.d.ts.map +1 -1
- package/dist/ui/alert.js +203 -99
- package/dist/ui/alert.js.map +1 -0
- package/dist/ui/aspect-ratio.js +13 -16
- package/dist/ui/aspect-ratio.js.map +1 -0
- package/dist/ui/autocomplete.d.ts.map +1 -1
- package/dist/ui/autocomplete.js +137 -148
- package/dist/ui/autocomplete.js.map +1 -0
- package/dist/ui/avatar.js +196 -169
- package/dist/ui/avatar.js.map +1 -0
- package/dist/ui/badge-group.js +2 -7
- package/dist/ui/badge-indicator.js +42 -51
- package/dist/ui/badge-indicator.js.map +1 -0
- package/dist/ui/badge.js +2 -15
- package/dist/ui/banner.js +76 -68
- package/dist/ui/banner.js.map +1 -0
- package/dist/ui/breadcrumb.js +65 -84
- package/dist/ui/breadcrumb.js.map +1 -0
- package/dist/ui/button-group.js +109 -102
- package/dist/ui/button-group.js.map +1 -0
- package/dist/ui/button-processing.d.ts.map +1 -1
- package/dist/ui/button-processing.js +89 -72
- package/dist/ui/button-processing.js.map +1 -0
- package/dist/ui/button.js +393 -279
- package/dist/ui/button.js.map +1 -0
- package/dist/ui/card.js +151 -157
- package/dist/ui/card.js.map +1 -0
- package/dist/ui/charts/bar-chart.d.ts.map +1 -1
- package/dist/ui/charts/chart-container.d.ts +2 -0
- package/dist/ui/charts/chart-container.d.ts.map +1 -1
- package/dist/ui/charts/index.js +1025 -1319
- package/dist/ui/charts/index.js.map +1 -0
- package/dist/ui/charts/line-chart.d.ts.map +1 -1
- package/dist/ui/chat/index.js +2 -11
- package/dist/ui/chat/message-input.d.ts.map +1 -1
- package/dist/ui/chat/message-list.d.ts +1 -1
- package/dist/ui/chat/message-list.d.ts.map +1 -1
- package/dist/ui/chat/message.d.ts.map +1 -1
- package/dist/ui/chat/system-message.d.ts.map +1 -1
- package/dist/ui/checkbox.d.ts.map +1 -1
- package/dist/ui/checkbox.js +82 -100
- package/dist/ui/checkbox.js.map +1 -0
- package/dist/ui/code.js +18 -32
- package/dist/ui/code.js.map +1 -0
- package/dist/ui/collapsible.js +21 -29
- package/dist/ui/collapsible.js.map +1 -0
- package/dist/ui/color-input.d.ts.map +1 -1
- package/dist/ui/color-input.js +455 -372
- package/dist/ui/color-input.js.map +1 -0
- package/dist/ui/color-swatch.js +60 -90
- package/dist/ui/color-swatch.js.map +1 -0
- package/dist/ui/combobox.d.ts +7 -0
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +278 -293
- package/dist/ui/combobox.js.map +1 -0
- package/dist/ui/container.js +18 -24
- package/dist/ui/container.js.map +1 -0
- package/dist/ui/context-menu.js +154 -203
- package/dist/ui/context-menu.js.map +1 -0
- package/dist/ui/data-table-body.js +116 -213
- package/dist/ui/data-table-body.js.map +1 -0
- package/dist/ui/data-table-bulk-actions.js +43 -59
- package/dist/ui/data-table-bulk-actions.js.map +1 -0
- package/dist/ui/data-table-card.js +84 -71
- package/dist/ui/data-table-card.js.map +1 -0
- package/dist/ui/data-table-context.js +39 -42
- package/dist/ui/data-table-context.js.map +1 -0
- package/dist/ui/data-table-header.js +98 -139
- package/dist/ui/data-table-header.js.map +1 -0
- package/dist/ui/data-table-pagination.js +69 -82
- package/dist/ui/data-table-pagination.js.map +1 -0
- package/dist/ui/data-table-toolbar.js +104 -130
- package/dist/ui/data-table-toolbar.js.map +1 -0
- package/dist/ui/data-table.js +281 -354
- package/dist/ui/data-table.js.map +1 -0
- package/dist/ui/devalok-grain.js +77 -66
- package/dist/ui/devalok-grain.js.map +1 -0
- package/dist/ui/dialog.js +118 -151
- package/dist/ui/dialog.js.map +1 -0
- package/dist/ui/dropdown-menu.js +152 -203
- package/dist/ui/dropdown-menu.js.map +1 -0
- package/dist/ui/file-upload.js +242 -266
- package/dist/ui/file-upload.js.map +1 -0
- package/dist/ui/form.d.ts +8 -0
- package/dist/ui/form.d.ts.map +1 -1
- package/dist/ui/form.js +62 -56
- package/dist/ui/form.js.map +1 -0
- package/dist/ui/hover-card.js +54 -54
- package/dist/ui/hover-card.js.map +1 -0
- package/dist/ui/icon-button.js +21 -26
- package/dist/ui/icon-button.js.map +1 -0
- package/dist/ui/icon-context.js +17 -17
- package/dist/ui/icon-context.js.map +1 -0
- package/dist/ui/icon-group.js +22 -29
- package/dist/ui/icon-group.js.map +1 -0
- package/dist/ui/icon.js +201 -121
- package/dist/ui/icon.js.map +1 -0
- package/dist/ui/index.d.ts +4 -4
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +90 -350
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/input-otp.d.ts +12 -3
- package/dist/ui/input-otp.d.ts.map +1 -1
- package/dist/ui/input-otp.js +58 -48
- package/dist/ui/input-otp.js.map +1 -0
- package/dist/ui/input.d.ts.map +1 -1
- package/dist/ui/input.js +93 -169
- package/dist/ui/input.js.map +1 -0
- package/dist/ui/label.d.ts.map +1 -1
- package/dist/ui/label.js +23 -23
- package/dist/ui/label.js.map +1 -0
- package/dist/ui/lib/check-tokens.d.ts +3 -0
- package/dist/ui/lib/check-tokens.d.ts.map +1 -0
- package/dist/ui/lib/date-utils.js +14 -11
- package/dist/ui/lib/date-utils.js.map +1 -0
- package/dist/ui/lib/motion.d.ts +15 -4
- package/dist/ui/lib/motion.d.ts.map +1 -1
- package/dist/ui/lib/motion.js +83 -33
- package/dist/ui/lib/motion.js.map +1 -0
- package/dist/ui/lib/utils.js +39 -16
- package/dist/ui/lib/utils.js.map +1 -0
- package/dist/ui/link.js +13 -24
- package/dist/ui/link.js.map +1 -0
- package/dist/ui/menubar.js +132 -210
- package/dist/ui/menubar.js.map +1 -0
- package/dist/ui/navigation-menu.js +163 -193
- package/dist/ui/navigation-menu.js.map +1 -0
- package/dist/ui/number-input.d.ts +16 -1
- package/dist/ui/number-input.d.ts.map +1 -1
- package/dist/ui/number-input.js +102 -95
- package/dist/ui/number-input.js.map +1 -0
- package/dist/ui/pagination.js +122 -159
- package/dist/ui/pagination.js.map +1 -0
- package/dist/ui/popover.js +2 -131
- package/dist/ui/progress-ring.d.ts.map +1 -1
- package/dist/ui/progress-ring.js +133 -143
- package/dist/ui/progress-ring.js.map +1 -0
- package/dist/ui/progress.js +51 -95
- package/dist/ui/progress.js.map +1 -0
- package/dist/ui/radio.d.ts.map +1 -1
- package/dist/ui/radio.js +47 -49
- package/dist/ui/radio.js.map +1 -0
- package/dist/ui/search-input.js +51 -53
- package/dist/ui/search-input.js.map +1 -0
- package/dist/ui/segmented-control.d.ts +1 -1
- package/dist/ui/segmented-control.d.ts.map +1 -1
- package/dist/ui/segmented-control.js +95 -114
- package/dist/ui/segmented-control.js.map +1 -0
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +137 -157
- package/dist/ui/select.js.map +1 -0
- package/dist/ui/separator.d.ts.map +1 -1
- package/dist/ui/separator.js +18 -25
- package/dist/ui/separator.js.map +1 -0
- package/dist/ui/sheet.js +135 -163
- package/dist/ui/sheet.js.map +1 -0
- package/dist/ui/sidebar.js +357 -600
- package/dist/ui/sidebar.js.map +1 -0
- package/dist/ui/skeleton.js +179 -231
- package/dist/ui/skeleton.js.map +1 -0
- package/dist/ui/slider.d.ts +22 -3
- package/dist/ui/slider.d.ts.map +1 -1
- package/dist/ui/slider.js +62 -34
- package/dist/ui/slider.js.map +1 -0
- package/dist/ui/spinner.js +226 -205
- package/dist/ui/spinner.js.map +1 -0
- package/dist/ui/split-button.d.ts.map +1 -1
- package/dist/ui/split-button.js +228 -276
- package/dist/ui/split-button.js.map +1 -0
- package/dist/ui/stack.js +56 -70
- package/dist/ui/stack.js.map +1 -0
- package/dist/ui/stat-card.js +259 -251
- package/dist/ui/stat-card.js.map +1 -0
- package/dist/ui/status-dot.js +67 -63
- package/dist/ui/status-dot.js.map +1 -0
- package/dist/ui/stepper.d.ts +10 -0
- package/dist/ui/stepper.d.ts.map +1 -1
- package/dist/ui/stepper.js +124 -168
- package/dist/ui/stepper.js.map +1 -0
- package/dist/ui/switch.d.ts.map +1 -1
- package/dist/ui/switch.js +56 -55
- package/dist/ui/switch.js.map +1 -0
- package/dist/ui/table.js +57 -90
- package/dist/ui/table.js.map +1 -0
- package/dist/ui/tabs.d.ts +3 -1
- package/dist/ui/tabs.d.ts.map +1 -1
- package/dist/ui/tabs.js +159 -156
- package/dist/ui/tabs.js.map +1 -0
- package/dist/ui/text.d.ts +1 -1
- package/dist/ui/text.d.ts.map +1 -1
- package/dist/ui/text.js +60 -59
- package/dist/ui/text.js.map +1 -0
- package/dist/ui/textarea.js +40 -57
- package/dist/ui/textarea.js.map +1 -0
- package/dist/ui/toast-registry.d.ts +8 -0
- package/dist/ui/toast-registry.d.ts.map +1 -0
- package/dist/ui/toast-registry.js +13 -0
- package/dist/ui/toast-registry.js.map +1 -0
- package/dist/ui/toast-types.js +0 -1
- package/dist/ui/toast.d.ts.map +1 -1
- package/dist/ui/toast.js +559 -536
- package/dist/ui/toast.js.map +1 -0
- package/dist/ui/toaster.d.ts.map +1 -1
- package/dist/ui/toaster.js +24 -33
- package/dist/ui/toaster.js.map +1 -0
- package/dist/ui/toggle-group.d.ts +2 -0
- package/dist/ui/toggle-group.d.ts.map +1 -1
- package/dist/ui/toggle-group.js +44 -41
- package/dist/ui/toggle-group.js.map +1 -0
- package/dist/ui/toggle.d.ts +2 -0
- package/dist/ui/toggle.d.ts.map +1 -1
- package/dist/ui/toggle.js +44 -40
- package/dist/ui/toggle.js.map +1 -0
- package/dist/ui/tooltip.js +80 -65
- package/dist/ui/tooltip.js.map +1 -0
- package/dist/ui/tree-view/index.js +2 -6
- package/dist/ui/visually-hidden.js +12 -10
- package/dist/ui/visually-hidden.js.map +1 -0
- package/docs/components/_header.md +85 -85
- package/docs/components/composed/activity-feed.md +62 -62
- package/docs/components/composed/avatar-group.md +65 -65
- package/docs/components/composed/bulk-action-bar.md +40 -40
- package/docs/components/composed/command-palette.md +40 -40
- package/docs/components/composed/confirm-dialog.md +46 -46
- package/docs/components/composed/content-card.md +36 -36
- package/docs/components/composed/date-picker.md +130 -130
- package/docs/components/composed/deadline-indicator.md +27 -27
- package/docs/components/composed/emoji-picker.md +52 -52
- package/docs/components/composed/empty-state.md +53 -53
- package/docs/components/composed/error-boundary.md +29 -29
- package/docs/components/composed/file-preview.md +40 -40
- package/docs/components/composed/filter-bar.md +57 -57
- package/docs/components/composed/form-section.md +31 -31
- package/docs/components/composed/global-loading.md +27 -27
- package/docs/components/composed/inline-edit.md +35 -35
- package/docs/components/composed/loading-skeleton.md +51 -51
- package/docs/components/composed/markdown-viewer.md +27 -27
- package/docs/components/composed/master-detail.md +48 -48
- package/docs/components/composed/member-picker.md +35 -35
- package/docs/components/composed/multi-select-popover.md +62 -62
- package/docs/components/composed/page-header.md +41 -41
- package/docs/components/composed/page-skeletons.md +32 -32
- package/docs/components/composed/priority-indicator.md +32 -32
- package/docs/components/composed/responsive-overlay.md +34 -34
- package/docs/components/composed/rich-text-editor.md +82 -82
- package/docs/components/composed/schedule-view.md +39 -39
- package/docs/components/composed/simple-tooltip.md +33 -33
- package/docs/components/composed/status-badge.md +55 -55
- package/docs/components/shell/app-command-palette.md +44 -44
- package/docs/components/shell/bottom-navbar.md +52 -52
- package/docs/components/shell/command-registry.md +48 -48
- package/docs/components/shell/link-context.md +41 -41
- package/docs/components/shell/notification-center.md +63 -63
- package/docs/components/shell/notification-preferences.md +42 -42
- package/docs/components/shell/sidebar.md +92 -92
- package/docs/components/shell/top-bar.md +143 -143
- package/docs/components/ui/accordion.md +51 -51
- package/docs/components/ui/alert-dialog.md +61 -61
- package/docs/components/ui/alert.md +46 -46
- package/docs/components/ui/aspect-ratio.md +25 -25
- package/docs/components/ui/autocomplete.md +48 -48
- package/docs/components/ui/avatar.md +56 -56
- package/docs/components/ui/badge.md +83 -82
- package/docs/components/ui/banner.md +42 -42
- package/docs/components/ui/breadcrumb.md +37 -37
- package/docs/components/ui/button-group.md +41 -41
- package/docs/components/ui/button.md +94 -93
- package/docs/components/ui/card.md +52 -52
- package/docs/components/ui/charts.md +43 -43
- package/docs/components/ui/checkbox.md +36 -36
- package/docs/components/ui/chip.md +47 -47
- package/docs/components/ui/code.md +28 -28
- package/docs/components/ui/collapsible.md +40 -40
- package/docs/components/ui/color-input.md +91 -91
- package/docs/components/ui/color-swatch.md +25 -25
- package/docs/components/ui/combobox.md +54 -54
- package/docs/components/ui/container.md +26 -26
- package/docs/components/ui/context-menu.md +43 -43
- package/docs/components/ui/data-table-body.md +1 -1
- package/docs/components/ui/data-table-bulk-actions.md +1 -1
- package/docs/components/ui/data-table-card.md +1 -1
- package/docs/components/ui/data-table-context.md +1 -1
- package/docs/components/ui/data-table-header.md +1 -1
- package/docs/components/ui/data-table-pagination.md +1 -1
- package/docs/components/ui/data-table-toolbar.md +44 -44
- package/docs/components/ui/data-table.md +94 -94
- package/docs/components/ui/dialog.md +54 -54
- package/docs/components/ui/dropdown-menu.md +48 -48
- package/docs/components/ui/file-upload.md +41 -41
- package/docs/components/ui/form.md +51 -51
- package/docs/components/ui/hover-card.md +32 -32
- package/docs/components/ui/icon-button.md +40 -40
- package/docs/components/ui/input-otp.md +44 -44
- package/docs/components/ui/input.md +74 -74
- package/docs/components/ui/label.md +25 -25
- package/docs/components/ui/link.md +29 -29
- package/docs/components/ui/menubar.md +44 -44
- package/docs/components/ui/navigation-menu.md +46 -46
- package/docs/components/ui/number-input.md +44 -44
- package/docs/components/ui/pagination.md +48 -48
- package/docs/components/ui/popover.md +30 -30
- package/docs/components/ui/progress-ring.md +41 -41
- package/docs/components/ui/progress.md +34 -34
- package/docs/components/ui/radio.md +34 -34
- package/docs/components/ui/search-input.md +43 -43
- package/docs/components/ui/segmented-control.md +50 -50
- package/docs/components/ui/select.md +53 -53
- package/docs/components/ui/separator.md +32 -32
- package/docs/components/ui/sheet.md +47 -47
- package/docs/components/ui/sidebar.md +72 -72
- package/docs/components/ui/skeleton.md +77 -77
- package/docs/components/ui/slider.md +29 -29
- package/docs/components/ui/spinner.md +54 -54
- package/docs/components/ui/stack.md +39 -39
- package/docs/components/ui/stat-card.md +61 -61
- package/docs/components/ui/status-dot.md +26 -26
- package/docs/components/ui/stepper.md +49 -49
- package/docs/components/ui/switch.md +47 -47
- package/docs/components/ui/table.md +47 -47
- package/docs/components/ui/tabs.md +60 -60
- package/docs/components/ui/text.md +37 -37
- package/docs/components/ui/textarea.md +39 -39
- package/docs/components/ui/toast.md +65 -65
- package/docs/components/ui/toaster.md +47 -47
- package/docs/components/ui/toggle-group.md +43 -43
- package/docs/components/ui/toggle.md +37 -37
- package/docs/components/ui/tooltip.md +38 -38
- package/docs/components/ui/tree-view.md +65 -65
- package/docs/components/ui/visually-hidden.md +21 -21
- package/llms-full.txt +5266 -5264
- package/llms.txt +624 -580
- package/package.json +7 -8
- package/dist/_chunks/date-time-picker.js +0 -851
- package/dist/_chunks/typing-indicator.js +0 -565
package/dist/ui/file-upload.js
CHANGED
|
@@ -1,269 +1,245 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
import { a as e, c as t } from "../_chunks/framer.js";
|
|
3
|
+
import { durations as n, springs as r, tweens as i } from "./lib/motion.js";
|
|
4
|
+
import { cn as a } from "./lib/utils.js";
|
|
5
|
+
import { Spinner as o } from "./spinner.js";
|
|
6
|
+
import { Icon as s } from "./icon.js";
|
|
7
|
+
import * as c from "react";
|
|
8
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
9
|
+
import { IconCheck as d, IconPaperclip as f, IconUpload as p } from "@tabler/icons-react";
|
|
10
|
+
//#region src/ui/file-upload.tsx
|
|
11
|
+
var m = 10 * 1024 * 1024;
|
|
12
|
+
function h(e, t) {
|
|
13
|
+
return t.split(",").map((e) => e.trim()).some((t) => t.startsWith(".") ? e.name.toLowerCase().endsWith(t.toLowerCase()) : t.endsWith("/*") ? e.type.startsWith(t.slice(0, t.indexOf("/") + 1)) : e.type === t);
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
15
|
+
function g(e) {
|
|
16
|
+
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
onFocus: z,
|
|
246
|
-
tabIndex: -1
|
|
247
|
-
}
|
|
248
|
-
),
|
|
249
|
-
/* @__PURE__ */ t(M, { children: u && /* @__PURE__ */ t(
|
|
250
|
-
c.p,
|
|
251
|
-
{
|
|
252
|
-
role: "alert",
|
|
253
|
-
className: "mt-ds-02 text-ds-xs text-error-11",
|
|
254
|
-
initial: { opacity: 0, x: 0 },
|
|
255
|
-
animate: { opacity: 1, x: [0, -4, 4, -4, 4, 0] },
|
|
256
|
-
exit: { opacity: 0 },
|
|
257
|
-
transition: { opacity: N.fade, x: { type: "tween", duration: 0.4, ease: "easeOut" } },
|
|
258
|
-
children: u
|
|
259
|
-
}
|
|
260
|
-
) })
|
|
261
|
-
]
|
|
262
|
-
}
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
);
|
|
266
|
-
Q.displayName = "FileUpload";
|
|
267
|
-
export {
|
|
268
|
-
Q as FileUpload
|
|
269
|
-
};
|
|
18
|
+
var _ = c.forwardRef(({ accept: _, maxSize: v = m, multiple: y = !1, uploading: b = !1, progress: x = 0, onFiles: S, error: C, compact: w = !1, disabled: T = !1, className: E, label: D, sublabel: O, ...k }, A) => {
|
|
19
|
+
let j = c.useRef(null), [M, N] = c.useState(!1), [P, F] = c.useState(null), I = c.useRef(!1), L = c.useRef(!1), R = C || P, z = c.useCallback(() => {
|
|
20
|
+
T || b || j.current?.click();
|
|
21
|
+
}, [T, b]), B = c.useCallback((e) => {
|
|
22
|
+
F(null);
|
|
23
|
+
for (let t of e) {
|
|
24
|
+
if (t.size > v) {
|
|
25
|
+
F(`File "${t.name}" exceeds the maximum size of ${g(v)}`);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (_ && !h(t, _)) {
|
|
29
|
+
F(`File "${t.name}" is not an accepted file type`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
S(e);
|
|
34
|
+
}, [
|
|
35
|
+
v,
|
|
36
|
+
_,
|
|
37
|
+
S
|
|
38
|
+
]), V = c.useCallback((e) => {
|
|
39
|
+
L.current = !0;
|
|
40
|
+
let t = e.target.files;
|
|
41
|
+
!t || t.length === 0 || (B(Array.from(t)), e.target.value = "");
|
|
42
|
+
}, [B]), H = c.useCallback(() => {
|
|
43
|
+
I.current = !0, L.current = !1;
|
|
44
|
+
}, []), U = c.useCallback(() => {
|
|
45
|
+
I.current && !L.current && _ && F("File type is not accepted"), I.current = !1;
|
|
46
|
+
}, [_]), W = c.useCallback((e) => {
|
|
47
|
+
e.preventDefault(), e.stopPropagation(), !T && !b && N(!0);
|
|
48
|
+
}, [T, b]), G = c.useCallback((e) => {
|
|
49
|
+
e.preventDefault(), e.stopPropagation(), !T && !b && N(!0);
|
|
50
|
+
}, [T, b]), K = c.useCallback((e) => {
|
|
51
|
+
e.preventDefault(), e.stopPropagation(), N(!1);
|
|
52
|
+
}, []), q = c.useCallback((e) => {
|
|
53
|
+
if (e.preventDefault(), e.stopPropagation(), N(!1), T || b) return;
|
|
54
|
+
let t = e.dataTransfer.files;
|
|
55
|
+
!t || t.length === 0 || B(Array.from(t));
|
|
56
|
+
}, [
|
|
57
|
+
T,
|
|
58
|
+
b,
|
|
59
|
+
B
|
|
60
|
+
]), J = D ?? "Drop files here or click to browse", Y = O ?? `Max file size: ${g(v)}`, X = c.useId();
|
|
61
|
+
return w ? /* @__PURE__ */ u("div", {
|
|
62
|
+
ref: A,
|
|
63
|
+
className: a("inline-flex flex-col", E),
|
|
64
|
+
...k,
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ u("button", {
|
|
67
|
+
type: "button",
|
|
68
|
+
onClick: z,
|
|
69
|
+
disabled: T,
|
|
70
|
+
className: a("inline-flex items-center gap-ds-02 rounded-ds-md px-ds-03 py-ds-02", "text-ds-sm font-medium", "border border-surface-border-strong", "bg-surface-raised-hover text-surface-fg-muted", "hover:bg-accent-2", "disabled:opacity-action-disabled disabled:cursor-not-allowed", "transition-colors"),
|
|
71
|
+
children: [b ? /* @__PURE__ */ l(o, { size: "sm" }) : /* @__PURE__ */ l(s, {
|
|
72
|
+
icon: f,
|
|
73
|
+
size: "sm"
|
|
74
|
+
}), D ?? "Attach files"]
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ l("input", {
|
|
77
|
+
ref: j,
|
|
78
|
+
id: X,
|
|
79
|
+
type: "file",
|
|
80
|
+
className: "sr-only",
|
|
81
|
+
style: { visibility: "hidden" },
|
|
82
|
+
"aria-hidden": "true",
|
|
83
|
+
"aria-label": D ?? "Attach files",
|
|
84
|
+
accept: _,
|
|
85
|
+
multiple: y,
|
|
86
|
+
disabled: T,
|
|
87
|
+
onChange: V,
|
|
88
|
+
onClick: H,
|
|
89
|
+
onFocus: U,
|
|
90
|
+
tabIndex: -1
|
|
91
|
+
}),
|
|
92
|
+
R && /* @__PURE__ */ l("p", {
|
|
93
|
+
role: "alert",
|
|
94
|
+
"aria-live": "polite",
|
|
95
|
+
className: "mt-ds-02 text-ds-xs text-error-11",
|
|
96
|
+
children: R
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
}) : /* @__PURE__ */ u("div", {
|
|
100
|
+
ref: A,
|
|
101
|
+
...k,
|
|
102
|
+
role: "presentation",
|
|
103
|
+
className: a("flex flex-col", E),
|
|
104
|
+
"data-drag-active": M ? "true" : void 0,
|
|
105
|
+
onDragEnter: W,
|
|
106
|
+
onDragOver: G,
|
|
107
|
+
onDragLeave: K,
|
|
108
|
+
onDrop: q,
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ u(e.div, {
|
|
111
|
+
role: "button",
|
|
112
|
+
tabIndex: 0,
|
|
113
|
+
"aria-disabled": T || void 0,
|
|
114
|
+
onClick: T ? void 0 : z,
|
|
115
|
+
onKeyDown: (e) => {
|
|
116
|
+
!T && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), z());
|
|
117
|
+
},
|
|
118
|
+
className: a("flex flex-col items-center justify-center gap-ds-03 rounded-ds-lg", "border-2 border-dashed p-ds-08", "cursor-pointer", "border-surface-border-strong bg-surface-raised-hover", M && "border-accent-7 bg-accent-2", T && "opacity-action-disabled cursor-not-allowed"),
|
|
119
|
+
animate: { scale: M ? 1.02 : 1 },
|
|
120
|
+
transition: r.snappy,
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ l(t, {
|
|
123
|
+
mode: "wait",
|
|
124
|
+
children: b ? /* @__PURE__ */ l(e.div, {
|
|
125
|
+
initial: {
|
|
126
|
+
opacity: 0,
|
|
127
|
+
scale: .5
|
|
128
|
+
},
|
|
129
|
+
animate: {
|
|
130
|
+
opacity: 1,
|
|
131
|
+
scale: 1
|
|
132
|
+
},
|
|
133
|
+
exit: {
|
|
134
|
+
opacity: 0,
|
|
135
|
+
scale: .5
|
|
136
|
+
},
|
|
137
|
+
transition: i.fade,
|
|
138
|
+
children: /* @__PURE__ */ l(o, { size: "md" })
|
|
139
|
+
}, "spinner") : x === 100 && !C ? /* @__PURE__ */ l(e.div, {
|
|
140
|
+
initial: {
|
|
141
|
+
opacity: 0,
|
|
142
|
+
scale: .5
|
|
143
|
+
},
|
|
144
|
+
animate: {
|
|
145
|
+
opacity: 1,
|
|
146
|
+
scale: 1
|
|
147
|
+
},
|
|
148
|
+
exit: {
|
|
149
|
+
opacity: 0,
|
|
150
|
+
scale: .5
|
|
151
|
+
},
|
|
152
|
+
transition: r.bouncy,
|
|
153
|
+
children: /* @__PURE__ */ l(s, {
|
|
154
|
+
icon: d,
|
|
155
|
+
size: "2xl",
|
|
156
|
+
className: "text-success-11"
|
|
157
|
+
})
|
|
158
|
+
}, "complete") : /* @__PURE__ */ l(e.div, {
|
|
159
|
+
initial: { opacity: 0 },
|
|
160
|
+
animate: { opacity: 1 },
|
|
161
|
+
exit: { opacity: 0 },
|
|
162
|
+
transition: i.fade,
|
|
163
|
+
children: /* @__PURE__ */ l(s, {
|
|
164
|
+
icon: p,
|
|
165
|
+
size: "2xl",
|
|
166
|
+
className: "text-surface-fg-subtle"
|
|
167
|
+
})
|
|
168
|
+
}, "upload")
|
|
169
|
+
}),
|
|
170
|
+
/* @__PURE__ */ l("span", {
|
|
171
|
+
id: X + "-label",
|
|
172
|
+
className: "text-ds-sm text-surface-fg-muted",
|
|
173
|
+
children: J
|
|
174
|
+
}),
|
|
175
|
+
b ? /* @__PURE__ */ l("div", {
|
|
176
|
+
className: "w-full max-w-xs",
|
|
177
|
+
children: /* @__PURE__ */ l("div", {
|
|
178
|
+
role: "progressbar",
|
|
179
|
+
"aria-valuenow": x,
|
|
180
|
+
"aria-valuemin": 0,
|
|
181
|
+
"aria-valuemax": 100,
|
|
182
|
+
className: "h-2 w-full overflow-hidden rounded-ds-full bg-surface-raised-hover",
|
|
183
|
+
children: /* @__PURE__ */ l(e.div, {
|
|
184
|
+
className: "h-full rounded-ds-full bg-accent-9",
|
|
185
|
+
animate: { width: `${x}%` },
|
|
186
|
+
transition: r.smooth
|
|
187
|
+
})
|
|
188
|
+
})
|
|
189
|
+
}) : /* @__PURE__ */ l("span", {
|
|
190
|
+
className: "text-ds-xs text-surface-fg-subtle",
|
|
191
|
+
children: Y
|
|
192
|
+
})
|
|
193
|
+
]
|
|
194
|
+
}),
|
|
195
|
+
/* @__PURE__ */ l("input", {
|
|
196
|
+
ref: j,
|
|
197
|
+
id: X,
|
|
198
|
+
type: "file",
|
|
199
|
+
className: "sr-only",
|
|
200
|
+
style: { visibility: "hidden" },
|
|
201
|
+
"aria-hidden": "true",
|
|
202
|
+
"aria-label": J,
|
|
203
|
+
accept: _,
|
|
204
|
+
multiple: y,
|
|
205
|
+
disabled: T,
|
|
206
|
+
onChange: V,
|
|
207
|
+
onClick: H,
|
|
208
|
+
onFocus: U,
|
|
209
|
+
tabIndex: -1
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ l(t, { children: R && /* @__PURE__ */ l(e.p, {
|
|
212
|
+
role: "alert",
|
|
213
|
+
className: "mt-ds-02 text-ds-xs text-error-11",
|
|
214
|
+
initial: {
|
|
215
|
+
opacity: 0,
|
|
216
|
+
x: 0
|
|
217
|
+
},
|
|
218
|
+
animate: {
|
|
219
|
+
opacity: 1,
|
|
220
|
+
x: [
|
|
221
|
+
0,
|
|
222
|
+
-4,
|
|
223
|
+
4,
|
|
224
|
+
-4,
|
|
225
|
+
4,
|
|
226
|
+
0
|
|
227
|
+
]
|
|
228
|
+
},
|
|
229
|
+
exit: { opacity: 0 },
|
|
230
|
+
transition: {
|
|
231
|
+
opacity: i.fade,
|
|
232
|
+
x: {
|
|
233
|
+
type: "tween",
|
|
234
|
+
duration: n.slow01,
|
|
235
|
+
ease: "easeOut"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
children: R
|
|
239
|
+
}) })
|
|
240
|
+
]
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
_.displayName = "FileUpload";
|
|
244
|
+
//#endregion
|
|
245
|
+
export { _ as FileUpload };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload.js","names":[],"sources":["../../src/ui/file-upload.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { motion, AnimatePresence } from 'framer-motion'\nimport { IconUpload, IconPaperclip, IconCheck } from '@tabler/icons-react'\nimport { cn } from './lib/utils'\nimport { springs, tweens, durations } from './lib/motion'\nimport { Spinner } from './spinner'\nimport { Icon } from './icon'\n\n/**\n * Props for FileUpload — a drag-and-drop file picker with client-side validation (type + size),\n * an upload progress bar, and a compact inline mode.\n *\n * **Two modes:**\n * - Default: large drop zone with an upload icon, label, and sublabel — good for primary upload areas.\n * - `compact={true}`: a small inline button with an attachment icon — good for secondary/inline uploads.\n *\n * **Validation:** Pass `accept` (MIME or extension) and `maxSize` (bytes). Errors are shown inline.\n * The `onFiles` callback only fires with valid files — invalid files are rejected with an error message.\n *\n * **`onFiles` required:** This is the only required prop. Integrating with a real uploader means\n * calling your upload API from this callback and driving `uploading` + `progress` externally.\n *\n * @example\n * // Avatar upload with image-only restriction:\n * <FileUpload\n * accept=\"image/*\"\n * maxSize={2 * 1024 * 1024}\n * onFiles={(files) => uploadAvatar(files[0])}\n * label=\"Upload profile photo\"\n * sublabel=\"PNG, JPG up to 2MB\"\n * />\n *\n * @example\n * // Document multi-upload with progress:\n * <FileUpload\n * multiple\n * accept=\".pdf,.doc,.docx\"\n * uploading={isUploading}\n * progress={uploadPercent}\n * onFiles={handleFiles}\n * />\n *\n * @example\n * // Compact inline attachment button in a comment form:\n * <FileUpload compact onFiles={(files) => attachFiles(files)} label=\"Attach files\" />\n * // These are just a few ways — feel free to combine props creatively!\n */\nexport interface FileUploadProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onError'> {\n /** Accepted file types (e.g., \"image/*\", \".pdf,.doc\") */\n accept?: string\n /** Max file size in bytes (default: 10MB) */\n maxSize?: number\n /** Allow multiple files */\n multiple?: boolean\n /** Currently uploading */\n uploading?: boolean\n /** Upload progress (0-100) */\n progress?: number\n /** Callback when files are selected/dropped */\n onFiles: (files: File[]) => void\n /** Error message to display */\n error?: string\n /** Compact mode (inline button instead of drop zone) */\n compact?: boolean\n /** Disabled */\n disabled?: boolean\n /** Custom label */\n label?: string\n /** Custom sublabel */\n sublabel?: string\n}\n\nconst DEFAULT_MAX_SIZE = 10 * 1024 * 1024 // 10MB\n\nfunction fileMatchesAccept(file: File, accept: string): boolean {\n return accept\n .split(',')\n .map((t) => t.trim())\n .some((type) => {\n if (type.startsWith('.'))\n return file.name.toLowerCase().endsWith(type.toLowerCase())\n if (type.endsWith('/*'))\n return file.type.startsWith(type.slice(0, type.indexOf('/') + 1))\n return file.type === type\n })\n}\n\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`\n}\n\nconst FileUpload = React.forwardRef<HTMLDivElement, FileUploadProps>(\n (\n {\n accept,\n maxSize = DEFAULT_MAX_SIZE,\n multiple = false,\n uploading = false,\n progress = 0,\n onFiles,\n error,\n compact = false,\n disabled = false,\n className,\n label,\n sublabel,\n ...props\n },\n ref,\n ) => {\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [isDragActive, setIsDragActive] = React.useState(false)\n const [validationError, setValidationError] = React.useState<string | null>(\n null,\n )\n // Track whether a file dialog was opened, so we can detect when the\n // browser (or testing library) filters out all files via the accept attribute\n const dialogOpenRef = React.useRef(false)\n const filesAcceptedRef = React.useRef(false)\n\n const displayError = error || validationError\n\n const openPicker = React.useCallback(() => {\n if (disabled || uploading) return\n inputRef.current?.click()\n }, [disabled, uploading])\n\n const validateAndEmit = React.useCallback(\n (files: File[]) => {\n setValidationError(null)\n\n for (const file of files) {\n if (file.size > maxSize) {\n setValidationError(\n `File \"${file.name}\" exceeds the maximum size of ${formatBytes(maxSize)}`,\n )\n return\n }\n if (accept && !fileMatchesAccept(file, accept)) {\n setValidationError(\n `File \"${file.name}\" is not an accepted file type`,\n )\n return\n }\n }\n\n onFiles(files)\n },\n [maxSize, accept, onFiles],\n )\n\n const handleInputChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n filesAcceptedRef.current = true\n const fileList = e.target.files\n if (!fileList || fileList.length === 0) return\n validateAndEmit(Array.from(fileList))\n // Reset input value so the same file can be selected again\n e.target.value = ''\n },\n [validateAndEmit],\n )\n\n // When the file input is clicked, the browser opens a dialog and blurs the input.\n // We track this to detect when the dialog closes without selecting valid files.\n const handleInputClick = React.useCallback(() => {\n dialogOpenRef.current = true\n filesAcceptedRef.current = false\n }, [])\n\n // After the file dialog closes, the browser re-focuses the input.\n // If no files were accepted (e.g., the browser/test library filtered by accept),\n // and the accept prop is set, show a validation error.\n const handleInputFocus = React.useCallback(() => {\n if (dialogOpenRef.current && !filesAcceptedRef.current && accept) {\n setValidationError('File type is not accepted')\n }\n dialogOpenRef.current = false\n }, [accept])\n\n const handleDragEnter = React.useCallback(\n (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault()\n e.stopPropagation()\n if (!disabled && !uploading) {\n setIsDragActive(true)\n }\n },\n [disabled, uploading],\n )\n\n const handleDragOver = React.useCallback(\n (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault()\n e.stopPropagation()\n if (!disabled && !uploading) {\n setIsDragActive(true)\n }\n },\n [disabled, uploading],\n )\n\n const handleDragLeave = React.useCallback(\n (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault()\n e.stopPropagation()\n setIsDragActive(false)\n },\n [],\n )\n\n const handleDrop = React.useCallback(\n (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault()\n e.stopPropagation()\n setIsDragActive(false)\n\n if (disabled || uploading) return\n\n const fileList = e.dataTransfer.files\n if (!fileList || fileList.length === 0) return\n validateAndEmit(Array.from(fileList))\n },\n [disabled, uploading, validateAndEmit],\n )\n\n const defaultLabel = label ?? 'Drop files here or click to browse'\n const defaultSublabel = sublabel ?? `Max file size: ${formatBytes(maxSize)}`\n const inputId = React.useId()\n\n if (compact) {\n return (\n <div ref={ref} className={cn('inline-flex flex-col', className)} {...props}>\n <button\n type=\"button\"\n onClick={openPicker}\n disabled={disabled}\n className={cn(\n 'inline-flex items-center gap-ds-02 rounded-ds-md px-ds-03 py-ds-02',\n 'text-ds-sm font-medium',\n 'border border-surface-border-strong',\n 'bg-surface-raised-hover text-surface-fg-muted',\n 'hover:bg-accent-2',\n 'disabled:opacity-action-disabled disabled:cursor-not-allowed',\n 'transition-colors',\n )}\n >\n {uploading ? (\n <Spinner size=\"sm\" />\n ) : (\n <Icon icon={IconPaperclip} size=\"sm\" />\n )}\n {label ?? 'Attach files'}\n </button>\n <input\n ref={inputRef}\n id={inputId}\n type=\"file\"\n className=\"sr-only\"\n style={{ visibility: 'hidden' }}\n aria-hidden=\"true\"\n aria-label={label ?? 'Attach files'}\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n onChange={handleInputChange}\n onClick={handleInputClick}\n onFocus={handleInputFocus}\n tabIndex={-1}\n />\n {displayError && (\n <p\n role=\"alert\"\n aria-live=\"polite\"\n className=\"mt-ds-02 text-ds-xs text-error-11\"\n >\n {displayError}\n </p>\n )}\n </div>\n )\n }\n\n return (\n <div\n ref={ref}\n {...props}\n role=\"presentation\"\n className={cn('flex flex-col', className)}\n data-drag-active={isDragActive ? 'true' : undefined}\n onDragEnter={handleDragEnter}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n >\n <motion.div\n role=\"button\"\n tabIndex={0}\n aria-disabled={disabled || undefined}\n onClick={disabled ? undefined : openPicker}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {\n if (!disabled && (e.key === 'Enter' || e.key === ' ')) {\n e.preventDefault()\n openPicker()\n }\n }}\n className={cn(\n 'flex flex-col items-center justify-center gap-ds-03 rounded-ds-lg',\n 'border-2 border-dashed p-ds-08',\n 'cursor-pointer',\n 'border-surface-border-strong bg-surface-raised-hover',\n isDragActive &&\n 'border-accent-7 bg-accent-2',\n disabled && 'opacity-action-disabled cursor-not-allowed',\n )}\n animate={{\n scale: isDragActive ? 1.02 : 1,\n }}\n transition={springs.snappy}\n >\n {/* Icon — animates between upload ↔ spinner ↔ checkmark */}\n <AnimatePresence mode=\"wait\">\n {uploading ? (\n <motion.div\n key=\"spinner\"\n initial={{ opacity: 0, scale: 0.5 }}\n animate={{ opacity: 1, scale: 1 }}\n exit={{ opacity: 0, scale: 0.5 }}\n transition={tweens.fade}\n >\n <Spinner size=\"md\" />\n </motion.div>\n ) : progress === 100 && !error ? (\n <motion.div\n key=\"complete\"\n initial={{ opacity: 0, scale: 0.5 }}\n animate={{ opacity: 1, scale: 1 }}\n exit={{ opacity: 0, scale: 0.5 }}\n transition={springs.bouncy}\n >\n <Icon icon={IconCheck} size=\"2xl\" className=\"text-success-11\" />\n </motion.div>\n ) : (\n <motion.div\n key=\"upload\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={tweens.fade}\n >\n <Icon icon={IconUpload} size=\"2xl\" className=\"text-surface-fg-subtle\" />\n </motion.div>\n )}\n </AnimatePresence>\n <span id={inputId + '-label'} className=\"text-ds-sm text-surface-fg-muted\">\n {defaultLabel}\n </span>\n {uploading ? (\n <div className=\"w-full max-w-xs\">\n <div\n role=\"progressbar\"\n aria-valuenow={progress}\n aria-valuemin={0}\n aria-valuemax={100}\n className=\"h-2 w-full overflow-hidden rounded-ds-full bg-surface-raised-hover\"\n >\n <motion.div\n className=\"h-full rounded-ds-full bg-accent-9\"\n animate={{ width: `${progress}%` }}\n transition={springs.smooth}\n />\n </div>\n </div>\n ) : (\n <span className=\"text-ds-xs text-surface-fg-subtle\">\n {defaultSublabel}\n </span>\n )}\n </motion.div>\n <input\n ref={inputRef}\n id={inputId}\n type=\"file\"\n className=\"sr-only\"\n style={{ visibility: 'hidden' }}\n aria-hidden=\"true\"\n aria-label={defaultLabel}\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n onChange={handleInputChange}\n onClick={handleInputClick}\n onFocus={handleInputFocus}\n tabIndex={-1}\n />\n {/* Error message with shake animation */}\n <AnimatePresence>\n {displayError && (\n <motion.p\n role=\"alert\"\n className=\"mt-ds-02 text-ds-xs text-error-11\"\n initial={{ opacity: 0, x: 0 }}\n animate={{ opacity: 1, x: [0, -4, 4, -4, 4, 0] }}\n exit={{ opacity: 0 }}\n transition={{ opacity: tweens.fade, x: { type: 'tween', duration: durations.slow01, ease: 'easeOut' } }}\n >\n {displayError}\n </motion.p>\n )}\n </AnimatePresence>\n </div>\n )\n },\n)\nFileUpload.displayName = 'FileUpload'\n\nexport { FileUpload }\n"],"mappings":";;;;;;;;;;AA2EA,IAAM,IAAmB,KAAK,OAAO;AAErC,SAAS,EAAkB,GAAY,GAAyB;AAC9D,QAAO,EACJ,MAAM,IAAI,CACV,KAAK,MAAM,EAAE,MAAM,CAAC,CACpB,MAAM,MACD,EAAK,WAAW,IAAI,GACf,EAAK,KAAK,aAAa,CAAC,SAAS,EAAK,aAAa,CAAC,GACzD,EAAK,SAAS,KAAK,GACd,EAAK,KAAK,WAAW,EAAK,MAAM,GAAG,EAAK,QAAQ,IAAI,GAAG,EAAE,CAAC,GAC5D,EAAK,SAAS,EACrB;;AAGN,SAAS,EAAY,GAAuB;AAG1C,QAFI,IAAQ,OAAa,GAAG,EAAM,MAC9B,IAAQ,OAAO,OAAa,IAAI,IAAQ,MAAM,QAAQ,EAAE,CAAC,OACtD,IAAI,KAAS,OAAO,OAAO,QAAQ,EAAE,CAAC;;AAG/C,IAAM,IAAa,EAAM,YAErB,EACE,WACA,aAAU,GACV,cAAW,IACX,eAAY,IACZ,cAAW,GACX,YACA,UACA,aAAU,IACV,cAAW,IACX,cACA,UACA,aACA,GAAG,KAEL,MACG;CACH,IAAM,IAAW,EAAM,OAAyB,KAAK,EAC/C,CAAC,GAAc,KAAmB,EAAM,SAAS,GAAM,EACvD,CAAC,GAAiB,KAAsB,EAAM,SAClD,KACD,EAGK,IAAgB,EAAM,OAAO,GAAM,EACnC,IAAmB,EAAM,OAAO,GAAM,EAEtC,IAAe,KAAS,GAExB,IAAa,EAAM,kBAAkB;AACrC,OAAY,KAChB,EAAS,SAAS,OAAO;IACxB,CAAC,GAAU,EAAU,CAAC,EAEnB,IAAkB,EAAM,aAC3B,MAAkB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,GAEN,kBAAC,QAAD;MAAM,WAAU;gBACb;MACI,CAAA;KAEE;;GACb,kBAAC,SAAD;IACE,KAAK;IACL,IAAI;IACJ,MAAK;IACL,WAAU;IACV,OAAO,EAAE,YAAY,UAAU;IAC/B,eAAY;IACZ,cAAY;IACJ;IACE;IACA;IACV,UAAU;IACV,SAAS;IACT,SAAS;IACT,UAAU;IACV,CAAA;GAEF,kBAAC,GAAD,EAAA,UACG,KACC,kBAAC,EAAO,GAAR;IACE,MAAK;IACL,WAAU;IACV,SAAS;KAAE,SAAS;KAAG,GAAG;KAAG;IAC7B,SAAS;KAAE,SAAS;KAAG,GAAG;MAAC;MAAG;MAAI;MAAG;MAAI;MAAG;MAAE;KAAE;IAChD,MAAM,EAAE,SAAS,GAAG;IACpB,YAAY;KAAE,SAAS,EAAO;KAAM,GAAG;MAAE,MAAM;MAAS,UAAU,EAAU;MAAQ,MAAM;MAAW;KAAE;cAEtG;IACQ,CAAA,EAEG,CAAA;GACd;;EAGX;AACD,EAAW,cAAc"}
|
package/dist/ui/form.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export type FormHelperState = 'helper' | 'error' | 'warning' | 'success';
|
|
|
4
4
|
interface FormFieldContextValue {
|
|
5
5
|
state?: FormHelperState;
|
|
6
6
|
helperTextId?: string;
|
|
7
|
+
/** Auto-generated id shared between Label (htmlFor) and the field input (id). */
|
|
8
|
+
inputId?: string;
|
|
7
9
|
required?: boolean;
|
|
8
10
|
}
|
|
9
11
|
declare const FormFieldContext: React.Context<FormFieldContextValue>;
|
|
@@ -28,6 +30,12 @@ export interface FormFieldProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
28
30
|
* Pass this to `useFormField()` consumers that need to set `aria-describedby`.
|
|
29
31
|
*/
|
|
30
32
|
helperTextId?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Custom ID for the field input element. If omitted, an auto-generated ID is used.
|
|
35
|
+
* Label (when inside FormField) reads this via `htmlFor`; Input reads it via `id`.
|
|
36
|
+
* Explicit `htmlFor` / `id` props on children always win.
|
|
37
|
+
*/
|
|
38
|
+
inputId?: string;
|
|
31
39
|
/** Current validation state — propagated to child `FormHelperText` via context */
|
|
32
40
|
state?: FormHelperState;
|
|
33
41
|
/** Whether the field is required — available to children via `useFormField()` */
|
package/dist/ui/form.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/ui/form.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;AAExE,UAAU,qBAAqB;IAC7B,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AACD,QAAA,MAAM,gBAAgB,sCAAiD,CAAA;AAEvE;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC1E;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kFAAkF;IAClF,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,QAAA,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/ui/form.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;AAExE,UAAU,qBAAqB;IAC7B,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,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