@covalent/components 0.0.0-COVALENT

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 (264) hide show
  1. package/.babelrc +10 -0
  2. package/.eslintrc.json +18 -0
  3. package/.storybook/main.js +34 -0
  4. package/.storybook/manager-head.html +62 -0
  5. package/.storybook/manager.js +1 -0
  6. package/.storybook/preview-head.html +20 -0
  7. package/.storybook/preview.js +20 -0
  8. package/README.md +179 -0
  9. package/component-config.json +313 -0
  10. package/index.html +288 -0
  11. package/jest.config.js +18 -0
  12. package/package.json +315 -0
  13. package/project.json +104 -0
  14. package/public/index.scss +1 -0
  15. package/public/reset.css +128 -0
  16. package/src/action-ribbon/_action-ribbon.theme.scss +90 -0
  17. package/src/action-ribbon/action-ribbon-base.ts +164 -0
  18. package/src/action-ribbon/action-ribbon.scss +20 -0
  19. package/src/action-ribbon/action-ribbon.spec.ts +11 -0
  20. package/src/action-ribbon/action-ribbon.stories.js +78 -0
  21. package/src/action-ribbon/action-ribbon.ts +26 -0
  22. package/src/alert/_alert.theme.scss +116 -0
  23. package/src/alert/alert-base.ts +175 -0
  24. package/src/alert/alert.scss +55 -0
  25. package/src/alert/alert.spec.ts +26 -0
  26. package/src/alert/alert.stories.js +76 -0
  27. package/src/alert/alert.ts +26 -0
  28. package/src/app-shell/app-shell.scss +387 -0
  29. package/src/app-shell/app-shell.stories.js +323 -0
  30. package/src/app-shell/app-shell.ts +388 -0
  31. package/src/badge/badge.scss +60 -0
  32. package/src/badge/badge.spec.ts +40 -0
  33. package/src/badge/badge.stories.js +88 -0
  34. package/src/badge/badge.ts +122 -0
  35. package/src/button/Overview.mdx +160 -0
  36. package/src/button/button.scss +28 -0
  37. package/src/button/button.spec.ts +11 -0
  38. package/src/button/button.stories.js +102 -0
  39. package/src/button/button.ts +17 -0
  40. package/src/card/card-base.ts +69 -0
  41. package/src/card/card.scss +45 -0
  42. package/src/card/card.spec.ts +11 -0
  43. package/src/card/card.ts +21 -0
  44. package/src/card/cards.stories.js +40 -0
  45. package/src/checkbox/checkbox.scss +8 -0
  46. package/src/checkbox/checkbox.spec.ts +11 -0
  47. package/src/checkbox/checkbox.stories.js +61 -0
  48. package/src/checkbox/checkbox.ts +18 -0
  49. package/src/chips/chip-base.ts +276 -0
  50. package/src/chips/chip-set-base.ts +184 -0
  51. package/src/chips/chip-set.scss +15 -0
  52. package/src/chips/chip-set.spec.ts +11 -0
  53. package/src/chips/chip-set.ts +27 -0
  54. package/src/chips/chip.scss +40 -0
  55. package/src/chips/chip.spec.ts +11 -0
  56. package/src/chips/chip.ts +26 -0
  57. package/src/chips/chips.stories.js +81 -0
  58. package/src/circular-progress/circular-progress.spec.ts +11 -0
  59. package/src/circular-progress/circular-progress.stories.js +40 -0
  60. package/src/circular-progress/circular-progress.ts +16 -0
  61. package/src/code-editor/code-editor.scss +20 -0
  62. package/src/code-editor/code-editor.spec.ts +11 -0
  63. package/src/code-editor/code-editor.stories.js +44 -0
  64. package/src/code-editor/code-editor.theme.ts +199 -0
  65. package/src/code-editor/code-editor.ts +231 -0
  66. package/src/code-snippet/code-snippet.scss +126 -0
  67. package/src/code-snippet/code-snippet.spec.ts +11 -0
  68. package/src/code-snippet/code-snippet.stories.js +134 -0
  69. package/src/code-snippet/code-snippet.ts +93 -0
  70. package/src/data-table/_data-table.theme.scss +39 -0
  71. package/src/data-table/data-table.stories.js +24 -0
  72. package/src/data-table/data-table.stories.scss +11 -0
  73. package/src/dialog/Overview.mdx +39 -0
  74. package/src/dialog/dialog.scss +17 -0
  75. package/src/dialog/dialog.spec.ts +11 -0
  76. package/src/dialog/dialog.stories.js +89 -0
  77. package/src/dialog/dialog.ts +44 -0
  78. package/src/drawer/drawer.scss +4 -0
  79. package/src/drawer/drawer.spec.ts +11 -0
  80. package/src/drawer/drawer.ts +18 -0
  81. package/src/empty-state/_empty-state.theme.scss +0 -0
  82. package/src/empty-state/empty-state.scss +67 -0
  83. package/src/empty-state/empty-state.spec.ts +11 -0
  84. package/src/empty-state/empty-state.stories.js +117 -0
  85. package/src/empty-state/empty-state.ts +61 -0
  86. package/src/expansion-panel/Overview.mdx +108 -0
  87. package/src/expansion-panel/expansion-panel-incorrect-example.png +0 -0
  88. package/src/expansion-panel/expansion-panel-item.scss +243 -0
  89. package/src/expansion-panel/expansion-panel-item.ts +95 -0
  90. package/src/expansion-panel/expansion-panel.spec.ts +11 -0
  91. package/src/expansion-panel/expansion-panel.stories.js +76 -0
  92. package/src/expansion-panel/expansion-panel.ts +94 -0
  93. package/src/focused-page/focused-page.scss +113 -0
  94. package/src/focused-page/focused-page.spec.ts +11 -0
  95. package/src/focused-page/focused-page.stories.js +167 -0
  96. package/src/focused-page/focused-page.ts +201 -0
  97. package/src/formfield/formfield.scss +8 -0
  98. package/src/formfield/formfield.spec.ts +11 -0
  99. package/src/formfield/formfield.ts +24 -0
  100. package/src/full-screen-dialog/full-screen-dialog.scss +37 -0
  101. package/src/full-screen-dialog/full-screen-dialog.spec.ts +11 -0
  102. package/src/full-screen-dialog/full-screen-dialog.stories.js +172 -0
  103. package/src/full-screen-dialog/full-screen-dialog.ts +84 -0
  104. package/src/icon/_icon-list.ts +316 -0
  105. package/src/icon/icon-demo.scss +25 -0
  106. package/src/icon/icon-demo.ts +37 -0
  107. package/src/icon/icon.spec.ts +11 -0
  108. package/src/icon/icon.stories.js +55 -0
  109. package/src/icon/icon.ts +16 -0
  110. package/src/icon-button/_icon-button.theme.scss +9 -0
  111. package/src/icon-button/icon-button.scss +12 -0
  112. package/src/icon-button/icon-button.spec.ts +11 -0
  113. package/src/icon-button/icon-button.stories.js +24 -0
  114. package/src/icon-button/icon-button.ts +19 -0
  115. package/src/icon-button-toggle/icon-button-toggle.scss +19 -0
  116. package/src/icon-button-toggle/icon-button-toggle.spec.ts +11 -0
  117. package/src/icon-button-toggle/icon-button-toggle.stories.js +32 -0
  118. package/src/icon-button-toggle/icon-button-toggle.ts +50 -0
  119. package/src/icon-checkbox/icon-check-toggle.ts +64 -0
  120. package/src/icon-checkbox/icon-check.spec.ts +11 -0
  121. package/src/icon-checkbox/icon-checkbox.scss +95 -0
  122. package/src/icon-checkbox/icon-checkbox.stories.js +77 -0
  123. package/src/icon-lockup/icon-lockup.scss +47 -0
  124. package/src/icon-lockup/icon-lockup.spec.ts +11 -0
  125. package/src/icon-lockup/icon-lockup.stories.js +93 -0
  126. package/src/icon-lockup/icon-lockup.ts +125 -0
  127. package/src/icon-radio/icon-radio-toggle.ts +43 -0
  128. package/src/icon-radio/icon-radio.scss +63 -0
  129. package/src/icon-radio/icon-radio.spec.ts +11 -0
  130. package/src/icon-radio/icon-radio.stories.js +23 -0
  131. package/src/index.scss +1 -0
  132. package/src/index.ts +57 -0
  133. package/src/linear-progress/linear-progress.scss +4 -0
  134. package/src/linear-progress/linear-progress.spec.ts +11 -0
  135. package/src/linear-progress/linear-progress.stories.js +43 -0
  136. package/src/linear-progress/linear-progress.ts +18 -0
  137. package/src/list/Overview.mdx +91 -0
  138. package/src/list/_list.theme.scss +100 -0
  139. package/src/list/check-list-item.spec.ts +11 -0
  140. package/src/list/check-list-item.ts +25 -0
  141. package/src/list/list-item.scss +56 -0
  142. package/src/list/list-item.spec.ts +11 -0
  143. package/src/list/list-item.ts +31 -0
  144. package/src/list/list.scss +25 -0
  145. package/src/list/list.stories.js +120 -0
  146. package/src/list/list.ts +23 -0
  147. package/src/list/nav-list-item.scss +159 -0
  148. package/src/list/nav-list-item.ts +223 -0
  149. package/src/list/radio-list-item.ts +25 -0
  150. package/src/menu/menu.scss +3 -0
  151. package/src/menu/menu.spec.ts +11 -0
  152. package/src/menu/menu.stories.js +110 -0
  153. package/src/menu/menu.ts +23 -0
  154. package/src/notebook-cell/notebook-cell.scss +185 -0
  155. package/src/notebook-cell/notebook-cell.spec.ts +11 -0
  156. package/src/notebook-cell/notebook-cell.stories.js +87 -0
  157. package/src/notebook-cell/notebook-cell.ts +300 -0
  158. package/src/radio/radio.scss +3 -0
  159. package/src/radio/radio.spec.ts +11 -0
  160. package/src/radio/radio.stories.js +56 -0
  161. package/src/radio/radio.ts +18 -0
  162. package/src/select/select.scss +16 -0
  163. package/src/select/select.spec.ts +11 -0
  164. package/src/select/select.stories.js +57 -0
  165. package/src/select/select.ts +18 -0
  166. package/src/side-sheet/side-sheet.scss +49 -0
  167. package/src/side-sheet/side-sheet.spec.ts +11 -0
  168. package/src/side-sheet/side-sheet.stories.js +96 -0
  169. package/src/side-sheet/side-sheet.ts +37 -0
  170. package/src/skeleton/_skeleton.styles.scss +24 -0
  171. package/src/skeleton/skeleton.stories.js +77 -0
  172. package/src/slider/slider-range.ts +16 -0
  173. package/src/slider/slider.spec.ts +11 -0
  174. package/src/slider/slider.stories.js +54 -0
  175. package/src/slider/slider.ts +16 -0
  176. package/src/snackbar/snackbar.scss +8 -0
  177. package/src/snackbar/snackbar.spec.ts +11 -0
  178. package/src/snackbar/snackbar.stories.js +42 -0
  179. package/src/snackbar/snackbar.ts +18 -0
  180. package/src/status-dialog/status-dialog.scss +204 -0
  181. package/src/status-dialog/status-dialog.spec.ts +48 -0
  182. package/src/status-dialog/status-dialog.stories.js +136 -0
  183. package/src/status-dialog/status-dialog.ts +188 -0
  184. package/src/status-header/_status-header.theme.scss +79 -0
  185. package/src/status-header/status-header-base.ts +42 -0
  186. package/src/status-header/status-header-item.scss +17 -0
  187. package/src/status-header/status-header-item.spec.ts +11 -0
  188. package/src/status-header/status-header-item.ts +32 -0
  189. package/src/status-header/status-header.scss +57 -0
  190. package/src/status-header/status-header.spec.ts +11 -0
  191. package/src/status-header/status-header.stories.js +114 -0
  192. package/src/status-header/status-header.ts +26 -0
  193. package/src/switch/switch.scss +17 -0
  194. package/src/switch/switch.spec.ts +11 -0
  195. package/src/switch/switch.stories.js +41 -0
  196. package/src/switch/switch.ts +18 -0
  197. package/src/tab/Overview.mdx +38 -0
  198. package/src/tab/tab-bar.spec.ts +11 -0
  199. package/src/tab/tab-bar.ts +16 -0
  200. package/src/tab/tab.scss +10 -0
  201. package/src/tab/tab.spec.ts +11 -0
  202. package/src/tab/tab.stories.js +30 -0
  203. package/src/tab/tab.ts +18 -0
  204. package/src/text-lockup/text-lockup.scss +66 -0
  205. package/src/text-lockup/text-lockup.spec.ts +11 -0
  206. package/src/text-lockup/text-lockup.stories.js +67 -0
  207. package/src/text-lockup/text-lockup.ts +55 -0
  208. package/src/textarea/textarea.spec.ts +11 -0
  209. package/src/textarea/textarea.stories.js +39 -0
  210. package/src/textarea/textarea.ts +19 -0
  211. package/src/textfield/textfield.scss +34 -0
  212. package/src/textfield/textfield.spec.ts +11 -0
  213. package/src/textfield/textfield.stories.js +60 -0
  214. package/src/textfield/textfield.ts +25 -0
  215. package/src/theme/_index.scss +46 -0
  216. package/src/theme/prebuilt/dark-theme.scss +17 -0
  217. package/src/theme/prebuilt/light-theme.scss +17 -0
  218. package/src/toolbar/toolbar.scss +37 -0
  219. package/src/toolbar/toolbar.spec.ts +11 -0
  220. package/src/toolbar/toolbar.stories.js +66 -0
  221. package/src/toolbar/toolbar.ts +27 -0
  222. package/src/tooltip/tooltip.scss +16 -0
  223. package/src/tooltip/tooltip.spec.ts +11 -0
  224. package/src/tooltip/tooltip.stories.js +72 -0
  225. package/src/tooltip/tooltip.ts +185 -0
  226. package/src/top-app-bar/top-app-bar-fixed.ts +23 -0
  227. package/src/top-app-bar/top-app-bar.scss +14 -0
  228. package/src/top-app-bar/top-app-bar.spec.ts +11 -0
  229. package/src/top-app-bar/top-app-bar.stories.js +41 -0
  230. package/src/top-app-bar/top-app-bar.ts +23 -0
  231. package/src/tree-list/tree-list-item.scss +96 -0
  232. package/src/tree-list/tree-list-item.spec.ts +11 -0
  233. package/src/tree-list/tree-list-item.ts +87 -0
  234. package/src/tree-list/tree-list.scss +13 -0
  235. package/src/tree-list/tree-list.spec.ts +11 -0
  236. package/src/tree-list/tree-list.stories.js +151 -0
  237. package/src/tree-list/tree-list.ts +53 -0
  238. package/src/typography/typography.scss +45 -0
  239. package/src/typography/typography.spec.ts +11 -0
  240. package/src/typography/typography.stories.js +23 -0
  241. package/src/typography/typography.ts +27 -0
  242. package/stories/Introduction.mdx +47 -0
  243. package/stories/color-use.mdx +509 -0
  244. package/stories/demos/dialog.component.html +187 -0
  245. package/stories/demos/dialog.component.js +57 -0
  246. package/stories/demos/grid.content.html +99 -0
  247. package/stories/demos/lorem-ipsum.content.html +338 -0
  248. package/stories/demos/material-web.content.html +2125 -0
  249. package/stories/demos/table-column-sorting.content.html +92 -0
  250. package/stories/demos/table-pagination.content.html +139 -0
  251. package/stories/demos/table-progress-indicator.content.html +77 -0
  252. package/stories/demos/table-row-selection.content.html +219 -0
  253. package/stories/demos/table.content.html +64 -0
  254. package/stories/demos/top-app-bar.component.js +57 -0
  255. package/stories/guide-representing-state.mdx +282 -0
  256. package/stories/info-and-help.mdx +484 -0
  257. package/stories/item-detail-and-editing.mdx +529 -0
  258. package/stories/markdown-elements.mdx +194 -0
  259. package/stories/writing-and-naming.mdx +157 -0
  260. package/tsconfig.json +34 -0
  261. package/tsconfig.lib.json +17 -0
  262. package/tsconfig.spec.json +14 -0
  263. package/types.d.ts +15 -0
  264. package/vite.config.js +58 -0
