@scania/tegel 0.0.1-beta.1 → 0.0.1-beta.10
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/loader.cjs.js +1 -1
- package/dist/cjs/tegel.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/modal/modal.css +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tegel.js +1 -1
- package/package.json +4 -4
- package/readme.md +136 -2
- package/dist/collection/components/accordion/accordion.stories.js +0 -91
- package/dist/collection/components/badge/badge.stories.js +0 -101
- 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-native.stories.js +0 -183
- package/dist/collection/components/button/button-webcomponent.stories.js +0 -182
- 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-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/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.stories.js +0 -130
- package/dist/collection/components/dropdown/dropdown-native.stories.js +0 -90
- 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/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/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/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.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.stories.js +0 -251
- 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.stories.js +0 -65
- package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.stories.js +0 -43
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.stories.js +0 -32
- package/dist/collection/components/textarea/textarea.stories.js +0 -149
- 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.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/types/components/accordion/accordion.stories.d.ts +0 -77
- package/dist/types/components/badge/badge.stories.d.ts +0 -66
- package/dist/types/components/banner/banner.stories.d.ts +0 -68
- package/dist/types/components/block/block.stories.d.ts +0 -31
- package/dist/types/components/breadcrumb/breadcrumb.stories.d.ts +0 -12
- package/dist/types/components/button/button-native.stories.d.ts +0 -144
- package/dist/types/components/button/button-webcomponent.stories.d.ts +0 -143
- package/dist/types/components/card/card.stories.d.ts +0 -114
- package/dist/types/components/checkbox/checkbox.stories.d.ts +0 -39
- package/dist/types/components/chips/chips.stories.d.ts +0 -81
- package/dist/types/components/data-table/native-table.stories.d.ts +0 -147
- package/dist/types/components/data-table/table-component-basic.stories.d.ts +0 -100
- package/dist/types/components/data-table/table-component-batch-actions.stories.d.ts +0 -98
- package/dist/types/components/data-table/table-component-bodydata.stories.d.ts +0 -38
- package/dist/types/components/data-table/table-component-custom-width.stories.d.ts +0 -147
- package/dist/types/components/data-table/table-component-event-listeners.stories.d.ts +0 -87
- package/dist/types/components/data-table/table-component-expandable-rows.stories.d.ts +0 -87
- package/dist/types/components/data-table/table-component-filtering.stories.d.ts +0 -100
- package/dist/types/components/data-table/table-component-multiselect.stories.d.ts +0 -100
- package/dist/types/components/data-table/table-component-pagination.stories.d.ts +0 -100
- package/dist/types/components/data-table/table-component-sorting.stories.d.ts +0 -79
- package/dist/types/components/datetime/datetime.stories.d.ts +0 -80
- package/dist/types/components/divider/divider.stories.d.ts +0 -72
- package/dist/types/components/dropdown/dropdown-filter/dropdown-filter.stories.d.ts +0 -73
- package/dist/types/components/dropdown/dropdown-native.stories.d.ts +0 -57
- package/dist/types/components/dropdown/dropdown-wc-default.stories.d.ts +0 -115
- package/dist/types/components/dropdown/dropdown-wc-multiselect.stories.d.ts +0 -115
- package/dist/types/components/footer/footer.stories.d.ts +0 -23
- package/dist/types/components/header/header-all.stories.d.ts +0 -29
- package/dist/types/components/header/header-default.stories.d.ts +0 -29
- package/dist/types/components/header/header-inline.stories.d.ts +0 -29
- package/dist/types/components/header/header-search.stories.d.ts +0 -29
- package/dist/types/components/header/header-toolbar.stories.d.ts +0 -29
- package/dist/types/components/icon/icon-font.stories.d.ts +0 -38
- package/dist/types/components/icon/icon-web-component.stories.d.ts +0 -38
- package/dist/types/components/link/link.stories.d.ts +0 -33
- package/dist/types/components/message/message.stories.d.ts +0 -67
- package/dist/types/components/modal/modal-native.stories.d.ts +0 -51
- package/dist/types/components/modal/modal-webcomponent.stories.d.ts +0 -44
- package/dist/types/components/popover-canvas/popover-canvas.stories.d.ts +0 -25
- package/dist/types/components/popover-menu/popover-menu-icons.stories.d.ts +0 -27
- package/dist/types/components/popover-menu/popover-menu.stories.d.ts +0 -27
- package/dist/types/components/radio-button/radio-button.stories.d.ts +0 -41
- package/dist/types/components/side-menu/side-menu.stories.d.ts +0 -42
- package/dist/types/components/slider/slider.stories.d.ts +0 -156
- package/dist/types/components/spinner/spinner.stories.d.ts +0 -37
- package/dist/types/components/stepper/stepper.stories.d.ts +0 -56
- package/dist/types/components/tabs/inline-tabs-default/inline-tabs.stories.d.ts +0 -41
- package/dist/types/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.stories.d.ts +0 -25
- package/dist/types/components/tabs/navigation-tabs/navigation-tabs.stories.d.ts +0 -13
- package/dist/types/components/textarea/textarea.stories.d.ts +0 -111
- package/dist/types/components/textfield/textfield.stories.d.ts +0 -176
- package/dist/types/components/toast/toast.stories.d.ts +0 -58
- package/dist/types/components/toggle/toggle.stories.d.ts +0 -42
- package/dist/types/components/tooltip/tooltip.stories.d.ts +0 -54
- package/dist/types/components/utility/colour/background-color.stories.d.ts +0 -58
- package/dist/types/components/utility/colour/text-color.stories.d.ts +0 -58
- package/dist/types/foundations-stories/colour/colour-brand.stories.d.ts +0 -13
- package/dist/types/foundations-stories/colour/colour-scales.stories.d.ts +0 -13
- package/dist/types/foundations-stories/colour/colour-semantic.stories.d.ts +0 -13
- package/dist/types/foundations-stories/grid/grid.stories.d.ts +0 -35
- package/dist/types/foundations-stories/spacing/spacing-element.stories.d.ts +0 -8
- package/dist/types/foundations-stories/spacing/spacing-layout.stories.d.ts +0 -8
- package/dist/types/foundations-stories/typography/typography-body.stories.d.ts +0 -8
- package/dist/types/foundations-stories/typography/typography-detail.stories.d.ts +0 -8
- package/dist/types/foundations-stories/typography/typography-headline.stories.d.ts +0 -21
- package/dist/types/foundations-stories/typography/typography-paragraph.stories.d.ts +0 -8
|
@@ -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
|
-
};
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import CardImage from '../../stories/assets/image/card-img.png';
|
|
2
|
-
import { formatHtmlPreview } from '../../utils/utils';
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Components/Card',
|
|
5
|
-
parameters: {
|
|
6
|
-
layout: 'centered',
|
|
7
|
-
design: [
|
|
8
|
-
{
|
|
9
|
-
name: 'Figma',
|
|
10
|
-
type: 'figma',
|
|
11
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=2891%3A125&t=rVXuTOgTmXPauyHd-1',
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
name: 'Link',
|
|
15
|
-
type: 'link',
|
|
16
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=2891%3A125&t=rVXuTOgTmXPauyHd-1',
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
},
|
|
20
|
-
argTypes: {
|
|
21
|
-
headline: {
|
|
22
|
-
name: 'Header text',
|
|
23
|
-
description: 'The header text',
|
|
24
|
-
control: {
|
|
25
|
-
type: 'text',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
subheadline: {
|
|
29
|
-
name: 'Subheader text',
|
|
30
|
-
description: 'The subheader text',
|
|
31
|
-
control: {
|
|
32
|
-
type: 'text',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
text: {
|
|
36
|
-
name: 'Body text',
|
|
37
|
-
description: 'The body text for the card',
|
|
38
|
-
control: {
|
|
39
|
-
type: 'text',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
divider: {
|
|
43
|
-
name: 'Divider',
|
|
44
|
-
description: 'Add a divider to the card',
|
|
45
|
-
control: {
|
|
46
|
-
type: 'boolean',
|
|
47
|
-
},
|
|
48
|
-
table: {
|
|
49
|
-
defaultValue: { summary: false },
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
footer: {
|
|
53
|
-
name: 'Footer',
|
|
54
|
-
description: 'The footer of the card',
|
|
55
|
-
control: {
|
|
56
|
-
type: 'text',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
clickable: {
|
|
60
|
-
name: 'Clickable',
|
|
61
|
-
description: 'Toggles if the card is clickable or not.',
|
|
62
|
-
control: {
|
|
63
|
-
type: 'boolean',
|
|
64
|
-
},
|
|
65
|
-
table: {
|
|
66
|
-
defaultValue: { summary: false },
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
image: {
|
|
70
|
-
name: 'Image',
|
|
71
|
-
description: 'Image on card',
|
|
72
|
-
control: {
|
|
73
|
-
type: 'boolean',
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
imageTop: {
|
|
77
|
-
name: 'Image on top',
|
|
78
|
-
description: 'Sets the image on top',
|
|
79
|
-
control: {
|
|
80
|
-
type: 'boolean',
|
|
81
|
-
},
|
|
82
|
-
table: {
|
|
83
|
-
defaultValue: { summary: false },
|
|
84
|
-
},
|
|
85
|
-
if: { arg: 'image', eq: true },
|
|
86
|
-
},
|
|
87
|
-
avatar: {
|
|
88
|
-
name: 'Avatar',
|
|
89
|
-
description: 'An avatar image for the card',
|
|
90
|
-
control: {
|
|
91
|
-
type: 'boolean',
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
args: {
|
|
96
|
-
headline: 'Header text',
|
|
97
|
-
subheadline: 'Subheader text',
|
|
98
|
-
text: '',
|
|
99
|
-
divider: false,
|
|
100
|
-
footer: '<sdds-icon style="font-size: 20px;" name="arrow_left"></sdds-icon>',
|
|
101
|
-
clickable: false,
|
|
102
|
-
image: false,
|
|
103
|
-
imageTop: false,
|
|
104
|
-
avatar: false,
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
const Template = ({ headline, subheadline, footer, clickable, text, divider, imageTop, avatar }) => formatHtmlPreview(`
|
|
108
|
-
<style>
|
|
109
|
-
/* demo-wrapper is for demonstration purposes only*/
|
|
110
|
-
.demo-wrapper {
|
|
111
|
-
width: 300px;
|
|
112
|
-
}
|
|
113
|
-
</style>
|
|
114
|
-
|
|
115
|
-
<div class="demo-wrapper">
|
|
116
|
-
<div class="sdds-card${clickable ? ' sdds-clickable' : ''}">
|
|
117
|
-
${imageTop === true
|
|
118
|
-
? `<img class="sdds-card-img" src="${CardImage}" alt="Add description to image"/>`
|
|
119
|
-
: ''}
|
|
120
|
-
<div class="${avatar ? 'sdds-card-header-avatar' : 'sdds-card-header'}">
|
|
121
|
-
${avatar
|
|
122
|
-
? `
|
|
123
|
-
<div class="sdds-card-avatar">
|
|
124
|
-
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="18" cy="18" r="18" fill="#E2E2E4"/></svg>
|
|
125
|
-
</div>`
|
|
126
|
-
: ''}
|
|
127
|
-
${avatar
|
|
128
|
-
? `<div class="sdds-card-headlines">
|
|
129
|
-
${headline ? `<h6 class="sdds-card-headline">${headline}</h6>` : ''}
|
|
130
|
-
${subheadline ? `<h6 class="sdds-card-sub-headline" >${subheadline}</h6>` : ''}
|
|
131
|
-
</div>`
|
|
132
|
-
: `${headline ? `<h6 class="sdds-card-headline">${headline}</h6>` : ''}
|
|
133
|
-
${subheadline ? `<h6 class="sdds-card-sub-headline" >${subheadline}</h6>` : ''}
|
|
134
|
-
`}
|
|
135
|
-
</div>
|
|
136
|
-
${imageTop === false
|
|
137
|
-
? `<img class="sdds-card-img" src="${CardImage}" alt="Add description to image"/>`
|
|
138
|
-
: ''}
|
|
139
|
-
${divider ? '<div class="sdds-divider-light-border-top"></div>' : ''}
|
|
140
|
-
${text ? `<div class="sdds-card-body">${text}</div>` : ''}
|
|
141
|
-
${footer ? `<div class="sdds-card-footer">${footer}</div>` : ''}
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
`);
|
|
145
|
-
export const Default = Template.bind({});
|
|
146
|
-
Default.args = {};
|
|
147
|
-
export const SupportText = Template.bind({});
|
|
148
|
-
SupportText.args = {
|
|
149
|
-
text: 'This is a short and consist detail text describing for the user what this text is really about.',
|
|
150
|
-
};
|
|
151
|
-
export const Divider = Template.bind({});
|
|
152
|
-
Divider.args = {
|
|
153
|
-
divider: true,
|
|
154
|
-
text: 'This is a short and consist detail text describing for the user what this text is really about.',
|
|
155
|
-
};
|
|
156
|
-
export const Link = Template.bind({});
|
|
157
|
-
Link.args = {
|
|
158
|
-
divider: true,
|
|
159
|
-
text: 'This is a short and consist detail text describing for the user what this text is really about.',
|
|
160
|
-
footer: '<a class="sdds-link sdds-link--no-underline" href="#">Link text</a><a class="sdds-link sdds-link--no-underline" href="#">Link text</a>',
|
|
161
|
-
};
|
|
162
|
-
export const Button = Template.bind({});
|
|
163
|
-
Button.args = {
|
|
164
|
-
divider: true,
|
|
165
|
-
text: 'This is a short and consist detail text describing for the user what this text is really about.',
|
|
166
|
-
footer: '<button class="sdds-btn sdds-btn-sm sdds-btn-primary">Button text</button>',
|
|
167
|
-
};
|
|
168
|
-
export const Image = Template.bind({});
|
|
169
|
-
Image.args = {
|
|
170
|
-
divider: true,
|
|
171
|
-
text: 'This is a short and consist detail text describing for the user what this text is really about.',
|
|
172
|
-
image: true,
|
|
173
|
-
imageTop: true,
|
|
174
|
-
};
|
|
175
|
-
export const Avatar = Template.bind({});
|
|
176
|
-
Avatar.args = {
|
|
177
|
-
avatar: true,
|
|
178
|
-
divider: false,
|
|
179
|
-
text: 'This is a short and consist detail text describing for the user what this text is really about.',
|
|
180
|
-
imageTop: false,
|
|
181
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { formatHtmlPreview } from '../../utils/utils';
|
|
2
|
-
export default {
|
|
3
|
-
title: 'Components/Checkbox',
|
|
4
|
-
parameters: {
|
|
5
|
-
layout: 'centered',
|
|
6
|
-
design: [
|
|
7
|
-
{
|
|
8
|
-
name: 'Figma',
|
|
9
|
-
type: 'figma',
|
|
10
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=9266%3A17409&t=rVXuTOgTmXPauyHd-1',
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
name: 'Link',
|
|
14
|
-
type: 'link',
|
|
15
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=9266%3A17409&t=rVXuTOgTmXPauyHd-1',
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
argTypes: {
|
|
20
|
-
disabled: {
|
|
21
|
-
name: 'Disabled',
|
|
22
|
-
description: 'Disables the checkbox',
|
|
23
|
-
control: {
|
|
24
|
-
type: 'boolean',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
checked: {
|
|
28
|
-
name: 'Checked',
|
|
29
|
-
description: 'Checks the checkbox',
|
|
30
|
-
control: {
|
|
31
|
-
type: 'boolean',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
label: {
|
|
35
|
-
name: 'Label text',
|
|
36
|
-
description: 'The label of the component',
|
|
37
|
-
type: 'string',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
args: {
|
|
41
|
-
disabled: false,
|
|
42
|
-
checked: false,
|
|
43
|
-
label: 'Label',
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
const Template = ({ checked, disabled, label }) => formatHtmlPreview(`
|
|
47
|
-
<div class="sdds-checkbox-item">
|
|
48
|
-
<input class="sdds-form-input" type="checkbox" id="unique-id" ${checked ? 'checked="checked"' : ''} ${disabled ? 'disabled' : ''}>
|
|
49
|
-
${label
|
|
50
|
-
? `<label class="sdds-form-label" for="unique-id" ${disabled ? 'disabled' : ''}> ${label} </label>`
|
|
51
|
-
: ''}
|
|
52
|
-
</div>
|
|
53
|
-
`);
|
|
54
|
-
export const Default = Template.bind({});
|