@scania/tegel 0.0.1-beta.6 → 0.0.1-beta.7

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.
Files changed (140) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/tegel.cjs.js +1 -1
  3. package/dist/collection/collection-manifest.json +2 -2
  4. package/dist/esm/loader.js +1 -1
  5. package/dist/esm/tegel.js +1 -1
  6. package/package.json +4 -4
  7. package/dist/collection/components/accordion/accordion.stories.js +0 -91
  8. package/dist/collection/components/badge/badge.stories.js +0 -101
  9. package/dist/collection/components/banner/banner.stories.js +0 -93
  10. package/dist/collection/components/block/block.stories.js +0 -46
  11. package/dist/collection/components/breadcrumb/breadcrumb.stories.js +0 -26
  12. package/dist/collection/components/button/button-native.stories.js +0 -183
  13. package/dist/collection/components/button/button-webcomponent.stories.js +0 -182
  14. package/dist/collection/components/card/card.stories.js +0 -181
  15. package/dist/collection/components/checkbox/checkbox.stories.js +0 -54
  16. package/dist/collection/components/chips/chips.stories.js +0 -124
  17. package/dist/collection/components/data-table/native-table.stories.js +0 -182
  18. package/dist/collection/components/data-table/table-component-basic.stories.js +0 -163
  19. package/dist/collection/components/data-table/table-component-batch-actions.stories.js +0 -129
  20. package/dist/collection/components/data-table/table-component-bodydata.stories.js +0 -58
  21. package/dist/collection/components/data-table/table-component-custom-width.stories.js +0 -198
  22. package/dist/collection/components/data-table/table-component-event-listeners.stories.js +0 -153
  23. package/dist/collection/components/data-table/table-component-expandable-rows.stories.js +0 -137
  24. package/dist/collection/components/data-table/table-component-filtering.stories.js +0 -139
  25. package/dist/collection/components/data-table/table-component-multiselect.stories.js +0 -160
  26. package/dist/collection/components/data-table/table-component-pagination.stories.js +0 -129
  27. package/dist/collection/components/data-table/table-component-sorting.stories.js +0 -107
  28. package/dist/collection/components/datetime/datetime.stories.js +0 -149
  29. package/dist/collection/components/divider/divider.stories.js +0 -116
  30. package/dist/collection/components/dropdown/dropdown-filter/dropdown-filter.stories.js +0 -130
  31. package/dist/collection/components/dropdown/dropdown-native.stories.js +0 -90
  32. package/dist/collection/components/dropdown/dropdown-wc-default.stories.js +0 -151
  33. package/dist/collection/components/dropdown/dropdown-wc-multiselect.stories.js +0 -146
  34. package/dist/collection/components/footer/footer.stories.js +0 -100
  35. package/dist/collection/components/header/header-all.stories.js +0 -217
  36. package/dist/collection/components/header/header-default.stories.js +0 -47
  37. package/dist/collection/components/header/header-inline.stories.js +0 -113
  38. package/dist/collection/components/header/header-search.stories.js +0 -263
  39. package/dist/collection/components/header/header-toolbar.stories.js +0 -204
  40. package/dist/collection/components/icon/icon-font.stories.js +0 -57
  41. package/dist/collection/components/icon/icon-web-component.stories.js +0 -51
  42. package/dist/collection/components/link/link.stories.js +0 -45
  43. package/dist/collection/components/message/message.stories.js +0 -117
  44. package/dist/collection/components/modal/modal-native.stories.js +0 -121
  45. package/dist/collection/components/modal/modal-webcomponent.stories.js +0 -78
  46. package/dist/collection/components/popover-canvas/popover-canvas.stories.js +0 -87
  47. package/dist/collection/components/popover-menu/popover-menu-icons.stories.js +0 -132
  48. package/dist/collection/components/popover-menu/popover-menu.stories.js +0 -109
  49. package/dist/collection/components/radio-button/radio-button.stories.js +0 -68
  50. package/dist/collection/components/side-menu/side-menu.stories.js +0 -182
  51. package/dist/collection/components/slider/slider.stories.js +0 -251
  52. package/dist/collection/components/spinner/spinner.stories.js +0 -59
  53. package/dist/collection/components/stepper/stepper.stories.js +0 -139
  54. package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.stories.js +0 -65
  55. package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.stories.js +0 -43
  56. package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.stories.js +0 -32
  57. package/dist/collection/components/textarea/textarea.stories.js +0 -149
  58. package/dist/collection/components/textfield/textfield.stories.js +0 -222
  59. package/dist/collection/components/toast/toast.stories.js +0 -119
  60. package/dist/collection/components/toggle/toggle.stories.js +0 -62
  61. package/dist/collection/components/tooltip/tooltip.stories.js +0 -113
  62. package/dist/collection/components/utility/colour/background-color.stories.js +0 -96
  63. package/dist/collection/components/utility/colour/text-color.stories.js +0 -94
  64. package/dist/collection/foundations-stories/colour/colour-brand.stories.js +0 -38
  65. package/dist/collection/foundations-stories/colour/colour-scales.stories.js +0 -71
  66. package/dist/collection/foundations-stories/colour/colour-semantic.stories.js +0 -40
  67. package/dist/collection/foundations-stories/grid/grid.stories.js +0 -386
  68. package/dist/collection/foundations-stories/spacing/spacing-element.stories.js +0 -100
  69. package/dist/collection/foundations-stories/spacing/spacing-layout.stories.js +0 -94
  70. package/dist/collection/foundations-stories/typography/typography-body.stories.js +0 -16
  71. package/dist/collection/foundations-stories/typography/typography-detail.stories.js +0 -17
  72. package/dist/collection/foundations-stories/typography/typography-headline.stories.js +0 -39
  73. package/dist/collection/foundations-stories/typography/typography-paragraph.stories.js +0 -12
  74. package/dist/types/components/accordion/accordion.stories.d.ts +0 -77
  75. package/dist/types/components/badge/badge.stories.d.ts +0 -66
  76. package/dist/types/components/banner/banner.stories.d.ts +0 -68
  77. package/dist/types/components/block/block.stories.d.ts +0 -31
  78. package/dist/types/components/breadcrumb/breadcrumb.stories.d.ts +0 -12
  79. package/dist/types/components/button/button-native.stories.d.ts +0 -144
  80. package/dist/types/components/button/button-webcomponent.stories.d.ts +0 -143
  81. package/dist/types/components/card/card.stories.d.ts +0 -114
  82. package/dist/types/components/checkbox/checkbox.stories.d.ts +0 -39
  83. package/dist/types/components/chips/chips.stories.d.ts +0 -81
  84. package/dist/types/components/data-table/native-table.stories.d.ts +0 -147
  85. package/dist/types/components/data-table/table-component-basic.stories.d.ts +0 -100
  86. package/dist/types/components/data-table/table-component-batch-actions.stories.d.ts +0 -98
  87. package/dist/types/components/data-table/table-component-bodydata.stories.d.ts +0 -38
  88. package/dist/types/components/data-table/table-component-custom-width.stories.d.ts +0 -147
  89. package/dist/types/components/data-table/table-component-event-listeners.stories.d.ts +0 -87
  90. package/dist/types/components/data-table/table-component-expandable-rows.stories.d.ts +0 -87
  91. package/dist/types/components/data-table/table-component-filtering.stories.d.ts +0 -100
  92. package/dist/types/components/data-table/table-component-multiselect.stories.d.ts +0 -100
  93. package/dist/types/components/data-table/table-component-pagination.stories.d.ts +0 -100
  94. package/dist/types/components/data-table/table-component-sorting.stories.d.ts +0 -79
  95. package/dist/types/components/datetime/datetime.stories.d.ts +0 -80
  96. package/dist/types/components/divider/divider.stories.d.ts +0 -72
  97. package/dist/types/components/dropdown/dropdown-filter/dropdown-filter.stories.d.ts +0 -73
  98. package/dist/types/components/dropdown/dropdown-native.stories.d.ts +0 -57
  99. package/dist/types/components/dropdown/dropdown-wc-default.stories.d.ts +0 -115
  100. package/dist/types/components/dropdown/dropdown-wc-multiselect.stories.d.ts +0 -115
  101. package/dist/types/components/footer/footer.stories.d.ts +0 -23
  102. package/dist/types/components/header/header-all.stories.d.ts +0 -29
  103. package/dist/types/components/header/header-default.stories.d.ts +0 -29
  104. package/dist/types/components/header/header-inline.stories.d.ts +0 -29
  105. package/dist/types/components/header/header-search.stories.d.ts +0 -29
  106. package/dist/types/components/header/header-toolbar.stories.d.ts +0 -29
  107. package/dist/types/components/icon/icon-font.stories.d.ts +0 -38
  108. package/dist/types/components/icon/icon-web-component.stories.d.ts +0 -38
  109. package/dist/types/components/link/link.stories.d.ts +0 -33
  110. package/dist/types/components/message/message.stories.d.ts +0 -67
  111. package/dist/types/components/modal/modal-native.stories.d.ts +0 -51
  112. package/dist/types/components/modal/modal-webcomponent.stories.d.ts +0 -44
  113. package/dist/types/components/popover-canvas/popover-canvas.stories.d.ts +0 -25
  114. package/dist/types/components/popover-menu/popover-menu-icons.stories.d.ts +0 -27
  115. package/dist/types/components/popover-menu/popover-menu.stories.d.ts +0 -27
  116. package/dist/types/components/radio-button/radio-button.stories.d.ts +0 -41
  117. package/dist/types/components/side-menu/side-menu.stories.d.ts +0 -42
  118. package/dist/types/components/slider/slider.stories.d.ts +0 -156
  119. package/dist/types/components/spinner/spinner.stories.d.ts +0 -37
  120. package/dist/types/components/stepper/stepper.stories.d.ts +0 -56
  121. package/dist/types/components/tabs/inline-tabs-default/inline-tabs.stories.d.ts +0 -41
  122. package/dist/types/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.stories.d.ts +0 -25
  123. package/dist/types/components/tabs/navigation-tabs/navigation-tabs.stories.d.ts +0 -13
  124. package/dist/types/components/textarea/textarea.stories.d.ts +0 -111
  125. package/dist/types/components/textfield/textfield.stories.d.ts +0 -176
  126. package/dist/types/components/toast/toast.stories.d.ts +0 -58
  127. package/dist/types/components/toggle/toggle.stories.d.ts +0 -42
  128. package/dist/types/components/tooltip/tooltip.stories.d.ts +0 -54
  129. package/dist/types/components/utility/colour/background-color.stories.d.ts +0 -58
  130. package/dist/types/components/utility/colour/text-color.stories.d.ts +0 -58
  131. package/dist/types/foundations-stories/colour/colour-brand.stories.d.ts +0 -13
  132. package/dist/types/foundations-stories/colour/colour-scales.stories.d.ts +0 -13
  133. package/dist/types/foundations-stories/colour/colour-semantic.stories.d.ts +0 -13
  134. package/dist/types/foundations-stories/grid/grid.stories.d.ts +0 -35
  135. package/dist/types/foundations-stories/spacing/spacing-element.stories.d.ts +0 -8
  136. package/dist/types/foundations-stories/spacing/spacing-layout.stories.d.ts +0 -8
  137. package/dist/types/foundations-stories/typography/typography-body.stories.d.ts +0 -8
  138. package/dist/types/foundations-stories/typography/typography-detail.stories.d.ts +0 -8
  139. package/dist/types/foundations-stories/typography/typography-headline.stories.d.ts +0 -21
  140. package/dist/types/foundations-stories/typography/typography-paragraph.stories.d.ts +0 -8
