@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,17 @@
1
+ :host {
2
+ --cv-status-header-item-width: 178px;
3
+
4
+ display: flex;
5
+ padding: 14px 16px;
6
+ align-items: center;
7
+ font-family: var(--mdc-typography-body2-font-family);
8
+ font-size: var(--mdc-typography-body2-font-size);
9
+ font-weight: var(--mdc-typography-body2-font-weight);
10
+ line-height: var(--mdc-typography-body2-line-height);
11
+ }
12
+
13
+ span {
14
+ display: inline-block;
15
+ width: var(--cv-status-header-item-width);
16
+ color: var(--mdc-theme-text-secondary-on-background);
17
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentStatusHeaderItem } from './status-header-item';
6
+
7
+ describe('Status header item', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentStatusHeaderItem()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,32 @@
1
+ import { css, html, LitElement, unsafeCSS } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import styles from './status-header-item.scss?inline';
4
+
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ 'cv-status-header-item': CovalentStatusHeaderItem;
8
+ }
9
+ }
10
+
11
+ /**
12
+ * Status header item
13
+ *
14
+ * @slot - This element has a slot
15
+ */
16
+ @customElement('cv-status-header-item')
17
+ export class CovalentStatusHeaderItem extends LitElement {
18
+ static override styles = [
19
+ css`
20
+ ${unsafeCSS(styles)}
21
+ `,
22
+ ];
23
+
24
+ @property()
25
+ label!: string;
26
+
27
+ render() {
28
+ return html`<span>${this.label}</span> <slot></slot>`;
29
+ }
30
+ }
31
+
32
+ export default CovalentStatusHeaderItem;
@@ -0,0 +1,57 @@
1
+ @use './status-header.theme';
2
+ @include status-header.theme();
3
+
4
+ .status-header-title {
5
+ padding: 0 0 16px 16px;
6
+ height: fit-content;
7
+ display: flex;
8
+ justify-content: space-between;
9
+ align-items: center;
10
+ }
11
+
12
+ .status-header-title-text {
13
+ font-family: var(--mdc-typography-headline6-font-family);
14
+ font-size: var(--mdc-typography-headline6-font-size);
15
+ font-weight: var(--mdc-typography-headline6-font-weight);
16
+ line-height: var(--mdc-typography-headline6-line-height);
17
+ }
18
+
19
+ .status-header-text {
20
+ font-family: var(--mdc-typography-body2-font-family);
21
+ font-size: var(--mdc-typography-body2-font-size);
22
+ font-weight: var(--mdc-typography-body2-font-weight);
23
+ line-height: var(--mdc-typography-body2-line-height);
24
+ }
25
+
26
+ .status-header-icon {
27
+ --mdc-icon-size: 36px;
28
+
29
+ border-radius: 50%;
30
+ min-width: 72px;
31
+ height: 72px;
32
+ display: flex;
33
+ justify-content: center;
34
+ align-items: center;
35
+ }
36
+
37
+ .status-header-status {
38
+ padding-left: 32px;
39
+ padding-bottom: 16px;
40
+ display: flex;
41
+ flex-direction: row;
42
+ align-items: center;
43
+ }
44
+
45
+ .status-header-text-block {
46
+ display: flex;
47
+ flex-direction: column;
48
+ margin-left: 12px;
49
+ margin-right: 56px;
50
+
51
+ .status-header-helper {
52
+ font-family: var(--mdc-typography-caption-font-family);
53
+ font-size: var(--mdc-typography-caption-font-size);
54
+ font-weight: var(--mdc-typography-caption-font-weight);
55
+ line-height: var(--mdc-typography-caption-line-height);
56
+ }
57
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentStatusHeader } from './status-header';
6
+
7
+ describe('Status header', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentStatusHeader()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,114 @@
1
+ import './status-header';
2
+ import './status-header-item';
3
+ import '../icon/icon';
4
+ import '../circular-progress/circular-progress';
5
+
6
+ export default {
7
+ title: 'Components/Status Header',
8
+ parameters: {
9
+ layout: 'fullscreen',
10
+ },
11
+ argTypes: {
12
+ state: {
13
+ options: ['active', 'caution', 'error', 'positive', 'neutral'],
14
+ control: { type: 'select' },
15
+ },
16
+ },
17
+ args: {
18
+ state: 'neutral',
19
+ title: 'Item details',
20
+ status: 'Status',
21
+ icon: 'Status',
22
+ },
23
+ };
24
+
25
+ const renderIcon = (state, icon) => {
26
+ if (state === 'active') {
27
+ return `<cv-circular-progress slot="status-header-icon" indeterminate density="-2"></cv-circular-progress>`;
28
+ } else if (state === 'pending') {
29
+ return `<cv-icon slot="status-header-icon" class="covalent-icon">loader_dots</cv-icon>`;
30
+ } else {
31
+ return `<cv-icon slot="status-header-icon">${icon}</cv-icon>`;
32
+ }
33
+ };
34
+
35
+ const HeaderWithTabs = ({
36
+ state = 'neutral',
37
+ status = 'status',
38
+ title = 'title',
39
+ icon,
40
+ }) => {
41
+ return `
42
+ <cv-status-header state="${state}" statusText="${status}" statusHelper="secondary text" titleText="${title}">
43
+ ${renderIcon(state, icon)}
44
+
45
+ <cv-icon-button slot="status-header-actions" icon="close" dialogAction="close" ></cv-icon-button>
46
+
47
+ <cv-status-header-item slot="status-header-text" label="Start time">
48
+ 09/30/21 4:38:50 PM
49
+ </cv-status-header-item>
50
+ <cv-status-header-item slot="status-header-text" label="Last heartbeat">
51
+ 09/30/21 4:38:51 PM
52
+ </cv-status-header-item>
53
+ <cv-status-header-item slot="status-header-text" label="Platform">
54
+ linux-x64
55
+ </cv-status-header-item>
56
+ <cv-status-header-item slot="status-header-text" label="Softvare version">
57
+ 02.18.00.01-1
58
+ </cv-status-header-item>
59
+ <cv-status-header-item slot="status-header-text" label="Primary Cluster">
60
+ Yes
61
+ </cv-status-header-item>
62
+ <cv-status-header-item slot="status-header-text" label="Primary Cluster manager">
63
+ cs3094-04.labs.teradata.com
64
+ </cv-status-header-item>
65
+ <cv-tab-bar activeIndex="0">
66
+ <cv-tab label="Tab one">
67
+ </cv-tab>
68
+ <cv-tab label="Tab two">
69
+ </cv-tab>
70
+ <cv-tab label="Tab three">
71
+ </cv-tab>
72
+ </cv-tab-bar>
73
+ </cv-status-header>`;
74
+ };
75
+
76
+ export const Active = HeaderWithTabs.bind({});
77
+ Active.args = {
78
+ state: 'active',
79
+ status: 'Running',
80
+ title: 'Active item details',
81
+ };
82
+ export const Caution = HeaderWithTabs.bind({});
83
+ Caution.args = {
84
+ state: 'caution',
85
+ icon: 'warning',
86
+ status: 'Caution',
87
+ title: 'Caution item details',
88
+ };
89
+ export const Error = HeaderWithTabs.bind({});
90
+ Error.args = {
91
+ state: 'error',
92
+ icon: 'error',
93
+ status: 'Error',
94
+ title: 'Error item details',
95
+ };
96
+ export const Positive = HeaderWithTabs.bind({});
97
+ Positive.args = {
98
+ state: 'positive',
99
+ icon: 'done',
100
+ status: 'Positive',
101
+ title: 'Positive item details',
102
+ };
103
+ export const Paused = HeaderWithTabs.bind({});
104
+ Paused.args = {
105
+ icon: 'pause',
106
+ status: 'Paused',
107
+ title: 'Paused item details',
108
+ };
109
+ export const Pending = HeaderWithTabs.bind({});
110
+ Pending.args = {
111
+ state: 'pending',
112
+ status: 'Pending',
113
+ title: 'Pending item details',
114
+ };
@@ -0,0 +1,26 @@
1
+ import { css, unsafeCSS } from 'lit';
2
+ import { customElement } from 'lit/decorators.js';
3
+ import { StatusHeaderBase } from './status-header-base';
4
+ import styles from './status-header.scss?inline';
5
+
6
+ /**
7
+ * Status header
8
+ *
9
+ * @slot - This element has a slot
10
+ */
11
+ @customElement('cv-status-header')
12
+ export class CovalentStatusHeader extends StatusHeaderBase {
13
+ static override styles = [
14
+ css`
15
+ ${unsafeCSS(styles)}
16
+ `,
17
+ ];
18
+ }
19
+
20
+ declare global {
21
+ interface HTMLElementTagNameMap {
22
+ 'cv-status-header': CovalentStatusHeader;
23
+ }
24
+ }
25
+
26
+ export default CovalentStatusHeader;
@@ -0,0 +1,17 @@
1
+ :host {
2
+ --mdc-theme-surface: var(--mdc-theme-background);
3
+ --mdc-switch-selected-handle-color: var(--mdc-theme-primary);
4
+ --mdc-switch-selected-hover-handle-color: var(--mdc-theme-primary);
5
+ --mdc-switch-selected-focus-handle-color: var(--mdc-theme-primary);
6
+ --mdc-switch-selected-pressed-handle-color: var(--mdc-theme-primary);
7
+ --mdc-switch-selected-track-color: var(--mdc-theme-surface-secondary);
8
+ --mdc-switch-selected-focus-track-color: var(
9
+ --mdc-theme-surface-secondary-highlight
10
+ );
11
+ --mdc-switch-selected-hover-track-color: var(
12
+ --mdc-theme-surface-secondary-highlight-hover
13
+ );
14
+ --mdc-switch-selected-pressed-track-color: var(
15
+ --mdc-theme-surface-secondary-highlight-hover
16
+ );
17
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentSwitch } from './switch';
6
+
7
+ describe('Switch', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentSwitch()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,41 @@
1
+ import './switch';
2
+ import '../formfield/formfield';
3
+
4
+ export default {
5
+ title: 'Components/Switch',
6
+ argTypes: {
7
+ disabled: {
8
+ control: 'boolean',
9
+ },
10
+ checked: {
11
+ control: 'boolean',
12
+ },
13
+ label: { control: 'text' },
14
+ onChange: { action: 'onChange' },
15
+ },
16
+ };
17
+
18
+ const Template = ({ disabled, label = 'On/Off', checked, onChange }) => {
19
+ const switchInput = document.createElement('cv-switch');
20
+ switchInput.checked = checked;
21
+ switchInput.disabled = disabled;
22
+ switchInput.ariaLabel = label;
23
+
24
+ switchInput.addEventListener('change', onChange);
25
+
26
+ if (label) {
27
+ const formfield = document.createElement('cv-formfield');
28
+ formfield.label = label;
29
+ formfield.appendChild(switchInput);
30
+
31
+ return formfield;
32
+ }
33
+
34
+ return `
35
+ <cv-formfield label="${label}" aria-label="${label}">
36
+ <cv-switch></cv-switch>
37
+ </cv-formfield>
38
+ `;
39
+ };
40
+
41
+ export const Basic = Template.bind({});
@@ -0,0 +1,18 @@
1
+ import { css, unsafeCSS } from 'lit';
2
+ import { customElement } from 'lit/decorators.js';
3
+ import { SwitchBase } from '@material/mwc-switch/mwc-switch-base';
4
+ import { styles as baseStyles } from '@material/mwc-switch/styles.css';
5
+ import styles from './switch.scss?inline';
6
+
7
+ declare global {
8
+ interface HTMLElementTagNameMap {
9
+ 'cv-switch': CovalentSwitch;
10
+ }
11
+ }
12
+
13
+ @customElement('cv-switch')
14
+ export class CovalentSwitch extends SwitchBase {
15
+ static override styles = [baseStyles, css`${unsafeCSS(styles)}`];
16
+ }
17
+
18
+ export default CovalentSwitch;
@@ -0,0 +1,38 @@
1
+ import { Canvas, DocsContainer, Meta, Story } from '@storybook/blocks';
2
+ import * as TabStories from './tab.stories';
3
+
4
+ <Meta of={TabStories} />
5
+
6
+ <style>
7
+ {`
8
+
9
+ mwc-tab-bar {
10
+ border-bottom: 1px solid var(--mdc-theme-border);
11
+ }
12
+ .sbdocs .docs-story {
13
+ min-height: 8rem;
14
+ }
15
+
16
+ `}
17
+ </style>
18
+
19
+ # Tabs
20
+
21
+ ## Basics
22
+
23
+ - Add 16px padding to the left and right of the tabs
24
+
25
+ ---
26
+
27
+ ## Examples
28
+
29
+ <Canvas>
30
+ <cv-tab-bar>
31
+ <cv-tab label="Tab one" />
32
+
33
+ <cv-tab label="Tab two" />
34
+
35
+ <cv-tab label="Tab three" />
36
+
37
+ </cv-tab-bar>
38
+ </Canvas>
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentTabBar } from './tab-bar';
6
+
7
+ describe('Tab bar', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentTabBar()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,16 @@
1
+ import { TabBarBase } from '@material/mwc-tab-bar/mwc-tab-bar-base';
2
+ import { styles } from '@material/mwc-tab-bar/mwc-tab-bar.css';
3
+ import { customElement } from 'lit/decorators.js';
4
+
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ 'cv-tab-bar': CovalentTabBar;
8
+ }
9
+ }
10
+
11
+ @customElement('cv-tab-bar')
12
+ export class CovalentTabBar extends TabBarBase {
13
+ static override styles = [styles];
14
+ }
15
+
16
+ export default CovalentTabBar;
@@ -0,0 +1,10 @@
1
+ :host {
2
+ --mdc-tab-text-label-color-default: var(
3
+ --mdc-theme-text-primary-on-background
4
+ );
5
+ --mdc-tab-color-default: var(--mdc-theme-text-icon-on-background);
6
+
7
+ .mdc-tab:not(.mdc-tab--active) .mdc-tab__text-label {
8
+ color: var(--mdc-theme-text-primary-on-background);
9
+ }
10
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentTab } from './tab';
6
+
7
+ describe('Tab', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentTab()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,30 @@
1
+ import './tab-bar';
2
+ import './tab';
3
+
4
+ export default {
5
+ title: 'Components/Tabs',
6
+ };
7
+
8
+ const Template = ({ icon, activeIndex = 0 }) => {
9
+ return `
10
+ <cv-tab-bar activeIndex="${activeIndex}">
11
+ <cv-tab${icon ? ` icon="${icon}"` : ``} label="Tab one">
12
+ </cv-tab>
13
+ <cv-tab${icon ? ` icon="${icon}"` : ``} label="Tab two">
14
+ </cv-tab>
15
+ <cv-tab${icon ? ` icon="${icon}"` : ``} label="Tab three">
16
+ </cv-tab>
17
+ </cv-tab-bar>`;
18
+ };
19
+
20
+ export const Basic = Template.bind({});
21
+
22
+ export const Icon = Template.bind({});
23
+ Icon.args = {
24
+ icon: 'houseboat',
25
+ };
26
+
27
+ export const Preselected = Template.bind({});
28
+ Preselected.args = {
29
+ activeIndex: 1,
30
+ };
package/src/tab/tab.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { css, unsafeCSS } from 'lit';
2
+ import { customElement } from 'lit/decorators.js';
3
+ import { TabBase } from '@material/mwc-tab/mwc-tab-base';
4
+ import { styles as baseStyles } from '@material/mwc-tab/mwc-tab.css';
5
+ import styles from './tab.scss?inline'
6
+
7
+ declare global {
8
+ interface HTMLElementTagNameMap {
9
+ 'cv-tab': CovalentTab;
10
+ }
11
+ }
12
+
13
+ @customElement('cv-tab')
14
+ export class CovalentTab extends TabBase {
15
+ static override styles = [baseStyles, css`${unsafeCSS(styles)}`];
16
+ }
17
+
18
+ export default CovalentTab;
@@ -0,0 +1,66 @@
1
+ .subtext--trailing {
2
+ display: flex;
3
+ flex-direction: column-reverse;
4
+ }
5
+
6
+ .subtext {
7
+ display: flex;
8
+ align-items: center;
9
+
10
+ --mdc-icon-size: 16px;
11
+
12
+ color: var(--mdc-theme-text-secondary-on-background);
13
+ font-family: var(--mdc-typography-caption-font-family);
14
+ font-size: var(--mdc-typography-caption-font-size);
15
+ font-weight: var(--mdc-typography-caption-font-weight);
16
+ line-height: var(--mdc-typography-caption-line-height);
17
+ margin-bottom: 2px;
18
+
19
+ cv-icon {
20
+ margin-right: 8px;
21
+ }
22
+ }
23
+
24
+ slot {
25
+ font-family: var(--mdc-typography-body1-font-family);
26
+ font-size: var(--mdc-typography-body1-font-size);
27
+ font-weight: var(--mdc-typography-body1-font-weight);
28
+ line-height: var(--mdc-typography-body1-line-height);
29
+ margin-bottom: 8px;
30
+ }
31
+
32
+ .scale--large {
33
+ .subtext {
34
+ --mdc-icon-size: 24px;
35
+
36
+ font-family: var(--mdc-typography-body1-font-family);
37
+ font-size: var(--mdc-typography-body1-font-size);
38
+ font-weight: var(--mdc-typography-body1-font-weight);
39
+ line-height: var(--mdc-typography-body1-line-height);
40
+ margin-bottom: 2px;
41
+ }
42
+
43
+ slot {
44
+ font-family: var(--mdc-typography-headline4-font-family);
45
+ font-size: var(--mdc-typography-headline4-font-size);
46
+ font-weight: var(--mdc-typography-headline4-font-weight);
47
+ line-height: var(--mdc-typography-headline4-line-height);
48
+ margin-bottom: 8px;
49
+ }
50
+ }
51
+
52
+ .subtext-state--positive .subtext {
53
+ color: var(--mdc-theme-positive);
54
+ }
55
+
56
+ .subtext-state--negative .subtext {
57
+ color: var(--mdc-theme-negative);
58
+ }
59
+
60
+ .subtext-state--caution .subtext {
61
+ color: var(--mdc-theme-caution);
62
+ }
63
+
64
+ .subtext-state--active .subtext {
65
+ color: var(--mdc-theme-accent);
66
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentTextLockup } from './text-lockup';
6
+
7
+ describe('Text lockup', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentTextLockup()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,67 @@
1
+ import './text-lockup';
2
+ import iconList from '../../../icons/material-codepoints.json';
3
+
4
+ const MAT_ICON_LIST = Object.keys(iconList);
5
+
6
+ export default {
7
+ title: 'Components/Text lockup',
8
+ argTypes: {
9
+ scale: {
10
+ options: ['large', 'small'],
11
+ control: { type: 'radio' },
12
+ },
13
+ icon: {
14
+ options: MAT_ICON_LIST,
15
+ control: { type: 'select' },
16
+ },
17
+ subTextState: {
18
+ options: ['active', 'positive', 'negative', 'caution'],
19
+ control: { type: 'select' },
20
+ },
21
+ },
22
+ args: {
23
+ scale: 'small',
24
+ text: 'TDICAM-8523411',
25
+ subText: 'environment Id',
26
+ subTextTrailing: false,
27
+ },
28
+ };
29
+
30
+ export const textLockup = ({
31
+ icon,
32
+ scale,
33
+ subText,
34
+ subTextState,
35
+ subTextTrailing,
36
+ text,
37
+ }) => {
38
+ return `
39
+ <cv-text-lockup
40
+ subtext="${subText}"
41
+ scale="${scale}"
42
+ ${icon ? `icon="${icon}"` : ''}
43
+ ${subTextState ? `state="${subTextState}"` : ''}
44
+ ${subTextTrailing ? 'trailingSubText' : ''}>${text}</cv-text-lockup>
45
+ `;
46
+ };
47
+
48
+ export const textLockupLarge = textLockup.bind({});
49
+ textLockupLarge.args = {
50
+ scale: 'large',
51
+ };
52
+
53
+ export const textLockupTrailing = textLockup.bind({});
54
+ textLockupTrailing.args = {
55
+ text: 'Jan 12th, 2022 at 5:10pm',
56
+ subText: 'Date last ran successfully',
57
+ subTextTrailing: true,
58
+ };
59
+
60
+ export const textLockupWithIcon = textLockup.bind({});
61
+ textLockupWithIcon.args = {
62
+ icon: 'warning',
63
+ text: 'Daily production backup job',
64
+ subText: 'completed with issues',
65
+ subTextState: 'caution',
66
+ subTextTrailing: true,
67
+ };