@scania/tegel 0.0.1-beta.3 → 0.0.1-beta.4
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/cjs/index-e1c79686.js +1912 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/popper-11d5f714.js +1801 -0
- package/dist/cjs/sdds-accordion-item.cjs.entry.js +34 -0
- package/dist/cjs/sdds-accordion.cjs.entry.js +21 -0
- package/dist/cjs/sdds-badges.cjs.entry.js +55 -0
- package/dist/cjs/sdds-body-cell_2.cjs.entry.js +173 -0
- package/dist/cjs/sdds-button.cjs.entry.js +36 -0
- package/dist/cjs/sdds-datetime.cjs.entry.js +66 -0
- package/dist/cjs/sdds-dropdown-filter.cjs.entry.js +92 -0
- package/dist/cjs/sdds-dropdown_2.cjs.entry.js +335 -0
- package/dist/cjs/sdds-header-cell.cjs.entry.js +141 -0
- package/dist/cjs/sdds-icon.cjs.entry.js +42 -0
- package/dist/cjs/sdds-inline-tabs-fullbleed.cjs.entry.js +96 -0
- package/dist/cjs/sdds-inline-tabs.cjs.entry.js +211 -0
- package/dist/cjs/sdds-modal.cjs.entry.js +49 -0
- package/dist/cjs/sdds-navigation-tabs.cjs.entry.js +95 -0
- package/dist/cjs/sdds-popover-canvas.cjs.entry.js +76 -0
- package/dist/cjs/sdds-popover-menu.cjs.entry.js +75 -0
- package/dist/cjs/sdds-slider.cjs.entry.js +336 -0
- package/dist/cjs/sdds-spinner.cjs.entry.js +21 -0
- package/dist/cjs/sdds-table-body-row-expandable.cjs.entry.js +81 -0
- package/dist/cjs/sdds-table-body.cjs.entry.js +289 -0
- package/dist/cjs/sdds-table-footer.cjs.entry.js +165 -0
- package/dist/cjs/sdds-table-header.cjs.entry.js +100 -0
- package/dist/cjs/sdds-table-toolbar.cjs.entry.js +66 -0
- package/dist/cjs/sdds-table.cjs.entry.js +69 -0
- package/dist/cjs/sdds-textarea.cjs.entry.js +61 -0
- package/dist/cjs/sdds-textfield.cjs.entry.js +82 -0
- package/dist/cjs/sdds-tooltip.cjs.entry.js +95 -0
- package/dist/cjs/tegel.cjs.js +19 -0
- package/dist/collection/collection-manifest.json +40 -0
- package/dist/collection/components/accordion/accordion-item/accordion-item.css +134 -0
- package/dist/collection/components/accordion/accordion-item/accordion-item.js +146 -0
- package/dist/collection/components/accordion/accordion.css +77 -0
- package/dist/collection/components/accordion/accordion.js +62 -0
- package/dist/collection/components/accordion/accordion.stories.js +91 -0
- package/dist/collection/components/badge/badge.stories.js +101 -0
- package/dist/collection/components/badge/badges.css +42 -0
- package/dist/collection/components/badge/badges.js +150 -0
- package/dist/collection/components/banner/banner.stories.js +93 -0
- package/dist/collection/components/block/block.stories.js +46 -0
- package/dist/collection/components/breadcrumb/breadcrumb.stories.js +26 -0
- package/dist/collection/components/button/button-component.js +154 -0
- package/dist/collection/components/button/button-native.stories.js +183 -0
- package/dist/collection/components/button/button-webcomponent.stories.js +182 -0
- package/dist/collection/components/button/button.css +658 -0
- package/dist/collection/components/card/card.stories.js +181 -0
- package/dist/collection/components/checkbox/checkbox.stories.js +54 -0
- package/dist/collection/components/chips/chips.stories.js +124 -0
- package/dist/collection/components/data-table/native-table.stories.js +182 -0
- package/dist/collection/components/data-table/table/table.css +15 -0
- package/dist/collection/components/data-table/table/table.js +253 -0
- package/dist/collection/components/data-table/table-body/table-body.css +22 -0
- package/dist/collection/components/data-table/table-body/table-body.js +425 -0
- package/dist/collection/components/data-table/table-body-cell/table-body-cell.css +40 -0
- package/dist/collection/components/data-table/table-body-cell/table-body-cell.js +169 -0
- package/dist/collection/components/data-table/table-body-row/table-body-row.css +196 -0
- package/dist/collection/components/data-table/table-body-row/table-body-row.js +164 -0
- package/dist/collection/components/data-table/table-body-row-expandable/table-body-row-expandable.css +79 -0
- package/dist/collection/components/data-table/table-body-row-expandable/table-body-row-expandable.js +155 -0
- package/dist/collection/components/data-table/table-component-basic.stories.js +163 -0
- package/dist/collection/components/data-table/table-component-batch-actions.stories.js +129 -0
- package/dist/collection/components/data-table/table-component-bodydata.stories.js +58 -0
- package/dist/collection/components/data-table/table-component-custom-width.stories.js +198 -0
- package/dist/collection/components/data-table/table-component-event-listeners.stories.js +153 -0
- package/dist/collection/components/data-table/table-component-expandable-rows.stories.js +137 -0
- package/dist/collection/components/data-table/table-component-filtering.stories.js +139 -0
- package/dist/collection/components/data-table/table-component-multiselect.stories.js +160 -0
- package/dist/collection/components/data-table/table-component-pagination.stories.js +129 -0
- package/dist/collection/components/data-table/table-component-sorting.stories.js +107 -0
- package/dist/collection/components/data-table/table-footer/table-footer.css +93 -0
- package/dist/collection/components/data-table/table-footer/table-footer.js +355 -0
- package/dist/collection/components/data-table/table-header/table-header.css +204 -0
- package/dist/collection/components/data-table/table-header/table-header.js +153 -0
- package/dist/collection/components/data-table/table-header-cell/table-header-cell.css +126 -0
- package/dist/collection/components/data-table/table-header-cell/table-header-cell.js +320 -0
- package/dist/collection/components/data-table/table-toolbar/table-toolbar.css +92 -0
- package/dist/collection/components/data-table/table-toolbar/table-toolbar.js +142 -0
- package/dist/collection/components/datetime/datetime.css +375 -0
- package/dist/collection/components/datetime/datetime.js +251 -0
- package/dist/collection/components/datetime/datetime.stories.js +149 -0
- package/dist/collection/components/divider/divider.stories.js +116 -0
- package/dist/collection/components/dropdown/dropdown-filter/dropdown-filter.js +339 -0
- package/dist/collection/components/dropdown/dropdown-filter/dropdown-filter.stories.js +130 -0
- package/dist/collection/components/dropdown/dropdown-native.stories.js +90 -0
- package/dist/collection/components/dropdown/dropdown-option/dropdown-option.js +185 -0
- package/dist/collection/components/dropdown/dropdown-wc-default.stories.js +151 -0
- package/dist/collection/components/dropdown/dropdown-wc-multiselect.stories.js +146 -0
- package/dist/collection/components/dropdown/dropdown.css +891 -0
- package/dist/collection/components/dropdown/dropdown.js +554 -0
- package/dist/collection/components/footer/footer.stories.js +100 -0
- package/dist/collection/components/header/header-all.stories.js +217 -0
- package/dist/collection/components/header/header-default.stories.js +47 -0
- package/dist/collection/components/header/header-inline.stories.js +113 -0
- package/dist/collection/components/header/header-search.stories.js +263 -0
- package/dist/collection/components/header/header-toolbar.stories.js +204 -0
- package/dist/collection/components/icon/icon-font.stories.js +57 -0
- package/dist/collection/components/icon/icon-web-component.stories.js +51 -0
- package/dist/collection/components/icon/icon.css +16 -0
- package/dist/collection/components/icon/icon.js +89 -0
- package/dist/collection/components/icon/iconsArray.js +2 -0
- package/dist/collection/components/link/link.stories.js +45 -0
- package/dist/collection/components/message/message.stories.js +117 -0
- package/dist/collection/components/modal/modal-native.stories.js +121 -0
- package/dist/collection/components/modal/modal-webcomponent.stories.js +78 -0
- package/dist/collection/components/modal/modal.css +324 -0
- package/dist/collection/components/modal/modal.js +146 -0
- package/dist/collection/components/popover-canvas/popover-canvas.css +20 -0
- package/dist/collection/components/popover-canvas/popover-canvas.js +190 -0
- package/dist/collection/components/popover-canvas/popover-canvas.stories.js +87 -0
- package/dist/collection/components/popover-menu/popover-menu-icons.stories.js +132 -0
- package/dist/collection/components/popover-menu/popover-menu.css +19 -0
- package/dist/collection/components/popover-menu/popover-menu.js +189 -0
- package/dist/collection/components/popover-menu/popover-menu.stories.js +109 -0
- package/dist/collection/components/radio-button/radio-button.stories.js +68 -0
- package/dist/collection/components/side-menu/side-menu.stories.js +182 -0
- package/dist/collection/components/slider/slider.css +260 -0
- package/dist/collection/components/slider/slider.js +682 -0
- package/dist/collection/components/slider/slider.stories.js +251 -0
- package/dist/collection/components/spinner/spinner.css +79 -0
- package/dist/collection/components/spinner/spinner.js +61 -0
- package/dist/collection/components/spinner/spinner.stories.js +59 -0
- package/dist/collection/components/stepper/stepper.stories.js +139 -0
- package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.css +159 -0
- package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.js +302 -0
- package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.stories.js +65 -0
- package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.css +172 -0
- package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.js +126 -0
- package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.stories.js +43 -0
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.css +153 -0
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.js +103 -0
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.stories.js +32 -0
- package/dist/collection/components/textarea/textarea.css +283 -0
- package/dist/collection/components/textarea/textarea.js +336 -0
- package/dist/collection/components/textarea/textarea.stories.js +149 -0
- package/dist/collection/components/textfield/textfield.css +494 -0
- package/dist/collection/components/textfield/textfield.js +359 -0
- package/dist/collection/components/textfield/textfield.stories.js +222 -0
- package/dist/collection/components/toast/toast.stories.js +119 -0
- package/dist/collection/components/toggle/toggle.stories.js +62 -0
- package/dist/collection/components/tooltip/tooltip.css +46 -0
- package/dist/collection/components/tooltip/tooltip.js +200 -0
- package/dist/collection/components/tooltip/tooltip.stories.js +113 -0
- package/dist/collection/components/utility/colour/background-color.stories.js +96 -0
- package/dist/collection/components/utility/colour/text-color.stories.js +94 -0
- package/dist/collection/foundations-stories/colour/colour-brand.stories.js +38 -0
- package/dist/collection/foundations-stories/colour/colour-scales.stories.js +71 -0
- package/dist/collection/foundations-stories/colour/colour-semantic.stories.js +40 -0
- package/dist/collection/foundations-stories/grid/grid.stories.js +386 -0
- package/dist/collection/foundations-stories/spacing/spacing-element.stories.js +100 -0
- package/dist/collection/foundations-stories/spacing/spacing-layout.stories.js +94 -0
- package/dist/collection/foundations-stories/typography/typography-body.stories.js +16 -0
- package/dist/collection/foundations-stories/typography/typography-detail.stories.js +17 -0
- package/dist/collection/foundations-stories/typography/typography-headline.stories.js +39 -0
- package/dist/collection/foundations-stories/typography/typography-paragraph.stories.js +12 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/stories/assets/code-brackets.svg +1 -0
- package/dist/collection/stories/assets/colors.svg +1 -0
- package/dist/collection/stories/assets/comments.svg +1 -0
- package/dist/collection/stories/assets/direction.svg +1 -0
- package/dist/collection/stories/assets/flow.svg +1 -0
- package/dist/collection/stories/assets/plugin.svg +1 -0
- package/dist/collection/stories/assets/repo.svg +1 -0
- package/dist/collection/stories/assets/stackalt.svg +1 -0
- package/dist/collection/utils/utils.js +12 -0
- package/dist/esm/index-b67b15a6.js +1884 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/popper-f860750c.js +1799 -0
- package/dist/esm/sdds-accordion-item.entry.js +30 -0
- package/dist/esm/sdds-accordion.entry.js +17 -0
- package/dist/esm/sdds-badges.entry.js +51 -0
- package/dist/esm/sdds-body-cell_2.entry.js +168 -0
- package/dist/esm/sdds-button.entry.js +32 -0
- package/dist/esm/sdds-datetime.entry.js +62 -0
- package/dist/esm/sdds-dropdown-filter.entry.js +88 -0
- package/dist/esm/sdds-dropdown_2.entry.js +330 -0
- package/dist/esm/sdds-header-cell.entry.js +137 -0
- package/dist/esm/sdds-icon.entry.js +38 -0
- package/dist/esm/sdds-inline-tabs-fullbleed.entry.js +92 -0
- package/dist/esm/sdds-inline-tabs.entry.js +207 -0
- package/dist/esm/sdds-modal.entry.js +45 -0
- package/dist/esm/sdds-navigation-tabs.entry.js +91 -0
- package/dist/esm/sdds-popover-canvas.entry.js +72 -0
- package/dist/esm/sdds-popover-menu.entry.js +71 -0
- package/dist/esm/sdds-slider.entry.js +332 -0
- package/dist/esm/sdds-spinner.entry.js +17 -0
- package/dist/esm/sdds-table-body-row-expandable.entry.js +77 -0
- package/dist/esm/sdds-table-body.entry.js +285 -0
- package/dist/esm/sdds-table-footer.entry.js +161 -0
- package/dist/esm/sdds-table-header.entry.js +96 -0
- package/dist/esm/sdds-table-toolbar.entry.js +62 -0
- package/dist/esm/sdds-table.entry.js +65 -0
- package/dist/esm/sdds-textarea.entry.js +57 -0
- package/dist/esm/sdds-textfield.entry.js +78 -0
- package/dist/esm/sdds-tooltip.entry.js +91 -0
- package/dist/esm/tegel.js +17 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/tegel/index.esm.js +0 -0
- package/dist/tegel/p-040efb32.entry.js +1 -0
- package/dist/tegel/p-12ca5cfa.entry.js +1 -0
- package/dist/tegel/p-157e1618.js +2 -0
- package/dist/tegel/p-1fe61cf6.entry.js +1 -0
- package/dist/tegel/p-2f376504.entry.js +1 -0
- package/dist/tegel/p-44ced895.entry.js +1 -0
- package/dist/tegel/p-4880f03d.entry.js +1 -0
- package/dist/tegel/p-4aba73a3.entry.js +1 -0
- package/dist/tegel/p-4b58a02c.entry.js +1 -0
- package/dist/tegel/p-4cb85347.entry.js +1 -0
- package/dist/tegel/p-52031b5a.entry.js +1 -0
- package/dist/tegel/p-677baf7f.entry.js +1 -0
- package/dist/tegel/p-71797eaf.entry.js +1 -0
- package/dist/tegel/p-7373284c.entry.js +1 -0
- package/dist/tegel/p-7451779b.entry.js +1 -0
- package/dist/tegel/p-77aeea3b.entry.js +1 -0
- package/dist/tegel/p-8582d6a7.entry.js +1 -0
- package/dist/tegel/p-96021bd0.entry.js +1 -0
- package/dist/tegel/p-9d8caf51.entry.js +1 -0
- package/dist/tegel/p-a5919930.entry.js +1 -0
- package/dist/tegel/p-b01cface.entry.js +1 -0
- package/dist/tegel/p-bf896643.entry.js +1 -0
- package/dist/tegel/p-c311725c.entry.js +1 -0
- package/dist/tegel/p-cf72dfd9.entry.js +1 -0
- package/dist/tegel/p-d91caec6.entry.js +1 -0
- package/dist/tegel/p-e10eec33.entry.js +1 -0
- package/dist/tegel/p-ec26fc38.js +1 -0
- package/dist/tegel/p-f2262a69.entry.js +1 -0
- package/dist/tegel/p-f2f7aa45.entry.js +1 -0
- package/dist/tegel/tegel.css +101 -0
- package/dist/tegel/tegel.esm.js +1 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { formatHtmlPreview } from '../../utils/utils';
|
|
2
|
+
// FIXME: CMS: Change state to type in Code tab of component
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/Banner',
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: 'fullscreen',
|
|
7
|
+
design: [
|
|
8
|
+
{
|
|
9
|
+
name: 'Figma',
|
|
10
|
+
type: 'figma',
|
|
11
|
+
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=5927%3A497&t=rVXuTOgTmXPauyHd-1',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'Link',
|
|
15
|
+
type: 'link',
|
|
16
|
+
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=5927%3A497&t=rVXuTOgTmXPauyHd-1',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
argTypes: {
|
|
21
|
+
state: {
|
|
22
|
+
name: 'Type',
|
|
23
|
+
description: 'Changes type of component',
|
|
24
|
+
options: ['Default', 'Error', 'Info'],
|
|
25
|
+
control: {
|
|
26
|
+
type: 'radio',
|
|
27
|
+
},
|
|
28
|
+
table: {
|
|
29
|
+
defaultValue: { summary: 'default' },
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
header: {
|
|
33
|
+
name: 'Header',
|
|
34
|
+
description: 'Text to display in header section',
|
|
35
|
+
control: {
|
|
36
|
+
type: 'text',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
subheader: {
|
|
40
|
+
name: 'Subheader',
|
|
41
|
+
description: 'Text to display in subheader section',
|
|
42
|
+
control: {
|
|
43
|
+
type: 'text',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
link: {
|
|
47
|
+
name: 'Link',
|
|
48
|
+
description: 'Text to display in link section',
|
|
49
|
+
control: {
|
|
50
|
+
type: 'text',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
prefix: {
|
|
54
|
+
name: 'Show icon',
|
|
55
|
+
description: 'If an icon should be displayed. For type default the truck icon is used in this example, but it should be changed to suit your needs.',
|
|
56
|
+
control: {
|
|
57
|
+
type: 'boolean',
|
|
58
|
+
},
|
|
59
|
+
table: {
|
|
60
|
+
defaultValue: { summary: 'true' },
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
args: {
|
|
65
|
+
state: 'Default',
|
|
66
|
+
header: 'This is a header text area',
|
|
67
|
+
subheader: 'SubHeader text area',
|
|
68
|
+
link: 'Learn more',
|
|
69
|
+
prefix: true,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
const Template = ({ state, prefix, header, subheader, link }) => formatHtmlPreview(`
|
|
73
|
+
<div class="sdds-banner sdds-banner-${state.toLowerCase()}">
|
|
74
|
+
${prefix && state === 'error'
|
|
75
|
+
? '<span class="sdds-banner-prefix"><sdds-icon name="error" size="20px"></sdds-icon></span>'
|
|
76
|
+
: ''}
|
|
77
|
+
${prefix && state === 'info'
|
|
78
|
+
? '<span class="sdds-banner-prefix"><sdds-icon name="info" size="20px"></sdds-icon></span>'
|
|
79
|
+
: ''}
|
|
80
|
+
${prefix && !(state === 'info' || state === 'error')
|
|
81
|
+
? '<span class="sdds-banner-prefix"><sdds-icon name="truck" size="20px"></sdds-icon></span>'
|
|
82
|
+
: ''}
|
|
83
|
+
<div class="sdds-banner-body">
|
|
84
|
+
${header && `<h6 class="sdds-banner-header">${header}</h6>`}
|
|
85
|
+
${subheader && `<div class="sdds-banner-subheader">${subheader}</div>`}
|
|
86
|
+
${link && `<a class="sdds-link sdds-banner-link">${link}</a>`}
|
|
87
|
+
</div>
|
|
88
|
+
<button type="button" aria-label="close" class="sdds-banner-close">
|
|
89
|
+
<sdds-icon name="cross" size="20px"></sdds-icon>
|
|
90
|
+
</button>
|
|
91
|
+
</div>
|
|
92
|
+
`);
|
|
93
|
+
export const Default = Template.bind({});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { formatHtmlPreview } from '../../utils/utils';
|
|
2
|
+
export default {
|
|
3
|
+
title: 'Components/Block',
|
|
4
|
+
parameters: {
|
|
5
|
+
layout: 'padded',
|
|
6
|
+
design: [
|
|
7
|
+
{
|
|
8
|
+
name: 'Figma',
|
|
9
|
+
type: 'figma',
|
|
10
|
+
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=9743%3A24020&t=rVXuTOgTmXPauyHd-1',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'Link',
|
|
14
|
+
type: 'link',
|
|
15
|
+
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=9743%3A24020&t=rVXuTOgTmXPauyHd-1',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
argTypes: {
|
|
20
|
+
type: {
|
|
21
|
+
name: 'Mode variation',
|
|
22
|
+
description: 'Mode variation adjusts component colors to have better visibility depending on global mode and background. ',
|
|
23
|
+
control: {
|
|
24
|
+
type: 'radio',
|
|
25
|
+
},
|
|
26
|
+
options: ['Primary', 'Secondary'],
|
|
27
|
+
table: {
|
|
28
|
+
defaultValue: { summary: 'Primary' },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
args: {
|
|
33
|
+
type: 'Primary',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
const Template = ({ type }) => formatHtmlPreview(`
|
|
37
|
+
<div class="sdds-block sdds-block-${type.toLowerCase()}">
|
|
38
|
+
<h2 class="sdds-headline-02">Block</h2>
|
|
39
|
+
<p class="sdds-body-01">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In condimentum nisi ut eleifend ultrices. Nunc venenatis maximus sapien, ac bibendum nisl aliquam in. Morbi ac velit et ligula consectetur interdum. Vestibulum condimentum, augue vitae lobortis rhoncus, mi est ultricies mi, sed tincidunt magna nibh in lectus. Pellentesque vel vulputate orci, vel lacinia orci. Sed suscipit leo at diam ullamcorper, vitae volutpat neque dapibus. Maecenas sit amet rhoncus arcu. Sed sed molestie elit. Nullam in interdum est, vitae aliquam ipsum. Nunc rutrum nibh ut arcu egestas egestas.</p>
|
|
40
|
+
<div class="sdds-block">
|
|
41
|
+
<h3 class="sdds-headline-03">Block in a block</h3>
|
|
42
|
+
<p class="sdds-body-02">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In condimentum nisi ut eleifend ultrices. Nunc venenatis maximus sapien, ac bibendum nisl aliquam in. Morbi ac velit et ligula consectetur interdum. Vestibulum condimentum, augue vitae lobortis rhoncus, mi est ultricies mi, sed tincidunt magna nibh in lectus. Pellentesque vel vulputate orci, vel lacinia orci. Sed suscipit leo at diam ullamcorper, vitae volutpat neque dapibus. Maecenas sit amet rhoncus arcu. Sed sed molestie elit. Nullam in interdum est, vitae aliquam ipsum. Nunc rutrum nibh ut arcu egestas egestas.</p>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
`);
|
|
46
|
+
export const Default = Template.bind({});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
title: 'Components/Breadcrumb',
|
|
3
|
+
parameters: {
|
|
4
|
+
design: [
|
|
5
|
+
{
|
|
6
|
+
name: 'Figma',
|
|
7
|
+
type: 'figma',
|
|
8
|
+
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=2703%3A4725&t=rVXuTOgTmXPauyHd-1',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: 'Link',
|
|
12
|
+
type: 'link',
|
|
13
|
+
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=2703%3A4725&t=rVXuTOgTmXPauyHd-1',
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const Template = () => `
|
|
19
|
+
<div class="sdds-breadcrumb">
|
|
20
|
+
<div class="sdds-breadcrumb-item"><a href="#">Page 1</a></div>
|
|
21
|
+
<div class="sdds-breadcrumb-item"><a href="#">Page 2</a></div>
|
|
22
|
+
<div class="sdds-breadcrumb-item sdds-breadcrumb-item-current"><a aria-current="page">Page 3</a></div>
|
|
23
|
+
</div>
|
|
24
|
+
`;
|
|
25
|
+
export const Default = Template.bind({});
|
|
26
|
+
Default.args = {};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
export class SddsButton {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.text = '';
|
|
5
|
+
this.type = 'primary';
|
|
6
|
+
this.variant = 'default';
|
|
7
|
+
this.size = 'lg';
|
|
8
|
+
this.disabled = false;
|
|
9
|
+
this.fullbleed = false;
|
|
10
|
+
this.onlyIcon = false;
|
|
11
|
+
}
|
|
12
|
+
componentWillLoad() {
|
|
13
|
+
if (this.text === '') {
|
|
14
|
+
this.onlyIcon = true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
return (h("button", { class: `sdds-btn sdds-btn-${this.type}
|
|
19
|
+
${`sdds-btn-${this.size}`}
|
|
20
|
+
${this.disabled ? 'disabled' : ''}
|
|
21
|
+
${this.fullbleed ? 'sdds-btn-fullbleed' : ''}
|
|
22
|
+
${this.variant === 'variant' ? 'sdds-on-white-bg' : ''}
|
|
23
|
+
${this.onlyIcon ? 'sdds-btn-only-icon' : ''}` }, h("span", { class: "sdds-btn-text" }, this.text), h("slot", { name: "icon" })));
|
|
24
|
+
}
|
|
25
|
+
static get is() { return "sdds-button"; }
|
|
26
|
+
static get encapsulation() { return "shadow"; }
|
|
27
|
+
static get originalStyleUrls() {
|
|
28
|
+
return {
|
|
29
|
+
"$": ["button.scss"]
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
static get styleUrls() {
|
|
33
|
+
return {
|
|
34
|
+
"$": ["button.css"]
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
static get properties() {
|
|
38
|
+
return {
|
|
39
|
+
"text": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"mutable": false,
|
|
42
|
+
"complexType": {
|
|
43
|
+
"original": "string",
|
|
44
|
+
"resolved": "string",
|
|
45
|
+
"references": {}
|
|
46
|
+
},
|
|
47
|
+
"required": false,
|
|
48
|
+
"optional": false,
|
|
49
|
+
"docs": {
|
|
50
|
+
"tags": [],
|
|
51
|
+
"text": "Text inside a button"
|
|
52
|
+
},
|
|
53
|
+
"attribute": "text",
|
|
54
|
+
"reflect": false,
|
|
55
|
+
"defaultValue": "''"
|
|
56
|
+
},
|
|
57
|
+
"type": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"mutable": false,
|
|
60
|
+
"complexType": {
|
|
61
|
+
"original": "'primary' | 'secondary' | 'ghost' | 'danger'",
|
|
62
|
+
"resolved": "\"danger\" | \"ghost\" | \"primary\" | \"secondary\"",
|
|
63
|
+
"references": {}
|
|
64
|
+
},
|
|
65
|
+
"required": false,
|
|
66
|
+
"optional": false,
|
|
67
|
+
"docs": {
|
|
68
|
+
"tags": [],
|
|
69
|
+
"text": "Type of button"
|
|
70
|
+
},
|
|
71
|
+
"attribute": "type",
|
|
72
|
+
"reflect": false,
|
|
73
|
+
"defaultValue": "'primary'"
|
|
74
|
+
},
|
|
75
|
+
"variant": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"mutable": false,
|
|
78
|
+
"complexType": {
|
|
79
|
+
"original": "'default' | 'variant'",
|
|
80
|
+
"resolved": "\"default\" | \"variant\"",
|
|
81
|
+
"references": {}
|
|
82
|
+
},
|
|
83
|
+
"required": false,
|
|
84
|
+
"optional": false,
|
|
85
|
+
"docs": {
|
|
86
|
+
"tags": [],
|
|
87
|
+
"text": ""
|
|
88
|
+
},
|
|
89
|
+
"attribute": "variant",
|
|
90
|
+
"reflect": false,
|
|
91
|
+
"defaultValue": "'default'"
|
|
92
|
+
},
|
|
93
|
+
"size": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"mutable": false,
|
|
96
|
+
"complexType": {
|
|
97
|
+
"original": "'xs' | 'sm' | 'md' | 'lg'",
|
|
98
|
+
"resolved": "\"lg\" | \"md\" | \"sm\" | \"xs\"",
|
|
99
|
+
"references": {}
|
|
100
|
+
},
|
|
101
|
+
"required": false,
|
|
102
|
+
"optional": false,
|
|
103
|
+
"docs": {
|
|
104
|
+
"tags": [],
|
|
105
|
+
"text": ""
|
|
106
|
+
},
|
|
107
|
+
"attribute": "size",
|
|
108
|
+
"reflect": false,
|
|
109
|
+
"defaultValue": "'lg'"
|
|
110
|
+
},
|
|
111
|
+
"disabled": {
|
|
112
|
+
"type": "boolean",
|
|
113
|
+
"mutable": false,
|
|
114
|
+
"complexType": {
|
|
115
|
+
"original": "boolean",
|
|
116
|
+
"resolved": "boolean",
|
|
117
|
+
"references": {}
|
|
118
|
+
},
|
|
119
|
+
"required": false,
|
|
120
|
+
"optional": false,
|
|
121
|
+
"docs": {
|
|
122
|
+
"tags": [],
|
|
123
|
+
"text": "Control for disabled state of component"
|
|
124
|
+
},
|
|
125
|
+
"attribute": "disabled",
|
|
126
|
+
"reflect": false,
|
|
127
|
+
"defaultValue": "false"
|
|
128
|
+
},
|
|
129
|
+
"fullbleed": {
|
|
130
|
+
"type": "boolean",
|
|
131
|
+
"mutable": false,
|
|
132
|
+
"complexType": {
|
|
133
|
+
"original": "boolean",
|
|
134
|
+
"resolved": "boolean",
|
|
135
|
+
"references": {}
|
|
136
|
+
},
|
|
137
|
+
"required": false,
|
|
138
|
+
"optional": false,
|
|
139
|
+
"docs": {
|
|
140
|
+
"tags": [],
|
|
141
|
+
"text": "When enabled, makes button take 100% width"
|
|
142
|
+
},
|
|
143
|
+
"attribute": "fullbleed",
|
|
144
|
+
"reflect": false,
|
|
145
|
+
"defaultValue": "false"
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
static get states() {
|
|
150
|
+
return {
|
|
151
|
+
"onlyIcon": {}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { formatHtmlPreview } from '../../utils/utils';
|
|
2
|
+
import { iconsNames } from '../icon/iconsArray';
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/Button',
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: 'padded',
|
|
7
|
+
chromatic: {
|
|
8
|
+
disableSnapshot: false, // enables snapshotting for the component
|
|
9
|
+
},
|
|
10
|
+
design: [
|
|
11
|
+
{
|
|
12
|
+
name: 'Figma',
|
|
13
|
+
type: 'figma',
|
|
14
|
+
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=1574%3A72148&t=rVXuTOgTmXPauyHd-1',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'Link',
|
|
18
|
+
type: 'link',
|
|
19
|
+
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=1574%3A72148&t=rVXuTOgTmXPauyHd-1',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
argTypes: {
|
|
24
|
+
text: {
|
|
25
|
+
name: 'Text',
|
|
26
|
+
description: 'The text to be displayed on the button',
|
|
27
|
+
control: {
|
|
28
|
+
type: 'text',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
btnType: {
|
|
32
|
+
name: 'Type',
|
|
33
|
+
description: 'Four different button types to help the user to distinguish the level of importance of the task they represent',
|
|
34
|
+
control: {
|
|
35
|
+
type: 'radio',
|
|
36
|
+
},
|
|
37
|
+
options: ['Primary', 'Secondary', 'Ghost', 'Danger'],
|
|
38
|
+
table: {
|
|
39
|
+
defaultValue: { summary: 'primary' },
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
size: {
|
|
43
|
+
name: 'Size',
|
|
44
|
+
description: 'Size of the button',
|
|
45
|
+
control: {
|
|
46
|
+
type: 'radio',
|
|
47
|
+
},
|
|
48
|
+
options: ['Large', 'Medium', 'Small', 'Extra small'],
|
|
49
|
+
table: {
|
|
50
|
+
defaultValue: { summary: 'lg' },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
variant: {
|
|
54
|
+
name: 'Variant',
|
|
55
|
+
description: 'Button variant.',
|
|
56
|
+
control: {
|
|
57
|
+
type: 'radio',
|
|
58
|
+
},
|
|
59
|
+
options: ['On light', 'On dark'],
|
|
60
|
+
table: {
|
|
61
|
+
defaultValue: { summary: 'on-dark' },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
fullbleed: {
|
|
65
|
+
name: 'Fullbleed',
|
|
66
|
+
defaultValue: false,
|
|
67
|
+
description: 'Fluid width in certain components-old',
|
|
68
|
+
control: {
|
|
69
|
+
type: 'boolean',
|
|
70
|
+
},
|
|
71
|
+
table: {
|
|
72
|
+
defaultValue: { summary: false },
|
|
73
|
+
},
|
|
74
|
+
if: { arg: 'onlyIcon', eq: false },
|
|
75
|
+
},
|
|
76
|
+
disabled: {
|
|
77
|
+
name: 'Disabled',
|
|
78
|
+
type: 'boolean',
|
|
79
|
+
description: 'Choose to disable the button',
|
|
80
|
+
table: {
|
|
81
|
+
defaultValue: { summary: false },
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
onlyIcon: {
|
|
85
|
+
name: 'Only Icon',
|
|
86
|
+
description: 'Displays only the icon and excludes any text from the button',
|
|
87
|
+
control: {
|
|
88
|
+
type: 'boolean',
|
|
89
|
+
},
|
|
90
|
+
table: {
|
|
91
|
+
defaultValue: { summary: false },
|
|
92
|
+
},
|
|
93
|
+
if: { arg: 'size', neq: 'Extra small' },
|
|
94
|
+
},
|
|
95
|
+
icon: {
|
|
96
|
+
name: 'Icon',
|
|
97
|
+
description: 'Icon to display on the button. Choose "none" to exclude the icon.',
|
|
98
|
+
control: {
|
|
99
|
+
type: 'select',
|
|
100
|
+
},
|
|
101
|
+
options: ['none', ...iconsNames],
|
|
102
|
+
if: { arg: 'size', neq: 'Extra small' },
|
|
103
|
+
},
|
|
104
|
+
iconType: {
|
|
105
|
+
name: 'Icon type',
|
|
106
|
+
description: 'Native/Web Component',
|
|
107
|
+
control: {
|
|
108
|
+
type: 'radio',
|
|
109
|
+
},
|
|
110
|
+
options: ['Native', 'Web Component'],
|
|
111
|
+
if: { arg: 'icon', neq: 'none' },
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
args: {
|
|
115
|
+
text: 'Button',
|
|
116
|
+
btnType: 'Primary',
|
|
117
|
+
size: 'Large',
|
|
118
|
+
variant: 'On dark',
|
|
119
|
+
fullbleed: false,
|
|
120
|
+
disabled: false,
|
|
121
|
+
onlyIcon: false,
|
|
122
|
+
icon: 'none',
|
|
123
|
+
iconType: 'Native',
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
const NativeTemplate = ({ size, variant, btnType, fullbleed, text = 'Button', disabled = '', onlyIcon, icon, iconType, }) => {
|
|
127
|
+
const fbClass = fullbleed ? 'sdds-btn-fullbleed' : '';
|
|
128
|
+
const onlyIconCss = onlyIcon ? 'sdds-btn-icon' : '';
|
|
129
|
+
const btnTypeLookUp = {
|
|
130
|
+
Primary: 'primary',
|
|
131
|
+
Secondary: 'secondary',
|
|
132
|
+
Ghost: 'ghost',
|
|
133
|
+
Danger: 'danger',
|
|
134
|
+
};
|
|
135
|
+
const sizeLookUp = {
|
|
136
|
+
'Large': 'lg',
|
|
137
|
+
'Medium': 'md',
|
|
138
|
+
'Small': 'sm',
|
|
139
|
+
'Extra small': 'xs',
|
|
140
|
+
};
|
|
141
|
+
const varaintLookup = {
|
|
142
|
+
'On light': 'on-light',
|
|
143
|
+
'On dark': 'on-dark',
|
|
144
|
+
};
|
|
145
|
+
return formatHtmlPreview(`
|
|
146
|
+
<style>
|
|
147
|
+
/* demo-wrapper is for demonstration purposes only*/
|
|
148
|
+
${icon && iconType === 'Native'
|
|
149
|
+
? `@import url('https://cdn.digitaldesign.scania.com/icons/webfont/css/sdds-icons.css');
|
|
150
|
+
i.sdds-btn-icon{
|
|
151
|
+
font-size: ${size === 'Small' ? '16' : '20'}px;
|
|
152
|
+
}\n `
|
|
153
|
+
: ''}\ .demo-wrapper{
|
|
154
|
+
width: 100%;
|
|
155
|
+
}
|
|
156
|
+
</style>
|
|
157
|
+
|
|
158
|
+
<div class="demo-wrapper">
|
|
159
|
+
<button class="sdds-btn sdds-btn-${btnTypeLookUp[btnType]} sdds-btn-${sizeLookUp[size]} ${fbClass} ${disabled ? 'disabled' : ''} ${onlyIconCss} ${varaintLookup[variant] === 'on-light' ? 'sdds-on-white-bg' : ''} ${onlyIcon ? 'sdds-btn-only-icon' : ''}">
|
|
160
|
+
${!onlyIcon ? `<span class="sdds-btn-text">${text}</span>` : ''}
|
|
161
|
+
${onlyIcon || (icon && icon !== 'none')
|
|
162
|
+
? `
|
|
163
|
+
${iconType === 'Native'
|
|
164
|
+
? `<i class="sdds-btn-icon sdds-icon ${icon}"></i>`
|
|
165
|
+
: `<sdds-icon class='sdds-btn-icon ' size='${sizeLookUp[size] === 'sm' ? '16px' : '20px'}' name='${icon}'></sdds-icon>`}
|
|
166
|
+
`
|
|
167
|
+
: ''}
|
|
168
|
+
</button>
|
|
169
|
+
</div>
|
|
170
|
+
`);
|
|
171
|
+
};
|
|
172
|
+
export const Native = NativeTemplate.bind({});
|
|
173
|
+
Native.args = {};
|
|
174
|
+
export const NativeWithIcon = NativeTemplate.bind({});
|
|
175
|
+
NativeWithIcon.args = {
|
|
176
|
+
icon: 'truck',
|
|
177
|
+
};
|
|
178
|
+
export const NativeOnlyIcon = NativeTemplate.bind({});
|
|
179
|
+
NativeOnlyIcon.args = {
|
|
180
|
+
text: '',
|
|
181
|
+
onlyIcon: true,
|
|
182
|
+
icon: 'truck',
|
|
183
|
+
};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { formatHtmlPreview } from '../../utils/utils';
|
|
2
|
+
import { iconsNames } from '../icon/iconsArray';
|
|
3
|
+
import readme from './readme.md';
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Components/Button',
|
|
6
|
+
parameters: {
|
|
7
|
+
notes: readme,
|
|
8
|
+
layout: 'padded',
|
|
9
|
+
chromatic: {
|
|
10
|
+
disableSnapshot: false, // enables snapshotting for the component
|
|
11
|
+
},
|
|
12
|
+
design: [
|
|
13
|
+
{
|
|
14
|
+
name: 'Figma',
|
|
15
|
+
type: 'figma',
|
|
16
|
+
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=1574%3A72148&t=rVXuTOgTmXPauyHd-1',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'Link',
|
|
20
|
+
type: 'link',
|
|
21
|
+
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=1574%3A72148&t=rVXuTOgTmXPauyHd-1',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
argTypes: {
|
|
26
|
+
text: {
|
|
27
|
+
name: 'Text',
|
|
28
|
+
description: 'The text to be displayed on the button',
|
|
29
|
+
control: {
|
|
30
|
+
type: 'text',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
btnType: {
|
|
34
|
+
name: 'Type',
|
|
35
|
+
description: 'Four different button types to help the user to distinguish the level of importance of the task they represent',
|
|
36
|
+
control: {
|
|
37
|
+
type: 'radio',
|
|
38
|
+
},
|
|
39
|
+
options: ['Primary', 'Secondary', 'Ghost', 'Danger'],
|
|
40
|
+
table: {
|
|
41
|
+
defaultValue: { summary: 'primary' },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
size: {
|
|
45
|
+
name: 'Size',
|
|
46
|
+
control: {
|
|
47
|
+
type: 'radio',
|
|
48
|
+
},
|
|
49
|
+
options: ['Large', 'Medium', 'Small', 'Extra small'],
|
|
50
|
+
table: {
|
|
51
|
+
defaultValue: { summary: 'lg' },
|
|
52
|
+
},
|
|
53
|
+
description: 'Size of the button',
|
|
54
|
+
},
|
|
55
|
+
variant: {
|
|
56
|
+
name: 'Variant',
|
|
57
|
+
control: {
|
|
58
|
+
type: 'radio',
|
|
59
|
+
},
|
|
60
|
+
options: ['On light', 'On dark'],
|
|
61
|
+
description: 'Button variant.',
|
|
62
|
+
table: {
|
|
63
|
+
defaultValue: { summary: 'on-dark' },
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
fullbleed: {
|
|
67
|
+
name: 'Fullbleed',
|
|
68
|
+
type: 'boolean',
|
|
69
|
+
description: 'Fluid width in certain components-old',
|
|
70
|
+
table: {
|
|
71
|
+
defaultValue: { summary: false },
|
|
72
|
+
},
|
|
73
|
+
if: { arg: 'onlyIcon', truthy: false },
|
|
74
|
+
},
|
|
75
|
+
disabled: {
|
|
76
|
+
name: 'Disabled',
|
|
77
|
+
type: 'boolean',
|
|
78
|
+
description: 'Choose to disable the button',
|
|
79
|
+
table: {
|
|
80
|
+
defaultValue: { summary: false },
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
onlyIcon: {
|
|
84
|
+
name: 'Only Icon',
|
|
85
|
+
description: 'Displays only the icon and excludes any text from the button',
|
|
86
|
+
control: {
|
|
87
|
+
type: 'boolean',
|
|
88
|
+
},
|
|
89
|
+
table: {
|
|
90
|
+
defaultValue: { summary: false },
|
|
91
|
+
},
|
|
92
|
+
if: { arg: 'size', neq: 'Extra small' },
|
|
93
|
+
},
|
|
94
|
+
icon: {
|
|
95
|
+
name: 'Icon',
|
|
96
|
+
description: 'Icon to display on the button. Choose "none" to exclude the icon.',
|
|
97
|
+
control: {
|
|
98
|
+
type: 'select',
|
|
99
|
+
},
|
|
100
|
+
options: ['none', ...iconsNames],
|
|
101
|
+
if: { arg: 'size', neq: 'Extra small' },
|
|
102
|
+
},
|
|
103
|
+
iconType: {
|
|
104
|
+
name: 'Icon type',
|
|
105
|
+
description: 'Native/Web Component',
|
|
106
|
+
control: {
|
|
107
|
+
type: 'radio',
|
|
108
|
+
},
|
|
109
|
+
options: ['Native', 'Web Component'],
|
|
110
|
+
if: { arg: 'icon', neq: 'none' },
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
args: {
|
|
114
|
+
text: 'Button',
|
|
115
|
+
btnType: 'Primary',
|
|
116
|
+
size: 'Large',
|
|
117
|
+
variant: 'On dark',
|
|
118
|
+
fullbleed: false,
|
|
119
|
+
disabled: false,
|
|
120
|
+
onlyIcon: false,
|
|
121
|
+
icon: 'none',
|
|
122
|
+
iconType: 'Webcomponent',
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
const WebComponentTemplate = ({ onlyIcon, size, variant, btnType, fullbleed, disabled, icon, iconType, text = 'Button', }) => {
|
|
126
|
+
const btnTypeLookUp = {
|
|
127
|
+
Primary: 'primary',
|
|
128
|
+
Secondary: 'secondary',
|
|
129
|
+
Ghost: 'ghost',
|
|
130
|
+
Danger: 'danger',
|
|
131
|
+
};
|
|
132
|
+
const sizeLookUp = {
|
|
133
|
+
'Large': 'lg',
|
|
134
|
+
'Medium': 'md',
|
|
135
|
+
'Small': 'sm',
|
|
136
|
+
'Extra small': 'xs',
|
|
137
|
+
};
|
|
138
|
+
const varaintLookup = {
|
|
139
|
+
'On light': 'on-light',
|
|
140
|
+
'On dark': 'on-dark',
|
|
141
|
+
};
|
|
142
|
+
return formatHtmlPreview(`
|
|
143
|
+
<style>
|
|
144
|
+
/* demo-wrapper is for demonstration purposes only*/${icon && iconType === 'Native'
|
|
145
|
+
? `@import url('https://cdn.digitaldesign.scania.com/icons/webfont/css/sdds-icons.css');
|
|
146
|
+
i.sdds-icon::before{
|
|
147
|
+
font-size: ${size === 'Large' || size === 'Medium' ? '20' : '16'}px;
|
|
148
|
+
}`
|
|
149
|
+
: ''}
|
|
150
|
+
.demo-wrapper{
|
|
151
|
+
width: 100%;
|
|
152
|
+
}
|
|
153
|
+
</style>
|
|
154
|
+
|
|
155
|
+
<div class="demo-wrapper">
|
|
156
|
+
<sdds-button ${onlyIcon ? 'onlyIcon' : ''} type="${btnTypeLookUp[btnType]}" size="${sizeLookUp[size]}" ${disabled ? 'disabled' : ''} ${fullbleed ? 'fullbleed' : ''} text="${onlyIcon ? '' : text}" variant="${varaintLookup[variant]}" >
|
|
157
|
+
${onlyIcon || (icon && icon !== 'none')
|
|
158
|
+
? `
|
|
159
|
+
${iconType === 'Native'
|
|
160
|
+
? `<i class="sdds-btn-icon sdds-icon ${icon}" slot="icon"></i>`
|
|
161
|
+
: `<sdds-icon slot="icon" class='sdds-btn-icon ' size='${sizeLookUp[size] == 'sm' ? '16px' : '20px'}' name='${icon}'></sdds-icon>`}
|
|
162
|
+
`
|
|
163
|
+
: ''}
|
|
164
|
+
</sdds-button>
|
|
165
|
+
</div>
|
|
166
|
+
`);
|
|
167
|
+
};
|
|
168
|
+
/** Button as web component */
|
|
169
|
+
export const WebComponent = WebComponentTemplate.bind({});
|
|
170
|
+
WebComponent.args = {};
|
|
171
|
+
export const WebComponentWithIcon = WebComponentTemplate.bind({});
|
|
172
|
+
WebComponentWithIcon.args = {
|
|
173
|
+
icon: 'truck',
|
|
174
|
+
iconType: 'Webcomponent',
|
|
175
|
+
};
|
|
176
|
+
export const WebComponentOnlyIcon = WebComponentTemplate.bind({});
|
|
177
|
+
WebComponentOnlyIcon.args = {
|
|
178
|
+
text: '',
|
|
179
|
+
iconType: 'Webcomponent',
|
|
180
|
+
onlyIcon: true,
|
|
181
|
+
icon: 'truck',
|
|
182
|
+
};
|