@scania/tegel 0.0.1-beta.3 → 0.0.1-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/dist/cjs/index-e1c79686.js +1912 -0
  2. package/dist/cjs/index.cjs.js +2 -0
  3. package/dist/cjs/loader.cjs.js +21 -0
  4. package/dist/cjs/popper-11d5f714.js +1801 -0
  5. package/dist/cjs/sdds-accordion-item.cjs.entry.js +34 -0
  6. package/dist/cjs/sdds-accordion.cjs.entry.js +21 -0
  7. package/dist/cjs/sdds-badges.cjs.entry.js +55 -0
  8. package/dist/cjs/sdds-body-cell_2.cjs.entry.js +173 -0
  9. package/dist/cjs/sdds-button.cjs.entry.js +36 -0
  10. package/dist/cjs/sdds-datetime.cjs.entry.js +66 -0
  11. package/dist/cjs/sdds-dropdown-filter.cjs.entry.js +92 -0
  12. package/dist/cjs/sdds-dropdown_2.cjs.entry.js +335 -0
  13. package/dist/cjs/sdds-header-cell.cjs.entry.js +141 -0
  14. package/dist/cjs/sdds-icon.cjs.entry.js +42 -0
  15. package/dist/cjs/sdds-inline-tabs-fullbleed.cjs.entry.js +96 -0
  16. package/dist/cjs/sdds-inline-tabs.cjs.entry.js +211 -0
  17. package/dist/cjs/sdds-modal.cjs.entry.js +49 -0
  18. package/dist/cjs/sdds-navigation-tabs.cjs.entry.js +95 -0
  19. package/dist/cjs/sdds-popover-canvas.cjs.entry.js +76 -0
  20. package/dist/cjs/sdds-popover-menu.cjs.entry.js +75 -0
  21. package/dist/cjs/sdds-slider.cjs.entry.js +336 -0
  22. package/dist/cjs/sdds-spinner.cjs.entry.js +21 -0
  23. package/dist/cjs/sdds-table-body-row-expandable.cjs.entry.js +81 -0
  24. package/dist/cjs/sdds-table-body.cjs.entry.js +289 -0
  25. package/dist/cjs/sdds-table-footer.cjs.entry.js +165 -0
  26. package/dist/cjs/sdds-table-header.cjs.entry.js +100 -0
  27. package/dist/cjs/sdds-table-toolbar.cjs.entry.js +66 -0
  28. package/dist/cjs/sdds-table.cjs.entry.js +69 -0
  29. package/dist/cjs/sdds-textarea.cjs.entry.js +61 -0
  30. package/dist/cjs/sdds-textfield.cjs.entry.js +82 -0
  31. package/dist/cjs/sdds-tooltip.cjs.entry.js +95 -0
  32. package/dist/cjs/tegel.cjs.js +19 -0
  33. package/dist/collection/collection-manifest.json +40 -0
  34. package/dist/collection/components/accordion/accordion-item/accordion-item.css +134 -0
  35. package/dist/collection/components/accordion/accordion-item/accordion-item.js +146 -0
  36. package/dist/collection/components/accordion/accordion.css +77 -0
  37. package/dist/collection/components/accordion/accordion.js +62 -0
  38. package/dist/collection/components/accordion/accordion.stories.js +91 -0
  39. package/dist/collection/components/badge/badge.stories.js +101 -0
  40. package/dist/collection/components/badge/badges.css +42 -0
  41. package/dist/collection/components/badge/badges.js +150 -0
  42. package/dist/collection/components/banner/banner.stories.js +93 -0
  43. package/dist/collection/components/block/block.stories.js +46 -0
  44. package/dist/collection/components/breadcrumb/breadcrumb.stories.js +26 -0
  45. package/dist/collection/components/button/button-component.js +154 -0
  46. package/dist/collection/components/button/button-native.stories.js +183 -0
  47. package/dist/collection/components/button/button-webcomponent.stories.js +182 -0
  48. package/dist/collection/components/button/button.css +658 -0
  49. package/dist/collection/components/card/card.stories.js +181 -0
  50. package/dist/collection/components/checkbox/checkbox.stories.js +54 -0
  51. package/dist/collection/components/chips/chips.stories.js +124 -0
  52. package/dist/collection/components/data-table/native-table.stories.js +182 -0
  53. package/dist/collection/components/data-table/table/table.css +15 -0
  54. package/dist/collection/components/data-table/table/table.js +253 -0
  55. package/dist/collection/components/data-table/table-body/table-body.css +22 -0
  56. package/dist/collection/components/data-table/table-body/table-body.js +425 -0
  57. package/dist/collection/components/data-table/table-body-cell/table-body-cell.css +40 -0
  58. package/dist/collection/components/data-table/table-body-cell/table-body-cell.js +169 -0
  59. package/dist/collection/components/data-table/table-body-row/table-body-row.css +196 -0
  60. package/dist/collection/components/data-table/table-body-row/table-body-row.js +164 -0
  61. package/dist/collection/components/data-table/table-body-row-expandable/table-body-row-expandable.css +79 -0
  62. package/dist/collection/components/data-table/table-body-row-expandable/table-body-row-expandable.js +155 -0
  63. package/dist/collection/components/data-table/table-component-basic.stories.js +163 -0
  64. package/dist/collection/components/data-table/table-component-batch-actions.stories.js +129 -0
  65. package/dist/collection/components/data-table/table-component-bodydata.stories.js +58 -0
  66. package/dist/collection/components/data-table/table-component-custom-width.stories.js +198 -0
  67. package/dist/collection/components/data-table/table-component-event-listeners.stories.js +153 -0
  68. package/dist/collection/components/data-table/table-component-expandable-rows.stories.js +137 -0
  69. package/dist/collection/components/data-table/table-component-filtering.stories.js +139 -0
  70. package/dist/collection/components/data-table/table-component-multiselect.stories.js +160 -0
  71. package/dist/collection/components/data-table/table-component-pagination.stories.js +129 -0
  72. package/dist/collection/components/data-table/table-component-sorting.stories.js +107 -0
  73. package/dist/collection/components/data-table/table-footer/table-footer.css +93 -0
  74. package/dist/collection/components/data-table/table-footer/table-footer.js +355 -0
  75. package/dist/collection/components/data-table/table-header/table-header.css +204 -0
  76. package/dist/collection/components/data-table/table-header/table-header.js +153 -0
  77. package/dist/collection/components/data-table/table-header-cell/table-header-cell.css +126 -0
  78. package/dist/collection/components/data-table/table-header-cell/table-header-cell.js +320 -0
  79. package/dist/collection/components/data-table/table-toolbar/table-toolbar.css +92 -0
  80. package/dist/collection/components/data-table/table-toolbar/table-toolbar.js +142 -0
  81. package/dist/collection/components/datetime/datetime.css +375 -0
  82. package/dist/collection/components/datetime/datetime.js +251 -0
  83. package/dist/collection/components/datetime/datetime.stories.js +149 -0
  84. package/dist/collection/components/divider/divider.stories.js +116 -0
  85. package/dist/collection/components/dropdown/dropdown-filter/dropdown-filter.js +339 -0
  86. package/dist/collection/components/dropdown/dropdown-filter/dropdown-filter.stories.js +130 -0
  87. package/dist/collection/components/dropdown/dropdown-native.stories.js +90 -0
  88. package/dist/collection/components/dropdown/dropdown-option/dropdown-option.js +185 -0
  89. package/dist/collection/components/dropdown/dropdown-wc-default.stories.js +151 -0
  90. package/dist/collection/components/dropdown/dropdown-wc-multiselect.stories.js +146 -0
  91. package/dist/collection/components/dropdown/dropdown.css +891 -0
  92. package/dist/collection/components/dropdown/dropdown.js +554 -0
  93. package/dist/collection/components/footer/footer.stories.js +100 -0
  94. package/dist/collection/components/header/header-all.stories.js +217 -0
  95. package/dist/collection/components/header/header-default.stories.js +47 -0
  96. package/dist/collection/components/header/header-inline.stories.js +113 -0
  97. package/dist/collection/components/header/header-search.stories.js +263 -0
  98. package/dist/collection/components/header/header-toolbar.stories.js +204 -0
  99. package/dist/collection/components/icon/icon-font.stories.js +57 -0
  100. package/dist/collection/components/icon/icon-web-component.stories.js +51 -0
  101. package/dist/collection/components/icon/icon.css +16 -0
  102. package/dist/collection/components/icon/icon.js +89 -0
  103. package/dist/collection/components/icon/iconsArray.js +2 -0
  104. package/dist/collection/components/link/link.stories.js +45 -0
  105. package/dist/collection/components/message/message.stories.js +117 -0
  106. package/dist/collection/components/modal/modal-native.stories.js +121 -0
  107. package/dist/collection/components/modal/modal-webcomponent.stories.js +78 -0
  108. package/dist/collection/components/modal/modal.css +324 -0
  109. package/dist/collection/components/modal/modal.js +146 -0
  110. package/dist/collection/components/popover-canvas/popover-canvas.css +20 -0
  111. package/dist/collection/components/popover-canvas/popover-canvas.js +190 -0
  112. package/dist/collection/components/popover-canvas/popover-canvas.stories.js +87 -0
  113. package/dist/collection/components/popover-menu/popover-menu-icons.stories.js +132 -0
  114. package/dist/collection/components/popover-menu/popover-menu.css +19 -0
  115. package/dist/collection/components/popover-menu/popover-menu.js +189 -0
  116. package/dist/collection/components/popover-menu/popover-menu.stories.js +109 -0
  117. package/dist/collection/components/radio-button/radio-button.stories.js +68 -0
  118. package/dist/collection/components/side-menu/side-menu.stories.js +182 -0
  119. package/dist/collection/components/slider/slider.css +260 -0
  120. package/dist/collection/components/slider/slider.js +682 -0
  121. package/dist/collection/components/slider/slider.stories.js +251 -0
  122. package/dist/collection/components/spinner/spinner.css +79 -0
  123. package/dist/collection/components/spinner/spinner.js +61 -0
  124. package/dist/collection/components/spinner/spinner.stories.js +59 -0
  125. package/dist/collection/components/stepper/stepper.stories.js +139 -0
  126. package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.css +159 -0
  127. package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.js +302 -0
  128. package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.stories.js +65 -0
  129. package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.css +172 -0
  130. package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.js +126 -0
  131. package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.stories.js +43 -0
  132. package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.css +153 -0
  133. package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.js +103 -0
  134. package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.stories.js +32 -0
  135. package/dist/collection/components/textarea/textarea.css +283 -0
  136. package/dist/collection/components/textarea/textarea.js +336 -0
  137. package/dist/collection/components/textarea/textarea.stories.js +149 -0
  138. package/dist/collection/components/textfield/textfield.css +494 -0
  139. package/dist/collection/components/textfield/textfield.js +359 -0
  140. package/dist/collection/components/textfield/textfield.stories.js +222 -0
  141. package/dist/collection/components/toast/toast.stories.js +119 -0
  142. package/dist/collection/components/toggle/toggle.stories.js +62 -0
  143. package/dist/collection/components/tooltip/tooltip.css +46 -0
  144. package/dist/collection/components/tooltip/tooltip.js +200 -0
  145. package/dist/collection/components/tooltip/tooltip.stories.js +113 -0
  146. package/dist/collection/components/utility/colour/background-color.stories.js +96 -0
  147. package/dist/collection/components/utility/colour/text-color.stories.js +94 -0
  148. package/dist/collection/foundations-stories/colour/colour-brand.stories.js +38 -0
  149. package/dist/collection/foundations-stories/colour/colour-scales.stories.js +71 -0
  150. package/dist/collection/foundations-stories/colour/colour-semantic.stories.js +40 -0
  151. package/dist/collection/foundations-stories/grid/grid.stories.js +386 -0
  152. package/dist/collection/foundations-stories/spacing/spacing-element.stories.js +100 -0
  153. package/dist/collection/foundations-stories/spacing/spacing-layout.stories.js +94 -0
  154. package/dist/collection/foundations-stories/typography/typography-body.stories.js +16 -0
  155. package/dist/collection/foundations-stories/typography/typography-detail.stories.js +17 -0
  156. package/dist/collection/foundations-stories/typography/typography-headline.stories.js +39 -0
  157. package/dist/collection/foundations-stories/typography/typography-paragraph.stories.js +12 -0
  158. package/dist/collection/index.js +1 -0
  159. package/dist/collection/stories/assets/code-brackets.svg +1 -0
  160. package/dist/collection/stories/assets/colors.svg +1 -0
  161. package/dist/collection/stories/assets/comments.svg +1 -0
  162. package/dist/collection/stories/assets/direction.svg +1 -0
  163. package/dist/collection/stories/assets/flow.svg +1 -0
  164. package/dist/collection/stories/assets/plugin.svg +1 -0
  165. package/dist/collection/stories/assets/repo.svg +1 -0
  166. package/dist/collection/stories/assets/stackalt.svg +1 -0
  167. package/dist/collection/utils/utils.js +12 -0
  168. package/dist/esm/index-b67b15a6.js +1884 -0
  169. package/dist/esm/index.js +1 -0
  170. package/dist/esm/loader.js +17 -0
  171. package/dist/esm/polyfills/core-js.js +11 -0
  172. package/dist/esm/polyfills/css-shim.js +1 -0
  173. package/dist/esm/polyfills/dom.js +79 -0
  174. package/dist/esm/polyfills/es5-html-element.js +1 -0
  175. package/dist/esm/polyfills/index.js +34 -0
  176. package/dist/esm/polyfills/system.js +6 -0
  177. package/dist/esm/popper-f860750c.js +1799 -0
  178. package/dist/esm/sdds-accordion-item.entry.js +30 -0
  179. package/dist/esm/sdds-accordion.entry.js +17 -0
  180. package/dist/esm/sdds-badges.entry.js +51 -0
  181. package/dist/esm/sdds-body-cell_2.entry.js +168 -0
  182. package/dist/esm/sdds-button.entry.js +32 -0
  183. package/dist/esm/sdds-datetime.entry.js +62 -0
  184. package/dist/esm/sdds-dropdown-filter.entry.js +88 -0
  185. package/dist/esm/sdds-dropdown_2.entry.js +330 -0
  186. package/dist/esm/sdds-header-cell.entry.js +137 -0
  187. package/dist/esm/sdds-icon.entry.js +38 -0
  188. package/dist/esm/sdds-inline-tabs-fullbleed.entry.js +92 -0
  189. package/dist/esm/sdds-inline-tabs.entry.js +207 -0
  190. package/dist/esm/sdds-modal.entry.js +45 -0
  191. package/dist/esm/sdds-navigation-tabs.entry.js +91 -0
  192. package/dist/esm/sdds-popover-canvas.entry.js +72 -0
  193. package/dist/esm/sdds-popover-menu.entry.js +71 -0
  194. package/dist/esm/sdds-slider.entry.js +332 -0
  195. package/dist/esm/sdds-spinner.entry.js +17 -0
  196. package/dist/esm/sdds-table-body-row-expandable.entry.js +77 -0
  197. package/dist/esm/sdds-table-body.entry.js +285 -0
  198. package/dist/esm/sdds-table-footer.entry.js +161 -0
  199. package/dist/esm/sdds-table-header.entry.js +96 -0
  200. package/dist/esm/sdds-table-toolbar.entry.js +62 -0
  201. package/dist/esm/sdds-table.entry.js +65 -0
  202. package/dist/esm/sdds-textarea.entry.js +57 -0
  203. package/dist/esm/sdds-textfield.entry.js +78 -0
  204. package/dist/esm/sdds-tooltip.entry.js +91 -0
  205. package/dist/esm/tegel.js +17 -0
  206. package/dist/index.cjs.js +1 -0
  207. package/dist/index.js +1 -0
  208. package/dist/tegel/index.esm.js +0 -0
  209. package/dist/tegel/p-040efb32.entry.js +1 -0
  210. package/dist/tegel/p-12ca5cfa.entry.js +1 -0
  211. package/dist/tegel/p-157e1618.js +2 -0
  212. package/dist/tegel/p-1fe61cf6.entry.js +1 -0
  213. package/dist/tegel/p-2f376504.entry.js +1 -0
  214. package/dist/tegel/p-44ced895.entry.js +1 -0
  215. package/dist/tegel/p-4880f03d.entry.js +1 -0
  216. package/dist/tegel/p-4aba73a3.entry.js +1 -0
  217. package/dist/tegel/p-4b58a02c.entry.js +1 -0
  218. package/dist/tegel/p-4cb85347.entry.js +1 -0
  219. package/dist/tegel/p-52031b5a.entry.js +1 -0
  220. package/dist/tegel/p-677baf7f.entry.js +1 -0
  221. package/dist/tegel/p-71797eaf.entry.js +1 -0
  222. package/dist/tegel/p-7373284c.entry.js +1 -0
  223. package/dist/tegel/p-7451779b.entry.js +1 -0
  224. package/dist/tegel/p-77aeea3b.entry.js +1 -0
  225. package/dist/tegel/p-8582d6a7.entry.js +1 -0
  226. package/dist/tegel/p-96021bd0.entry.js +1 -0
  227. package/dist/tegel/p-9d8caf51.entry.js +1 -0
  228. package/dist/tegel/p-a5919930.entry.js +1 -0
  229. package/dist/tegel/p-b01cface.entry.js +1 -0
  230. package/dist/tegel/p-bf896643.entry.js +1 -0
  231. package/dist/tegel/p-c311725c.entry.js +1 -0
  232. package/dist/tegel/p-cf72dfd9.entry.js +1 -0
  233. package/dist/tegel/p-d91caec6.entry.js +1 -0
  234. package/dist/tegel/p-e10eec33.entry.js +1 -0
  235. package/dist/tegel/p-ec26fc38.js +1 -0
  236. package/dist/tegel/p-f2262a69.entry.js +1 -0
  237. package/dist/tegel/p-f2f7aa45.entry.js +1 -0
  238. package/dist/tegel/tegel.css +101 -0
  239. package/dist/tegel/tegel.esm.js +1 -0
  240. package/loader/cdn.js +3 -0
  241. package/loader/index.cjs.js +3 -0
  242. package/loader/index.d.ts +12 -0
  243. package/loader/index.es2017.js +3 -0
  244. package/loader/index.js +4 -0
  245. package/loader/package.json +11 -0
  246. package/package.json +1 -1
