@skeletonlabs/skeleton 0.86.9 → 0.92.1
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/.eslintrc.cjs +20 -0
- package/.github/FUNDING.yml +13 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +30 -0
- package/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/.github/ISSUE_TEMPLATE/docs_issue.yml +23 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +22 -0
- package/.github/pull_request_template.md +14 -0
- package/.prettierignore +12 -0
- package/.prettierrc +6 -0
- package/package.json +61 -149
- package/postcss.config.cjs +14 -0
- package/scripts/compile-css-to-js.cjs +50 -0
- package/scripts/generate-jss.js +67 -0
- package/scripts/post-build.js +17 -0
- package/scripts/pre-build.js +14 -0
- package/src/app.d.ts +13 -0
- package/src/app.html +43 -0
- package/src/app.postcss +10 -0
- package/src/docs/DocsAppBar/DocsAppBar.svelte +213 -0
- package/src/docs/DocsFooter/DocsFooter.svelte +78 -0
- package/src/docs/DocsLogo/DocsLogoAnim.svelte +44 -0
- package/src/docs/DocsLogo/DocsLogoFull.svelte +11 -0
- package/src/docs/DocsLogo/DocsLogoIcon.svelte +6 -0
- package/src/docs/DocsNavigation/DocsDrawer.svelte +23 -0
- package/src/docs/DocsNavigation/DocsSidebar.svelte +103 -0
- package/src/docs/DocsNavigation/links.ts +148 -0
- package/src/docs/DocsSearch/DocsSearch.svelte +78 -0
- package/src/docs/DocsShell/DocsShell.svelte +377 -0
- package/src/docs/DocsShell/sveldMapper.ts +143 -0
- package/src/docs/DocsShell/types.ts +96 -0
- package/src/docs/DocsStyles/blog.css +192 -0
- package/src/docs/DocsThemer/DocsThemer.svelte +254 -0
- package/src/docs/DocsThemer/Swatch.svelte +28 -0
- package/src/docs/DocsThemer/colors.ts +122 -0
- package/src/docs/DocsThemer/settings.ts +129 -0
- package/src/docs/DocsThemer/stores.ts +5 -0
- package/src/docs/DocsThemer/types.ts +20 -0
- package/src/docs/README.md +3 -0
- package/src/docs/stores.ts +15 -0
- package/src/lib/actions/Clipboard/clipboard.ts +39 -0
- package/src/lib/actions/Filters/filter.test.ts +40 -0
- package/src/lib/actions/Filters/filter.ts +23 -0
- package/{actions → src/lib/actions}/Filters/svg-filters/Apollo.svelte +0 -0
- package/{actions → src/lib/actions}/Filters/svg-filters/BlueNight.svelte +0 -0
- package/{actions → src/lib/actions}/Filters/svg-filters/Emerald.svelte +0 -0
- package/{actions → src/lib/actions}/Filters/svg-filters/GreenFall.svelte +0 -0
- package/{actions → src/lib/actions}/Filters/svg-filters/Noir.svelte +0 -0
- package/{actions → src/lib/actions}/Filters/svg-filters/NoirLight.svelte +0 -0
- package/{actions → src/lib/actions}/Filters/svg-filters/Rustic.svelte +0 -0
- package/{actions → src/lib/actions}/Filters/svg-filters/Summer84.svelte +0 -0
- package/{actions → src/lib/actions}/Filters/svg-filters/XPro.svelte +0 -0
- package/src/lib/actions/FocusTrap/focusTrap.ts +56 -0
- package/src/lib/components/Accordion/AccordionGroup.svelte +53 -0
- package/src/lib/components/Accordion/AccordionGroup.test.ts +22 -0
- package/src/lib/components/Accordion/AccordionItem.svelte +80 -0
- package/src/lib/components/Accordion/AccordionItem.test.ts +28 -0
- package/src/lib/components/Alert/Alert.svelte +71 -0
- package/src/lib/components/Alert/Alert.test.ts +30 -0
- package/src/lib/components/AppBar/AppBar.svelte +60 -0
- package/src/lib/components/AppBar/AppBar.test.ts +31 -0
- package/src/lib/components/AppRail/AppRail.svelte +58 -0
- package/src/lib/components/AppRail/AppRailTile.svelte +66 -0
- package/src/lib/components/AppShell/AppShell.svelte +84 -0
- package/src/lib/components/AppShell/AppShell.test.ts +26 -0
- package/src/lib/components/Avatar/Avatar.svelte +51 -0
- package/src/lib/components/Avatar/Avatar.test.ts +41 -0
- package/src/lib/components/Breadcrumb/Breadcrumb.svelte +30 -0
- package/src/lib/components/Breadcrumb/Breadcrumb.test.ts +20 -0
- package/{components → src/lib/components}/Breadcrumb/Crumb.svelte +23 -16
- package/src/lib/components/Breadcrumb/Crumb.test.ts +48 -0
- package/src/lib/components/ConicGradient/ConicGradient.svelte +88 -0
- package/src/lib/components/ConicGradient/ConicGradient.test.ts +26 -0
- package/src/lib/components/ConicGradient/settings.ts +345 -0
- package/src/lib/components/ConicGradient/types.ts +12 -0
- package/src/lib/components/Divider/Divider.svelte +26 -0
- package/src/lib/components/Divider/Divider.test.ts +32 -0
- package/src/lib/components/FileButton/FileButton.svelte +29 -0
- package/src/lib/components/FileButton/FileButton.test.ts +32 -0
- package/src/lib/components/FileDropzone/FileDropzone.svelte +108 -0
- package/src/lib/components/FileDropzone/FileDropzone.test.ts +32 -0
- package/src/lib/components/GradientHeading/GradientHeading.svelte +24 -0
- package/src/lib/components/GradientHeading/GradientHeading.test.ts +30 -0
- package/src/lib/components/InputChip/InputChip.svelte +118 -0
- package/src/lib/components/ListBox/ListBox.svelte +65 -0
- package/src/lib/components/ListBox/ListBox.test.ts +48 -0
- package/src/lib/components/ListBox/ListBoxItem.svelte +99 -0
- package/src/lib/components/ListBox/ListBoxItem.test.ts +22 -0
- package/src/lib/components/Paginator/Paginator.svelte +84 -0
- package/src/lib/components/Paginator/Paginator.test.ts +29 -0
- package/src/lib/components/Paginator/types.ts +12 -0
- package/src/lib/components/ProgressBar/ProgressBar.svelte +73 -0
- package/src/lib/components/ProgressBar/ProgressBar.test.ts +27 -0
- package/src/lib/components/ProgressRadial/ProgressRadial.svelte +98 -0
- package/src/lib/components/ProgressRadial/ProgressRadial.test.ts +26 -0
- package/src/lib/components/Radio/RadioGroup.svelte +54 -0
- package/src/lib/components/Radio/RadioGroup.test.ts +35 -0
- package/src/lib/components/Radio/RadioItem.svelte +71 -0
- package/src/lib/components/Radio/RadioItem.test.ts +32 -0
- package/src/lib/components/RangeSlider/RangeSlider.svelte +110 -0
- package/src/lib/components/RangeSlider/RangeSlider.test.ts +44 -0
- package/src/lib/components/SlideToggle/SlideToggle.svelte +106 -0
- package/src/lib/components/SlideToggle/SlideToggle.test.ts +23 -0
- package/src/lib/components/Stepper/Step.svelte +140 -0
- package/src/lib/components/Stepper/Step.test.ts +21 -0
- package/src/lib/components/Stepper/Stepper.svelte +71 -0
- package/src/lib/components/Stepper/Stepper.test.ts +31 -0
- package/src/lib/components/SvgIcon/SvgIcon.svelte +50 -0
- package/src/lib/components/SvgIcon/SvgIcon.test.ts +28 -0
- package/src/lib/components/SvgIcon/icons.ts +29 -0
- package/src/lib/components/Tab/Tab.svelte +79 -0
- package/src/lib/components/Tab/Tab.test.ts +26 -0
- package/src/lib/components/Tab/TabGroup.svelte +78 -0
- package/src/lib/components/Tab/TabGroup.test.ts +30 -0
- package/src/lib/components/Table/Table.svelte +106 -0
- package/src/lib/components/Table/types.ts +10 -0
- package/{components/Table/utils.js → src/lib/components/Table/utils.ts} +16 -10
- package/src/lib/components/TableOfContents/TableOfContents.svelte +139 -0
- package/{index.d.ts → src/lib/index.ts} +33 -1
- package/{styles → src/lib/styles}/all.css +0 -3
- package/{styles → src/lib/styles}/core.css +3 -0
- package/src/lib/styles/elements/alerts.css +43 -0
- package/{styles → src/lib/styles}/elements/badges.css +1 -1
- package/src/lib/styles/elements/breadcrumbs.css +27 -0
- package/{styles → src/lib/styles}/elements/buttons.css +1 -1
- package/{styles → src/lib/styles}/elements/cards.css +1 -1
- package/src/lib/styles/elements/chips.css +71 -0
- package/{styles → src/lib/styles}/elements/lists.css +1 -1
- package/{styles → src/lib/styles}/elements/logo-clouds.css +1 -1
- package/{styles → src/lib/styles}/elements/menus.css +1 -1
- package/{styles → src/lib/styles}/elements/placeholders.css +1 -1
- package/{styles → src/lib/styles}/elements/tables.css +0 -0
- package/{styles → src/lib/styles}/elements/tooltips.css +1 -1
- package/{styles → src/lib/styles}/elements.css +2 -0
- package/{styles → src/lib/styles}/forms.css +57 -40
- package/{styles → src/lib/styles}/highlight-js.css +0 -0
- package/{styles → src/lib/styles}/tailwind.css +0 -0
- package/{styles → src/lib/styles}/typography.css +2 -2
- package/src/lib/tailwind/settings.cjs +20 -0
- package/src/lib/tailwind/skeleton.cjs +50 -0
- package/src/lib/tailwind/theme/colors.cjs +18 -0
- package/src/lib/tailwind/tokens/backgrounds.cjs +40 -0
- package/src/lib/tailwind/tokens/border-radius.cjs +21 -0
- package/src/lib/tailwind/tokens/borders.cjs +20 -0
- package/src/lib/tailwind/tokens/fills.cjs +20 -0
- package/src/lib/tailwind/tokens/rings.cjs +42 -0
- package/src/lib/tailwind/tokens/text.cjs +33 -0
- package/{themes → src/lib/themes}/theme-crimson.css +0 -0
- package/{themes → src/lib/themes}/theme-gold-nouveau.css +0 -0
- package/{themes → src/lib/themes}/theme-hamlindigo.css +0 -0
- package/{themes → src/lib/themes}/theme-modern.css +0 -0
- package/{themes → src/lib/themes}/theme-rocket.css +0 -0
- package/{themes → src/lib/themes}/theme-sahara.css +0 -0
- package/{themes → src/lib/themes}/theme-seafoam.css +0 -0
- package/{themes → src/lib/themes}/theme-seasonal.css +2 -2
- package/{themes → src/lib/themes}/theme-skeleton.css +6 -6
- package/src/lib/themes/theme-test.css +96 -0
- package/{themes → src/lib/themes}/theme-vintage.css +0 -0
- package/src/lib/utilities/CodeBlock/CodeBlock.svelte +78 -0
- package/src/lib/utilities/CodeBlock/CodeBlock.test.ts +27 -0
- package/src/lib/utilities/CodeBlock/stores.ts +5 -0
- package/src/lib/utilities/DataTable/DataTable.ts +151 -0
- package/src/lib/utilities/DataTable/actions.ts +100 -0
- package/src/lib/utilities/DataTable/types.ts +33 -0
- package/src/lib/utilities/Drawer/Drawer.svelte +173 -0
- package/src/lib/utilities/Drawer/Drawer.test.ts +15 -0
- package/src/lib/utilities/Drawer/stores.ts +27 -0
- package/src/lib/utilities/Drawer/types.ts +47 -0
- package/src/lib/utilities/LightSwitch/LightSwitch.svelte +116 -0
- package/src/lib/utilities/LightSwitch/LightSwitch.test.ts +19 -0
- package/src/lib/utilities/LightSwitch/stores.ts +7 -0
- package/src/lib/utilities/LocalStorageStore/LocalStorageStore.test.ts +220 -0
- package/src/lib/utilities/LocalStorageStore/LocalStorageStore.ts +77 -0
- package/src/lib/utilities/Menu/menu.test.ts +22 -0
- package/src/lib/utilities/Menu/menu.ts +172 -0
- package/src/lib/utilities/Modal/Modal.svelte +206 -0
- package/src/lib/utilities/Modal/Modal.test.ts +50 -0
- package/{utilities → src/lib/utilities}/Modal/examples/ModalExampleEmbed.svelte +7 -5
- package/{utilities → src/lib/utilities}/Modal/examples/ModalExampleForm.svelte +24 -20
- package/{utilities → src/lib/utilities}/Modal/examples/ModalExampleList.svelte +18 -13
- package/src/lib/utilities/Modal/stores.ts +29 -0
- package/src/lib/utilities/Modal/types.ts +39 -0
- package/src/lib/utilities/Toast/Toast.svelte +95 -0
- package/src/lib/utilities/Toast/Toats.test.ts +25 -0
- package/src/lib/utilities/Toast/stores.ts +63 -0
- package/src/lib/utilities/Toast/types.ts +29 -0
- package/src/lib/utilities/Tooltip/tooltip.ts +137 -0
- package/src/routes/(inner)/+layout.svelte +3 -0
- package/src/routes/(inner)/actions/clipboard/+page.svelte +87 -0
- package/src/routes/(inner)/actions/filters/+page.svelte +151 -0
- package/src/routes/(inner)/actions/focus-trap/+page.svelte +59 -0
- package/src/routes/(inner)/components/accordions/+page.svelte +127 -0
- package/src/routes/(inner)/components/alerts/+page.svelte +130 -0
- package/src/routes/(inner)/components/app-bar/+page.svelte +52 -0
- package/src/routes/(inner)/components/app-rail/+page.svelte +105 -0
- package/src/routes/(inner)/components/app-shell/+page.svelte +159 -0
- package/src/routes/(inner)/components/avatars/+page.svelte +193 -0
- package/src/routes/(inner)/components/breadcrumbs/+page.svelte +121 -0
- package/src/routes/(inner)/components/conic-gradients/+page.svelte +161 -0
- package/src/routes/(inner)/components/dividers/+page.svelte +146 -0
- package/src/routes/(inner)/components/file-buttons/+page.svelte +46 -0
- package/src/routes/(inner)/components/file-dropzone/+page.svelte +71 -0
- package/src/routes/(inner)/components/gradient-headings/+page.svelte +138 -0
- package/src/routes/(inner)/components/input-chips/+page.svelte +128 -0
- package/src/routes/(inner)/components/listboxes/+page.svelte +92 -0
- package/src/routes/(inner)/components/paginators/+page.svelte +118 -0
- package/src/routes/(inner)/components/progress-bars/+page.svelte +157 -0
- package/src/routes/(inner)/components/progress-radials/+page.svelte +64 -0
- package/src/routes/(inner)/components/radio-groups/+page.svelte +91 -0
- package/src/routes/(inner)/components/range-sliders/+page.svelte +134 -0
- package/src/routes/(inner)/components/slide-toggles/+page.svelte +63 -0
- package/src/routes/(inner)/components/steppers/+page.svelte +168 -0
- package/src/routes/(inner)/components/svg-icons/+page.svelte +60 -0
- package/src/routes/(inner)/components/table-of-contents/+page.svelte +110 -0
- package/src/routes/(inner)/components/tables/+page.svelte +216 -0
- package/src/routes/(inner)/components/tabs/+page.svelte +146 -0
- package/src/routes/(inner)/docs/comparisons/+page.svelte +130 -0
- package/src/routes/(inner)/docs/contributions/+page.svelte +78 -0
- package/src/routes/(inner)/docs/contributions/documentation/+page.svelte +217 -0
- package/src/routes/(inner)/docs/contributions/requirements/+page.svelte +173 -0
- package/src/routes/(inner)/docs/contributions/style-guide/+page.svelte +164 -0
- package/src/routes/(inner)/docs/faqs/+page.svelte +80 -0
- package/src/routes/(inner)/docs/features/+page.svelte +121 -0
- package/src/routes/(inner)/docs/recommended/+page.svelte +162 -0
- package/src/routes/(inner)/docs/why/+page.svelte +104 -0
- package/src/routes/(inner)/elements/alerts/+page.svelte +142 -0
- package/src/routes/(inner)/elements/badges/+page.svelte +155 -0
- package/src/routes/(inner)/elements/breadcrumbs/+page.svelte +132 -0
- package/src/routes/(inner)/elements/buttons/+page.svelte +304 -0
- package/src/routes/(inner)/elements/cards/+page.svelte +117 -0
- package/src/routes/(inner)/elements/chips/+page.svelte +130 -0
- package/src/routes/(inner)/elements/core/+page.svelte +98 -0
- package/src/routes/(inner)/elements/forms/+page.svelte +89 -0
- package/src/routes/(inner)/elements/forms/preview/+page.svelte +256 -0
- package/src/routes/(inner)/elements/lists/+page.svelte +197 -0
- package/src/routes/(inner)/elements/logo-clouds/+page.svelte +105 -0
- package/src/routes/(inner)/elements/placeholders/+page.svelte +70 -0
- package/src/routes/(inner)/elements/tables/+page.svelte +138 -0
- package/src/routes/(inner)/elements/tokens/+page.svelte +176 -0
- package/src/routes/(inner)/elements/typography/+page.svelte +100 -0
- package/src/routes/(inner)/guides/install/+page.svelte +84 -0
- package/src/routes/(inner)/guides/quickstart/+page.svelte +118 -0
- package/src/routes/(inner)/guides/styling/+page.svelte +361 -0
- package/src/routes/(inner)/guides/tailwind/+page.svelte +150 -0
- package/src/routes/(inner)/guides/themes/+page.svelte +144 -0
- package/src/routes/(inner)/guides/themes/colors/+page.svelte +87 -0
- package/src/routes/(inner)/guides/themes/generator/+page.svelte +58 -0
- package/src/routes/(inner)/guides/themes/presets.ts +69 -0
- package/src/routes/(inner)/template/+page.svelte +52 -0
- package/src/routes/(inner)/utilities/codeblocks/+page.svelte +77 -0
- package/src/routes/(inner)/utilities/data-tables/+page.svelte +399 -0
- package/src/routes/(inner)/utilities/data-tables/+page.ts +18 -0
- package/src/routes/(inner)/utilities/drawers/+page.svelte +193 -0
- package/src/routes/(inner)/utilities/lightswitches/+page.svelte +86 -0
- package/src/routes/(inner)/utilities/local-storage-stores/+page.svelte +67 -0
- package/src/routes/(inner)/utilities/menus/+page.svelte +186 -0
- package/src/routes/(inner)/utilities/modals/+page.svelte +391 -0
- package/src/routes/(inner)/utilities/toasts/+page.svelte +212 -0
- package/src/routes/(inner)/utilities/tooltips/+page.svelte +153 -0
- package/src/routes/+error.svelte +16 -0
- package/src/routes/+layout.server.ts +13 -0
- package/src/routes/+layout.svelte +100 -0
- package/src/routes/+page.server.ts +12 -0
- package/src/routes/+page.svelte +197 -0
- package/src/routes/blog/+page.svelte +78 -0
- package/src/routes/blog/+page.ts +6 -0
- package/src/routes/blog/[slug]/+page.svelte +112 -0
- package/src/routes/blog/[slug]/+page.ts +6 -0
- package/src/routes/blog/blog-service.ts +31 -0
- package/src/routes/blog/rss/+server.ts +16 -0
- package/static/favicon.png +0 -0
- package/svelte.config.js +30 -0
- package/tailwind.config.cjs +14 -0
- package/tsconfig.json +37 -0
- package/vite.config.js +25 -0
- package/actions/Clipboard/clipboard.d.ts +0 -4
- package/actions/Clipboard/clipboard.js +0 -37
- package/actions/Filters/filter.d.ts +0 -3
- package/actions/Filters/filter.js +0 -23
- package/actions/Filters/svg-filters/Apollo.svelte.d.ts +0 -23
- package/actions/Filters/svg-filters/BlueNight.svelte.d.ts +0 -23
- package/actions/Filters/svg-filters/Emerald.svelte.d.ts +0 -23
- package/actions/Filters/svg-filters/GreenFall.svelte.d.ts +0 -23
- package/actions/Filters/svg-filters/Noir.svelte.d.ts +0 -23
- package/actions/Filters/svg-filters/NoirLight.svelte.d.ts +0 -23
- package/actions/Filters/svg-filters/Rustic.svelte.d.ts +0 -23
- package/actions/Filters/svg-filters/Summer84.svelte.d.ts +0 -23
- package/actions/Filters/svg-filters/XPro.svelte.d.ts +0 -23
- package/actions/FocusTrap/focusTrap.d.ts +0 -4
- package/actions/FocusTrap/focusTrap.js +0 -53
- package/components/Accordion/AccordionGroup.svelte +0 -46
- package/components/Accordion/AccordionGroup.svelte.d.ts +0 -24
- package/components/Accordion/AccordionItem.svelte +0 -70
- package/components/Accordion/AccordionItem.svelte.d.ts +0 -36
- package/components/Alert/Alert.svelte +0 -65
- package/components/Alert/Alert.svelte.d.ts +0 -30
- package/components/AppBar/AppBar.svelte +0 -54
- package/components/AppBar/AppBar.svelte.d.ts +0 -30
- package/components/AppRail/AppRail.svelte +0 -51
- package/components/AppRail/AppRail.svelte.d.ts +0 -32
- package/components/AppRail/AppRailTile.svelte +0 -57
- package/components/AppRail/AppRailTile.svelte.d.ts +0 -33
- package/components/AppShell/AppShell.svelte +0 -80
- package/components/AppShell/AppShell.svelte.d.ts +0 -31
- package/components/Avatar/Avatar.svelte +0 -46
- package/components/Avatar/Avatar.svelte.d.ts +0 -32
- package/components/Breadcrumb/Breadcrumb.svelte +0 -24
- package/components/Breadcrumb/Breadcrumb.svelte.d.ts +0 -21
- package/components/Breadcrumb/Crumb.svelte.d.ts +0 -26
- package/components/ConicGradient/ConicGradient.svelte +0 -80
- package/components/ConicGradient/ConicGradient.svelte.d.ts +0 -29
- package/components/ConicGradient/types.d.ts +0 -10
- package/components/ConicGradient/types.js +0 -2
- package/components/Divider/Divider.svelte +0 -21
- package/components/Divider/Divider.svelte.d.ts +0 -22
- package/components/FileButton/FileButton.svelte +0 -25
- package/components/FileButton/FileButton.svelte.d.ts +0 -25
- package/components/FileDropzone/FileDropzone.svelte +0 -98
- package/components/FileDropzone/FileDropzone.svelte.d.ts +0 -32
- package/components/GradientHeading/GradientHeading.svelte +0 -21
- package/components/GradientHeading/GradientHeading.svelte.d.ts +0 -22
- package/components/ListBox/ListBox.svelte +0 -57
- package/components/ListBox/ListBox.svelte.d.ts +0 -30
- package/components/ListBox/ListBoxItem.svelte +0 -89
- package/components/ListBox/ListBoxItem.svelte.d.ts +0 -32
- package/components/Paginator/Paginator.svelte +0 -74
- package/components/Paginator/Paginator.svelte.d.ts +0 -29
- package/components/Paginator/types.d.ts +0 -10
- package/components/Paginator/types.js +0 -2
- package/components/ProgressBar/ProgressBar.svelte +0 -67
- package/components/ProgressBar/ProgressBar.svelte.d.ts +0 -24
- package/components/ProgressRadial/ProgressRadial.svelte +0 -89
- package/components/ProgressRadial/ProgressRadial.svelte.d.ts +0 -25
- package/components/Radio/RadioGroup.svelte +0 -48
- package/components/Radio/RadioGroup.svelte.d.ts +0 -31
- package/components/Radio/RadioItem.svelte +0 -61
- package/components/Radio/RadioItem.svelte.d.ts +0 -33
- package/components/RangeSlider/RangeSlider.svelte +0 -101
- package/components/RangeSlider/RangeSlider.svelte.d.ts +0 -32
- package/components/SlideToggle/SlideToggle.svelte +0 -100
- package/components/SlideToggle/SlideToggle.svelte.d.ts +0 -34
- package/components/Stepper/Step.svelte +0 -114
- package/components/Stepper/Step.svelte.d.ts +0 -34
- package/components/Stepper/Stepper.svelte +0 -51
- package/components/Stepper/Stepper.svelte.d.ts +0 -30
- package/components/SvgIcon/SvgIcon.svelte +0 -45
- package/components/SvgIcon/SvgIcon.svelte.d.ts +0 -26
- package/components/SvgIcon/icons.d.ts +0 -1
- package/components/SvgIcon/icons.js +0 -171
- package/components/Tab/Tab.svelte +0 -69
- package/components/Tab/Tab.svelte.d.ts +0 -37
- package/components/Tab/TabGroup.svelte +0 -69
- package/components/Tab/TabGroup.svelte.d.ts +0 -30
- package/components/Table/Table.svelte +0 -99
- package/components/Table/Table.svelte.d.ts +0 -27
- package/components/Table/types.d.ts +0 -10
- package/components/Table/types.js +0 -1
- package/components/Table/utils.d.ts +0 -7
- package/index.js +0 -69
- package/styles/elements/chips.css +0 -20
- package/styles/tokens/backgrounds.css +0 -329
- package/styles/tokens/border-radius.css +0 -41
- package/styles/tokens/borders.css +0 -253
- package/styles/tokens/fills.css +0 -38
- package/styles/tokens/rings.css +0 -253
- package/styles/tokens/text.css +0 -293
- package/styles/tokens.css +0 -8
- package/tailwind/colors.d.ts +0 -13
- package/tailwind/colors.js +0 -335
- package/tailwind/theme.cjs +0 -39
- package/tailwind/theme.d.cts +0 -5
- package/utilities/CodeBlock/CodeBlock.svelte +0 -68
- package/utilities/CodeBlock/CodeBlock.svelte.d.ts +0 -25
- package/utilities/CodeBlock/stores.d.ts +0 -2
- package/utilities/CodeBlock/stores.js +0 -3
- package/utilities/DataTable/DataTable.d.ts +0 -18
- package/utilities/DataTable/DataTable.js +0 -137
- package/utilities/DataTable/actions.d.ts +0 -8
- package/utilities/DataTable/actions.js +0 -114
- package/utilities/DataTable/types.d.ts +0 -33
- package/utilities/DataTable/types.js +0 -2
- package/utilities/Drawer/Drawer.svelte +0 -157
- package/utilities/Drawer/Drawer.svelte.d.ts +0 -33
- package/utilities/Drawer/stores.d.ts +0 -10
- package/utilities/Drawer/stores.js +0 -21
- package/utilities/Drawer/types.d.ts +0 -33
- package/utilities/Drawer/types.js +0 -2
- package/utilities/LightSwitch/LightSwitch.svelte +0 -75
- package/utilities/LightSwitch/LightSwitch.svelte.d.ts +0 -21
- package/utilities/LightSwitch/stores.d.ts +0 -3
- package/utilities/LightSwitch/stores.js +0 -5
- package/utilities/LocalStorageStore/LocalStorageStore.d.ts +0 -12
- package/utilities/LocalStorageStore/LocalStorageStore.js +0 -49
- package/utilities/Menu/menu.d.ts +0 -18
- package/utilities/Menu/menu.js +0 -151
- package/utilities/Modal/Modal.svelte +0 -194
- package/utilities/Modal/Modal.svelte.d.ts +0 -35
- package/utilities/Modal/examples/ModalExampleEmbed.svelte.d.ts +0 -17
- package/utilities/Modal/examples/ModalExampleForm.svelte.d.ts +0 -17
- package/utilities/Modal/examples/ModalExampleList.svelte.d.ts +0 -17
- package/utilities/Modal/stores.d.ts +0 -12
- package/utilities/Modal/stores.js +0 -24
- package/utilities/Modal/types.d.ts +0 -34
- package/utilities/Modal/types.js +0 -2
- package/utilities/Toast/Toast.svelte +0 -117
- package/utilities/Toast/Toast.svelte.d.ts +0 -28
- package/utilities/Toast/stores.d.ts +0 -10
- package/utilities/Toast/stores.js +0 -61
- package/utilities/Toast/types.d.ts +0 -26
- package/utilities/Toast/types.js +0 -2
- package/utilities/Tooltip/tooltip.d.ts +0 -35
- package/utilities/Tooltip/tooltip.js +0 -94
package/utilities/Menu/menu.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
// Action: Menu
|
|
2
|
-
// https://svelte.dev/repl/0ace7a508bd843b798ae599940a91783?version=3.16.7
|
|
3
|
-
// prettier-ignore
|
|
4
|
-
export function menu(node, args) {
|
|
5
|
-
const elemMenu = document.querySelector(`[data-menu="${args.menu}"]`);
|
|
6
|
-
if (!elemMenu)
|
|
7
|
-
return;
|
|
8
|
-
const elemWhitelist = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])';
|
|
9
|
-
let activeFocusIdx;
|
|
10
|
-
let focusableElems;
|
|
11
|
-
const onInit = () => {
|
|
12
|
-
autoUpdateOrigin();
|
|
13
|
-
// Apply a11y attributes
|
|
14
|
-
elemMenu.setAttribute('role', 'menu');
|
|
15
|
-
};
|
|
16
|
-
// Menu States ---
|
|
17
|
-
const menuOpen = (openWithFocus = false) => {
|
|
18
|
-
elemMenu.style.display = 'block';
|
|
19
|
-
stateEventHandler(true);
|
|
20
|
-
// Create array of all focusable elements, so that we can iterate through them
|
|
21
|
-
focusableElems = Array.from(elemMenu.querySelectorAll(elemWhitelist));
|
|
22
|
-
// reset the focus index
|
|
23
|
-
activeFocusIdx = -1;
|
|
24
|
-
if (openWithFocus) {
|
|
25
|
-
// Automatically focus the element if openWithFocus is true (for example if
|
|
26
|
-
// the menu was opened with Enter instead of with a click
|
|
27
|
-
activeFocusIdx = 0;
|
|
28
|
-
focusableElems[0]?.focus();
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
const menuClose = () => {
|
|
32
|
-
elemMenu.style.display = 'none';
|
|
33
|
-
stateEventHandler(false);
|
|
34
|
-
};
|
|
35
|
-
const stateEventHandler = (state) => {
|
|
36
|
-
if (args.state)
|
|
37
|
-
args.state({ menu: args.menu, state });
|
|
38
|
-
};
|
|
39
|
-
// Click Handlers ---
|
|
40
|
-
const toggleMenu = () => {
|
|
41
|
-
// When the node is clicked, open the menu if it is closed, otherwise close it
|
|
42
|
-
if (elemMenu.style.display != 'block') {
|
|
43
|
-
autoUpdateOrigin();
|
|
44
|
-
menuOpen();
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
menuClose();
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const onWindowClick = (event) => {
|
|
51
|
-
args.interactive === true ? interactiveClickHandler(event) : standardClickHandler(event);
|
|
52
|
-
};
|
|
53
|
-
// Interactive FALSE - any click closes the menu
|
|
54
|
-
const standardClickHandler = (event) => {
|
|
55
|
-
// Any click outside the node closes the menu, but a click inside the node toggles the menu.
|
|
56
|
-
const outsideNode = node && !node.contains(event.target);
|
|
57
|
-
if (outsideNode) {
|
|
58
|
-
menuClose();
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
toggleMenu();
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
// Interactive TRUE - clicks outside close menu
|
|
65
|
-
const interactiveClickHandler = (event) => {
|
|
66
|
-
const outsideNode = node && !node.contains(event.target);
|
|
67
|
-
const outsideMenu = elemMenu && !elemMenu.contains(event.target);
|
|
68
|
-
if (!outsideNode) {
|
|
69
|
-
toggleMenu();
|
|
70
|
-
}
|
|
71
|
-
else if (outsideNode && outsideMenu) {
|
|
72
|
-
menuClose();
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
// Menu - Set auto origin ---
|
|
76
|
-
const autoUpdateOrigin = () => {
|
|
77
|
-
if (!args.fixed && !elemMenu.classList.contains('hidden')) {
|
|
78
|
-
// Get the Menu's bounds
|
|
79
|
-
const elemTriggerBounds = node.getBoundingClientRect();
|
|
80
|
-
// Determine vertical and horizontal values
|
|
81
|
-
const vert = elemTriggerBounds.y < window.innerHeight / 2 ? 't' : 'b'; // top/bottom
|
|
82
|
-
const horz = elemTriggerBounds.x < window.innerWidth / 2 ? 'l' : 'r'; // left/right
|
|
83
|
-
// Strip and apply only the relevant class
|
|
84
|
-
elemMenu.classList.remove('menu-tl', 'menu-tr', 'menu-bl', 'menu-br');
|
|
85
|
-
elemMenu.classList.add(`menu-${vert}${horz}`);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
// A11y Input Handlers ---
|
|
89
|
-
const onTriggerKeyDown = (event) => {
|
|
90
|
-
const key = event.key;
|
|
91
|
-
if (key === 'Enter' || key === 'Space') {
|
|
92
|
-
event.preventDefault();
|
|
93
|
-
// Toggle menu
|
|
94
|
-
toggleMenu();
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
const onWindowKeyDown = (event) => {
|
|
98
|
-
const key = event.key;
|
|
99
|
-
if (elemMenu.style.display === 'none')
|
|
100
|
-
return;
|
|
101
|
-
if (key === 'Escape' || key === 'Tab') {
|
|
102
|
-
// Close the menu
|
|
103
|
-
event.preventDefault();
|
|
104
|
-
menuClose();
|
|
105
|
-
node.focus();
|
|
106
|
-
}
|
|
107
|
-
else if (key === 'ArrowDown') {
|
|
108
|
-
event.preventDefault();
|
|
109
|
-
if (activeFocusIdx < focusableElems.length - 1) {
|
|
110
|
-
// Move down the menu
|
|
111
|
-
activeFocusIdx += 1;
|
|
112
|
-
focusableElems[activeFocusIdx]?.focus();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else if (key === 'ArrowUp') {
|
|
116
|
-
event.preventDefault();
|
|
117
|
-
if (activeFocusIdx > 0) {
|
|
118
|
-
// Move up the menu
|
|
119
|
-
activeFocusIdx -= 1;
|
|
120
|
-
focusableElems[activeFocusIdx]?.focus();
|
|
121
|
-
}
|
|
122
|
-
else if (focusableElems.length && activeFocusIdx === -1) {
|
|
123
|
-
// Start at the bottom of the menu if first key is arrow up key
|
|
124
|
-
event.preventDefault();
|
|
125
|
-
activeFocusIdx = focusableElems.length - 1;
|
|
126
|
-
focusableElems[activeFocusIdx]?.focus();
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
// On Action Init
|
|
131
|
-
onInit();
|
|
132
|
-
// Window Events
|
|
133
|
-
window.addEventListener('resize', autoUpdateOrigin, true);
|
|
134
|
-
window.addEventListener('click', onWindowClick, true);
|
|
135
|
-
window.addEventListener('keydown', onWindowKeyDown, true);
|
|
136
|
-
// Trigger Node Events
|
|
137
|
-
node.addEventListener('keydown', onTriggerKeyDown);
|
|
138
|
-
node.addEventListener('change', (e) => {
|
|
139
|
-
console.log(e);
|
|
140
|
-
});
|
|
141
|
-
// Lifecycle
|
|
142
|
-
return {
|
|
143
|
-
update: (newArgs) => { args = newArgs; },
|
|
144
|
-
destroy: () => {
|
|
145
|
-
window.removeEventListener('resize', onWindowClick, true);
|
|
146
|
-
window.removeEventListener('click', onWindowClick, true);
|
|
147
|
-
window.removeEventListener('keydown', onWindowKeyDown, true);
|
|
148
|
-
node.removeEventListener('keydown', onTriggerKeyDown);
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
}
|
|
@@ -1,194 +0,0 @@
|
|
|
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 cModalImage = 'w-full h-auto';
|
|
48
|
-
// Local
|
|
49
|
-
let promptValue;
|
|
50
|
-
const buttonTextDefaults = {
|
|
51
|
-
buttonTextCancel,
|
|
52
|
-
buttonTextConfirm,
|
|
53
|
-
buttonTextSubmit
|
|
54
|
-
};
|
|
55
|
-
// Modal Store Subscription
|
|
56
|
-
modalStore.subscribe((dArr) => {
|
|
57
|
-
if (!dArr.length)
|
|
58
|
-
return;
|
|
59
|
-
// Set Prompt input value and type
|
|
60
|
-
promptValue = dArr[0].value;
|
|
61
|
-
// Override button text per instance, if available
|
|
62
|
-
buttonTextCancel = dArr[0].buttonTextCancel || buttonTextDefaults.buttonTextCancel;
|
|
63
|
-
buttonTextConfirm = dArr[0].buttonTextConfirm || buttonTextDefaults.buttonTextConfirm;
|
|
64
|
-
buttonTextSubmit = dArr[0].buttonTextSubmit || buttonTextDefaults.buttonTextSubmit;
|
|
65
|
-
});
|
|
66
|
-
// Event Handlers ---
|
|
67
|
-
function onBackdropInteraction(event) {
|
|
68
|
-
if (!(event.target instanceof Element))
|
|
69
|
-
return;
|
|
70
|
-
if (event.target.classList.contains('modal-backdrop'))
|
|
71
|
-
onClose();
|
|
72
|
-
/** @event {{ event }} backdrop - Fires on backdrop interaction. */
|
|
73
|
-
dispatch('backdrop', event);
|
|
74
|
-
}
|
|
75
|
-
function onClose() {
|
|
76
|
-
if ($modalStore[0].response)
|
|
77
|
-
$modalStore[0].response(false);
|
|
78
|
-
modalStore.close();
|
|
79
|
-
}
|
|
80
|
-
function onConfirm() {
|
|
81
|
-
if ($modalStore[0].response)
|
|
82
|
-
$modalStore[0].response(true);
|
|
83
|
-
modalStore.close();
|
|
84
|
-
}
|
|
85
|
-
function onPromptSubmit() {
|
|
86
|
-
if ($modalStore[0].response)
|
|
87
|
-
$modalStore[0].response(promptValue);
|
|
88
|
-
modalStore.close();
|
|
89
|
-
}
|
|
90
|
-
// A11y ---
|
|
91
|
-
function onKeyDown(event) {
|
|
92
|
-
if (!$modalStore.length)
|
|
93
|
-
return;
|
|
94
|
-
if (event.code === 'Escape')
|
|
95
|
-
onClose();
|
|
96
|
-
}
|
|
97
|
-
// Reactive
|
|
98
|
-
$: classesBackdrop = `${cBackdrop} ${regionBackdrop} ${$$props.class || ''}`;
|
|
99
|
-
$: classesModal = `${background} ${width} ${height} ${padding} ${spacing} ${rounded} ${shadow}`;
|
|
100
|
-
// IMPORTANT: add values to pass to the children templates.
|
|
101
|
-
// There is a way to self-reference component values, but it involes svelte-internal and is not yet stable.
|
|
102
|
-
// REPL: https://svelte.dev/repl/badd0f11aa99450ca69dca6690d4d5a4?version=3.52.0
|
|
103
|
-
// Source: https://discord.com/channels/457912077277855764/1037768846855118909
|
|
104
|
-
$: parent = {
|
|
105
|
-
background,
|
|
106
|
-
width,
|
|
107
|
-
height,
|
|
108
|
-
padding,
|
|
109
|
-
spacing,
|
|
110
|
-
rounded,
|
|
111
|
-
shadow,
|
|
112
|
-
// ---
|
|
113
|
-
buttonNeutral,
|
|
114
|
-
buttonPositive,
|
|
115
|
-
buttonTextCancel,
|
|
116
|
-
buttonTextConfirm,
|
|
117
|
-
buttonTextSubmit,
|
|
118
|
-
// ---
|
|
119
|
-
regionBackdrop,
|
|
120
|
-
regionHeader,
|
|
121
|
-
regionBody,
|
|
122
|
-
regionFooter,
|
|
123
|
-
// ---
|
|
124
|
-
onClose
|
|
125
|
-
};
|
|
126
|
-
</script>
|
|
127
|
-
|
|
128
|
-
<svelte:window on:keydown={onKeyDown} />
|
|
129
|
-
|
|
130
|
-
{#if $modalStore.length > 0}
|
|
131
|
-
{#key $modalStore}
|
|
132
|
-
<!-- Backdrop -->
|
|
133
|
-
<div
|
|
134
|
-
class="modal-backdrop {classesBackdrop}"
|
|
135
|
-
on:mousedown={onBackdropInteraction}
|
|
136
|
-
on:touchstart={onBackdropInteraction}
|
|
137
|
-
transition:fade={{ duration }}
|
|
138
|
-
data-testid="modal-backdrop"
|
|
139
|
-
>
|
|
140
|
-
<!-- Modal -->
|
|
141
|
-
<div
|
|
142
|
-
class="modal {classesModal} {$modalStore[0].classes}"
|
|
143
|
-
transition:fly={{ duration, opacity: 0, y: 100 }}
|
|
144
|
-
use:focusTrap={true}
|
|
145
|
-
data-testid="modal"
|
|
146
|
-
role="dialog"
|
|
147
|
-
aria-modal="true"
|
|
148
|
-
aria-label={$modalStore[0].title}
|
|
149
|
-
>
|
|
150
|
-
<!-- Header -->
|
|
151
|
-
{#if $modalStore[0]?.title}
|
|
152
|
-
<header class="modal-header {regionHeader}">{@html $modalStore[0].title}</header>
|
|
153
|
-
{/if}
|
|
154
|
-
<!-- Body -->
|
|
155
|
-
{#if $modalStore[0]?.body}
|
|
156
|
-
<article class="modal-body {regionBody}">{@html $modalStore[0].body}</article>
|
|
157
|
-
{/if}
|
|
158
|
-
<!-- Image -->
|
|
159
|
-
{#if $modalStore[0]?.image && typeof $modalStore[0]?.image === 'string'}
|
|
160
|
-
<img class="modal-image {cModalImage}" src={$modalStore[0]?.image} alt="Modal" />
|
|
161
|
-
{/if}
|
|
162
|
-
<!-- Type -->
|
|
163
|
-
{#if $modalStore[0].type === 'alert'}
|
|
164
|
-
<!-- Template: Alert -->
|
|
165
|
-
<footer class="modal-footer {regionFooter}">
|
|
166
|
-
<!-- prettier-ignore -->
|
|
167
|
-
<button class="btn {buttonNeutral}" on:click={onClose}>{buttonTextCancel}</button>
|
|
168
|
-
</footer>
|
|
169
|
-
{:else if $modalStore[0].type === 'confirm'}
|
|
170
|
-
<!-- Template: Confirm -->
|
|
171
|
-
<!-- prettier-ignore -->
|
|
172
|
-
<footer class="modal-footer {regionFooter}">
|
|
173
|
-
<button class="btn {buttonNeutral}" on:click={onClose}>{buttonTextCancel}</button>
|
|
174
|
-
<button class="btn {buttonPositive}" on:click={onConfirm}>{buttonTextConfirm}</button>
|
|
175
|
-
</footer>
|
|
176
|
-
{:else if $modalStore[0].type === 'prompt'}
|
|
177
|
-
<!-- Template: Prompt -->
|
|
178
|
-
<input class="modal-prompt-input" type="text" bind:value={promptValue} />
|
|
179
|
-
<!-- prettier-ignore -->
|
|
180
|
-
<footer class="modal-footer {regionFooter}">
|
|
181
|
-
<button class="btn {buttonNeutral}" on:click={onClose}>{buttonTextCancel}</button>
|
|
182
|
-
<button class="btn {buttonPositive}" on:click={onPromptSubmit} disabled={!promptValue}>{buttonTextSubmit}</button>
|
|
183
|
-
</footer>
|
|
184
|
-
{:else if $modalStore[0].type === 'component'}
|
|
185
|
-
<!-- Template: Component -->
|
|
186
|
-
<!-- NOTE: users are repsonsible for handling all UI, including cancel/submit buttons -->
|
|
187
|
-
<svelte:component this={$modalStore[0].component?.ref} {...$modalStore[0].component?.props} {parent}>
|
|
188
|
-
{@html $modalStore[0].component?.slot}
|
|
189
|
-
</svelte:component>
|
|
190
|
-
{/if}
|
|
191
|
-
</div>
|
|
192
|
-
</div>
|
|
193
|
-
{/key}
|
|
194
|
-
{/if}
|
|
@@ -1,35 +0,0 @@
|
|
|
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,17 +0,0 @@
|
|
|
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,17 +0,0 @@
|
|
|
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,17 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
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();
|
|
@@ -1,34 +0,0 @@
|
|
|
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 abritrary classes to apply to the Modal element. Use `!` for important. */
|
|
25
|
-
classes?: string;
|
|
26
|
-
/** Override the Cancel button label. */
|
|
27
|
-
buttonTextCancel?: string;
|
|
28
|
-
/** Override the Confirm button label. */
|
|
29
|
-
buttonTextConfirm?: string;
|
|
30
|
-
/** Override the Submit button label. */
|
|
31
|
-
buttonTextSubmit?: string;
|
|
32
|
-
/** Pass abitrary data per modal instance. */
|
|
33
|
-
meta?: any;
|
|
34
|
-
}
|
package/utilities/Modal/types.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
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}
|
|
@@ -1,28 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
};
|