@scania/tegel 0.0.1-beta.1 → 0.0.1-beta.3
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/components/dropdown-option.js +1 -0
- package/dist/components/dropdown.js +1 -0
- package/dist/components/icon.js +1 -0
- package/dist/components/sdds-accordion-item.js +1 -0
- package/dist/components/sdds-accordion.js +1 -0
- package/dist/components/sdds-badges.js +1 -0
- package/dist/components/sdds-button.js +1 -0
- package/dist/components/sdds-datetime.js +1 -0
- package/dist/components/sdds-dropdown-filter.js +1 -0
- package/dist/components/sdds-header-cell.js +1 -0
- package/dist/components/sdds-inline-tabs-fullbleed.js +1 -0
- package/dist/components/sdds-inline-tabs.js +1 -0
- package/dist/components/sdds-modal.js +1 -0
- package/dist/components/sdds-navigation-tabs.js +1 -0
- package/dist/components/sdds-popover-canvas.js +1 -0
- package/dist/components/sdds-popover-menu.js +1 -0
- package/dist/components/sdds-slider.js +1 -0
- package/dist/components/sdds-spinner.js +1 -0
- package/dist/components/sdds-table-body-row-expandable.js +1 -0
- package/dist/components/sdds-table-body.js +1 -0
- package/dist/components/sdds-table-footer.js +1 -0
- package/dist/components/sdds-table-header.js +1 -0
- package/dist/components/sdds-table-toolbar.js +1 -0
- package/dist/components/sdds-table.js +1 -0
- package/dist/components/sdds-textarea.js +1 -0
- package/dist/components/sdds-textfield.js +1 -0
- package/dist/components/sdds-tooltip.js +1 -0
- package/dist/components/table-body-cell.js +1 -0
- package/dist/components/table-body-row.js +1 -0
- package/package.json +3 -3
- package/dist/cjs/index-e1c79686.js +0 -1912
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/loader.cjs.js +0 -21
- package/dist/cjs/popper-11d5f714.js +0 -1801
- package/dist/cjs/sdds-accordion-item.cjs.entry.js +0 -34
- package/dist/cjs/sdds-accordion.cjs.entry.js +0 -21
- package/dist/cjs/sdds-badges.cjs.entry.js +0 -55
- package/dist/cjs/sdds-body-cell_2.cjs.entry.js +0 -173
- package/dist/cjs/sdds-button.cjs.entry.js +0 -36
- package/dist/cjs/sdds-datetime.cjs.entry.js +0 -66
- package/dist/cjs/sdds-dropdown-filter.cjs.entry.js +0 -92
- package/dist/cjs/sdds-dropdown_2.cjs.entry.js +0 -335
- package/dist/cjs/sdds-header-cell.cjs.entry.js +0 -141
- package/dist/cjs/sdds-icon.cjs.entry.js +0 -42
- package/dist/cjs/sdds-inline-tabs-fullbleed.cjs.entry.js +0 -96
- package/dist/cjs/sdds-inline-tabs.cjs.entry.js +0 -211
- package/dist/cjs/sdds-modal.cjs.entry.js +0 -49
- package/dist/cjs/sdds-navigation-tabs.cjs.entry.js +0 -95
- package/dist/cjs/sdds-popover-canvas.cjs.entry.js +0 -76
- package/dist/cjs/sdds-popover-menu.cjs.entry.js +0 -75
- package/dist/cjs/sdds-slider.cjs.entry.js +0 -336
- package/dist/cjs/sdds-spinner.cjs.entry.js +0 -21
- package/dist/cjs/sdds-table-body-row-expandable.cjs.entry.js +0 -81
- package/dist/cjs/sdds-table-body.cjs.entry.js +0 -289
- package/dist/cjs/sdds-table-footer.cjs.entry.js +0 -165
- package/dist/cjs/sdds-table-header.cjs.entry.js +0 -100
- package/dist/cjs/sdds-table-toolbar.cjs.entry.js +0 -66
- package/dist/cjs/sdds-table.cjs.entry.js +0 -69
- package/dist/cjs/sdds-textarea.cjs.entry.js +0 -61
- package/dist/cjs/sdds-textfield.cjs.entry.js +0 -82
- package/dist/cjs/sdds-tooltip.cjs.entry.js +0 -95
- package/dist/cjs/tegel.cjs.js +0 -19
- package/dist/collection/collection-manifest.json +0 -40
- package/dist/collection/components/accordion/accordion-item/accordion-item.css +0 -134
- package/dist/collection/components/accordion/accordion-item/accordion-item.js +0 -146
- package/dist/collection/components/accordion/accordion.css +0 -77
- package/dist/collection/components/accordion/accordion.js +0 -62
- package/dist/collection/components/accordion/accordion.stories.js +0 -91
- package/dist/collection/components/badge/badge.stories.js +0 -101
- package/dist/collection/components/badge/badges.css +0 -42
- package/dist/collection/components/badge/badges.js +0 -150
- package/dist/collection/components/banner/banner.stories.js +0 -93
- package/dist/collection/components/block/block.stories.js +0 -46
- package/dist/collection/components/breadcrumb/breadcrumb.stories.js +0 -26
- package/dist/collection/components/button/button-component.js +0 -154
- package/dist/collection/components/button/button-native.stories.js +0 -183
- package/dist/collection/components/button/button-webcomponent.stories.js +0 -182
- package/dist/collection/components/button/button.css +0 -658
- package/dist/collection/components/card/card.stories.js +0 -181
- package/dist/collection/components/checkbox/checkbox.stories.js +0 -54
- package/dist/collection/components/chips/chips.stories.js +0 -124
- package/dist/collection/components/data-table/native-table.stories.js +0 -182
- package/dist/collection/components/data-table/table/table.css +0 -15
- package/dist/collection/components/data-table/table/table.js +0 -253
- package/dist/collection/components/data-table/table-body/table-body.css +0 -22
- package/dist/collection/components/data-table/table-body/table-body.js +0 -425
- package/dist/collection/components/data-table/table-body-cell/table-body-cell.css +0 -40
- package/dist/collection/components/data-table/table-body-cell/table-body-cell.js +0 -169
- package/dist/collection/components/data-table/table-body-row/table-body-row.css +0 -196
- package/dist/collection/components/data-table/table-body-row/table-body-row.js +0 -164
- package/dist/collection/components/data-table/table-body-row-expandable/table-body-row-expandable.css +0 -79
- package/dist/collection/components/data-table/table-body-row-expandable/table-body-row-expandable.js +0 -155
- package/dist/collection/components/data-table/table-component-basic.stories.js +0 -163
- package/dist/collection/components/data-table/table-component-batch-actions.stories.js +0 -129
- package/dist/collection/components/data-table/table-component-bodydata.stories.js +0 -58
- package/dist/collection/components/data-table/table-component-custom-width.stories.js +0 -198
- package/dist/collection/components/data-table/table-component-event-listeners.stories.js +0 -153
- package/dist/collection/components/data-table/table-component-expandable-rows.stories.js +0 -137
- package/dist/collection/components/data-table/table-component-filtering.stories.js +0 -139
- package/dist/collection/components/data-table/table-component-multiselect.stories.js +0 -160
- package/dist/collection/components/data-table/table-component-pagination.stories.js +0 -129
- package/dist/collection/components/data-table/table-component-sorting.stories.js +0 -107
- package/dist/collection/components/data-table/table-footer/table-footer.css +0 -93
- package/dist/collection/components/data-table/table-footer/table-footer.js +0 -355
- package/dist/collection/components/data-table/table-header/table-header.css +0 -204
- package/dist/collection/components/data-table/table-header/table-header.js +0 -153
- package/dist/collection/components/data-table/table-header-cell/table-header-cell.css +0 -126
- package/dist/collection/components/data-table/table-header-cell/table-header-cell.js +0 -320
- package/dist/collection/components/data-table/table-toolbar/table-toolbar.css +0 -92
- package/dist/collection/components/data-table/table-toolbar/table-toolbar.js +0 -142
- package/dist/collection/components/datetime/datetime.css +0 -375
- package/dist/collection/components/datetime/datetime.js +0 -251
- package/dist/collection/components/datetime/datetime.stories.js +0 -149
- package/dist/collection/components/divider/divider.stories.js +0 -116
- package/dist/collection/components/dropdown/dropdown-filter/dropdown-filter.js +0 -339
- package/dist/collection/components/dropdown/dropdown-filter/dropdown-filter.stories.js +0 -130
- package/dist/collection/components/dropdown/dropdown-native.stories.js +0 -90
- package/dist/collection/components/dropdown/dropdown-option/dropdown-option.js +0 -185
- package/dist/collection/components/dropdown/dropdown-wc-default.stories.js +0 -151
- package/dist/collection/components/dropdown/dropdown-wc-multiselect.stories.js +0 -146
- package/dist/collection/components/dropdown/dropdown.css +0 -891
- package/dist/collection/components/dropdown/dropdown.js +0 -554
- package/dist/collection/components/footer/footer.stories.js +0 -100
- package/dist/collection/components/header/header-all.stories.js +0 -217
- package/dist/collection/components/header/header-default.stories.js +0 -47
- package/dist/collection/components/header/header-inline.stories.js +0 -113
- package/dist/collection/components/header/header-search.stories.js +0 -263
- package/dist/collection/components/header/header-toolbar.stories.js +0 -204
- package/dist/collection/components/icon/icon-font.stories.js +0 -57
- package/dist/collection/components/icon/icon-web-component.stories.js +0 -51
- package/dist/collection/components/icon/icon.css +0 -16
- package/dist/collection/components/icon/icon.js +0 -89
- package/dist/collection/components/icon/iconsArray.js +0 -2
- package/dist/collection/components/link/link.stories.js +0 -45
- package/dist/collection/components/message/message.stories.js +0 -117
- package/dist/collection/components/modal/modal-native.stories.js +0 -121
- package/dist/collection/components/modal/modal-webcomponent.stories.js +0 -78
- package/dist/collection/components/modal/modal.css +0 -324
- package/dist/collection/components/modal/modal.js +0 -146
- package/dist/collection/components/popover-canvas/popover-canvas.css +0 -20
- package/dist/collection/components/popover-canvas/popover-canvas.js +0 -190
- package/dist/collection/components/popover-canvas/popover-canvas.stories.js +0 -87
- package/dist/collection/components/popover-menu/popover-menu-icons.stories.js +0 -132
- package/dist/collection/components/popover-menu/popover-menu.css +0 -19
- package/dist/collection/components/popover-menu/popover-menu.js +0 -189
- package/dist/collection/components/popover-menu/popover-menu.stories.js +0 -109
- package/dist/collection/components/radio-button/radio-button.stories.js +0 -68
- package/dist/collection/components/side-menu/side-menu.stories.js +0 -182
- package/dist/collection/components/slider/slider.css +0 -260
- package/dist/collection/components/slider/slider.js +0 -682
- package/dist/collection/components/slider/slider.stories.js +0 -251
- package/dist/collection/components/spinner/spinner.css +0 -79
- package/dist/collection/components/spinner/spinner.js +0 -61
- package/dist/collection/components/spinner/spinner.stories.js +0 -59
- package/dist/collection/components/stepper/stepper.stories.js +0 -139
- package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.css +0 -159
- package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.js +0 -302
- package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.stories.js +0 -65
- package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.css +0 -172
- package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.js +0 -126
- package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.stories.js +0 -43
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.css +0 -153
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.js +0 -103
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.stories.js +0 -32
- package/dist/collection/components/textarea/textarea.css +0 -283
- package/dist/collection/components/textarea/textarea.js +0 -336
- package/dist/collection/components/textarea/textarea.stories.js +0 -149
- package/dist/collection/components/textfield/textfield.css +0 -494
- package/dist/collection/components/textfield/textfield.js +0 -359
- package/dist/collection/components/textfield/textfield.stories.js +0 -222
- package/dist/collection/components/toast/toast.stories.js +0 -119
- package/dist/collection/components/toggle/toggle.stories.js +0 -62
- package/dist/collection/components/tooltip/tooltip.css +0 -46
- package/dist/collection/components/tooltip/tooltip.js +0 -200
- package/dist/collection/components/tooltip/tooltip.stories.js +0 -113
- package/dist/collection/components/utility/colour/background-color.stories.js +0 -96
- package/dist/collection/components/utility/colour/text-color.stories.js +0 -94
- package/dist/collection/foundations-stories/colour/colour-brand.stories.js +0 -38
- package/dist/collection/foundations-stories/colour/colour-scales.stories.js +0 -71
- package/dist/collection/foundations-stories/colour/colour-semantic.stories.js +0 -40
- package/dist/collection/foundations-stories/grid/grid.stories.js +0 -386
- package/dist/collection/foundations-stories/spacing/spacing-element.stories.js +0 -100
- package/dist/collection/foundations-stories/spacing/spacing-layout.stories.js +0 -94
- package/dist/collection/foundations-stories/typography/typography-body.stories.js +0 -16
- package/dist/collection/foundations-stories/typography/typography-detail.stories.js +0 -17
- package/dist/collection/foundations-stories/typography/typography-headline.stories.js +0 -39
- package/dist/collection/foundations-stories/typography/typography-paragraph.stories.js +0 -12
- package/dist/collection/index.js +0 -1
- package/dist/collection/stories/assets/code-brackets.svg +0 -1
- package/dist/collection/stories/assets/colors.svg +0 -1
- package/dist/collection/stories/assets/comments.svg +0 -1
- package/dist/collection/stories/assets/direction.svg +0 -1
- package/dist/collection/stories/assets/flow.svg +0 -1
- package/dist/collection/stories/assets/plugin.svg +0 -1
- package/dist/collection/stories/assets/repo.svg +0 -1
- package/dist/collection/stories/assets/stackalt.svg +0 -1
- package/dist/collection/utils/utils.js +0 -12
- package/dist/esm/index-b67b15a6.js +0 -1884
- package/dist/esm/index.js +0 -1
- package/dist/esm/loader.js +0 -17
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/popper-f860750c.js +0 -1799
- package/dist/esm/sdds-accordion-item.entry.js +0 -30
- package/dist/esm/sdds-accordion.entry.js +0 -17
- package/dist/esm/sdds-badges.entry.js +0 -51
- package/dist/esm/sdds-body-cell_2.entry.js +0 -168
- package/dist/esm/sdds-button.entry.js +0 -32
- package/dist/esm/sdds-datetime.entry.js +0 -62
- package/dist/esm/sdds-dropdown-filter.entry.js +0 -88
- package/dist/esm/sdds-dropdown_2.entry.js +0 -330
- package/dist/esm/sdds-header-cell.entry.js +0 -137
- package/dist/esm/sdds-icon.entry.js +0 -38
- package/dist/esm/sdds-inline-tabs-fullbleed.entry.js +0 -92
- package/dist/esm/sdds-inline-tabs.entry.js +0 -207
- package/dist/esm/sdds-modal.entry.js +0 -45
- package/dist/esm/sdds-navigation-tabs.entry.js +0 -91
- package/dist/esm/sdds-popover-canvas.entry.js +0 -72
- package/dist/esm/sdds-popover-menu.entry.js +0 -71
- package/dist/esm/sdds-slider.entry.js +0 -332
- package/dist/esm/sdds-spinner.entry.js +0 -17
- package/dist/esm/sdds-table-body-row-expandable.entry.js +0 -77
- package/dist/esm/sdds-table-body.entry.js +0 -285
- package/dist/esm/sdds-table-footer.entry.js +0 -161
- package/dist/esm/sdds-table-header.entry.js +0 -96
- package/dist/esm/sdds-table-toolbar.entry.js +0 -62
- package/dist/esm/sdds-table.entry.js +0 -65
- package/dist/esm/sdds-textarea.entry.js +0 -57
- package/dist/esm/sdds-textfield.entry.js +0 -78
- package/dist/esm/sdds-tooltip.entry.js +0 -91
- package/dist/esm/tegel.js +0 -17
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/tegel/index.esm.js +0 -0
- package/dist/tegel/p-040efb32.entry.js +0 -1
- package/dist/tegel/p-12ca5cfa.entry.js +0 -1
- package/dist/tegel/p-157e1618.js +0 -2
- package/dist/tegel/p-1fe61cf6.entry.js +0 -1
- package/dist/tegel/p-2f376504.entry.js +0 -1
- package/dist/tegel/p-44ced895.entry.js +0 -1
- package/dist/tegel/p-4880f03d.entry.js +0 -1
- package/dist/tegel/p-4aba73a3.entry.js +0 -1
- package/dist/tegel/p-4b58a02c.entry.js +0 -1
- package/dist/tegel/p-4cb85347.entry.js +0 -1
- package/dist/tegel/p-52031b5a.entry.js +0 -1
- package/dist/tegel/p-677baf7f.entry.js +0 -1
- package/dist/tegel/p-71797eaf.entry.js +0 -1
- package/dist/tegel/p-7373284c.entry.js +0 -1
- package/dist/tegel/p-7451779b.entry.js +0 -1
- package/dist/tegel/p-77aeea3b.entry.js +0 -1
- package/dist/tegel/p-8582d6a7.entry.js +0 -1
- package/dist/tegel/p-96021bd0.entry.js +0 -1
- package/dist/tegel/p-9d8caf51.entry.js +0 -1
- package/dist/tegel/p-a5919930.entry.js +0 -1
- package/dist/tegel/p-b01cface.entry.js +0 -1
- package/dist/tegel/p-bf896643.entry.js +0 -1
- package/dist/tegel/p-c311725c.entry.js +0 -1
- package/dist/tegel/p-cf72dfd9.entry.js +0 -1
- package/dist/tegel/p-d91caec6.entry.js +0 -1
- package/dist/tegel/p-e10eec33.entry.js +0 -1
- package/dist/tegel/p-ec26fc38.js +0 -1
- package/dist/tegel/p-f2262a69.entry.js +0 -1
- package/dist/tegel/p-f2f7aa45.entry.js +0 -1
- package/dist/tegel/tegel.css +0 -101
- package/dist/tegel/tegel.esm.js +0 -1
- package/loader/cdn.js +0 -3
- package/loader/index.cjs.js +0 -3
- package/loader/index.d.ts +0 -12
- package/loader/index.es2017.js +0 -3
- package/loader/index.js +0 -4
- package/loader/package.json +0 -11
|
@@ -1,93 +0,0 @@
|
|
|
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({});
|
|
@@ -1,46 +0,0 @@
|
|
|
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({});
|
|
@@ -1,26 +0,0 @@
|
|
|
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 = {};
|
|
@@ -1,154 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,183 +0,0 @@
|
|
|
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/Webcomponent',
|
|
107
|
-
control: {
|
|
108
|
-
type: 'radio',
|
|
109
|
-
},
|
|
110
|
-
options: ['Native', 'Webcomponent'],
|
|
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
|
-
};
|
|
@@ -1,182 +0,0 @@
|
|
|
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/Webcomponent',
|
|
106
|
-
control: {
|
|
107
|
-
type: 'radio',
|
|
108
|
-
},
|
|
109
|
-
options: ['Native', 'Webcomponent'],
|
|
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
|
-
};
|