@@ -0,0 +1,134 @@
1
+ import './code-snippet';
2
+ import '../dialog/dialog';
3
+ import '../icon-button/icon-button';
4
+ import '../button/button';
5
+
6
+ import { addons } from '@storybook/preview-api';
7
+ import {
8
+ DARK_MODE_EVENT_NAME,
9
+ UPDATE_DARK_MODE_EVENT_NAME,
10
+ } from 'storybook-dark-mode';
11
+
12
+ // get channel to listen to event emitter
13
+ const channel = addons.getChannel();
14
+
15
+ const sqlContent = `
16
+ SELECT * FROM load_to_teradata (
17
+ ON (
18
+ SELECT "class" AS class_col,
19
+ "variable" AS variable_col,
20
+ "type" AS type_col,
21
+ category,
22
+ cnt,
23
+ "sum" AS sum_col,
24
+ "sumSq",
25
+ "totalCnt"
26
+ FROM aster_nb_modelSC
27
+ )
28
+ tdpid ('sdt12432.labs.teradata.com')
29
+ username ('sample_user')
30
+ password ('sample_user')
31
+ target_table ('td_nb_modelSC')
32
+ );
33
+ `;
34
+
35
+ export default {
36
+ title: 'Components/Code snippet',
37
+ args: {
38
+ hideHeader: false,
39
+ inline: false,
40
+ label: 'Example.sql',
41
+ language: 'sql',
42
+ content: sqlContent,
43
+ maxHeight: 0,
44
+ },
45
+ };
46
+
47
+ const Template = ({
48
+ inline,
49
+ content,
50
+ hideHeader,
51
+ label,
52
+ language,
53
+ maxHeight,
54
+ }) => {
55
+ document.addEventListener(
56
+ 'DOMContentLoaded',
57
+ () => {
58
+ const themeToggle = document.querySelector('#theme-toggle');
59
+
60
+ // listen to DARK_MODE event
61
+ channel.on(DARK_MODE_EVENT_NAME, (darkMode) => {
62
+ if (darkMode) {
63
+ themeToggle.setAttribute('icon', 'brightness_high');
64
+ } else {
65
+ themeToggle.setAttribute('icon', 'brightness_4');
66
+ }
67
+ });
68
+
69
+ themeToggle.addEventListener('click', () => {
70
+ channel.emit(UPDATE_DARK_MODE_EVENT_NAME);
71
+ });
72
+ },
73
+ { once: true }
74
+ );
75
+ return `
76
+ <cv-code-snippet
77
+ label="${label}"
78
+ maxHeight="${maxHeight}"
79
+ language="${language}"
80
+ ${hideHeader ? 'hideHeader' : ''}
81
+ ${inline ? 'inline' : ''}>
82
+ <cv-icon-button slot="actionItems" id="theme-toggle"></cv-icon-button>
83
+ <cv-icon-button slot="actionItems" icon="content_copy"></cv-icon-button>
84
+ ${content}
85
+ </cv-code-snippet>`;
86
+ };
87
+
88
+ export const Basic = Template.bind();
89
+ Basic.args = {
90
+ language: 'sql',
91
+ content: sqlContent,
92
+ };
93
+
94
+ export const Scrollable = Template.bind();
95
+ Scrollable.args = {
96
+ maxHeight: 250,
97
+ };
98
+
99
+ export const HiddenHeader = Template.bind();
100
+ HiddenHeader.args = {
101
+ hideHeader: true,
102
+ };
103
+
104
+ const TemplateDialog = (...args) => {
105
+ return `
106
+ <style>
107
+ cv-code-snippet {
108
+ margin:8px -24px -36px;
109
+ }
110
+ cv-code-snippet::part(container) {
111
+ padding-left: 8px;
112
+ padding-right: 8px;
113
+ }
114
+ cv-code-snippet::part(header) {
115
+ padding-left: 24px;
116
+ }
117
+ </style>
118
+ <cv-dialog heading="Lorem ipsum dolor sit amet" open>
119
+ <cv-typography scale="body1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Tortor consectetur quis velit donec vel integer diam. Nisl pretium egestas ultrices facilisis sed amet et. Odio elementum ut eu magnis at ullamcorper euismod.</cv-typography>
120
+ ${Template(...args)}
121
+ <cv-button outlined slot="primaryAction">Export</cv-button>
122
+ <cv-button slot="secondaryAction">Close</cv-button>
123
+ </cv-dialog>
124
+ `;
125
+ };
126
+ export const Dialog = TemplateDialog.bind();
127
+ Dialog.args = {
128
+ inline: true,
129
+ };
130
+ Dialog.parameters = {
131
+ docs: {
132
+ inlineStories: false,
133
+ },
134
+ };
@@ -0,0 +1,93 @@
1
+ import { css, LitElement, html, unsafeCSS } from 'lit';
2
+ import { customElement, property, queryAssignedNodes } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import styles from './code-snippet.scss?inline';
5
+ import hljs from 'highlight.js/lib/common';
6
+
7
+ declare global {
8
+ interface HTMLElementTagNameMap {
9
+ 'cv-code-snippet': CovalentCodeSnippet;
10
+ }
11
+ }
12
+
13
+ @customElement('cv-code-snippet')
14
+ export class CovalentCodeSnippet extends LitElement {
15
+ static override styles = [
16
+ css`
17
+ ${unsafeCSS(styles)}
18
+ `,
19
+ ];
20
+
21
+ @property()
22
+ language?: string;
23
+
24
+ @property()
25
+ label?: string;
26
+
27
+ @property({ type: Boolean, reflect: true })
28
+ inline = false;
29
+
30
+ @property({ type: Boolean, reflect: true })
31
+ hideHeader = false;
32
+
33
+ @queryAssignedNodes({})
34
+ _codeItems!: Array<Node>;
35
+
36
+ @property()
37
+ maxHeight?: number;
38
+
39
+ private _code = '';
40
+
41
+ highlight() {
42
+ this._code = '';
43
+ this._codeItems.forEach((codeEl) => {
44
+ this._code += hljs.highlight(codeEl.textContent ?? '', {
45
+ language: this.language ?? '',
46
+ }).value;
47
+ this.requestUpdate();
48
+ });
49
+ }
50
+
51
+ firstUpdated() {
52
+ this.highlight();
53
+ }
54
+
55
+ override render() {
56
+ let container = html`${this.renderContainer()}`;
57
+ if (!this.hideHeader) {
58
+ container = html`${this.renderHeader()}${this.renderContainer()}`;
59
+ }
60
+ return container;
61
+ }
62
+
63
+ renderContainer() {
64
+ const classes: { [key: string]: boolean } = {
65
+ 'cv-code-snippet': true,
66
+ hljs: true,
67
+ inline: this.inline,
68
+ };
69
+ classes[`language-${this.language}`] = true;
70
+ const container = document.createElement('div');
71
+ container.innerHTML = this._code.trim();
72
+
73
+ let styleHeight;
74
+ if (this.maxHeight && this.maxHeight > 0) {
75
+ styleHeight = `max-height: ${this.maxHeight}px`;
76
+ }
77
+
78
+ return html` <pre
79
+ style="${styleHeight}"
80
+ part="container"
81
+ ><code part="code" class="${classMap(classes)}">${container}</code></pre>
82
+ <slot class="code-slot"></slot>`;
83
+ }
84
+
85
+ renderHeader() {
86
+ return html`<div class="header" part="header">
87
+ <div class="title">${this.label}</div>
88
+ <span><slot name="actionItems"></slot></span>
89
+ </div>`;
90
+ }
91
+ }
92
+
93
+ export default CovalentCodeSnippet;
@@ -0,0 +1,39 @@
1
+ @use '@material/data-table' as data-table;
2
+
3
+ @mixin data-table-theme($theme) {
4
+ $surface: map-get($theme, surface);
5
+ $highlight: map-get($theme, surface-neutral-highlight);
6
+ $highlight-hover: map-get($theme, surface-neutral-highlight-hover);
7
+ $text: map-get($theme, text-primary-on-background);
8
+ $hint-text: map-get($theme, text-hint-on-background);
9
+ $icon: map-get($theme, text-icon-on-background);
10
+ $divider: map-get($theme, divider);
11
+
12
+ @include data-table.sort-icon-color($hint-text);
13
+ @include data-table.sort-icon-active-color($icon);
14
+ // @include data-table.header-row-fill-color,
15
+ // @include data-table.row-fill-color();
16
+ @include data-table.selected-row-fill-color($highlight);
17
+ @include data-table.row-hover-fill-color($highlight-hover);
18
+ @include data-table.header-row-text-color($text);
19
+ @include data-table.row-text-color($text);
20
+ @include data-table.divider-color($divider);
21
+ @include data-table.stroke-size(0);
22
+
23
+ .mdc-data-table {
24
+ width: 100%;
25
+ border-width: 0;
26
+ white-space: normal;
27
+ }
28
+
29
+ .mdc-data-table__header-cell {
30
+ font-family: var(--mdc-typography-font-family);
31
+ font-size: var(--mdc-typography-body2-font-size);
32
+ font-weight: 600;
33
+ line-height: var(--mdc-typography-body2-line-height);
34
+ }
35
+
36
+ .mdc-data-table__sort-icon-button {
37
+ font-size: 1rem;
38
+ }
39
+ }
@@ -0,0 +1,24 @@
1
+ import '../icon/icon';
2
+ import '../linear-progress/linear-progress';
3
+
4
+ // Example Content
5
+ import tableContent from '../../stories/demos/table.content.html?raw';
6
+ import tableRowSelectionContent from '../../stories/demos/table-row-selection.content.html?raw';
7
+ import tablePagination from '../../stories/demos/table-pagination.content.html?raw';
8
+ import tableProgressIndicator from '../../stories/demos/table-progress-indicator.content.html?raw';
9
+ import tableColumnSorting from '../../stories/demos/table-column-sorting.content.html?raw';
10
+
11
+ import './data-table.stories.scss';
12
+
13
+ export default {
14
+ title: 'Components/Data Table',
15
+ parameters: {
16
+ // layout: "fullscreen",
17
+ },
18
+ };
19
+
20
+ export const Basic = ({}) => tableContent;
21
+ export const RowSelection = ({}) => tableRowSelectionContent;
22
+ export const WithPagination = ({}) => tablePagination;
23
+ export const WithColumnSorting = ({}) => tableColumnSorting;
24
+ export const ProgressIndicator = ({}) => tableProgressIndicator;
@@ -0,0 +1,11 @@
1
+ @use '@material/checkbox'; // Required only for data table with row selection.
2
+ @use '@material/icon-button/icon-button'; // Required only for data table with column sorting.
3
+ @use '@material/linear-progress'; // Required only for data table with linear progress
4
+ @use '@material/select/styles'; // Required only for data table with pagination
5
+ @use '@material/data-table/data-table';
6
+
7
+ @include checkbox.core-styles;
8
+ @include linear-progress.core-styles;
9
+ @include icon-button.core-styles;
10
+ @include data-table.core-styles;
11
+ @include data-table.theme-baseline;
@@ -0,0 +1,39 @@
1
+ import { Canvas, Meta, DocsContainer, Story } from '@storybook/blocks';
2
+ import * as DialogStories from './dialog.stories';
3
+
4
+ <Meta of={DialogStories} />
5
+
6
+ # Dialogs
7
+
8
+ ## Basics
9
+
10
+ - Use only when the user has to make a decision RIGHT NOW
11
+ - It's always better to do the action and then allow an "undo" option rather than using an "Are you sure?" dialog
12
+ - To notify the user less intrusively, consider using a [snackbar](?path=/story/components-snackbar--basic) instead
13
+
14
+ ---
15
+
16
+ ## Anatomy
17
+
18
+ {/* <Story id="components-dialog--anatomy" /> is deprecated, please migrate it to <Story of={referenceToStory} /> see: https://storybook.js.org/migration-guides/7.0 */}
19
+
20
+ {' '}
21
+ <Story id="components-dialog--anatomy" />
22
+
23
+ ---
24
+
25
+ ## Examples
26
+
27
+ ### Logout
28
+
29
+ {/* <Story id="components-dialog--logout" /> is deprecated, please migrate it to <Story of={referenceToStory} /> see: https://storybook.js.org/migration-guides/7.0 */}
30
+
31
+ {' '}
32
+ <Story id="components-dialog--logout" />
33
+
34
+ ### Destructive dialog
35
+
36
+ {/* <Story id="components-dialog--udf" /> is deprecated, please migrate it to <Story of={referenceToStory} /> see: https://storybook.js.org/migration-guides/7.0 */}
37
+
38
+ {' '}
39
+ <Story id="components-dialog--udf" />
@@ -0,0 +1,17 @@
1
+ :host {
2
+ --mdc-dialog-heading-ink-color: var(--mdc-theme-text-primary-on-background);
3
+ --mdc-dialog-content-ink-color: var(--mdc-theme-text-primary-on-background);
4
+ --mdc-dialog-scroll-divider-color: var(--mdc-theme-border);
5
+
6
+ // Allow consumer to set border radius and height of the dialog
7
+ .mdc-dialog .mdc-dialog__surface {
8
+ border-radius: var(--cv-dialog-border-radius, var(--mdc-shape-medium, 4));
9
+ min-height: var(--mdc-dialog-min-height);
10
+ }
11
+
12
+ // Allow consumer to set padding of the dialog content
13
+ .mdc-dialog .mdc-dialog__content {
14
+ padding: var(--cv-dialog-vertical-padding, 20px)
15
+ var(--cv-dialog-horizontal-padding, 24px);
16
+ }
17
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentDialog } from './dialog';
6
+
7
+ describe('Dialog', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentDialog()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,89 @@
1
+ import dialogComponent from '../../stories/demos/dialog.component';
2
+ import './dialog';
3
+ import '../button/button';
4
+ import '../textfield/textfield';
5
+
6
+ export default {
7
+ title: 'Components/Dialog',
8
+ };
9
+
10
+ const Template = ({ trapFocus }) => {
11
+ document.addEventListener(
12
+ 'DOMContentLoaded',
13
+ () => {
14
+ const button = document.body.querySelector('#dialog-button');
15
+ button.addEventListener('click', () => {
16
+ const dialog = document.body.querySelector('#dialog1');
17
+ dialog.open = true;
18
+ });
19
+ },
20
+ { once: true },
21
+ );
22
+ return `
23
+ <cv-button id="dialog-button" raised>Open basic dialog</cv-button>
24
+ <cv-dialog id="dialog1" heading="Dialog header" ${trapFocus ? 'trapFocus' : ''} scrimClickAction="">
25
+ Dialog body text
26
+ <cv-button slot="primaryAction" dialogAction="close">Action 2</cv-button>
27
+ <cv-button slot="secondaryAction" dialogAction="close">Action 1</cv-button>
28
+ </cv-dialog>`;
29
+ };
30
+
31
+ export const Basic = dialogComponent.bind({});
32
+
33
+ export const Anatomy = Template.bind({});
34
+ Anatomy.args = {
35
+ trapFocus: true,
36
+ };
37
+
38
+ const templateLogout = () => {
39
+ document.addEventListener(
40
+ 'DOMContentLoaded',
41
+ () => {
42
+ const button = document.body.querySelector('#logout-button');
43
+ button.addEventListener('click', () => {
44
+ const dialog = document.body.querySelector('#example-logout');
45
+ dialog.open = true;
46
+ });
47
+ },
48
+ { once: true },
49
+ );
50
+ return `
51
+ <cv-button id="logoout-button" raised>Open logout dialog</cv-button>
52
+ <cv-dialog id="example-logout" heading="You will be logged out soon" scrimClickAction="">
53
+ Due to inactivity, you’ll be logged out in 3 minutes to protect your security.
54
+ <cv-button slot="primaryAction" dialogAction="close">Log out</cv-button>
55
+ <cv-button slot="secondaryAction" dialogAction="close">Stay logged in</cv-button>
56
+ </cv-dialog>`;
57
+ };
58
+
59
+ export const Logout = templateLogout.bind({});
60
+
61
+ const templateUDF = ({}) => {
62
+ document.addEventListener(
63
+ 'DOMContentLoaded',
64
+ () => {
65
+ const button = document.body.querySelector('#udf-button');
66
+ button.addEventListener('click', () => {
67
+ const dialog = document.body.querySelector('#example-udf');
68
+ dialog.open = true;
69
+ });
70
+ },
71
+ { once: true },
72
+ );
73
+ return `
74
+ <cv-button id="udf-button" raised>Open UDF dialog</cv-button>
75
+ <cv-dialog id="example-udf" heading="Delete User Defined Function" scrimClickAction="" >
76
+
77
+ <div class="key-value">
78
+ <div class="key-value--key mdc-typography--caption">Function to delete</div>
79
+ <div class="key-value--value">UDF_StrCpy</div>
80
+ </div>
81
+ <cv-formfield label="I understand that all queries currently using this UDF will be canceled">
82
+ <cv-checkbox class="child"></cv-checkbox>
83
+ </cv-formfield>
84
+ <cv-button slot="primaryAction" dialogAction="close" class="destructive primary" disabled>Delete</cv-button>
85
+ <cv-button slot="secondaryAction" dialogAction="close">Cancel</cv-button>
86
+ </cv-dialog>`;
87
+ };
88
+
89
+ export const UDF = templateUDF.bind({});
@@ -0,0 +1,44 @@
1
+ import { css, unsafeCSS } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import { DialogBase } from '@material/mwc-dialog/mwc-dialog-base';
4
+ import { MDCDialogAdapter } from '@material/dialog/adapter.js';
5
+ import { styles as baseStyles } from '@material/mwc-dialog/mwc-dialog.css';
6
+ import styles from './dialog.scss?inline';
7
+
8
+ declare global {
9
+ interface HTMLElementTagNameMap {
10
+ 'cv-dialog': CovalentDialog;
11
+ }
12
+ }
13
+
14
+ @customElement('cv-dialog')
15
+ export class CovalentDialog extends DialogBase {
16
+ static override styles = [
17
+ baseStyles,
18
+ css`
19
+ ${unsafeCSS(styles)}
20
+ `,
21
+ ];
22
+
23
+ /** Enables/Disables the trap focus functionality that uses blocking-elements library */
24
+ @property({ type: Boolean, reflect: true })
25
+ trapFocus = false;
26
+
27
+ protected override createAdapter(): MDCDialogAdapter {
28
+ const baseAdapater = super.createAdapter();
29
+
30
+ return {
31
+ ...baseAdapater,
32
+ // Override the trapFocus method to prevent the blocking-elements from assigning inert attribute
33
+ trapFocus: (el) => {
34
+ if (this.trapFocus) {
35
+ baseAdapater.trapFocus(el);
36
+ } else if (el && !this.isConnected) {
37
+ el.focus();
38
+ }
39
+ },
40
+ };
41
+ }
42
+ }
43
+
44
+ export default CovalentDialog;
@@ -0,0 +1,4 @@
1
+
2
+ :host {
3
+ border-color: var(--mdc-theme-border);
4
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentDrawer } from './drawer';
6
+
7
+ describe('Drawer', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentDrawer()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,18 @@
1
+ import { css, unsafeCSS } from 'lit';
2
+ import { customElement } from 'lit/decorators.js';
3
+ import { DrawerBase } from '@material/mwc-drawer/mwc-drawer-base';
4
+ import { styles as baseStyles } from '@material/mwc-drawer/mwc-drawer.css';
5
+ import styles from './drawer.scss?inline';
6
+
7
+ declare global {
8
+ interface HTMLElementTagNameMap {
9
+ 'cv-drawer': CovalentDrawer;
10
+ }
11
+ }
12
+
13
+ @customElement('cv-drawer')
14
+ export class CovalentDrawer extends DrawerBase {
15
+ static override styles = [baseStyles, css`${unsafeCSS(styles)}`];
16
+ }
17
+
18
+ export default CovalentDrawer
File without changes
@@ -0,0 +1,67 @@
1
+ @use '@material/typography/mdc-typography';
2
+
3
+ :host {
4
+ height: 100%;
5
+ display: flex;
6
+ align-items: center;
7
+ align-self: center;
8
+ }
9
+
10
+ .content {
11
+ display: flex;
12
+ flex-direction: column;
13
+ align-items: center;
14
+ justify-content: center;
15
+ text-align: center;
16
+ max-width: 360px;
17
+ margin: auto;
18
+ }
19
+
20
+ .icon-background {
21
+ display: flex;
22
+ justify-content: center;
23
+ align-items: center;
24
+ width: 96px;
25
+ height: 96px;
26
+ border-radius: 50%;
27
+ background-color: color-mix(
28
+ in srgb,
29
+ var(--mdc-theme-on-surface) 4%,
30
+ transparent
31
+ );
32
+ margin-left: auto;
33
+ margin-right: auto;
34
+ }
35
+
36
+ .covalent-icon {
37
+ font-size: 40px;
38
+ color: var(--mdc-theme-text-secondary-on-background);
39
+ }
40
+
41
+ .mdc-typography--headline6 {
42
+ font-family: var(--mdc-typography-headline6-font-family);
43
+ font-size: var(--mdc-typography-headline6-font-size);
44
+ font-weight: var(--mdc-typography-headline6-font-weight);
45
+ line-height: var(--mdc-typography-headline6-line-height);
46
+ color: var(--mdc-theme-text-secondary-on-background);
47
+ margin: 16px 0 8px;
48
+ }
49
+
50
+ .mdc-typography--body2 {
51
+ font-family: var(--mdc-typography-body2-font-family);
52
+ font-size: var(--mdc-typography-body2-font-size);
53
+ font-weight: var(--mdc-typography-body2-font-weight);
54
+ line-height: var(--mdc-typography-body2-line-height);
55
+ color: var(--mdc-theme-text-secondary-on-background);
56
+ margin: 0;
57
+ }
58
+
59
+ .buttonContainer {
60
+ display: flex;
61
+ gap: 0 20px;
62
+ margin-top: 16px;
63
+ }
64
+
65
+ h6 {
66
+ margin: 16px;
67
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentEmptyState } from './empty-state';
6
+
7
+ describe('Empty state', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentEmptyState()).toBeDefined();
10
+ });
11
+ });