@moldable-ai/ui 0.2.19 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalog/catalog-coverage.d.ts +15 -0
- package/dist/catalog/catalog-coverage.d.ts.map +1 -0
- package/dist/catalog/catalog-coverage.js +44 -0
- package/dist/catalog/catalog-manifest.d.ts +6 -0
- package/dist/catalog/catalog-manifest.d.ts.map +1 -0
- package/dist/catalog/catalog-manifest.js +117 -0
- package/dist/catalog/catalog-types.d.ts +64 -0
- package/dist/catalog/catalog-types.d.ts.map +1 -0
- package/dist/catalog/catalog-types.js +20 -0
- package/dist/catalog/component-catalog.d.ts +14 -0
- package/dist/catalog/component-catalog.d.ts.map +1 -0
- package/dist/catalog/component-catalog.js +49 -0
- package/dist/catalog/core-catalog-exclusions.d.ts +8 -0
- package/dist/catalog/core-catalog-exclusions.d.ts.map +1 -0
- package/dist/catalog/core-catalog-exclusions.js +151 -0
- package/dist/catalog/core-catalog.d.ts +2 -0
- package/dist/catalog/core-catalog.d.ts.map +1 -0
- package/dist/catalog/core-catalog.js +19 -0
- package/dist/catalog/core-collection-stories.d.ts +3 -0
- package/dist/catalog/core-collection-stories.d.ts.map +1 -0
- package/dist/catalog/core-collection-stories.js +42 -0
- package/dist/catalog/core-control-stories.d.ts +3 -0
- package/dist/catalog/core-control-stories.d.ts.map +1 -0
- package/dist/catalog/core-control-stories.js +94 -0
- package/dist/catalog/core-feedback-stories.d.ts +3 -0
- package/dist/catalog/core-feedback-stories.d.ts.map +1 -0
- package/dist/catalog/core-feedback-stories.js +50 -0
- package/dist/catalog/core-foundation-stories.d.ts +3 -0
- package/dist/catalog/core-foundation-stories.d.ts.map +1 -0
- package/dist/catalog/core-foundation-stories.js +53 -0
- package/dist/catalog/core-navigation-stories.d.ts +3 -0
- package/dist/catalog/core-navigation-stories.d.ts.map +1 -0
- package/dist/catalog/core-navigation-stories.js +25 -0
- package/dist/catalog/core-overlay-stories.d.ts +3 -0
- package/dist/catalog/core-overlay-stories.d.ts.map +1 -0
- package/dist/catalog/core-overlay-stories.js +20 -0
- package/dist/catalog/index.d.ts +7 -0
- package/dist/catalog/index.d.ts.map +1 -0
- package/dist/catalog/index.js +6 -0
- package/dist/components/app-error-boundary.d.ts +1 -0
- package/dist/components/app-error-boundary.d.ts.map +1 -1
- package/dist/components/app-error-boundary.js +13 -0
- package/dist/components/chat/chat-image-lightbox.d.ts +9 -0
- package/dist/components/chat/chat-image-lightbox.d.ts.map +1 -0
- package/dist/components/chat/chat-image-lightbox.js +9 -0
- package/dist/components/chat/chat-message.d.ts +19 -1
- package/dist/components/chat/chat-message.d.ts.map +1 -1
- package/dist/components/chat/chat-message.js +66 -16
- package/dist/components/chat/chat-messages.d.ts +5 -2
- package/dist/components/chat/chat-messages.d.ts.map +1 -1
- package/dist/components/chat/chat-messages.js +61 -6
- package/dist/components/chat/chat-panel.d.ts +49 -6
- package/dist/components/chat/chat-panel.d.ts.map +1 -1
- package/dist/components/chat/chat-panel.js +196 -163
- package/dist/components/chat/conversation-history.d.ts +39 -5
- package/dist/components/chat/conversation-history.d.ts.map +1 -1
- package/dist/components/chat/conversation-history.js +192 -26
- package/dist/components/chat/index.d.ts +2 -2
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +1 -1
- package/dist/components/chat/tool-handlers.d.ts.map +1 -1
- package/dist/components/chat/tool-handlers.js +40 -2
- package/dist/components/chat/vertical-scroll-fade.d.ts +6 -0
- package/dist/components/chat/vertical-scroll-fade.d.ts.map +1 -0
- package/dist/components/chat/vertical-scroll-fade.js +12 -0
- package/dist/components/native-capabilities/bluetooth-panel-helpers.d.ts +9 -0
- package/dist/components/native-capabilities/bluetooth-panel-helpers.d.ts.map +1 -0
- package/dist/components/native-capabilities/bluetooth-panel-helpers.js +37 -0
- package/dist/components/native-capabilities/bluetooth-panel.d.ts +56 -0
- package/dist/components/native-capabilities/bluetooth-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/bluetooth-panel.js +470 -0
- package/dist/components/native-capabilities/camera-preview.d.ts +39 -0
- package/dist/components/native-capabilities/camera-preview.d.ts.map +1 -0
- package/dist/components/native-capabilities/camera-preview.js +228 -0
- package/dist/components/native-capabilities/capability-badge.d.ts +23 -0
- package/dist/components/native-capabilities/capability-badge.d.ts.map +1 -0
- package/dist/components/native-capabilities/capability-badge.js +39 -0
- package/dist/components/native-capabilities/capability-matrix.d.ts +14 -0
- package/dist/components/native-capabilities/capability-matrix.d.ts.map +1 -0
- package/dist/components/native-capabilities/capability-matrix.js +97 -0
- package/dist/components/native-capabilities/clipboard-button.d.ts +26 -0
- package/dist/components/native-capabilities/clipboard-button.d.ts.map +1 -0
- package/dist/components/native-capabilities/clipboard-button.js +99 -0
- package/dist/components/native-capabilities/device-io-controls.d.ts +4 -0
- package/dist/components/native-capabilities/device-io-controls.d.ts.map +1 -0
- package/dist/components/native-capabilities/device-io-controls.js +28 -0
- package/dist/components/native-capabilities/device-list.d.ts +20 -0
- package/dist/components/native-capabilities/device-list.d.ts.map +1 -0
- package/dist/components/native-capabilities/device-list.js +14 -0
- package/dist/components/native-capabilities/display-map.d.ts +23 -0
- package/dist/components/native-capabilities/display-map.d.ts.map +1 -0
- package/dist/components/native-capabilities/display-map.js +114 -0
- package/dist/components/native-capabilities/haptic-button.d.ts +26 -0
- package/dist/components/native-capabilities/haptic-button.d.ts.map +1 -0
- package/dist/components/native-capabilities/haptic-button.js +94 -0
- package/dist/components/native-capabilities/hid-panel.d.ts +40 -0
- package/dist/components/native-capabilities/hid-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/hid-panel.js +373 -0
- package/dist/components/native-capabilities/index.d.ts +27 -0
- package/dist/components/native-capabilities/index.d.ts.map +1 -0
- package/dist/components/native-capabilities/index.js +26 -0
- package/dist/components/native-capabilities/live-indicator.d.ts +15 -0
- package/dist/components/native-capabilities/live-indicator.d.ts.map +1 -0
- package/dist/components/native-capabilities/live-indicator.js +26 -0
- package/dist/components/native-capabilities/local-auth-button.d.ts +33 -0
- package/dist/components/native-capabilities/local-auth-button.d.ts.map +1 -0
- package/dist/components/native-capabilities/local-auth-button.js +115 -0
- package/dist/components/native-capabilities/location-panel.d.ts +29 -0
- package/dist/components/native-capabilities/location-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/location-panel.js +146 -0
- package/dist/components/native-capabilities/microphone-meter.d.ts +35 -0
- package/dist/components/native-capabilities/microphone-meter.d.ts.map +1 -0
- package/dist/components/native-capabilities/microphone-meter.js +244 -0
- package/dist/components/native-capabilities/midi-monitor.d.ts +54 -0
- package/dist/components/native-capabilities/midi-monitor.d.ts.map +1 -0
- package/dist/components/native-capabilities/midi-monitor.js +534 -0
- package/dist/components/native-capabilities/native-capability-panel.d.ts +11 -0
- package/dist/components/native-capabilities/native-capability-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/native-capability-panel.js +28 -0
- package/dist/components/native-capabilities/notification-panel.d.ts +24 -0
- package/dist/components/native-capabilities/notification-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/notification-panel.js +124 -0
- package/dist/components/native-capabilities/power-blocker-controller.d.ts +19 -0
- package/dist/components/native-capabilities/power-blocker-controller.d.ts.map +1 -0
- package/dist/components/native-capabilities/power-blocker-controller.js +83 -0
- package/dist/components/native-capabilities/power-panel.d.ts +67 -0
- package/dist/components/native-capabilities/power-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/power-panel.js +309 -0
- package/dist/components/native-capabilities/readout.d.ts +10 -0
- package/dist/components/native-capabilities/readout.d.ts.map +1 -0
- package/dist/components/native-capabilities/readout.js +11 -0
- package/dist/components/native-capabilities/screen-share-preview.d.ts +36 -0
- package/dist/components/native-capabilities/screen-share-preview.d.ts.map +1 -0
- package/dist/components/native-capabilities/screen-share-preview.js +191 -0
- package/dist/components/native-capabilities/secure-storage-panel.d.ts +36 -0
- package/dist/components/native-capabilities/secure-storage-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/secure-storage-panel.js +193 -0
- package/dist/components/native-capabilities/serial-console.d.ts +64 -0
- package/dist/components/native-capabilities/serial-console.d.ts.map +1 -0
- package/dist/components/native-capabilities/serial-console.js +399 -0
- package/dist/components/native-capabilities/shortcut-recorder.d.ts +35 -0
- package/dist/components/native-capabilities/shortcut-recorder.d.ts.map +1 -0
- package/dist/components/native-capabilities/shortcut-recorder.js +217 -0
- package/dist/components/native-capabilities/stream-log.d.ts +35 -0
- package/dist/components/native-capabilities/stream-log.d.ts.map +1 -0
- package/dist/components/native-capabilities/stream-log.js +65 -0
- package/dist/components/native-capabilities/system-audio-monitor.d.ts +34 -0
- package/dist/components/native-capabilities/system-audio-monitor.d.ts.map +1 -0
- package/dist/components/native-capabilities/system-audio-monitor.js +275 -0
- package/dist/components/native-capabilities/usb-panel.d.ts +54 -0
- package/dist/components/native-capabilities/usb-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/usb-panel.js +363 -0
- package/dist/components/native-capabilities/use-capability.d.ts +20 -0
- package/dist/components/native-capabilities/use-capability.d.ts.map +1 -0
- package/dist/components/native-capabilities/use-capability.js +61 -0
- package/dist/components/ui/alert-dialog.d.ts +7 -3
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.js +9 -5
- package/dist/components/ui/alert.d.ts +19 -3
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/alert.js +25 -8
- package/dist/components/ui/app-frame.d.ts +28 -0
- package/dist/components/ui/app-frame.d.ts.map +1 -0
- package/dist/components/ui/app-frame.js +95 -0
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/collapsible.d.ts +9 -1
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/collapsible.js +13 -2
- package/dist/components/ui/collection-navigation.d.ts +8 -0
- package/dist/components/ui/collection-navigation.d.ts.map +1 -0
- package/dist/components/ui/collection-navigation.js +19 -0
- package/dist/components/ui/color-well.d.ts +13 -0
- package/dist/components/ui/color-well.d.ts.map +1 -0
- package/dist/components/ui/color-well.js +30 -0
- package/dist/components/ui/command.d.ts +5 -1
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/command.js +13 -1
- package/dist/components/ui/confirm-dialog.d.ts +19 -0
- package/dist/components/ui/confirm-dialog.d.ts.map +1 -0
- package/dist/components/ui/confirm-dialog.js +45 -0
- package/dist/components/ui/date-field.d.ts +19 -0
- package/dist/components/ui/date-field.d.ts.map +1 -0
- package/dist/components/ui/date-field.js +54 -0
- package/dist/components/ui/date-picker.d.ts +24 -0
- package/dist/components/ui/date-picker.d.ts.map +1 -0
- package/dist/components/ui/date-picker.js +92 -0
- package/dist/components/ui/dialog.d.ts +4 -2
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +8 -5
- package/dist/components/ui/edge-fade.d.ts +11 -0
- package/dist/components/ui/edge-fade.d.ts.map +1 -0
- package/dist/components/ui/edge-fade.js +41 -0
- package/dist/components/ui/empty.d.ts +7 -2
- package/dist/components/ui/empty.d.ts.map +1 -1
- package/dist/components/ui/empty.js +20 -7
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/grid.d.ts +24 -0
- package/dist/components/ui/grid.d.ts.map +1 -0
- package/dist/components/ui/grid.js +258 -0
- package/dist/components/ui/icon-button.d.ts +15 -0
- package/dist/components/ui/icon-button.d.ts.map +1 -0
- package/dist/components/ui/icon-button.js +15 -0
- package/dist/components/ui/index.d.ts +23 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +23 -0
- package/dist/components/ui/input-group.d.ts +1 -1
- package/dist/components/ui/inspector.d.ts +15 -0
- package/dist/components/ui/inspector.d.ts.map +1 -0
- package/dist/components/ui/inspector.js +26 -0
- package/dist/components/ui/kbd.d.ts +1 -1
- package/dist/components/ui/list.d.ts +28 -0
- package/dist/components/ui/list.d.ts.map +1 -0
- package/dist/components/ui/list.js +235 -0
- package/dist/components/ui/material.d.ts +34 -0
- package/dist/components/ui/material.d.ts.map +1 -0
- package/dist/components/ui/material.js +34 -0
- package/dist/components/ui/message-scroller-controller.d.ts +162 -0
- package/dist/components/ui/message-scroller-controller.d.ts.map +1 -0
- package/dist/components/ui/message-scroller-controller.js +888 -0
- package/dist/components/ui/message-scroller-layout-stability.d.ts +33 -0
- package/dist/components/ui/message-scroller-layout-stability.d.ts.map +1 -0
- package/dist/components/ui/message-scroller-layout-stability.js +153 -0
- package/dist/components/ui/message-scroller-policy.d.ts +74 -0
- package/dist/components/ui/message-scroller-policy.d.ts.map +1 -0
- package/dist/components/ui/message-scroller-policy.js +129 -0
- package/dist/components/ui/message-scroller-primitive.d.ts +55 -0
- package/dist/components/ui/message-scroller-primitive.d.ts.map +1 -0
- package/dist/components/ui/message-scroller-primitive.js +226 -0
- package/dist/components/ui/message-scroller.d.ts +11 -0
- package/dist/components/ui/message-scroller.d.ts.map +1 -0
- package/dist/components/ui/message-scroller.js +25 -0
- package/dist/components/ui/navigation-button-group.d.ts +16 -0
- package/dist/components/ui/navigation-button-group.d.ts.map +1 -0
- package/dist/components/ui/navigation-button-group.js +9 -0
- package/dist/components/ui/notification-dot.d.ts +4 -0
- package/dist/components/ui/notification-dot.d.ts.map +1 -0
- package/dist/components/ui/notification-dot.js +7 -0
- package/dist/components/ui/number-input.d.ts +16 -0
- package/dist/components/ui/number-input.d.ts.map +1 -0
- package/dist/components/ui/number-input.js +56 -0
- package/dist/components/ui/panel.d.ts +18 -0
- package/dist/components/ui/panel.d.ts.map +1 -0
- package/dist/components/ui/panel.js +40 -0
- package/dist/components/ui/popover.d.ts +9 -2
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +14 -4
- package/dist/components/ui/scroll-area.d.ts +8 -2
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.js +6 -3
- package/dist/components/ui/search-field.d.ts +19 -0
- package/dist/components/ui/search-field.d.ts.map +1 -0
- package/dist/components/ui/search-field.js +64 -0
- package/dist/components/ui/segmented-control.d.ts +21 -0
- package/dist/components/ui/segmented-control.d.ts.map +1 -0
- package/dist/components/ui/segmented-control.js +62 -0
- package/dist/components/ui/sheet.d.ts +4 -2
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet.js +12 -9
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/sonner.d.ts +4 -3
- package/dist/components/ui/sonner.d.ts.map +1 -1
- package/dist/components/ui/sonner.js +7 -6
- package/dist/components/ui/split-view.d.ts +11 -0
- package/dist/components/ui/split-view.d.ts.map +1 -0
- package/dist/components/ui/split-view.js +13 -0
- package/dist/components/ui/status.d.ts +13 -0
- package/dist/components/ui/status.d.ts.map +1 -0
- package/dist/components/ui/status.js +36 -0
- package/dist/components/ui/table.d.ts +11 -2
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/table.js +33 -6
- package/dist/components/ui/text.d.ts +17 -0
- package/dist/components/ui/text.d.ts.map +1 -0
- package/dist/components/ui/text.js +55 -0
- package/dist/components/ui/toggle.d.ts +12 -4
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/toggle.js +13 -2
- package/dist/components/ui/toolbar.d.ts +27 -0
- package/dist/components/ui/toolbar.d.ts.map +1 -0
- package/dist/components/ui/toolbar.js +71 -0
- package/dist/components/ui/tooltip.d.ts +8 -3
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +11 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/lib/frame-lifecycle.d.ts +29 -0
- package/dist/lib/frame-lifecycle.d.ts.map +1 -1
- package/dist/lib/frame-lifecycle.js +85 -0
- package/dist/lib/native-capabilities/access.d.ts +13 -0
- package/dist/lib/native-capabilities/access.d.ts.map +1 -0
- package/dist/lib/native-capabilities/access.js +53 -0
- package/dist/lib/native-capabilities/bluetooth-access.d.ts +14 -0
- package/dist/lib/native-capabilities/bluetooth-access.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bluetooth-access.js +43 -0
- package/dist/lib/native-capabilities/bluetooth-connection.d.ts +19 -0
- package/dist/lib/native-capabilities/bluetooth-connection.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bluetooth-connection.js +88 -0
- package/dist/lib/native-capabilities/bluetooth-gatt.d.ts +7 -0
- package/dist/lib/native-capabilities/bluetooth-gatt.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bluetooth-gatt.js +77 -0
- package/dist/lib/native-capabilities/bluetooth-internal.d.ts +10 -0
- package/dist/lib/native-capabilities/bluetooth-internal.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bluetooth-internal.js +105 -0
- package/dist/lib/native-capabilities/bluetooth-native-fallback.d.ts +33 -0
- package/dist/lib/native-capabilities/bluetooth-native-fallback.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bluetooth-native-fallback.js +214 -0
- package/dist/lib/native-capabilities/bluetooth-types.d.ts +85 -0
- package/dist/lib/native-capabilities/bluetooth-types.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bluetooth-types.js +2 -0
- package/dist/lib/native-capabilities/bluetooth.d.ts +7 -0
- package/dist/lib/native-capabilities/bluetooth.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bluetooth.js +4 -0
- package/dist/lib/native-capabilities/bridge.d.ts +23 -0
- package/dist/lib/native-capabilities/bridge.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bridge.js +266 -0
- package/dist/lib/native-capabilities/capabilities.d.ts +7 -0
- package/dist/lib/native-capabilities/capabilities.d.ts.map +1 -0
- package/dist/lib/native-capabilities/capabilities.js +95 -0
- package/dist/lib/native-capabilities/clipboard.d.ts +11 -0
- package/dist/lib/native-capabilities/clipboard.d.ts.map +1 -0
- package/dist/lib/native-capabilities/clipboard.js +58 -0
- package/dist/lib/native-capabilities/device-io-errors.d.ts +11 -0
- package/dist/lib/native-capabilities/device-io-errors.d.ts.map +1 -0
- package/dist/lib/native-capabilities/device-io-errors.js +82 -0
- package/dist/lib/native-capabilities/displays.d.ts +38 -0
- package/dist/lib/native-capabilities/displays.d.ts.map +1 -0
- package/dist/lib/native-capabilities/displays.js +12 -0
- package/dist/lib/native-capabilities/global-shortcuts.d.ts +86 -0
- package/dist/lib/native-capabilities/global-shortcuts.d.ts.map +1 -0
- package/dist/lib/native-capabilities/global-shortcuts.js +351 -0
- package/dist/lib/native-capabilities/haptics.d.ts +25 -0
- package/dist/lib/native-capabilities/haptics.d.ts.map +1 -0
- package/dist/lib/native-capabilities/haptics.js +18 -0
- package/dist/lib/native-capabilities/hid-native.d.ts +26 -0
- package/dist/lib/native-capabilities/hid-native.d.ts.map +1 -0
- package/dist/lib/native-capabilities/hid-native.js +229 -0
- package/dist/lib/native-capabilities/hid.d.ts +52 -0
- package/dist/lib/native-capabilities/hid.d.ts.map +1 -0
- package/dist/lib/native-capabilities/hid.js +163 -0
- package/dist/lib/native-capabilities/index.d.ts +40 -0
- package/dist/lib/native-capabilities/index.d.ts.map +1 -0
- package/dist/lib/native-capabilities/index.js +21 -0
- package/dist/lib/native-capabilities/local-authentication.d.ts +32 -0
- package/dist/lib/native-capabilities/local-authentication.d.ts.map +1 -0
- package/dist/lib/native-capabilities/local-authentication.js +46 -0
- package/dist/lib/native-capabilities/location.d.ts +49 -0
- package/dist/lib/native-capabilities/location.d.ts.map +1 -0
- package/dist/lib/native-capabilities/location.js +114 -0
- package/dist/lib/native-capabilities/media-permissions.d.ts +28 -0
- package/dist/lib/native-capabilities/media-permissions.d.ts.map +1 -0
- package/dist/lib/native-capabilities/media-permissions.js +37 -0
- package/dist/lib/native-capabilities/media.d.ts +17 -0
- package/dist/lib/native-capabilities/media.d.ts.map +1 -0
- package/dist/lib/native-capabilities/media.js +104 -0
- package/dist/lib/native-capabilities/midi-access.d.ts +13 -0
- package/dist/lib/native-capabilities/midi-access.d.ts.map +1 -0
- package/dist/lib/native-capabilities/midi-access.js +68 -0
- package/dist/lib/native-capabilities/midi-internal.d.ts +12 -0
- package/dist/lib/native-capabilities/midi-internal.d.ts.map +1 -0
- package/dist/lib/native-capabilities/midi-internal.js +88 -0
- package/dist/lib/native-capabilities/midi-native-fallback.d.ts +27 -0
- package/dist/lib/native-capabilities/midi-native-fallback.d.ts.map +1 -0
- package/dist/lib/native-capabilities/midi-native-fallback.js +127 -0
- package/dist/lib/native-capabilities/midi-ports.d.ts +6 -0
- package/dist/lib/native-capabilities/midi-ports.d.ts.map +1 -0
- package/dist/lib/native-capabilities/midi-ports.js +115 -0
- package/dist/lib/native-capabilities/midi-types.d.ts +25 -0
- package/dist/lib/native-capabilities/midi-types.d.ts.map +1 -0
- package/dist/lib/native-capabilities/midi-types.js +1 -0
- package/dist/lib/native-capabilities/midi.d.ts +6 -0
- package/dist/lib/native-capabilities/midi.d.ts.map +1 -0
- package/dist/lib/native-capabilities/midi.js +3 -0
- package/dist/lib/native-capabilities/native-device-io.d.ts +28 -0
- package/dist/lib/native-capabilities/native-device-io.d.ts.map +1 -0
- package/dist/lib/native-capabilities/native-device-io.js +91 -0
- package/dist/lib/native-capabilities/native-device-lifecycle.d.ts +13 -0
- package/dist/lib/native-capabilities/native-device-lifecycle.d.ts.map +1 -0
- package/dist/lib/native-capabilities/native-device-lifecycle.js +40 -0
- package/dist/lib/native-capabilities/notifications.d.ts +38 -0
- package/dist/lib/native-capabilities/notifications.d.ts.map +1 -0
- package/dist/lib/native-capabilities/notifications.js +50 -0
- package/dist/lib/native-capabilities/power-session.d.ts +113 -0
- package/dist/lib/native-capabilities/power-session.d.ts.map +1 -0
- package/dist/lib/native-capabilities/power-session.js +264 -0
- package/dist/lib/native-capabilities/secure-storage.d.ts +36 -0
- package/dist/lib/native-capabilities/secure-storage.d.ts.map +1 -0
- package/dist/lib/native-capabilities/secure-storage.js +64 -0
- package/dist/lib/native-capabilities/serial-native.d.ts +23 -0
- package/dist/lib/native-capabilities/serial-native.d.ts.map +1 -0
- package/dist/lib/native-capabilities/serial-native.js +181 -0
- package/dist/lib/native-capabilities/serial.d.ts +76 -0
- package/dist/lib/native-capabilities/serial.d.ts.map +1 -0
- package/dist/lib/native-capabilities/serial.js +215 -0
- package/dist/lib/native-capabilities/system-audio.d.ts +127 -0
- package/dist/lib/native-capabilities/system-audio.d.ts.map +1 -0
- package/dist/lib/native-capabilities/system-audio.js +330 -0
- package/dist/lib/native-capabilities/types.d.ts +62 -0
- package/dist/lib/native-capabilities/types.d.ts.map +1 -0
- package/dist/lib/native-capabilities/types.js +27 -0
- package/dist/lib/native-capabilities/usb-native.d.ts +39 -0
- package/dist/lib/native-capabilities/usb-native.d.ts.map +1 -0
- package/dist/lib/native-capabilities/usb-native.js +217 -0
- package/dist/lib/native-capabilities/usb.d.ts +85 -0
- package/dist/lib/native-capabilities/usb.d.ts.map +1 -0
- package/dist/lib/native-capabilities/usb.js +225 -0
- package/dist/lib/theme.d.ts.map +1 -1
- package/dist/lib/theme.js +2 -1
- package/docs/README.md +39 -0
- package/docs/accessibility.md +32 -0
- package/docs/adaptive-materials.md +79 -0
- package/docs/app-anatomy.md +74 -0
- package/docs/component-catalog.md +82 -0
- package/docs/component-guide-template.md +37 -0
- package/docs/design-tokens.md +185 -0
- package/docs/foundations.md +58 -0
- package/docs/native-integration.md +33 -0
- package/docs/standalone-app-windows.md +136 -0
- package/package.json +8 -3
- package/src/components/ui/alert-dialog.md +31 -0
- package/src/components/ui/alert.md +77 -0
- package/src/components/ui/app-frame.md +38 -0
- package/src/components/ui/badge.md +57 -0
- package/src/components/ui/button.md +76 -0
- package/src/components/ui/collapsible.md +52 -0
- package/src/components/ui/color-well.md +11 -0
- package/src/components/ui/combobox.md +42 -0
- package/src/components/ui/command.md +54 -0
- package/src/components/ui/date-field.md +32 -0
- package/src/components/ui/date-picker.md +55 -0
- package/src/components/ui/dialog.md +40 -0
- package/src/components/ui/edge-fade.md +7 -0
- package/src/components/ui/empty.md +87 -0
- package/src/components/ui/field.md +77 -0
- package/src/components/ui/grid.md +109 -0
- package/src/components/ui/icon-button.md +36 -0
- package/src/components/ui/inspector.md +11 -0
- package/src/components/ui/item.md +87 -0
- package/src/components/ui/list.md +140 -0
- package/src/components/ui/material.md +51 -0
- package/src/components/ui/navigation-button-group.md +46 -0
- package/src/components/ui/notification-dot.md +7 -0
- package/src/components/ui/number-input.md +19 -0
- package/src/components/ui/panel.md +11 -0
- package/src/components/ui/popover.md +31 -0
- package/src/components/ui/resizable.md +66 -0
- package/src/components/ui/scroll-area.md +72 -0
- package/src/components/ui/search-field.md +33 -0
- package/src/components/ui/segmented-control.md +36 -0
- package/src/components/ui/sheet.md +30 -0
- package/src/components/ui/sidebar.md +113 -0
- package/src/components/ui/sonner.md +37 -0
- package/src/components/ui/split-view.md +15 -0
- package/src/components/ui/status.md +12 -0
- package/src/components/ui/table.md +37 -0
- package/src/components/ui/tabs.md +66 -0
- package/src/components/ui/text.md +17 -0
- package/src/components/ui/toggle-button.md +48 -0
- package/src/components/ui/toggle-group.md +80 -0
- package/src/components/ui/toggle.md +73 -0
- package/src/components/ui/toolbar.md +26 -0
- package/src/components/ui/tooltip.md +31 -0
- package/src/styles/index.css +704 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MaterialVariant } from './material';
|
|
3
|
+
export type AppFrameMode = 'auto' | 'embedded' | 'window';
|
|
4
|
+
declare function resolveAppFrameMode(mode: AppFrameMode): Exclude<AppFrameMode, 'auto'>;
|
|
5
|
+
export interface AppFrameProps extends React.ComponentProps<'div'> {
|
|
6
|
+
/**
|
|
7
|
+
* `auto` detects whether the app is hosted in a frame. Set an explicit mode
|
|
8
|
+
* in catalogs, previews, and tests where the runtime environment is ambiguous.
|
|
9
|
+
*/
|
|
10
|
+
mode?: AppFrameMode;
|
|
11
|
+
}
|
|
12
|
+
declare function AppFrame({ mode, className, style, ...props }: AppFrameProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export interface AppFrameTitlebarProps extends React.ComponentPropsWithoutRef<'header'> {
|
|
14
|
+
material?: MaterialVariant | 'none';
|
|
15
|
+
}
|
|
16
|
+
declare function AppFrameTitlebar({ className, material, onDoubleClick, onPointerDown, style, ...props }: AppFrameTitlebarProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare function AppFrameToolbar({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export interface AppFrameContentProps extends React.ComponentPropsWithoutRef<'main'> {
|
|
19
|
+
scrollable?: boolean;
|
|
20
|
+
chatSafe?: boolean;
|
|
21
|
+
}
|
|
22
|
+
declare function AppFrameContent({ scrollable, chatSafe, className, style, ...props }: AppFrameContentProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export interface AppFrameStatusbarProps extends React.ComponentPropsWithoutRef<'footer'> {
|
|
24
|
+
material?: MaterialVariant | 'none';
|
|
25
|
+
}
|
|
26
|
+
declare function AppFrameStatusbar({ className, material, style, ...props }: AppFrameStatusbarProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export { AppFrame, AppFrameContent, AppFrameStatusbar, AppFrameTitlebar, AppFrameToolbar, resolveAppFrameMode, };
|
|
28
|
+
//# sourceMappingURL=app-frame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-frame.d.ts","sourceRoot":"","sources":["../../../src/components/ui/app-frame.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAA;AAEzD,iBAAS,mBAAmB,CAC1B,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAM/B;AAED,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAChE;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,CAAA;CACpB;AAED,iBAAS,QAAQ,CAAC,EAChB,IAAa,EACb,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,aAAa,2CA+Bf;AAED,MAAM,WAAW,qBACf,SAAQ,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC;IAChD,QAAQ,CAAC,EAAE,eAAe,GAAG,MAAM,CAAA;CACpC;AAiCD,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,QAAoB,EACpB,aAAa,EACb,aAAa,EACb,KAAK,EACL,GAAG,KAAK,EACT,EAAE,qBAAqB,2CA4CvB;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,2CAWvC;AAED,MAAM,WAAW,oBACf,SAAQ,KAAK,CAAC,wBAAwB,CAAC,MAAM,CAAC;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,iBAAS,eAAe,CAAC,EACvB,UAAiB,EACjB,QAAe,EACf,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,oBAAoB,2CAoBtB;AAED,MAAM,WAAW,sBACf,SAAQ,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC;IAChD,QAAQ,CAAC,EAAE,eAAe,GAAG,MAAM,CAAA;CACpC;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,QAAoB,EACpB,KAAK,EACL,GAAG,KAAK,EACT,EAAE,sBAAsB,2CAmBxB;AAED,OAAO,EACL,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,GACpB,CAAA"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
function resolveAppFrameMode(mode) {
|
|
6
|
+
if (mode !== 'auto')
|
|
7
|
+
return mode;
|
|
8
|
+
if (typeof window === 'undefined')
|
|
9
|
+
return 'window';
|
|
10
|
+
const hostMode = document.documentElement.dataset.moldableDisplayMode;
|
|
11
|
+
if (hostMode === 'embedded' || hostMode === 'window')
|
|
12
|
+
return hostMode;
|
|
13
|
+
return window.parent === window ? 'window' : 'embedded';
|
|
14
|
+
}
|
|
15
|
+
function AppFrame({ mode = 'auto', className, style, ...props }) {
|
|
16
|
+
const [resolvedMode, setResolvedMode] = React.useState(() => resolveAppFrameMode(mode));
|
|
17
|
+
React.useEffect(() => {
|
|
18
|
+
setResolvedMode(resolveAppFrameMode(mode));
|
|
19
|
+
if (mode !== 'auto')
|
|
20
|
+
return;
|
|
21
|
+
const updateMode = () => setResolvedMode(resolveAppFrameMode('auto'));
|
|
22
|
+
window.addEventListener('moldable:host-context-change', updateMode);
|
|
23
|
+
return () => window.removeEventListener('moldable:host-context-change', updateMode);
|
|
24
|
+
}, [mode]);
|
|
25
|
+
return (_jsx("div", { "data-slot": "app-frame", "data-mode": resolvedMode, className: cn('text-foreground flex h-dvh min-h-0 min-w-0 flex-col overflow-hidden bg-[var(--surface-canvas,var(--background))]', className), style: {
|
|
26
|
+
paddingInlineStart: 'var(--window-safe-area-inline-start, 0px)',
|
|
27
|
+
paddingInlineEnd: 'var(--window-safe-area-inline-end, 0px)',
|
|
28
|
+
...style,
|
|
29
|
+
}, ...props }));
|
|
30
|
+
}
|
|
31
|
+
const WINDOW_TITLEBAR_INTERACTIVE_SELECTOR = [
|
|
32
|
+
'a',
|
|
33
|
+
'button',
|
|
34
|
+
'input',
|
|
35
|
+
'select',
|
|
36
|
+
'textarea',
|
|
37
|
+
'[contenteditable]:not([contenteditable="false"])',
|
|
38
|
+
'[role="button"]',
|
|
39
|
+
'[role="link"]',
|
|
40
|
+
'[data-moldable-no-window-drag]',
|
|
41
|
+
].join(',');
|
|
42
|
+
function isAppOwnedWindowTitlebar() {
|
|
43
|
+
return (document.documentElement.dataset.moldableDisplayMode === 'window' &&
|
|
44
|
+
document.documentElement.dataset.moldableWindowTitlebar === 'app');
|
|
45
|
+
}
|
|
46
|
+
function isInteractiveTitlebarTarget(target) {
|
|
47
|
+
return (target instanceof Element &&
|
|
48
|
+
target.closest(WINDOW_TITLEBAR_INTERACTIVE_SELECTOR) !== null);
|
|
49
|
+
}
|
|
50
|
+
function postWindowTitlebarMessage(type) {
|
|
51
|
+
if (!isAppOwnedWindowTitlebar())
|
|
52
|
+
return;
|
|
53
|
+
window.parent.postMessage({ type }, '*');
|
|
54
|
+
}
|
|
55
|
+
function AppFrameTitlebar({ className, material = 'regular', onDoubleClick, onPointerDown, style, ...props }) {
|
|
56
|
+
return (_jsx("header", { "data-slot": "app-frame-titlebar", "data-material": material === 'none' ? undefined : material, "data-material-elevation": material === 'none' ? undefined : 'none', className: cn('border-border/70 flex shrink-0 items-center gap-2 border-b', material !== 'none' && 'moldable-material', className), style: {
|
|
57
|
+
minHeight: 'max(var(--density-toolbar-height, 2.5rem), var(--window-titlebar-height, 0px))',
|
|
58
|
+
paddingInlineStart: 'max(var(--density-pane-padding, 0.75rem), var(--window-control-inset-inline-start, 0px))',
|
|
59
|
+
paddingInlineEnd: 'max(var(--density-pane-padding, 0.75rem), var(--window-control-inset-inline-end, 0px))',
|
|
60
|
+
...style,
|
|
61
|
+
}, onPointerDown: (event) => {
|
|
62
|
+
onPointerDown?.(event);
|
|
63
|
+
if (event.defaultPrevented ||
|
|
64
|
+
event.button !== 0 ||
|
|
65
|
+
isInteractiveTitlebarTarget(event.target)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
postWindowTitlebarMessage('startWindowDrag');
|
|
69
|
+
}, onDoubleClick: (event) => {
|
|
70
|
+
onDoubleClick?.(event);
|
|
71
|
+
if (event.defaultPrevented ||
|
|
72
|
+
isInteractiveTitlebarTarget(event.target)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
postWindowTitlebarMessage('titlebarDoubleClick');
|
|
76
|
+
}, ...props }));
|
|
77
|
+
}
|
|
78
|
+
function AppFrameToolbar({ className, ...props }) {
|
|
79
|
+
return (_jsx("div", { "data-slot": "app-frame-toolbar", className: cn('flex min-h-9 min-w-0 flex-1 items-center gap-2 px-3 py-1.5', className), ...props }));
|
|
80
|
+
}
|
|
81
|
+
function AppFrameContent({ scrollable = true, chatSafe = true, className, style, ...props }) {
|
|
82
|
+
return (_jsx("main", { "data-slot": "app-frame-content", "data-scrollable": scrollable, "data-chat-safe": chatSafe, className: cn('min-h-0 min-w-0 flex-1', scrollable ? 'overflow-auto' : 'overflow-hidden', className), style: {
|
|
83
|
+
paddingBlockEnd: chatSafe
|
|
84
|
+
? 'calc(var(--window-content-inset-bottom, 0px) + var(--chat-safe-padding, 0px))'
|
|
85
|
+
: 'var(--window-content-inset-bottom, 0px)',
|
|
86
|
+
...style,
|
|
87
|
+
}, ...props }));
|
|
88
|
+
}
|
|
89
|
+
function AppFrameStatusbar({ className, material = 'regular', style, ...props }) {
|
|
90
|
+
return (_jsx("footer", { "data-slot": "app-frame-statusbar", "data-material": material === 'none' ? undefined : material, "data-material-elevation": material === 'none' ? undefined : 'none', className: cn('border-border/70 text-muted-foreground flex min-h-7 shrink-0 items-center gap-2 border-t px-3 py-1 text-xs', material !== 'none' && 'moldable-material', className), style: {
|
|
91
|
+
paddingBlockEnd: 'calc(var(--window-content-inset-bottom, 0px) + 0.25rem)',
|
|
92
|
+
...style,
|
|
93
|
+
}, ...props }));
|
|
94
|
+
}
|
|
95
|
+
export { AppFrame, AppFrameContent, AppFrameStatusbar, AppFrameTitlebar, AppFrameToolbar, resolveAppFrameMode, };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Separator } from './separator';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const buttonGroupVariants: (props?: ({
|
|
4
|
-
orientation?: "
|
|
4
|
+
orientation?: "vertical" | "horizontal" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
6
|
declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<'div'> & VariantProps<typeof buttonGroupVariants>): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
declare function ButtonGroupText({ className, asChild, ...props }: React.ComponentProps<'div'> & {
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Slot } from '@radix-ui/react-slot';
|
|
3
3
|
import { cn } from '../../lib/utils';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
|
-
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
5
|
+
const buttonVariants = cva("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
6
6
|
variants: {
|
|
7
7
|
variant: {
|
|
8
8
|
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
declare function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
declare function CollapsibleTrigger({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>): import("react/jsx-runtime").JSX.Element;
|
|
4
5
|
declare function CollapsibleContent({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
|
|
6
|
+
declare function CollapsibleSection({ className, ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function CollapsibleSectionTrigger({ className, children, ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
interface CollapsibleSectionContentProps extends React.ComponentProps<typeof CollapsiblePrimitive.Content> {
|
|
9
|
+
motion?: 'default' | 'none';
|
|
10
|
+
contentClassName?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function CollapsibleSectionContent({ className, contentClassName, children, motion, ...props }: CollapsibleSectionContentProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export { Collapsible, CollapsibleContent, CollapsibleSection, CollapsibleSectionContent, CollapsibleSectionTrigger, CollapsibleTrigger, type CollapsibleSectionContentProps, };
|
|
6
14
|
//# sourceMappingURL=collapsible.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../../src/components/ui/collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAA;AAEnE,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,2CAExD;AAED,iBAAS,kBAAkB,CAAC,EAC1B,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,2CAOtE;AAED,iBAAS,kBAAkB,CAAC,EAC1B,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,2CAOtE;AAED,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../../src/components/ui/collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAA;AAEnE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,2CAExD;AAED,iBAAS,kBAAkB,CAAC,EAC1B,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,2CAOtE;AAED,iBAAS,kBAAkB,CAAC,EAC1B,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,2CAOtE;AAED,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,2CAWxD;AAED,iBAAS,yBAAyB,CAAC,EACjC,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,OAAO,CAAC,2CAiB3D;AAED,UAAU,8BACR,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,OAAO,CAAC;IACjE,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,iBAAS,yBAAyB,CAAC,EACjC,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,MAAkB,EAClB,GAAG,KAAK,EACT,EAAE,8BAA8B,2CAsBhC;AAED,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,EAClB,KAAK,8BAA8B,GACpC,CAAA"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
4
|
+
import { ChevronRightIcon } from 'lucide-react';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
4
6
|
function Collapsible({ ...props }) {
|
|
5
7
|
return _jsx(CollapsiblePrimitive.Root, { "data-slot": "collapsible", ...props });
|
|
6
8
|
}
|
|
@@ -10,4 +12,13 @@ function CollapsibleTrigger({ ...props }) {
|
|
|
10
12
|
function CollapsibleContent({ ...props }) {
|
|
11
13
|
return (_jsx(CollapsiblePrimitive.CollapsibleContent, { "data-slot": "collapsible-content", ...props }));
|
|
12
14
|
}
|
|
13
|
-
|
|
15
|
+
function CollapsibleSection({ className, ...props }) {
|
|
16
|
+
return (_jsx(CollapsiblePrimitive.Root, { "data-slot": "collapsible-section", className: cn('border-border/60 rounded-container overflow-hidden border', className), ...props }));
|
|
17
|
+
}
|
|
18
|
+
function CollapsibleSectionTrigger({ className, children, ...props }) {
|
|
19
|
+
return (_jsxs(CollapsiblePrimitive.Trigger, { "data-slot": "collapsible-section-trigger", className: cn('hover:bg-control-hover focus-visible:ring-ring/50 flex min-h-8 w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm font-medium outline-none transition-[background-color,color] focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&[data-state=open]>svg]:rotate-90', className), ...props, children: [_jsx(ChevronRightIcon, { "aria-hidden": "true", className: "text-muted-foreground duration-(--motion-duration-normal) ease-(--motion-ease-standard) size-3.5 shrink-0 transition-transform" }), _jsx("span", { className: "min-w-0 flex-1", children: children })] }));
|
|
20
|
+
}
|
|
21
|
+
function CollapsibleSectionContent({ className, contentClassName, children, motion = 'default', ...props }) {
|
|
22
|
+
return (_jsx(CollapsiblePrimitive.Content, { "data-slot": "collapsible-section-content", "data-motion": motion, className: cn('data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-top-1 data-[state=open]:slide-in-from-top-1 overflow-hidden text-sm data-[motion=none]:animate-none', className), ...props, children: _jsx("div", { "data-slot": "collapsible-section-content-inner", className: cn('border-border/60 border-t px-3 py-2.5', contentClassName), children: children }) }));
|
|
23
|
+
}
|
|
24
|
+
export { Collapsible, CollapsibleContent, CollapsibleSection, CollapsibleSectionContent, CollapsibleSectionTrigger, CollapsibleTrigger, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type CollectionItem<Node extends HTMLElement = HTMLElement> = {
|
|
2
|
+
node: Node;
|
|
3
|
+
disabled: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare function getCollectionItemsInDomOrder<Value, Node extends HTMLElement = HTMLElement>(items: ReadonlyMap<Value, CollectionItem<Node>>): [Value, CollectionItem<Node>][];
|
|
6
|
+
declare function isInteractiveDescendant(target: EventTarget | null, currentTarget: HTMLElement): boolean;
|
|
7
|
+
export { getCollectionItemsInDomOrder, isInteractiveDescendant, type CollectionItem, };
|
|
8
|
+
//# sourceMappingURL=collection-navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-navigation.d.ts","sourceRoot":"","sources":["../../../src/components/ui/collection-navigation.ts"],"names":[],"mappings":"AAAA,KAAK,cAAc,CAAC,IAAI,SAAS,WAAW,GAAG,WAAW,IAAI;IAC5D,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA;AAWD,iBAAS,4BAA4B,CACnC,KAAK,EACL,IAAI,SAAS,WAAW,GAAG,WAAW,EACtC,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC,mCAIhD;AAED,iBAAS,uBAAuB,CAC9B,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,aAAa,EAAE,WAAW,WAS3B;AAED,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,KAAK,cAAc,GACpB,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
function compareNodesInDocumentOrder(left, right) {
|
|
2
|
+
if (left === right)
|
|
3
|
+
return 0;
|
|
4
|
+
const position = left.compareDocumentPosition(right);
|
|
5
|
+
if (position & Node.DOCUMENT_POSITION_FOLLOWING)
|
|
6
|
+
return -1;
|
|
7
|
+
if (position & Node.DOCUMENT_POSITION_PRECEDING)
|
|
8
|
+
return 1;
|
|
9
|
+
return 0;
|
|
10
|
+
}
|
|
11
|
+
function getCollectionItemsInDomOrder(items) {
|
|
12
|
+
return [...items.entries()].sort(([, left], [, right]) => compareNodesInDocumentOrder(left.node, right.node));
|
|
13
|
+
}
|
|
14
|
+
function isInteractiveDescendant(target, currentTarget) {
|
|
15
|
+
if (!(target instanceof HTMLElement) || target === currentTarget)
|
|
16
|
+
return false;
|
|
17
|
+
return Boolean(target.closest('a,button,input,select,textarea,[contenteditable="true"],[role="button"],[role="link"]'));
|
|
18
|
+
}
|
|
19
|
+
export { getCollectionItemsInDomOrder, isInteractiveDescendant, };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
declare const colorWellVariants: (props?: ({
|
|
4
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
export interface ColorWellProps extends Omit<React.ComponentProps<'input'>, 'onChange' | 'size' | 'type' | 'value'>, VariantProps<typeof colorWellVariants> {
|
|
7
|
+
value?: string | null;
|
|
8
|
+
onValueChange?: (value: string) => void;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare function ColorWell({ value, onValueChange, readOnly, size, className, 'aria-label': ariaLabel, disabled, ...props }: ColorWellProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export { ColorWell, colorWellVariants };
|
|
13
|
+
//# sourceMappingURL=color-well.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-well.d.ts","sourceRoot":"","sources":["../../../src/components/ui/color-well.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAA;AAEjE,QAAA,MAAM,iBAAiB;;8EActB,CAAA;AAED,MAAM,WAAW,cACf,SAAQ,IAAI,CACR,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAC7B,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CACvC,EACD,YAAY,CAAC,OAAO,iBAAiB,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,iBAAS,SAAS,CAAC,EACjB,KAAK,EACL,aAAa,EACb,QAAgB,EAChB,IAAI,EACJ,SAAS,EACT,YAAY,EAAE,SAA0B,EACxC,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,2CAkDhB;AAED,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
const colorWellVariants = cva('border-border has-[:focus-visible]:ring-ring/50 relative inline-flex shrink-0 overflow-hidden rounded-md border shadow-xs outline-none has-[:focus-visible]:ring-[3px]', {
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
sm: 'size-6',
|
|
9
|
+
default: 'size-8',
|
|
10
|
+
lg: 'size-10',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
size: 'default',
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
function ColorWell({ value, onValueChange, readOnly = false, size, className, 'aria-label': ariaLabel = 'Choose color', disabled, ...props }) {
|
|
18
|
+
const swatch = (_jsx("span", { "aria-hidden": "true", "data-slot": "color-well-swatch", className: "absolute inset-0", style: {
|
|
19
|
+
backgroundColor: value ?? 'transparent',
|
|
20
|
+
backgroundImage: value
|
|
21
|
+
? undefined
|
|
22
|
+
: 'conic-gradient(var(--muted) 25%, transparent 0 50%, var(--muted) 0 75%, transparent 0)',
|
|
23
|
+
backgroundSize: value ? undefined : '8px 8px',
|
|
24
|
+
} }));
|
|
25
|
+
if (readOnly) {
|
|
26
|
+
return (_jsx("span", { "data-slot": "color-well", role: "img", "aria-label": ariaLabel, className: cn(colorWellVariants({ size }), className), children: swatch }));
|
|
27
|
+
}
|
|
28
|
+
return (_jsxs("label", { "data-slot": "color-well", className: cn(colorWellVariants({ size }), disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer', className), children: [swatch, _jsx("input", { type: "color", value: value ?? '#000000', "aria-label": ariaLabel, disabled: disabled, className: "absolute inset-0 cursor-[inherit] opacity-0", onChange: (event) => onValueChange?.(event.currentTarget.value), ...props })] }));
|
|
29
|
+
}
|
|
30
|
+
export { ColorWell, colorWellVariants };
|
|
@@ -15,6 +15,10 @@ declare function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandP
|
|
|
15
15
|
declare function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
declare function CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
declare function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare function CommandItemIcon({ className, 'aria-hidden': ariaHidden, ...props }: React.ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare function CommandItemContent({ className, ...props }: React.ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function CommandItemTitle({ className, ...props }: React.ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare function CommandItemDescription({ className, ...props }: React.ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
18
22
|
declare function CommandShortcut({ className, ...props }: React.ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
|
|
23
|
+
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandItemContent, CommandItemDescription, CommandItemIcon, CommandItemTitle, CommandShortcut, CommandSeparator, };
|
|
20
24
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/components/ui/command.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,MAAM,EAKP,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAA;AAElD,iBAAS,OAAO,CAAC,EACf,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,2CAW/C;AAED,iBAAS,aAAa,CAAC,EACrB,KAAyB,EACzB,WAA8C,EAC9C,QAAQ,EACR,SAAS,EACT,eAAsB,EACtB,MAAM,EACN,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IACvC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,MAAM,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAA;CACjE,2CAoBA;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,2CAiBrD;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,2CAWpD;AAED,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,2CAQrD;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,2CAWrD;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,SAAS,CAAC,2CAQzD;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,2CAWpD;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,2CAW9B;AAED,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,eAAe,EACf,gBAAgB,GACjB,CAAA"}
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/components/ui/command.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,MAAM,EAKP,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAA;AAElD,iBAAS,OAAO,CAAC,EACf,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,2CAW/C;AAED,iBAAS,aAAa,CAAC,EACrB,KAAyB,EACzB,WAA8C,EAC9C,QAAQ,EACR,SAAS,EACT,eAAsB,EACtB,MAAM,EACN,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IACvC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,MAAM,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAA;CACjE,2CAoBA;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,2CAiBrD;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,2CAWpD;AAED,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,2CAQrD;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,2CAWrD;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,SAAS,CAAC,2CAQzD;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,2CAWpD;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,aAAa,EAAE,UAAiB,EAChC,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,2CAY9B;AAED,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,2CAQ9B;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,2CAQ9B;AAED,iBAAS,sBAAsB,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,2CAQ9B;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,2CAW9B;AAED,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,CAAA"}
|
|
@@ -28,7 +28,19 @@ function CommandSeparator({ className, ...props }) {
|
|
|
28
28
|
function CommandItem({ className, ...props }) {
|
|
29
29
|
return (_jsx(CommandPrimitive.Item, { "data-slot": "command-item", className: cn("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), ...props }));
|
|
30
30
|
}
|
|
31
|
+
function CommandItemIcon({ className, 'aria-hidden': ariaHidden = true, ...props }) {
|
|
32
|
+
return (_jsx("span", { "data-slot": "command-item-icon", "aria-hidden": ariaHidden, className: cn("flex size-5 shrink-0 items-center justify-center [&_img]:size-4 [&_img]:object-contain [&_svg:not([class*='size-'])]:size-4", className), ...props }));
|
|
33
|
+
}
|
|
34
|
+
function CommandItemContent({ className, ...props }) {
|
|
35
|
+
return (_jsx("span", { "data-slot": "command-item-content", className: cn('flex min-w-0 flex-1 flex-col', className), ...props }));
|
|
36
|
+
}
|
|
37
|
+
function CommandItemTitle({ className, ...props }) {
|
|
38
|
+
return (_jsx("span", { "data-slot": "command-item-title", className: cn('flex min-w-0 items-center gap-2 truncate', className), ...props }));
|
|
39
|
+
}
|
|
40
|
+
function CommandItemDescription({ className, ...props }) {
|
|
41
|
+
return (_jsx("span", { "data-slot": "command-item-description", className: cn('text-muted-foreground truncate text-xs', className), ...props }));
|
|
42
|
+
}
|
|
31
43
|
function CommandShortcut({ className, ...props }) {
|
|
32
44
|
return (_jsx("span", { "data-slot": "command-shortcut", className: cn('text-muted-foreground ml-auto text-xs tracking-widest', className), ...props }));
|
|
33
45
|
}
|
|
34
|
-
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
|
|
46
|
+
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandItemContent, CommandItemDescription, CommandItemIcon, CommandItemTitle, CommandShortcut, CommandSeparator, };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AlertDialog } from './alert-dialog';
|
|
3
|
+
interface ConfirmDialogProps extends Omit<React.ComponentProps<typeof AlertDialog>, 'children' | 'onOpenChange'> {
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
description: React.ReactNode;
|
|
6
|
+
trigger?: React.ReactElement;
|
|
7
|
+
confirmLabel?: React.ReactNode;
|
|
8
|
+
pendingLabel?: React.ReactNode;
|
|
9
|
+
cancelLabel?: React.ReactNode;
|
|
10
|
+
variant?: 'default' | 'destructive';
|
|
11
|
+
size?: 'sm' | 'default' | 'lg';
|
|
12
|
+
onOpenChange?: (open: boolean) => void;
|
|
13
|
+
onConfirm: () => void | Promise<void>;
|
|
14
|
+
onConfirmError?: (error: unknown) => void;
|
|
15
|
+
getErrorMessage?: (error: unknown) => React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
declare function ConfirmDialog({ cancelLabel, confirmLabel, defaultOpen, description, getErrorMessage, onConfirm, onConfirmError, onOpenChange, open, pendingLabel, size, title, trigger, variant, ...props }: ConfirmDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export { ConfirmDialog, type ConfirmDialogProps };
|
|
19
|
+
//# sourceMappingURL=confirm-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/confirm-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,WAAW,EASZ,MAAM,gBAAgB,CAAA;AAEvB,UAAU,kBACR,SAAQ,IAAI,CACV,KAAK,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC,EACxC,UAAU,GAAG,cAAc,CAC5B;IACD,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,WAAW,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,OAAO,CAAC,EAAE,KAAK,CAAC,YAAY,CAAA;IAC5B,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAA;IACnC,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,CAAA;IAC9B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACzC,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,CAAC,SAAS,CAAA;CACtD;AAED,iBAAS,aAAa,CAAC,EACrB,WAAsB,EACtB,YAAwB,EACxB,WAAmB,EACnB,WAAW,EACX,eAAe,EACf,SAAS,EACT,cAAc,EACd,YAAY,EACZ,IAAI,EACJ,YAAyB,EACzB,IAAgB,EAChB,KAAK,EACL,OAAO,EACP,OAAmB,EACnB,GAAG,KAAK,EACT,EAAE,kBAAkB,2CAgFpB;AAED,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from './alert-dialog';
|
|
5
|
+
function ConfirmDialog({ cancelLabel = 'Cancel', confirmLabel = 'Confirm', defaultOpen = false, description, getErrorMessage, onConfirm, onConfirmError, onOpenChange, open, pendingLabel = 'Working…', size = 'default', title, trigger, variant = 'default', ...props }) {
|
|
6
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);
|
|
7
|
+
const [pending, setPending] = React.useState(false);
|
|
8
|
+
const [error, setError] = React.useState(null);
|
|
9
|
+
const pendingRef = React.useRef(false);
|
|
10
|
+
const resolvedOpen = open ?? uncontrolledOpen;
|
|
11
|
+
const updateOpen = React.useCallback((nextOpen) => {
|
|
12
|
+
if (pendingRef.current && !nextOpen)
|
|
13
|
+
return;
|
|
14
|
+
if (open === undefined)
|
|
15
|
+
setUncontrolledOpen(nextOpen);
|
|
16
|
+
if (nextOpen)
|
|
17
|
+
setError(null);
|
|
18
|
+
onOpenChange?.(nextOpen);
|
|
19
|
+
}, [onOpenChange, open]);
|
|
20
|
+
const handleConfirm = React.useCallback(async (event) => {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
if (pendingRef.current)
|
|
23
|
+
return;
|
|
24
|
+
pendingRef.current = true;
|
|
25
|
+
setPending(true);
|
|
26
|
+
setError(null);
|
|
27
|
+
try {
|
|
28
|
+
await onConfirm();
|
|
29
|
+
pendingRef.current = false;
|
|
30
|
+
setPending(false);
|
|
31
|
+
if (open === undefined)
|
|
32
|
+
setUncontrolledOpen(false);
|
|
33
|
+
onOpenChange?.(false);
|
|
34
|
+
}
|
|
35
|
+
catch (confirmError) {
|
|
36
|
+
pendingRef.current = false;
|
|
37
|
+
setPending(false);
|
|
38
|
+
setError(getErrorMessage?.(confirmError) ??
|
|
39
|
+
'Could not complete the action. Please try again.');
|
|
40
|
+
onConfirmError?.(confirmError);
|
|
41
|
+
}
|
|
42
|
+
}, [getErrorMessage, onConfirm, onConfirmError, onOpenChange, open]);
|
|
43
|
+
return (_jsxs(AlertDialog, { open: resolvedOpen, onOpenChange: updateOpen, ...props, children: [trigger ? (_jsx(AlertDialogTrigger, { asChild: true, children: trigger })) : null, _jsxs(AlertDialogContent, { size: size, children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: title }), _jsx(AlertDialogDescription, { children: description })] }), error ? (_jsx("p", { "data-slot": "confirm-dialog-error", role: "alert", className: "text-destructive text-sm", children: error })) : null, _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: pending, children: cancelLabel }), _jsx(AlertDialogAction, { variant: variant, pending: pending, pendingLabel: pendingLabel, onClick: handleConfirm, children: confirmLabel })] })] })] }));
|
|
44
|
+
}
|
|
45
|
+
export { ConfirmDialog };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
declare const dateFieldVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "filled" | null | undefined;
|
|
5
|
+
density?: "compact" | "default" | "comfortable" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
interface DateFieldProps extends Omit<React.ComponentProps<'input'>, 'defaultValue' | 'size' | 'type' | 'value'>, VariantProps<typeof dateFieldVariants> {
|
|
8
|
+
/** ISO calendar date in YYYY-MM-DD form. No timezone conversion is applied. */
|
|
9
|
+
value?: string;
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
onValueChange?: (value: string) => void;
|
|
12
|
+
onClear?: () => void;
|
|
13
|
+
clearable?: boolean;
|
|
14
|
+
clearLabel?: string;
|
|
15
|
+
inputClassName?: string;
|
|
16
|
+
}
|
|
17
|
+
declare function DateField({ className, inputClassName, value, defaultValue, onChange, onValueChange, onClear, clearable, clearLabel, variant, density, disabled, readOnly, ref, ...props }: DateFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export { DateField, dateFieldVariants, type DateFieldProps };
|
|
19
|
+
//# sourceMappingURL=date-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-field.d.ts","sourceRoot":"","sources":["../../../src/components/ui/date-field.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAA;AAEjE,QAAA,MAAM,iBAAiB;;;8EAmBtB,CAAA;AAED,UAAU,cACR,SAAQ,IAAI,CACR,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAC7B,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAC3C,EACD,YAAY,CAAC,OAAO,iBAAiB,CAAC;IACxC,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,iBAAS,SAAS,CAAC,EACjB,SAAS,EACT,cAAc,EACd,KAAK,EACL,YAAiB,EACjB,QAAQ,EACR,aAAa,EACb,OAAO,EACP,SAAiB,EACjB,UAAyB,EACzB,OAAmB,EACnB,OAAmB,EACnB,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,GAAG,KAAK,EACT,EAAE,cAAc,2CAkFhB;AAED,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,KAAK,cAAc,EAAE,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CalendarDaysIcon, XIcon } from 'lucide-react';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
import { IconButton } from './icon-button';
|
|
7
|
+
import { cva } from 'class-variance-authority';
|
|
8
|
+
const dateFieldVariants = cva('group/date-field border-input focus-within:border-ring focus-within:ring-ring/50 flex w-full min-w-0 items-center rounded-md border text-foreground shadow-xs transition-[background-color,border-color,box-shadow] focus-within:ring-[3px] has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-destructive/20', {
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: 'bg-background',
|
|
12
|
+
filled: 'border-transparent bg-muted/70 shadow-none',
|
|
13
|
+
},
|
|
14
|
+
density: {
|
|
15
|
+
compact: 'h-7',
|
|
16
|
+
default: 'h-9',
|
|
17
|
+
comfortable: 'h-10',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
variant: 'default',
|
|
22
|
+
density: 'default',
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
function DateField({ className, inputClassName, value, defaultValue = '', onChange, onValueChange, onClear, clearable = false, clearLabel = 'Clear date', variant = 'default', density = 'default', disabled, readOnly, ref, ...props }) {
|
|
26
|
+
const controlled = value !== undefined;
|
|
27
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue);
|
|
28
|
+
const inputRef = React.useRef(null);
|
|
29
|
+
const currentValue = controlled ? value : internalValue;
|
|
30
|
+
const setRefs = React.useCallback((node) => {
|
|
31
|
+
inputRef.current = node;
|
|
32
|
+
if (typeof ref === 'function')
|
|
33
|
+
ref(node);
|
|
34
|
+
else if (ref)
|
|
35
|
+
ref.current = node;
|
|
36
|
+
}, [ref]);
|
|
37
|
+
const commitValue = React.useCallback((nextValue) => {
|
|
38
|
+
if (!controlled)
|
|
39
|
+
setInternalValue(nextValue);
|
|
40
|
+
onValueChange?.(nextValue);
|
|
41
|
+
}, [controlled, onValueChange]);
|
|
42
|
+
const clear = React.useCallback(() => {
|
|
43
|
+
if (!currentValue)
|
|
44
|
+
return;
|
|
45
|
+
commitValue('');
|
|
46
|
+
onClear?.();
|
|
47
|
+
inputRef.current?.focus();
|
|
48
|
+
}, [commitValue, currentValue, onClear]);
|
|
49
|
+
return (_jsxs("div", { "data-slot": "date-field", "data-density": density, "data-variant": variant, "data-disabled": disabled || undefined, "data-readonly": readOnly || undefined, className: cn(dateFieldVariants({ variant, density }), disabled && 'cursor-not-allowed opacity-50', className), children: [_jsx(CalendarDaysIcon, { "aria-hidden": "true", className: cn('text-muted-foreground pointer-events-none ml-2.5 shrink-0', density === 'compact' ? 'size-3.5' : 'size-4') }), _jsx("input", { ref: setRefs, "data-slot": "date-field-input", type: "date", value: currentValue, disabled: disabled, readOnly: readOnly, className: cn('min-w-0 flex-1 bg-transparent px-2 text-sm outline-none dark:[color-scheme:dark] [&::-webkit-calendar-picker-indicator]:cursor-pointer [&::-webkit-calendar-picker-indicator]:opacity-60 [&::-webkit-calendar-picker-indicator]:hover:opacity-100', density === 'compact' && 'text-xs', inputClassName), onChange: (event) => {
|
|
50
|
+
onChange?.(event);
|
|
51
|
+
commitValue(event.currentTarget.value);
|
|
52
|
+
}, ...props }), clearable && currentValue && !readOnly ? (_jsx(IconButton, { label: clearLabel, size: "xs", variant: "ghost", disabled: disabled, className: "mr-0.5 shrink-0", onClick: clear, children: _jsx(XIcon, {}) })) : null] }));
|
|
53
|
+
}
|
|
54
|
+
export { DateField, dateFieldVariants };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Button } from './button';
|
|
3
|
+
import { Calendar } from './calendar';
|
|
4
|
+
type DatePickerDensity = 'compact' | 'default' | 'comfortable';
|
|
5
|
+
interface DatePickerProps extends Omit<React.ComponentProps<typeof Button>, 'children' | 'defaultValue' | 'size' | 'value'> {
|
|
6
|
+
/** ISO calendar date in YYYY-MM-DD form. No timezone conversion is applied. */
|
|
7
|
+
value?: string;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
onValueChange?: (value: string) => void;
|
|
10
|
+
min?: string;
|
|
11
|
+
max?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
locale?: React.ComponentProps<typeof Calendar>['locale'];
|
|
14
|
+
formatValue?: (value: string) => React.ReactNode;
|
|
15
|
+
clearable?: boolean;
|
|
16
|
+
clearLabel?: string;
|
|
17
|
+
density?: DatePickerDensity;
|
|
18
|
+
open?: boolean;
|
|
19
|
+
defaultOpen?: boolean;
|
|
20
|
+
onOpenChange?: (open: boolean) => void;
|
|
21
|
+
}
|
|
22
|
+
declare function DatePicker({ className, value, defaultValue, onValueChange, min, max, placeholder, locale, formatValue, clearable, clearLabel, density, open, defaultOpen, onOpenChange, disabled, variant, 'aria-invalid': ariaInvalid, ...buttonProps }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export { DatePicker, type DatePickerDensity, type DatePickerProps };
|
|
24
|
+
//# sourceMappingURL=date-picker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/components/ui/date-picker.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAGrC,KAAK,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,CAAA;AAE9D,UAAU,eACR,SAAQ,IAAI,CACV,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,EACnC,UAAU,GAAG,cAAc,GAAG,MAAM,GAAG,OAAO,CAC/C;IACD,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAA;IACxD,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAA;IAChD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;CACvC;AAwCD,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,KAAK,EACL,YAAiB,EACjB,aAAa,EACb,GAAG,EACH,GAAG,EACH,WAA2B,EAC3B,MAAM,EACN,WAAW,EACX,SAAiB,EACjB,UAAyB,EACzB,OAAmB,EACnB,IAAI,EACJ,WAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,OAAmB,EACnB,cAAc,EAAE,WAAW,EAC3B,GAAG,WAAW,EACf,EAAE,eAAe,2CA2GjB;AAED,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CalendarDaysIcon } from 'lucide-react';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
import { Button } from './button';
|
|
7
|
+
import { Calendar } from './calendar';
|
|
8
|
+
import { Popover, PopoverContent, PopoverTrigger } from './popover';
|
|
9
|
+
const ISO_CALENDAR_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
10
|
+
function parseCalendarDate(value) {
|
|
11
|
+
if (!value)
|
|
12
|
+
return undefined;
|
|
13
|
+
const match = ISO_CALENDAR_DATE.exec(value);
|
|
14
|
+
if (!match)
|
|
15
|
+
return undefined;
|
|
16
|
+
const year = Number(match[1]);
|
|
17
|
+
const month = Number(match[2]);
|
|
18
|
+
const day = Number(match[3]);
|
|
19
|
+
const date = new Date(0);
|
|
20
|
+
date.setHours(0, 0, 0, 0);
|
|
21
|
+
date.setFullYear(year, month - 1, day);
|
|
22
|
+
if (date.getFullYear() !== year ||
|
|
23
|
+
date.getMonth() !== month - 1 ||
|
|
24
|
+
date.getDate() !== day) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
return date;
|
|
28
|
+
}
|
|
29
|
+
function formatCalendarDate(date) {
|
|
30
|
+
const year = String(date.getFullYear()).padStart(4, '0');
|
|
31
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
32
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
33
|
+
return `${year}-${month}-${day}`;
|
|
34
|
+
}
|
|
35
|
+
const densityClasses = {
|
|
36
|
+
compact: 'h-7 gap-1.5 px-2 text-xs',
|
|
37
|
+
default: 'h-9 px-3',
|
|
38
|
+
comfortable: 'h-10 px-3.5',
|
|
39
|
+
};
|
|
40
|
+
function DatePicker({ className, value, defaultValue = '', onValueChange, min, max, placeholder = 'Choose date', locale, formatValue, clearable = false, clearLabel = 'Clear date', density = 'default', open, defaultOpen = false, onOpenChange, disabled, variant = 'outline', 'aria-invalid': ariaInvalid, ...buttonProps }) {
|
|
41
|
+
const controlled = value !== undefined;
|
|
42
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue);
|
|
43
|
+
const [internalOpen, setInternalOpen] = React.useState(defaultOpen);
|
|
44
|
+
const currentValue = controlled ? value : internalValue;
|
|
45
|
+
const selectedDate = parseCalendarDate(currentValue);
|
|
46
|
+
const minDate = parseCalendarDate(min);
|
|
47
|
+
const maxDate = parseCalendarDate(max);
|
|
48
|
+
const isOpen = open ?? internalOpen;
|
|
49
|
+
const invalid = Boolean(currentValue && !selectedDate);
|
|
50
|
+
const disabledDates = React.useMemo(() => {
|
|
51
|
+
const matchers = [];
|
|
52
|
+
if (minDate)
|
|
53
|
+
matchers.push({ before: minDate });
|
|
54
|
+
if (maxDate)
|
|
55
|
+
matchers.push({ after: maxDate });
|
|
56
|
+
return matchers;
|
|
57
|
+
}, [maxDate, minDate]);
|
|
58
|
+
const setOpen = React.useCallback((nextOpen) => {
|
|
59
|
+
if (open === undefined)
|
|
60
|
+
setInternalOpen(nextOpen);
|
|
61
|
+
onOpenChange?.(nextOpen);
|
|
62
|
+
}, [onOpenChange, open]);
|
|
63
|
+
const commitValue = React.useCallback((nextValue) => {
|
|
64
|
+
if (!controlled)
|
|
65
|
+
setInternalValue(nextValue);
|
|
66
|
+
onValueChange?.(nextValue);
|
|
67
|
+
}, [controlled, onValueChange]);
|
|
68
|
+
const displayValue = React.useMemo(() => {
|
|
69
|
+
if (!currentValue)
|
|
70
|
+
return null;
|
|
71
|
+
if (formatValue)
|
|
72
|
+
return formatValue(currentValue);
|
|
73
|
+
if (!selectedDate)
|
|
74
|
+
return currentValue;
|
|
75
|
+
return new Intl.DateTimeFormat(locale?.code, {
|
|
76
|
+
dateStyle: 'medium',
|
|
77
|
+
}).format(selectedDate);
|
|
78
|
+
}, [currentValue, formatValue, locale?.code, selectedDate]);
|
|
79
|
+
return (_jsxs(Popover, { open: isOpen, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { "data-slot": "date-picker-trigger", "data-density": density, type: "button", variant: variant, disabled: disabled, "aria-invalid": (ariaInvalid ?? invalid) || undefined, className: cn('min-w-0 justify-start font-normal', !displayValue && 'text-muted-foreground', densityClasses[density], className), ...buttonProps, children: [_jsx(CalendarDaysIcon, { "aria-hidden": "true" }), _jsx("span", { className: "min-w-0 truncate", children: displayValue ?? placeholder })] }) }), _jsxs(PopoverContent, { "data-slot": "date-picker-content", align: "start", className: "w-auto p-0", children: [_jsx(Calendar, { mode: "single", locale: locale, selected: selectedDate, defaultMonth: selectedDate ?? minDate, disabled: disabledDates, autoFocus: true, onSelect: (nextDate) => {
|
|
80
|
+
if (!nextDate) {
|
|
81
|
+
if (clearable)
|
|
82
|
+
commitValue('');
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
commitValue(formatCalendarDate(nextDate));
|
|
86
|
+
setOpen(false);
|
|
87
|
+
} }), clearable && currentValue ? (_jsx("div", { className: "border-border/60 flex justify-end border-t p-2", children: _jsx(Button, { type: "button", size: "xs", variant: "ghost", onClick: () => {
|
|
88
|
+
commitValue('');
|
|
89
|
+
setOpen(false);
|
|
90
|
+
}, children: clearLabel }) })) : null] })] }));
|
|
91
|
+
}
|
|
92
|
+
export { DatePicker };
|