@skeletonlabs/skeleton 0.92.1 → 0.92.2
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/actions/Clipboard/clipboard.d.ts +4 -0
- package/actions/Clipboard/clipboard.js +37 -0
- package/actions/Filters/filter.d.ts +3 -0
- package/actions/Filters/filter.js +23 -0
- package/{src/lib/actions → actions}/Filters/svg-filters/Apollo.svelte +0 -0
- package/actions/Filters/svg-filters/Apollo.svelte.d.ts +23 -0
- package/{src/lib/actions → actions}/Filters/svg-filters/BlueNight.svelte +0 -0
- package/actions/Filters/svg-filters/BlueNight.svelte.d.ts +23 -0
- package/{src/lib/actions → actions}/Filters/svg-filters/Emerald.svelte +0 -0
- package/actions/Filters/svg-filters/Emerald.svelte.d.ts +23 -0
- package/{src/lib/actions → actions}/Filters/svg-filters/GreenFall.svelte +0 -0
- package/actions/Filters/svg-filters/GreenFall.svelte.d.ts +23 -0
- package/{src/lib/actions → actions}/Filters/svg-filters/Noir.svelte +0 -0
- package/actions/Filters/svg-filters/Noir.svelte.d.ts +23 -0
- package/{src/lib/actions → actions}/Filters/svg-filters/NoirLight.svelte +0 -0
- package/actions/Filters/svg-filters/NoirLight.svelte.d.ts +23 -0
- package/{src/lib/actions → actions}/Filters/svg-filters/Rustic.svelte +0 -0
- package/actions/Filters/svg-filters/Rustic.svelte.d.ts +23 -0
- package/{src/lib/actions → actions}/Filters/svg-filters/Summer84.svelte +0 -0
- package/actions/Filters/svg-filters/Summer84.svelte.d.ts +23 -0
- package/{src/lib/actions → actions}/Filters/svg-filters/XPro.svelte +0 -0
- package/actions/Filters/svg-filters/XPro.svelte.d.ts +23 -0
- package/actions/FocusTrap/focusTrap.d.ts +4 -0
- package/actions/FocusTrap/focusTrap.js +53 -0
- package/components/Accordion/AccordionGroup.svelte +46 -0
- package/components/Accordion/AccordionGroup.svelte.d.ts +24 -0
- package/components/Accordion/AccordionItem.svelte +73 -0
- package/components/Accordion/AccordionItem.svelte.d.ts +36 -0
- package/components/Alert/Alert.svelte +65 -0
- package/components/Alert/Alert.svelte.d.ts +30 -0
- package/components/AppBar/AppBar.svelte +54 -0
- package/components/AppBar/AppBar.svelte.d.ts +30 -0
- package/components/AppRail/AppRail.svelte +51 -0
- package/components/AppRail/AppRail.svelte.d.ts +32 -0
- package/components/AppRail/AppRailTile.svelte +57 -0
- package/components/AppRail/AppRailTile.svelte.d.ts +33 -0
- package/components/AppShell/AppShell.svelte +80 -0
- package/components/AppShell/AppShell.svelte.d.ts +31 -0
- package/components/Avatar/Avatar.svelte +46 -0
- package/components/Avatar/Avatar.svelte.d.ts +32 -0
- package/components/Breadcrumb/Breadcrumb.svelte +24 -0
- package/components/Breadcrumb/Breadcrumb.svelte.d.ts +21 -0
- package/{src/lib/components → components}/Breadcrumb/Crumb.svelte +16 -23
- package/components/Breadcrumb/Crumb.svelte.d.ts +26 -0
- package/components/ConicGradient/ConicGradient.svelte +80 -0
- package/components/ConicGradient/ConicGradient.svelte.d.ts +29 -0
- package/components/ConicGradient/settings.d.ts +13 -0
- package/components/ConicGradient/settings.js +335 -0
- package/components/ConicGradient/types.d.ts +10 -0
- package/components/ConicGradient/types.js +2 -0
- package/components/Divider/Divider.svelte +21 -0
- package/components/Divider/Divider.svelte.d.ts +22 -0
- package/components/FileButton/FileButton.svelte +25 -0
- package/components/FileButton/FileButton.svelte.d.ts +25 -0
- package/components/FileDropzone/FileDropzone.svelte +95 -0
- package/components/FileDropzone/FileDropzone.svelte.d.ts +32 -0
- package/components/GradientHeading/GradientHeading.svelte +21 -0
- package/components/GradientHeading/GradientHeading.svelte.d.ts +22 -0
- package/components/InputChip/InputChip.svelte +107 -0
- package/components/InputChip/InputChip.svelte.d.ts +29 -0
- package/components/ListBox/ListBox.svelte +57 -0
- package/components/ListBox/ListBox.svelte.d.ts +30 -0
- package/components/ListBox/ListBoxItem.svelte +88 -0
- package/components/ListBox/ListBoxItem.svelte.d.ts +32 -0
- package/components/Paginator/Paginator.svelte +74 -0
- package/components/Paginator/Paginator.svelte.d.ts +29 -0
- package/components/Paginator/types.d.ts +10 -0
- package/components/Paginator/types.js +2 -0
- package/components/ProgressBar/ProgressBar.svelte +67 -0
- package/components/ProgressBar/ProgressBar.svelte.d.ts +24 -0
- package/components/ProgressRadial/ProgressRadial.svelte +89 -0
- package/components/ProgressRadial/ProgressRadial.svelte.d.ts +25 -0
- package/components/Radio/RadioGroup.svelte +48 -0
- package/components/Radio/RadioGroup.svelte.d.ts +31 -0
- package/components/Radio/RadioItem.svelte +61 -0
- package/components/Radio/RadioItem.svelte.d.ts +33 -0
- package/components/RangeSlider/RangeSlider.svelte +101 -0
- package/components/RangeSlider/RangeSlider.svelte.d.ts +32 -0
- package/components/SlideToggle/SlideToggle.svelte +100 -0
- package/components/SlideToggle/SlideToggle.svelte.d.ts +34 -0
- package/components/Stepper/Step.svelte +133 -0
- package/components/Stepper/Step.svelte.d.ts +39 -0
- package/components/Stepper/Stepper.svelte +64 -0
- package/components/Stepper/Stepper.svelte.d.ts +32 -0
- package/components/SvgIcon/SvgIcon.svelte +45 -0
- package/components/SvgIcon/SvgIcon.svelte.d.ts +26 -0
- package/components/SvgIcon/icons.d.ts +1 -0
- package/components/SvgIcon/icons.js +25 -0
- package/components/Tab/Tab.svelte +69 -0
- package/components/Tab/Tab.svelte.d.ts +37 -0
- package/components/Tab/TabGroup.svelte +69 -0
- package/components/Tab/TabGroup.svelte.d.ts +30 -0
- package/components/Table/Table.svelte +99 -0
- package/components/Table/Table.svelte.d.ts +27 -0
- package/components/Table/types.d.ts +10 -0
- package/components/Table/types.js +1 -0
- package/components/Table/utils.d.ts +7 -0
- package/{src/lib/components/Table/utils.ts → components/Table/utils.js} +10 -16
- package/components/TableOfContents/TableOfContents.svelte +132 -0
- package/components/TableOfContents/TableOfContents.svelte.d.ts +32 -0
- package/{src/lib/index.ts → index.d.ts} +1 -31
- package/index.js +71 -0
- package/package.json +158 -61
- package/{src/lib/styles → styles}/all.css +0 -0
- package/{src/lib/styles → styles}/core.css +0 -0
- package/{src/lib/styles → styles}/elements/alerts.css +0 -0
- package/{src/lib/styles → styles}/elements/badges.css +0 -0
- package/{src/lib/styles → styles}/elements/breadcrumbs.css +0 -0
- package/{src/lib/styles → styles}/elements/buttons.css +0 -0
- package/{src/lib/styles → styles}/elements/cards.css +0 -0
- package/{src/lib/styles → styles}/elements/chips.css +0 -0
- package/{src/lib/styles → styles}/elements/lists.css +0 -0
- package/{src/lib/styles → styles}/elements/logo-clouds.css +0 -0
- package/{src/lib/styles → styles}/elements/menus.css +0 -0
- package/{src/lib/styles → styles}/elements/placeholders.css +0 -0
- package/{src/lib/styles → styles}/elements/tables.css +0 -0
- package/{src/lib/styles → styles}/elements/tooltips.css +0 -0
- package/{src/lib/styles → styles}/elements.css +0 -0
- package/{src/lib/styles → styles}/forms.css +0 -0
- package/{src/lib/styles → styles}/highlight-js.css +0 -0
- package/{src/lib/styles → styles}/tailwind.css +0 -0
- package/{src/lib/styles → styles}/typography.css +0 -0
- package/tailwind/generated/allComponents.cjs +1 -0
- package/tailwind/generated/allComponents.d.cts +2156 -0
- package/{src/lib/tailwind → tailwind}/settings.cjs +0 -0
- package/tailwind/settings.d.cts +6 -0
- package/{src/lib/tailwind → tailwind}/skeleton.cjs +0 -0
- package/tailwind/skeleton.d.cts +5 -0
- package/{src/lib/tailwind → tailwind}/theme/colors.cjs +0 -0
- package/tailwind/theme/colors.d.cts +2 -0
- package/{src/lib/tailwind → tailwind}/tokens/backgrounds.cjs +0 -0
- package/tailwind/tokens/backgrounds.d.cts +2 -0
- package/{src/lib/tailwind → tailwind}/tokens/border-radius.cjs +0 -0
- package/tailwind/tokens/border-radius.d.cts +33 -0
- package/{src/lib/tailwind → tailwind}/tokens/borders.cjs +0 -0
- package/tailwind/tokens/borders.d.cts +6 -0
- package/{src/lib/tailwind → tailwind}/tokens/fills.cjs +0 -0
- package/tailwind/tokens/fills.d.cts +15 -0
- package/{src/lib/tailwind → tailwind}/tokens/rings.cjs +0 -0
- package/tailwind/tokens/rings.d.cts +17 -0
- package/{src/lib/tailwind → tailwind}/tokens/text.cjs +0 -0
- package/tailwind/tokens/text.d.cts +21 -0
- package/{src/lib/themes → themes}/theme-crimson.css +0 -0
- package/{src/lib/themes → themes}/theme-gold-nouveau.css +0 -0
- package/{src/lib/themes → themes}/theme-hamlindigo.css +0 -0
- package/{src/lib/themes → themes}/theme-modern.css +0 -0
- package/{src/lib/themes → themes}/theme-rocket.css +0 -0
- package/{src/lib/themes → themes}/theme-sahara.css +0 -0
- package/{src/lib/themes → themes}/theme-seafoam.css +0 -0
- package/{src/lib/themes → themes}/theme-seasonal.css +0 -0
- package/{src/lib/themes → themes}/theme-skeleton.css +0 -0
- package/{src/lib/themes → themes}/theme-vintage.css +0 -0
- package/utilities/CodeBlock/CodeBlock.svelte +68 -0
- package/utilities/CodeBlock/CodeBlock.svelte.d.ts +25 -0
- package/utilities/CodeBlock/stores.d.ts +2 -0
- package/utilities/CodeBlock/stores.js +3 -0
- package/utilities/DataTable/DataTable.d.ts +18 -0
- package/utilities/DataTable/DataTable.js +137 -0
- package/utilities/DataTable/actions.d.ts +8 -0
- package/utilities/DataTable/actions.js +114 -0
- package/utilities/DataTable/types.d.ts +33 -0
- package/utilities/DataTable/types.js +2 -0
- package/utilities/Drawer/Drawer.svelte +157 -0
- package/utilities/Drawer/Drawer.svelte.d.ts +33 -0
- package/utilities/Drawer/stores.d.ts +10 -0
- package/utilities/Drawer/stores.js +21 -0
- package/utilities/Drawer/types.d.ts +33 -0
- package/utilities/Drawer/types.js +2 -0
- package/utilities/LightSwitch/LightSwitch.svelte +98 -0
- package/utilities/LightSwitch/LightSwitch.svelte.d.ts +21 -0
- package/utilities/LightSwitch/stores.d.ts +2 -0
- package/utilities/LightSwitch/stores.js +5 -0
- package/utilities/LocalStorageStore/LocalStorageStore.d.ts +12 -0
- package/utilities/LocalStorageStore/LocalStorageStore.js +49 -0
- package/utilities/Menu/menu.d.ts +18 -0
- package/utilities/Menu/menu.js +151 -0
- package/utilities/Modal/Modal.svelte +195 -0
- package/utilities/Modal/Modal.svelte.d.ts +35 -0
- package/{src/lib/utilities → utilities}/Modal/examples/ModalExampleEmbed.svelte +5 -7
- package/utilities/Modal/examples/ModalExampleEmbed.svelte.d.ts +17 -0
- package/{src/lib/utilities → utilities}/Modal/examples/ModalExampleForm.svelte +20 -24
- package/utilities/Modal/examples/ModalExampleForm.svelte.d.ts +17 -0
- package/{src/lib/utilities → utilities}/Modal/examples/ModalExampleList.svelte +13 -18
- package/utilities/Modal/examples/ModalExampleList.svelte.d.ts +17 -0
- package/utilities/Modal/stores.d.ts +12 -0
- package/utilities/Modal/stores.js +24 -0
- package/utilities/Modal/types.d.ts +36 -0
- package/utilities/Modal/types.js +2 -0
- package/utilities/Toast/Toast.svelte +117 -0
- package/utilities/Toast/Toast.svelte.d.ts +28 -0
- package/utilities/Toast/stores.d.ts +10 -0
- package/utilities/Toast/stores.js +60 -0
- package/utilities/Toast/types.d.ts +26 -0
- package/utilities/Toast/types.js +2 -0
- package/utilities/Tooltip/tooltip.d.ts +35 -0
- package/utilities/Tooltip/tooltip.js +94 -0
- package/.eslintrc.cjs +0 -20
- package/.github/FUNDING.yml +0 -13
- package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -30
- package/.github/ISSUE_TEMPLATE/config.yml +0 -8
- package/.github/ISSUE_TEMPLATE/docs_issue.yml +0 -23
- package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -22
- package/.github/pull_request_template.md +0 -14
- package/.prettierignore +0 -12
- package/.prettierrc +0 -6
- package/postcss.config.cjs +0 -14
- package/scripts/compile-css-to-js.cjs +0 -50
- package/scripts/generate-jss.js +0 -67
- package/scripts/post-build.js +0 -17
- package/scripts/pre-build.js +0 -14
- package/src/app.d.ts +0 -13
- package/src/app.html +0 -43
- package/src/app.postcss +0 -10
- package/src/docs/DocsAppBar/DocsAppBar.svelte +0 -213
- package/src/docs/DocsFooter/DocsFooter.svelte +0 -78
- package/src/docs/DocsLogo/DocsLogoAnim.svelte +0 -44
- package/src/docs/DocsLogo/DocsLogoFull.svelte +0 -11
- package/src/docs/DocsLogo/DocsLogoIcon.svelte +0 -6
- package/src/docs/DocsNavigation/DocsDrawer.svelte +0 -23
- package/src/docs/DocsNavigation/DocsSidebar.svelte +0 -103
- package/src/docs/DocsNavigation/links.ts +0 -148
- package/src/docs/DocsSearch/DocsSearch.svelte +0 -78
- package/src/docs/DocsShell/DocsShell.svelte +0 -377
- package/src/docs/DocsShell/sveldMapper.ts +0 -143
- package/src/docs/DocsShell/types.ts +0 -96
- package/src/docs/DocsStyles/blog.css +0 -192
- package/src/docs/DocsThemer/DocsThemer.svelte +0 -254
- package/src/docs/DocsThemer/Swatch.svelte +0 -28
- package/src/docs/DocsThemer/colors.ts +0 -122
- package/src/docs/DocsThemer/settings.ts +0 -129
- package/src/docs/DocsThemer/stores.ts +0 -5
- package/src/docs/DocsThemer/types.ts +0 -20
- package/src/docs/README.md +0 -3
- package/src/docs/stores.ts +0 -15
- package/src/lib/actions/Clipboard/clipboard.ts +0 -39
- package/src/lib/actions/Filters/filter.test.ts +0 -40
- package/src/lib/actions/Filters/filter.ts +0 -23
- package/src/lib/actions/FocusTrap/focusTrap.ts +0 -56
- package/src/lib/components/Accordion/AccordionGroup.svelte +0 -53
- package/src/lib/components/Accordion/AccordionGroup.test.ts +0 -22
- package/src/lib/components/Accordion/AccordionItem.svelte +0 -80
- package/src/lib/components/Accordion/AccordionItem.test.ts +0 -28
- package/src/lib/components/Alert/Alert.svelte +0 -71
- package/src/lib/components/Alert/Alert.test.ts +0 -30
- package/src/lib/components/AppBar/AppBar.svelte +0 -60
- package/src/lib/components/AppBar/AppBar.test.ts +0 -31
- package/src/lib/components/AppRail/AppRail.svelte +0 -58
- package/src/lib/components/AppRail/AppRailTile.svelte +0 -66
- package/src/lib/components/AppShell/AppShell.svelte +0 -84
- package/src/lib/components/AppShell/AppShell.test.ts +0 -26
- package/src/lib/components/Avatar/Avatar.svelte +0 -51
- package/src/lib/components/Avatar/Avatar.test.ts +0 -41
- package/src/lib/components/Breadcrumb/Breadcrumb.svelte +0 -30
- package/src/lib/components/Breadcrumb/Breadcrumb.test.ts +0 -20
- package/src/lib/components/Breadcrumb/Crumb.test.ts +0 -48
- package/src/lib/components/ConicGradient/ConicGradient.svelte +0 -88
- package/src/lib/components/ConicGradient/ConicGradient.test.ts +0 -26
- package/src/lib/components/ConicGradient/settings.ts +0 -345
- package/src/lib/components/ConicGradient/types.ts +0 -12
- package/src/lib/components/Divider/Divider.svelte +0 -26
- package/src/lib/components/Divider/Divider.test.ts +0 -32
- package/src/lib/components/FileButton/FileButton.svelte +0 -29
- package/src/lib/components/FileButton/FileButton.test.ts +0 -32
- package/src/lib/components/FileDropzone/FileDropzone.svelte +0 -108
- package/src/lib/components/FileDropzone/FileDropzone.test.ts +0 -32
- package/src/lib/components/GradientHeading/GradientHeading.svelte +0 -24
- package/src/lib/components/GradientHeading/GradientHeading.test.ts +0 -30
- package/src/lib/components/InputChip/InputChip.svelte +0 -118
- package/src/lib/components/ListBox/ListBox.svelte +0 -65
- package/src/lib/components/ListBox/ListBox.test.ts +0 -48
- package/src/lib/components/ListBox/ListBoxItem.svelte +0 -99
- package/src/lib/components/ListBox/ListBoxItem.test.ts +0 -22
- package/src/lib/components/Paginator/Paginator.svelte +0 -84
- package/src/lib/components/Paginator/Paginator.test.ts +0 -29
- package/src/lib/components/Paginator/types.ts +0 -12
- package/src/lib/components/ProgressBar/ProgressBar.svelte +0 -73
- package/src/lib/components/ProgressBar/ProgressBar.test.ts +0 -27
- package/src/lib/components/ProgressRadial/ProgressRadial.svelte +0 -98
- package/src/lib/components/ProgressRadial/ProgressRadial.test.ts +0 -26
- package/src/lib/components/Radio/RadioGroup.svelte +0 -54
- package/src/lib/components/Radio/RadioGroup.test.ts +0 -35
- package/src/lib/components/Radio/RadioItem.svelte +0 -71
- package/src/lib/components/Radio/RadioItem.test.ts +0 -32
- package/src/lib/components/RangeSlider/RangeSlider.svelte +0 -110
- package/src/lib/components/RangeSlider/RangeSlider.test.ts +0 -44
- package/src/lib/components/SlideToggle/SlideToggle.svelte +0 -106
- package/src/lib/components/SlideToggle/SlideToggle.test.ts +0 -23
- package/src/lib/components/Stepper/Step.svelte +0 -140
- package/src/lib/components/Stepper/Step.test.ts +0 -21
- package/src/lib/components/Stepper/Stepper.svelte +0 -71
- package/src/lib/components/Stepper/Stepper.test.ts +0 -31
- package/src/lib/components/SvgIcon/SvgIcon.svelte +0 -50
- package/src/lib/components/SvgIcon/SvgIcon.test.ts +0 -28
- package/src/lib/components/SvgIcon/icons.ts +0 -29
- package/src/lib/components/Tab/Tab.svelte +0 -79
- package/src/lib/components/Tab/Tab.test.ts +0 -26
- package/src/lib/components/Tab/TabGroup.svelte +0 -78
- package/src/lib/components/Tab/TabGroup.test.ts +0 -30
- package/src/lib/components/Table/Table.svelte +0 -106
- package/src/lib/components/Table/types.ts +0 -10
- package/src/lib/components/TableOfContents/TableOfContents.svelte +0 -139
- package/src/lib/themes/theme-test.css +0 -96
- package/src/lib/utilities/CodeBlock/CodeBlock.svelte +0 -78
- package/src/lib/utilities/CodeBlock/CodeBlock.test.ts +0 -27
- package/src/lib/utilities/CodeBlock/stores.ts +0 -5
- package/src/lib/utilities/DataTable/DataTable.ts +0 -151
- package/src/lib/utilities/DataTable/actions.ts +0 -100
- package/src/lib/utilities/DataTable/types.ts +0 -33
- package/src/lib/utilities/Drawer/Drawer.svelte +0 -173
- package/src/lib/utilities/Drawer/Drawer.test.ts +0 -15
- package/src/lib/utilities/Drawer/stores.ts +0 -27
- package/src/lib/utilities/Drawer/types.ts +0 -47
- package/src/lib/utilities/LightSwitch/LightSwitch.svelte +0 -116
- package/src/lib/utilities/LightSwitch/LightSwitch.test.ts +0 -19
- package/src/lib/utilities/LightSwitch/stores.ts +0 -7
- package/src/lib/utilities/LocalStorageStore/LocalStorageStore.test.ts +0 -220
- package/src/lib/utilities/LocalStorageStore/LocalStorageStore.ts +0 -77
- package/src/lib/utilities/Menu/menu.test.ts +0 -22
- package/src/lib/utilities/Menu/menu.ts +0 -172
- package/src/lib/utilities/Modal/Modal.svelte +0 -206
- package/src/lib/utilities/Modal/Modal.test.ts +0 -50
- package/src/lib/utilities/Modal/stores.ts +0 -29
- package/src/lib/utilities/Modal/types.ts +0 -39
- package/src/lib/utilities/Toast/Toast.svelte +0 -95
- package/src/lib/utilities/Toast/Toats.test.ts +0 -25
- package/src/lib/utilities/Toast/stores.ts +0 -63
- package/src/lib/utilities/Toast/types.ts +0 -29
- package/src/lib/utilities/Tooltip/tooltip.ts +0 -137
- package/src/routes/(inner)/+layout.svelte +0 -3
- package/src/routes/(inner)/actions/clipboard/+page.svelte +0 -87
- package/src/routes/(inner)/actions/filters/+page.svelte +0 -151
- package/src/routes/(inner)/actions/focus-trap/+page.svelte +0 -59
- package/src/routes/(inner)/components/accordions/+page.svelte +0 -127
- package/src/routes/(inner)/components/alerts/+page.svelte +0 -130
- package/src/routes/(inner)/components/app-bar/+page.svelte +0 -52
- package/src/routes/(inner)/components/app-rail/+page.svelte +0 -105
- package/src/routes/(inner)/components/app-shell/+page.svelte +0 -159
- package/src/routes/(inner)/components/avatars/+page.svelte +0 -193
- package/src/routes/(inner)/components/breadcrumbs/+page.svelte +0 -121
- package/src/routes/(inner)/components/conic-gradients/+page.svelte +0 -161
- package/src/routes/(inner)/components/dividers/+page.svelte +0 -146
- package/src/routes/(inner)/components/file-buttons/+page.svelte +0 -46
- package/src/routes/(inner)/components/file-dropzone/+page.svelte +0 -71
- package/src/routes/(inner)/components/gradient-headings/+page.svelte +0 -138
- package/src/routes/(inner)/components/input-chips/+page.svelte +0 -128
- package/src/routes/(inner)/components/listboxes/+page.svelte +0 -92
- package/src/routes/(inner)/components/paginators/+page.svelte +0 -118
- package/src/routes/(inner)/components/progress-bars/+page.svelte +0 -157
- package/src/routes/(inner)/components/progress-radials/+page.svelte +0 -64
- package/src/routes/(inner)/components/radio-groups/+page.svelte +0 -91
- package/src/routes/(inner)/components/range-sliders/+page.svelte +0 -134
- package/src/routes/(inner)/components/slide-toggles/+page.svelte +0 -63
- package/src/routes/(inner)/components/steppers/+page.svelte +0 -168
- package/src/routes/(inner)/components/svg-icons/+page.svelte +0 -60
- package/src/routes/(inner)/components/table-of-contents/+page.svelte +0 -110
- package/src/routes/(inner)/components/tables/+page.svelte +0 -216
- package/src/routes/(inner)/components/tabs/+page.svelte +0 -146
- package/src/routes/(inner)/docs/comparisons/+page.svelte +0 -130
- package/src/routes/(inner)/docs/contributions/+page.svelte +0 -78
- package/src/routes/(inner)/docs/contributions/documentation/+page.svelte +0 -217
- package/src/routes/(inner)/docs/contributions/requirements/+page.svelte +0 -173
- package/src/routes/(inner)/docs/contributions/style-guide/+page.svelte +0 -164
- package/src/routes/(inner)/docs/faqs/+page.svelte +0 -80
- package/src/routes/(inner)/docs/features/+page.svelte +0 -121
- package/src/routes/(inner)/docs/recommended/+page.svelte +0 -162
- package/src/routes/(inner)/docs/why/+page.svelte +0 -104
- package/src/routes/(inner)/elements/alerts/+page.svelte +0 -142
- package/src/routes/(inner)/elements/badges/+page.svelte +0 -155
- package/src/routes/(inner)/elements/breadcrumbs/+page.svelte +0 -132
- package/src/routes/(inner)/elements/buttons/+page.svelte +0 -304
- package/src/routes/(inner)/elements/cards/+page.svelte +0 -117
- package/src/routes/(inner)/elements/chips/+page.svelte +0 -130
- package/src/routes/(inner)/elements/core/+page.svelte +0 -98
- package/src/routes/(inner)/elements/forms/+page.svelte +0 -89
- package/src/routes/(inner)/elements/forms/preview/+page.svelte +0 -256
- package/src/routes/(inner)/elements/lists/+page.svelte +0 -197
- package/src/routes/(inner)/elements/logo-clouds/+page.svelte +0 -105
- package/src/routes/(inner)/elements/placeholders/+page.svelte +0 -70
- package/src/routes/(inner)/elements/tables/+page.svelte +0 -138
- package/src/routes/(inner)/elements/tokens/+page.svelte +0 -176
- package/src/routes/(inner)/elements/typography/+page.svelte +0 -100
- package/src/routes/(inner)/guides/install/+page.svelte +0 -84
- package/src/routes/(inner)/guides/quickstart/+page.svelte +0 -118
- package/src/routes/(inner)/guides/styling/+page.svelte +0 -361
- package/src/routes/(inner)/guides/tailwind/+page.svelte +0 -150
- package/src/routes/(inner)/guides/themes/+page.svelte +0 -144
- package/src/routes/(inner)/guides/themes/colors/+page.svelte +0 -87
- package/src/routes/(inner)/guides/themes/generator/+page.svelte +0 -58
- package/src/routes/(inner)/guides/themes/presets.ts +0 -69
- package/src/routes/(inner)/template/+page.svelte +0 -52
- package/src/routes/(inner)/utilities/codeblocks/+page.svelte +0 -77
- package/src/routes/(inner)/utilities/data-tables/+page.svelte +0 -399
- package/src/routes/(inner)/utilities/data-tables/+page.ts +0 -18
- package/src/routes/(inner)/utilities/drawers/+page.svelte +0 -193
- package/src/routes/(inner)/utilities/lightswitches/+page.svelte +0 -86
- package/src/routes/(inner)/utilities/local-storage-stores/+page.svelte +0 -67
- package/src/routes/(inner)/utilities/menus/+page.svelte +0 -186
- package/src/routes/(inner)/utilities/modals/+page.svelte +0 -391
- package/src/routes/(inner)/utilities/toasts/+page.svelte +0 -212
- package/src/routes/(inner)/utilities/tooltips/+page.svelte +0 -153
- package/src/routes/+error.svelte +0 -16
- package/src/routes/+layout.server.ts +0 -13
- package/src/routes/+layout.svelte +0 -100
- package/src/routes/+page.server.ts +0 -12
- package/src/routes/+page.svelte +0 -197
- package/src/routes/blog/+page.svelte +0 -78
- package/src/routes/blog/+page.ts +0 -6
- package/src/routes/blog/[slug]/+page.svelte +0 -112
- package/src/routes/blog/[slug]/+page.ts +0 -6
- package/src/routes/blog/blog-service.ts +0 -31
- package/src/routes/blog/rss/+server.ts +0 -16
- package/static/favicon.png +0 -0
- package/svelte.config.js +0 -30
- package/tailwind.config.cjs +0 -14
- package/tsconfig.json +0 -37
- package/vite.config.js +0 -25
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from 'svelte';
|
|
2
|
+
import { fade, fly } from 'svelte/transition';
|
|
3
|
+
// Event Handler
|
|
4
|
+
const dispatch = createEventDispatcher();
|
|
5
|
+
import { focusTrap } from '../../actions/FocusTrap/focusTrap';
|
|
6
|
+
import { modalStore } from './stores';
|
|
7
|
+
// Props
|
|
8
|
+
/** The open/close animation duration. Set '0' (zero) to disable. */
|
|
9
|
+
export let duration = 150;
|
|
10
|
+
// Props (modal)
|
|
11
|
+
/** Provide classes to style the modal background. */
|
|
12
|
+
export let background = 'bg-surface-100-800-token';
|
|
13
|
+
/** Provide classes to style the modal width. */
|
|
14
|
+
export let width = 'w-full max-w-[640px]';
|
|
15
|
+
/** Provide classes to style the modal. */
|
|
16
|
+
export let height = 'h-auto';
|
|
17
|
+
/** Provide classes to style the modal padding. */
|
|
18
|
+
export let padding = 'p-4';
|
|
19
|
+
/** Provide classes to style the modal spacing. */
|
|
20
|
+
export let spacing = 'space-y-4';
|
|
21
|
+
/** Provide classes to style the modal border radius. */
|
|
22
|
+
export let rounded = 'rounded-container-token';
|
|
23
|
+
/** Provide classes to style modal box shadow. */
|
|
24
|
+
export let shadow = 'shadow-xl';
|
|
25
|
+
// Props (buttons)
|
|
26
|
+
/** Provide classes for neutral buttons, such as Cancel. */
|
|
27
|
+
export let buttonNeutral = 'btn-ghost-surface';
|
|
28
|
+
/** Provide classes for positive actions, such as Confirm or Submit. */
|
|
29
|
+
export let buttonPositive = 'btn-filled-primary';
|
|
30
|
+
/** Override the text for the Cancel button. */
|
|
31
|
+
export let buttonTextCancel = 'Cancel';
|
|
32
|
+
/** Override the text for the Confirm button. */
|
|
33
|
+
export let buttonTextConfirm = 'Confirm';
|
|
34
|
+
/** Override the text for the Submit button. */
|
|
35
|
+
export let buttonTextSubmit = 'Submit';
|
|
36
|
+
// Props (regions)
|
|
37
|
+
/** Provide classes to style the backdrop. */
|
|
38
|
+
export let regionBackdrop = 'bg-surface-backdrop-token';
|
|
39
|
+
/** Provide arbitrary classes to modal header region. */
|
|
40
|
+
export let regionHeader = 'text-2xl font-bold';
|
|
41
|
+
/** Provide arbitrary classes to modal body region. */
|
|
42
|
+
export let regionBody = 'max-h-[200px] overflow-hidden';
|
|
43
|
+
/** Provide arbitrary classes to modal footer region. */
|
|
44
|
+
export let regionFooter = 'flex justify-end space-x-2';
|
|
45
|
+
// Base Styles
|
|
46
|
+
const cBackdrop = 'fixed top-0 left-0 right-0 bottom-0 z-[999] flex justify-center items-center p-4';
|
|
47
|
+
const cModal = 'max-h-full overflow-y-auto overflow-x-hidden';
|
|
48
|
+
const cModalImage = 'w-full h-auto';
|
|
49
|
+
// Local
|
|
50
|
+
let promptValue;
|
|
51
|
+
const buttonTextDefaults = {
|
|
52
|
+
buttonTextCancel,
|
|
53
|
+
buttonTextConfirm,
|
|
54
|
+
buttonTextSubmit
|
|
55
|
+
};
|
|
56
|
+
// Modal Store Subscription
|
|
57
|
+
modalStore.subscribe((dArr) => {
|
|
58
|
+
if (!dArr.length)
|
|
59
|
+
return;
|
|
60
|
+
// Set Prompt input value and type
|
|
61
|
+
promptValue = dArr[0].value;
|
|
62
|
+
// Override button text per instance, if available
|
|
63
|
+
buttonTextCancel = dArr[0].buttonTextCancel || buttonTextDefaults.buttonTextCancel;
|
|
64
|
+
buttonTextConfirm = dArr[0].buttonTextConfirm || buttonTextDefaults.buttonTextConfirm;
|
|
65
|
+
buttonTextSubmit = dArr[0].buttonTextSubmit || buttonTextDefaults.buttonTextSubmit;
|
|
66
|
+
});
|
|
67
|
+
// Event Handlers ---
|
|
68
|
+
function onBackdropInteraction(event) {
|
|
69
|
+
if (!(event.target instanceof Element))
|
|
70
|
+
return;
|
|
71
|
+
if (event.target.classList.contains('modal-backdrop'))
|
|
72
|
+
onClose();
|
|
73
|
+
/** @event {{ event }} backdrop - Fires on backdrop interaction. */
|
|
74
|
+
dispatch('backdrop', event);
|
|
75
|
+
}
|
|
76
|
+
function onClose() {
|
|
77
|
+
if ($modalStore[0].response)
|
|
78
|
+
$modalStore[0].response(false);
|
|
79
|
+
modalStore.close();
|
|
80
|
+
}
|
|
81
|
+
function onConfirm() {
|
|
82
|
+
if ($modalStore[0].response)
|
|
83
|
+
$modalStore[0].response(true);
|
|
84
|
+
modalStore.close();
|
|
85
|
+
}
|
|
86
|
+
function onPromptSubmit() {
|
|
87
|
+
if ($modalStore[0].response)
|
|
88
|
+
$modalStore[0].response(promptValue);
|
|
89
|
+
modalStore.close();
|
|
90
|
+
}
|
|
91
|
+
// A11y ---
|
|
92
|
+
function onKeyDown(event) {
|
|
93
|
+
if (!$modalStore.length)
|
|
94
|
+
return;
|
|
95
|
+
if (event.code === 'Escape')
|
|
96
|
+
onClose();
|
|
97
|
+
}
|
|
98
|
+
// Reactive
|
|
99
|
+
$: classesBackdrop = `${cBackdrop} ${regionBackdrop} ${$$props.class || ''}`;
|
|
100
|
+
$: classesModal = `${cModal} ${background} ${width} ${height} ${padding} ${spacing} ${rounded} ${shadow}`;
|
|
101
|
+
// IMPORTANT: add values to pass to the children templates.
|
|
102
|
+
// There is a way to self-reference component values, but it involes svelte-internal and is not yet stable.
|
|
103
|
+
// REPL: https://svelte.dev/repl/badd0f11aa99450ca69dca6690d4d5a4?version=3.52.0
|
|
104
|
+
// Source: https://discord.com/channels/457912077277855764/1037768846855118909
|
|
105
|
+
$: parent = {
|
|
106
|
+
background,
|
|
107
|
+
width,
|
|
108
|
+
height,
|
|
109
|
+
padding,
|
|
110
|
+
spacing,
|
|
111
|
+
rounded,
|
|
112
|
+
shadow,
|
|
113
|
+
// ---
|
|
114
|
+
buttonNeutral,
|
|
115
|
+
buttonPositive,
|
|
116
|
+
buttonTextCancel,
|
|
117
|
+
buttonTextConfirm,
|
|
118
|
+
buttonTextSubmit,
|
|
119
|
+
// ---
|
|
120
|
+
regionBackdrop,
|
|
121
|
+
regionHeader,
|
|
122
|
+
regionBody,
|
|
123
|
+
regionFooter,
|
|
124
|
+
// ---
|
|
125
|
+
onClose
|
|
126
|
+
};
|
|
127
|
+
</script>
|
|
128
|
+
|
|
129
|
+
<svelte:window on:keydown={onKeyDown} />
|
|
130
|
+
|
|
131
|
+
{#if $modalStore.length > 0}
|
|
132
|
+
{#key $modalStore}
|
|
133
|
+
<!-- Backdrop -->
|
|
134
|
+
<div
|
|
135
|
+
class="modal-backdrop {classesBackdrop} {$modalStore[0].backdropClasses}"
|
|
136
|
+
on:mousedown={onBackdropInteraction}
|
|
137
|
+
on:touchstart={onBackdropInteraction}
|
|
138
|
+
transition:fade={{ duration }}
|
|
139
|
+
data-testid="modal-backdrop"
|
|
140
|
+
>
|
|
141
|
+
<!-- Modal -->
|
|
142
|
+
<div
|
|
143
|
+
class="modal {classesModal} {$modalStore[0].modalClasses}"
|
|
144
|
+
transition:fly={{ duration, opacity: 0, y: 100 }}
|
|
145
|
+
use:focusTrap={true}
|
|
146
|
+
data-testid="modal"
|
|
147
|
+
role="dialog"
|
|
148
|
+
aria-modal="true"
|
|
149
|
+
aria-label={$modalStore[0].title}
|
|
150
|
+
>
|
|
151
|
+
<!-- Header -->
|
|
152
|
+
{#if $modalStore[0]?.title}
|
|
153
|
+
<header class="modal-header {regionHeader}">{@html $modalStore[0].title}</header>
|
|
154
|
+
{/if}
|
|
155
|
+
<!-- Body -->
|
|
156
|
+
{#if $modalStore[0]?.body}
|
|
157
|
+
<article class="modal-body {regionBody}">{@html $modalStore[0].body}</article>
|
|
158
|
+
{/if}
|
|
159
|
+
<!-- Image -->
|
|
160
|
+
{#if $modalStore[0]?.image && typeof $modalStore[0]?.image === 'string'}
|
|
161
|
+
<img class="modal-image {cModalImage}" src={$modalStore[0]?.image} alt="Modal" />
|
|
162
|
+
{/if}
|
|
163
|
+
<!-- Type -->
|
|
164
|
+
{#if $modalStore[0].type === 'alert'}
|
|
165
|
+
<!-- Template: Alert -->
|
|
166
|
+
<footer class="modal-footer {regionFooter}">
|
|
167
|
+
<!-- prettier-ignore -->
|
|
168
|
+
<button class="btn {buttonNeutral}" on:click={onClose}>{buttonTextCancel}</button>
|
|
169
|
+
</footer>
|
|
170
|
+
{:else if $modalStore[0].type === 'confirm'}
|
|
171
|
+
<!-- Template: Confirm -->
|
|
172
|
+
<!-- prettier-ignore -->
|
|
173
|
+
<footer class="modal-footer {regionFooter}">
|
|
174
|
+
<button class="btn {buttonNeutral}" on:click={onClose}>{buttonTextCancel}</button>
|
|
175
|
+
<button class="btn {buttonPositive}" on:click={onConfirm}>{buttonTextConfirm}</button>
|
|
176
|
+
</footer>
|
|
177
|
+
{:else if $modalStore[0].type === 'prompt'}
|
|
178
|
+
<!-- Template: Prompt -->
|
|
179
|
+
<input class="modal-prompt-input" type="text" bind:value={promptValue} />
|
|
180
|
+
<!-- prettier-ignore -->
|
|
181
|
+
<footer class="modal-footer {regionFooter}">
|
|
182
|
+
<button class="btn {buttonNeutral}" on:click={onClose}>{buttonTextCancel}</button>
|
|
183
|
+
<button class="btn {buttonPositive}" on:click={onPromptSubmit} disabled={!promptValue}>{buttonTextSubmit}</button>
|
|
184
|
+
</footer>
|
|
185
|
+
{:else if $modalStore[0].type === 'component'}
|
|
186
|
+
<!-- Template: Component -->
|
|
187
|
+
<!-- NOTE: users are repsonsible for handling all UI, including cancel/submit buttons -->
|
|
188
|
+
<svelte:component this={$modalStore[0].component?.ref} {...$modalStore[0].component?.props} {parent}>
|
|
189
|
+
{@html $modalStore[0].component?.slot}
|
|
190
|
+
</svelte:component>
|
|
191
|
+
{/if}
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
{/key}
|
|
195
|
+
{/if}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
duration?: number | undefined;
|
|
6
|
+
background?: string | undefined;
|
|
7
|
+
width?: string | undefined;
|
|
8
|
+
height?: string | undefined;
|
|
9
|
+
padding?: string | undefined;
|
|
10
|
+
spacing?: string | undefined;
|
|
11
|
+
rounded?: string | undefined;
|
|
12
|
+
shadow?: string | undefined;
|
|
13
|
+
buttonNeutral?: string | undefined;
|
|
14
|
+
buttonPositive?: string | undefined;
|
|
15
|
+
buttonTextCancel?: string | undefined;
|
|
16
|
+
buttonTextConfirm?: string | undefined;
|
|
17
|
+
buttonTextSubmit?: string | undefined;
|
|
18
|
+
regionBackdrop?: string | undefined;
|
|
19
|
+
regionHeader?: string | undefined;
|
|
20
|
+
regionBody?: string | undefined;
|
|
21
|
+
regionFooter?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
events: {
|
|
24
|
+
backdrop: CustomEvent<any>;
|
|
25
|
+
} & {
|
|
26
|
+
[evt: string]: CustomEvent<any>;
|
|
27
|
+
};
|
|
28
|
+
slots: {};
|
|
29
|
+
};
|
|
30
|
+
export type ModalProps = typeof __propDef.props;
|
|
31
|
+
export type ModalEvents = typeof __propDef.events;
|
|
32
|
+
export type ModalSlots = typeof __propDef.slots;
|
|
33
|
+
export default class Modal extends SvelteComponentTyped<ModalProps, ModalEvents, ModalSlots> {
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// Base Classes
|
|
7
|
-
const cBase = 'relative';
|
|
1
|
+
<script>// Props
|
|
2
|
+
/** Exposes parent props to this component. */
|
|
3
|
+
export let parent;
|
|
4
|
+
// Base Classes
|
|
5
|
+
const cBase = 'relative';
|
|
8
6
|
</script>
|
|
9
7
|
|
|
10
8
|
<!-- @component This example creates an embedded video modal. -->
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
/** Exposes parent props to this component. */ parent: any;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type ModalExampleEmbedProps = typeof __propDef.props;
|
|
12
|
+
export type ModalExampleEmbedEvents = typeof __propDef.events;
|
|
13
|
+
export type ModalExampleEmbedSlots = typeof __propDef.slots;
|
|
14
|
+
/** This example creates an embedded video modal. */
|
|
15
|
+
export default class ModalExampleEmbed extends SvelteComponentTyped<ModalExampleEmbedProps, ModalExampleEmbedEvents, ModalExampleEmbedSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// Base Classes
|
|
23
|
-
const cBase = 'space-y-4';
|
|
24
|
-
const cForm = 'border border-surface-500 p-4 space-y-4 rounded-container-token';
|
|
1
|
+
<script>// Props
|
|
2
|
+
/** Exposes parent props to this component. */
|
|
3
|
+
export let parent;
|
|
4
|
+
// Stores
|
|
5
|
+
import { modalStore } from '../../../index.ts';
|
|
6
|
+
// Form Data
|
|
7
|
+
const formData = {
|
|
8
|
+
name: 'Jane Doe',
|
|
9
|
+
tel: '214-555-1234',
|
|
10
|
+
email: 'jdoe@email.com'
|
|
11
|
+
};
|
|
12
|
+
// We've created a custom submit function to pass the response and close the modal.
|
|
13
|
+
function onFormSubmit() {
|
|
14
|
+
if ($modalStore[0].response)
|
|
15
|
+
$modalStore[0].response(formData);
|
|
16
|
+
modalStore.close();
|
|
17
|
+
}
|
|
18
|
+
// Base Classes
|
|
19
|
+
const cBase = 'space-y-4';
|
|
20
|
+
const cForm = 'border border-surface-500 p-4 space-y-4 rounded-container-token';
|
|
25
21
|
</script>
|
|
26
22
|
|
|
27
23
|
<!-- @component This example creates a simple form modal. -->
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
/** Exposes parent props to this component. */ parent: any;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type ModalExampleFormProps = typeof __propDef.props;
|
|
12
|
+
export type ModalExampleFormEvents = typeof __propDef.events;
|
|
13
|
+
export type ModalExampleFormSlots = typeof __propDef.slots;
|
|
14
|
+
/** This example creates a simple form modal. */
|
|
15
|
+
export default class ModalExampleForm extends SvelteComponentTyped<ModalExampleFormProps, ModalExampleFormEvents, ModalExampleFormSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
modalStore.close();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Base Classes
|
|
18
|
-
const cBase = 'space-y-4';
|
|
1
|
+
<script>import { writable } from 'svelte/store';
|
|
2
|
+
import { ListBox, ListBoxItem, modalStore } from '../../../index.ts';
|
|
3
|
+
// Props
|
|
4
|
+
/** Exposes parent props to this component. */
|
|
5
|
+
export let parent;
|
|
6
|
+
const storeFlavor = writable('chocolate');
|
|
7
|
+
function onFormSubmit() {
|
|
8
|
+
if ($modalStore[0].response)
|
|
9
|
+
$modalStore[0].response($storeFlavor);
|
|
10
|
+
modalStore.close();
|
|
11
|
+
}
|
|
12
|
+
// Base Classes
|
|
13
|
+
const cBase = 'space-y-4';
|
|
19
14
|
</script>
|
|
20
15
|
|
|
21
16
|
<!-- @component This example creates a simple form modal. -->
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
/** Exposes parent props to this component. */ parent: any;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type ModalExampleListProps = typeof __propDef.props;
|
|
12
|
+
export type ModalExampleListEvents = typeof __propDef.events;
|
|
13
|
+
export type ModalExampleListSlots = typeof __propDef.slots;
|
|
14
|
+
/** This example creates a simple form modal. */
|
|
15
|
+
export default class ModalExampleList extends SvelteComponentTyped<ModalExampleListProps, ModalExampleListEvents, ModalExampleListSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ModalSettings } from './types';
|
|
2
|
+
export declare const modalStore: {
|
|
3
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<ModalSettings[]>, invalidate?: ((value?: ModalSettings[] | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
|
|
4
|
+
set: (this: void, value: ModalSettings[]) => void;
|
|
5
|
+
update: (this: void, updater: import("svelte/store").Updater<ModalSettings[]>) => void;
|
|
6
|
+
/** Append to end of queue. */
|
|
7
|
+
trigger: (modal: ModalSettings) => void;
|
|
8
|
+
/** Remove first item in queue. */
|
|
9
|
+
close: () => void;
|
|
10
|
+
/** Remove all items from queue. */
|
|
11
|
+
clear: () => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Modal Store Queue
|
|
2
|
+
import { writable } from 'svelte/store';
|
|
3
|
+
function modalService() {
|
|
4
|
+
const { subscribe, set, update } = writable([]);
|
|
5
|
+
return {
|
|
6
|
+
subscribe,
|
|
7
|
+
set,
|
|
8
|
+
update,
|
|
9
|
+
/** Append to end of queue. */
|
|
10
|
+
trigger: (modal) => update((mStore) => {
|
|
11
|
+
mStore.push(modal);
|
|
12
|
+
return mStore;
|
|
13
|
+
}),
|
|
14
|
+
/** Remove first item in queue. */
|
|
15
|
+
close: () => update((mStore) => {
|
|
16
|
+
if (mStore.length > 0)
|
|
17
|
+
mStore.shift();
|
|
18
|
+
return mStore;
|
|
19
|
+
}),
|
|
20
|
+
/** Remove all items from queue. */
|
|
21
|
+
clear: () => set([])
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export const modalStore = modalService();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface ModalComponent {
|
|
2
|
+
/** Import and provide your component reference. */
|
|
3
|
+
ref: any;
|
|
4
|
+
/** Provide a key/value pairs of component props. */
|
|
5
|
+
props?: Record<string, unknown>;
|
|
6
|
+
/** Provide an HTML template literal for the default slot. */
|
|
7
|
+
slot?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ModalSettings {
|
|
10
|
+
/** Designate what type of component will display. */
|
|
11
|
+
type: 'alert' | 'confirm' | 'prompt' | 'component';
|
|
12
|
+
/** Provide the modal header content. Accepts HTML. */
|
|
13
|
+
title?: string;
|
|
14
|
+
/** Provide the modal body content. Accepts HTML. */
|
|
15
|
+
body?: string;
|
|
16
|
+
/** Provide a URL to display an image within the modal. */
|
|
17
|
+
image?: URL | string;
|
|
18
|
+
/** Prompt Only - provide a prompt value. */
|
|
19
|
+
value?: unknown;
|
|
20
|
+
/** Provide your component reference, props, and slot details. */
|
|
21
|
+
component?: ModalComponent;
|
|
22
|
+
/** Provide a function. Returns the repsonse value. */
|
|
23
|
+
response?: (r: any) => void;
|
|
24
|
+
/** Provide abitrary classes to the backdrop. */
|
|
25
|
+
backdropClasses?: string;
|
|
26
|
+
/** Provide abitrary classes to the modal window. */
|
|
27
|
+
modalClasses?: string;
|
|
28
|
+
/** Override the Cancel button label. */
|
|
29
|
+
buttonTextCancel?: string;
|
|
30
|
+
/** Override the Confirm button label. */
|
|
31
|
+
buttonTextConfirm?: string;
|
|
32
|
+
/** Override the Submit button label. */
|
|
33
|
+
buttonTextSubmit?: string;
|
|
34
|
+
/** Pass abitrary data per modal instance. */
|
|
35
|
+
meta?: any;
|
|
36
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script>import { fly } from 'svelte/transition';
|
|
2
|
+
// Toast Store
|
|
3
|
+
import { toastStore } from './stores';
|
|
4
|
+
// Props
|
|
5
|
+
/** Set the toast position.
|
|
6
|
+
* @type {'t' | 'b' | 'l' | 'r' | 'tl' | 'tr' | 'bl' | 'br'}
|
|
7
|
+
*/
|
|
8
|
+
export let position = 'b';
|
|
9
|
+
/** Maximum toasts that can show at once. */
|
|
10
|
+
export let max = 3;
|
|
11
|
+
/** The duration of the fly in/out animation. */
|
|
12
|
+
export let duration = 150;
|
|
13
|
+
// Props (styles)
|
|
14
|
+
/** Provide classes to set the background color. */
|
|
15
|
+
export let background = 'bg-secondary-500';
|
|
16
|
+
/** Provide classes to set width styles. */
|
|
17
|
+
export let width = 'max-w-[640px]';
|
|
18
|
+
/** Provide classes to set the text color. */
|
|
19
|
+
export let color = 'text-on-secondary-token';
|
|
20
|
+
/** Provide classes to set the padding. */
|
|
21
|
+
export let padding = 'p-4';
|
|
22
|
+
/** Provide classes to set the horizontal spacing. */
|
|
23
|
+
export let spacing = 'space-x-4';
|
|
24
|
+
/** Provide classes to set the border radius styles. */
|
|
25
|
+
export let rounded = 'rounded-container-token';
|
|
26
|
+
/** Provide classes to set the border box shadow. */
|
|
27
|
+
export let shadow = 'shadow-lg';
|
|
28
|
+
// Props (buttons)
|
|
29
|
+
/** Provide action button styles. */
|
|
30
|
+
export let buttonAction = 'btn-filled';
|
|
31
|
+
/** Provide dismiss button styles. */
|
|
32
|
+
export let buttonDismiss = 'btn-filled';
|
|
33
|
+
// Base Classes
|
|
34
|
+
const cWrapper = 'flex fixed top-0 left-0 right-0 bottom-0 z-[888] pointer-events-none';
|
|
35
|
+
const cSnackbar = 'flex flex-col space-y-2';
|
|
36
|
+
const cToast = 'flex justify-between items-center pointer-events-auto';
|
|
37
|
+
// Local
|
|
38
|
+
let cPosition;
|
|
39
|
+
let cAlign; // items-center
|
|
40
|
+
let animAxis = { x: 0, y: 0 };
|
|
41
|
+
// Set Position
|
|
42
|
+
// prettier-ignore
|
|
43
|
+
switch (position) {
|
|
44
|
+
// Centered
|
|
45
|
+
case ('t'):
|
|
46
|
+
cPosition = 'justify-center items-start';
|
|
47
|
+
cAlign = 'items-center';
|
|
48
|
+
animAxis = { x: 0, y: -100 };
|
|
49
|
+
break;
|
|
50
|
+
case ('b'):
|
|
51
|
+
cPosition = 'justify-center items-end';
|
|
52
|
+
cAlign = 'items-center';
|
|
53
|
+
animAxis = { x: 0, y: 100 };
|
|
54
|
+
break;
|
|
55
|
+
case ('l'):
|
|
56
|
+
cPosition = 'justify-start items-center';
|
|
57
|
+
cAlign = 'items-start';
|
|
58
|
+
animAxis = { x: -100, y: 0 };
|
|
59
|
+
break;
|
|
60
|
+
case ('r'):
|
|
61
|
+
cPosition = 'justify-end items-center';
|
|
62
|
+
cAlign = 'items-end';
|
|
63
|
+
animAxis = { x: 100, y: 0 };
|
|
64
|
+
break;
|
|
65
|
+
// Corners
|
|
66
|
+
case ('tl'):
|
|
67
|
+
cPosition = 'justify-start items-start';
|
|
68
|
+
cAlign = 'items-start';
|
|
69
|
+
animAxis = { x: -100, y: 0 };
|
|
70
|
+
break;
|
|
71
|
+
case ('tr'):
|
|
72
|
+
cPosition = 'justify-end items-start';
|
|
73
|
+
cAlign = 'items-end';
|
|
74
|
+
animAxis = { x: 100, y: 0 };
|
|
75
|
+
break;
|
|
76
|
+
case ('bl'):
|
|
77
|
+
cPosition = 'justify-start items-end';
|
|
78
|
+
cAlign = 'items-start';
|
|
79
|
+
animAxis = { x: -100, y: 0 };
|
|
80
|
+
break;
|
|
81
|
+
case ('br'):
|
|
82
|
+
cPosition = 'justify-end items-end';
|
|
83
|
+
cAlign = 'items-end';
|
|
84
|
+
animAxis = { x: 100, y: 0 };
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
function onAction(index) {
|
|
88
|
+
$toastStore[index]?.action?.response();
|
|
89
|
+
toastStore.close($toastStore[index].id);
|
|
90
|
+
}
|
|
91
|
+
// Reactive
|
|
92
|
+
$: classesWrapper = `${cWrapper} ${cPosition} ${$$props.class || ''}`;
|
|
93
|
+
$: classesSnackbar = `${cSnackbar} ${cAlign} ${padding}`;
|
|
94
|
+
$: classesBase = `${cToast} ${background} ${width} ${color} ${padding} ${spacing} ${rounded} ${shadow}`;
|
|
95
|
+
</script>
|
|
96
|
+
|
|
97
|
+
{#if $toastStore.length}
|
|
98
|
+
<!-- Wrapper -->
|
|
99
|
+
<div class="snackbar-wrapper {classesWrapper}" data-testid="snackbar-wrapper">
|
|
100
|
+
<!-- List -->
|
|
101
|
+
<div class="snackbar {classesSnackbar}" transition:fly={{ x: animAxis.x, y: animAxis.y, duration }}>
|
|
102
|
+
{#each $toastStore as t, i}
|
|
103
|
+
{#if i < max + 1}
|
|
104
|
+
<!-- Toast -->
|
|
105
|
+
<div class="toast {classesBase} {t.classes}" role="alert" aria-live="polite" data-testid="toast">
|
|
106
|
+
<div class="text-base">{@html t.message}</div>
|
|
107
|
+
<!-- prettier-ignore -->
|
|
108
|
+
<div class="flex items-center space-x-2">
|
|
109
|
+
{#if t.action}<button class="btn {buttonAction}" on:click={() => onAction(i)}>{@html t.action.label}</button>{/if}
|
|
110
|
+
<button class="btn-icon {buttonDismiss}" on:click={() => { toastStore.close(t.id) }}>✕</button>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
{/if}
|
|
114
|
+
{/each}
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
{/if}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
position?: string | undefined;
|
|
6
|
+
max?: number | undefined;
|
|
7
|
+
duration?: number | undefined;
|
|
8
|
+
background?: string | undefined;
|
|
9
|
+
width?: string | undefined;
|
|
10
|
+
color?: string | undefined;
|
|
11
|
+
padding?: string | undefined;
|
|
12
|
+
spacing?: string | undefined;
|
|
13
|
+
rounded?: string | undefined;
|
|
14
|
+
shadow?: string | undefined;
|
|
15
|
+
buttonAction?: string | undefined;
|
|
16
|
+
buttonDismiss?: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export type ToastProps = typeof __propDef.props;
|
|
24
|
+
export type ToastEvents = typeof __propDef.events;
|
|
25
|
+
export type ToastSlots = typeof __propDef.slots;
|
|
26
|
+
export default class Toast extends SvelteComponentTyped<ToastProps, ToastEvents, ToastSlots> {
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ToastSettings, Toast } from './types';
|
|
2
|
+
export declare const toastStore: {
|
|
3
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<Toast[]>, invalidate?: ((value?: Toast[] | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
|
|
4
|
+
/** Add a new toast to the queue. */
|
|
5
|
+
trigger: (toast: ToastSettings) => void;
|
|
6
|
+
/** Remove first toast in queue */
|
|
7
|
+
close: (id: string) => void;
|
|
8
|
+
/** Remove all toasts from queue */
|
|
9
|
+
clear: () => void;
|
|
10
|
+
};
|