@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,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/Web Component',
106
- control: {
107
- type: 'radio',
108
- },
109
- options: ['Native', 'Web Component'],
110
- if: { arg: 'icon', neq: 'none' },
111
- },
112
- },
113
- args: {
114
- text: 'Button',
115
- btnType: 'Primary',
116
- size: 'Large',
117
- variant: 'On dark',
118
- fullbleed: false,
119
- disabled: false,
120
- onlyIcon: false,
121
- icon: 'none',
122
- iconType: 'Webcomponent',
123
- },
124
- };
125
- const WebComponentTemplate = ({ onlyIcon, size, variant, btnType, fullbleed, disabled, icon, iconType, text = 'Button', }) => {
126
- const btnTypeLookUp = {
127
- Primary: 'primary',
128
- Secondary: 'secondary',
129
- Ghost: 'ghost',
130
- Danger: 'danger',
131
- };
132
- const sizeLookUp = {
133
- 'Large': 'lg',
134
- 'Medium': 'md',
135
- 'Small': 'sm',
136
- 'Extra small': 'xs',
137
- };
138
- const varaintLookup = {
139
- 'On light': 'on-light',
140
- 'On dark': 'on-dark',
141
- };
142
- return formatHtmlPreview(`
143
- <style>
144
- /* demo-wrapper is for demonstration purposes only*/${icon && iconType === 'Native'
145
- ? `@import url('https://cdn.digitaldesign.scania.com/icons/webfont/css/sdds-icons.css');
146
- i.sdds-icon::before{
147
- font-size: ${size === 'Large' || size === 'Medium' ? '20' : '16'}px;
148
- }`
149
- : ''}
150
- .demo-wrapper{
151
- width: 100%;
152
- }
153
- </style>
154
-
155
- <div class="demo-wrapper">
156
- <sdds-button ${onlyIcon ? 'onlyIcon' : ''} type="${btnTypeLookUp[btnType]}" size="${sizeLookUp[size]}" ${disabled ? 'disabled' : ''} ${fullbleed ? 'fullbleed' : ''} text="${onlyIcon ? '' : text}" variant="${varaintLookup[variant]}" >
157
- ${onlyIcon || (icon && icon !== 'none')
158
- ? `
159
- ${iconType === 'Native'
160
- ? `<i class="sdds-btn-icon sdds-icon ${icon}" slot="icon"></i>`
161
- : `<sdds-icon slot="icon" class='sdds-btn-icon ' size='${sizeLookUp[size] == 'sm' ? '16px' : '20px'}' name='${icon}'></sdds-icon>`}
162
- `
163
- : ''}
164
- </sdds-button>
165
- </div>
166
- `);
167
- };
168
- /** Button as web component */
169
- export const WebComponent = WebComponentTemplate.bind({});
170
- WebComponent.args = {};
171
- export const WebComponentWithIcon = WebComponentTemplate.bind({});
172
- WebComponentWithIcon.args = {
173
- icon: 'truck',
174
- iconType: 'Webcomponent',
175
- };
176
- export const WebComponentOnlyIcon = WebComponentTemplate.bind({});
177
- WebComponentOnlyIcon.args = {
178
- text: '',
179
- iconType: 'Webcomponent',
180
- onlyIcon: true,
181
- icon: 'truck',
182
- };
@@ -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({});
@@ -1,124 +0,0 @@
1
- import { formatHtmlPreview } from '../../utils/utils';
2
- export default {
3
- title: 'Components/Chips',
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=11268%3A39456&t=rVXuTOgTmXPauyHd-1',
11
- },
12
- {
13
- name: 'Link',
14
- type: 'link',
15
- url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=11268%3A39456&t=rVXuTOgTmXPauyHd-1',
16
- },
17
- ],
18
- },
19
- argTypes: {
20
- placeholderText: {
21
- name: 'Placeholder',
22
- description: 'Set custom chip text',
23
- control: {
24
- type: 'text',
25
- },
26
- },
27
- icon: {
28
- name: 'Icon',
29
- description: 'Add an icon to the chip.',
30
- control: {
31
- type: 'boolean',
32
- },
33
- },
34
- iconType: {
35
- name: 'Icon type',
36
- description: 'Choose what icon type to use',
37
- control: {
38
- type: 'radio',
39
- },
40
- options: ['Native', 'Web Component'],
41
- if: { arg: 'icon', eq: true },
42
- },
43
- iconPosition: {
44
- name: 'Icon position',
45
- description: 'Set the placement of the icon',
46
- control: {
47
- type: 'radio',
48
- },
49
- options: ['Icon left', 'Icon right'],
50
- if: { arg: 'icon', eq: true },
51
- },
52
- state: {
53
- name: 'State',
54
- description: 'Set the chips state as active or default',
55
- control: {
56
- type: 'radio',
57
- },
58
- options: ['Default', 'Active'],
59
- },
60
- size: {
61
- name: 'Size',
62
- description: 'Set the chip size',
63
- control: {
64
- type: 'radio',
65
- },
66
- options: ['Default', 'Small'],
67
- },
68
- },
69
- args: {
70
- placeholderText: 'Chip text',
71
- icon: false,
72
- iconType: 'Native',
73
- iconPosition: 'Icon right',
74
- state: 'Default',
75
- size: 'Default',
76
- },
77
- };
78
- const Template = ({ icon, iconPosition, iconType, state, placeholderText, size }) => {
79
- const stateValue = state === 'Active' ? 'sdds-chip__active' : '';
80
- const sizeValue = size === 'Small' ? 'sdds-chip-sm' : '';
81
- const iconPositionLookup = {
82
- 'Icon left': 'sdds-chip__icon-left',
83
- 'Icon right': 'sdds-chip__icon-right',
84
- };
85
- // TODO - Add dark theme to story
86
- const iconSvg = `
87
- ${iconType === 'Native'
88
- ? '<i class="sdds-chip-icon sdds-icon notification"></i>'
89
- : '<sdds-icon class="sdds-chip-icon" name="notification" size="16px"></sdds-icon>'}
90
- `;
91
- return formatHtmlPreview(`
92
- ${iconType === 'Native'
93
- ? `<style>
94
- /* Note: In case you are using WebFont icons, please make sure to import icons css file in your implementation */
95
- @import url('https://cdn.digitaldesign.scania.com/icons/webfont/css/sdds-icons.css');
96
-
97
- </style>`
98
- : ''}
99
-
100
- <div class="sdds-chip ${icon ? iconPositionLookup[iconPosition] : ''} ${stateValue} ${sizeValue}">
101
- ${icon ? iconSvg : ''}<span class="sdds-chip-text">${placeholderText}</span>
102
- </div>
103
- `);
104
- };
105
- export const Default = Template.bind({});
106
- Default.args = {};
107
- export const IconRight = Template.bind({});
108
- IconRight.args = {
109
- icon: true,
110
- iconPosition: 'Icon right',
111
- };
112
- export const IconLeft = Template.bind({});
113
- IconLeft.args = {
114
- icon: true,
115
- iconPosition: 'Icon left',
116
- };
117
- export const Active = Template.bind({});
118
- Active.args = {
119
- state: 'Active',
120
- };
121
- export const Small = Template.bind({});
122
- Small.args = {
123
- size: 'Small',
124
- };