svelora 2.1.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 +145 -0
- package/dist/Accordion/Accordion.svelte +207 -0
- package/dist/Accordion/Accordion.svelte.d.ts +6 -0
- package/dist/Accordion/accordion.types.d.ts +225 -0
- package/dist/Accordion/accordion.types.js +1 -0
- package/dist/Accordion/accordion.variants.d.ts +88 -0
- package/dist/Accordion/accordion.variants.js +28 -0
- package/dist/Accordion/index.d.ts +2 -0
- package/dist/Accordion/index.js +1 -0
- package/dist/Alert/Alert.svelte +131 -0
- package/dist/Alert/Alert.svelte.d.ts +5 -0
- package/dist/Alert/alert.types.d.ts +103 -0
- package/dist/Alert/alert.types.js +1 -0
- package/dist/Alert/alert.variants.d.ts +213 -0
- package/dist/Alert/alert.variants.js +293 -0
- package/dist/Alert/index.d.ts +2 -0
- package/dist/Alert/index.js +1 -0
- package/dist/Avatar/Avatar.svelte +114 -0
- package/dist/Avatar/Avatar.svelte.d.ts +6 -0
- package/dist/Avatar/avatar.types.d.ts +73 -0
- package/dist/Avatar/avatar.types.js +1 -0
- package/dist/Avatar/avatar.variants.d.ts +316 -0
- package/dist/Avatar/avatar.variants.js +39 -0
- package/dist/Avatar/index.d.ts +2 -0
- package/dist/Avatar/index.js +1 -0
- package/dist/AvatarGroup/AvatarGroup.svelte +71 -0
- package/dist/AvatarGroup/AvatarGroup.svelte.d.ts +5 -0
- package/dist/AvatarGroup/avatar-group.types.d.ts +49 -0
- package/dist/AvatarGroup/avatar-group.types.js +1 -0
- package/dist/AvatarGroup/avatar-group.variants.d.ts +258 -0
- package/dist/AvatarGroup/avatar-group.variants.js +35 -0
- package/dist/AvatarGroup/index.d.ts +2 -0
- package/dist/AvatarGroup/index.js +1 -0
- package/dist/Badge/Badge.svelte +79 -0
- package/dist/Badge/Badge.svelte.d.ts +5 -0
- package/dist/Badge/badge.types.d.ts +83 -0
- package/dist/Badge/badge.types.js +1 -0
- package/dist/Badge/badge.variants.d.ts +303 -0
- package/dist/Badge/badge.variants.js +259 -0
- package/dist/Badge/index.d.ts +2 -0
- package/dist/Badge/index.js +1 -0
- package/dist/Banner/Banner.svelte +130 -0
- package/dist/Banner/Banner.svelte.d.ts +5 -0
- package/dist/Banner/banner.types.d.ts +148 -0
- package/dist/Banner/banner.types.js +1 -0
- package/dist/Banner/banner.variants.d.ts +293 -0
- package/dist/Banner/banner.variants.js +86 -0
- package/dist/Banner/index.d.ts +2 -0
- package/dist/Banner/index.js +1 -0
- package/dist/Breadcrumb/Breadcrumb.svelte +79 -0
- package/dist/Breadcrumb/Breadcrumb.svelte.d.ts +5 -0
- package/dist/Breadcrumb/breadcrumb.types.d.ts +66 -0
- package/dist/Breadcrumb/breadcrumb.types.js +1 -0
- package/dist/Breadcrumb/breadcrumb.variants.d.ts +138 -0
- package/dist/Breadcrumb/breadcrumb.variants.js +53 -0
- package/dist/Breadcrumb/index.d.ts +2 -0
- package/dist/Breadcrumb/index.js +1 -0
- package/dist/Button/Button.svelte +177 -0
- package/dist/Button/Button.svelte.d.ts +5 -0
- package/dist/Button/button.types.d.ts +151 -0
- package/dist/Button/button.types.js +1 -0
- package/dist/Button/button.variants.d.ts +388 -0
- package/dist/Button/button.variants.js +461 -0
- package/dist/Button/index.d.ts +2 -0
- package/dist/Button/index.js +1 -0
- package/dist/Calendar/Calendar.svelte +344 -0
- package/dist/Calendar/Calendar.svelte.d.ts +6 -0
- package/dist/Calendar/calendar.types.d.ts +122 -0
- package/dist/Calendar/calendar.types.js +1 -0
- package/dist/Calendar/calendar.variants.d.ts +553 -0
- package/dist/Calendar/calendar.variants.js +368 -0
- package/dist/Calendar/index.d.ts +2 -0
- package/dist/Calendar/index.js +1 -0
- package/dist/Card/Card.svelte +54 -0
- package/dist/Card/Card.svelte.d.ts +5 -0
- package/dist/Card/card.types.d.ts +36 -0
- package/dist/Card/card.types.js +1 -0
- package/dist/Card/card.variants.d.ts +108 -0
- package/dist/Card/card.variants.js +32 -0
- package/dist/Card/index.d.ts +2 -0
- package/dist/Card/index.js +1 -0
- package/dist/Carousel/Carousel.svelte +277 -0
- package/dist/Carousel/Carousel.svelte.d.ts +26 -0
- package/dist/Carousel/carousel.types.d.ts +251 -0
- package/dist/Carousel/carousel.types.js +1 -0
- package/dist/Carousel/carousel.variants.d.ts +408 -0
- package/dist/Carousel/carousel.variants.js +88 -0
- package/dist/Carousel/index.d.ts +2 -0
- package/dist/Carousel/index.js +1 -0
- package/dist/Checkbox/Checkbox.svelte +161 -0
- package/dist/Checkbox/Checkbox.svelte.d.ts +6 -0
- package/dist/Checkbox/checkbox.types.d.ts +101 -0
- package/dist/Checkbox/checkbox.types.js +1 -0
- package/dist/Checkbox/checkbox.variants.d.ts +448 -0
- package/dist/Checkbox/checkbox.variants.js +209 -0
- package/dist/Checkbox/index.d.ts +2 -0
- package/dist/Checkbox/index.js +1 -0
- package/dist/CheckboxGroup/CheckboxGroup.svelte +219 -0
- package/dist/CheckboxGroup/CheckboxGroup.svelte.d.ts +5 -0
- package/dist/CheckboxGroup/checkbox-group.types.d.ts +130 -0
- package/dist/CheckboxGroup/checkbox-group.types.js +1 -0
- package/dist/CheckboxGroup/checkbox-group.variants.d.ts +553 -0
- package/dist/CheckboxGroup/checkbox-group.variants.js +231 -0
- package/dist/CheckboxGroup/index.d.ts +2 -0
- package/dist/CheckboxGroup/index.js +1 -0
- package/dist/Chip/Chip.svelte +51 -0
- package/dist/Chip/Chip.svelte.d.ts +5 -0
- package/dist/Chip/chip.types.d.ts +66 -0
- package/dist/Chip/chip.types.js +1 -0
- package/dist/Chip/chip.variants.d.ts +418 -0
- package/dist/Chip/chip.variants.js +74 -0
- package/dist/Chip/index.d.ts +2 -0
- package/dist/Chip/index.js +1 -0
- package/dist/Collapsible/Collapsible.svelte +69 -0
- package/dist/Collapsible/Collapsible.svelte.d.ts +6 -0
- package/dist/Collapsible/CollapsibleTestWrapper.svelte +17 -0
- package/dist/Collapsible/CollapsibleTestWrapper.svelte.d.ts +4 -0
- package/dist/Collapsible/collapsible.types.d.ts +77 -0
- package/dist/Collapsible/collapsible.types.js +1 -0
- package/dist/Collapsible/collapsible.variants.d.ts +53 -0
- package/dist/Collapsible/collapsible.variants.js +21 -0
- package/dist/Collapsible/index.d.ts +2 -0
- package/dist/Collapsible/index.js +1 -0
- package/dist/Command/Command.svelte +183 -0
- package/dist/Command/Command.svelte.d.ts +6 -0
- package/dist/Command/CommandTestWrapper.svelte +13 -0
- package/dist/Command/CommandTestWrapper.svelte.d.ts +4 -0
- package/dist/Command/command.types.d.ts +100 -0
- package/dist/Command/command.types.js +1 -0
- package/dist/Command/command.variants.d.ts +226 -0
- package/dist/Command/command.variants.js +86 -0
- package/dist/Command/index.d.ts +2 -0
- package/dist/Command/index.js +1 -0
- package/dist/Container/Container.svelte +21 -0
- package/dist/Container/Container.svelte.d.ts +5 -0
- package/dist/Container/container.types.d.ts +19 -0
- package/dist/Container/container.types.js +1 -0
- package/dist/Container/container.variants.d.ts +29 -0
- package/dist/Container/container.variants.js +9 -0
- package/dist/Container/index.d.ts +2 -0
- package/dist/Container/index.js +1 -0
- package/dist/ContextMenu/ContextMenu.svelte +344 -0
- package/dist/ContextMenu/ContextMenu.svelte.d.ts +6 -0
- package/dist/ContextMenu/context-menu.types.d.ts +265 -0
- package/dist/ContextMenu/context-menu.types.js +1 -0
- package/dist/ContextMenu/context-menu.variants.d.ts +307 -0
- package/dist/ContextMenu/context-menu.variants.js +144 -0
- package/dist/ContextMenu/index.d.ts +2 -0
- package/dist/ContextMenu/index.js +1 -0
- package/dist/Drawer/Drawer.svelte +207 -0
- package/dist/Drawer/Drawer.svelte.d.ts +6 -0
- package/dist/Drawer/DrawerTriggerTestWrapper.svelte +10 -0
- package/dist/Drawer/DrawerTriggerTestWrapper.svelte.d.ts +18 -0
- package/dist/Drawer/drawer.types.d.ts +116 -0
- package/dist/Drawer/drawer.types.js +1 -0
- package/dist/Drawer/drawer.variants.d.ts +193 -0
- package/dist/Drawer/drawer.variants.js +139 -0
- package/dist/Drawer/index.d.ts +2 -0
- package/dist/Drawer/index.js +1 -0
- package/dist/DropdownMenu/DropdownMenu.svelte +363 -0
- package/dist/DropdownMenu/DropdownMenu.svelte.d.ts +6 -0
- package/dist/DropdownMenu/DropdownMenuTriggerTestWrapper.svelte +12 -0
- package/dist/DropdownMenu/DropdownMenuTriggerTestWrapper.svelte.d.ts +7 -0
- package/dist/DropdownMenu/dropdown-menu.types.d.ts +279 -0
- package/dist/DropdownMenu/dropdown-menu.types.js +1 -0
- package/dist/DropdownMenu/dropdown-menu.variants.d.ts +312 -0
- package/dist/DropdownMenu/dropdown-menu.variants.js +149 -0
- package/dist/DropdownMenu/index.d.ts +2 -0
- package/dist/DropdownMenu/index.js +1 -0
- package/dist/Editor/Editor.svelte +756 -0
- package/dist/Editor/Editor.svelte.d.ts +6 -0
- package/dist/Editor/EditorUrlPrompt.svelte +94 -0
- package/dist/Editor/EditorUrlPrompt.svelte.d.ts +15 -0
- package/dist/Editor/SlashPopup.svelte +74 -0
- package/dist/Editor/SlashPopup.svelte.d.ts +11 -0
- package/dist/Editor/editor.extensions.d.ts +23 -0
- package/dist/Editor/editor.extensions.js +132 -0
- package/dist/Editor/editor.schemas.d.ts +5 -0
- package/dist/Editor/editor.schemas.js +27 -0
- package/dist/Editor/editor.slash.svelte.d.ts +25 -0
- package/dist/Editor/editor.slash.svelte.js +299 -0
- package/dist/Editor/editor.suggestion.d.ts +7 -0
- package/dist/Editor/editor.suggestion.js +165 -0
- package/dist/Editor/editor.toolbar.d.ts +11 -0
- package/dist/Editor/editor.toolbar.js +204 -0
- package/dist/Editor/editor.types.d.ts +367 -0
- package/dist/Editor/editor.types.js +1 -0
- package/dist/Editor/editor.variants.d.ts +303 -0
- package/dist/Editor/editor.variants.js +135 -0
- package/dist/Editor/index.d.ts +55 -0
- package/dist/Editor/index.js +54 -0
- package/dist/Empty/Empty.svelte +118 -0
- package/dist/Empty/Empty.svelte.d.ts +5 -0
- package/dist/Empty/empty.types.d.ts +91 -0
- package/dist/Empty/empty.types.js +1 -0
- package/dist/Empty/empty.variants.d.ts +308 -0
- package/dist/Empty/empty.variants.js +73 -0
- package/dist/Empty/index.d.ts +2 -0
- package/dist/Empty/index.js +1 -0
- package/dist/FieldGroup/FieldGroup.svelte +53 -0
- package/dist/FieldGroup/FieldGroup.svelte.d.ts +5 -0
- package/dist/FieldGroup/field-group.types.d.ts +37 -0
- package/dist/FieldGroup/field-group.types.js +1 -0
- package/dist/FieldGroup/field-group.variants.d.ts +116 -0
- package/dist/FieldGroup/field-group.variants.js +49 -0
- package/dist/FieldGroup/index.d.ts +2 -0
- package/dist/FieldGroup/index.js +1 -0
- package/dist/FileUpload/FileUpload.svelte +639 -0
- package/dist/FileUpload/FileUpload.svelte.d.ts +8 -0
- package/dist/FileUpload/file-upload.types.d.ts +203 -0
- package/dist/FileUpload/file-upload.types.js +1 -0
- package/dist/FileUpload/file-upload.variants.d.ts +397 -0
- package/dist/FileUpload/file-upload.variants.js +224 -0
- package/dist/FileUpload/index.d.ts +2 -0
- package/dist/FileUpload/index.js +1 -0
- package/dist/Form/Form.svelte +197 -0
- package/dist/Form/Form.svelte.d.ts +26 -0
- package/dist/Form/form.context.svelte.d.ts +64 -0
- package/dist/Form/form.context.svelte.js +478 -0
- package/dist/Form/form.types.d.ts +164 -0
- package/dist/Form/form.types.js +12 -0
- package/dist/Form/form.variants.d.ts +39 -0
- package/dist/Form/form.variants.js +17 -0
- package/dist/Form/index.d.ts +4 -0
- package/dist/Form/index.js +6 -0
- package/dist/Form/validate-schema.d.ts +13 -0
- package/dist/Form/validate-schema.js +113 -0
- package/dist/FormField/FormField.svelte +186 -0
- package/dist/FormField/FormField.svelte.d.ts +5 -0
- package/dist/FormField/form-field.types.d.ts +109 -0
- package/dist/FormField/form-field.types.js +1 -0
- package/dist/FormField/form-field.variants.d.ts +313 -0
- package/dist/FormField/form-field.variants.js +74 -0
- package/dist/FormField/index.d.ts +2 -0
- package/dist/FormField/index.js +1 -0
- package/dist/Icon/Icon.svelte +46 -0
- package/dist/Icon/Icon.svelte.d.ts +6 -0
- package/dist/Icon/icon.types.d.ts +49 -0
- package/dist/Icon/icon.types.js +1 -0
- package/dist/Icon/index.d.ts +2 -0
- package/dist/Icon/index.js +1 -0
- package/dist/Input/Input.svelte +199 -0
- package/dist/Input/Input.svelte.d.ts +26 -0
- package/dist/Input/index.d.ts +2 -0
- package/dist/Input/index.js +1 -0
- package/dist/Input/input.types.d.ts +113 -0
- package/dist/Input/input.types.js +1 -0
- package/dist/Input/input.variants.d.ts +398 -0
- package/dist/Input/input.variants.js +387 -0
- package/dist/Kbd/Kbd.svelte +45 -0
- package/dist/Kbd/Kbd.svelte.d.ts +5 -0
- package/dist/Kbd/index.d.ts +3 -0
- package/dist/Kbd/index.js +2 -0
- package/dist/Kbd/kbd.types.d.ts +91 -0
- package/dist/Kbd/kbd.types.js +1 -0
- package/dist/Kbd/kbd.variants.d.ts +180 -0
- package/dist/Kbd/kbd.variants.js +168 -0
- package/dist/Kbd/useKbd.svelte.d.ts +29 -0
- package/dist/Kbd/useKbd.svelte.js +248 -0
- package/dist/Link/Link.svelte +168 -0
- package/dist/Link/Link.svelte.d.ts +5 -0
- package/dist/Link/index.d.ts +2 -0
- package/dist/Link/index.js +1 -0
- package/dist/Link/link.types.d.ts +86 -0
- package/dist/Link/link.types.js +1 -0
- package/dist/Link/link.variants.d.ts +113 -0
- package/dist/Link/link.variants.js +43 -0
- package/dist/Modal/Modal.svelte +218 -0
- package/dist/Modal/Modal.svelte.d.ts +5 -0
- package/dist/Modal/ModalTriggerTestWrapper.svelte +10 -0
- package/dist/Modal/ModalTriggerTestWrapper.svelte.d.ts +18 -0
- package/dist/Modal/index.d.ts +2 -0
- package/dist/Modal/index.js +1 -0
- package/dist/Modal/modal.types.d.ts +155 -0
- package/dist/Modal/modal.types.js +1 -0
- package/dist/Modal/modal.variants.d.ts +303 -0
- package/dist/Modal/modal.variants.js +90 -0
- package/dist/Pagination/Pagination.svelte +253 -0
- package/dist/Pagination/Pagination.svelte.d.ts +6 -0
- package/dist/Pagination/index.d.ts +2 -0
- package/dist/Pagination/index.js +1 -0
- package/dist/Pagination/pagination.types.d.ts +191 -0
- package/dist/Pagination/pagination.types.js +1 -0
- package/dist/Pagination/pagination.variants.d.ts +160 -0
- package/dist/Pagination/pagination.variants.js +125 -0
- package/dist/PinInput/PinInput.svelte +162 -0
- package/dist/PinInput/PinInput.svelte.d.ts +6 -0
- package/dist/PinInput/index.d.ts +2 -0
- package/dist/PinInput/index.js +1 -0
- package/dist/PinInput/pin-input.types.d.ts +110 -0
- package/dist/PinInput/pin-input.types.js +1 -0
- package/dist/PinInput/pin-input.variants.d.ts +303 -0
- package/dist/PinInput/pin-input.variants.js +196 -0
- package/dist/Popover/Popover.svelte +122 -0
- package/dist/Popover/Popover.svelte.d.ts +6 -0
- package/dist/Popover/index.d.ts +2 -0
- package/dist/Popover/index.js +1 -0
- package/dist/Popover/popover.types.d.ts +58 -0
- package/dist/Popover/popover.types.js +1 -0
- package/dist/Popover/popover.variants.d.ts +53 -0
- package/dist/Popover/popover.variants.js +31 -0
- package/dist/Progress/Progress.svelte +135 -0
- package/dist/Progress/Progress.svelte.d.ts +6 -0
- package/dist/Progress/index.d.ts +2 -0
- package/dist/Progress/index.js +1 -0
- package/dist/Progress/progress.types.d.ts +71 -0
- package/dist/Progress/progress.types.js +1 -0
- package/dist/Progress/progress.variants.d.ts +513 -0
- package/dist/Progress/progress.variants.js +204 -0
- package/dist/RadioGroup/RadioGroup.svelte +226 -0
- package/dist/RadioGroup/RadioGroup.svelte.d.ts +6 -0
- package/dist/RadioGroup/index.d.ts +2 -0
- package/dist/RadioGroup/index.js +1 -0
- package/dist/RadioGroup/radio-group.types.d.ts +111 -0
- package/dist/RadioGroup/radio-group.types.js +1 -0
- package/dist/RadioGroup/radio-group.variants.d.ts +543 -0
- package/dist/RadioGroup/radio-group.variants.js +232 -0
- package/dist/Select/Select.svelte +461 -0
- package/dist/Select/Select.svelte.d.ts +6 -0
- package/dist/Select/index.d.ts +2 -0
- package/dist/Select/index.js +1 -0
- package/dist/Select/select.types.d.ts +263 -0
- package/dist/Select/select.types.js +1 -0
- package/dist/Select/select.variants.d.ts +713 -0
- package/dist/Select/select.variants.js +482 -0
- package/dist/SelectMenu/SelectMenu.svelte +637 -0
- package/dist/SelectMenu/SelectMenu.svelte.d.ts +5 -0
- package/dist/SelectMenu/SelectMenuFormFieldTestWrapper.svelte +11 -0
- package/dist/SelectMenu/SelectMenuFormFieldTestWrapper.svelte.d.ts +7 -0
- package/dist/SelectMenu/index.d.ts +2 -0
- package/dist/SelectMenu/index.js +1 -0
- package/dist/SelectMenu/select-menu.types.d.ts +326 -0
- package/dist/SelectMenu/select-menu.types.js +1 -0
- package/dist/SelectMenu/select-menu.variants.d.ts +795 -0
- package/dist/SelectMenu/select-menu.variants.js +70 -0
- package/dist/Separator/Separator.svelte +77 -0
- package/dist/Separator/Separator.svelte.d.ts +6 -0
- package/dist/Separator/index.d.ts +2 -0
- package/dist/Separator/index.js +1 -0
- package/dist/Separator/separator.types.d.ts +53 -0
- package/dist/Separator/separator.types.js +1 -0
- package/dist/Separator/separator.variants.d.ts +509 -0
- package/dist/Separator/separator.variants.js +110 -0
- package/dist/Skeleton/Skeleton.svelte +39 -0
- package/dist/Skeleton/Skeleton.svelte.d.ts +5 -0
- package/dist/Skeleton/index.d.ts +2 -0
- package/dist/Skeleton/index.js +1 -0
- package/dist/Skeleton/skeleton.types.d.ts +27 -0
- package/dist/Skeleton/skeleton.types.js +1 -0
- package/dist/Skeleton/skeleton.variants.d.ts +18 -0
- package/dist/Skeleton/skeleton.variants.js +12 -0
- package/dist/Slideover/Slideover.svelte +212 -0
- package/dist/Slideover/Slideover.svelte.d.ts +5 -0
- package/dist/Slideover/SlideoverTriggerTestWrapper.svelte +10 -0
- package/dist/Slideover/SlideoverTriggerTestWrapper.svelte.d.ts +18 -0
- package/dist/Slideover/index.d.ts +2 -0
- package/dist/Slideover/index.js +1 -0
- package/dist/Slideover/slideover.types.d.ts +154 -0
- package/dist/Slideover/slideover.types.js +1 -0
- package/dist/Slideover/slideover.variants.d.ts +298 -0
- package/dist/Slideover/slideover.variants.js +145 -0
- package/dist/Slider/Slider.svelte +129 -0
- package/dist/Slider/Slider.svelte.d.ts +6 -0
- package/dist/Slider/index.d.ts +2 -0
- package/dist/Slider/index.js +1 -0
- package/dist/Slider/slider.types.d.ts +55 -0
- package/dist/Slider/slider.types.js +1 -0
- package/dist/Slider/slider.variants.d.ts +383 -0
- package/dist/Slider/slider.variants.js +102 -0
- package/dist/Stepper/Stepper.svelte +254 -0
- package/dist/Stepper/Stepper.svelte.d.ts +5 -0
- package/dist/Stepper/index.d.ts +2 -0
- package/dist/Stepper/index.js +1 -0
- package/dist/Stepper/stepper.types.d.ts +223 -0
- package/dist/Stepper/stepper.types.js +1 -0
- package/dist/Stepper/stepper.variants.d.ts +428 -0
- package/dist/Stepper/stepper.variants.js +204 -0
- package/dist/Switch/Switch.svelte +150 -0
- package/dist/Switch/Switch.svelte.d.ts +6 -0
- package/dist/Switch/index.d.ts +2 -0
- package/dist/Switch/index.js +1 -0
- package/dist/Switch/switch.types.d.ts +80 -0
- package/dist/Switch/switch.types.js +1 -0
- package/dist/Switch/switch.variants.d.ts +433 -0
- package/dist/Switch/switch.variants.js +171 -0
- package/dist/Table/Table.svelte +667 -0
- package/dist/Table/Table.svelte.d.ts +26 -0
- package/dist/Table/index.d.ts +2 -0
- package/dist/Table/index.js +1 -0
- package/dist/Table/table.types.d.ts +202 -0
- package/dist/Table/table.types.js +1 -0
- package/dist/Table/table.utils.d.ts +54 -0
- package/dist/Table/table.utils.js +167 -0
- package/dist/Table/table.variants.d.ts +205 -0
- package/dist/Table/table.variants.js +126 -0
- package/dist/Tabs/Tabs.svelte +188 -0
- package/dist/Tabs/Tabs.svelte.d.ts +6 -0
- package/dist/Tabs/index.d.ts +2 -0
- package/dist/Tabs/index.js +1 -0
- package/dist/Tabs/tabs.types.d.ts +207 -0
- package/dist/Tabs/tabs.types.js +1 -0
- package/dist/Tabs/tabs.variants.d.ts +298 -0
- package/dist/Tabs/tabs.variants.js +251 -0
- package/dist/Textarea/Textarea.svelte +215 -0
- package/dist/Textarea/Textarea.svelte.d.ts +5 -0
- package/dist/Textarea/index.d.ts +2 -0
- package/dist/Textarea/index.js +1 -0
- package/dist/Textarea/textarea.types.d.ts +103 -0
- package/dist/Textarea/textarea.types.js +1 -0
- package/dist/Textarea/textarea.variants.d.ts +403 -0
- package/dist/Textarea/textarea.variants.js +404 -0
- package/dist/ThemeModeButton/ThemeModeButton.svelte +74 -0
- package/dist/ThemeModeButton/ThemeModeButton.svelte.d.ts +5 -0
- package/dist/ThemeModeButton/index.d.ts +2 -0
- package/dist/ThemeModeButton/index.js +1 -0
- package/dist/ThemeModeButton/theme-mode-button.types.d.ts +69 -0
- package/dist/ThemeModeButton/theme-mode-button.types.js +1 -0
- package/dist/ThemeModeButton/theme-mode-button.variants.d.ts +21 -0
- package/dist/ThemeModeButton/theme-mode-button.variants.js +17 -0
- package/dist/Timeline/Timeline.svelte +116 -0
- package/dist/Timeline/Timeline.svelte.d.ts +5 -0
- package/dist/Timeline/index.d.ts +2 -0
- package/dist/Timeline/index.js +1 -0
- package/dist/Timeline/timeline.types.d.ts +138 -0
- package/dist/Timeline/timeline.types.js +1 -0
- package/dist/Timeline/timeline.variants.d.ts +413 -0
- package/dist/Timeline/timeline.variants.js +201 -0
- package/dist/Toast/Toaster.svelte +619 -0
- package/dist/Toast/Toaster.svelte.d.ts +5 -0
- package/dist/Toast/index.d.ts +4 -0
- package/dist/Toast/index.js +2 -0
- package/dist/Toast/toast.d.ts +38 -0
- package/dist/Toast/toast.js +73 -0
- package/dist/Toast/toast.types.d.ts +19 -0
- package/dist/Toast/toast.types.js +1 -0
- package/dist/Toast/toast.variants.d.ts +7 -0
- package/dist/Toast/toast.variants.js +5 -0
- package/dist/Tooltip/Tooltip.svelte +151 -0
- package/dist/Tooltip/Tooltip.svelte.d.ts +6 -0
- package/dist/Tooltip/TooltipTestWrapper.svelte +8 -0
- package/dist/Tooltip/TooltipTestWrapper.svelte.d.ts +4 -0
- package/dist/Tooltip/index.d.ts +2 -0
- package/dist/Tooltip/index.js +1 -0
- package/dist/Tooltip/tooltip.types.d.ts +62 -0
- package/dist/Tooltip/tooltip.types.js +1 -0
- package/dist/Tooltip/tooltip.variants.d.ts +68 -0
- package/dist/Tooltip/tooltip.variants.js +35 -0
- package/dist/User/User.svelte +98 -0
- package/dist/User/User.svelte.d.ts +5 -0
- package/dist/User/index.d.ts +2 -0
- package/dist/User/index.js +1 -0
- package/dist/User/user.types.d.ts +78 -0
- package/dist/User/user.types.js +1 -0
- package/dist/User/user.variants.d.ts +368 -0
- package/dist/User/user.variants.js +85 -0
- package/dist/config.d.ts +73 -0
- package/dist/config.js +108 -0
- package/dist/hooks/HookContextProbe.svelte +7 -0
- package/dist/hooks/HookContextProbe.svelte.d.ts +18 -0
- package/dist/hooks/HookContextProvider.svelte +9 -0
- package/dist/hooks/HookContextProvider.svelte.d.ts +18 -0
- package/dist/hooks/HookEmitProbe.svelte +14 -0
- package/dist/hooks/HookEmitProbe.svelte.d.ts +18 -0
- package/dist/hooks/index.d.ts +14 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/useClickOutside.svelte.d.ts +31 -0
- package/dist/hooks/useClickOutside.svelte.js +37 -0
- package/dist/hooks/useClipboard.svelte.d.ts +30 -0
- package/dist/hooks/useClipboard.svelte.js +45 -0
- package/dist/hooks/useDebounce.svelte.d.ts +36 -0
- package/dist/hooks/useDebounce.svelte.js +56 -0
- package/dist/hooks/useEscapeKeydown.svelte.d.ts +31 -0
- package/dist/hooks/useEscapeKeydown.svelte.js +37 -0
- package/dist/hooks/useFormField.svelte.d.ts +54 -0
- package/dist/hooks/useFormField.svelte.js +65 -0
- package/dist/hooks/useInfiniteScroll.svelte.d.ts +57 -0
- package/dist/hooks/useInfiniteScroll.svelte.js +69 -0
- package/dist/hooks/useMediaQuery.svelte.d.ts +31 -0
- package/dist/hooks/useMediaQuery.svelte.js +38 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +57 -0
- package/dist/theme.css +680 -0
- package/package.json +237 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 asphum
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://img.shields.io/badge/Svelora-ff3e00?style=for-the-badge&logo=svelte&logoColor=white" alt="Svelora" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">Svelora</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>Modern UI component library for Svelte 5</strong><br/>
|
|
9
|
+
Tailwind CSS 4 · OKLCH Color Tokens · Fully Typed · 50+ Components · 7 Hooks
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://www.npmjs.com/package/svelora"><img src="https://img.shields.io/npm/v/svelora?style=flat-square&colorA=18181b&colorB=ff3e00" alt="npm" /></a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/svelora"><img src="https://img.shields.io/npm/dm/svelora?style=flat-square&colorA=18181b&colorB=ff3e00" alt="downloads" /></a>
|
|
15
|
+
<a href="https://github.com/asphum/svelora/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/svelora?style=flat-square&colorA=18181b&colorB=ff3e00" alt="license" /></a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="https://svelora.vercel.app"><strong>Live Demo</strong></a> ·
|
|
20
|
+
<a href="https://svelora.vercel.app/getting-started"><strong>Getting Started</strong></a> ·
|
|
21
|
+
<a href="https://github.com/asphum/svelora/blob/main/CHANGELOG.md"><strong>Changelog</strong></a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install svelora
|
|
30
|
+
# pnpm add svelora
|
|
31
|
+
# yarn add svelora
|
|
32
|
+
# bun add svelora
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```svelte
|
|
36
|
+
<script lang="ts">
|
|
37
|
+
import 'svelora/theme.css'
|
|
38
|
+
import { ModeWatcher } from 'svelora'
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<ModeWatcher />
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```css
|
|
45
|
+
/* layout.css */
|
|
46
|
+
@import 'svelora/theme.css';
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```svelte
|
|
50
|
+
<script lang="ts">
|
|
51
|
+
import { Avatar, Button, ModeWatcher, toggleMode, toast } from 'svelora'
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<ModeWatcher />
|
|
55
|
+
<Button variant="soft" color="primary" leadingIcon="lucide:edit">Edit</Button>
|
|
56
|
+
<Button variant="ghost" color="secondary" onclick={toggleMode}>Toggle theme</Button>
|
|
57
|
+
<Avatar src="/photo.jpg" alt="Jane" size="lg" />
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Features
|
|
61
|
+
|
|
62
|
+
- **Svelte 5** — Runes, snippets, latest reactivity
|
|
63
|
+
- **Tailwind CSS 4** — Utility-first with [Tailwind Variants](https://www.tailwind-variants.org/)
|
|
64
|
+
- **Fully Typed** — Strict TypeScript, exported prop types
|
|
65
|
+
- **Accessible** — Built on [Bits UI](https://bits-ui.com) & [Vaul Svelte](https://vaul-svelte.com)
|
|
66
|
+
- **200,000+ Icons** — [Iconify](https://iconify.design) integration
|
|
67
|
+
- **Themeable** — OKLCH color tokens, light/dark mode, global config
|
|
68
|
+
- **Hooks** — 7 reactive hooks for common UI patterns
|
|
69
|
+
|
|
70
|
+
## Hooks
|
|
71
|
+
|
|
72
|
+
Reactive hooks built on Svelte 5 runes and actions.
|
|
73
|
+
|
|
74
|
+
```svelte
|
|
75
|
+
<script>
|
|
76
|
+
import { useMediaQuery, useClipboard, useDebounce } from 'svelora'
|
|
77
|
+
|
|
78
|
+
const isMobile = useMediaQuery('(max-width: 640px)')
|
|
79
|
+
const clipboard = useClipboard()
|
|
80
|
+
const debounce = useDebounce({ delay: 500 })
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
{#if isMobile.matches}
|
|
84
|
+
<MobileLayout />
|
|
85
|
+
{/if}
|
|
86
|
+
|
|
87
|
+
<Button onclick={() => clipboard.copy('Hello!')}>
|
|
88
|
+
{clipboard.copied ? 'Copied!' : 'Copy'}
|
|
89
|
+
</Button>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
| Hook | Type | Description |
|
|
93
|
+
| ------------------- | -------------- | ---------------------------------------------- |
|
|
94
|
+
| `useMediaQuery` | Runes | Reactive CSS media query tracking |
|
|
95
|
+
| `useClipboard` | Runes | Copy text with auto-reset state |
|
|
96
|
+
| `useFormField` | Context | Access FormField context from child components |
|
|
97
|
+
| `useDebounce` | Runes | Debounce with pending, cancel, flush |
|
|
98
|
+
| `useClickOutside` | Action | Detect clicks outside an element |
|
|
99
|
+
| `useInfiniteScroll` | Runes + Action | Auto-load on scroll with loading state |
|
|
100
|
+
| `useEscapeKeydown` | Action | Listen for Escape key |
|
|
101
|
+
|
|
102
|
+
## Customization
|
|
103
|
+
|
|
104
|
+
```svelte
|
|
105
|
+
<!-- Per-instance -->
|
|
106
|
+
<Button ui={{ base: 'rounded-full shadow-lg' }}>Custom</Button>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
// Global defaults
|
|
111
|
+
import { defineConfig } from 'svelora'
|
|
112
|
+
|
|
113
|
+
defineConfig({
|
|
114
|
+
button: { defaultVariants: { variant: 'outline' } },
|
|
115
|
+
icons: { loading: 'lucide:loader' }
|
|
116
|
+
})
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
```css
|
|
120
|
+
/* Custom colors */
|
|
121
|
+
:root {
|
|
122
|
+
--color-primary: oklch(0.55 0.25 270);
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Publish
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
bun run release:verify
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
npm login
|
|
134
|
+
npm publish --access public
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
If you want to include the full test suite before publishing:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
bun run release:verify:full
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
[MIT](LICENSE) © [asphum](https://github.com/asphum)
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { AccordionItem, AccordionProps } from './accordion.types.js'
|
|
3
|
+
|
|
4
|
+
export type Props = AccordionProps
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { Accordion } from 'bits-ui'
|
|
9
|
+
import { slide } from 'svelte/transition'
|
|
10
|
+
import { getComponentConfig } from '../config.js'
|
|
11
|
+
import Icon from '../Icon/Icon.svelte'
|
|
12
|
+
import { accordionDefaults, accordionVariants } from './accordion.variants.js'
|
|
13
|
+
|
|
14
|
+
const config = getComponentConfig('accordion', accordionDefaults)
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
items = [],
|
|
18
|
+
type = 'single',
|
|
19
|
+
value = $bindable(),
|
|
20
|
+
onValueChange,
|
|
21
|
+
disabled = false,
|
|
22
|
+
loop = false,
|
|
23
|
+
orientation = 'vertical',
|
|
24
|
+
forceMount = false,
|
|
25
|
+
trailingIcon = 'lucide:chevron-down',
|
|
26
|
+
ui,
|
|
27
|
+
class: className,
|
|
28
|
+
leading,
|
|
29
|
+
label: labelSlot,
|
|
30
|
+
trailing,
|
|
31
|
+
content: contentSlot,
|
|
32
|
+
body: bodySlot
|
|
33
|
+
}: Props = $props()
|
|
34
|
+
|
|
35
|
+
const variantSlots = $derived(accordionVariants({ disabled }))
|
|
36
|
+
const rootClass = $derived(
|
|
37
|
+
variantSlots.root({ class: [config.slots.root, ui?.root, className] })
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
const singleValue = $derived(typeof value === 'string' ? value : undefined)
|
|
41
|
+
const multipleValue = $derived(Array.isArray(value) ? value : undefined)
|
|
42
|
+
|
|
43
|
+
const slotNames = [
|
|
44
|
+
'item',
|
|
45
|
+
'header',
|
|
46
|
+
'trigger',
|
|
47
|
+
'content',
|
|
48
|
+
'body',
|
|
49
|
+
'leadingIcon',
|
|
50
|
+
'trailingIcon',
|
|
51
|
+
'label'
|
|
52
|
+
] as const
|
|
53
|
+
|
|
54
|
+
type SlotName = (typeof slotNames)[number]
|
|
55
|
+
|
|
56
|
+
const itemDefaults = $derived.by(() => {
|
|
57
|
+
const result = {} as Record<SlotName, string>
|
|
58
|
+
for (const slot of slotNames) {
|
|
59
|
+
result[slot] = variantSlots[slot]({ class: [config.slots[slot], ui?.[slot]] })
|
|
60
|
+
}
|
|
61
|
+
return result
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
function getItemClasses(item: AccordionItem) {
|
|
65
|
+
if (!item.ui && item.class === undefined && item.disabled === undefined) {
|
|
66
|
+
return itemDefaults
|
|
67
|
+
}
|
|
68
|
+
const result = {} as Record<SlotName, string>
|
|
69
|
+
for (const slot of slotNames) {
|
|
70
|
+
const baseClass = [
|
|
71
|
+
config.slots[slot],
|
|
72
|
+
ui?.[slot],
|
|
73
|
+
item.ui?.[slot],
|
|
74
|
+
slot === 'item' ? item.class : undefined
|
|
75
|
+
]
|
|
76
|
+
const opts =
|
|
77
|
+
slot === 'trigger'
|
|
78
|
+
? { class: baseClass, disabled: item.disabled }
|
|
79
|
+
: { class: baseClass }
|
|
80
|
+
result[slot] = variantSlots[slot](opts)
|
|
81
|
+
}
|
|
82
|
+
return result
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function isOpen(itemValue: string): boolean {
|
|
86
|
+
if (!value) return false
|
|
87
|
+
if (Array.isArray(value)) return value.includes(itemValue)
|
|
88
|
+
return value === itemValue
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function handleSingleValueChange(newValue: string) {
|
|
92
|
+
value = newValue
|
|
93
|
+
onValueChange?.(newValue)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function handleMultipleValueChange(newValue: string[]) {
|
|
97
|
+
value = newValue
|
|
98
|
+
onValueChange?.(newValue)
|
|
99
|
+
}
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
{#snippet accordionItem(item: AccordionItem, index: number)}
|
|
103
|
+
{@const itemValue = item.value ?? String(index)}
|
|
104
|
+
{@const cls = getItemClasses(item)}
|
|
105
|
+
{@const open = isOpen(itemValue)}
|
|
106
|
+
<Accordion.Item value={itemValue} disabled={item.disabled} class={cls.item}>
|
|
107
|
+
<Accordion.Header class={cls.header}>
|
|
108
|
+
<Accordion.Trigger class={cls.trigger}>
|
|
109
|
+
{#if leading}
|
|
110
|
+
{@render leading({ item, index, open })}
|
|
111
|
+
{:else if item.icon}
|
|
112
|
+
<Icon name={item.icon} class={cls.leadingIcon} />
|
|
113
|
+
{/if}
|
|
114
|
+
|
|
115
|
+
{#if item.label || labelSlot}
|
|
116
|
+
<span class={cls.label}>
|
|
117
|
+
{#if labelSlot}
|
|
118
|
+
{@render labelSlot({ item, index, open })}
|
|
119
|
+
{:else}
|
|
120
|
+
{item.label}
|
|
121
|
+
{/if}
|
|
122
|
+
</span>
|
|
123
|
+
{/if}
|
|
124
|
+
|
|
125
|
+
{#if trailing}
|
|
126
|
+
{@render trailing({ item, index, open })}
|
|
127
|
+
{:else}
|
|
128
|
+
<Icon name={item.trailingIcon ?? trailingIcon} class={cls.trailingIcon} />
|
|
129
|
+
{/if}
|
|
130
|
+
</Accordion.Trigger>
|
|
131
|
+
</Accordion.Header>
|
|
132
|
+
|
|
133
|
+
{#if item.content || contentSlot || bodySlot}
|
|
134
|
+
{#if forceMount}
|
|
135
|
+
<Accordion.Content forceMount>
|
|
136
|
+
{#snippet child({ props, open: isContentOpen })}
|
|
137
|
+
{#if isContentOpen}
|
|
138
|
+
<div {...props} transition:slide={{ duration: 200 }}>
|
|
139
|
+
<div class={cls.content}>
|
|
140
|
+
{#if contentSlot}
|
|
141
|
+
{@render contentSlot({ item, index, open: isContentOpen })}
|
|
142
|
+
{:else}
|
|
143
|
+
<div class={cls.body}>
|
|
144
|
+
{#if bodySlot}
|
|
145
|
+
{@render bodySlot({
|
|
146
|
+
item,
|
|
147
|
+
index,
|
|
148
|
+
open: isContentOpen
|
|
149
|
+
})}
|
|
150
|
+
{:else}
|
|
151
|
+
{item.content}
|
|
152
|
+
{/if}
|
|
153
|
+
</div>
|
|
154
|
+
{/if}
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
{/if}
|
|
158
|
+
{/snippet}
|
|
159
|
+
</Accordion.Content>
|
|
160
|
+
{:else}
|
|
161
|
+
<Accordion.Content class={cls.content}>
|
|
162
|
+
{#if contentSlot}
|
|
163
|
+
{@render contentSlot({ item, index, open })}
|
|
164
|
+
{:else}
|
|
165
|
+
<div class={cls.body}>
|
|
166
|
+
{#if bodySlot}
|
|
167
|
+
{@render bodySlot({ item, index, open })}
|
|
168
|
+
{:else}
|
|
169
|
+
{item.content}
|
|
170
|
+
{/if}
|
|
171
|
+
</div>
|
|
172
|
+
{/if}
|
|
173
|
+
</Accordion.Content>
|
|
174
|
+
{/if}
|
|
175
|
+
{/if}
|
|
176
|
+
</Accordion.Item>
|
|
177
|
+
{/snippet}
|
|
178
|
+
|
|
179
|
+
{#if type === 'single'}
|
|
180
|
+
<Accordion.Root
|
|
181
|
+
type="single"
|
|
182
|
+
value={singleValue}
|
|
183
|
+
onValueChange={handleSingleValueChange}
|
|
184
|
+
{disabled}
|
|
185
|
+
{loop}
|
|
186
|
+
{orientation}
|
|
187
|
+
class={rootClass}
|
|
188
|
+
>
|
|
189
|
+
{#each items as item, index (item.value ?? index)}
|
|
190
|
+
{@render accordionItem(item, index)}
|
|
191
|
+
{/each}
|
|
192
|
+
</Accordion.Root>
|
|
193
|
+
{:else}
|
|
194
|
+
<Accordion.Root
|
|
195
|
+
type="multiple"
|
|
196
|
+
value={multipleValue}
|
|
197
|
+
onValueChange={handleMultipleValueChange}
|
|
198
|
+
{disabled}
|
|
199
|
+
{loop}
|
|
200
|
+
{orientation}
|
|
201
|
+
class={rootClass}
|
|
202
|
+
>
|
|
203
|
+
{#each items as item, index (item.value ?? index)}
|
|
204
|
+
{@render accordionItem(item, index)}
|
|
205
|
+
{/each}
|
|
206
|
+
</Accordion.Root>
|
|
207
|
+
{/if}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AccordionProps } from './accordion.types.js';
|
|
2
|
+
export type Props = AccordionProps;
|
|
3
|
+
import { Accordion } from 'bits-ui';
|
|
4
|
+
declare const Accordion: import("svelte").Component<AccordionProps, {}, "value">;
|
|
5
|
+
type Accordion = ReturnType<typeof Accordion>;
|
|
6
|
+
export default Accordion;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import type { AccordionContentPropsWithoutHTML, BaseAccordionRootPropsWithoutHTML } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
import type { AccordionSlots } from './accordion.variants.js';
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for an individual accordion item.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const item: AccordionItem = {
|
|
11
|
+
* label: 'Section Title',
|
|
12
|
+
* content: 'Section content goes here',
|
|
13
|
+
* icon: 'lucide:settings',
|
|
14
|
+
* value: 'section-1'
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export interface AccordionItem {
|
|
19
|
+
/**
|
|
20
|
+
* The visible text displayed in the accordion trigger/header.
|
|
21
|
+
*/
|
|
22
|
+
label?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Icon displayed before the label (leading position).
|
|
25
|
+
* Supports any Iconify icon name (e.g., 'lucide:home', 'mdi:account').
|
|
26
|
+
*/
|
|
27
|
+
icon?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Icon displayed after the label (trailing position).
|
|
30
|
+
* Overrides the global `trailingIcon` prop for this item.
|
|
31
|
+
* Supports any Iconify icon name.
|
|
32
|
+
*/
|
|
33
|
+
trailingIcon?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The text content shown when the accordion item is expanded.
|
|
36
|
+
* For complex content, use the `body` or `content` snippet instead.
|
|
37
|
+
*/
|
|
38
|
+
content?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Unique identifier for this item.
|
|
41
|
+
* Used to control which item(s) are expanded via the `value` prop.
|
|
42
|
+
* @default String(index) - Falls back to the item's index as a string
|
|
43
|
+
*/
|
|
44
|
+
value?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Whether this specific item is disabled.
|
|
47
|
+
* Disabled items cannot be expanded or collapsed by the user.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Additional CSS classes applied to this item's container element.
|
|
53
|
+
*/
|
|
54
|
+
class?: ClassNameValue;
|
|
55
|
+
/**
|
|
56
|
+
* Override classes for specific slots within this item.
|
|
57
|
+
* Allows fine-grained styling control per item.
|
|
58
|
+
*/
|
|
59
|
+
ui?: Partial<Pick<Record<AccordionSlots, ClassNameValue>, 'item' | 'header' | 'trigger' | 'leadingIcon' | 'label' | 'trailingIcon' | 'content' | 'body'>>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Props passed to accordion snippet slots.
|
|
63
|
+
* Provides context about the current item and its state.
|
|
64
|
+
*/
|
|
65
|
+
export interface AccordionSlotProps {
|
|
66
|
+
/** The current accordion item data */
|
|
67
|
+
item: AccordionItem;
|
|
68
|
+
/** Zero-based index of the item in the items array */
|
|
69
|
+
index: number;
|
|
70
|
+
/** Whether this item is currently expanded */
|
|
71
|
+
open: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Props for the Accordion component.
|
|
75
|
+
*
|
|
76
|
+
* Extends bits-ui's base accordion props for behavior (disabled, loop, orientation)
|
|
77
|
+
* and content props (forceMount).
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```svelte
|
|
81
|
+
* <Accordion
|
|
82
|
+
* type="single"
|
|
83
|
+
* items={faqItems}
|
|
84
|
+
* bind:value={openItem}
|
|
85
|
+
* ui={{ trigger: 'font-semibold' }}
|
|
86
|
+
* />
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* @see https://bits-ui.com/docs/components/accordion
|
|
90
|
+
*/
|
|
91
|
+
export interface AccordionProps extends Omit<BaseAccordionRootPropsWithoutHTML, 'loop'>, Pick<AccordionContentPropsWithoutHTML, 'forceMount'> {
|
|
92
|
+
/**
|
|
93
|
+
* Array of accordion items to render.
|
|
94
|
+
* Each item can have a label, content, icon, and optional styling overrides.
|
|
95
|
+
*/
|
|
96
|
+
items?: AccordionItem[];
|
|
97
|
+
/**
|
|
98
|
+
* Default icon displayed on the trailing side of all triggers.
|
|
99
|
+
* Typically used for expand/collapse indicators.
|
|
100
|
+
* Can be overridden per-item via `item.trailingIcon`.
|
|
101
|
+
* @default 'lucide:chevron-down'
|
|
102
|
+
*/
|
|
103
|
+
trailingIcon?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Controls how many items can be expanded simultaneously.
|
|
106
|
+
* - `'single'`: Only one item can be open at a time (default)
|
|
107
|
+
* - `'multiple'`: Multiple items can be open simultaneously
|
|
108
|
+
* @default 'single'
|
|
109
|
+
*/
|
|
110
|
+
type?: 'single' | 'multiple';
|
|
111
|
+
/**
|
|
112
|
+
* The currently expanded item value(s).
|
|
113
|
+
* - For `type="single"`: `string | undefined`
|
|
114
|
+
* - For `type="multiple"`: `string[] | undefined`
|
|
115
|
+
*
|
|
116
|
+
* Use `bind:value` for two-way binding.
|
|
117
|
+
*/
|
|
118
|
+
value?: string | string[];
|
|
119
|
+
/**
|
|
120
|
+
* Callback fired when the expanded item(s) change.
|
|
121
|
+
* Receives the new value (string for single, string[] for multiple).
|
|
122
|
+
*/
|
|
123
|
+
onValueChange?: (value: string | string[]) => void;
|
|
124
|
+
/**
|
|
125
|
+
* Whether to cycle focus when reaching the first/last item
|
|
126
|
+
* using keyboard navigation.
|
|
127
|
+
* @default false
|
|
128
|
+
*/
|
|
129
|
+
loop?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Override classes for accordion component slots.
|
|
132
|
+
* Allows customization of root, item, header, trigger, content, body,
|
|
133
|
+
* label, leadingIcon, and trailingIcon elements.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* ui={{
|
|
138
|
+
* trigger: 'py-4 hover:bg-muted',
|
|
139
|
+
* body: 'text-muted-foreground'
|
|
140
|
+
* }}
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
ui?: Partial<Record<AccordionSlots, ClassNameValue>>;
|
|
144
|
+
/**
|
|
145
|
+
* Additional CSS classes for the root accordion container.
|
|
146
|
+
*/
|
|
147
|
+
class?: ClassNameValue;
|
|
148
|
+
/**
|
|
149
|
+
* Custom snippet for the leading section of all item triggers.
|
|
150
|
+
* Replaces the default leading icon when provided.
|
|
151
|
+
*
|
|
152
|
+
* @param props - Contains `{ item, index, open }`
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```svelte
|
|
156
|
+
* {#snippet leading({ item, open })}
|
|
157
|
+
* <Avatar src={item.avatar} size="sm" />
|
|
158
|
+
* {/snippet}
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
leading?: Snippet<[AccordionSlotProps]>;
|
|
162
|
+
/**
|
|
163
|
+
* Custom snippet for the label section of all item triggers.
|
|
164
|
+
* Replaces the default `item.label` text when provided.
|
|
165
|
+
*
|
|
166
|
+
* @param props - Contains `{ item, index, open }`
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```svelte
|
|
170
|
+
* {#snippet label({ item, open })}
|
|
171
|
+
* <span class:font-bold={open}>{item.label}</span>
|
|
172
|
+
* {#if item.badge}<Badge>{item.badge}</Badge>{/if}
|
|
173
|
+
* {/snippet}
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
label?: Snippet<[AccordionSlotProps]>;
|
|
177
|
+
/**
|
|
178
|
+
* Custom snippet for the trailing section of all item triggers.
|
|
179
|
+
* Replaces the default trailing icon when provided.
|
|
180
|
+
*
|
|
181
|
+
* @param props - Contains `{ item, index, open }`
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```svelte
|
|
185
|
+
* {#snippet trailing({ open })}
|
|
186
|
+
* <Icon name={open ? 'lucide:minus' : 'lucide:plus'} />
|
|
187
|
+
* {/snippet}
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
trailing?: Snippet<[AccordionSlotProps]>;
|
|
191
|
+
/**
|
|
192
|
+
* Custom snippet for the entire content area.
|
|
193
|
+
* Provides full control over the expanded content rendering.
|
|
194
|
+
* When used, `body` snippet and `item.content` are ignored.
|
|
195
|
+
*
|
|
196
|
+
* @param props - Contains `{ item, index, open }`
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```svelte
|
|
200
|
+
* {#snippet content({ item })}
|
|
201
|
+
* <div class="custom-content-wrapper">
|
|
202
|
+
* <p>{item.content}</p>
|
|
203
|
+
* <Button>Action</Button>
|
|
204
|
+
* </div>
|
|
205
|
+
* {/snippet}
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
content?: Snippet<[AccordionSlotProps]>;
|
|
209
|
+
/**
|
|
210
|
+
* Custom snippet for the body content inside the default content wrapper.
|
|
211
|
+
* Replaces `item.content` text when provided.
|
|
212
|
+
* Use `content` snippet instead for full control over the content area.
|
|
213
|
+
*
|
|
214
|
+
* @param props - Contains `{ item, index, open }`
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```svelte
|
|
218
|
+
* {#snippet body({ item })}
|
|
219
|
+
* <p>{item.content}</p>
|
|
220
|
+
* <a href={item.link}>Learn more</a>
|
|
221
|
+
* {/snippet}
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
body?: Snippet<[AccordionSlotProps]>;
|
|
225
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const accordionVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
disabled: {
|
|
4
|
+
true: {
|
|
5
|
+
trigger: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
}, {
|
|
9
|
+
root: string;
|
|
10
|
+
item: string;
|
|
11
|
+
header: string;
|
|
12
|
+
trigger: string;
|
|
13
|
+
content: string;
|
|
14
|
+
body: string;
|
|
15
|
+
leadingIcon: string;
|
|
16
|
+
trailingIcon: string;
|
|
17
|
+
label: string;
|
|
18
|
+
}, undefined, {
|
|
19
|
+
disabled: {
|
|
20
|
+
true: {
|
|
21
|
+
trigger: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}, {
|
|
25
|
+
root: string;
|
|
26
|
+
item: string;
|
|
27
|
+
header: string;
|
|
28
|
+
trigger: string;
|
|
29
|
+
content: string;
|
|
30
|
+
body: string;
|
|
31
|
+
leadingIcon: string;
|
|
32
|
+
trailingIcon: string;
|
|
33
|
+
label: string;
|
|
34
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
35
|
+
disabled: {
|
|
36
|
+
true: {
|
|
37
|
+
trigger: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
}, {
|
|
41
|
+
root: string;
|
|
42
|
+
item: string;
|
|
43
|
+
header: string;
|
|
44
|
+
trigger: string;
|
|
45
|
+
content: string;
|
|
46
|
+
body: string;
|
|
47
|
+
leadingIcon: string;
|
|
48
|
+
trailingIcon: string;
|
|
49
|
+
label: string;
|
|
50
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
51
|
+
export type AccordionVariantProps = VariantProps<typeof accordionVariants>;
|
|
52
|
+
export type AccordionSlots = keyof ReturnType<typeof accordionVariants>;
|
|
53
|
+
export declare const accordionDefaults: {
|
|
54
|
+
defaultVariants: import("tailwind-variants").TVDefaultVariants<{
|
|
55
|
+
disabled: {
|
|
56
|
+
true: {
|
|
57
|
+
trigger: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
}, {
|
|
61
|
+
root: string;
|
|
62
|
+
item: string;
|
|
63
|
+
header: string;
|
|
64
|
+
trigger: string;
|
|
65
|
+
content: string;
|
|
66
|
+
body: string;
|
|
67
|
+
leadingIcon: string;
|
|
68
|
+
trailingIcon: string;
|
|
69
|
+
label: string;
|
|
70
|
+
}, {
|
|
71
|
+
disabled: {
|
|
72
|
+
true: {
|
|
73
|
+
trigger: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
}, {
|
|
77
|
+
root: string;
|
|
78
|
+
item: string;
|
|
79
|
+
header: string;
|
|
80
|
+
trigger: string;
|
|
81
|
+
content: string;
|
|
82
|
+
body: string;
|
|
83
|
+
leadingIcon: string;
|
|
84
|
+
trailingIcon: string;
|
|
85
|
+
label: string;
|
|
86
|
+
}>;
|
|
87
|
+
slots: Partial<Record<AccordionSlots, string>>;
|
|
88
|
+
};
|