snice 3.1.0 → 3.3.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 +90 -41
- package/dist/components/accordion/snice-accordion-item.d.ts +2 -2
- package/dist/components/accordion/snice-accordion-item.js +9 -9
- package/dist/components/accordion/snice-accordion-item.js.map +1 -1
- package/dist/components/accordion/snice-accordion.d.ts +2 -2
- package/dist/components/accordion/snice-accordion.js +9 -9
- package/dist/components/accordion/snice-accordion.js.map +1 -1
- package/dist/components/actions/snice-actions.d.ts +28 -0
- package/dist/components/actions/snice-actions.js +220 -0
- package/dist/components/actions/snice-actions.js.map +1 -0
- package/dist/components/actions/snice-actions.types.d.ts +27 -0
- package/dist/components/alert/snice-alert.d.ts +2 -2
- package/dist/components/alert/snice-alert.js +9 -9
- package/dist/components/alert/snice-alert.js.map +1 -1
- package/dist/components/audio-recorder/snice-audio-recorder.d.ts +58 -0
- package/dist/components/audio-recorder/snice-audio-recorder.js +413 -0
- package/dist/components/audio-recorder/snice-audio-recorder.js.map +1 -0
- package/dist/components/audio-recorder/snice-audio-recorder.types.d.ts +28 -0
- package/dist/components/avatar/snice-avatar.d.ts +2 -2
- package/dist/components/avatar/snice-avatar.js +9 -9
- package/dist/components/avatar/snice-avatar.js.map +1 -1
- package/dist/components/badge/snice-badge.d.ts +2 -2
- package/dist/components/badge/snice-badge.js +10 -10
- package/dist/components/badge/snice-badge.js.map +1 -1
- package/dist/components/banner/snice-banner.d.ts +22 -0
- package/dist/components/banner/snice-banner.js +180 -0
- package/dist/components/banner/snice-banner.js.map +1 -0
- package/dist/components/banner/snice-banner.types.d.ts +14 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.d.ts +2 -2
- package/dist/components/breadcrumbs/snice-breadcrumbs.js +9 -9
- package/dist/components/breadcrumbs/snice-breadcrumbs.js.map +1 -1
- package/dist/components/button/snice-button.d.ts +2 -2
- package/dist/components/button/snice-button.js +9 -9
- package/dist/components/button/snice-button.js.map +1 -1
- package/dist/components/calendar/snice-calendar.d.ts +46 -0
- package/dist/components/calendar/snice-calendar.js +294 -0
- package/dist/components/calendar/snice-calendar.js.map +1 -0
- package/dist/components/calendar/snice-calendar.types.d.ts +34 -0
- package/dist/components/camera/snice-camera.d.ts +39 -0
- package/dist/components/camera/snice-camera.js +286 -0
- package/dist/components/camera/snice-camera.js.map +1 -0
- package/dist/components/camera/snice-camera.types.d.ts +28 -0
- package/dist/components/card/snice-card.d.ts +2 -2
- package/dist/components/card/snice-card.js +9 -9
- package/dist/components/card/snice-card.js.map +1 -1
- package/dist/components/carousel/snice-carousel.d.ts +32 -0
- package/dist/components/carousel/snice-carousel.js +279 -0
- package/dist/components/carousel/snice-carousel.js.map +1 -0
- package/dist/components/carousel/snice-carousel.types.d.ts +22 -0
- package/dist/components/chart/snice-chart.d.ts +73 -0
- package/dist/components/chart/snice-chart.js +940 -0
- package/dist/components/chart/snice-chart.js.map +1 -0
- package/dist/components/chart/snice-chart.types.d.ts +71 -0
- package/dist/components/chat/snice-chat.d.ts +98 -0
- package/dist/components/chat/snice-chat.js +589 -0
- package/dist/components/chat/snice-chat.js.map +1 -0
- package/dist/components/chat/snice-chat.types.d.ts +141 -0
- package/dist/components/checkbox/snice-checkbox.d.ts +2 -2
- package/dist/components/checkbox/snice-checkbox.js +9 -9
- package/dist/components/checkbox/snice-checkbox.js.map +1 -1
- package/dist/components/chip/snice-chip.d.ts +2 -2
- package/dist/components/chip/snice-chip.js +9 -9
- package/dist/components/chip/snice-chip.js.map +1 -1
- package/dist/components/code-block/snice-code-block.d.ts +15 -0
- package/dist/components/code-block/snice-code-block.js +141 -0
- package/dist/components/code-block/snice-code-block.js.map +1 -0
- package/dist/components/code-block/snice-code-block.types.d.ts +15 -0
- package/dist/components/color-display/snice-color-display.d.ts +14 -0
- package/dist/components/color-display/snice-color-display.js +151 -0
- package/dist/components/color-display/snice-color-display.js.map +1 -0
- package/dist/components/color-display/snice-color-display.types.d.ts +10 -0
- package/dist/components/color-picker/snice-color-picker.d.ts +50 -0
- package/dist/components/color-picker/snice-color-picker.js +489 -0
- package/dist/components/color-picker/snice-color-picker.js.map +1 -0
- package/dist/components/color-picker/snice-color-picker.types.d.ts +19 -0
- package/dist/components/command-palette/snice-command-palette.d.ts +47 -0
- package/dist/components/command-palette/snice-command-palette.js +428 -0
- package/dist/components/command-palette/snice-command-palette.js.map +1 -0
- package/dist/components/command-palette/snice-command-palette.types.d.ts +49 -0
- package/dist/components/date-picker/snice-date-picker.d.ts +2 -2
- package/dist/components/date-picker/snice-date-picker.js +10 -10
- package/dist/components/date-picker/snice-date-picker.js.map +1 -1
- package/dist/components/divider/snice-divider.d.ts +2 -2
- package/dist/components/divider/snice-divider.js +9 -9
- package/dist/components/divider/snice-divider.js.map +1 -1
- package/dist/components/doc/snice-doc.d.ts +93 -0
- package/dist/components/doc/snice-doc.js +626 -0
- package/dist/components/doc/snice-doc.js.map +1 -0
- package/dist/components/doc/snice-doc.types.d.ts +118 -0
- package/dist/components/draw/snice-draw.d.ts +71 -0
- package/dist/components/draw/snice-draw.js +709 -0
- package/dist/components/draw/snice-draw.js.map +1 -0
- package/dist/components/draw/snice-draw.types.d.ts +41 -0
- package/dist/components/drawer/snice-drawer.d.ts +2 -2
- package/dist/components/drawer/snice-drawer.js +9 -9
- package/dist/components/drawer/snice-drawer.js.map +1 -1
- package/dist/components/empty-state/snice-empty-state.d.ts +13 -0
- package/dist/components/empty-state/snice-empty-state.js +121 -0
- package/dist/components/empty-state/snice-empty-state.js.map +1 -0
- package/dist/components/empty-state/snice-empty-state.types.d.ts +9 -0
- package/dist/components/file-upload/snice-file-upload.d.ts +44 -0
- package/dist/components/file-upload/snice-file-upload.js +387 -0
- package/dist/components/file-upload/snice-file-upload.js.map +1 -0
- package/dist/components/file-upload/snice-file-upload.types.d.ts +22 -0
- package/dist/components/gantt/snice-gantt.d.ts +29 -0
- package/dist/components/gantt/snice-gantt.js +268 -0
- package/dist/components/gantt/snice-gantt.js.map +1 -0
- package/dist/components/gantt/snice-gantt.types.d.ts +23 -0
- package/dist/components/image/snice-image.d.ts +22 -0
- package/dist/components/image/snice-image.js +201 -0
- package/dist/components/image/snice-image.js.map +1 -0
- package/dist/components/image/snice-image.types.d.ts +17 -0
- package/dist/components/input/snice-input.d.ts +2 -2
- package/dist/components/input/snice-input.js +9 -9
- package/dist/components/input/snice-input.js.map +1 -1
- package/dist/components/kanban/snice-kanban.d.ts +31 -0
- package/dist/components/kanban/snice-kanban.js +243 -0
- package/dist/components/kanban/snice-kanban.js.map +1 -0
- package/dist/components/kanban/snice-kanban.types.d.ts +29 -0
- package/dist/components/kpi/snice-kpi.d.ts +16 -0
- package/dist/components/kpi/snice-kpi.js +162 -0
- package/dist/components/kpi/snice-kpi.js.map +1 -0
- package/dist/components/kpi/snice-kpi.types.d.ts +12 -0
- package/dist/components/layout/snice-layout-blog.d.ts +2 -2
- package/dist/components/layout/snice-layout-blog.js +9 -9
- package/dist/components/layout/snice-layout-blog.js.map +1 -1
- package/dist/components/layout/snice-layout-card.d.ts +2 -2
- package/dist/components/layout/snice-layout-card.js +9 -9
- package/dist/components/layout/snice-layout-card.js.map +1 -1
- package/dist/components/layout/snice-layout-centered.d.ts +2 -2
- package/dist/components/layout/snice-layout-centered.js +9 -9
- package/dist/components/layout/snice-layout-centered.js.map +1 -1
- package/dist/components/layout/snice-layout-dashboard.d.ts +2 -2
- package/dist/components/layout/snice-layout-dashboard.js +9 -9
- package/dist/components/layout/snice-layout-dashboard.js.map +1 -1
- package/dist/components/layout/snice-layout-fullscreen.d.ts +2 -2
- package/dist/components/layout/snice-layout-fullscreen.js +9 -9
- package/dist/components/layout/snice-layout-fullscreen.js.map +1 -1
- package/dist/components/layout/snice-layout-landing.d.ts +2 -2
- package/dist/components/layout/snice-layout-landing.js +9 -9
- package/dist/components/layout/snice-layout-landing.js.map +1 -1
- package/dist/components/layout/snice-layout-minimal.d.ts +2 -2
- package/dist/components/layout/snice-layout-minimal.js +9 -9
- package/dist/components/layout/snice-layout-minimal.js.map +1 -1
- package/dist/components/layout/snice-layout-sidebar.d.ts +2 -2
- package/dist/components/layout/snice-layout-sidebar.js +9 -9
- package/dist/components/layout/snice-layout-sidebar.js.map +1 -1
- package/dist/components/layout/snice-layout-split.d.ts +2 -2
- package/dist/components/layout/snice-layout-split.js +9 -9
- package/dist/components/layout/snice-layout-split.js.map +1 -1
- package/dist/components/layout/snice-layout.d.ts +2 -2
- package/dist/components/layout/snice-layout.js +9 -9
- package/dist/components/layout/snice-layout.js.map +1 -1
- package/dist/components/link/snice-link.d.ts +13 -0
- package/dist/components/link/snice-link.js +137 -0
- package/dist/components/link/snice-link.js.map +1 -0
- package/dist/components/link/snice-link.types.d.ts +11 -0
- package/dist/components/list/snice-list-item.d.ts +6 -0
- package/dist/components/list/snice-list-item.js +68 -0
- package/dist/components/list/snice-list-item.js.map +1 -0
- package/dist/components/list/snice-list.d.ts +23 -0
- package/dist/components/list/snice-list.js +270 -0
- package/dist/components/list/snice-list.js.map +1 -0
- package/dist/components/list/snice-list.types.d.ts +28 -0
- package/dist/components/location/snice-location.d.ts +35 -0
- package/dist/components/location/snice-location.js +238 -0
- package/dist/components/location/snice-location.js.map +1 -0
- package/dist/components/location/snice-location.types.d.ts +35 -0
- package/dist/components/login/snice-login.d.ts +2 -2
- package/dist/components/login/snice-login.js +9 -9
- package/dist/components/login/snice-login.js.map +1 -1
- package/dist/components/menu/snice-menu-divider.d.ts +4 -0
- package/dist/components/menu/snice-menu-divider.js +53 -0
- package/dist/components/menu/snice-menu-divider.js.map +1 -0
- package/dist/components/menu/snice-menu-item.d.ts +10 -0
- package/dist/components/menu/snice-menu-item.js +99 -0
- package/dist/components/menu/snice-menu-item.js.map +1 -0
- package/dist/components/menu/snice-menu-item.types.d.ts +9 -0
- package/dist/components/menu/snice-menu.d.ts +27 -0
- package/dist/components/menu/snice-menu.js +199 -0
- package/dist/components/menu/snice-menu.js.map +1 -0
- package/dist/components/menu/snice-menu.types.d.ts +18 -0
- package/dist/components/modal/snice-modal.d.ts +2 -2
- package/dist/components/modal/snice-modal.js +9 -9
- package/dist/components/modal/snice-modal.js.map +1 -1
- package/dist/components/nav/snice-nav.js +1 -1
- package/dist/components/nav/snice-nav.js.map +1 -1
- package/dist/components/pagination/snice-pagination.d.ts +2 -2
- package/dist/components/pagination/snice-pagination.js +8 -8
- package/dist/components/pagination/snice-pagination.js.map +1 -1
- package/dist/components/progress/snice-progress.d.ts +2 -2
- package/dist/components/progress/snice-progress.js +9 -9
- package/dist/components/progress/snice-progress.js.map +1 -1
- package/dist/components/qr-code/qrcode.d.ts +28 -0
- package/dist/components/qr-code/qrcode.js +906 -0
- package/dist/components/qr-code/qrcode.js.map +1 -0
- package/dist/components/qr-code/snice-qr-code.d.ts +35 -0
- package/dist/components/qr-code/snice-qr-code.js +256 -0
- package/dist/components/qr-code/snice-qr-code.js.map +1 -0
- package/dist/components/qr-code/snice-qr-code.types.d.ts +33 -0
- package/dist/components/radio/snice-radio.d.ts +2 -2
- package/dist/components/radio/snice-radio.js +9 -9
- package/dist/components/radio/snice-radio.js.map +1 -1
- package/dist/components/select/snice-option.d.ts +2 -2
- package/dist/components/select/snice-option.js +8 -8
- package/dist/components/select/snice-option.js.map +1 -1
- package/dist/components/select/snice-select.d.ts +2 -2
- package/dist/components/select/snice-select.js +9 -9
- package/dist/components/select/snice-select.js.map +1 -1
- package/dist/components/skeleton/snice-skeleton.d.ts +2 -2
- package/dist/components/skeleton/snice-skeleton.js +9 -9
- package/dist/components/skeleton/snice-skeleton.js.map +1 -1
- package/dist/components/slider/snice-slider.d.ts +53 -0
- package/dist/components/slider/snice-slider.js +479 -0
- package/dist/components/slider/snice-slider.js.map +1 -0
- package/dist/components/slider/snice-slider.types.d.ts +26 -0
- package/dist/components/snice-cell-C0slgOpe.js +4 -0
- package/dist/components/snice-cell-C0slgOpe.js.map +1 -0
- package/dist/components/sparkline/snice-sparkline.d.ts +21 -0
- package/dist/components/sparkline/snice-sparkline.js +228 -0
- package/dist/components/sparkline/snice-sparkline.js.map +1 -0
- package/dist/components/sparkline/snice-sparkline.types.d.ts +16 -0
- package/dist/components/spinner/snice-spinner.d.ts +10 -0
- package/dist/components/spinner/snice-spinner.js +109 -0
- package/dist/components/spinner/snice-spinner.js.map +1 -0
- package/dist/components/spinner/snice-spinner.types.d.ts +8 -0
- package/dist/components/split-pane/snice-split-pane.d.ts +32 -0
- package/dist/components/split-pane/snice-split-pane.js +191 -0
- package/dist/components/split-pane/snice-split-pane.js.map +1 -0
- package/dist/components/split-pane/snice-split-pane.types.d.ts +19 -0
- package/dist/components/stat/snice-stat.d.ts +14 -0
- package/dist/components/stat/snice-stat.js +140 -0
- package/dist/components/stat/snice-stat.js.map +1 -0
- package/dist/components/stat/snice-stat.types.d.ts +12 -0
- package/dist/components/stepper/snice-stepper-panel.d.ts +8 -0
- package/dist/components/stepper/snice-stepper-panel.js +70 -0
- package/dist/components/stepper/snice-stepper-panel.js.map +1 -0
- package/dist/components/stepper/snice-stepper-panel.types.d.ts +4 -0
- package/dist/components/stepper/snice-stepper.d.ts +15 -0
- package/dist/components/stepper/snice-stepper.js +163 -0
- package/dist/components/stepper/snice-stepper.js.map +1 -0
- package/dist/components/stepper/snice-stepper.types.d.ts +13 -0
- package/dist/components/switch/snice-switch.d.ts +2 -2
- package/dist/components/switch/snice-switch.js +9 -9
- package/dist/components/switch/snice-switch.js.map +1 -1
- package/dist/components/table/snice-cell-actions.d.ts +2 -2
- package/dist/components/table/snice-cell-actions.js +9 -9
- package/dist/components/table/snice-cell-actions.js.map +1 -1
- package/dist/components/table/snice-cell-boolean.d.ts +2 -2
- package/dist/components/table/snice-cell-boolean.js +9 -9
- package/dist/components/table/snice-cell-boolean.js.map +1 -1
- package/dist/components/table/snice-cell-color.d.ts +2 -2
- package/dist/components/table/snice-cell-color.js +9 -9
- package/dist/components/table/snice-cell-color.js.map +1 -1
- package/dist/components/table/snice-cell-currency.d.ts +2 -2
- package/dist/components/table/snice-cell-currency.js +9 -9
- package/dist/components/table/snice-cell-currency.js.map +1 -1
- package/dist/components/table/snice-cell-date.d.ts +2 -2
- package/dist/components/table/snice-cell-date.js +9 -9
- package/dist/components/table/snice-cell-date.js.map +1 -1
- package/dist/components/table/snice-cell-duration.d.ts +2 -2
- package/dist/components/table/snice-cell-duration.js +9 -9
- package/dist/components/table/snice-cell-duration.js.map +1 -1
- package/dist/components/table/snice-cell-email.d.ts +2 -2
- package/dist/components/table/snice-cell-email.js +9 -9
- package/dist/components/table/snice-cell-email.js.map +1 -1
- package/dist/components/table/snice-cell-filesize.d.ts +2 -2
- package/dist/components/table/snice-cell-filesize.js +9 -9
- package/dist/components/table/snice-cell-filesize.js.map +1 -1
- package/dist/components/table/snice-cell-image.d.ts +2 -2
- package/dist/components/table/snice-cell-image.js +9 -9
- package/dist/components/table/snice-cell-image.js.map +1 -1
- package/dist/components/table/snice-cell-json.d.ts +2 -2
- package/dist/components/table/snice-cell-json.js +9 -9
- package/dist/components/table/snice-cell-json.js.map +1 -1
- package/dist/components/table/snice-cell-link.d.ts +2 -2
- package/dist/components/table/snice-cell-link.js +9 -9
- package/dist/components/table/snice-cell-link.js.map +1 -1
- package/dist/components/table/snice-cell-location.d.ts +2 -2
- package/dist/components/table/snice-cell-location.js +9 -9
- package/dist/components/table/snice-cell-location.js.map +1 -1
- package/dist/components/table/snice-cell-number.d.ts +2 -2
- package/dist/components/table/snice-cell-number.js +9 -9
- package/dist/components/table/snice-cell-number.js.map +1 -1
- package/dist/components/table/snice-cell-percentage.d.ts +2 -2
- package/dist/components/table/snice-cell-percentage.js +9 -9
- package/dist/components/table/snice-cell-percentage.js.map +1 -1
- package/dist/components/table/snice-cell-phone.d.ts +2 -2
- package/dist/components/table/snice-cell-phone.js +9 -9
- package/dist/components/table/snice-cell-phone.js.map +1 -1
- package/dist/components/table/snice-cell-progress.d.ts +2 -2
- package/dist/components/table/snice-cell-progress.js +9 -9
- package/dist/components/table/snice-cell-progress.js.map +1 -1
- package/dist/components/table/snice-cell-rating.d.ts +2 -2
- package/dist/components/table/snice-cell-rating.js +9 -9
- package/dist/components/table/snice-cell-rating.js.map +1 -1
- package/dist/components/table/snice-cell-sparkline.d.ts +2 -2
- package/dist/components/table/snice-cell-sparkline.js +9 -9
- package/dist/components/table/snice-cell-sparkline.js.map +1 -1
- package/dist/components/table/snice-cell-status.d.ts +2 -2
- package/dist/components/table/snice-cell-status.js +9 -9
- package/dist/components/table/snice-cell-status.js.map +1 -1
- package/dist/components/table/snice-cell-tag.d.ts +2 -2
- package/dist/components/table/snice-cell-tag.js +9 -9
- package/dist/components/table/snice-cell-tag.js.map +1 -1
- package/dist/components/table/snice-cell-text.d.ts +2 -2
- package/dist/components/table/snice-cell-text.js +9 -9
- package/dist/components/table/snice-cell-text.js.map +1 -1
- package/dist/components/table/snice-cell.d.ts +2 -2
- package/dist/components/table/snice-cell.js +9 -9
- package/dist/components/table/snice-cell.js.map +1 -1
- package/dist/components/table/snice-column.d.ts +1 -1
- package/dist/components/table/snice-column.js +4 -4
- package/dist/components/table/snice-column.js.map +1 -1
- package/dist/components/table/snice-header.d.ts +2 -2
- package/dist/components/table/snice-header.js +9 -9
- package/dist/components/table/snice-header.js.map +1 -1
- package/dist/components/table/snice-progress.d.ts +2 -2
- package/dist/components/table/snice-progress.js +8 -8
- package/dist/components/table/snice-progress.js.map +1 -1
- package/dist/components/table/snice-rating.d.ts +2 -2
- package/dist/components/table/snice-rating.js +8 -8
- package/dist/components/table/snice-rating.js.map +1 -1
- package/dist/components/table/snice-row.d.ts +2 -2
- package/dist/components/table/snice-row.js +10 -10
- package/dist/components/table/snice-row.js.map +1 -1
- package/dist/components/table/snice-table.d.ts +2 -3
- package/dist/components/table/snice-table.js +9 -14
- package/dist/components/table/snice-table.js.map +1 -1
- package/dist/components/tabs/snice-tab-panel.d.ts +2 -2
- package/dist/components/tabs/snice-tab-panel.js +9 -9
- package/dist/components/tabs/snice-tab-panel.js.map +1 -1
- package/dist/components/tabs/snice-tab.d.ts +2 -2
- package/dist/components/tabs/snice-tab.js +9 -9
- package/dist/components/tabs/snice-tab.js.map +1 -1
- package/dist/components/tabs/snice-tabs.d.ts +2 -2
- package/dist/components/tabs/snice-tabs.js +9 -9
- package/dist/components/tabs/snice-tabs.js.map +1 -1
- package/dist/components/terminal/snice-terminal.types.d.ts +133 -0
- package/dist/components/textarea/snice-textarea.d.ts +52 -0
- package/dist/components/textarea/snice-textarea.js +407 -0
- package/dist/components/textarea/snice-textarea.js.map +1 -0
- package/dist/components/textarea/snice-textarea.types.d.ts +30 -0
- package/dist/components/timeline/snice-timeline.d.ts +11 -0
- package/dist/components/timeline/snice-timeline.js +112 -0
- package/dist/components/timeline/snice-timeline.js.map +1 -0
- package/dist/components/timeline/snice-timeline.types.d.ts +16 -0
- package/dist/components/toast/snice-toast-container.d.ts +2 -2
- package/dist/components/toast/snice-toast-container.js +8 -8
- package/dist/components/toast/snice-toast-container.js.map +1 -1
- package/dist/components/toast/snice-toast.d.ts +2 -2
- package/dist/components/toast/snice-toast.js +8 -8
- package/dist/components/toast/snice-toast.js.map +1 -1
- package/dist/components/tooltip/snice-tooltip.d.ts +2 -2
- package/dist/components/tooltip/snice-tooltip.js +10 -10
- package/dist/components/tooltip/snice-tooltip.js.map +1 -1
- package/dist/components/tree/snice-tree-item.d.ts +35 -0
- package/dist/components/tree/snice-tree-item.js +301 -0
- package/dist/components/tree/snice-tree-item.js.map +1 -0
- package/dist/components/tree/snice-tree-item.types.d.ts +30 -0
- package/dist/components/tree/snice-tree.d.ts +45 -0
- package/dist/components/tree/snice-tree.js +390 -0
- package/dist/components/tree/snice-tree.js.map +1 -0
- package/dist/components/tree/snice-tree.types.d.ts +65 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.d.ts +31 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.js +160 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.js.map +1 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.types.d.ts +19 -0
- package/dist/index.cjs +125 -158
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +125 -158
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +125 -158
- package/dist/index.iife.js.map +1 -1
- package/dist/parts.d.ts +13 -16
- package/dist/symbols.cjs +1 -1
- package/dist/symbols.esm.js +1 -1
- package/dist/template.d.ts +0 -1
- package/dist/transitions.cjs +1 -1
- package/dist/transitions.esm.js +1 -1
- package/docs/ai/README.md +10 -1
- package/docs/ai/components/actions.md +81 -0
- package/docs/ai/components/audio-recorder.md +97 -0
- package/docs/ai/components/banner.md +84 -0
- package/docs/ai/components/calendar.md +95 -0
- package/docs/ai/components/camera.md +130 -0
- package/docs/ai/components/carousel.md +49 -0
- package/docs/ai/components/chart.md +160 -0
- package/docs/ai/components/chat.md +189 -0
- package/docs/ai/components/code-block.md +32 -0
- package/docs/ai/components/color-display.md +48 -0
- package/docs/ai/components/color-picker.md +75 -0
- package/docs/ai/components/command-palette.md +117 -0
- package/docs/ai/components/doc.md +154 -0
- package/docs/ai/components/draw.md +140 -0
- package/docs/ai/components/empty-state.md +72 -0
- package/docs/ai/components/file-upload.md +93 -0
- package/docs/ai/components/gantt.md +95 -0
- package/docs/ai/components/image.md +60 -0
- package/docs/ai/components/kanban.md +102 -0
- package/docs/ai/components/kpi.md +158 -0
- package/docs/ai/components/layout.md +261 -0
- package/docs/ai/components/link.md +77 -0
- package/docs/ai/components/list.md +50 -0
- package/docs/ai/components/location.md +75 -0
- package/docs/ai/components/menu.md +114 -0
- package/docs/ai/components/popover.md +70 -0
- package/docs/ai/components/qr-code.md +106 -0
- package/docs/ai/components/slider.md +87 -0
- package/docs/ai/components/sparkline.md +168 -0
- package/docs/ai/components/spinner.md +47 -0
- package/docs/ai/components/split-pane.md +71 -0
- package/docs/ai/components/stat.md +29 -0
- package/docs/ai/components/stepper.md +216 -0
- package/docs/ai/components/textarea.md +87 -0
- package/docs/ai/components/timeline.md +77 -0
- package/docs/ai/components/tree.md +191 -0
- package/docs/ai/components/virtual-scroller.md +71 -0
- package/docs/components/actions.md +317 -0
- package/docs/components/alert.md +540 -0
- package/docs/components/audio-recorder.md +152 -0
- package/docs/components/badge.md +593 -0
- package/docs/components/banner.md +106 -0
- package/docs/components/breadcrumbs.md +568 -0
- package/docs/components/button.md +648 -0
- package/docs/components/calendar.md +397 -0
- package/docs/components/camera.md +383 -0
- package/docs/components/card.md +778 -0
- package/docs/components/carousel.md +63 -0
- package/docs/components/chart.md +526 -0
- package/docs/components/chat.md +482 -0
- package/docs/components/checkbox.md +714 -0
- package/docs/components/chip.md +670 -0
- package/docs/components/code-block.md +49 -0
- package/docs/components/color-display.md +96 -0
- package/docs/components/color-picker.md +81 -0
- package/docs/components/command-palette.md +159 -0
- package/docs/components/doc.md +357 -0
- package/docs/components/draw.md +307 -0
- package/docs/components/empty-state.md +79 -0
- package/docs/components/file-upload.md +263 -0
- package/docs/components/gantt.md +347 -0
- package/docs/components/image.md +110 -0
- package/docs/components/kanban.md +410 -0
- package/docs/components/kpi.md +251 -0
- package/docs/components/link.md +229 -0
- package/docs/components/list.md +65 -0
- package/docs/components/location.md +369 -0
- package/docs/components/menu.md +633 -0
- package/docs/components/popover.md +333 -0
- package/docs/components/qr-code.md +464 -0
- package/docs/components/slider.md +297 -0
- package/docs/components/sparkline.md +293 -0
- package/docs/components/spinner.md +63 -0
- package/docs/components/split-pane.md +315 -0
- package/docs/components/stat.md +45 -0
- package/docs/components/stepper.md +410 -0
- package/docs/components/textarea.md +235 -0
- package/docs/components/timeline.md +192 -0
- package/docs/components/tree.md +536 -0
- package/docs/components/virtual-scroller.md +298 -0
- package/package.json +2 -1
- package/dist/components/snice-cell-BLFVdxPp.js +0 -4
- package/dist/components/snice-cell-BLFVdxPp.js.map +0 -1
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# Draw Component
|
|
2
|
+
|
|
3
|
+
Canvas drawing with smooth lazy-brush technology.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<snice-draw id="draw" width="800" height="600"></snice-draw>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
const draw = document.getElementById('draw');
|
|
12
|
+
|
|
13
|
+
// Clear canvas
|
|
14
|
+
draw.clear();
|
|
15
|
+
|
|
16
|
+
// Undo/redo
|
|
17
|
+
draw.undo();
|
|
18
|
+
draw.redo();
|
|
19
|
+
|
|
20
|
+
// Download
|
|
21
|
+
draw.download('my-drawing.png');
|
|
22
|
+
</script>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Properties
|
|
26
|
+
|
|
27
|
+
| Property | Type | Default | Description |
|
|
28
|
+
|----------|------|---------|-------------|
|
|
29
|
+
| `width` | `number` | `800` | Canvas width |
|
|
30
|
+
| `height` | `number` | `600` | Canvas height |
|
|
31
|
+
| `tool` | `DrawTool` | `'pen'` | Drawing tool |
|
|
32
|
+
| `color` | `string` | `'#000000'` | Brush color |
|
|
33
|
+
| `strokeWidth` | `number` | `2` | Brush width |
|
|
34
|
+
| `backgroundColor` | `string` | `'#ffffff'` | Canvas background |
|
|
35
|
+
| `lazy` | `boolean` | `false` | Enable lazy brush |
|
|
36
|
+
| `lazyRadius` | `number` | `60` | Lazy brush radius |
|
|
37
|
+
| `friction` | `number` | `0.1` | Lazy brush friction |
|
|
38
|
+
| `smoothing` | `number` | `0.5` | Line smoothing (0-1) |
|
|
39
|
+
| `autoPolygon` | `boolean` | `false` | Enable auto-polygon |
|
|
40
|
+
| `polygonCurvePoints` | `number` | `10` | Polygon curve smoothness (2-30) |
|
|
41
|
+
| `disabled` | `boolean` | `false` | Disable drawing |
|
|
42
|
+
|
|
43
|
+
## Tools
|
|
44
|
+
|
|
45
|
+
- `'pen'` - Draw with brush
|
|
46
|
+
- `'eraser'` - Erase strokes
|
|
47
|
+
- `'line'` - Draw straight lines
|
|
48
|
+
- `'rectangle'` - Draw rectangles
|
|
49
|
+
- `'circle'` - Draw circles
|
|
50
|
+
- `'text'` - Add text
|
|
51
|
+
|
|
52
|
+
## Methods
|
|
53
|
+
|
|
54
|
+
### `clear(): void`
|
|
55
|
+
Clear the entire canvas.
|
|
56
|
+
|
|
57
|
+
### `undo(): void`
|
|
58
|
+
Undo last stroke.
|
|
59
|
+
|
|
60
|
+
### `redo(): void`
|
|
61
|
+
Redo previously undone stroke.
|
|
62
|
+
|
|
63
|
+
### `toDataURL(type?, quality?): string`
|
|
64
|
+
Export as data URL.
|
|
65
|
+
|
|
66
|
+
### `toBlob(type?, quality?): Promise<Blob>`
|
|
67
|
+
Export as Blob.
|
|
68
|
+
|
|
69
|
+
### `download(filename?): void`
|
|
70
|
+
Download drawing.
|
|
71
|
+
|
|
72
|
+
### `loadImage(url): Promise<void>`
|
|
73
|
+
Load image onto canvas.
|
|
74
|
+
|
|
75
|
+
### `getStrokes(): DrawStroke[]`
|
|
76
|
+
Get all strokes.
|
|
77
|
+
|
|
78
|
+
### `setStrokes(strokes): void`
|
|
79
|
+
Set strokes (for loading saved drawings).
|
|
80
|
+
|
|
81
|
+
## Events
|
|
82
|
+
|
|
83
|
+
- `@snice/draw-start` - Drawing started
|
|
84
|
+
- `@snice/draw-end` - Drawing ended (stroke complete)
|
|
85
|
+
- `@snice/draw-clear` - Canvas cleared
|
|
86
|
+
- `@snice/draw-undo` - Undo performed
|
|
87
|
+
- `@snice/draw-redo` - Redo performed
|
|
88
|
+
|
|
89
|
+
## Examples
|
|
90
|
+
|
|
91
|
+
### Basic Drawing
|
|
92
|
+
|
|
93
|
+
```html
|
|
94
|
+
<snice-draw width="800" height="600"></snice-draw>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Custom Colors
|
|
98
|
+
|
|
99
|
+
```javascript
|
|
100
|
+
const draw = document.querySelector('snice-draw');
|
|
101
|
+
draw.color = '#ff0000';
|
|
102
|
+
draw.strokeWidth = 5;
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Toolbar Integration
|
|
106
|
+
|
|
107
|
+
```html
|
|
108
|
+
<div>
|
|
109
|
+
<button onclick="draw.tool = 'pen'">Pen</button>
|
|
110
|
+
<button onclick="draw.tool = 'eraser'">Eraser</button>
|
|
111
|
+
<input type="color" oninput="draw.color = this.value">
|
|
112
|
+
<button onclick="draw.clear()">Clear</button>
|
|
113
|
+
<button onclick="draw.undo()">Undo</button>
|
|
114
|
+
<button onclick="draw.redo()">Redo</button>
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<snice-draw id="draw"></snice-draw>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Lazy Brush Settings
|
|
121
|
+
|
|
122
|
+
```javascript
|
|
123
|
+
// More responsive (smaller radius)
|
|
124
|
+
draw.lazyRadius = 10;
|
|
125
|
+
|
|
126
|
+
// Very smooth (larger radius)
|
|
127
|
+
draw.lazyRadius = 60;
|
|
128
|
+
|
|
129
|
+
// Disable lazy brush
|
|
130
|
+
draw.lazy = false;
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Export Drawing
|
|
134
|
+
|
|
135
|
+
```javascript
|
|
136
|
+
// As data URL
|
|
137
|
+
const dataURL = draw.toDataURL('image/png');
|
|
138
|
+
|
|
139
|
+
// As blob
|
|
140
|
+
const blob = await draw.toBlob('image/png', 0.9);
|
|
141
|
+
|
|
142
|
+
// Download
|
|
143
|
+
draw.download('my-artwork.png');
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Save and Load
|
|
147
|
+
|
|
148
|
+
Each stroke has a unique ID for tracking and manipulation:
|
|
149
|
+
|
|
150
|
+
```javascript
|
|
151
|
+
// Save drawing
|
|
152
|
+
const strokes = draw.getStrokes();
|
|
153
|
+
localStorage.setItem('drawing', JSON.stringify(strokes));
|
|
154
|
+
|
|
155
|
+
// Load drawing
|
|
156
|
+
const saved = JSON.parse(localStorage.getItem('drawing'));
|
|
157
|
+
draw.setStrokes(saved);
|
|
158
|
+
|
|
159
|
+
// Access individual strokes by ID
|
|
160
|
+
const strokes = draw.getStrokes();
|
|
161
|
+
console.log(strokes[0].id); // e.g., "stroke-1735216842123-x7k9m2p"
|
|
162
|
+
|
|
163
|
+
// Filter strokes
|
|
164
|
+
const penStrokes = strokes.filter(s => s.tool === 'pen');
|
|
165
|
+
|
|
166
|
+
// Remove specific stroke
|
|
167
|
+
const filtered = strokes.filter(s => s.id !== 'stroke-id-to-remove');
|
|
168
|
+
draw.setStrokes(filtered);
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Stroke Structure:**
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
interface DrawStroke {
|
|
175
|
+
id: string; // Unique identifier
|
|
176
|
+
tool: DrawTool; // 'pen' | 'eraser' | etc
|
|
177
|
+
color: string; // Hex color
|
|
178
|
+
width: number; // Stroke width
|
|
179
|
+
points: Point[]; // Array of {x, y, pressure?}
|
|
180
|
+
timestamp: number; // Creation time (ms)
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Load Background Image
|
|
185
|
+
|
|
186
|
+
```javascript
|
|
187
|
+
await draw.loadImage('background.jpg');
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Event Handling
|
|
191
|
+
|
|
192
|
+
```javascript
|
|
193
|
+
draw.addEventListener('@snice/draw-end', (e) => {
|
|
194
|
+
const stroke = e.detail.stroke;
|
|
195
|
+
console.log(`Drew ${stroke.points.length} points`);
|
|
196
|
+
|
|
197
|
+
// Auto-save
|
|
198
|
+
saveDrawing();
|
|
199
|
+
});
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Keyboard Shortcuts
|
|
203
|
+
|
|
204
|
+
```javascript
|
|
205
|
+
document.addEventListener('keydown', (e) => {
|
|
206
|
+
if (e.ctrlKey || e.metaKey) {
|
|
207
|
+
if (e.key === 'z') {
|
|
208
|
+
e.preventDefault();
|
|
209
|
+
if (e.shiftKey) {
|
|
210
|
+
draw.redo();
|
|
211
|
+
} else {
|
|
212
|
+
draw.undo();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Lazy Brush
|
|
220
|
+
|
|
221
|
+
The lazy brush creates smooth, organic lines by making the brush lag behind your cursor within a configurable radius. This eliminates jitter and produces professional-looking strokes.
|
|
222
|
+
|
|
223
|
+
**How it works:**
|
|
224
|
+
1. Cursor moves freely
|
|
225
|
+
2. Brush follows within `lazyRadius`
|
|
226
|
+
3. Creates smooth curves
|
|
227
|
+
4. Reduces hand tremor effects
|
|
228
|
+
|
|
229
|
+
**Tips:**
|
|
230
|
+
- Larger radius = smoother, slower response
|
|
231
|
+
- Smaller radius = more control, less smoothing
|
|
232
|
+
- Disable for pixel-perfect control
|
|
233
|
+
|
|
234
|
+
## Auto-Polygon
|
|
235
|
+
|
|
236
|
+
Auto-polygon automatically processes completed strokes into closed shapes. When you finish drawing (release the mouse/pointer), it analyzes the stroke and applies smart shape completion.
|
|
237
|
+
|
|
238
|
+
**Features:**
|
|
239
|
+
|
|
240
|
+
1. **Self-Intersection Detection**
|
|
241
|
+
- Detects when your stroke crosses itself
|
|
242
|
+
- Automatically trims at the first intersection point
|
|
243
|
+
- Creates a clean closed shape without excess
|
|
244
|
+
|
|
245
|
+
2. **Auto-Close Open Shapes**
|
|
246
|
+
- If start and end points are far apart (>20px)
|
|
247
|
+
- Connects them with a smooth quadratic curve
|
|
248
|
+
- Curve adapts to the gap distance
|
|
249
|
+
|
|
250
|
+
**Properties:**
|
|
251
|
+
|
|
252
|
+
- `autoPolygon` - Enable/disable the feature (default: `false`)
|
|
253
|
+
- `polygonCurvePoints` - Curve smoothness, 2-30 (default: `10`)
|
|
254
|
+
- Lower values (2-5): Sharp, direct connection
|
|
255
|
+
- Medium values (10-15): Balanced smooth curve
|
|
256
|
+
- Higher values (20-30): Very smooth, organic curve
|
|
257
|
+
|
|
258
|
+
**Example:**
|
|
259
|
+
|
|
260
|
+
```javascript
|
|
261
|
+
const draw = document.querySelector('snice-draw');
|
|
262
|
+
|
|
263
|
+
// Enable auto-polygon
|
|
264
|
+
draw.autoPolygon = true;
|
|
265
|
+
|
|
266
|
+
// Adjust curve smoothness
|
|
267
|
+
draw.polygonCurvePoints = 15; // Smoother curves
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
```html
|
|
271
|
+
<snice-draw
|
|
272
|
+
auto-polygon
|
|
273
|
+
polygon-curve-points="15">
|
|
274
|
+
</snice-draw>
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**Use Cases:**
|
|
278
|
+
|
|
279
|
+
- Sketching closed shapes quickly
|
|
280
|
+
- Drawing polygons without precision
|
|
281
|
+
- Creating organic forms that auto-complete
|
|
282
|
+
- UI wireframing and mockups
|
|
283
|
+
- Diagram creation
|
|
284
|
+
|
|
285
|
+
**How It Works:**
|
|
286
|
+
|
|
287
|
+
The algorithm processes strokes on `pointerup`:
|
|
288
|
+
|
|
289
|
+
1. Simplify points (sample every 5th point for performance)
|
|
290
|
+
2. Check for self-intersections using line-line intersection
|
|
291
|
+
3. If intersection found: trim and close at that point
|
|
292
|
+
4. If no intersection and gap >20px: generate curve points
|
|
293
|
+
5. Use quadratic Bezier with perpendicular control point
|
|
294
|
+
6. Insert interpolated points for smooth rendering
|
|
295
|
+
|
|
296
|
+
## Browser Support
|
|
297
|
+
|
|
298
|
+
- Modern browsers with Canvas API
|
|
299
|
+
- Pointer Events API for touch support
|
|
300
|
+
- Works on desktop and mobile
|
|
301
|
+
|
|
302
|
+
## Performance
|
|
303
|
+
|
|
304
|
+
- Optimized canvas rendering
|
|
305
|
+
- Efficient stroke storage
|
|
306
|
+
- Smooth 60fps drawing
|
|
307
|
+
- Touch and stylus pressure support
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Empty State Component
|
|
2
|
+
|
|
3
|
+
The `<snice-empty-state>` component provides a consistent way to display empty or no-data states.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<snice-empty-state
|
|
9
|
+
icon="📭"
|
|
10
|
+
title="No data"
|
|
11
|
+
description="There's nothing here yet"
|
|
12
|
+
></snice-empty-state>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
| Property | Type | Default | Description |
|
|
18
|
+
|----------|------|---------|-------------|
|
|
19
|
+
| `size` | `'small' \| 'medium' \| 'large'` | `'medium'` | Size variant |
|
|
20
|
+
| `icon` | `string` | `'📭'` | Icon (emoji or text) |
|
|
21
|
+
| `title` | `string` | `'No data'` | Title text |
|
|
22
|
+
| `description` | `string` | `''` | Description text |
|
|
23
|
+
| `actionText` | `string` | `''` | Action button text |
|
|
24
|
+
| `actionHref` | `string` | `''` | Action link URL |
|
|
25
|
+
|
|
26
|
+
## Events
|
|
27
|
+
|
|
28
|
+
### `@snice/empty-state-action`
|
|
29
|
+
Fired when action button/link is clicked.
|
|
30
|
+
|
|
31
|
+
## Examples
|
|
32
|
+
|
|
33
|
+
### No Search Results
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<snice-empty-state
|
|
37
|
+
icon="🔍"
|
|
38
|
+
title="No results found"
|
|
39
|
+
description="Try adjusting your search criteria"
|
|
40
|
+
action-text="Clear Search"
|
|
41
|
+
></snice-empty-state>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Empty List
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<snice-empty-state
|
|
48
|
+
icon="📦"
|
|
49
|
+
title="No items yet"
|
|
50
|
+
description="Get started by creating your first item"
|
|
51
|
+
action-text="Create Item"
|
|
52
|
+
></snice-empty-state>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 404 Page
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<snice-empty-state
|
|
59
|
+
icon="🤷"
|
|
60
|
+
title="Page not found"
|
|
61
|
+
description="The page you're looking for doesn't exist"
|
|
62
|
+
action-text="Go Home"
|
|
63
|
+
action-href="/"
|
|
64
|
+
></snice-empty-state>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### With Custom Content
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<snice-empty-state
|
|
71
|
+
icon="🎨"
|
|
72
|
+
title="No projects"
|
|
73
|
+
>
|
|
74
|
+
<div slot="">
|
|
75
|
+
<button>Create Project</button>
|
|
76
|
+
<button>Import Project</button>
|
|
77
|
+
</div>
|
|
78
|
+
</snice-empty-state>
|
|
79
|
+
```
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# File Upload Component
|
|
2
|
+
|
|
3
|
+
The `<snice-file-upload>` component provides a file upload interface with drag-and-drop support, file previews, and validation.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
- [Basic Usage](#basic-usage)
|
|
7
|
+
- [Properties](#properties)
|
|
8
|
+
- [Methods](#methods)
|
|
9
|
+
- [Events](#events)
|
|
10
|
+
- [Features](#features)
|
|
11
|
+
- [Examples](#examples)
|
|
12
|
+
|
|
13
|
+
## Basic Usage
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<snice-file-upload
|
|
17
|
+
label="Upload Documents"
|
|
18
|
+
accept=".pdf,.doc,.docx"
|
|
19
|
+
max-size="5242880"
|
|
20
|
+
></snice-file-upload>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import 'snice/components/file-upload/snice-file-upload';
|
|
25
|
+
|
|
26
|
+
const upload = document.querySelector('snice-file-upload');
|
|
27
|
+
upload.addEventListener('@snice/file-upload-change', (e) => {
|
|
28
|
+
console.log('Files:', e.detail.files);
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Properties
|
|
33
|
+
|
|
34
|
+
| Property | Type | Default | Description |
|
|
35
|
+
|----------|------|---------|-------------|
|
|
36
|
+
| `size` | `'small' \| 'medium' \| 'large'` | `'medium'` | Size variant |
|
|
37
|
+
| `variant` | `'outlined' \| 'filled'` | `'outlined'` | Visual style variant |
|
|
38
|
+
| `accept` | `string` | `''` | Allowed file types (same as input accept) |
|
|
39
|
+
| `multiple` | `boolean` | `false` | Allow multiple file selection |
|
|
40
|
+
| `label` | `string` | `''` | Label text |
|
|
41
|
+
| `helperText` | `string` | `''` | Helper text below upload area |
|
|
42
|
+
| `errorText` | `string` | `''` | Error message (shown when invalid) |
|
|
43
|
+
| `disabled` | `boolean` | `false` | Whether upload is disabled |
|
|
44
|
+
| `required` | `boolean` | `false` | Whether upload is required |
|
|
45
|
+
| `invalid` | `boolean` | `false` | Whether to show invalid state |
|
|
46
|
+
| `maxSize` | `number` | `-1` | Maximum file size in bytes (-1 = no limit) |
|
|
47
|
+
| `maxFiles` | `number` | `-1` | Maximum number of files (-1 = no limit) |
|
|
48
|
+
| `name` | `string` | `''` | Form field name |
|
|
49
|
+
| `dragDrop` | `boolean` | `true` | Enable drag-and-drop |
|
|
50
|
+
| `showPreview` | `boolean` | `true` | Show image previews |
|
|
51
|
+
| `files` | `FileList \| null` | `null` | Selected files (read-only) |
|
|
52
|
+
|
|
53
|
+
## Methods
|
|
54
|
+
|
|
55
|
+
### `clear(): void`
|
|
56
|
+
Remove all selected files.
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
upload.clear();
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### `removeFile(index: number): void`
|
|
63
|
+
Remove a specific file by index.
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
upload.removeFile(0); // Remove first file
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Events
|
|
70
|
+
|
|
71
|
+
### `@snice/file-upload-change`
|
|
72
|
+
Fired when files are added or removed.
|
|
73
|
+
|
|
74
|
+
**Detail**: `{ files: File[], fileUpload: SniceFileUploadElement }`
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
upload.addEventListener('@snice/file-upload-change', (e) => {
|
|
78
|
+
console.log('Selected files:', e.detail.files);
|
|
79
|
+
e.detail.files.forEach(file => {
|
|
80
|
+
console.log(`- ${file.name} (${file.size} bytes)`);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### `@snice/file-upload-error`
|
|
86
|
+
Fired when file validation fails.
|
|
87
|
+
|
|
88
|
+
**Detail**: `{ message: string, fileUpload: SniceFileUploadElement }`
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
upload.addEventListener('@snice/file-upload-error', (e) => {
|
|
92
|
+
console.error('Upload error:', e.detail.message);
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Features
|
|
97
|
+
|
|
98
|
+
- **Drag and Drop**: Native drag-and-drop support with visual feedback
|
|
99
|
+
- **Image Preview**: Automatic thumbnail generation for image files
|
|
100
|
+
- **File Validation**: Size and type validation with error messaging
|
|
101
|
+
- **Multiple Files**: Support for single or multiple file selection
|
|
102
|
+
- **File Management**: Add and remove files before upload
|
|
103
|
+
- **Form Integration**: Form-associated custom element
|
|
104
|
+
- **Accessibility**: Full keyboard support and ARIA attributes
|
|
105
|
+
|
|
106
|
+
## Examples
|
|
107
|
+
|
|
108
|
+
### Basic Upload
|
|
109
|
+
|
|
110
|
+
```html
|
|
111
|
+
<snice-file-upload
|
|
112
|
+
label="Upload File"
|
|
113
|
+
helper-text="Choose a file to upload"
|
|
114
|
+
></snice-file-upload>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Image Upload with Preview
|
|
118
|
+
|
|
119
|
+
```html
|
|
120
|
+
<snice-file-upload
|
|
121
|
+
label="Upload Image"
|
|
122
|
+
accept="image/*"
|
|
123
|
+
max-size="2097152"
|
|
124
|
+
helper-text="Maximum 2MB, images only"
|
|
125
|
+
></snice-file-upload>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Multiple Files
|
|
129
|
+
|
|
130
|
+
```html
|
|
131
|
+
<snice-file-upload
|
|
132
|
+
label="Upload Documents"
|
|
133
|
+
accept=".pdf,.doc,.docx"
|
|
134
|
+
multiple
|
|
135
|
+
max-files="5"
|
|
136
|
+
helper-text="Select up to 5 documents"
|
|
137
|
+
></snice-file-upload>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Without Drag-and-Drop
|
|
141
|
+
|
|
142
|
+
```html
|
|
143
|
+
<snice-file-upload
|
|
144
|
+
label="Upload File"
|
|
145
|
+
drag-drop="false"
|
|
146
|
+
></snice-file-upload>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Different Sizes
|
|
150
|
+
|
|
151
|
+
```html
|
|
152
|
+
<snice-file-upload size="small" label="Small"></snice-file-upload>
|
|
153
|
+
<snice-file-upload size="medium" label="Medium"></snice-file-upload>
|
|
154
|
+
<snice-file-upload size="large" label="Large"></snice-file-upload>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Different Variants
|
|
158
|
+
|
|
159
|
+
```html
|
|
160
|
+
<snice-file-upload variant="outlined" label="Outlined"></snice-file-upload>
|
|
161
|
+
<snice-file-upload variant="filled" label="Filled"></snice-file-upload>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Error State
|
|
165
|
+
|
|
166
|
+
```html
|
|
167
|
+
<snice-file-upload
|
|
168
|
+
label="Resume"
|
|
169
|
+
invalid
|
|
170
|
+
error-text="Please upload your resume"
|
|
171
|
+
required
|
|
172
|
+
></snice-file-upload>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### File Type Restrictions
|
|
176
|
+
|
|
177
|
+
```html
|
|
178
|
+
<!-- Images only -->
|
|
179
|
+
<snice-file-upload accept="image/*" label="Images"></snice-file-upload>
|
|
180
|
+
|
|
181
|
+
<!-- Specific formats -->
|
|
182
|
+
<snice-file-upload accept=".pdf,.doc,.docx" label="Documents"></snice-file-upload>
|
|
183
|
+
|
|
184
|
+
<!-- Multiple types -->
|
|
185
|
+
<snice-file-upload accept="image/*,.pdf" label="Images and PDFs"></snice-file-upload>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### With Size Validation
|
|
189
|
+
|
|
190
|
+
```html
|
|
191
|
+
<snice-file-upload
|
|
192
|
+
label="Upload Photo"
|
|
193
|
+
accept="image/*"
|
|
194
|
+
max-size="5242880"
|
|
195
|
+
helper-text="Maximum 5MB"
|
|
196
|
+
></snice-file-upload>
|
|
197
|
+
|
|
198
|
+
<script>
|
|
199
|
+
const upload = document.querySelector('snice-file-upload');
|
|
200
|
+
upload.addEventListener('@snice/file-upload-error', (e) => {
|
|
201
|
+
alert(e.detail.message);
|
|
202
|
+
});
|
|
203
|
+
</script>
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Form Integration
|
|
207
|
+
|
|
208
|
+
```html
|
|
209
|
+
<form id="upload-form">
|
|
210
|
+
<snice-file-upload
|
|
211
|
+
name="documents"
|
|
212
|
+
label="Upload Documents"
|
|
213
|
+
accept=".pdf,.doc,.docx"
|
|
214
|
+
multiple
|
|
215
|
+
required
|
|
216
|
+
></snice-file-upload>
|
|
217
|
+
|
|
218
|
+
<button type="submit">Submit</button>
|
|
219
|
+
</form>
|
|
220
|
+
|
|
221
|
+
<script>
|
|
222
|
+
document.getElementById('upload-form').addEventListener('submit', async (e) => {
|
|
223
|
+
e.preventDefault();
|
|
224
|
+
|
|
225
|
+
const formData = new FormData(e.target);
|
|
226
|
+
const files = formData.getAll('documents');
|
|
227
|
+
|
|
228
|
+
console.log(`Uploading ${files.length} file(s)...`);
|
|
229
|
+
|
|
230
|
+
// Upload to server
|
|
231
|
+
const response = await fetch('/api/upload', {
|
|
232
|
+
method: 'POST',
|
|
233
|
+
body: formData
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
console.log('Upload complete!');
|
|
237
|
+
});
|
|
238
|
+
</script>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Managing Files Programmatically
|
|
242
|
+
|
|
243
|
+
```html
|
|
244
|
+
<snice-file-upload id="file-upload" multiple></snice-file-upload>
|
|
245
|
+
<button onclick="clearFiles()">Clear All</button>
|
|
246
|
+
<button onclick="removeFirst()">Remove First</button>
|
|
247
|
+
|
|
248
|
+
<script>
|
|
249
|
+
const upload = document.getElementById('file-upload');
|
|
250
|
+
|
|
251
|
+
function clearFiles() {
|
|
252
|
+
upload.clear();
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function removeFirst() {
|
|
256
|
+
upload.removeFile(0);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
upload.addEventListener('@snice/file-upload-change', (e) => {
|
|
260
|
+
console.log(`${e.detail.files.length} file(s) selected`);
|
|
261
|
+
});
|
|
262
|
+
</script>
|
|
263
|
+
```
|