@krizaka/ui 2.2.0 → 2.4.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/README.md +33 -8
- package/dist/audio-player.d.ts +113 -0
- package/dist/audio-player.js +207 -0
- package/dist/audio-player.js.map +1 -0
- package/dist/{button-Cgfkg_3y.d.ts → button-BMAO7dKF.d.ts} +29 -2
- package/dist/button.d.ts +32 -5
- package/dist/button.js +62 -9
- package/dist/button.js.map +1 -1
- package/dist/chip-link.d.ts +53 -0
- package/dist/chip-link.js +32 -0
- package/dist/chip-link.js.map +1 -0
- package/dist/chunk-2USC2YT6.js +17 -0
- package/dist/chunk-2USC2YT6.js.map +1 -0
- package/dist/chunk-43PTCDTL.js +31 -0
- package/dist/chunk-43PTCDTL.js.map +1 -0
- package/dist/chunk-6ISW63JI.js +11 -0
- package/dist/chunk-6ISW63JI.js.map +1 -0
- package/dist/chunk-EUPTXKH7.js +95 -0
- package/dist/chunk-EUPTXKH7.js.map +1 -0
- package/dist/chunk-HAQWKORZ.js +117 -0
- package/dist/chunk-HAQWKORZ.js.map +1 -0
- package/dist/{chunk-FHYZSO2S.js → chunk-R6SDS7JM.js} +5 -3
- package/dist/chunk-R6SDS7JM.js.map +1 -0
- package/dist/chunk-RUPNPMP3.js +103 -0
- package/dist/chunk-RUPNPMP3.js.map +1 -0
- package/dist/chunk-RUPRYJ45.js +82 -0
- package/dist/chunk-RUPRYJ45.js.map +1 -0
- package/dist/chunk-VDR2EP6K.js +49 -0
- package/dist/chunk-VDR2EP6K.js.map +1 -0
- package/dist/chunk-WEVYKZIF.js +33 -0
- package/dist/chunk-WEVYKZIF.js.map +1 -0
- package/dist/chunk-XUMJA5ZI.js +283 -0
- package/dist/chunk-XUMJA5ZI.js.map +1 -0
- package/dist/chunk-YH4LMWRU.js +92 -0
- package/dist/chunk-YH4LMWRU.js.map +1 -0
- package/dist/chunk-YX6CNVJA.js +94 -0
- package/dist/chunk-YX6CNVJA.js.map +1 -0
- package/dist/chunk-ZIXB33X7.js +95 -0
- package/dist/chunk-ZIXB33X7.js.map +1 -0
- package/dist/combobox.d.ts +188 -0
- package/dist/combobox.js +16 -0
- package/dist/combobox.js.map +1 -0
- package/dist/command.d.ts +7 -7
- package/dist/command.js +3 -2
- package/dist/command.js.map +1 -1
- package/dist/confirm-button.d.ts +1 -1
- package/dist/confirm-button.js +2 -1
- package/dist/confirm-button.js.map +1 -1
- package/dist/data-table.d.ts +246 -0
- package/dist/data-table.js +290 -0
- package/dist/data-table.js.map +1 -0
- package/dist/date-picker.d.ts +288 -0
- package/dist/date-picker.js +364 -0
- package/dist/date-picker.js.map +1 -0
- package/dist/{dialog-GQ4Nvuyf.d.ts → dialog-D42QwYb_.d.ts} +11 -1
- package/dist/dialog.d.ts +1 -1
- package/dist/dialog.js +3 -2
- package/dist/dialog.js.map +1 -1
- package/dist/file-upload.d.ts +238 -0
- package/dist/file-upload.js +437 -0
- package/dist/file-upload.js.map +1 -0
- package/dist/filter-bar.d.ts +139 -0
- package/dist/filter-bar.js +155 -0
- package/dist/filter-bar.js.map +1 -0
- package/dist/glow-card.d.ts +20 -0
- package/dist/glow-card.js +30 -0
- package/dist/glow-card.js.map +1 -0
- package/dist/image-cropper.d.ts +115 -0
- package/dist/image-cropper.js +166 -0
- package/dist/image-cropper.js.map +1 -0
- package/dist/index.d.ts +2 -20
- package/dist/index.js +7 -64
- package/dist/index.js.map +1 -1
- package/dist/iso.d.ts +400 -0
- package/dist/iso.js +363 -0
- package/dist/iso.js.map +1 -0
- package/dist/loader.d.ts +206 -0
- package/dist/loader.js +138 -0
- package/dist/loader.js.map +1 -0
- package/dist/marquee.d.ts +33 -0
- package/dist/marquee.js +52 -0
- package/dist/marquee.js.map +1 -0
- package/dist/media-capture.d.ts +155 -0
- package/dist/media-capture.js +242 -0
- package/dist/media-capture.js.map +1 -0
- package/dist/meter.d.ts +146 -0
- package/dist/meter.js +107 -0
- package/dist/meter.js.map +1 -0
- package/dist/motion.css +394 -3
- package/dist/motion.d.ts +46 -0
- package/dist/motion.js +10 -0
- package/dist/motion.js.map +1 -0
- package/dist/native/media-capture.d.ts +49 -0
- package/dist/native/media-capture.js +113 -0
- package/dist/native/media-capture.js.map +1 -0
- package/dist/native/video-player.d.ts +50 -0
- package/dist/native/video-player.js +69 -0
- package/dist/native/video-player.js.map +1 -0
- package/dist/native.d.ts +66 -2
- package/dist/native.js +166 -68
- package/dist/native.js.map +1 -1
- package/dist/nav-bar.d.ts +178 -0
- package/dist/nav-bar.js +157 -0
- package/dist/nav-bar.js.map +1 -0
- package/dist/number-ticker.d.ts +32 -0
- package/dist/number-ticker.js +61 -0
- package/dist/number-ticker.js.map +1 -0
- package/dist/pagination.d.ts +141 -0
- package/dist/pagination.js +165 -0
- package/dist/pagination.js.map +1 -0
- package/dist/progress.d.ts +56 -1
- package/dist/progress.js +72 -25
- package/dist/progress.js.map +1 -1
- package/dist/search-field.d.ts +100 -0
- package/dist/search-field.js +167 -0
- package/dist/search-field.js.map +1 -0
- package/dist/skeleton.d.ts +18 -3
- package/dist/skeleton.js +9 -1
- package/dist/skeleton.js.map +1 -1
- package/dist/spinner.d.ts +21 -5
- package/dist/spinner.js +13 -12
- package/dist/spinner.js.map +1 -1
- package/dist/stepper.d.ts +112 -0
- package/dist/stepper.js +67 -0
- package/dist/stepper.js.map +1 -0
- package/dist/tabs.d.ts +1 -1
- package/dist/tabs.js +14 -8
- package/dist/tabs.js.map +1 -1
- package/dist/tag-input.d.ts +44 -0
- package/dist/tag-input.js +67 -0
- package/dist/tag-input.js.map +1 -0
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +2 -1
- package/dist/theme.js.map +1 -1
- package/dist/toast.d.ts +39 -4
- package/dist/toast.js +81 -7
- package/dist/toast.js.map +1 -1
- package/dist/video-player.d.ts +204 -0
- package/dist/video-player.js +371 -0
- package/dist/video-player.js.map +1 -0
- package/dist/video-trimmer.d.ts +142 -0
- package/dist/video-trimmer.js +193 -0
- package/dist/video-trimmer.js.map +1 -0
- package/package.json +375 -7
- package/registry/alert.json +1 -1
- package/registry/audio-player.json +282 -0
- package/registry/avatar.json +1 -1
- package/registry/badge.json +1 -1
- package/registry/button.json +232 -26
- package/registry/card.json +1 -1
- package/registry/checkbox.json +1 -1
- package/registry/chip-link.json +158 -0
- package/registry/chip.json +1 -1
- package/registry/combobox.json +475 -0
- package/registry/command.json +1 -1
- package/registry/confirm-button.json +91 -7
- package/registry/countdown.json +1 -1
- package/registry/data-table.json +500 -0
- package/registry/date-picker.json +978 -0
- package/registry/dialog.json +15 -7
- package/registry/dropdown-menu.json +1 -1
- package/registry/empty-state.json +1 -1
- package/registry/examples/audio-player/podcast.js +22 -0
- package/registry/examples/audio-player/podcast.tsx +19 -0
- package/registry/examples/audio-player/voice-note.d.ts +4 -0
- package/registry/examples/audio-player/voice-note.js +12 -0
- package/registry/examples/audio-player/voice-note.tsx +12 -0
- package/registry/examples/button/error.d.ts +4 -0
- package/registry/examples/button/error.js +11 -0
- package/registry/examples/button/error.tsx +10 -0
- package/registry/examples/button/loading.tsx +1 -1
- package/registry/examples/button/save-flow.d.ts +4 -0
- package/registry/examples/button/save-flow.js +28 -0
- package/registry/examples/button/save-flow.tsx +24 -0
- package/registry/examples/button/signature.d.ts +4 -0
- package/registry/examples/button/signature.js +17 -0
- package/registry/examples/button/signature.tsx +19 -0
- package/registry/examples/button/upload-progress.d.ts +4 -0
- package/registry/examples/button/upload-progress.js +23 -0
- package/registry/examples/button/upload-progress.tsx +26 -0
- package/registry/examples/chip-link/filters.d.ts +4 -0
- package/registry/examples/chip-link/filters.js +12 -0
- package/registry/examples/chip-link/filters.tsx +17 -0
- package/registry/examples/combobox/async.d.ts +4 -0
- package/registry/examples/combobox/async.js +23 -0
- package/registry/examples/combobox/async.tsx +22 -0
- package/registry/examples/combobox/creatable.d.ts +4 -0
- package/registry/examples/combobox/creatable.js +32 -0
- package/registry/examples/combobox/creatable.tsx +28 -0
- package/registry/examples/combobox/invalid.d.ts +4 -0
- package/registry/examples/combobox/invalid.js +23 -0
- package/registry/examples/combobox/invalid.tsx +17 -0
- package/registry/examples/combobox/multiple.d.ts +4 -0
- package/registry/examples/combobox/multiple.js +29 -0
- package/registry/examples/combobox/multiple.tsx +26 -0
- package/registry/examples/data-table/cards.d.ts +4 -0
- package/registry/examples/data-table/cards.js +21 -0
- package/registry/examples/data-table/cards.tsx +20 -0
- package/registry/examples/data-table/empty.d.ts +4 -0
- package/registry/examples/data-table/empty.js +26 -0
- package/registry/examples/data-table/empty.tsx +21 -0
- package/registry/examples/data-table/error.d.ts +4 -0
- package/registry/examples/data-table/error.js +28 -0
- package/registry/examples/data-table/error.tsx +29 -0
- package/registry/examples/data-table/jobs.d.ts +4 -0
- package/registry/examples/data-table/jobs.js +37 -0
- package/registry/examples/data-table/jobs.tsx +36 -0
- package/registry/examples/data-table/loading.d.ts +4 -0
- package/registry/examples/data-table/loading.js +16 -0
- package/registry/examples/data-table/loading.tsx +12 -0
- package/registry/examples/data-table/virtualized.d.ts +4 -0
- package/registry/examples/data-table/virtualized.js +21 -0
- package/registry/examples/data-table/virtualized.tsx +20 -0
- package/registry/examples/date-picker/calendar.d.ts +4 -0
- package/registry/examples/date-picker/calendar.js +14 -0
- package/registry/examples/date-picker/calendar.tsx +16 -0
- package/registry/examples/date-picker/french.d.ts +4 -0
- package/registry/examples/date-picker/french.js +20 -0
- package/registry/examples/date-picker/french.tsx +14 -0
- package/registry/examples/date-picker/open.d.ts +4 -0
- package/registry/examples/date-picker/open.js +11 -0
- package/registry/examples/date-picker/open.tsx +8 -0
- package/registry/examples/date-picker/range.d.ts +4 -0
- package/registry/examples/date-picker/range.js +29 -0
- package/registry/examples/date-picker/range.tsx +25 -0
- package/registry/examples/date-picker/schedule.d.ts +4 -0
- package/registry/examples/date-picker/schedule.js +26 -0
- package/registry/examples/date-picker/schedule.tsx +22 -0
- package/registry/examples/dialog/left.d.ts +4 -0
- package/registry/examples/dialog/left.js +22 -0
- package/registry/examples/dialog/left.tsx +32 -0
- package/registry/examples/file-upload/images.d.ts +4 -0
- package/registry/examples/file-upload/images.js +32 -0
- package/registry/examples/file-upload/images.tsx +25 -0
- package/registry/examples/file-upload/states.d.ts +4 -0
- package/registry/examples/file-upload/states.js +28 -0
- package/registry/examples/file-upload/states.tsx +23 -0
- package/registry/examples/file-upload/tus.d.ts +4 -0
- package/registry/examples/file-upload/tus.js +23 -0
- package/registry/examples/file-upload/tus.tsx +26 -0
- package/registry/examples/file-upload/video.d.ts +4 -0
- package/registry/examples/file-upload/video.js +39 -0
- package/registry/examples/file-upload/video.tsx +36 -0
- package/registry/examples/filter-bar/address.d.ts +4 -0
- package/registry/examples/filter-bar/address.js +29 -0
- package/registry/examples/filter-bar/address.tsx +27 -0
- package/registry/examples/filter-bar/jobs.d.ts +4 -0
- package/registry/examples/filter-bar/jobs.js +37 -0
- package/registry/examples/filter-bar/jobs.tsx +37 -0
- package/registry/examples/filter-bar/menu.d.ts +4 -0
- package/registry/examples/filter-bar/menu.js +27 -0
- package/registry/examples/filter-bar/menu.tsx +23 -0
- package/registry/examples/glow-card/link-card.d.ts +4 -0
- package/registry/examples/glow-card/link-card.js +14 -0
- package/registry/examples/glow-card/link-card.tsx +13 -0
- package/registry/examples/glow-card/plans.d.ts +4 -0
- package/registry/examples/glow-card/plans.js +25 -0
- package/registry/examples/glow-card/plans.tsx +26 -0
- package/registry/examples/glow-card/spotlight.d.ts +4 -0
- package/registry/examples/glow-card/spotlight.js +14 -0
- package/registry/examples/glow-card/spotlight.tsx +15 -0
- package/registry/examples/image-cropper/avatar.d.ts +4 -0
- package/registry/examples/image-cropper/avatar.js +13 -0
- package/registry/examples/image-cropper/avatar.tsx +14 -0
- package/registry/examples/image-cropper/banner.d.ts +4 -0
- package/registry/examples/image-cropper/banner.js +11 -0
- package/registry/examples/image-cropper/banner.tsx +10 -0
- package/registry/examples/image-cropper/vertical-video.d.ts +4 -0
- package/registry/examples/image-cropper/vertical-video.js +12 -0
- package/registry/examples/image-cropper/vertical-video.tsx +16 -0
- package/registry/examples/iso/compose.d.ts +4 -0
- package/registry/examples/iso/compose.js +22 -0
- package/registry/examples/iso/compose.tsx +19 -0
- package/registry/examples/iso/orazaka-hero.d.ts +4 -0
- package/registry/examples/iso/orazaka-hero.js +26 -0
- package/registry/examples/iso/orazaka-hero.tsx +21 -0
- package/registry/examples/iso/orochia-hero.d.ts +4 -0
- package/registry/examples/iso/orochia-hero.js +29 -0
- package/registry/examples/iso/orochia-hero.tsx +23 -0
- package/registry/examples/iso/still.d.ts +4 -0
- package/registry/examples/iso/still.js +21 -0
- package/registry/examples/iso/still.tsx +15 -0
- package/registry/examples/loader/endings.d.ts +4 -0
- package/registry/examples/loader/endings.js +14 -0
- package/registry/examples/loader/endings.tsx +11 -0
- package/registry/examples/loader/fetch-flow.d.ts +4 -0
- package/registry/examples/loader/fetch-flow.js +24 -0
- package/registry/examples/loader/fetch-flow.tsx +24 -0
- package/registry/examples/loader/minimal.d.ts +4 -0
- package/registry/examples/loader/minimal.js +11 -0
- package/registry/examples/loader/minimal.tsx +6 -0
- package/registry/examples/loader/overlay.d.ts +4 -0
- package/registry/examples/loader/overlay.js +16 -0
- package/registry/examples/loader/overlay.tsx +13 -0
- package/registry/examples/loader/region-handover.d.ts +4 -0
- package/registry/examples/loader/region-handover.js +42 -0
- package/registry/examples/loader/region-handover.tsx +29 -0
- package/registry/examples/loader/upload-eta.d.ts +4 -0
- package/registry/examples/loader/upload-eta.js +11 -0
- package/registry/examples/loader/upload-eta.tsx +10 -0
- package/registry/examples/marquee/cards.d.ts +4 -0
- package/registry/examples/marquee/cards.js +23 -0
- package/registry/examples/marquee/cards.tsx +21 -0
- package/registry/examples/marquee/logos.d.ts +4 -0
- package/registry/examples/marquee/logos.js +12 -0
- package/registry/examples/marquee/logos.tsx +17 -0
- package/registry/examples/media-capture/clip.d.ts +4 -0
- package/registry/examples/media-capture/clip.js +20 -0
- package/registry/examples/media-capture/clip.tsx +18 -0
- package/registry/examples/media-capture/native/photo.d.ts +4 -0
- package/registry/examples/media-capture/native/photo.dark.png +0 -0
- package/registry/examples/media-capture/native/photo.js +27 -0
- package/registry/examples/media-capture/native/photo.light.png +0 -0
- package/registry/examples/media-capture/native/photo.tsx +20 -0
- package/registry/examples/media-capture/profile-photo.d.ts +4 -0
- package/registry/examples/media-capture/profile-photo.js +24 -0
- package/registry/examples/media-capture/profile-photo.tsx +20 -0
- package/registry/examples/meter/balance.d.ts +4 -0
- package/registry/examples/meter/balance.js +14 -0
- package/registry/examples/meter/balance.tsx +15 -0
- package/registry/examples/meter/quota.d.ts +4 -0
- package/registry/examples/meter/quota.js +15 -0
- package/registry/examples/meter/quota.tsx +12 -0
- package/registry/examples/meter/split.d.ts +4 -0
- package/registry/examples/meter/split.js +18 -0
- package/registry/examples/meter/split.tsx +18 -0
- package/registry/examples/nav-bar/app-bar.d.ts +4 -0
- package/registry/examples/nav-bar/app-bar.js +22 -0
- package/registry/examples/nav-bar/app-bar.tsx +21 -0
- package/registry/examples/nav-bar/menu-open.d.ts +4 -0
- package/registry/examples/nav-bar/menu-open.js +26 -0
- package/registry/examples/nav-bar/menu-open.tsx +26 -0
- package/registry/examples/nav-bar/site.d.ts +4 -0
- package/registry/examples/nav-bar/site.js +31 -0
- package/registry/examples/nav-bar/site.tsx +36 -0
- package/registry/examples/number-ticker/gradient.d.ts +4 -0
- package/registry/examples/number-ticker/gradient.js +11 -0
- package/registry/examples/number-ticker/gradient.tsx +10 -0
- package/registry/examples/number-ticker/live-total.d.ts +4 -0
- package/registry/examples/number-ticker/live-total.js +17 -0
- package/registry/examples/number-ticker/live-total.tsx +21 -0
- package/registry/examples/number-ticker/stats.d.ts +4 -0
- package/registry/examples/number-ticker/stats.js +19 -0
- package/registry/examples/number-ticker/stats.tsx +23 -0
- package/registry/examples/pagination/cursor.d.ts +4 -0
- package/registry/examples/pagination/cursor.js +24 -0
- package/registry/examples/pagination/cursor.tsx +20 -0
- package/registry/examples/pagination/links.d.ts +4 -0
- package/registry/examples/pagination/links.js +11 -0
- package/registry/examples/pagination/links.tsx +6 -0
- package/registry/examples/pagination/native/cursor.d.ts +4 -0
- package/registry/examples/pagination/native/cursor.dark.png +0 -0
- package/registry/examples/pagination/native/cursor.js +19 -0
- package/registry/examples/pagination/native/cursor.light.png +0 -0
- package/registry/examples/pagination/native/cursor.tsx +13 -0
- package/registry/examples/pagination/native/pages.d.ts +4 -0
- package/registry/examples/pagination/native/pages.dark.png +0 -0
- package/registry/examples/pagination/native/pages.js +21 -0
- package/registry/examples/pagination/native/pages.light.png +0 -0
- package/registry/examples/pagination/native/pages.tsx +14 -0
- package/registry/examples/pagination/results.d.ts +4 -0
- package/registry/examples/pagination/results.js +23 -0
- package/registry/examples/pagination/results.tsx +19 -0
- package/registry/examples/pagination/table-footer.d.ts +4 -0
- package/registry/examples/pagination/table-footer.js +31 -0
- package/registry/examples/pagination/table-footer.tsx +27 -0
- package/registry/examples/progress/buffer.d.ts +4 -0
- package/registry/examples/progress/buffer.js +11 -0
- package/registry/examples/progress/buffer.tsx +10 -0
- package/registry/examples/progress/statuses.d.ts +4 -0
- package/registry/examples/progress/statuses.js +14 -0
- package/registry/examples/progress/statuses.tsx +11 -0
- package/registry/examples/progress/steps.d.ts +4 -0
- package/registry/examples/progress/steps.js +14 -0
- package/registry/examples/progress/steps.tsx +13 -0
- package/registry/examples/progress/upload.d.ts +4 -0
- package/registry/examples/progress/upload.js +11 -0
- package/registry/examples/progress/upload.tsx +10 -0
- package/registry/examples/search-field/global.d.ts +4 -0
- package/registry/examples/search-field/global.js +19 -0
- package/registry/examples/search-field/global.tsx +15 -0
- package/registry/examples/search-field/native/default.d.ts +4 -0
- package/registry/examples/search-field/native/default.dark.png +0 -0
- package/registry/examples/search-field/native/default.js +13 -0
- package/registry/examples/search-field/native/default.light.png +0 -0
- package/registry/examples/search-field/native/default.tsx +7 -0
- package/registry/examples/search-field/suggestions.d.ts +4 -0
- package/registry/examples/search-field/suggestions.js +30 -0
- package/registry/examples/search-field/suggestions.tsx +27 -0
- package/registry/examples/search-field/toolbar.d.ts +4 -0
- package/registry/examples/search-field/toolbar.js +17 -0
- package/registry/examples/search-field/toolbar.tsx +21 -0
- package/registry/examples/skeleton/paragraph.d.ts +4 -0
- package/registry/examples/skeleton/paragraph.js +14 -0
- package/registry/examples/skeleton/paragraph.tsx +12 -0
- package/registry/examples/skeleton/shape-of-content.d.ts +4 -0
- package/registry/examples/skeleton/shape-of-content.js +23 -0
- package/registry/examples/skeleton/shape-of-content.tsx +26 -0
- package/registry/examples/spinner/default.js +5 -2
- package/registry/examples/spinner/default.tsx +7 -1
- package/registry/examples/spinner/sizes.js +2 -1
- package/registry/examples/spinner/sizes.tsx +2 -0
- package/registry/examples/spinner/value.d.ts +4 -0
- package/registry/examples/spinner/value.js +11 -0
- package/registry/examples/spinner/value.tsx +12 -0
- package/registry/examples/stepper/checkout.d.ts +4 -0
- package/registry/examples/stepper/checkout.js +22 -0
- package/registry/examples/stepper/checkout.tsx +17 -0
- package/registry/examples/stepper/failed.d.ts +4 -0
- package/registry/examples/stepper/failed.js +26 -0
- package/registry/examples/stepper/failed.tsx +21 -0
- package/registry/examples/stepper/job.d.ts +4 -0
- package/registry/examples/stepper/job.js +32 -0
- package/registry/examples/stepper/job.tsx +28 -0
- package/registry/examples/tag-input/recipients.d.ts +4 -0
- package/registry/examples/tag-input/recipients.js +23 -0
- package/registry/examples/tag-input/recipients.tsx +20 -0
- package/registry/examples/tag-input/video-tags.d.ts +4 -0
- package/registry/examples/tag-input/video-tags.js +26 -0
- package/registry/examples/tag-input/video-tags.tsx +22 -0
- package/registry/examples/toast/grouped.d.ts +4 -0
- package/registry/examples/toast/grouped.js +21 -0
- package/registry/examples/toast/grouped.tsx +23 -0
- package/registry/examples/toast/undo.d.ts +4 -0
- package/registry/examples/toast/undo.js +29 -0
- package/registry/examples/toast/undo.tsx +30 -0
- package/registry/examples/toast/upload-progress.d.ts +4 -0
- package/registry/examples/toast/upload-progress.js +29 -0
- package/registry/examples/toast/upload-progress.tsx +31 -0
- package/registry/examples/video-player/default.d.ts +4 -0
- package/registry/examples/video-player/default.js +12 -0
- package/registry/examples/video-player/default.tsx +8 -0
- package/registry/examples/video-player/gated.d.ts +4 -0
- package/registry/examples/video-player/gated.js +26 -0
- package/registry/examples/video-player/gated.tsx +23 -0
- package/registry/examples/video-player/native/default.d.ts +4 -0
- package/registry/examples/video-player/native/default.dark.png +0 -0
- package/registry/examples/video-player/native/default.js +18 -0
- package/registry/examples/video-player/native/default.light.png +0 -0
- package/registry/examples/video-player/native/default.tsx +12 -0
- package/registry/examples/video-player/signed-source.d.ts +4 -0
- package/registry/examples/video-player/signed-source.js +16 -0
- package/registry/examples/video-player/signed-source.tsx +15 -0
- package/registry/examples/video-player/vertical.d.ts +4 -0
- package/registry/examples/video-player/vertical.js +12 -0
- package/registry/examples/video-player/vertical.tsx +12 -0
- package/registry/examples/video-trimmer/custom.d.ts +4 -0
- package/registry/examples/video-trimmer/custom.js +24 -0
- package/registry/examples/video-trimmer/custom.tsx +26 -0
- package/registry/examples/video-trimmer/filmstrip.d.ts +4 -0
- package/registry/examples/video-trimmer/filmstrip.js +15 -0
- package/registry/examples/video-trimmer/filmstrip.tsx +13 -0
- package/registry/examples/video-trimmer/playhead.d.ts +4 -0
- package/registry/examples/video-trimmer/playhead.js +15 -0
- package/registry/examples/video-trimmer/playhead.tsx +13 -0
- package/registry/field.json +1 -1
- package/registry/file-upload.json +471 -0
- package/registry/filter-bar.json +347 -0
- package/registry/glow-card.json +162 -0
- package/registry/image-cropper.json +313 -0
- package/registry/index.json +445 -20
- package/registry/iso.json +1355 -0
- package/registry/kbd.json +1 -1
- package/registry/loader.json +399 -0
- package/registry/marquee.json +225 -0
- package/registry/mascots.json +3 -3
- package/registry/media-capture.json +347 -0
- package/registry/meter.json +324 -0
- package/registry/nav-bar.json +480 -0
- package/registry/number-ticker.json +219 -0
- package/registry/page-header.json +1 -1
- package/registry/pagination.json +475 -0
- package/registry/popover.json +1 -1
- package/registry/progress.json +114 -9
- package/registry/radio-group.json +1 -1
- package/registry/search-field.json +436 -0
- package/registry/section-backdrop.json +1 -1
- package/registry/separator.json +1 -1
- package/registry/skeleton.json +69 -13
- package/registry/slider.json +1 -1
- package/registry/slot.json +1 -1
- package/registry/spinner.json +91 -27
- package/registry/stat.json +1 -1
- package/registry/stepper.json +174 -0
- package/registry/switch.json +1 -1
- package/registry/tabs.json +11 -7
- package/registry/tag-input.json +363 -0
- package/registry/theme.json +3 -3
- package/registry/toast.json +41 -13
- package/registry/tooltip.json +1 -1
- package/registry/video-player.json +598 -0
- package/registry/video-trimmer.json +385 -0
- package/dist/chunk-FHYZSO2S.js.map +0 -1
- package/dist/chunk-PESA2R4U.js +0 -51
- package/dist/chunk-PESA2R4U.js.map +0 -1
- package/registry/examples/spinner/muted.js +0 -11
- package/registry/examples/spinner/muted.tsx +0 -6
- /package/registry/examples/{spinner/muted.d.ts → audio-player/podcast.d.ts} +0 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
declare const videoTrimmer: tailwind_variants.TVReturnType<{
|
|
5
|
+
[key: string]: {
|
|
6
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
7
|
+
root?: tailwind_variants.ClassValue;
|
|
8
|
+
header?: tailwind_variants.ClassValue;
|
|
9
|
+
kept?: tailwind_variants.ClassValue;
|
|
10
|
+
track?: tailwind_variants.ClassValue;
|
|
11
|
+
strip?: tailwind_variants.ClassValue;
|
|
12
|
+
frame?: tailwind_variants.ClassValue;
|
|
13
|
+
shade?: tailwind_variants.ClassValue;
|
|
14
|
+
range?: tailwind_variants.ClassValue;
|
|
15
|
+
grip?: tailwind_variants.ClassValue;
|
|
16
|
+
handle?: tailwind_variants.ClassValue;
|
|
17
|
+
playhead?: tailwind_variants.ClassValue;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
} | {
|
|
21
|
+
[x: string]: {
|
|
22
|
+
[x: string]: tailwind_variants.ClassValue | {
|
|
23
|
+
root?: tailwind_variants.ClassValue;
|
|
24
|
+
header?: tailwind_variants.ClassValue;
|
|
25
|
+
kept?: tailwind_variants.ClassValue;
|
|
26
|
+
track?: tailwind_variants.ClassValue;
|
|
27
|
+
strip?: tailwind_variants.ClassValue;
|
|
28
|
+
frame?: tailwind_variants.ClassValue;
|
|
29
|
+
shade?: tailwind_variants.ClassValue;
|
|
30
|
+
range?: tailwind_variants.ClassValue;
|
|
31
|
+
grip?: tailwind_variants.ClassValue;
|
|
32
|
+
handle?: tailwind_variants.ClassValue;
|
|
33
|
+
playhead?: tailwind_variants.ClassValue;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
} | {}, {
|
|
37
|
+
root: string;
|
|
38
|
+
header: string;
|
|
39
|
+
kept: string;
|
|
40
|
+
track: string;
|
|
41
|
+
strip: string;
|
|
42
|
+
frame: string;
|
|
43
|
+
shade: string;
|
|
44
|
+
range: string;
|
|
45
|
+
handle: string;
|
|
46
|
+
grip: string;
|
|
47
|
+
playhead: string;
|
|
48
|
+
}, undefined, {
|
|
49
|
+
[key: string]: {
|
|
50
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
51
|
+
root?: tailwind_variants.ClassValue;
|
|
52
|
+
header?: tailwind_variants.ClassValue;
|
|
53
|
+
kept?: tailwind_variants.ClassValue;
|
|
54
|
+
track?: tailwind_variants.ClassValue;
|
|
55
|
+
strip?: tailwind_variants.ClassValue;
|
|
56
|
+
frame?: tailwind_variants.ClassValue;
|
|
57
|
+
shade?: tailwind_variants.ClassValue;
|
|
58
|
+
range?: tailwind_variants.ClassValue;
|
|
59
|
+
grip?: tailwind_variants.ClassValue;
|
|
60
|
+
handle?: tailwind_variants.ClassValue;
|
|
61
|
+
playhead?: tailwind_variants.ClassValue;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
} | {}, {
|
|
65
|
+
root: string;
|
|
66
|
+
header: string;
|
|
67
|
+
kept: string;
|
|
68
|
+
track: string;
|
|
69
|
+
strip: string;
|
|
70
|
+
frame: string;
|
|
71
|
+
shade: string;
|
|
72
|
+
range: string;
|
|
73
|
+
handle: string;
|
|
74
|
+
grip: string;
|
|
75
|
+
playhead: string;
|
|
76
|
+
}, tailwind_variants.TVReturnTypeLike<unknown, {
|
|
77
|
+
root: string;
|
|
78
|
+
header: string;
|
|
79
|
+
kept: string;
|
|
80
|
+
track: string;
|
|
81
|
+
strip: string;
|
|
82
|
+
frame: string;
|
|
83
|
+
shade: string;
|
|
84
|
+
range: string;
|
|
85
|
+
handle: string;
|
|
86
|
+
grip: string;
|
|
87
|
+
playhead: string;
|
|
88
|
+
}>>;
|
|
89
|
+
type Part = keyof ReturnType<typeof videoTrimmer>;
|
|
90
|
+
type VideoTrimmerLabels = {
|
|
91
|
+
/** The start handle ("Start"). */
|
|
92
|
+
start: string;
|
|
93
|
+
/** The end handle ("End"). */
|
|
94
|
+
end: string;
|
|
95
|
+
/** The playhead ("Playhead"). */
|
|
96
|
+
playhead: string;
|
|
97
|
+
/** The length kept, above the track: `(length) => length + " kept"` (the length already formatted). */
|
|
98
|
+
kept: (length: string) => string;
|
|
99
|
+
};
|
|
100
|
+
declare const videoTrimmerLabels: VideoTrimmerLabels;
|
|
101
|
+
type VideoTrimmerProps = {
|
|
102
|
+
/** The length of the clip, in seconds. */
|
|
103
|
+
duration: number;
|
|
104
|
+
/** The part kept, `[start, end]` in seconds (controlled). */
|
|
105
|
+
value?: readonly [number, number];
|
|
106
|
+
/** The part kept at first, uncontrolled. Default: the whole clip. */
|
|
107
|
+
defaultValue?: readonly [number, number];
|
|
108
|
+
/** Called on every move of a handle. */
|
|
109
|
+
onValueChange?: (value: [number, number]) => void;
|
|
110
|
+
/** Called once a drag or a key press ends: render a preview, save. */
|
|
111
|
+
onValueCommit?: (value: [number, number]) => void;
|
|
112
|
+
/** The time played, in seconds: shows the playhead. */
|
|
113
|
+
time?: number;
|
|
114
|
+
/** Called when the playhead is moved (a drag on the track, the arrows on the playhead). */
|
|
115
|
+
onSeek?: (time: number) => void;
|
|
116
|
+
/** The shortest part that can be kept, in seconds. Default 0.5. */
|
|
117
|
+
minLength?: number;
|
|
118
|
+
/** One arrow press, in seconds. Default 0.1. */
|
|
119
|
+
step?: number;
|
|
120
|
+
/** Shift + arrow, Page Up / Page Down, in seconds. Default 1. */
|
|
121
|
+
largeStep?: number;
|
|
122
|
+
/** Pictures of the clip, in order: the filmstrip. */
|
|
123
|
+
frames?: readonly string[];
|
|
124
|
+
/** Track content instead of the filmstrip (a waveform, a coloured band). */
|
|
125
|
+
children?: React.ReactNode;
|
|
126
|
+
/** A time as read and shown. Default `m:ss` with tenths. */
|
|
127
|
+
formatTime?: (seconds: number) => string;
|
|
128
|
+
/** Shows the times and the length kept above the track. Default `true`. */
|
|
129
|
+
showHeader?: boolean;
|
|
130
|
+
/** Not available (a render is running). */
|
|
131
|
+
disabled?: boolean;
|
|
132
|
+
/** Classes per part: `root`, `header`, `kept`, `track`, `strip`, `frame`, `shade`, `range`, `handle`, `grip`, `playhead`. */
|
|
133
|
+
classNames?: Partial<Record<Part, string>>;
|
|
134
|
+
/** The content of a handle (default: two grip lines). */
|
|
135
|
+
renderHandle?: (edge: "start" | "end") => React.ReactNode;
|
|
136
|
+
/** The words, passed translated; English by default. */
|
|
137
|
+
labels?: Partial<VideoTrimmerLabels>;
|
|
138
|
+
};
|
|
139
|
+
/** Keeps a part of a clip between two handles over its filmstrip, with a playhead to scrub — the keyboard included. */
|
|
140
|
+
declare function VideoTrimmer({ duration, value: valueProp, defaultValue, onValueChange, onValueCommit, time, onSeek, minLength, step, largeStep, frames, children, formatTime, showHeader, disabled, classNames, renderHandle, labels: given, }: VideoTrimmerProps): React.JSX.Element;
|
|
141
|
+
|
|
142
|
+
export { VideoTrimmer, type VideoTrimmerLabels, type VideoTrimmerProps, videoTrimmer, videoTrimmerLabels };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
clamp,
|
|
4
|
+
formatClock
|
|
5
|
+
} from "./chunk-EUPTXKH7.js";
|
|
6
|
+
|
|
7
|
+
// src/video-trimmer/video-trimmer.tsx
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { tv } from "tailwind-variants";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var videoTrimmer = tv({
|
|
12
|
+
slots: {
|
|
13
|
+
root: "w-full select-none",
|
|
14
|
+
header: "mb-2 flex items-center justify-between font-mono text-[11px] tabular-nums text-fg-secondary",
|
|
15
|
+
kept: "rounded-full bg-accent-soft px-2.5 py-0.5 font-sans text-xs font-semibold text-fg",
|
|
16
|
+
track: "relative h-16 touch-none rounded-xl bg-surface-2 data-[disabled]:opacity-50",
|
|
17
|
+
strip: "pointer-events-none absolute inset-0 flex overflow-hidden rounded-xl",
|
|
18
|
+
frame: "h-full min-w-0 flex-1 object-cover",
|
|
19
|
+
shade: "pointer-events-none absolute inset-y-0 bg-scrim-strong",
|
|
20
|
+
range: "pointer-events-none absolute inset-y-0 border-y-[3px] border-accent",
|
|
21
|
+
handle: "absolute inset-y-0 z-10 flex w-6 cursor-ew-resize items-center justify-center bg-accent text-on-accent shadow-md focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface-0 data-[edge=start]:rounded-l-xl data-[edge=end]:-translate-x-full data-[edge=end]:rounded-r-xl",
|
|
22
|
+
grip: "flex gap-[3px] [&>span]:h-5 [&>span]:w-[2px] [&>span]:rounded-sm [&>span]:bg-on-accent/70",
|
|
23
|
+
playhead: "absolute -inset-y-1.5 z-20 w-[3px] -translate-x-1/2 cursor-ew-resize rounded-full bg-fg shadow-md focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring"
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
var videoTrimmerLabels = {
|
|
27
|
+
start: "Start",
|
|
28
|
+
end: "End",
|
|
29
|
+
playhead: "Playhead",
|
|
30
|
+
kept: (length) => `${length} kept`
|
|
31
|
+
};
|
|
32
|
+
var tenths = (seconds) => `${formatClock(seconds)}.${Math.floor(Math.max(0, seconds) % 1 * 10)}`;
|
|
33
|
+
function VideoTrimmer({
|
|
34
|
+
duration,
|
|
35
|
+
value: valueProp,
|
|
36
|
+
defaultValue,
|
|
37
|
+
onValueChange,
|
|
38
|
+
onValueCommit,
|
|
39
|
+
time,
|
|
40
|
+
onSeek,
|
|
41
|
+
minLength = 0.5,
|
|
42
|
+
step = 0.1,
|
|
43
|
+
largeStep = 1,
|
|
44
|
+
frames,
|
|
45
|
+
children,
|
|
46
|
+
formatTime = tenths,
|
|
47
|
+
showHeader = true,
|
|
48
|
+
disabled,
|
|
49
|
+
classNames = {},
|
|
50
|
+
renderHandle,
|
|
51
|
+
labels: given
|
|
52
|
+
}) {
|
|
53
|
+
const labels = { ...videoTrimmerLabels, ...given };
|
|
54
|
+
const s = videoTrimmer();
|
|
55
|
+
const track = React.useRef(null);
|
|
56
|
+
const grip = React.useRef(null);
|
|
57
|
+
const [inner, setInner] = React.useState(() => [defaultValue?.[0] ?? 0, defaultValue?.[1] ?? duration]);
|
|
58
|
+
const [start, end] = valueProp ?? inner;
|
|
59
|
+
const total = duration > 0 ? duration : 1;
|
|
60
|
+
const pct = (seconds) => clamp(seconds, 0, total) / total * 100;
|
|
61
|
+
const set = (next, commit = false) => {
|
|
62
|
+
if (!valueProp) setInner(next);
|
|
63
|
+
onValueChange?.(next);
|
|
64
|
+
if (commit) onValueCommit?.(next);
|
|
65
|
+
};
|
|
66
|
+
const move = (edge, to, commit = false) => {
|
|
67
|
+
const next = edge === "start" ? [clamp(to, 0, end - minLength), end] : [start, clamp(to, start + minLength, duration)];
|
|
68
|
+
set([Math.round(next[0] * 1e3) / 1e3, Math.round(next[1] * 1e3) / 1e3], commit);
|
|
69
|
+
};
|
|
70
|
+
const seek = (to) => onSeek?.(clamp(to, start, Math.max(start, end - 0.05)));
|
|
71
|
+
const at = (clientX) => {
|
|
72
|
+
const box = track.current?.getBoundingClientRect();
|
|
73
|
+
if (!box || box.width === 0) return 0;
|
|
74
|
+
return clamp((clientX - box.left) / box.width * duration, 0, duration);
|
|
75
|
+
};
|
|
76
|
+
const keys = (which) => (event) => {
|
|
77
|
+
const current = which === "start" ? start : which === "end" ? end : time ?? start;
|
|
78
|
+
const big = largeStep;
|
|
79
|
+
const small = event.shiftKey ? largeStep : step;
|
|
80
|
+
const target = {
|
|
81
|
+
ArrowLeft: current - small,
|
|
82
|
+
ArrowDown: current - small,
|
|
83
|
+
ArrowRight: current + small,
|
|
84
|
+
ArrowUp: current + small,
|
|
85
|
+
PageDown: current - big,
|
|
86
|
+
PageUp: current + big,
|
|
87
|
+
Home: 0,
|
|
88
|
+
End: duration
|
|
89
|
+
};
|
|
90
|
+
const to = target[event.key];
|
|
91
|
+
if (to === void 0 || disabled) return;
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
if (which === "playhead") seek(to);
|
|
94
|
+
else move(which, to, true);
|
|
95
|
+
};
|
|
96
|
+
const handle = (edge) => {
|
|
97
|
+
const own = edge === "start" ? start : end;
|
|
98
|
+
return /* @__PURE__ */ jsx(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
role: "slider",
|
|
102
|
+
tabIndex: disabled ? -1 : 0,
|
|
103
|
+
"aria-label": edge === "start" ? labels.start : labels.end,
|
|
104
|
+
"aria-valuemin": edge === "start" ? 0 : Math.round((start + minLength) * 10) / 10,
|
|
105
|
+
"aria-valuemax": edge === "start" ? Math.round((end - minLength) * 10) / 10 : Math.round(duration * 10) / 10,
|
|
106
|
+
"aria-valuenow": Math.round(own * 10) / 10,
|
|
107
|
+
"aria-valuetext": formatTime(own),
|
|
108
|
+
"aria-disabled": disabled || void 0,
|
|
109
|
+
"data-edge": edge,
|
|
110
|
+
className: s.handle({ className: classNames.handle }),
|
|
111
|
+
style: { left: `${pct(own)}%` },
|
|
112
|
+
onPointerDown: (event) => {
|
|
113
|
+
if (disabled) return;
|
|
114
|
+
event.stopPropagation();
|
|
115
|
+
track.current?.setPointerCapture?.(event.pointerId);
|
|
116
|
+
grip.current = edge;
|
|
117
|
+
},
|
|
118
|
+
onKeyDown: keys(edge),
|
|
119
|
+
children: renderHandle ? renderHandle(edge) : /* @__PURE__ */ jsxs("span", { className: s.grip({ className: classNames.grip }), children: [
|
|
120
|
+
/* @__PURE__ */ jsx("span", {}),
|
|
121
|
+
/* @__PURE__ */ jsx("span", {})
|
|
122
|
+
] })
|
|
123
|
+
},
|
|
124
|
+
edge
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
return /* @__PURE__ */ jsxs("div", { className: s.root({ className: classNames.root }), children: [
|
|
128
|
+
showHeader && /* @__PURE__ */ jsxs("div", { className: s.header({ className: classNames.header }), children: [
|
|
129
|
+
/* @__PURE__ */ jsx("span", { children: formatTime(start) }),
|
|
130
|
+
/* @__PURE__ */ jsx("span", { className: s.kept({ className: classNames.kept }), children: labels.kept(formatTime(end - start)) }),
|
|
131
|
+
/* @__PURE__ */ jsx("span", { children: formatTime(end) })
|
|
132
|
+
] }),
|
|
133
|
+
/* @__PURE__ */ jsxs(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
ref: track,
|
|
137
|
+
className: s.track({ className: classNames.track }),
|
|
138
|
+
"data-disabled": disabled ? "" : void 0,
|
|
139
|
+
onPointerDown: (event) => {
|
|
140
|
+
if (disabled) return;
|
|
141
|
+
track.current?.setPointerCapture?.(event.pointerId);
|
|
142
|
+
const t = at(event.clientX);
|
|
143
|
+
grip.current = onSeek ? "playhead" : Math.abs(t - start) < Math.abs(t - end) ? "start" : "end";
|
|
144
|
+
if (grip.current === "playhead") seek(t);
|
|
145
|
+
else move(grip.current, t);
|
|
146
|
+
},
|
|
147
|
+
onPointerMove: (event) => {
|
|
148
|
+
if (!grip.current) return;
|
|
149
|
+
const t = at(event.clientX);
|
|
150
|
+
if (grip.current === "playhead") seek(t);
|
|
151
|
+
else move(grip.current, t);
|
|
152
|
+
},
|
|
153
|
+
onPointerUp: () => {
|
|
154
|
+
if (grip.current && grip.current !== "playhead") onValueCommit?.([start, end]);
|
|
155
|
+
grip.current = null;
|
|
156
|
+
},
|
|
157
|
+
onPointerCancel: () => {
|
|
158
|
+
grip.current = null;
|
|
159
|
+
},
|
|
160
|
+
children: [
|
|
161
|
+
/* @__PURE__ */ jsx("div", { className: s.strip({ className: classNames.strip }), children: children ?? frames?.map((src, i) => /* @__PURE__ */ jsx("img", { src, alt: "", draggable: false, className: s.frame({ className: classNames.frame }) }, `${i}-${src}`)) }),
|
|
162
|
+
/* @__PURE__ */ jsx("div", { className: s.shade({ className: classNames.shade }), style: { left: 0, width: `${pct(start)}%`, borderRadius: "0.75rem 0 0 0.75rem" } }),
|
|
163
|
+
/* @__PURE__ */ jsx("div", { className: s.shade({ className: classNames.shade }), style: { right: 0, width: `${100 - pct(end)}%`, borderRadius: "0 0.75rem 0.75rem 0" } }),
|
|
164
|
+
/* @__PURE__ */ jsx("div", { className: s.range({ className: classNames.range }), style: { left: `${pct(start)}%`, right: `${100 - pct(end)}%` } }),
|
|
165
|
+
time !== void 0 && /* @__PURE__ */ jsx(
|
|
166
|
+
"div",
|
|
167
|
+
{
|
|
168
|
+
role: "slider",
|
|
169
|
+
tabIndex: disabled || !onSeek ? -1 : 0,
|
|
170
|
+
"aria-label": labels.playhead,
|
|
171
|
+
"aria-valuemin": Math.round(start * 10) / 10,
|
|
172
|
+
"aria-valuemax": Math.round(end * 10) / 10,
|
|
173
|
+
"aria-valuenow": Math.round(time * 10) / 10,
|
|
174
|
+
"aria-valuetext": formatTime(time),
|
|
175
|
+
"aria-readonly": !onSeek || void 0,
|
|
176
|
+
className: s.playhead({ className: classNames.playhead }),
|
|
177
|
+
style: { left: `${pct(time)}%` },
|
|
178
|
+
onKeyDown: onSeek ? keys("playhead") : void 0
|
|
179
|
+
}
|
|
180
|
+
),
|
|
181
|
+
handle("start"),
|
|
182
|
+
handle("end")
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
] });
|
|
187
|
+
}
|
|
188
|
+
export {
|
|
189
|
+
VideoTrimmer,
|
|
190
|
+
videoTrimmer,
|
|
191
|
+
videoTrimmerLabels
|
|
192
|
+
};
|
|
193
|
+
//# sourceMappingURL=video-trimmer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/video-trimmer/video-trimmer.tsx"],"sourcesContent":["// Client. The trim timeline of a video editor: the clip as a filmstrip (or any track content), the part kept framed\n// between two edge handles — each a `slider` named by a prop, its value read as a time, never past the other one —\n// the outside dimmed, and a playhead to scrub. The handles sit on their value by their outer edge (the start handle\n// to the right of its value, the end handle to its left), so the frame encloses exactly what is kept. Every part\n// takes its own classes (`classNames`) and the handles their own content (`renderHandle`).\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { clamp, formatClock } from \"../media\";\n\nexport const videoTrimmer = tv({\n slots: {\n root: \"w-full select-none\",\n header: \"mb-2 flex items-center justify-between font-mono text-[11px] tabular-nums text-fg-secondary\",\n kept: \"rounded-full bg-accent-soft px-2.5 py-0.5 font-sans text-xs font-semibold text-fg\",\n track: \"relative h-16 touch-none rounded-xl bg-surface-2 data-[disabled]:opacity-50\",\n strip: \"pointer-events-none absolute inset-0 flex overflow-hidden rounded-xl\",\n frame: \"h-full min-w-0 flex-1 object-cover\",\n shade: \"pointer-events-none absolute inset-y-0 bg-scrim-strong\",\n range: \"pointer-events-none absolute inset-y-0 border-y-[3px] border-accent\",\n handle:\n \"absolute inset-y-0 z-10 flex w-6 cursor-ew-resize items-center justify-center bg-accent text-on-accent shadow-md \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface-0 \" +\n \"data-[edge=start]:rounded-l-xl data-[edge=end]:-translate-x-full data-[edge=end]:rounded-r-xl\",\n grip: \"flex gap-[3px] [&>span]:h-5 [&>span]:w-[2px] [&>span]:rounded-sm [&>span]:bg-on-accent/70\",\n playhead:\n \"absolute -inset-y-1.5 z-20 w-[3px] -translate-x-1/2 cursor-ew-resize rounded-full bg-fg shadow-md \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\",\n },\n});\n\ntype Part = keyof ReturnType<typeof videoTrimmer>;\n\nexport type VideoTrimmerLabels = {\n /** The start handle (\"Start\"). */\n start: string;\n /** The end handle (\"End\"). */\n end: string;\n /** The playhead (\"Playhead\"). */\n playhead: string;\n /** The length kept, above the track: `(length) => length + \" kept\"` (the length already formatted). */\n kept: (length: string) => string;\n};\n\nexport const videoTrimmerLabels: VideoTrimmerLabels = {\n start: \"Start\",\n end: \"End\",\n playhead: \"Playhead\",\n kept: (length) => `${length} kept`,\n};\n\nexport type VideoTrimmerProps = {\n /** The length of the clip, in seconds. */\n duration: number;\n /** The part kept, `[start, end]` in seconds (controlled). */\n value?: readonly [number, number];\n /** The part kept at first, uncontrolled. Default: the whole clip. */\n defaultValue?: readonly [number, number];\n /** Called on every move of a handle. */\n onValueChange?: (value: [number, number]) => void;\n /** Called once a drag or a key press ends: render a preview, save. */\n onValueCommit?: (value: [number, number]) => void;\n /** The time played, in seconds: shows the playhead. */\n time?: number;\n /** Called when the playhead is moved (a drag on the track, the arrows on the playhead). */\n onSeek?: (time: number) => void;\n /** The shortest part that can be kept, in seconds. Default 0.5. */\n minLength?: number;\n /** One arrow press, in seconds. Default 0.1. */\n step?: number;\n /** Shift + arrow, Page Up / Page Down, in seconds. Default 1. */\n largeStep?: number;\n /** Pictures of the clip, in order: the filmstrip. */\n frames?: readonly string[];\n /** Track content instead of the filmstrip (a waveform, a coloured band). */\n children?: React.ReactNode;\n /** A time as read and shown. Default `m:ss` with tenths. */\n formatTime?: (seconds: number) => string;\n /** Shows the times and the length kept above the track. Default `true`. */\n showHeader?: boolean;\n /** Not available (a render is running). */\n disabled?: boolean;\n /** Classes per part: `root`, `header`, `kept`, `track`, `strip`, `frame`, `shade`, `range`, `handle`, `grip`, `playhead`. */\n classNames?: Partial<Record<Part, string>>;\n /** The content of a handle (default: two grip lines). */\n renderHandle?: (edge: \"start\" | \"end\") => React.ReactNode;\n /** The words, passed translated; English by default. */\n labels?: Partial<VideoTrimmerLabels>;\n};\n\nconst tenths = (seconds: number) => `${formatClock(seconds)}.${Math.floor((Math.max(0, seconds) % 1) * 10)}`;\n\ntype Grip = \"start\" | \"end\" | \"playhead\";\n\n/** Keeps a part of a clip between two handles over its filmstrip, with a playhead to scrub — the keyboard included. */\nexport function VideoTrimmer({\n duration,\n value: valueProp,\n defaultValue,\n onValueChange,\n onValueCommit,\n time,\n onSeek,\n minLength = 0.5,\n step = 0.1,\n largeStep = 1,\n frames,\n children,\n formatTime = tenths,\n showHeader = true,\n disabled,\n classNames = {},\n renderHandle,\n labels: given,\n}: VideoTrimmerProps) {\n const labels = { ...videoTrimmerLabels, ...given };\n const s = videoTrimmer();\n const track = React.useRef<HTMLDivElement>(null);\n const grip = React.useRef<Grip | null>(null);\n const [inner, setInner] = React.useState<[number, number]>(() => [defaultValue?.[0] ?? 0, defaultValue?.[1] ?? duration]);\n const [start, end] = valueProp ?? inner;\n const total = duration > 0 ? duration : 1;\n const pct = (seconds: number) => (clamp(seconds, 0, total) / total) * 100;\n\n const set = (next: [number, number], commit = false) => {\n if (!valueProp) setInner(next);\n onValueChange?.(next);\n if (commit) onValueCommit?.(next);\n };\n const move = (edge: \"start\" | \"end\", to: number, commit = false) => {\n const next: [number, number] =\n edge === \"start\" ? [clamp(to, 0, end - minLength), end] : [start, clamp(to, start + minLength, duration)];\n set([Math.round(next[0] * 1000) / 1000, Math.round(next[1] * 1000) / 1000], commit);\n };\n const seek = (to: number) => onSeek?.(clamp(to, start, Math.max(start, end - 0.05)));\n\n const at = (clientX: number) => {\n const box = track.current?.getBoundingClientRect();\n if (!box || box.width === 0) return 0;\n return clamp(((clientX - box.left) / box.width) * duration, 0, duration);\n };\n\n const keys = (which: Grip) => (event: React.KeyboardEvent) => {\n const current = which === \"start\" ? start : which === \"end\" ? end : (time ?? start);\n const big = largeStep;\n const small = event.shiftKey ? largeStep : step;\n const target: Record<string, number> = {\n ArrowLeft: current - small,\n ArrowDown: current - small,\n ArrowRight: current + small,\n ArrowUp: current + small,\n PageDown: current - big,\n PageUp: current + big,\n Home: 0,\n End: duration,\n };\n const to = target[event.key];\n if (to === undefined || disabled) return;\n event.preventDefault();\n if (which === \"playhead\") seek(to);\n else move(which, to, true);\n };\n\n const handle = (edge: \"start\" | \"end\") => {\n const own = edge === \"start\" ? start : end;\n return (\n <div\n key={edge}\n role=\"slider\"\n tabIndex={disabled ? -1 : 0}\n aria-label={edge === \"start\" ? labels.start : labels.end}\n aria-valuemin={edge === \"start\" ? 0 : Math.round((start + minLength) * 10) / 10}\n aria-valuemax={edge === \"start\" ? Math.round((end - minLength) * 10) / 10 : Math.round(duration * 10) / 10}\n aria-valuenow={Math.round(own * 10) / 10}\n aria-valuetext={formatTime(own)}\n aria-disabled={disabled || undefined}\n data-edge={edge}\n className={s.handle({ className: classNames.handle })}\n style={{ left: `${pct(own)}%` }}\n onPointerDown={(event) => {\n if (disabled) return;\n event.stopPropagation();\n track.current?.setPointerCapture?.(event.pointerId);\n grip.current = edge;\n }}\n onKeyDown={keys(edge)}\n >\n {renderHandle ? (\n renderHandle(edge)\n ) : (\n <span className={s.grip({ className: classNames.grip })}>\n <span />\n <span />\n </span>\n )}\n </div>\n );\n };\n\n return (\n <div className={s.root({ className: classNames.root })}>\n {showHeader && (\n <div className={s.header({ className: classNames.header })}>\n <span>{formatTime(start)}</span>\n <span className={s.kept({ className: classNames.kept })}>{labels.kept(formatTime(end - start))}</span>\n <span>{formatTime(end)}</span>\n </div>\n )}\n <div\n ref={track}\n className={s.track({ className: classNames.track })}\n data-disabled={disabled ? \"\" : undefined}\n onPointerDown={(event) => {\n if (disabled) return;\n track.current?.setPointerCapture?.(event.pointerId);\n const t = at(event.clientX);\n grip.current = onSeek ? \"playhead\" : Math.abs(t - start) < Math.abs(t - end) ? \"start\" : \"end\";\n if (grip.current === \"playhead\") seek(t);\n else move(grip.current, t);\n }}\n onPointerMove={(event) => {\n if (!grip.current) return;\n const t = at(event.clientX);\n if (grip.current === \"playhead\") seek(t);\n else move(grip.current, t);\n }}\n onPointerUp={() => {\n if (grip.current && grip.current !== \"playhead\") onValueCommit?.([start, end]);\n grip.current = null;\n }}\n onPointerCancel={() => {\n grip.current = null;\n }}\n >\n <div className={s.strip({ className: classNames.strip })}>\n {children ?? frames?.map((src, i) => <img key={`${i}-${src}`} src={src} alt=\"\" draggable={false} className={s.frame({ className: classNames.frame })} />)}\n </div>\n <div className={s.shade({ className: classNames.shade })} style={{ left: 0, width: `${pct(start)}%`, borderRadius: \"0.75rem 0 0 0.75rem\" }} />\n <div className={s.shade({ className: classNames.shade })} style={{ right: 0, width: `${100 - pct(end)}%`, borderRadius: \"0 0.75rem 0.75rem 0\" }} />\n <div className={s.range({ className: classNames.range })} style={{ left: `${pct(start)}%`, right: `${100 - pct(end)}%` }} />\n {time !== undefined && (\n <div\n role=\"slider\"\n tabIndex={disabled || !onSeek ? -1 : 0}\n aria-label={labels.playhead}\n aria-valuemin={Math.round(start * 10) / 10}\n aria-valuemax={Math.round(end * 10) / 10}\n aria-valuenow={Math.round(time * 10) / 10}\n aria-valuetext={formatTime(time)}\n aria-readonly={!onSeek || undefined}\n className={s.playhead({ className: classNames.playhead })}\n style={{ left: `${pct(time)}%` }}\n onKeyDown={onSeek ? keys(\"playhead\") : undefined}\n />\n )}\n {handle(\"start\")}\n {handle(\"end\")}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAKA,YAAY,WAAW;AACvB,SAAS,UAAU;AAwLT,SACE,KADF;AApLH,IAAM,eAAe,GAAG;AAAA,EAC7B,OAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAA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