@@ -1,149 +0,0 @@
1
- import readme from './readme.md';
2
- import { formatHtmlPreview } from '../../utils/utils';
3
- export default {
4
- title: 'Components/Textarea',
5
- parameters: {
6
- notes: readme,
7
- layout: 'centered',
8
- design: [
9
- {
10
- name: 'Figma',
11
- type: 'figma',
12
- url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=1828%3A85238&t=Ne6myqwca5m00de7-1',
13
- },
14
- {
15
- name: 'Link',
16
- type: 'link',
17
- url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=1828%3A85238&t=Ne6myqwca5m00de7-1',
18
- },
19
- ],
20
- },
21
- argTypes: {
22
- placeholder: {
23
- name: 'Placeholder',
24
- description: 'Placeholder text',
25
- control: {
26
- type: 'text',
27
- },
28
- },
29
- disabled: {
30
- description: 'Set textfield to disabled state',
31
- name: 'Disabled',
32
- control: {
33
- type: 'boolean',
34
- },
35
- table: {
36
- defaultValue: { summary: false },
37
- },
38
- },
39
- readonly: {
40
- description: 'Set textfield to disabled state',
41
- name: 'Read only',
42
- control: {
43
- type: 'boolean',
44
- },
45
- table: {
46
- defaultValue: { summary: false },
47
- },
48
- },
49
- label: {
50
- description: 'Label text for specific textfield',
51
- name: 'Label text',
52
- control: {
53
- type: 'text',
54
- },
55
- },
56
- labelPosition: {
57
- name: 'Label position',
58
- control: {
59
- type: 'radio',
60
- },
61
- options: ['None', 'Inside', 'Outside'],
62
- description: 'Label text position',
63
- },
64
- helper: {
65
- name: 'Helper text',
66
- description: 'Add helper text for the textfield',
67
- control: {
68
- type: 'text',
69
- },
70
- },
71
- maxLength: {
72
- name: 'Max length',
73
- description: 'Set a maximum value of how long the text can be.',
74
- control: {
75
- type: 'number',
76
- },
77
- },
78
- rows: {
79
- name: 'Rows',
80
- description: 'Set the number of rows',
81
- control: {
82
- type: 'number',
83
- },
84
- },
85
- state: {
86
- name: 'State',
87
- description: 'Switch between success or error state',
88
- control: {
89
- type: 'radio',
90
- },
91
- options: ['Default', 'Success', 'Error'],
92
- },
93
- variant: {
94
- name: 'Mode Variant',
95
- description: 'The variant of the textarea',
96
- control: {
97
- type: 'radio',
98
- },
99
- options: ['Primary', 'Secondary'],
100
- },
101
- },
102
- args: {
103
- placeholder: 'Placeholder',
104
- disabled: false,
105
- readonly: false,
106
- label: 'Label',
107
- labelPosition: 'None',
108
- helper: '',
109
- maxLength: 0,
110
- rows: 5,
111
- state: 'Default',
112
- variant: 'Secondary',
113
- },
114
- };
115
- const Template = ({ placeholder, disabled, readonly, label, labelPosition, state, helper, maxLength, rows, variant, }) => {
116
- const maxlength = maxLength > 0 ? `max-length="${maxLength}"` : '';
117
- const variantValue = variant === 'Primary' ? 'primary' : 'secondary';
118
- const stateValue = state.toLowerCase();
119
- const labelPosLookup = {
120
- None: 'no-label',
121
- Inside: 'inside',
122
- Outside: 'outside',
123
- };
124
- return formatHtmlPreview(`
125
- <style>
126
- /* demo-wrapper is for demonstration purposes only*/
127
- .demo-wrapper {
128
- width: 400px;
129
- }
130
- </style>
131
-
132
- <div class="demo-wrapper">
133
- <sdds-textarea
134
- rows="${rows}"
135
- state="${stateValue}"
136
- label="${label}"
137
- mode-variant="${variantValue}"
138
- helper="${helper}"
139
- label-position="${labelPosLookup[labelPosition]}"
140
- ${disabled ? 'disabled' : ''}
141
- ${readonly ? 'read-only' : ''}
142
- placeholder="${placeholder}"
143
- ${maxlength}>
144
- </sdds-textarea>
145
- </div>
146
- `);
147
- };
148
- export const Default = Template.bind({});
149
- Default.args = {};
@@ -1,222 +0,0 @@
1
- import readme from './readme.md';
2
- import { formatHtmlPreview } from '../../utils/utils';
3
- export default {
4
- title: 'Components/Textfield',
5
- parameters: {
6
- notes: readme,
7
- layout: 'centered',
8
- design: [
9
- {
10
- name: 'Figma',
11
- type: 'figma',
12
- url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=1675%3A76544&t=Ne6myqwca5m00de7-1',
13
- },
14
- {
15
- name: 'Link',
16
- type: 'link',
17
- url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=1675%3A76544&t=Ne6myqwca5m00de7-1',
18
- },
19
- ],
20
- },
21
- argTypes: {
22
- placeholderText: {
23
- name: 'Placeholder',
24
- description: 'Placeholder text',
25
- control: {
26
- type: 'text',
27
- },
28
- },
29
- type: {
30
- name: 'Type',
31
- description: 'Which type of textfield',
32
- control: {
33
- type: 'radio',
34
- options: ['password', 'text'],
35
- },
36
- },
37
- size: {
38
- name: 'Size',
39
- description: 'Switch between different sizes',
40
- control: {
41
- type: 'radio',
42
- options: ['Large', 'Medium', 'Small'],
43
- },
44
- },
45
- minWidth: {
46
- name: 'No minimum width',
47
- description: 'Toggle the minimum width.',
48
- control: {
49
- type: 'boolean',
50
- },
51
- table: {
52
- defaultValue: { summary: false },
53
- },
54
- },
55
- disabled: {
56
- description: 'Set textfield to disabled state',
57
- name: 'Disabled',
58
- control: {
59
- type: 'boolean',
60
- },
61
- },
62
- readonly: {
63
- description: 'Set textfield to read only',
64
- name: 'Read Only',
65
- control: {
66
- type: 'boolean',
67
- },
68
- },
69
- label: {
70
- description: 'Label text for specific textfield',
71
- name: 'Label text',
72
- control: {
73
- type: 'text',
74
- },
75
- },
76
- labelPosition: {
77
- name: 'Label position',
78
- control: {
79
- type: 'radio',
80
- },
81
- options: ['None', 'Inside', 'Outside'],
82
- description: 'Label text position',
83
- },
84
- prefix: {
85
- name: 'Prefix',
86
- description: 'Add prefix symbol/text before the textfield',
87
- control: {
88
- type: 'boolean',
89
- },
90
- table: {
91
- defaultValue: { summary: false },
92
- },
93
- },
94
- prefixType: {
95
- name: 'Prefix type',
96
- description: 'Choose icon or text for prefix.',
97
- control: {
98
- type: 'radio',
99
- },
100
- options: ['Icon', 'Text'],
101
- if: { arg: 'prefix', eq: true },
102
- },
103
- suffix: {
104
- name: 'Suffix',
105
- description: 'Add suffix symbol/text after the textfield',
106
- control: {
107
- type: 'boolean',
108
- },
109
- table: {
110
- defaultValue: { summary: false },
111
- },
112
- },
113
- suffixType: {
114
- name: 'Suffix type',
115
- description: 'Choose icon or text for suffix.',
116
- control: {
117
- type: 'radio',
118
- },
119
- options: ['Icon', 'Text'],
120
- if: { arg: 'suffix', eq: true },
121
- },
122
- helper: {
123
- name: 'Helper text',
124
- description: 'Add helper text for the textfield',
125
- control: {
126
- type: 'text',
127
- },
128
- },
129
- maxLength: {
130
- name: 'Max length',
131
- description: 'Set a maximum value of how long the text can be.',
132
- control: {
133
- type: 'number',
134
- },
135
- },
136
- state: {
137
- name: 'State',
138
- description: 'Switch between success or error state',
139
- control: {
140
- type: 'radio',
141
- },
142
- options: ['Default', 'Success', 'Error'],
143
- },
144
- variant: {
145
- name: 'Mode Variant',
146
- description: 'The variant of the textarea',
147
- control: {
148
- type: 'radio',
149
- },
150
- options: ['Primary', 'Secondary'],
151
- },
152
- },
153
- args: {
154
- placeholderText: 'Placeholder',
155
- disabled: false,
156
- readonly: false,
157
- label: 'Label',
158
- labelPosition: 'None',
159
- helper: '',
160
- maxLength: 0,
161
- state: 'Default',
162
- variant: 'Secondary',
163
- suffix: false,
164
- suffixType: 'Icon',
165
- prefix: false,
166
- prefixType: 'Icon',
167
- minWidth: 'Default',
168
- size: 'Large',
169
- type: 'text',
170
- },
171
- };
172
- const Template = ({ type, placeholderText, size, minWidth, disabled, readonly, label, labelPosition, state, variant, helper, prefix, prefixType, suffix, suffixType, maxLength, }) => {
173
- const maxlength = maxLength > 0 ? `max-length="${maxLength}"` : '';
174
- const variantValue = variant === 'Primary' ? 'primary' : 'secondary';
175
- const stateValue = state.toLowerCase();
176
- const sizeLookUp = {
177
- Large: 'lg',
178
- Medium: 'md',
179
- Small: 'sm',
180
- };
181
- return formatHtmlPreview(`
182
- <style>
183
- /* demo-wrapper is for demonstration purposes only*/
184
- .demo-wrapper {
185
- width: 200px;
186
- height: 150px;
187
- }
188
- </style>
189
-
190
- <div class="demo-wrapper">
191
- <sdds-textfield
192
- type="${type}"
193
- size="${sizeLookUp[size]}"
194
- state="${stateValue}"
195
- mode-variant="${variantValue}"
196
- label="${label}"
197
- label-position="${labelPosition.toLowerCase()}"
198
- ${maxlength}
199
- ${disabled ? 'disabled' : ''}
200
- ${readonly ? 'readonly' : ''}
201
- ${minWidth ? 'no-min-width' : ''}
202
- placeholder="${placeholderText}" >
203
- ${prefix
204
- ? `
205
- <span slot="sdds-prefix">
206
- ${prefixType === 'Text' ? '$' : '<sdds-icon name="truck" size="20px"></sdds-icon> '}
207
- </span>`
208
- : ''}
209
- ${helper ? `<span slot='sdds-helper'>${helper}</span>` : ''}
210
- ${suffix
211
- ? `
212
- <span slot="sdds-suffix">
213
- ${suffixType === 'Text' ? '$' : '<sdds-icon name="truck" size="20px"></sdds-icon> '}
214
- </span>`
215
- : ''}
216
- </sdds-textfield>
217
- </div>
218
- `);
219
- };
220
- // ${true ? '<sdds-icon name="cross" slot="sdds-prefix"></sdds-icon>' : ''}
221
- export const Default = Template.bind({});
222
- Default.args = {};
@@ -1,119 +0,0 @@
1
- import { formatHtmlPreview } from '../../utils/utils';
2
- import { iconsNames } from '../icon/iconsArray';
3
- export default {
4
- title: 'Components/Toast',
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=5903%3A245536&t=Ne6myqwca5m00de7-1',
12
- },
13
- {
14
- name: 'Link',
15
- type: 'link',
16
- url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=5903%3A245536&t=Ne6myqwca5m00de7-1',
17
- },
18
- ],
19
- },
20
- argTypes: {
21
- toastType: {
22
- name: 'Message type',
23
- description: 'Changes the type of message',
24
- control: {
25
- type: 'radio',
26
- },
27
- options: ['Success', 'Info', 'Warning', 'Error'],
28
- },
29
- subheader: {
30
- name: 'Subheader',
31
- description: 'Adds a subheader',
32
- },
33
- link: {
34
- name: 'Link',
35
- description: 'Adds a CTA link',
36
- },
37
- iconType: {
38
- name: 'Icon type',
39
- description: 'Native/Web Component',
40
- control: {
41
- type: 'radio',
42
- },
43
- options: ['Native', 'Web Component'],
44
- },
45
- icon: {
46
- name: 'Icon',
47
- description: 'Icon to display on the button. Choose "none" to exclude the icon, or choose "recommended" to pick the icon that is recommended for the type of toast.',
48
- control: {
49
- type: 'select',
50
- },
51
- options: ['none', 'recommended', ...iconsNames],
52
- if: { arg: 'size', neq: 'xs' },
53
- },
54
- },
55
- args: {
56
- toastType: 'Success',
57
- subheader: false,
58
- link: false,
59
- iconType: 'Webcomponent',
60
- icon: 'recommended',
61
- },
62
- };
63
- const typeLookup = {
64
- Success: 'success',
65
- Info: 'info',
66
- Warning: 'warning',
67
- Error: 'error',
68
- };
69
- const iconLookup = {
70
- Success: 'tick',
71
- Info: 'info',
72
- Warning: 'warning',
73
- Error: 'error',
74
- };
75
- const Template = ({ toastType, subheader, link, iconType, icon }) => {
76
- const iconValue = icon === 'recommended' ? iconLookup[toastType] : icon;
77
- return formatHtmlPreview(`
78
- ${iconType === 'Native'
79
- ? `
80
- <style>
81
- /* Note: In case using WebFont icons, please make sure to import icons css file in your implementation */
82
- @import url('https://cdn.digitaldesign.scania.com/icons/webfont/css/sdds-icons.css');
83
-
84
- </style>
85
- `
86
- : ''}
87
- <div class="sdds-toast sdds-toast-${typeLookup[toastType]}">
88
- ${icon === 'none'
89
- ? ''
90
- : `
91
- <div class="sdds-toast-icon">
92
- ${iconType === 'Native'
93
- ? `<i class="sdds-icon ${iconValue}"></i>`
94
- : `<sdds-icon name="${iconValue}" size="20px"></sdds-icon>
95
- `}
96
- </div>
97
- `}
98
- <div class="sdds-toast-content">
99
- <div class="sdds-toast-header">
100
- <span class="sdds-toast-headline">This is ${toastType === 'Success' || toastType === 'Warning' ? 'a' : 'an'} ${toastType.toLowerCase()} message</span>
101
- <button type="button" aria-label="close" class="sdds-toast-dismiss">
102
- ${iconType === 'Native'
103
- ? `<i class="sdds-icon cross"></i>`
104
- : `<sdds-icon name="cross" size="20px"></sdds-icon>
105
- `}
106
- </button>
107
- </div>
108
- ${subheader || link
109
- ? `\n<div class="sdds-toast-body">\
110
- ${subheader ? '\n<span class="sdds-toast-subheadline">Short subheader</span>' : ''}\
111
- ${link ? '\n<a class="sdds-toast-link" href="#">Link example</a>' : ''}
112
- </div> `
113
- : ''}
114
- </div>
115
- </div>
116
- `);
117
- };
118
- export const Default = Template.bind({});
119
- Default.args = {};
@@ -1,62 +0,0 @@
1
- import { formatHtmlPreview } from '../../utils/utils';
2
- export default {
3
- title: 'Components/Toggle',
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=2479%3A108951&t=Ne6myqwca5m00de7-1',
11
- },
12
- {
13
- name: 'Link',
14
- type: 'link',
15
- url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=2479%3A108951&t=Ne6myqwca5m00de7-1',
16
- },
17
- ],
18
- },
19
- argTypes: {
20
- size: {
21
- name: 'Size',
22
- control: {
23
- type: 'radio',
24
- },
25
- options: ['Default', 'Small'],
26
- description: 'Size of the toggle',
27
- },
28
- headline: {
29
- name: 'Headline',
30
- description: 'Optional value to be used to clarify what the toggle is switching on / off',
31
- control: {
32
- type: 'text',
33
- },
34
- },
35
- disabled: {
36
- name: 'Disabled',
37
- description: 'Should it be disabled?',
38
- control: {
39
- type: 'boolean',
40
- },
41
- },
42
- },
43
- args: {
44
- size: 'Default',
45
- headline: '',
46
- disabled: false,
47
- },
48
- };
49
- const Template = ({ size, disabled = false, headline = '' }) => {
50
- const sizeValue = size === 'Small' ? 'sdds-toggle-sm' : '';
51
- const headlineDiv = headline.length > 0 ? `<div class="sdds-toggle-headline">${headline}</div>` : '';
52
- return formatHtmlPreview(`
53
- <div class="sdds-toggle ${sizeValue} ${disabled ? 'disabled' : ''}" tabindex="0">
54
- ${headlineDiv}
55
- <input type="checkbox" class="sdds-toggle-input" id="customSwitch1" ${disabled ? 'disabled' : ''}>
56
- <span class="sdds-toggle-switch"></span>
57
- <label class="sdds-toggle-label" for="customSwitch1">Toggle this switch element</label>
58
- </div>
59
- `);
60
- };
61
- export const Default = Template.bind({});
62
- Default.args = {};
@@ -1,113 +0,0 @@
1
- import { formatHtmlPreview } from '../../utils/utils';
2
- import readme from './readme.md';
3
- export default {
4
- title: 'Components/Tooltip',
5
- parameters: {
6
- layout: 'centered',
7
- notes: readme,
8
- docs: {
9
- source: {
10
- state: 'closed',
11
- },
12
- },
13
- design: [
14
- {
15
- name: 'Figma',
16
- type: 'figma',
17
- url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=2620%3A4152&t=Ne6myqwca5m00de7-1',
18
- },
19
- {
20
- name: 'Link',
21
- type: 'link',
22
- url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=2620%3A4152&t=Ne6myqwca5m00de7-1',
23
- },
24
- ],
25
- },
26
- argTypes: {
27
- tooltipPosition: {
28
- name: 'Tooltip position',
29
- control: {
30
- type: 'select',
31
- options: [
32
- 'Bottom-start',
33
- 'Bottom',
34
- 'Bottom-end',
35
- 'Top-start',
36
- 'Top',
37
- 'Top-end',
38
- 'Left-start',
39
- 'Left',
40
- 'Left-end',
41
- 'Right-start',
42
- 'Right',
43
- 'Right-end',
44
- ],
45
- },
46
- description: 'Position of the tooltip',
47
- },
48
- text: {
49
- name: 'Tooltip text',
50
- description: 'Text that will be displayed inside tooltip',
51
- control: {
52
- type: 'text',
53
- },
54
- },
55
- slot: {
56
- name: 'Tooltip html content',
57
- description: 'A slot for the tooltip to pass in html.',
58
- control: {
59
- type: 'text',
60
- },
61
- },
62
- mouseOverTooltip: {
63
- name: 'Open while hovering over tooltip',
64
- control: 'boolean',
65
- description: 'Keep the tooltip visible as long as the mouse hover over it',
66
- },
67
- },
68
- args: {
69
- tooltipPosition: 'Bottom',
70
- text: 'Text inside tooltip',
71
- slot: '<p class="sdds-detail-05 sdds-u-m0"> Paragraph tag inside of Tooltip with <b>bold</b> and <i>italic</i> tags too. </p>',
72
- mouseOverTooltip: true,
73
- },
74
- };
75
- const positionLookup = {
76
- 'Bottom-start': 'bottom-start',
77
- 'Bottom': 'bottom',
78
- 'Bottom-end': 'bottom-end',
79
- 'Top-start': 'top-start',
80
- 'Top': 'top',
81
- 'Top-end': 'top-end',
82
- 'Left-start': 'left-start',
83
- 'Left': 'left',
84
- 'Left-end': 'left-end',
85
- 'Right-start': 'right-start',
86
- 'Right': 'right',
87
- 'Right-end': 'right-end',
88
- };
89
- const ComponentTooltip = ({ tooltipPosition, mouseOverTooltip, text, slot }) => formatHtmlPreview(`
90
- <style>
91
- /* demo-wrapper is for demonstration purposes only*/
92
- .demo-wrapper{
93
- height: 300px;
94
- display: flex;
95
- justify-content: center;
96
- align-items: center;
97
- }
98
- </style>
99
-
100
- <div class="demo-wrapper">
101
- <sdds-tooltip
102
- placement="${positionLookup[tooltipPosition]}"
103
- selector="#button-1"
104
- text="${text}"
105
- mouse-over-tooltip="${mouseOverTooltip}">
106
- ${slot}
107
- </sdds-tooltip>
108
-
109
- <!-- Demo button for presentation purposes -->
110
- <sdds-button size= 'sm' id="button-1" text='Hover me'></sdds-button>
111
- </div>
112
- `);
113
- export const Default = ComponentTooltip.bind({});