@leap-online/jolt 0.0.0-stage → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +51 -2
- package/THIRD_PARTY_NOTICES.md +25 -0
- package/dist/components/accordion/accordion.svelte +150 -0
- package/dist/components/accordion/accordion.svelte.d.ts +32 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.js +1 -0
- package/dist/components/alert/alert.svelte +75 -0
- package/dist/components/alert/alert.svelte.d.ts +24 -0
- package/dist/components/alert/index.d.ts +1 -0
- package/dist/components/alert/index.js +1 -0
- package/dist/components/app-shell/app-shell.svelte +53 -0
- package/dist/components/app-shell/app-shell.svelte.d.ts +13 -0
- package/dist/components/app-shell/index.d.ts +2 -0
- package/dist/components/app-shell/index.js +1 -0
- package/dist/components/attachment/attachment-list.svelte +77 -0
- package/dist/components/attachment/attachment-list.svelte.d.ts +15 -0
- package/dist/components/attachment/attachment.svelte +119 -0
- package/dist/components/attachment/attachment.svelte.d.ts +14 -0
- package/dist/components/attachment/format.d.ts +1 -0
- package/dist/components/attachment/format.js +9 -0
- package/dist/components/attachment/index.d.ts +3 -0
- package/dist/components/attachment/index.js +2 -0
- package/dist/components/attachment/preview.d.ts +9 -0
- package/dist/components/attachment/preview.js +191 -0
- package/dist/components/attachment/types.d.ts +12 -0
- package/dist/components/attachment/types.js +1 -0
- package/dist/components/avatar/avatar.svelte +115 -0
- package/dist/components/avatar/avatar.svelte.d.ts +18 -0
- package/dist/components/avatar/index.d.ts +1 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/avatar-group/avatar-group.svelte +79 -0
- package/dist/components/avatar-group/avatar-group.svelte.d.ts +19 -0
- package/dist/components/avatar-group/index.d.ts +1 -0
- package/dist/components/avatar-group/index.js +1 -0
- package/dist/components/badge/badge.svelte +83 -0
- package/dist/components/badge/badge.svelte.d.ts +39 -0
- package/dist/components/badge/index.d.ts +1 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/breadcrumb/breadcrumb.svelte +165 -0
- package/dist/components/breadcrumb/breadcrumb.svelte.d.ts +24 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +1 -0
- package/dist/components/button/button.svelte +77 -0
- package/dist/components/button/button.svelte.d.ts +29 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/calendar/calendar.svelte +512 -0
- package/dist/components/calendar/calendar.svelte.d.ts +4 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/calendar/types.d.ts +31 -0
- package/dist/components/calendar/types.js +1 -0
- package/dist/components/card/card.svelte +65 -0
- package/dist/components/card/card.svelte.d.ts +15 -0
- package/dist/components/card/index.d.ts +1 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/chat/chat-actions.svelte +183 -0
- package/dist/components/chat/chat-actions.svelte.d.ts +21 -0
- package/dist/components/chat/chat-attachments.svelte +41 -0
- package/dist/components/chat/chat-attachments.svelte.d.ts +12 -0
- package/dist/components/chat/chat-composer.svelte +165 -0
- package/dist/components/chat/chat-composer.svelte.d.ts +21 -0
- package/dist/components/chat/chat-loader.svelte +23 -0
- package/dist/components/chat/chat-loader.svelte.d.ts +7 -0
- package/dist/components/chat/chat-markdown.svelte +16 -0
- package/dist/components/chat/chat-markdown.svelte.d.ts +7 -0
- package/dist/components/chat/chat-message.svelte +114 -0
- package/dist/components/chat/chat-message.svelte.d.ts +18 -0
- package/dist/components/chat/chat-reasoning.svelte +52 -0
- package/dist/components/chat/chat-reasoning.svelte.d.ts +11 -0
- package/dist/components/chat/chat-sources.svelte +54 -0
- package/dist/components/chat/chat-sources.svelte.d.ts +10 -0
- package/dist/components/chat/chat-suggestions.svelte +44 -0
- package/dist/components/chat/chat-suggestions.svelte.d.ts +10 -0
- package/dist/components/chat/chat-tool-call.svelte +182 -0
- package/dist/components/chat/chat-tool-call.svelte.d.ts +26 -0
- package/dist/components/chat/chat-viewport.svelte +105 -0
- package/dist/components/chat/chat-viewport.svelte.d.ts +14 -0
- package/dist/components/chat/chat.svelte +113 -0
- package/dist/components/chat/chat.svelte.d.ts +27 -0
- package/dist/components/chat/index.d.ts +16 -0
- package/dist/components/chat/index.js +12 -0
- package/dist/components/chat/types.d.ts +19 -0
- package/dist/components/chat/types.js +1 -0
- package/dist/components/checkbox/checkbox.svelte +99 -0
- package/dist/components/checkbox/checkbox.svelte.d.ts +20 -0
- package/dist/components/checkbox/index.d.ts +1 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/code-block/code-block.svelte +53 -0
- package/dist/components/code-block/code-block.svelte.d.ts +12 -0
- package/dist/components/code-block/index.d.ts +1 -0
- package/dist/components/code-block/index.js +1 -0
- package/dist/components/collapsible/collapsible.svelte +79 -0
- package/dist/components/collapsible/collapsible.svelte.d.ts +17 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/collapsible/index.js +1 -0
- package/dist/components/combobox/combobox.svelte +272 -0
- package/dist/components/combobox/combobox.svelte.d.ts +25 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +1 -0
- package/dist/components/combobox/types.d.ts +42 -0
- package/dist/components/combobox/types.js +1 -0
- package/dist/components/command-palette/command-palette.svelte +143 -0
- package/dist/components/command-palette/command-palette.svelte.d.ts +31 -0
- package/dist/components/command-palette/index.d.ts +2 -0
- package/dist/components/command-palette/index.js +1 -0
- package/dist/components/confirm-dialog/confirm-dialog.svelte +107 -0
- package/dist/components/confirm-dialog/confirm-dialog.svelte.d.ts +20 -0
- package/dist/components/confirm-dialog/index.d.ts +1 -0
- package/dist/components/confirm-dialog/index.js +1 -0
- package/dist/components/context-menu/context-menu.svelte +175 -0
- package/dist/components/context-menu/context-menu.svelte.d.ts +22 -0
- package/dist/components/context-menu/index.d.ts +1 -0
- package/dist/components/context-menu/index.js +1 -0
- package/dist/components/copy-button/copy-button.svelte +130 -0
- package/dist/components/copy-button/copy-button.svelte.d.ts +19 -0
- package/dist/components/copy-button/index.d.ts +1 -0
- package/dist/components/copy-button/index.js +1 -0
- package/dist/components/data-table/data-table.svelte +146 -0
- package/dist/components/data-table/data-table.svelte.d.ts +43 -0
- package/dist/components/data-table/index.d.ts +2 -0
- package/dist/components/data-table/index.js +1 -0
- package/dist/components/date-picker/date-picker.svelte +95 -0
- package/dist/components/date-picker/date-picker.svelte.d.ts +24 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/date-range-picker/date-range-picker.svelte +117 -0
- package/dist/components/date-range-picker/date-range-picker.svelte.d.ts +28 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/index.js +1 -0
- package/dist/components/description-list/description-list.svelte +108 -0
- package/dist/components/description-list/description-list.svelte.d.ts +29 -0
- package/dist/components/description-list/index.d.ts +1 -0
- package/dist/components/description-list/index.js +1 -0
- package/dist/components/dialog/dialog.svelte +98 -0
- package/dist/components/dialog/dialog.svelte.d.ts +16 -0
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/dialog/index.js +1 -0
- package/dist/components/dropdown-menu/dropdown-menu.svelte +197 -0
- package/dist/components/dropdown-menu/dropdown-menu.svelte.d.ts +29 -0
- package/dist/components/dropdown-menu/index.d.ts +1 -0
- package/dist/components/dropdown-menu/index.js +1 -0
- package/dist/components/email-input/email-input.svelte +21 -0
- package/dist/components/email-input/email-input.svelte.d.ts +5 -0
- package/dist/components/email-input/email.d.ts +10 -0
- package/dist/components/email-input/email.js +15 -0
- package/dist/components/email-input/index.d.ts +1 -0
- package/dist/components/email-input/index.js +1 -0
- package/dist/components/empty-state/empty-state.svelte +46 -0
- package/dist/components/empty-state/empty-state.svelte.d.ts +14 -0
- package/dist/components/empty-state/index.d.ts +1 -0
- package/dist/components/empty-state/index.js +1 -0
- package/dist/components/feed-item/feed-item.svelte +104 -0
- package/dist/components/feed-item/feed-item.svelte.d.ts +16 -0
- package/dist/components/feed-item/index.d.ts +1 -0
- package/dist/components/feed-item/index.js +1 -0
- package/dist/components/field/checkbox-field.svelte +50 -0
- package/dist/components/field/checkbox-field.svelte.d.ts +4 -0
- package/dist/components/field/field.svelte +71 -0
- package/dist/components/field/field.svelte.d.ts +21 -0
- package/dist/components/field/index.d.ts +5 -0
- package/dist/components/field/index.js +4 -0
- package/dist/components/field/select-field.svelte +55 -0
- package/dist/components/field/select-field.svelte.d.ts +25 -0
- package/dist/components/field/text-field.svelte +48 -0
- package/dist/components/field/text-field.svelte.d.ts +4 -0
- package/dist/components/field/textarea-field.svelte +45 -0
- package/dist/components/field/textarea-field.svelte.d.ts +4 -0
- package/dist/components/field/types.d.ts +74 -0
- package/dist/components/field/types.js +1 -0
- package/dist/components/file-upload/file-upload.svelte +202 -0
- package/dist/components/file-upload/file-upload.svelte.d.ts +15 -0
- package/dist/components/file-upload/index.d.ts +1 -0
- package/dist/components/file-upload/index.js +1 -0
- package/dist/components/hover-card/hover-card.svelte +64 -0
- package/dist/components/hover-card/hover-card.svelte.d.ts +20 -0
- package/dist/components/hover-card/index.d.ts +1 -0
- package/dist/components/hover-card/index.js +1 -0
- package/dist/components/inline-edit/index.d.ts +1 -0
- package/dist/components/inline-edit/index.js +1 -0
- package/dist/components/inline-edit/inline-edit.svelte +207 -0
- package/dist/components/inline-edit/inline-edit.svelte.d.ts +17 -0
- package/dist/components/input/index.d.ts +1 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/input/input.svelte +36 -0
- package/dist/components/input/input.svelte.d.ts +8 -0
- package/dist/components/kbd/index.d.ts +1 -0
- package/dist/components/kbd/index.js +1 -0
- package/dist/components/kbd/kbd.svelte +33 -0
- package/dist/components/kbd/kbd.svelte.d.ts +10 -0
- package/dist/components/label/index.d.ts +1 -0
- package/dist/components/label/index.js +1 -0
- package/dist/components/label/label.svelte +25 -0
- package/dist/components/label/label.svelte.d.ts +8 -0
- package/dist/components/lightbox/index.d.ts +2 -0
- package/dist/components/lightbox/index.js +1 -0
- package/dist/components/lightbox/lightbox.svelte +264 -0
- package/dist/components/lightbox/lightbox.svelte.d.ts +4 -0
- package/dist/components/lightbox/types.d.ts +41 -0
- package/dist/components/lightbox/types.js +1 -0
- package/dist/components/loader/index.d.ts +1 -0
- package/dist/components/loader/index.js +1 -0
- package/dist/components/loader/loader.svelte +78 -0
- package/dist/components/loader/loader.svelte.d.ts +10 -0
- package/dist/components/markdown/markdown.svelte +52 -0
- package/dist/components/markdown/markdown.svelte.d.ts +7 -0
- package/dist/components/menubar/index.d.ts +3 -0
- package/dist/components/menubar/index.js +1 -0
- package/dist/components/menubar/menubar.svelte +180 -0
- package/dist/components/menubar/menubar.svelte.d.ts +4 -0
- package/dist/components/menubar/types.d.ts +26 -0
- package/dist/components/menubar/types.js +1 -0
- package/dist/components/multi-select/index.d.ts +2 -0
- package/dist/components/multi-select/index.js +1 -0
- package/dist/components/multi-select/multi-select.svelte +273 -0
- package/dist/components/multi-select/multi-select.svelte.d.ts +25 -0
- package/dist/components/multi-select/types.d.ts +32 -0
- package/dist/components/multi-select/types.js +1 -0
- package/dist/components/navigation-menu/index.d.ts +2 -0
- package/dist/components/navigation-menu/index.js +1 -0
- package/dist/components/navigation-menu/navigation-menu.svelte +125 -0
- package/dist/components/navigation-menu/navigation-menu.svelte.d.ts +4 -0
- package/dist/components/navigation-menu/types.d.ts +40 -0
- package/dist/components/navigation-menu/types.js +1 -0
- package/dist/components/page-header/index.d.ts +1 -0
- package/dist/components/page-header/index.js +1 -0
- package/dist/components/page-header/page-header.svelte +44 -0
- package/dist/components/page-header/page-header.svelte.d.ts +11 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.js +1 -0
- package/dist/components/pagination/pagination.svelte +105 -0
- package/dist/components/pagination/pagination.svelte.d.ts +20 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/popover/popover.svelte +67 -0
- package/dist/components/popover/popover.svelte.d.ts +20 -0
- package/dist/components/progress/index.d.ts +2 -0
- package/dist/components/progress/index.js +1 -0
- package/dist/components/progress/progress.svelte +81 -0
- package/dist/components/progress/progress.svelte.d.ts +16 -0
- package/dist/components/radio-group/index.d.ts +2 -0
- package/dist/components/radio-group/index.js +1 -0
- package/dist/components/radio-group/radio-group.svelte +140 -0
- package/dist/components/radio-group/radio-group.svelte.d.ts +32 -0
- package/dist/components/reaction-bar/index.d.ts +1 -0
- package/dist/components/reaction-bar/index.js +1 -0
- package/dist/components/reaction-bar/reaction-bar.svelte +99 -0
- package/dist/components/reaction-bar/reaction-bar.svelte.d.ts +18 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +1 -0
- package/dist/components/scroll-area/scroll-area.svelte +81 -0
- package/dist/components/scroll-area/scroll-area.svelte.d.ts +15 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/select/select.svelte +183 -0
- package/dist/components/select/select.svelte.d.ts +25 -0
- package/dist/components/select/types.d.ts +38 -0
- package/dist/components/select/types.js +1 -0
- package/dist/components/separator/index.d.ts +1 -0
- package/dist/components/separator/index.js +1 -0
- package/dist/components/separator/separator.svelte +25 -0
- package/dist/components/separator/separator.svelte.d.ts +8 -0
- package/dist/components/severity-dot/index.d.ts +1 -0
- package/dist/components/severity-dot/index.js +1 -0
- package/dist/components/severity-dot/severity-dot.svelte +55 -0
- package/dist/components/severity-dot/severity-dot.svelte.d.ts +12 -0
- package/dist/components/sheet/index.d.ts +2 -0
- package/dist/components/sheet/index.js +1 -0
- package/dist/components/sheet/sheet.svelte +111 -0
- package/dist/components/sheet/sheet.svelte.d.ts +17 -0
- package/dist/components/sidebar/index.d.ts +2 -0
- package/dist/components/sidebar/index.js +1 -0
- package/dist/components/sidebar/sidebar.svelte +124 -0
- package/dist/components/sidebar/sidebar.svelte.d.ts +4 -0
- package/dist/components/sidebar/types.d.ts +28 -0
- package/dist/components/sidebar/types.js +1 -0
- package/dist/components/skeleton/index.d.ts +1 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/skeleton/skeleton.svelte +17 -0
- package/dist/components/skeleton/skeleton.svelte.d.ts +6 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +1 -0
- package/dist/components/slider/slider.svelte +194 -0
- package/dist/components/slider/slider.svelte.d.ts +25 -0
- package/dist/components/spinner/index.d.ts +1 -0
- package/dist/components/spinner/index.js +1 -0
- package/dist/components/spinner/spinner.svelte +32 -0
- package/dist/components/spinner/spinner.svelte.d.ts +9 -0
- package/dist/components/split-button/index.d.ts +1 -0
- package/dist/components/split-button/index.js +1 -0
- package/dist/components/split-button/split-button.svelte +87 -0
- package/dist/components/split-button/split-button.svelte.d.ts +21 -0
- package/dist/components/switch/index.d.ts +1 -0
- package/dist/components/switch/index.js +1 -0
- package/dist/components/switch/switch.svelte +78 -0
- package/dist/components/switch/switch.svelte.d.ts +17 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/table/table.svelte +71 -0
- package/dist/components/table/table.svelte.d.ts +25 -0
- package/dist/components/table/types.d.ts +19 -0
- package/dist/components/table/types.js +1 -0
- package/dist/components/tabs/index.d.ts +1 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/tabs/tabs.svelte +117 -0
- package/dist/components/tabs/tabs.svelte.d.ts +30 -0
- package/dist/components/tags-input/index.d.ts +2 -0
- package/dist/components/tags-input/index.js +1 -0
- package/dist/components/tags-input/parse.d.ts +6 -0
- package/dist/components/tags-input/parse.js +24 -0
- package/dist/components/tags-input/tags-input.svelte +181 -0
- package/dist/components/tags-input/tags-input.svelte.d.ts +4 -0
- package/dist/components/tags-input/types.d.ts +21 -0
- package/dist/components/tags-input/types.js +1 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/textarea/textarea.svelte +35 -0
- package/dist/components/textarea/textarea.svelte.d.ts +8 -0
- package/dist/components/time-ago/index.d.ts +1 -0
- package/dist/components/time-ago/index.js +1 -0
- package/dist/components/time-ago/time-ago.svelte +48 -0
- package/dist/components/time-ago/time-ago.svelte.d.ts +9 -0
- package/dist/components/time-picker/index.d.ts +2 -0
- package/dist/components/time-picker/index.js +1 -0
- package/dist/components/time-picker/time-picker.svelte +255 -0
- package/dist/components/time-picker/time-picker.svelte.d.ts +4 -0
- package/dist/components/time-picker/types.d.ts +23 -0
- package/dist/components/time-picker/types.js +1 -0
- package/dist/components/toast/index.d.ts +4 -0
- package/dist/components/toast/index.js +2 -0
- package/dist/components/toast/toast.svelte +68 -0
- package/dist/components/toast/toast.svelte.d.ts +16 -0
- package/dist/components/toggle/index.d.ts +2 -0
- package/dist/components/toggle/index.js +1 -0
- package/dist/components/toggle/toggle-variants.d.ts +14 -0
- package/dist/components/toggle/toggle-variants.js +19 -0
- package/dist/components/toggle/toggle.svelte +57 -0
- package/dist/components/toggle/toggle.svelte.d.ts +19 -0
- package/dist/components/toggle-group/index.d.ts +2 -0
- package/dist/components/toggle-group/index.js +1 -0
- package/dist/components/toggle-group/toggle-group.svelte +163 -0
- package/dist/components/toggle-group/toggle-group.svelte.d.ts +32 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/tooltip/tooltip.svelte +65 -0
- package/dist/components/tooltip/tooltip.svelte.d.ts +18 -0
- package/dist/components/tree-view/index.d.ts +3 -0
- package/dist/components/tree-view/index.js +2 -0
- package/dist/components/tree-view/move-tree-node.d.ts +7 -0
- package/dist/components/tree-view/move-tree-node.js +57 -0
- package/dist/components/tree-view/tree-view.svelte +553 -0
- package/dist/components/tree-view/tree-view.svelte.d.ts +4 -0
- package/dist/components/tree-view/types.d.ts +45 -0
- package/dist/components/tree-view/types.js +1 -0
- package/dist/form/create-form.svelte.d.ts +23 -0
- package/dist/form/create-form.svelte.js +68 -0
- package/dist/form/index.d.ts +4 -0
- package/dist/form/index.js +2 -0
- package/dist/form/superform-errors.d.ts +6 -0
- package/dist/form/superform-errors.js +13 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.js +71 -0
- package/dist/styles/theme.css +385 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +1 -0
- package/dist/types/menu.d.ts +51 -0
- package/dist/types/menu.js +1 -0
- package/dist/utils/clipboard.d.ts +13 -0
- package/dist/utils/clipboard.js +22 -0
- package/dist/utils/cls.d.ts +5 -0
- package/dist/utils/cls.js +8 -0
- package/dist/utils/format.d.ts +24 -0
- package/dist/utils/format.js +82 -0
- package/dist/utils/highlight.d.ts +4 -0
- package/dist/utils/highlight.js +82 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/package.json +123 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type Props = {
|
|
2
|
+
checked?: boolean;
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
name?: string;
|
|
6
|
+
value?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
class?: string;
|
|
10
|
+
switchClass?: string;
|
|
11
|
+
labelClass?: string;
|
|
12
|
+
descriptionClass?: string;
|
|
13
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
14
|
+
};
|
|
15
|
+
declare const Switch: import("svelte").Component<Props, {}, "checked">;
|
|
16
|
+
type Switch = ReturnType<typeof Switch>;
|
|
17
|
+
export default Switch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Table } from './table.svelte';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script lang="ts" generics="T extends object">
|
|
2
|
+
import { cls } from '../../utils/index.js';
|
|
3
|
+
import type { Props, TableColumn } from './types.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
data,
|
|
7
|
+
columns,
|
|
8
|
+
caption,
|
|
9
|
+
empty,
|
|
10
|
+
cell,
|
|
11
|
+
getRowKey = (_row, index) => index,
|
|
12
|
+
class: className,
|
|
13
|
+
tableClass,
|
|
14
|
+
}: Props<T> = $props();
|
|
15
|
+
|
|
16
|
+
function formatCell(column: TableColumn<T>, row: T): string {
|
|
17
|
+
const value = column.accessor(row);
|
|
18
|
+
if (column.format) return column.format(value, row);
|
|
19
|
+
if (value === null || value === undefined) return '—';
|
|
20
|
+
return String(value);
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<div data-slot="table" class={cls('relative w-full overflow-x-auto', className)}>
|
|
25
|
+
<table data-slot="table-table" class={cls('w-full caption-bottom text-sm', tableClass)}>
|
|
26
|
+
{#if caption}
|
|
27
|
+
<caption class="sr-only">{caption}</caption>
|
|
28
|
+
{/if}
|
|
29
|
+
<thead data-slot="table-header" class="[&_tr]:border-b">
|
|
30
|
+
<tr class="border-b transition-colors hover:bg-muted/50">
|
|
31
|
+
{#each columns as column (column.id)}
|
|
32
|
+
<th
|
|
33
|
+
scope="col"
|
|
34
|
+
data-slot="table-head"
|
|
35
|
+
class={cls(
|
|
36
|
+
'h-10 px-3 text-left align-middle text-xs font-medium text-muted-foreground',
|
|
37
|
+
column.headerClass,
|
|
38
|
+
)}
|
|
39
|
+
>
|
|
40
|
+
{column.header}
|
|
41
|
+
</th>
|
|
42
|
+
{/each}
|
|
43
|
+
</tr>
|
|
44
|
+
</thead>
|
|
45
|
+
<tbody data-slot="table-body" class="[&_tr:last-child]:border-0">
|
|
46
|
+
{#each data as row, index (getRowKey(row, index))}
|
|
47
|
+
<tr class="border-b transition-colors hover:bg-muted/50" data-slot="table-row">
|
|
48
|
+
{#each columns as column (column.id)}
|
|
49
|
+
<td data-slot="table-cell" class={cls('p-3 align-middle', column.class)}>
|
|
50
|
+
{#if cell}
|
|
51
|
+
{@render cell(row, column)}
|
|
52
|
+
{:else}
|
|
53
|
+
{formatCell(column, row)}
|
|
54
|
+
{/if}
|
|
55
|
+
</td>
|
|
56
|
+
{/each}
|
|
57
|
+
</tr>
|
|
58
|
+
{:else}
|
|
59
|
+
<tr class="border-b">
|
|
60
|
+
<td colspan={columns.length} class="p-6 text-center text-sm text-muted-foreground">
|
|
61
|
+
{#if empty}
|
|
62
|
+
{@render empty()}
|
|
63
|
+
{:else}
|
|
64
|
+
No results.
|
|
65
|
+
{/if}
|
|
66
|
+
</td>
|
|
67
|
+
</tr>
|
|
68
|
+
{/each}
|
|
69
|
+
</tbody>
|
|
70
|
+
</table>
|
|
71
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Props } from './types.js';
|
|
2
|
+
declare function $$render<T extends object>(): {
|
|
3
|
+
props: Props<T>;
|
|
4
|
+
exports: {};
|
|
5
|
+
bindings: "";
|
|
6
|
+
slots: {};
|
|
7
|
+
events: {};
|
|
8
|
+
};
|
|
9
|
+
declare class __sveltets_Render<T extends object> {
|
|
10
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
11
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
12
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
13
|
+
bindings(): "";
|
|
14
|
+
exports(): {};
|
|
15
|
+
}
|
|
16
|
+
interface $$IsomorphicComponent {
|
|
17
|
+
new <T extends object>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
18
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
19
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
20
|
+
<T extends object>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
21
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
22
|
+
}
|
|
23
|
+
declare const Table: $$IsomorphicComponent;
|
|
24
|
+
type Table<T extends object> = InstanceType<typeof Table<T>>;
|
|
25
|
+
export default Table;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export type TableColumn<T extends object> = {
|
|
3
|
+
id: string;
|
|
4
|
+
header: string;
|
|
5
|
+
accessor: (row: T) => unknown;
|
|
6
|
+
format?: (value: unknown, row: T) => string;
|
|
7
|
+
class?: string;
|
|
8
|
+
headerClass?: string;
|
|
9
|
+
};
|
|
10
|
+
export type Props<T extends object> = {
|
|
11
|
+
data: T[];
|
|
12
|
+
columns: TableColumn<T>[];
|
|
13
|
+
caption?: string;
|
|
14
|
+
empty?: Snippet;
|
|
15
|
+
cell?: Snippet<[T, TableColumn<T>]>;
|
|
16
|
+
getRowKey?: (row: T, index: number) => string | number;
|
|
17
|
+
class?: string;
|
|
18
|
+
tableClass?: string;
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Tabs, type TabsActivationMode, type TabsItem, type TabsOrientation, type Props as TabsProps, } from './tabs.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Tabs, } from './tabs.svelte';
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Component, Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
export type TabsItem = {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
icon?: Component<{ class?: string }>;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type TabsOrientation = 'horizontal' | 'vertical';
|
|
12
|
+
export type TabsActivationMode = 'automatic' | 'manual';
|
|
13
|
+
|
|
14
|
+
export type Props = {
|
|
15
|
+
items: TabsItem[];
|
|
16
|
+
value?: string;
|
|
17
|
+
onValueChange?: (value: string) => void;
|
|
18
|
+
orientation?: TabsOrientation;
|
|
19
|
+
activationMode?: TabsActivationMode;
|
|
20
|
+
loop?: boolean;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
ariaLabel?: string;
|
|
23
|
+
class?: string;
|
|
24
|
+
listClass?: string;
|
|
25
|
+
triggerClass?: string;
|
|
26
|
+
contentClass?: string;
|
|
27
|
+
trigger?: Snippet<[TabsItem]>;
|
|
28
|
+
content?: Snippet<[TabsItem]>;
|
|
29
|
+
};
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<script lang="ts">
|
|
33
|
+
import { Tabs as BitsTabs } from 'bits-ui';
|
|
34
|
+
import { cls } from '../../utils/index.js';
|
|
35
|
+
|
|
36
|
+
let {
|
|
37
|
+
items,
|
|
38
|
+
value = $bindable(items[0]?.value ?? ''),
|
|
39
|
+
onValueChange,
|
|
40
|
+
orientation = 'horizontal',
|
|
41
|
+
activationMode = 'automatic',
|
|
42
|
+
loop,
|
|
43
|
+
disabled,
|
|
44
|
+
ariaLabel = 'Tabs',
|
|
45
|
+
class: className,
|
|
46
|
+
listClass,
|
|
47
|
+
triggerClass,
|
|
48
|
+
contentClass,
|
|
49
|
+
trigger: triggerSnippet,
|
|
50
|
+
content: contentSnippet,
|
|
51
|
+
}: Props = $props();
|
|
52
|
+
|
|
53
|
+
const isVertical = $derived(orientation === 'vertical');
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<BitsTabs.Root
|
|
57
|
+
bind:value
|
|
58
|
+
{onValueChange}
|
|
59
|
+
{orientation}
|
|
60
|
+
{activationMode}
|
|
61
|
+
{loop}
|
|
62
|
+
{disabled}
|
|
63
|
+
data-slot="tabs"
|
|
64
|
+
class={cls('flex gap-2', isVertical ? 'flex-row' : 'flex-col', className)}
|
|
65
|
+
>
|
|
66
|
+
<BitsTabs.List
|
|
67
|
+
aria-label={ariaLabel}
|
|
68
|
+
data-slot="tabs-list"
|
|
69
|
+
class={cls(
|
|
70
|
+
'inline-flex items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground',
|
|
71
|
+
isVertical ? 'h-auto flex-col' : 'h-9',
|
|
72
|
+
listClass,
|
|
73
|
+
)}
|
|
74
|
+
>
|
|
75
|
+
{#each items as item (item.value)}
|
|
76
|
+
<BitsTabs.Trigger
|
|
77
|
+
value={item.value}
|
|
78
|
+
disabled={item.disabled}
|
|
79
|
+
data-slot="tabs-trigger"
|
|
80
|
+
class={cls(
|
|
81
|
+
'inline-flex items-center justify-center gap-1.5 rounded-md px-3 py-1 text-sm font-medium whitespace-nowrap transition-[color,background-color,box-shadow] duration-150 ease-out motion-reduce:transition-none',
|
|
82
|
+
'focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-hidden',
|
|
83
|
+
'disabled:pointer-events-none disabled:opacity-50',
|
|
84
|
+
'data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm',
|
|
85
|
+
isVertical && 'w-full justify-start',
|
|
86
|
+
triggerClass,
|
|
87
|
+
)}
|
|
88
|
+
>
|
|
89
|
+
{#if triggerSnippet}
|
|
90
|
+
{@render triggerSnippet(item)}
|
|
91
|
+
{:else}
|
|
92
|
+
{#if item.icon}
|
|
93
|
+
{@const Icon = item.icon}
|
|
94
|
+
<Icon class="size-4" />
|
|
95
|
+
{/if}
|
|
96
|
+
{item.label}
|
|
97
|
+
{/if}
|
|
98
|
+
</BitsTabs.Trigger>
|
|
99
|
+
{/each}
|
|
100
|
+
</BitsTabs.List>
|
|
101
|
+
|
|
102
|
+
{#each items as item (item.value)}
|
|
103
|
+
<BitsTabs.Content
|
|
104
|
+
value={item.value}
|
|
105
|
+
data-slot="tabs-content"
|
|
106
|
+
class={cls(
|
|
107
|
+
'text-sm focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-hidden',
|
|
108
|
+
isVertical ? 'flex-1' : 'mt-2',
|
|
109
|
+
contentClass,
|
|
110
|
+
)}
|
|
111
|
+
>
|
|
112
|
+
{#if contentSnippet}
|
|
113
|
+
{@render contentSnippet(item)}
|
|
114
|
+
{/if}
|
|
115
|
+
</BitsTabs.Content>
|
|
116
|
+
{/each}
|
|
117
|
+
</BitsTabs.Root>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Component, Snippet } from 'svelte';
|
|
2
|
+
export type TabsItem = {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: Component<{
|
|
6
|
+
class?: string;
|
|
7
|
+
}>;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type TabsOrientation = 'horizontal' | 'vertical';
|
|
11
|
+
export type TabsActivationMode = 'automatic' | 'manual';
|
|
12
|
+
export type Props = {
|
|
13
|
+
items: TabsItem[];
|
|
14
|
+
value?: string;
|
|
15
|
+
onValueChange?: (value: string) => void;
|
|
16
|
+
orientation?: TabsOrientation;
|
|
17
|
+
activationMode?: TabsActivationMode;
|
|
18
|
+
loop?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
ariaLabel?: string;
|
|
21
|
+
class?: string;
|
|
22
|
+
listClass?: string;
|
|
23
|
+
triggerClass?: string;
|
|
24
|
+
contentClass?: string;
|
|
25
|
+
trigger?: Snippet<[TabsItem]>;
|
|
26
|
+
content?: Snippet<[TabsItem]>;
|
|
27
|
+
};
|
|
28
|
+
declare const Tabs: Component<Props, {}, "value">;
|
|
29
|
+
type Tabs = ReturnType<typeof Tabs>;
|
|
30
|
+
export default Tabs;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TagsInput } from './tags-input.svelte';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits pasted text into tags on the configured separator characters.
|
|
3
|
+
*
|
|
4
|
+
* Newlines are always treated as separators, even when the caller omits them.
|
|
5
|
+
*/
|
|
6
|
+
export function splitTags(value, separators) {
|
|
7
|
+
const separatorSet = new Set([...separators, '\n', '\r']);
|
|
8
|
+
const parts = [];
|
|
9
|
+
let current = '';
|
|
10
|
+
for (const character of value) {
|
|
11
|
+
if (!separatorSet.has(character)) {
|
|
12
|
+
current += character;
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
const next = current.trim();
|
|
16
|
+
if (next)
|
|
17
|
+
parts.push(next);
|
|
18
|
+
current = '';
|
|
19
|
+
}
|
|
20
|
+
const next = current.trim();
|
|
21
|
+
if (next)
|
|
22
|
+
parts.push(next);
|
|
23
|
+
return parts;
|
|
24
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { XIcon } from '@lucide/svelte';
|
|
3
|
+
import { cls } from '../../utils/index.js';
|
|
4
|
+
import { splitTags } from './parse.js';
|
|
5
|
+
import type { Props } from './types.js';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
value = $bindable([]),
|
|
9
|
+
onValueChange,
|
|
10
|
+
placeholder = 'Add a tag...',
|
|
11
|
+
ariaLabel,
|
|
12
|
+
id,
|
|
13
|
+
describedBy,
|
|
14
|
+
invalid = false,
|
|
15
|
+
disabled = false,
|
|
16
|
+
maxTags,
|
|
17
|
+
validate,
|
|
18
|
+
normalize = (tag: string): string => tag.trim(),
|
|
19
|
+
separators = [',', ';'],
|
|
20
|
+
commitOnBlur = true,
|
|
21
|
+
allowDuplicates = false,
|
|
22
|
+
onInvalid,
|
|
23
|
+
class: className,
|
|
24
|
+
inputClass,
|
|
25
|
+
chipClass,
|
|
26
|
+
}: Props = $props();
|
|
27
|
+
|
|
28
|
+
let inputValue = $state('');
|
|
29
|
+
let inputElement = $state<HTMLInputElement | null>(null);
|
|
30
|
+
let announcement = $state('');
|
|
31
|
+
let announceTimer: ReturnType<typeof setTimeout> | undefined;
|
|
32
|
+
|
|
33
|
+
const atLimit = $derived(maxTags !== undefined && value.length >= maxTags);
|
|
34
|
+
const isInputDisabled = $derived(disabled || atLimit);
|
|
35
|
+
const inputPlaceholder = $derived(value.length === 0 && !atLimit ? placeholder : '');
|
|
36
|
+
|
|
37
|
+
$effect(() => {
|
|
38
|
+
return () => {
|
|
39
|
+
if (announceTimer) clearTimeout(announceTimer);
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
function announce(message: string): void {
|
|
44
|
+
announcement = message;
|
|
45
|
+
if (announceTimer) clearTimeout(announceTimer);
|
|
46
|
+
announceTimer = setTimeout(() => {
|
|
47
|
+
announcement = '';
|
|
48
|
+
announceTimer = undefined;
|
|
49
|
+
}, 1800);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function addTag(raw: string): boolean {
|
|
53
|
+
const next = normalize(raw);
|
|
54
|
+
if (!next) return false;
|
|
55
|
+
|
|
56
|
+
if (atLimit) {
|
|
57
|
+
onInvalid?.(next, 'limit');
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (validate && !validate(next)) {
|
|
62
|
+
onInvalid?.(next, 'invalid');
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!allowDuplicates && value.some((tag) => normalize(tag) === next)) {
|
|
67
|
+
onInvalid?.(next, 'duplicate');
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
value = [...value, next];
|
|
72
|
+
onValueChange?.(value);
|
|
73
|
+
announce(`Added ${next}.`);
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function commitInput(): void {
|
|
78
|
+
if (addTag(inputValue)) inputValue = '';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function removeTag(index: number): void {
|
|
82
|
+
const removed = value[index];
|
|
83
|
+
if (removed === undefined) return;
|
|
84
|
+
|
|
85
|
+
const next = value.filter((_, itemIndex) => itemIndex !== index);
|
|
86
|
+
value = next;
|
|
87
|
+
onValueChange?.(next);
|
|
88
|
+
announce(`Removed ${removed}.`);
|
|
89
|
+
inputElement?.focus();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function handleKeydown(event: KeyboardEvent): void {
|
|
93
|
+
if (event.isComposing) return;
|
|
94
|
+
|
|
95
|
+
if (event.key === 'Enter' || separators.includes(event.key)) {
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
commitInput();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (event.key === 'Backspace' && inputValue === '' && value.length > 0) {
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
removeTag(value.length - 1);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function handlePaste(event: ClipboardEvent): void {
|
|
108
|
+
const pasted = event.clipboardData?.getData('text/plain');
|
|
109
|
+
if (!pasted) return;
|
|
110
|
+
|
|
111
|
+
const parts = splitTags(pasted, separators);
|
|
112
|
+
if (parts.length <= 1) return;
|
|
113
|
+
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
let added = false;
|
|
116
|
+
|
|
117
|
+
for (const part of parts) {
|
|
118
|
+
if (addTag(part)) added = true;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (added) inputValue = '';
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function handleBlur(): void {
|
|
125
|
+
if (commitOnBlur) commitInput();
|
|
126
|
+
}
|
|
127
|
+
</script>
|
|
128
|
+
|
|
129
|
+
<div
|
|
130
|
+
data-slot="tags-input"
|
|
131
|
+
class={cls(
|
|
132
|
+
'relative flex min-h-9 w-full flex-wrap items-center gap-1 rounded-md border border-input bg-background px-2 py-1 text-sm shadow-xs transition-[color,box-shadow] duration-150 ease-out motion-reduce:transition-none',
|
|
133
|
+
'focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background',
|
|
134
|
+
invalid && 'border-destructive focus-within:ring-destructive',
|
|
135
|
+
disabled && 'cursor-not-allowed bg-muted/30',
|
|
136
|
+
className,
|
|
137
|
+
)}
|
|
138
|
+
>
|
|
139
|
+
{#each value as tag, index (`${tag}-${index}`)}
|
|
140
|
+
<span
|
|
141
|
+
data-slot="tags-input-chip"
|
|
142
|
+
class={cls(
|
|
143
|
+
'inline-flex max-w-full items-center gap-1 rounded-sm bg-secondary px-1.5 py-0.5 text-xs text-secondary-foreground',
|
|
144
|
+
chipClass,
|
|
145
|
+
)}
|
|
146
|
+
>
|
|
147
|
+
<span class="truncate">{tag}</span>
|
|
148
|
+
<button
|
|
149
|
+
type="button"
|
|
150
|
+
data-slot="tags-input-remove"
|
|
151
|
+
aria-label={`Remove ${tag}`}
|
|
152
|
+
class="rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden disabled:pointer-events-none"
|
|
153
|
+
{disabled}
|
|
154
|
+
onclick={() => removeTag(index)}
|
|
155
|
+
>
|
|
156
|
+
<XIcon class="size-3" />
|
|
157
|
+
</button>
|
|
158
|
+
</span>
|
|
159
|
+
{/each}
|
|
160
|
+
|
|
161
|
+
<input
|
|
162
|
+
bind:this={inputElement}
|
|
163
|
+
bind:value={inputValue}
|
|
164
|
+
{id}
|
|
165
|
+
data-slot="tags-input-input"
|
|
166
|
+
aria-label={ariaLabel ?? placeholder}
|
|
167
|
+
aria-describedby={describedBy}
|
|
168
|
+
aria-invalid={invalid || undefined}
|
|
169
|
+
disabled={isInputDisabled}
|
|
170
|
+
placeholder={inputPlaceholder}
|
|
171
|
+
onkeydown={handleKeydown}
|
|
172
|
+
onpaste={handlePaste}
|
|
173
|
+
onblur={handleBlur}
|
|
174
|
+
class={cls(
|
|
175
|
+
'min-w-20 flex-1 border-0 bg-transparent p-0 text-sm shadow-none outline-hidden placeholder:text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0 disabled:cursor-not-allowed',
|
|
176
|
+
inputClass,
|
|
177
|
+
)}
|
|
178
|
+
/>
|
|
179
|
+
|
|
180
|
+
<span class="sr-only" role="status" aria-live="polite">{announcement}</span>
|
|
181
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type TagsInputInvalidReason = 'invalid' | 'duplicate' | 'limit';
|
|
2
|
+
export type Props = {
|
|
3
|
+
value?: string[];
|
|
4
|
+
onValueChange?: (value: string[]) => void;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
ariaLabel?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
describedBy?: string;
|
|
9
|
+
invalid?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
maxTags?: number;
|
|
12
|
+
validate?: (value: string) => boolean;
|
|
13
|
+
normalize?: (value: string) => string;
|
|
14
|
+
separators?: string[];
|
|
15
|
+
commitOnBlur?: boolean;
|
|
16
|
+
allowDuplicates?: boolean;
|
|
17
|
+
onInvalid?: (value: string, reason: TagsInputInvalidReason) => void;
|
|
18
|
+
class?: string;
|
|
19
|
+
inputClass?: string;
|
|
20
|
+
chipClass?: string;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Textarea } from './textarea.svelte';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
3
|
+
import type { WithElementRef } from '../../types/index.js';
|
|
4
|
+
|
|
5
|
+
export type Props = WithElementRef<Omit<HTMLTextareaAttributes, 'value'>> & {
|
|
6
|
+
value?: string;
|
|
7
|
+
};
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { cls } from '../../utils/index.js';
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
class: className,
|
|
15
|
+
value = $bindable(''),
|
|
16
|
+
ref = $bindable(null),
|
|
17
|
+
rows = 3,
|
|
18
|
+
...restProps
|
|
19
|
+
}: Props = $props();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<textarea
|
|
23
|
+
bind:this={ref}
|
|
24
|
+
bind:value
|
|
25
|
+
{rows}
|
|
26
|
+
data-slot="textarea"
|
|
27
|
+
class={cls(
|
|
28
|
+
'flex min-h-20 w-full resize-y rounded-md border border-input bg-background px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] duration-150 ease-out motion-reduce:transition-none',
|
|
29
|
+
'placeholder:text-muted-foreground',
|
|
30
|
+
'focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-hidden',
|
|
31
|
+
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
32
|
+
'aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive',
|
|
33
|
+
className,
|
|
34
|
+
)}
|
|
35
|
+
{...restProps}></textarea>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
2
|
+
import type { WithElementRef } from '../../types/index.js';
|
|
3
|
+
export type Props = WithElementRef<Omit<HTMLTextareaAttributes, 'value'>> & {
|
|
4
|
+
value?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const Textarea: import("svelte").Component<Props, {}, "value" | "ref">;
|
|
7
|
+
type Textarea = ReturnType<typeof Textarea>;
|
|
8
|
+
export default Textarea;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TimeAgo, type Props as TimeAgoProps } from './time-ago.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TimeAgo } from './time-ago.svelte';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { DateInput } from '../../utils/format.js';
|
|
3
|
+
|
|
4
|
+
export type Props = {
|
|
5
|
+
/** The timestamp to describe relative to the current time. */
|
|
6
|
+
date: DateInput;
|
|
7
|
+
class?: string;
|
|
8
|
+
};
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { onMount } from 'svelte';
|
|
13
|
+
import { formatRelativeTime } from '../../utils/format.js';
|
|
14
|
+
import { cls } from '../../utils/index.js';
|
|
15
|
+
|
|
16
|
+
const absoluteFormat = new Intl.DateTimeFormat('en', {
|
|
17
|
+
dateStyle: 'medium',
|
|
18
|
+
timeStyle: 'short',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
let { date, class: className }: Props = $props();
|
|
22
|
+
|
|
23
|
+
let now = $state(new Date());
|
|
24
|
+
|
|
25
|
+
onMount(() => {
|
|
26
|
+
const timer = setInterval(() => {
|
|
27
|
+
now = new Date();
|
|
28
|
+
}, 60_000);
|
|
29
|
+
|
|
30
|
+
return () => clearInterval(timer);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const parsedDate = $derived(date instanceof Date ? date : new Date(date));
|
|
34
|
+
const isValidDate = $derived(!Number.isNaN(parsedDate.getTime()));
|
|
35
|
+
const isoDate = $derived(isValidDate ? parsedDate.toISOString() : undefined);
|
|
36
|
+
const absoluteLabel = $derived(isValidDate ? absoluteFormat.format(parsedDate) : 'Invalid date');
|
|
37
|
+
const relativeLabel = $derived(formatRelativeTime(date, now));
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<time
|
|
41
|
+
data-slot="time-ago"
|
|
42
|
+
datetime={isoDate}
|
|
43
|
+
title={absoluteLabel}
|
|
44
|
+
aria-label={absoluteLabel}
|
|
45
|
+
class={cls('whitespace-nowrap', className)}
|
|
46
|
+
>
|
|
47
|
+
{relativeLabel}
|
|
48
|
+
</time>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DateInput } from '../../utils/format.js';
|
|
2
|
+
export type Props = {
|
|
3
|
+
/** The timestamp to describe relative to the current time. */
|
|
4
|
+
date: DateInput;
|
|
5
|
+
class?: string;
|
|
6
|
+
};
|
|
7
|
+
declare const TimeAgo: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type TimeAgo = ReturnType<typeof TimeAgo>;
|
|
9
|
+
export default TimeAgo;
|