@onsvisual/svelte-components 0.1.104 → 1.0.0-next.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/dist/css/main.css +500 -4
- package/dist/datavis/BarChart/BarChart.stories.svelte +84 -0
- package/dist/datavis/BarChart/BarChart.stories.svelte.d.ts +23 -0
- package/dist/datavis/BarChart/docs/component.md +19 -0
- package/dist/datavis/Chart/Chart.stories.svelte +128 -0
- package/dist/datavis/Chart/Chart.stories.svelte.d.ts +23 -0
- package/dist/datavis/Chart/docs/component.md +31 -0
- package/dist/datavis/Chart/docs/example.md +28 -0
- package/dist/datavis/ColumnChart/ColumnChart.stories.svelte +84 -0
- package/dist/datavis/ColumnChart/ColumnChart.stories.svelte.d.ts +23 -0
- package/dist/datavis/ColumnChart/docs/component.md +19 -0
- package/dist/datavis/DotPlotChart/DotPlotChart.stories.svelte +40 -0
- package/dist/datavis/DotPlotChart/DotPlotChart.stories.svelte.d.ts +23 -0
- package/dist/datavis/DotPlotChart/docs/component.md +19 -0
- package/dist/datavis/LineChart/LineChart.stories.svelte +64 -0
- package/dist/datavis/LineChart/LineChart.stories.svelte.d.ts +23 -0
- package/dist/datavis/LineChart/docs/component.md +31 -0
- package/dist/datavis/ScatterChart/ScatterChart.stories.svelte +55 -0
- package/dist/datavis/ScatterChart/ScatterChart.stories.svelte.d.ts +23 -0
- package/dist/datavis/ScatterChart/docs/component.md +53 -0
- package/dist/datavis/Table/Table.stories.svelte +32 -0
- package/dist/{@types/datavis/Table/Table.svelte.d.ts → datavis/Table/Table.stories.svelte.d.ts} +2 -16
- package/dist/datavis/Table/Table.svelte +141 -149
- package/dist/datavis/Table/Table.svelte.d.ts +35 -0
- package/dist/datavis/Table/docs/component.md +20 -0
- package/dist/datavis/intro.mdx +22 -0
- package/dist/decorators/Blockquote/Blockquote.stories.svelte +25 -0
- package/dist/decorators/Blockquote/Blockquote.stories.svelte.d.ts +23 -0
- package/dist/decorators/Blockquote/Blockquote.svelte +22 -22
- package/dist/{@types/decorators → decorators}/Blockquote/Blockquote.svelte.d.ts +2 -2
- package/dist/decorators/Blockquote/docs/component.md +10 -0
- package/dist/decorators/Divider/Divider.stories.svelte +29 -0
- package/dist/decorators/Divider/Divider.stories.svelte.d.ts +23 -0
- package/dist/decorators/Divider/Divider.svelte +40 -59
- package/dist/{@types/decorators → decorators}/Divider/Divider.svelte.d.ts +10 -14
- package/dist/decorators/Divider/docs/component.md +12 -0
- package/dist/decorators/Em/Em.stories.svelte +30 -0
- package/dist/{@types/decorators/Em/Em.svelte.d.ts → decorators/Em/Em.stories.svelte.d.ts} +4 -10
- package/dist/decorators/Em/Em.svelte +42 -25
- package/dist/decorators/Em/Em.svelte.d.ts +33 -0
- package/dist/decorators/Em/docs/component.md +12 -0
- package/dist/decorators/Indent/Indent.stories.svelte +22 -0
- package/dist/decorators/Indent/Indent.stories.svelte.d.ts +23 -0
- package/dist/decorators/Indent/Indent.svelte +3 -0
- package/dist/decorators/Indent/Indent.svelte.d.ts +27 -0
- package/dist/decorators/Indent/docs/component.md +10 -0
- package/dist/{@types/index.d.ts → index.d.ts} +10 -10
- package/dist/index.js +13 -8
- package/dist/inputs/Button/Button.stories.svelte +65 -0
- package/dist/inputs/Button/Button.stories.svelte.d.ts +23 -0
- package/dist/inputs/Button/Button.svelte +113 -113
- package/dist/inputs/Button/Button.svelte.d.ts +51 -0
- package/dist/inputs/Button/Icon.svelte +44 -44
- package/dist/{@types/inputs → inputs}/Button/Icon.svelte.d.ts +6 -6
- package/dist/inputs/Button/docs/component.md +17 -0
- package/dist/inputs/Checkbox/Checkbox.stories.svelte +34 -0
- package/dist/inputs/Checkbox/Checkbox.stories.svelte.d.ts +23 -0
- package/dist/inputs/Checkbox/Checkbox.svelte +145 -152
- package/dist/{@types/inputs → inputs}/Checkbox/Checkbox.svelte.d.ts +16 -16
- package/dist/inputs/Checkbox/docs/component.md +14 -0
- package/dist/inputs/Checkboxes/Checkboxes.stories.svelte +42 -0
- package/dist/inputs/Checkboxes/Checkboxes.stories.svelte.d.ts +23 -0
- package/dist/inputs/Checkboxes/Checkboxes.svelte +29 -29
- package/dist/{@types/inputs → inputs}/Checkboxes/Checkboxes.svelte.d.ts +8 -8
- package/dist/inputs/Checkboxes/docs/component.md +20 -0
- package/dist/inputs/Checkboxes/docs/example.md +16 -0
- package/dist/inputs/Dropdown/Dropdown.stories.svelte +54 -0
- package/dist/{@types/inputs/Dropdown/Dropdown.svelte.d.ts → inputs/Dropdown/Dropdown.stories.svelte.d.ts} +2 -16
- package/dist/inputs/Dropdown/Dropdown.svelte +49 -55
- package/dist/inputs/Dropdown/Dropdown.svelte.d.ts +37 -0
- package/dist/inputs/Dropdown/docs/component.md +22 -0
- package/dist/inputs/ErrorPanel/ErrorPanel.stories.svelte +25 -0
- package/dist/inputs/ErrorPanel/ErrorPanel.stories.svelte.d.ts +23 -0
- package/dist/inputs/ErrorPanel/ErrorPanel.svelte +14 -30
- package/dist/{@types/inputs → inputs}/ErrorPanel/ErrorPanel.svelte.d.ts +2 -2
- package/dist/inputs/ErrorPanel/docs/component.md +14 -0
- package/dist/inputs/ErrorSummary/ErrorSummary.stories.svelte +34 -0
- package/dist/inputs/ErrorSummary/ErrorSummary.stories.svelte.d.ts +23 -0
- package/dist/inputs/ErrorSummary/ErrorSummary.svelte +34 -32
- package/dist/{@types/inputs → inputs}/ErrorSummary/ErrorSummary.svelte.d.ts +4 -4
- package/dist/inputs/ErrorSummary/docs/component.md +17 -0
- package/dist/inputs/ErrorSummary/docs/example.md +12 -0
- package/dist/inputs/Input/Input.stories.svelte +73 -0
- package/dist/inputs/Input/Input.stories.svelte.d.ts +23 -0
- package/dist/inputs/Input/Input.svelte +125 -156
- package/dist/inputs/Input/Input.svelte.d.ts +51 -0
- package/dist/inputs/Input/docs/component.md +16 -0
- package/dist/inputs/Radios/Radio.svelte +68 -102
- package/dist/{@types/inputs → inputs}/Radios/Radio.svelte.d.ts +6 -6
- package/dist/inputs/Radios/Radios.stories.svelte +51 -0
- package/dist/inputs/Radios/Radios.stories.svelte.d.ts +23 -0
- package/dist/inputs/Radios/Radios.svelte +38 -38
- package/dist/{@types/inputs → inputs}/Radios/Radios.svelte.d.ts +10 -10
- package/dist/inputs/Radios/docs/component.md +24 -0
- package/dist/inputs/Radios/docs/example.md +21 -0
- package/dist/inputs/Select/Select.stories.svelte +61 -0
- package/dist/inputs/Select/Select.stories.svelte.d.ts +23 -0
- package/dist/inputs/Select/Select.svelte +271 -289
- package/dist/inputs/Select/Select.svelte.d.ts +58 -0
- package/dist/inputs/Select/docs/component.md +27 -0
- package/dist/inputs/Textarea/Textarea.stories.svelte +40 -0
- package/dist/{@types/inputs/Textarea/Textarea.svelte.d.ts → inputs/Textarea/Textarea.stories.svelte.d.ts} +2 -16
- package/dist/inputs/Textarea/Textarea.svelte +93 -89
- package/dist/inputs/Textarea/Textarea.svelte.d.ts +37 -0
- package/dist/inputs/Textarea/docs/component.md +16 -0
- package/dist/intro.mdx +60 -0
- package/dist/js/menuOptions.js +14 -0
- package/dist/{@types/js → js}/utils.d.ts +8 -2
- package/dist/js/utils.js +61 -44
- package/dist/{@types/js → js}/withParams.d.ts +3 -9
- package/dist/js/withParams.js +17 -20
- package/dist/layout/Accordion/Accordion.stories.svelte +30 -0
- package/dist/{@types/layout/Accordion/Accordion.svelte.d.ts → layout/Accordion/Accordion.stories.svelte.d.ts} +4 -8
- package/dist/layout/Accordion/Accordion.svelte +49 -29
- package/dist/layout/Accordion/Accordion.svelte.d.ts +31 -0
- package/dist/layout/Accordion/AccordionItem.svelte +46 -81
- package/dist/{@types/layout → layout}/Accordion/AccordionItem.svelte.d.ts +6 -6
- package/dist/layout/Accordion/accordion.d.ts +18 -0
- package/dist/layout/Accordion/accordion.js +64 -0
- package/dist/layout/Accordion/details.d.ts +14 -0
- package/dist/layout/Accordion/details.js +83 -0
- package/dist/layout/Accordion/docs/component.md +19 -0
- package/dist/layout/AnalyticsBanner/AnalyticsBanner.stories.svelte +16 -0
- package/dist/{@types/layout/AnalyticsBanner/AnalyticsBanner.svelte.d.ts → layout/AnalyticsBanner/AnalyticsBanner.stories.svelte.d.ts} +2 -13
- package/dist/layout/AnalyticsBanner/AnalyticsBanner.svelte +284 -273
- package/dist/layout/AnalyticsBanner/AnalyticsBanner.svelte.d.ts +36 -0
- package/dist/layout/AnalyticsBanner/docs/component.md +17 -0
- package/dist/layout/BackLink/BackLink.stories.svelte +16 -0
- package/dist/layout/BackLink/BackLink.stories.svelte.d.ts +23 -0
- package/dist/layout/BackLink/BackLink.svelte +30 -0
- package/dist/layout/BackLink/BackLink.svelte.d.ts +25 -0
- package/dist/layout/BackLink/docs/component.md +12 -0
- package/dist/layout/Breadcrumb/Breadcrumb.stories.svelte +31 -0
- package/dist/layout/Breadcrumb/Breadcrumb.stories.svelte.d.ts +23 -0
- package/dist/layout/Breadcrumb/Breadcrumb.svelte +44 -67
- package/dist/{@types/layout → layout}/Breadcrumb/Breadcrumb.svelte.d.ts +6 -12
- package/dist/layout/Breadcrumb/docs/component.md +15 -0
- package/dist/layout/Card/Card.stories.svelte +39 -0
- package/dist/layout/Card/Card.stories.svelte.d.ts +23 -0
- package/dist/layout/Card/Card.svelte +120 -0
- package/dist/layout/Card/Card.svelte.d.ts +49 -0
- package/dist/layout/Card/docs/component.md +14 -0
- package/dist/layout/Card/docs/eg-images.md +27 -0
- package/dist/layout/Card/docs/eg-links.md +12 -0
- package/dist/layout/Card/docs/eg-spans.md +12 -0
- package/dist/layout/Contents/Contents.stories.svelte +27 -0
- package/dist/{@types/layout/Contents/Contents.svelte.d.ts → layout/Contents/Contents.stories.svelte.d.ts} +2 -8
- package/dist/layout/Contents/Contents.svelte +42 -40
- package/dist/layout/Contents/Contents.svelte.d.ts +29 -0
- package/dist/layout/Contents/docs/component.md +18 -0
- package/dist/layout/DescriptionList/DescriptionList.stories.svelte +22 -0
- package/dist/layout/DescriptionList/DescriptionList.stories.svelte.d.ts +23 -0
- package/dist/layout/DescriptionList/DescriptionList.svelte +48 -0
- package/dist/layout/DescriptionList/DescriptionList.svelte.d.ts +27 -0
- package/dist/layout/DescriptionList/docs/component.md +18 -0
- package/dist/layout/Details/Details.stories.svelte +32 -0
- package/dist/layout/Details/Details.stories.svelte.d.ts +23 -0
- package/dist/layout/Details/Details.svelte +70 -0
- package/dist/layout/Details/Details.svelte.d.ts +35 -0
- package/dist/layout/Details/docs/component.md +14 -0
- package/dist/layout/DocumentList/Document.svelte +103 -0
- package/dist/layout/DocumentList/Document.svelte.d.ts +39 -0
- package/dist/layout/DocumentList/DocumentList.stories.svelte +73 -0
- package/dist/layout/DocumentList/DocumentList.stories.svelte.d.ts +23 -0
- package/dist/layout/DocumentList/DocumentList.svelte +17 -0
- package/dist/layout/DocumentList/DocumentList.svelte.d.ts +27 -0
- package/dist/layout/DocumentList/docs/component.md +28 -0
- package/dist/layout/DocumentList/docs/example.md +23 -0
- package/dist/layout/ErrorPage/ErrorPage.stories.svelte +18 -0
- package/dist/{@types/layout/ErrorPage/ErrorPage.svelte.d.ts → layout/ErrorPage/ErrorPage.stories.svelte.d.ts} +2 -6
- package/dist/layout/ErrorPage/ErrorPage.svelte +45 -40
- package/dist/layout/ErrorPage/ErrorPage.svelte.d.ts +29 -0
- package/dist/layout/ErrorPage/docs/component.md +13 -0
- package/dist/layout/Footer/Footer.stories.svelte +24 -0
- package/dist/{@types/layout/Footer/Footer.svelte.d.ts → layout/Footer/Footer.stories.svelte.d.ts} +4 -12
- package/dist/layout/Footer/Footer.svelte +372 -257
- package/dist/layout/Footer/Footer.svelte.d.ts +27 -0
- package/dist/layout/Footer/docs/component.md +10 -0
- package/dist/layout/Grid/Grid.stories.svelte +50 -0
- package/dist/layout/Grid/Grid.stories.svelte.d.ts +23 -0
- package/dist/layout/Grid/Grid.svelte +110 -160
- package/dist/layout/Grid/Grid.svelte.d.ts +49 -0
- package/dist/layout/Grid/GridCell.svelte +65 -0
- package/dist/layout/Grid/GridCell.svelte.d.ts +27 -0
- package/dist/layout/Grid/docs/component.md +14 -0
- package/dist/layout/Header/Header.stories.svelte +26 -0
- package/dist/{@types/layout/Header/Header.svelte.d.ts → layout/Header/Header.stories.svelte.d.ts} +4 -20
- package/dist/layout/Header/Header.svelte +842 -612
- package/dist/layout/Header/Header.svelte.d.ts +39 -0
- package/dist/layout/Header/docs/component.md +11 -0
- package/dist/layout/Hero/Hero.stories.svelte +77 -0
- package/dist/layout/Hero/Hero.stories.svelte.d.ts +23 -0
- package/dist/layout/Hero/Hero.svelte +350 -80
- package/dist/layout/Hero/Hero.svelte.d.ts +55 -0
- package/dist/layout/Hero/docs/component.md +14 -0
- package/dist/layout/Highlight/Highlight.stories.svelte +29 -0
- package/dist/layout/Highlight/Highlight.stories.svelte.d.ts +23 -0
- package/dist/layout/Highlight/Highlight.svelte +78 -66
- package/dist/layout/Highlight/Highlight.svelte.d.ts +45 -0
- package/dist/layout/Highlight/docs/component.md +12 -0
- package/dist/layout/Image/Image.stories.svelte +23 -0
- package/dist/layout/Image/Image.stories.svelte.d.ts +23 -0
- package/dist/layout/Image/Image.svelte +24 -0
- package/dist/layout/Image/Image.svelte.d.ts +27 -0
- package/dist/layout/Image/docs/component.md +15 -0
- package/dist/layout/List/Li.svelte +3 -0
- package/dist/layout/List/Li.svelte.d.ts +27 -0
- package/dist/layout/List/List.stories.svelte +40 -0
- package/dist/{@types/layout/List/List.svelte.d.ts → layout/List/List.stories.svelte.d.ts} +4 -8
- package/dist/layout/List/List.svelte +34 -25
- package/dist/layout/List/List.svelte.d.ts +29 -0
- package/dist/layout/List/docs/component.md +14 -0
- package/dist/layout/List/docs/example.md +12 -0
- package/dist/layout/NavSections/NavSection.svelte +66 -66
- package/dist/{@types/layout → layout}/NavSections/NavSection.svelte.d.ts +10 -10
- package/dist/layout/NavSections/NavSections.stories.svelte +48 -0
- package/dist/layout/NavSections/NavSections.stories.svelte.d.ts +23 -0
- package/dist/layout/NavSections/NavSections.svelte +135 -183
- package/dist/{@types/layout → layout}/NavSections/NavSections.svelte.d.ts +14 -24
- package/dist/layout/NavSections/docs/component.md +27 -0
- package/dist/layout/Notice/Notice.stories.svelte +61 -0
- package/dist/layout/Notice/Notice.stories.svelte.d.ts +23 -0
- package/dist/layout/Notice/Notice.svelte +45 -54
- package/dist/{@types/layout → layout}/Notice/Notice.svelte.d.ts +2 -6
- package/dist/layout/Notice/docs/component.md +14 -0
- package/dist/layout/PhaseBanner/PhaseBanner.stories.svelte +24 -0
- package/dist/{@types/layout/PhaseBanner/PhaseBanner.svelte.d.ts → layout/PhaseBanner/PhaseBanner.stories.svelte.d.ts} +2 -4
- package/dist/layout/PhaseBanner/PhaseBanner.svelte +56 -35
- package/dist/layout/PhaseBanner/PhaseBanner.svelte.d.ts +25 -0
- package/dist/layout/PhaseBanner/docs/component.md +14 -0
- package/dist/layout/RelatedContent/RelatedContent.stories.svelte +36 -0
- package/dist/{@types/layout/RelatedContent/RelatedContent.svelte.d.ts → layout/RelatedContent/RelatedContent.stories.svelte.d.ts} +2 -2
- package/dist/layout/RelatedContent/RelatedContent.svelte +44 -54
- package/dist/layout/RelatedContent/RelatedContent.svelte.d.ts +31 -0
- package/dist/layout/RelatedContent/docs/component.md +16 -0
- package/dist/layout/Scroller/Scroller.stories.svelte +61 -0
- package/dist/layout/Scroller/Scroller.stories.svelte.d.ts +23 -0
- package/dist/layout/Scroller/Scroller.svelte +341 -331
- package/dist/{@types/layout → layout}/Scroller/Scroller.svelte.d.ts +22 -20
- package/dist/layout/Scroller/ScrollerSection.svelte +54 -73
- package/dist/{@types/layout → layout}/Scroller/ScrollerSection.svelte.d.ts +6 -12
- package/dist/layout/Scroller/docs/component.md +41 -0
- package/dist/layout/Section/Section.stories.svelte +33 -0
- package/dist/layout/Section/Section.stories.svelte.d.ts +23 -0
- package/dist/layout/Section/Section.svelte +53 -77
- package/dist/layout/Section/Section.svelte.d.ts +41 -0
- package/dist/layout/Section/docs/component.md +12 -0
- package/dist/layout/ShareButtons/ShareButtons.stories.svelte +20 -0
- package/dist/layout/ShareButtons/ShareButtons.stories.svelte.d.ts +23 -0
- package/dist/layout/ShareButtons/ShareButtons.svelte +118 -175
- package/dist/{@types/layout → layout}/ShareButtons/ShareButtons.svelte.d.ts +6 -14
- package/dist/layout/ShareButtons/docs/component.md +14 -0
- package/dist/layout/SkipLink/SkipLink.stories.svelte +16 -0
- package/dist/{@types/layout/SkipLink/SkipLink.svelte.d.ts → layout/SkipLink/SkipLink.stories.svelte.d.ts} +2 -2
- package/dist/layout/SkipLink/SkipLink.svelte +6 -6
- package/dist/layout/SkipLink/SkipLink.svelte.d.ts +23 -0
- package/dist/layout/SkipLink/docs/component.md +11 -0
- package/dist/layout/Summary/Summary.stories.svelte +21 -0
- package/dist/{@types/layout/Summary/Summary.svelte.d.ts → layout/Summary/Summary.stories.svelte.d.ts} +2 -4
- package/dist/layout/Summary/Summary.svelte +50 -46
- package/dist/layout/Summary/Summary.svelte.d.ts +31 -0
- package/dist/layout/Summary/docs/component.md +17 -0
- package/dist/layout/Tabs/Tab.svelte +42 -42
- package/dist/{@types/layout → layout}/Tabs/Tab.svelte.d.ts +6 -6
- package/dist/layout/Tabs/Tabs.stories.svelte +29 -0
- package/dist/layout/Tabs/Tabs.stories.svelte.d.ts +23 -0
- package/dist/layout/Tabs/Tabs.svelte +71 -97
- package/dist/{@types/layout → layout}/Tabs/Tabs.svelte.d.ts +6 -6
- package/dist/layout/Tabs/docs/component.md +16 -0
- package/dist/layout/Tabs/tabs.d.ts +43 -0
- package/dist/layout/Tabs/tabs.js +302 -0
- package/dist/templates/EmbedArticle/EmbedArticle.stories.svelte +72 -0
- package/dist/templates/EmbedArticle/EmbedArticle.stories.svelte.d.ts +23 -0
- package/dist/templates/EmbedArticle/docs/component.md +56 -0
- package/dist/templates/FeatureArticle/FeatureArticle.stories.svelte +151 -0
- package/dist/templates/FeatureArticle/FeatureArticle.stories.svelte.d.ts +23 -0
- package/dist/templates/FeatureArticle/docs/component.md +125 -0
- package/dist/templates/StandardArticle/StandardArticle.stories.svelte +86 -0
- package/dist/templates/StandardArticle/StandardArticle.stories.svelte.d.ts +23 -0
- package/dist/templates/StandardArticle/docs/component.md +76 -0
- package/dist/templates/intro.mdx +19 -0
- package/dist/wrappers/Container/Container.stories.svelte +38 -0
- package/dist/wrappers/Container/Container.stories.svelte.d.ts +23 -0
- package/dist/wrappers/Container/Container.svelte +61 -140
- package/dist/wrappers/Container/Container.svelte.d.ts +39 -0
- package/dist/wrappers/Container/docs/component.md +10 -0
- package/dist/wrappers/Embed/Embed.stories.svelte +24 -0
- package/dist/wrappers/Embed/Embed.stories.svelte.d.ts +23 -0
- package/dist/wrappers/Embed/Embed.svelte +33 -32
- package/dist/{@types/wrappers → wrappers}/Embed/Embed.svelte.d.ts +4 -4
- package/dist/wrappers/Embed/docs/component.md +15 -0
- package/dist/wrappers/LazyLoad/LazyLoad.stories.svelte +37 -0
- package/dist/wrappers/LazyLoad/LazyLoad.stories.svelte.d.ts +23 -0
- package/dist/wrappers/LazyLoad/LazyLoad.svelte +34 -35
- package/dist/{@types/wrappers → wrappers}/LazyLoad/LazyLoad.svelte.d.ts +6 -6
- package/dist/wrappers/LazyLoad/docs/component.md +29 -0
- package/dist/wrappers/Main/Main.stories.svelte +24 -0
- package/dist/wrappers/Main/Main.stories.svelte.d.ts +23 -0
- package/dist/wrappers/Main/Main.svelte +10 -3
- package/dist/{@types/wrappers → wrappers}/Main/Main.svelte.d.ts +2 -4
- package/dist/wrappers/Main/docs/component.md +16 -0
- package/dist/wrappers/Observe/Observe.stories.svelte +29 -0
- package/dist/wrappers/Observe/Observe.stories.svelte.d.ts +23 -0
- package/dist/wrappers/Observe/Observe.svelte +24 -24
- package/dist/{@types/wrappers → wrappers}/Observe/Observe.svelte.d.ts +2 -2
- package/dist/wrappers/Observe/docs/component.md +22 -0
- package/dist/wrappers/Theme/Theme.stories.svelte +70 -0
- package/dist/{@types/wrappers/Theme/Theme.svelte.d.ts → wrappers/Theme/Theme.stories.svelte.d.ts} +4 -20
- package/dist/wrappers/Theme/Theme.svelte +64 -101
- package/dist/wrappers/Theme/Theme.svelte.d.ts +37 -0
- package/dist/wrappers/Theme/docs/component.md +10 -0
- package/dist/wrappers/Theme/themes.d.ts +143 -0
- package/dist/wrappers/Theme/themes.js +68 -27
- package/package.json +82 -195
- package/dist/@types/actions/cssVariables/index.d.ts +0 -4
- package/dist/@types/actions/resizeObserver/index.d.ts +0 -4
- package/dist/@types/inputs/AccessibleSelect/AccessibleSelect.svelte.d.ts +0 -58
- package/dist/@types/inputs/Button/Button.svelte.d.ts +0 -51
- package/dist/@types/inputs/Input/Input.svelte.d.ts +0 -51
- package/dist/@types/inputs/Select/Select.svelte.d.ts +0 -77
- package/dist/@types/js/docsPage.d.ts +0 -25
- package/dist/@types/layout/Backlink/Backlink.svelte.d.ts +0 -23
- package/dist/@types/layout/Cards/Card.svelte.d.ts +0 -49
- package/dist/@types/layout/Cards/Cards.svelte.d.ts +0 -51
- package/dist/@types/layout/Footer/ONSLogo.svelte.d.ts +0 -29
- package/dist/@types/layout/Grid/Grid.svelte.d.ts +0 -53
- package/dist/@types/layout/Header/ONSLogo.svelte.d.ts +0 -31
- package/dist/@types/layout/Hero/Hero.svelte.d.ts +0 -47
- package/dist/@types/layout/Highlight/Highlight.svelte.d.ts +0 -43
- package/dist/@types/layout/NavSections/SectionBacklink.svelte.d.ts +0 -23
- package/dist/@types/layout/Section/Section.svelte.d.ts +0 -47
- package/dist/@types/layout/Survey/Survey.svelte.d.ts +0 -23
- package/dist/@types/layout/Survey/init-survey.d.ts +0 -1
- package/dist/@types/layout/Titleblock/Meta.svelte.d.ts +0 -23
- package/dist/@types/layout/Titleblock/Titleblock.svelte.d.ts +0 -53
- package/dist/@types/layout/Twisty/Twisty.svelte.d.ts +0 -33
- package/dist/@types/wrappers/Container/Container.svelte.d.ts +0 -45
- package/dist/@types/wrappers/Theme/themes.d.ts +0 -29
- package/dist/actions/cssVariables/index.js +0 -20
- package/dist/actions/resizeObserver/index.js +0 -25
- package/dist/globals.d.ts +0 -23
- package/dist/inputs/AccessibleSelect/AccessibleSelect.svelte +0 -280
- package/dist/inputs/AccessibleSelect/options.js +0 -263
- package/dist/js/docsPage.js +0 -13
- package/dist/layout/Backlink/Backlink.svelte +0 -32
- package/dist/layout/Cards/Card.svelte +0 -99
- package/dist/layout/Cards/Cards.svelte +0 -95
- package/dist/layout/Footer/ONSLogo.svelte +0 -150
- package/dist/layout/Header/ONSLogo.svelte +0 -148
- package/dist/layout/NavSections/SectionBacklink.svelte +0 -31
- package/dist/layout/Survey/Survey.svelte +0 -96
- package/dist/layout/Survey/init-survey.js +0 -230
- package/dist/layout/Titleblock/Meta.svelte +0 -26
- package/dist/layout/Titleblock/Titleblock.svelte +0 -147
- package/dist/layout/Twisty/Twisty.svelte +0 -56
- /package/dist/{@types/datavis/shared → datavis/demo-data}/data-scatter.d.ts +0 -0
- /package/dist/datavis/{shared → demo-data}/data-scatter.js +0 -0
- /package/dist/{@types/datavis/shared → datavis/demo-data}/data.d.ts +0 -0
- /package/dist/datavis/{shared → demo-data}/data.js +0 -0
- /package/dist/{@types/inputs/AccessibleSelect/options.d.ts → js/menuOptions.d.ts} +0 -0
|
@@ -1,299 +1,281 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
3
|
-
import SelectInner from "svelte-select";
|
|
4
|
-
import { sleep } from "../../js/utils";
|
|
2
|
+
// @ts-nocheck
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
* Unique id for the element
|
|
8
|
-
* @type {string}
|
|
9
|
-
*/
|
|
10
|
-
export let id = "";
|
|
11
|
-
/**
|
|
12
|
-
* The mode can be either "default" or "search"
|
|
13
|
-
* @type {"default"|"search"}
|
|
14
|
-
*/
|
|
15
|
-
export let mode = "default";
|
|
16
|
-
/**
|
|
17
|
-
* Binding for the filter text entered
|
|
18
|
-
* @type {string}
|
|
19
|
-
*/
|
|
20
|
-
export let filterText = "";
|
|
21
|
-
/**
|
|
22
|
-
* Enable multi-select mode
|
|
23
|
-
* @type {boolean}
|
|
24
|
-
*/
|
|
25
|
-
export let multiple = false;
|
|
26
|
-
/**
|
|
27
|
-
* Set a limit on the number of items in multi-select mode
|
|
28
|
-
* @type {number}
|
|
29
|
-
*/
|
|
30
|
-
export let maxSelected = 4;
|
|
31
|
-
/**
|
|
32
|
-
* Defines whether the selection can be cleared
|
|
33
|
-
* @type {boolean}
|
|
34
|
-
*/
|
|
35
|
-
export let clearable = true;
|
|
36
|
-
/**
|
|
37
|
-
* Clear value on selection (default for "search" mode)
|
|
38
|
-
* @type {boolean}
|
|
39
|
-
*/
|
|
40
|
-
export let autoClear = mode === "search";
|
|
41
|
-
/**
|
|
42
|
-
* A label to describe the element (expected for accessibility)
|
|
43
|
-
* @type {string}
|
|
44
|
-
*/
|
|
45
|
-
export let label = "";
|
|
46
|
-
/**
|
|
47
|
-
* Visually hide the label
|
|
48
|
-
* @type {boolean}
|
|
49
|
-
*/
|
|
50
|
-
export let hideLabel = false;
|
|
51
|
-
/**
|
|
52
|
-
* An optional placeholder text
|
|
53
|
-
* @type {string}
|
|
54
|
-
*/
|
|
55
|
-
export let placeholder = "Select an option";
|
|
56
|
-
/**
|
|
57
|
-
* A prop to bind to for the selected value (will be an array for multi-select)
|
|
58
|
-
* @type {object}
|
|
59
|
-
*/
|
|
60
|
-
export let value = null;
|
|
61
|
-
/**
|
|
62
|
-
* An array of options, formatted {id, label}
|
|
63
|
-
* @type {array}
|
|
64
|
-
*/
|
|
65
|
-
export let options = [];
|
|
66
|
-
/**
|
|
67
|
-
* The attribute of an option that defines its ID
|
|
68
|
-
* @type {string}
|
|
69
|
-
*/
|
|
70
|
-
export let idKey = "id";
|
|
71
|
-
/**
|
|
72
|
-
* The attribute of an option that defines its label/name
|
|
73
|
-
* @type {string}
|
|
74
|
-
*/
|
|
75
|
-
export let labelKey = "label";
|
|
76
|
-
/**
|
|
77
|
-
* The attribute of an option that defines its group (optional)
|
|
78
|
-
* @type {string|null}
|
|
79
|
-
*/
|
|
80
|
-
export let groupKey = null;
|
|
81
|
-
/**
|
|
82
|
-
* Cluster results by group. If {false}, the group name will be the suffix
|
|
83
|
-
* @type {boolean}
|
|
84
|
-
*/
|
|
85
|
-
export let clusterByGroup = false;
|
|
86
|
-
/**
|
|
87
|
-
* Defines the width of the input in characters
|
|
88
|
-
* @type {number}
|
|
89
|
-
*/
|
|
90
|
-
export let width = 30;
|
|
91
|
-
/**
|
|
92
|
-
* Hide the icon in the search box
|
|
93
|
-
* @type {boolean}
|
|
94
|
-
*/
|
|
95
|
-
export let hideIcon = false;
|
|
96
|
-
/**
|
|
97
|
-
* An array of colours for multi-select
|
|
98
|
-
* @type {array}
|
|
99
|
-
*/
|
|
100
|
-
export let colors = [
|
|
101
|
-
"#206095",
|
|
102
|
-
"#a8bd3a",
|
|
103
|
-
"#871a5b",
|
|
104
|
-
"#27a0cc",
|
|
105
|
-
"rgb(0, 60, 87)",
|
|
106
|
-
"rgb(116, 108, 177)",
|
|
107
|
-
"rgb(246, 96, 104)",
|
|
108
|
-
"rgb(0, 163, 166)",
|
|
109
|
-
];
|
|
110
|
-
/**
|
|
111
|
-
* A function to filter items based on the entered text
|
|
112
|
-
* @type {function}
|
|
113
|
-
*/
|
|
114
|
-
export let itemFilter = (label, filterText, option) =>
|
|
115
|
-
label.match(new RegExp(`\\b${filterText.replace(/[^\w\s]/gi, "")}`, "i")) &&
|
|
116
|
-
!(multiple && value?.length >= maxSelected) &&
|
|
117
|
-
!(mode === "search" && filterText?.length < 3);
|
|
118
|
-
/**
|
|
119
|
-
* An optional function to load options based on the entered text
|
|
120
|
-
* @type {function}
|
|
121
|
-
*/
|
|
122
|
-
export let loadOptions = null;
|
|
123
|
-
/**
|
|
124
|
-
* Optional params for positioning the dropdown
|
|
125
|
-
* @type {object} floatingConfig
|
|
126
|
-
*/
|
|
127
|
-
export let floatingConfig = {};
|
|
4
|
+
import { onMount, createEventDispatcher } from "svelte";
|
|
128
5
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
: mode === "search" && filterText.length < 3
|
|
134
|
-
? "Enter 3 or more characters to see options"
|
|
135
|
-
: filterText
|
|
136
|
-
? `No options match <b>${filterText}</b>`
|
|
137
|
-
: "No options available";
|
|
6
|
+
const dispatch = createEventDispatcher();
|
|
7
|
+
const sleep = (ms = 1000) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
8
|
+
const chevron = (opts) =>
|
|
9
|
+
`<svg class="${opts?.className}" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 11.75 7.7" width="18" style="z-index:1"><path fill="currentColor" d="m1.37.15 4.5 5.1 4.5-5.1a.37.37 0 0 1 .6 0l.7.7a.45.45 0 0 1 0 .5l-5.5 6.2a.37.37 0 0 1-.6 0l-5.5-6.1a.64.64 0 0 1 0-.6l.7-.7a.64.64 0 0 1 .6 0Z"></path></svg>`;
|
|
138
10
|
|
|
139
|
-
|
|
11
|
+
let inputElement;
|
|
12
|
+
let scriptLoaded;
|
|
13
|
+
let accessibleAutocomplete;
|
|
14
|
+
let hideMenu = false;
|
|
140
15
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Unique id for the element
|
|
18
|
+
* @type {string}
|
|
19
|
+
*/
|
|
20
|
+
export let id = "autocomplete";
|
|
21
|
+
/**
|
|
22
|
+
* The mode can be either "default" or "search"
|
|
23
|
+
* @type {"default"|"search"}
|
|
24
|
+
*/
|
|
25
|
+
export let mode = "default";
|
|
26
|
+
/**
|
|
27
|
+
* Defines whether the selection can be cleared
|
|
28
|
+
* @type {boolean}
|
|
29
|
+
*/
|
|
30
|
+
export let clearable = mode !== "search";
|
|
31
|
+
/**
|
|
32
|
+
* Clear value on selection (default for "search" mode)
|
|
33
|
+
* @type {boolean}
|
|
34
|
+
*/
|
|
35
|
+
export let autoClear = mode === "search";
|
|
36
|
+
/**
|
|
37
|
+
* A label to describe the element (expected for accessibility)
|
|
38
|
+
* @type {string}
|
|
39
|
+
*/
|
|
40
|
+
export let label = mode === "search" ? "Type to select" : "Select an option";
|
|
41
|
+
/**
|
|
42
|
+
* Visually hide the label
|
|
43
|
+
* @type {boolean}
|
|
44
|
+
*/
|
|
45
|
+
export let hideLabel = false;
|
|
46
|
+
/**
|
|
47
|
+
* An optional placeholder text
|
|
48
|
+
* @type {string}
|
|
49
|
+
*/
|
|
50
|
+
export let placeholder = mode === "search" ? "Enter text" : "Select one";
|
|
51
|
+
/**
|
|
52
|
+
* A prop to bind to for the selected value
|
|
53
|
+
* @type {object}
|
|
54
|
+
*/
|
|
55
|
+
export let value = null;
|
|
56
|
+
/**
|
|
57
|
+
* An array of options, formatted {id, label}
|
|
58
|
+
* @type {array}
|
|
59
|
+
*/
|
|
60
|
+
export let options = [];
|
|
61
|
+
/**
|
|
62
|
+
* The attribute of an option that defines its label/name
|
|
63
|
+
* @type {string}
|
|
64
|
+
*/
|
|
65
|
+
export let labelKey = "label";
|
|
66
|
+
/**
|
|
67
|
+
* The attribute of an option that defines its group (optional)
|
|
68
|
+
* @type {string}
|
|
69
|
+
*/
|
|
70
|
+
export let groupKey = "";
|
|
71
|
+
/**
|
|
72
|
+
* Optional: Minimum query length to return results
|
|
73
|
+
* @type {number}
|
|
74
|
+
*/
|
|
75
|
+
export let minLength = mode === "search" ? 1 : 0;
|
|
76
|
+
/**
|
|
77
|
+
* Optional: Override function for loading/filtering options based on the entered text
|
|
78
|
+
* @type {function}
|
|
79
|
+
*/
|
|
80
|
+
export let loadOptions = (query, populateResults) => {
|
|
81
|
+
const filteredResults =
|
|
82
|
+
mode !== "search" && options.map((opt) => opt[labelKey]).includes(query)
|
|
83
|
+
? options
|
|
84
|
+
: options.filter((opt) =>
|
|
85
|
+
opt[labelKey].match(new RegExp(`\\b${query.replace(/[^\w\s]/gi, "")}`, "i"))
|
|
86
|
+
);
|
|
87
|
+
populateResults(filteredResults);
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Optional: Override the default CDN URL for the accessible-autocomplete script
|
|
91
|
+
* @type {string}
|
|
92
|
+
*/
|
|
93
|
+
export let scriptUrl =
|
|
94
|
+
"https://cdn.ons.gov.uk/vendor/accessible-autocomplete/3.0.1/accessible-autocomplete.min.js";
|
|
95
|
+
|
|
96
|
+
// This clearing method is a bit of a hack, but no better options available at present
|
|
97
|
+
// https://github.com/alphagov/accessible-autocomplete/issues/390
|
|
98
|
+
/**
|
|
99
|
+
* Call this function externally to clear the input
|
|
100
|
+
* @type {function}
|
|
101
|
+
*/
|
|
102
|
+
export async function clearInput() {
|
|
103
|
+
hideMenu = true;
|
|
104
|
+
inputElement.value = "";
|
|
105
|
+
await sleep(110);
|
|
106
|
+
inputElement.focus({ preventScroll: true });
|
|
107
|
+
inputElement.blur();
|
|
108
|
+
hideMenu = false;
|
|
109
|
+
dispatch("clear", value);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function inputValueTemplate(result) {
|
|
113
|
+
return result && result[labelKey];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function highlight(text, query = "") {
|
|
117
|
+
return text.replace(
|
|
118
|
+
new RegExp(`\\b${query.replace(/[^\w\s]/gi, "")}`, "i"),
|
|
119
|
+
(str) => `<b>${str}</b>`
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function suggestionTemplate(result) {
|
|
124
|
+
const query = inputElement?.value || "";
|
|
125
|
+
return (
|
|
126
|
+
result &&
|
|
127
|
+
(groupKey
|
|
128
|
+
? `${highlight(result?.[labelKey] || "", query)} <span class="muted-text">${
|
|
129
|
+
result[groupKey]
|
|
130
|
+
}</span>`
|
|
131
|
+
: highlight(result?.[labelKey] || "", query))
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async function select(option) {
|
|
136
|
+
value = option;
|
|
137
|
+
dispatch("change", value);
|
|
138
|
+
if (value && autoClear) {
|
|
139
|
+
await sleep(0);
|
|
140
|
+
clearInput();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function inputChange(e) {
|
|
145
|
+
if (!e.target.value) select(null);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function handleScriptLoad() {
|
|
149
|
+
if (!scriptLoaded && window?.accessibleAutocomplete) {
|
|
150
|
+
accessibleAutocomplete = window.accessibleAutocomplete;
|
|
151
|
+
scriptLoaded = true;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function initAutocomplete(element) {
|
|
156
|
+
accessibleAutocomplete({
|
|
157
|
+
element,
|
|
158
|
+
id,
|
|
159
|
+
name: `${id}-input`,
|
|
160
|
+
source: loadOptions,
|
|
161
|
+
defaultValue: value?.[labelKey] || "",
|
|
162
|
+
autoselect: true,
|
|
163
|
+
onConfirm: select,
|
|
164
|
+
confirmOnBlur: false,
|
|
165
|
+
placeholder,
|
|
166
|
+
displayMenu: "overlay",
|
|
167
|
+
showAllValues: mode === "default",
|
|
168
|
+
dropdownArrow: chevron,
|
|
169
|
+
minLength,
|
|
170
|
+
templates: {
|
|
171
|
+
inputValue: inputValueTemplate,
|
|
172
|
+
suggestion: suggestionTemplate
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
inputElement = document.getElementById(id);
|
|
176
|
+
inputElement.addEventListener("blur", inputChange);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
onMount(handleScriptLoad);
|
|
148
180
|
</script>
|
|
149
181
|
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
</div>
|
|
183
|
-
<div slot="empty">{@html noOptionsMessage}</div>
|
|
184
|
-
<div slot="chevron-icon" style:transform="{mode === "search" ? "translateY(2px)" : null}">
|
|
185
|
-
{#if mode === "search"}
|
|
186
|
-
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 12 12" width="20">
|
|
187
|
-
<path
|
|
188
|
-
fill="currentColor"
|
|
189
|
-
d="M11.86 10.23 8.62 6.99a4.63 4.63 0 1 0-6.34 1.64 4.55 4.55 0 0 0 2.36.64 4.65 4.65 0 0 0 2.33-.65l3.24 3.23a.46.46 0 0 0 .65 0l1-1a.48.48 0 0 0 0-.62Zm-5-3.32a3.28 3.28 0 0 1-2.31.93 3.22 3.22 0 1 1 2.35-.93Z"
|
|
190
|
-
></path>
|
|
191
|
-
</svg>
|
|
192
|
-
{:else}
|
|
193
|
-
<svg
|
|
194
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
195
|
-
aria-hidden="true"
|
|
196
|
-
viewBox="0 0 11.75 7.7"
|
|
197
|
-
width="18"
|
|
198
|
-
>
|
|
199
|
-
<path
|
|
200
|
-
fill="currentColor"
|
|
201
|
-
d="m1.37.15 4.5 5.1 4.5-5.1a.37.37 0 0 1 .6 0l.7.7a.45.45 0 0 1 0 .5l-5.5 6.2a.37.37 0 0 1-.6 0l-5.5-6.1a.64.64 0 0 1 0-.6l.7-.7a.64.64 0 0 1 .6 0Z"
|
|
202
|
-
></path>
|
|
203
|
-
</svg>
|
|
204
|
-
{/if}
|
|
205
|
-
</div>
|
|
206
|
-
<div slot="clear-icon" style:transform="translateY(2px)" aria-label="Clear search">
|
|
207
|
-
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 14 14" width="18">
|
|
208
|
-
<path
|
|
209
|
-
fill="currentColor"
|
|
210
|
-
d="M13.6 1 l -0.71 -0.71 a 0.5 0.5 0 0 0 -0.71 0 l -5.25 5.25 l -5.25 -5.25 a 0.51 0.51 0 0 0 -0.71 0 l -0.71 0.71 a 0.5 0.5 0 0 0 0 0.71 l 5.25 5.25 l -5.25 5.25 a 0.5 0.5 0 0 0 0 0.71 l 0.71 0.71 a 0.5 0.5 0 0 0 0.71 0 l 5.25 -5.25 l 5.25 5.25 a 0.5 0.5 0 0 0 0.71 0 l 0.71 -0.71 a 0.5 0.5 0 0 0 0 -0.71 l -5.25 -5.25 l 5.25 -5.25 a 0.5 0.5 0 0 0 0 -0.71Z"
|
|
211
|
-
></path>
|
|
212
|
-
</svg>
|
|
213
|
-
</div>
|
|
214
|
-
</SelectInner>
|
|
215
|
-
</div>
|
|
182
|
+
<svelte:head>
|
|
183
|
+
<script src={scriptUrl} on:load={handleScriptLoad}></script>
|
|
184
|
+
</svelte:head>
|
|
185
|
+
|
|
186
|
+
<div class="ons-field">
|
|
187
|
+
{#if label}<label for={id} class="ons-label" class:ons-u-vh={hideLabel}>{label}</label>{/if}
|
|
188
|
+
<div class="ons-autocomplete-wrapper">
|
|
189
|
+
{#if scriptLoaded}
|
|
190
|
+
<div
|
|
191
|
+
id="{id}-container"
|
|
192
|
+
class="ons-autocomplete"
|
|
193
|
+
class:hide-menu={hideMenu}
|
|
194
|
+
use:initAutocomplete
|
|
195
|
+
></div>
|
|
196
|
+
{#if clearable && !autoClear && value}
|
|
197
|
+
<button
|
|
198
|
+
type="reset"
|
|
199
|
+
title="Clear selection"
|
|
200
|
+
aria-label="Clear selection"
|
|
201
|
+
on:click={clearInput}
|
|
202
|
+
class="ons-autocomplete-clear"
|
|
203
|
+
>
|
|
204
|
+
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 14 14" width="18">
|
|
205
|
+
<path
|
|
206
|
+
fill="currentColor"
|
|
207
|
+
d="M13.6 1 l -0.71 -0.71 a 0.5 0.5 0 0 0 -0.71 0 l -5.25 5.25 l -5.25 -5.25 a 0.51 0.51 0 0 0 -0.71 0 l -0.71 0.71 a 0.5 0.5 0 0 0 0 0.71 l 5.25 5.25 l -5.25 5.25 a 0.5 0.5 0 0 0 0 0.71 l 0.71 0.71 a 0.5 0.5 0 0 0 0.71 0 l 5.25 -5.25 l 5.25 5.25 a 0.5 0.5 0 0 0 0.71 0 l 0.71 -0.71 a 0.5 0.5 0 0 0 0 -0.71 l -5.25 -5.25 l 5.25 -5.25 a 0.5 0.5 0 0 0 0 -0.71Z"
|
|
208
|
+
></path>
|
|
209
|
+
</svg>
|
|
210
|
+
</button>
|
|
211
|
+
{/if}
|
|
212
|
+
{/if}
|
|
213
|
+
</div>
|
|
216
214
|
</div>
|
|
217
215
|
|
|
218
216
|
<style>
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
:global(.ons-themed-select .multi-item:nth-of-type(6)) {
|
|
285
|
-
background-color: var(--item2, #ebedef) !important;
|
|
286
|
-
}
|
|
287
|
-
:global(.ons-themed-select .multi-item:nth-of-type(7)) {
|
|
288
|
-
background-color: var(--item3, #ebedef) !important;
|
|
289
|
-
}
|
|
290
|
-
:global(.ons-themed-select .multi-item:nth-of-type(8)) {
|
|
291
|
-
background-color: var(--item4, #ebedef) !important;
|
|
292
|
-
}
|
|
293
|
-
.ons-field {
|
|
294
|
-
overflow: visible;
|
|
295
|
-
}
|
|
296
|
-
span.item-group {
|
|
297
|
-
font-size: smaller;
|
|
298
|
-
opacity: 0.7;
|
|
299
|
-
}</style>
|
|
217
|
+
.ons-autocomplete-wrapper {
|
|
218
|
+
position: relative;
|
|
219
|
+
}
|
|
220
|
+
.ons-autocomplete-clear {
|
|
221
|
+
position: absolute;
|
|
222
|
+
display: flex;
|
|
223
|
+
align-items: center;
|
|
224
|
+
align-content: center;
|
|
225
|
+
z-index: 1;
|
|
226
|
+
right: 3px;
|
|
227
|
+
top: calc(50% - 14px);
|
|
228
|
+
height: 28px;
|
|
229
|
+
width: 28px;
|
|
230
|
+
border: none;
|
|
231
|
+
background: var(--ons-color-input-bg, white);
|
|
232
|
+
}
|
|
233
|
+
.ons-autocomplete-clear:focus {
|
|
234
|
+
outline: 3px solid var(--ons-color-focus, #fbc900) !important;
|
|
235
|
+
}
|
|
236
|
+
.hide-menu :global(.autocomplete__menu) {
|
|
237
|
+
display: none;
|
|
238
|
+
}
|
|
239
|
+
.ons-autocomplete :global(.autocomplete__input) {
|
|
240
|
+
border-radius: 3px !important;
|
|
241
|
+
border-width: 1px !important;
|
|
242
|
+
background: var(--ons-color-input-bg, white);
|
|
243
|
+
}
|
|
244
|
+
.ons-autocomplete :global(.autocomplete__input--focused) {
|
|
245
|
+
box-shadow: inset 0 0 0 1px black !important;
|
|
246
|
+
outline-color: var(--ons-color-focus, #fbc900) !important;
|
|
247
|
+
}
|
|
248
|
+
.ons-autocomplete :global(.autocomplete__dropdown-arrow-down) {
|
|
249
|
+
width: 18px !important;
|
|
250
|
+
transform: translateY(-2px);
|
|
251
|
+
}
|
|
252
|
+
.ons-autocomplete :global(.muted-text) {
|
|
253
|
+
opacity: 0.8;
|
|
254
|
+
font-size: smaller;
|
|
255
|
+
}
|
|
256
|
+
.ons-autocomplete-wrapper :global(*) {
|
|
257
|
+
font-size: 18px;
|
|
258
|
+
}
|
|
259
|
+
.ons-autocomplete-wrapper :global(.autocomplete__hint),
|
|
260
|
+
.ons-autocomplete-wrapper :global(.autocomplete__input) {
|
|
261
|
+
height: 40px;
|
|
262
|
+
}
|
|
263
|
+
.ons-autocomplete-wrapper :global(.autocomplete__option) {
|
|
264
|
+
margin: 0;
|
|
265
|
+
}
|
|
266
|
+
.ons-autocomplete-wrapper :global(.autocomplete__menu) {
|
|
267
|
+
transform: translateY(5px);
|
|
268
|
+
border: 1px solid currentColor;
|
|
269
|
+
border-radius: 3px;
|
|
270
|
+
}
|
|
271
|
+
.ons-autocomplete-wrapper :global(.autocomplete__option--focused),
|
|
272
|
+
.ons-autocomplete-wrapper :global(.autocomplete__option:hover) {
|
|
273
|
+
background-color: var(--ons-color-branded-secondary, #003c57);
|
|
274
|
+
}
|
|
275
|
+
.ons-autocomplete-wrapper :global(.autocomplete__option:focus) {
|
|
276
|
+
outline: none !important;
|
|
277
|
+
}
|
|
278
|
+
.ons-autocomplete-wrapper :global(input) {
|
|
279
|
+
padding: 0 35px 0 8px;
|
|
280
|
+
}
|
|
281
|
+
</style>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} SelectProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} SelectEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} SelectSlots */
|
|
4
|
+
export default class Select extends SvelteComponentTyped<{
|
|
5
|
+
id?: string | undefined;
|
|
6
|
+
label?: string | undefined;
|
|
7
|
+
mode?: "default" | "search" | undefined;
|
|
8
|
+
value?: object | undefined;
|
|
9
|
+
hideLabel?: boolean | undefined;
|
|
10
|
+
placeholder?: string | undefined;
|
|
11
|
+
options?: array;
|
|
12
|
+
clearable?: boolean | undefined;
|
|
13
|
+
autoClear?: boolean | undefined;
|
|
14
|
+
labelKey?: string | undefined;
|
|
15
|
+
groupKey?: string | undefined;
|
|
16
|
+
minLength?: number | undefined;
|
|
17
|
+
loadOptions?: Function | undefined;
|
|
18
|
+
scriptUrl?: string | undefined;
|
|
19
|
+
clearInput?: (() => Promise<void>) | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
clear: CustomEvent<any>;
|
|
22
|
+
change: CustomEvent<any>;
|
|
23
|
+
} & {
|
|
24
|
+
[evt: string]: CustomEvent<any>;
|
|
25
|
+
}, {}> {
|
|
26
|
+
get clearInput(): () => Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export type SelectProps = typeof __propDef.props;
|
|
29
|
+
export type SelectEvents = typeof __propDef.events;
|
|
30
|
+
export type SelectSlots = typeof __propDef.slots;
|
|
31
|
+
import { SvelteComponentTyped } from "svelte";
|
|
32
|
+
declare const __propDef: {
|
|
33
|
+
props: {
|
|
34
|
+
id?: string | undefined;
|
|
35
|
+
label?: string | undefined;
|
|
36
|
+
mode?: "default" | "search" | undefined;
|
|
37
|
+
value?: object | undefined;
|
|
38
|
+
hideLabel?: boolean | undefined;
|
|
39
|
+
placeholder?: string | undefined;
|
|
40
|
+
options?: array;
|
|
41
|
+
clearable?: boolean | undefined;
|
|
42
|
+
autoClear?: boolean | undefined;
|
|
43
|
+
labelKey?: string | undefined;
|
|
44
|
+
groupKey?: string | undefined;
|
|
45
|
+
minLength?: number | undefined;
|
|
46
|
+
loadOptions?: Function | undefined;
|
|
47
|
+
scriptUrl?: string | undefined;
|
|
48
|
+
clearInput?: (() => Promise<void>) | undefined;
|
|
49
|
+
};
|
|
50
|
+
events: {
|
|
51
|
+
clear: CustomEvent<any>;
|
|
52
|
+
change: CustomEvent<any>;
|
|
53
|
+
} & {
|
|
54
|
+
[evt: string]: CustomEvent<any>;
|
|
55
|
+
};
|
|
56
|
+
slots: {};
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
An extended alternative to an HTML `<select>` component (see Dropdown), with auto-complete and the ability to have a custom **loadOptions** function.
|
|
2
|
+
|
|
3
|
+
This component is a Svelte wrapper for the GOV.UK [accessible-autocomplete](https://github.com/alphagov/accessible-autocomplete).
|
|
4
|
+
|
|
5
|
+
(Note: This component is not fully compatible with a previous version of the same component based on svelte-select.)
|
|
6
|
+
|
|
7
|
+
<!-- prettier-ignore -->
|
|
8
|
+
```html
|
|
9
|
+
<script>
|
|
10
|
+
import { AccessibleSelect } from "@onsvisual/svelte-components";
|
|
11
|
+
|
|
12
|
+
const values = [
|
|
13
|
+
{ id: "1", label: "one" },
|
|
14
|
+
{ id: "2", label: "two" },
|
|
15
|
+
{ id: "3", label: "three" },
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
// Bind the <select> value to a variable (reactive)
|
|
20
|
+
let value;
|
|
21
|
+
|
|
22
|
+
// Define your own function on change
|
|
23
|
+
const handleChange = (e) => console.log(e);
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<AccessibleSelect {options} bind:value on:change="{handleChange}" />
|
|
27
|
+
```
|