@@ -0,0 +1,117 @@
1
+ import { formatHtmlPreview } from '../../utils/utils';
2
+ export default {
3
+ title: 'Components/Message',
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=11884%3A47370&t=Ne6myqwca5m00de7-1',
11
+ },
12
+ {
13
+ name: 'Link',
14
+ type: 'link',
15
+ url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=11884%3A47370&t=Ne6myqwca5m00de7-1',
16
+ },
17
+ ],
18
+ },
19
+ argTypes: {
20
+ messageType: {
21
+ name: 'Message Type',
22
+ description: 'The type of the message.',
23
+ control: {
24
+ type: 'radio',
25
+ },
26
+ options: ['Information', 'Error', 'Warning', 'Success'],
27
+ },
28
+ variant: {
29
+ name: 'Variant',
30
+ description: 'The variant of the message, on-dark/on-light',
31
+ control: {
32
+ type: 'radio',
33
+ },
34
+ options: ['On dark', 'On light'],
35
+ },
36
+ icon: {
37
+ name: 'Icon',
38
+ description: 'Show icon',
39
+ control: {
40
+ type: 'boolean',
41
+ },
42
+ },
43
+ iconType: {
44
+ name: 'Icon',
45
+ description: 'Switch between show a native/web component icon.',
46
+ control: {
47
+ type: 'radio',
48
+ },
49
+ options: ['Native', 'Web Component'],
50
+ if: { arg: 'icon', eq: true },
51
+ },
52
+ showExtendedMessage: {
53
+ name: 'Extended Message',
54
+ description: 'Show an extended message',
55
+ control: {
56
+ type: 'boolean',
57
+ },
58
+ },
59
+ },
60
+ args: {
61
+ messageType: 'Information',
62
+ variant: 'On light',
63
+ icon: false,
64
+ iconType: 'Webcomponent',
65
+ showExtendedMessage: false,
66
+ },
67
+ };
68
+ const nativeIconNameLookup = {
69
+ Information: 'info',
70
+ Error: 'error',
71
+ Warning: 'warning',
72
+ Success: 'tick',
73
+ };
74
+ const Template = ({ messageType, icon, iconType, showExtendedMessage, variant }) => {
75
+ const messageTypeClass = messageType === 'Information'
76
+ ? 'sdds-message-type-informative'
77
+ : `sdds-message-type-${messageType.toLowerCase()}`;
78
+ const iconClass = messageType === 'Information'
79
+ ? 'sdds-message-icon-informative'
80
+ : `sdds-message-icon-${messageType.toLowerCase()}`;
81
+ const variantValue = variant === 'On dark' ? 'sdds-message-ongrey' : '';
82
+ const iconHtml = iconType === 'Native'
83
+ ? `<i class="sdds-message-icon sdds-icon ${iconClass} ${nativeIconNameLookup[messageType]}"></i>`
84
+ : `<div><sdds-icon class="sdds-message-icon ${iconClass}" name="${nativeIconNameLookup[messageType]}" size="20"></sdds-icon></div>`;
85
+ return formatHtmlPreview(`
86
+
87
+ ${iconType === 'Native'
88
+ ? `<style>
89
+ /* Note: In case using WebFont icons, please make sure to import icons css file in your implementation */
90
+ @import url('https://cdn.digitaldesign.scania.com/icons/webfont/css/sdds-icons.css');
91
+ </style>`
92
+ : ''}
93
+
94
+ <div class="sdds-message ${messageTypeClass} ${icon ? 'sdds-message-icon-active' : ''} ${showExtendedMessage ? 'sdds-message-extended-active' : ''} ${variantValue}">
95
+ ${icon ? iconHtml : ''}
96
+ <h4 class="sdds-message-single">
97
+ Single line message goes here.
98
+ </h4>
99
+ ${showExtendedMessage
100
+ ? '<p class="sdds-message-extended">Longer message text can be placed here. Longer message text can be placed here. Longer message text can be placed here.</p>'
101
+ : ''}
102
+ </div>
103
+ `);
104
+ };
105
+ export const Information = Template.bind({});
106
+ export const Error = Template.bind({});
107
+ Error.args = {
108
+ messageType: 'Error',
109
+ };
110
+ export const Warning = Template.bind({});
111
+ Warning.args = {
112
+ messageType: 'Warning',
113
+ };
114
+ export const Success = Template.bind({});
115
+ Success.args = {
116
+ messageType: 'Success',
117
+ };
@@ -0,0 +1,121 @@
1
+ import { formatHtmlPreview } from '../../utils/utils';
2
+ export default {
3
+ title: 'Components/Modal',
4
+ parameters: {
5
+ layout: 'fullscreen',
6
+ design: [
7
+ {
8
+ name: 'Figma',
9
+ type: 'figma',
10
+ url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=4398%3A181325&t=Ne6myqwca5m00de7-1',
11
+ },
12
+ {
13
+ name: 'Link',
14
+ type: 'link',
15
+ url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=4398%3A181325&t=Ne6myqwca5m00de7-1',
16
+ },
17
+ ],
18
+ },
19
+ argTypes: {
20
+ size: {
21
+ name: 'Size',
22
+ description: 'Size of modal',
23
+ control: {
24
+ type: 'radio',
25
+ },
26
+ options: ['Large', 'Medium', 'Small', 'Extra small'],
27
+ },
28
+ showModal: {
29
+ name: 'Show modal',
30
+ description: 'Toggle if the modal is displayed',
31
+ control: {
32
+ type: 'boolean',
33
+ },
34
+ },
35
+ actions: {
36
+ name: 'Actions',
37
+ description: 'Behaviour of modal actions',
38
+ control: {
39
+ type: 'radio',
40
+ },
41
+ options: ['Sticky', 'Static'],
42
+ },
43
+ headline: {
44
+ name: 'Modal headline',
45
+ description: 'Customize headline',
46
+ control: {
47
+ type: 'text',
48
+ },
49
+ },
50
+ },
51
+ args: {
52
+ headline: 'The buttons for the modal only works in the canvas tab',
53
+ actions: 'Static',
54
+ size: 'Large',
55
+ showModal: true,
56
+ },
57
+ };
58
+ const sizeLookUp = {
59
+ 'Large': 'lg',
60
+ 'Medium': 'md',
61
+ 'Small': 'sm',
62
+ 'Extra small': 'xs',
63
+ };
64
+ const Template = ({ headline, size, actions, showModal }) => formatHtmlPreview(` <style>
65
+ /* demo-wrapper and demo-styles is for demonstration purposes only*/
66
+ .demo-wrapper {
67
+ position: relative;
68
+ top: 0;
69
+ left: 0;
70
+ height: 500px;
71
+ }
72
+ .demo-styles {
73
+ position: absolute;
74
+ margin-bottom: 20px;
75
+ }
76
+ </style>
77
+
78
+ <div class="demo-wrapper">
79
+ <button id="modal-button" class="sdds-btn sdds-btn-primary sdds-btn-lg">
80
+ <span class="sdds-btn-text">Open modal</span>
81
+ </button>
82
+ <div id="my-modal" class="sdds-modal-backdrop ${showModal ? 'show' : 'hide'} demo-styles">
83
+ <div class="sdds-modal sdds-modal-${sizeLookUp[size]} sdds-modal__actions-${actions.toLowerCase()}">
84
+ <div class="sdds-modal-header">
85
+ <h5 class="sdds-modal-headline">${headline}</h5>
86
+ <span class="sdds-modal-btn"></span>
87
+ </div>
88
+ <div class="sdds-modal-body">
89
+ <p>
90
+ Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Maecenas tempus, tellus eget condimentum rhoncus.
91
+ </p>
92
+ </div>
93
+ <div class="sdds-modal-actions">
94
+ <button class="sdds-btn sdds-btn-primary sdds-btn-md">Save</button>
95
+ <button class="sdds-btn sdds-btn-secondary sdds-btn-md">Cancel</button>
96
+ </div>
97
+ </div>
98
+ </div>
99
+ </div>
100
+
101
+ <script>
102
+ /* Note: Code below is used only for inspiration and presentation purposes in Storybook */
103
+ modal = document.getElementById('my-modal');
104
+ buttons = modal.getElementsByTagName('button');
105
+ for (const button of buttons) {
106
+ button.addEventListener('click', () => {
107
+ modal.classList.replace('show', 'hide')
108
+ })
109
+ }
110
+
111
+ document.getElementsByClassName('sdds-modal-btn')[0].addEventListener('click', () => {
112
+ modal.classList.replace('show', 'hide');
113
+ })
114
+
115
+ document.getElementById('modal-button').addEventListener('click', () => {
116
+ modal.classList.replace('hide', 'show')
117
+ })
118
+ </script>
119
+ `);
120
+ export const Native = Template.bind({});
121
+ Native.args = {};
@@ -0,0 +1,78 @@
1
+ import { formatHtmlPreview } from '../../utils/utils';
2
+ import readme from './readme.md';
3
+ export default {
4
+ title: 'Components/Modal',
5
+ parameters: {
6
+ layout: 'fullscreen',
7
+ notes: readme,
8
+ design: [
9
+ {
10
+ name: 'Figma',
11
+ type: 'figma',
12
+ url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=4398%3A181325&t=Ne6myqwca5m00de7-1',
13
+ },
14
+ {
15
+ name: 'Link',
16
+ type: 'link',
17
+ url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=4398%3A181325&t=Ne6myqwca5m00de7-1',
18
+ },
19
+ ],
20
+ },
21
+ argTypes: {
22
+ size: {
23
+ name: 'Size',
24
+ description: 'Size of modal',
25
+ control: {
26
+ type: 'radio',
27
+ },
28
+ options: ['Large', 'Medium', 'Small', 'Extra small'],
29
+ },
30
+ actions: {
31
+ name: 'Actions',
32
+ description: 'Behaviour of modal actions',
33
+ control: {
34
+ type: 'radio',
35
+ },
36
+ options: ['Sticky', 'Static'],
37
+ },
38
+ headline: {
39
+ name: 'Modal headline',
40
+ description: 'Customize headline',
41
+ control: {
42
+ type: 'text',
43
+ },
44
+ },
45
+ },
46
+ args: {
47
+ headline: 'The buttons for the modal only works in the canvas tab',
48
+ actions: 'Static',
49
+ size: 'Large',
50
+ },
51
+ };
52
+ const sizeLookUp = {
53
+ 'Large': 'lg',
54
+ 'Medium': 'md',
55
+ 'Small': 'sm',
56
+ 'Extra small': 'xs',
57
+ };
58
+ const ModalTemplate = ({ size, headline, actions }) => formatHtmlPreview(`
59
+ <button id="my-modal-button" class="sdds-btn sdds-btn-primary">Open modal</button>
60
+
61
+ <sdds-modal open id="my-modal" size="${sizeLookUp[size]}" actions="${actions.toLowerCase()}">
62
+ <h5 class="sdds-modal-headline" slot="sdds-modal-headline">${headline}</h5>
63
+ <div class="sdds-modal-body" slot="sdds-modal-body">
64
+ Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Maecenas tempus, tellus eget condimentum rhoncus.
65
+ </div>
66
+ <button slot="sdds-modal-actions" data-dismiss-modal onclick="console.log('delete')" class="sdds-btn sdds-btn-danger sdds-btn-md">Delete</button>
67
+ <button slot="sdds-modal-actions" data-dismiss-modal onclick="console.log('cancel')" class="sdds-btn sdds-btn-secondary sdds-btn-md">Cancel</button>
68
+ </sdds-modal>
69
+ <script>
70
+
71
+ document.getElementById('my-modal-button').addEventListener('click', () => {
72
+ document.getElementById('my-modal').open = true;
73
+ })
74
+ </script>
75
+
76
+ `);
77
+ export const WebComponent = ModalTemplate.bind({});
78
+ WebComponent.args = {};
@@ -0,0 +1,324 @@
1
+ :root,
2
+ html {
3
+ --sdds-modal-backdrop: rgba(0 0 0 / 40%);
4
+ --sdds-modal-bg: var(--sdds-white);
5
+ --sdds-modal-text: var(--sdds-grey-958);
6
+ --sdds-modal-icon: var(--sdds-black);
7
+ --sdds-modal-scrollbar: var(--sdds-grey-300);
8
+ --sdds-modal-scrollbar-track: var(--sdds-grey-300);
9
+ --sdds-modal-scrollbar-thumb: var(--sdds-grey-500);
10
+ }
11
+
12
+ :root .sdds-theme-light,
13
+ html .sdds-theme-light {
14
+ --sdds-modal-backdrop: rgba(0 0 0 / 40%);
15
+ --sdds-modal-bg: var(--sdds-white);
16
+ --sdds-modal-text: var(--sdds-grey-958);
17
+ --sdds-modal-icon: var(--sdds-black);
18
+ --sdds-modal-scrollbar: var(--sdds-grey-300);
19
+ --sdds-modal-scrollbar-track: var(--sdds-grey-300);
20
+ --sdds-modal-scrollbar-thumb: var(--sdds-grey-500);
21
+ }
22
+
23
+ :root .sdds-theme-dark,
24
+ html .sdds-theme-dark {
25
+ --sdds-modal-backdrop: rgba(0 0 0 / 40%);
26
+ --sdds-modal-bg: var(--sdds-grey-900);
27
+ --sdds-modal-text: var(--sdds-white);
28
+ --sdds-modal-icon: var(--sdds-white);
29
+ --sdds-modal-scrollbar: var(--sdds-grey-300);
30
+ --sdds-modal-scrollbar-track: var(--sdds-grey-300);
31
+ --sdds-modal-scrollbar-thumb: var(--sdds-grey-500);
32
+ }
33
+
34
+ /* MIXINS */
35
+ /* MODAL STYLING */
36
+ .sdds-modal {
37
+ box-sizing: border-box;
38
+ background-color: var(--sdds-modal-bg);
39
+ z-index: 4;
40
+ margin: auto;
41
+ position: relative;
42
+ border-radius: 4px;
43
+ padding: 16px;
44
+ max-height: 85vh;
45
+ overflow-y: auto;
46
+ /* SCROLL STUFF */
47
+ /* width */
48
+ /* Track */
49
+ /* Handle */
50
+ }
51
+ .sdds-modal * {
52
+ box-sizing: border-box;
53
+ }
54
+ .sdds-modal::-webkit-scrollbar {
55
+ width: 5px;
56
+ background-color: var(--sdds-grey-300);
57
+ border-radius: 0 1em 1em 0;
58
+ }
59
+ .sdds-modal::-webkit-scrollbar-track {
60
+ background-color: var(--sdds-grey-300);
61
+ border-radius: 0 1em 1em 0;
62
+ }
63
+ .sdds-modal::-webkit-scrollbar-thumb {
64
+ background-color: var(--sdds-grey-500);
65
+ border-radius: 0 1em 1em 0;
66
+ }
67
+ .sdds-modal__actions-sticky {
68
+ overflow: hidden;
69
+ }
70
+ .sdds-modal__actions-sticky .sdds-modal-body {
71
+ font: var(--sdds-body-01);
72
+ letter-spacing: var(--sdds-body-01-ls);
73
+ padding-bottom: 40px;
74
+ margin: 0 -16px 0 0;
75
+ max-height: calc(85vh - 36px);
76
+ overflow-y: auto;
77
+ }
78
+ .sdds-modal__actions-sticky .sdds-modal-actions {
79
+ position: absolute;
80
+ bottom: 0;
81
+ left: 0;
82
+ right: 0;
83
+ background-color: var(--sdds-modal-bg);
84
+ padding: var(--sdds-spacing-element-16);
85
+ display: flex;
86
+ gap: 16px;
87
+ }
88
+ .sdds-modal__actions-static .sdds-modal-actions {
89
+ background-color: var(--sdds-modal-bg);
90
+ display: flex;
91
+ gap: 16px;
92
+ }
93
+
94
+ @media (min-width: 320px) {
95
+ .sdds-modal-xs {
96
+ width: 100%;
97
+ }
98
+
99
+ .sdds-modal-sm {
100
+ width: 100%;
101
+ }
102
+
103
+ .sdds-modal-md {
104
+ width: 100%;
105
+ }
106
+
107
+ .sdds-modal-lg {
108
+ width: 100%;
109
+ }
110
+ }
111
+ @media (min-width: 672px) {
112
+ .sdds-modal-xs {
113
+ width: 75%;
114
+ }
115
+
116
+ .sdds-modal-sm {
117
+ width: 62.5%;
118
+ }
119
+
120
+ .sdds-modal-md {
121
+ width: 75%;
122
+ }
123
+
124
+ .sdds-modal-lg {
125
+ width: 100%;
126
+ }
127
+ }
128
+ @media (min-width: 1056px) {
129
+ .sdds-modal-xs {
130
+ width: 31.25%;
131
+ }
132
+
133
+ .sdds-modal-sm {
134
+ width: 43.75%;
135
+ }
136
+
137
+ .sdds-modal-md {
138
+ width: 62.5%;
139
+ }
140
+
141
+ .sdds-modal-lg {
142
+ width: 75%;
143
+ }
144
+ }
145
+ @media (min-width: 1312px) {
146
+ .sdds-modal-xs {
147
+ width: 31.25%;
148
+ }
149
+
150
+ .sdds-modal-sm {
151
+ width: 37.5%;
152
+ }
153
+
154
+ .sdds-modal-md {
155
+ width: 62.5%;
156
+ }
157
+
158
+ .sdds-modal-lg {
159
+ width: 75%;
160
+ }
161
+ }
162
+ @media (min-width: 1584px) {
163
+ .sdds-modal-xs {
164
+ width: 25%;
165
+ }
166
+
167
+ .sdds-modal-sm {
168
+ width: 37.5%;
169
+ }
170
+
171
+ .sdds-modal-md {
172
+ width: 50%;
173
+ }
174
+
175
+ .sdds-modal-lg {
176
+ width: 75%;
177
+ }
178
+ }
179
+ @media (max-width: 320px) {
180
+ .sdds-modal-md,
181
+ .sdds-modal-lg,
182
+ .sdds-modal-sm {
183
+ height: 100%;
184
+ }
185
+ .sdds-modal-md slot[name=sdds-modal-actions]::slotted(*),
186
+ .sdds-modal-lg slot[name=sdds-modal-actions]::slotted(*),
187
+ .sdds-modal-sm slot[name=sdds-modal-actions]::slotted(*) {
188
+ display: flex;
189
+ }
190
+ }
191
+ /* MODAL SUBELEMENTS */
192
+ .sdds-modal-header {
193
+ display: flex;
194
+ padding-bottom: var(--sdds-spacing-element-8);
195
+ position: sticky;
196
+ top: 0;
197
+ background-color: var(--sdds-modal-bg);
198
+ z-index: 1;
199
+ }
200
+ .sdds-modal-header::before {
201
+ content: " ";
202
+ position: absolute;
203
+ height: 16px;
204
+ top: -16px;
205
+ width: 100%;
206
+ background-color: var(--sdds-modal-bg);
207
+ }
208
+
209
+ .sdds-modal-headline {
210
+ font: var(--sdds-headline-05);
211
+ letter-spacing: var(--sdds-headline-05-ls);
212
+ margin: 0;
213
+ flex: 1;
214
+ }
215
+
216
+ .sdds-modal-body {
217
+ font: var(--sdds-body-01);
218
+ letter-spacing: var(--sdds-body-01-ls);
219
+ padding-bottom: 40px;
220
+ margin: 0 -16px 0 0;
221
+ overflow-y: visible;
222
+ /* SCROLL STUFF */
223
+ /* width */
224
+ /* Track */
225
+ /* Handle */
226
+ }
227
+ .sdds-modal-body::-webkit-scrollbar {
228
+ width: 5px;
229
+ background-color: var(--sdds-grey-300);
230
+ }
231
+ .sdds-modal-body::-webkit-scrollbar-track {
232
+ background-color: var(--sdds-grey-300);
233
+ }
234
+ .sdds-modal-body::-webkit-scrollbar-thumb {
235
+ background-color: var(--sdds-grey-500);
236
+ }
237
+ @media (min-width: 1056px) {
238
+ .sdds-modal-body {
239
+ padding-right: 64px;
240
+ }
241
+ }
242
+
243
+ .sdds-modal-backdrop {
244
+ left: 0;
245
+ top: 0;
246
+ position: fixed;
247
+ height: 100%;
248
+ width: 100%;
249
+ z-index: 40000;
250
+ background-color: var(--sdds-modal-backdrop);
251
+ padding: 0 16px;
252
+ }
253
+ @media (max-width: 320px) {
254
+ .sdds-modal-backdrop {
255
+ padding: 0;
256
+ }
257
+ }
258
+ .sdds-modal-backdrop.show {
259
+ display: flex;
260
+ }
261
+ .sdds-modal-backdrop.hide {
262
+ display: none;
263
+ }
264
+
265
+ .sdds-modal-btn {
266
+ display: inline-block;
267
+ width: 16px;
268
+ height: auto;
269
+ background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M3.40338 2.34308C3.11048 2.05019 2.63561 2.05019 2.34272 2.34308C2.04982 2.63598 2.04982 3.11085 2.34272 3.40374L6.93897 8L2.34283 12.5961C2.04994 12.889 2.04994 13.3639 2.34283 13.6568C2.63572 13.9497 3.1106 13.9497 3.40349 13.6568L7.99963 9.06066L12.5958 13.6568C12.8887 13.9497 13.3635 13.9497 13.6564 13.6568C13.9493 13.3639 13.9493 12.889 13.6564 12.5961L9.06029 8L13.6565 3.40376C13.9494 3.11086 13.9494 2.63599 13.6565 2.3431C13.3636 2.0502 12.8888 2.0502 12.5959 2.3431L7.99963 6.93934L3.40338 2.34308Z' fill='%23171719'/%3E%3C/svg%3E%0A");
270
+ background-repeat: no-repeat;
271
+ cursor: pointer;
272
+ }
273
+ @media (min-width: 320px) {
274
+ .sdds-modal-btn {
275
+ margin-left: var(--sdds-spacing-element-16);
276
+ }
277
+ }
278
+ @media (min-width: 1056px) {
279
+ .sdds-modal-btn {
280
+ margin-left: var(--sdds-spacing-element-48);
281
+ }
282
+ }
283
+
284
+ .sdds-modal-overflow {
285
+ overflow: hidden;
286
+ }
287
+
288
+ /* WEB COMPONENT STUFF */
289
+ :host {
290
+ left: 0;
291
+ top: 0;
292
+ position: fixed;
293
+ height: 100%;
294
+ width: 100%;
295
+ z-index: 40000;
296
+ background-color: var(--sdds-modal-backdrop);
297
+ padding: 0 16px;
298
+ }
299
+ @media (max-width: 320px) {
300
+ :host {
301
+ padding: 0;
302
+ }
303
+ }
304
+ :host.show {
305
+ display: flex;
306
+ }
307
+ :host.hide {
308
+ display: none;
309
+ }
310
+ :host .sdds-modal-btn {
311
+ border: none;
312
+ background-color: transparent;
313
+ /* &:focus {
314
+ //@include sdds-focus-state; FIXME: THIS INCLUDE IS NOT WORKING
315
+ } */
316
+ }
317
+
318
+ :host(.show) {
319
+ display: flex;
320
+ }
321
+
322
+ :host(.hide) {
323
+ display: none;
324
+ }