@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,55 @@
1
+ import { css, html, LitElement, nothing, unsafeCSS } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import styles from './text-lockup.scss?inline';
5
+
6
+ declare global {
7
+ interface HTMLElementTagNameMap {
8
+ 'cv-text-lockup': CovalentTextLockup;
9
+ }
10
+ }
11
+
12
+ @customElement('cv-text-lockup')
13
+ export class CovalentTextLockup extends LitElement {
14
+ static override styles = [
15
+ css`
16
+ ${unsafeCSS(styles)}
17
+ `,
18
+ ];
19
+
20
+ @property()
21
+ subText!: string;
22
+
23
+ @property()
24
+ icon?: string;
25
+
26
+ @property()
27
+ state?: 'active' | 'positive' | 'negative' | 'caution';
28
+
29
+ @property()
30
+ scale: 'large' | 'small' = 'small';
31
+
32
+ @property({ type: Boolean, reflect: true })
33
+ trailingSubText = false;
34
+
35
+ override render() {
36
+ const classes: { [key: string]: boolean } = {
37
+ 'subtext--trailing': this.trailingSubText,
38
+ };
39
+ classes[`scale--${this.scale}`] = true;
40
+
41
+ if (this.state) {
42
+ classes[`subtext-state--${this.state}`] = true;
43
+ }
44
+ return html`<span class="${classMap(classes)}"
45
+ ><span class="subtext">${this.renderIcon()}${this.subText}</span
46
+ ><slot></slot
47
+ ></span>`;
48
+ }
49
+
50
+ renderIcon() {
51
+ return this.icon ? html`<cv-icon>${this.icon}</cv-icon>` : nothing;
52
+ }
53
+ }
54
+
55
+ export default CovalentTextLockup;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentTextArea } from './textarea';
6
+
7
+ describe('Text area', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentTextArea()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,39 @@
1
+ import './textarea';
2
+
3
+ export default {
4
+ title: 'Components/Text area',
5
+ argTypes: {
6
+ style: {
7
+ options: ['outlined', 'filled'],
8
+ control: { type: 'radio' },
9
+ },
10
+ },
11
+ args: {
12
+ style: 'outlined',
13
+ disabled: false,
14
+ },
15
+ };
16
+
17
+ const Template = ({ label, style, disabled, required, helper }) => {
18
+ return `
19
+ <cv-textarea
20
+ label="${label ?? style}"
21
+ ${style}
22
+ ${helper ? `helper="${helper}"` : null}
23
+ ${disabled ? `disabled` : null}
24
+ ${required ? `required` : null}>
25
+ </cv-textarea>`;
26
+ };
27
+
28
+ export const Basic = Template.bind({});
29
+
30
+ export const Required = Template.bind({});
31
+ Required.args = {
32
+ required: true,
33
+ };
34
+
35
+ export const HelperText = Template.bind({});
36
+ HelperText.args = {
37
+ label: 'Click to see helper text',
38
+ helper: 'Helper Text',
39
+ };
@@ -0,0 +1,19 @@
1
+ import { css, unsafeCSS } from 'lit';
2
+ import { customElement } from 'lit/decorators.js';
3
+ import { TextAreaBase } from '@material/mwc-textarea/mwc-textarea-base';
4
+ import { styles as baseTextAreaStyles } from '@material/mwc-textarea/mwc-textarea.css';
5
+ import { styles as textfieldStyles } from '@material/mwc-textfield/mwc-textfield.css.js';
6
+ import styles from '../textfield/textfield.scss?inline';
7
+
8
+ declare global {
9
+ interface HTMLElementTagNameMap {
10
+ 'cv-textarea': CovalentTextArea;
11
+ }
12
+ }
13
+
14
+ @customElement('cv-textarea')
15
+ export class CovalentTextArea extends TextAreaBase {
16
+ static override styles = [textfieldStyles, baseTextAreaStyles, css`${unsafeCSS(styles)}`];
17
+ }
18
+
19
+ export default CovalentTextArea;
@@ -0,0 +1,34 @@
1
+ :host {
2
+ --mdc-text-field-label-ink-color: var(
3
+ --mdc-theme-text-secondary-on-background
4
+ );
5
+ --mdc-text-field-ink-color: var(--mdc-theme-text-secondary-on-background);
6
+ --mdc-text-field-fill-color: var(--mdc-theme-surface-canvas);
7
+ --mdc-text-field-idle-line-color: var(--mdc-theme-border);
8
+ --mdc-text-field-hover-line-color: var(--mdc-theme-text-icon-on-background);
9
+ --mdc-text-field-outlined-idle-border-color: var(--mdc-theme-border);
10
+ --mdc-text-field-outlined-hover-border-color: var(
11
+ --mdc-theme-text-icon-on-background
12
+ );
13
+ --mdc-text-field-outlined-disabled-border-color: var(--cv-theme-outline-12);
14
+ --mdc-text-field-disabled-ink-color: var(--cv-theme-on-surface-38);
15
+ --mdc-typography-subtitle1-font-family: var(
16
+ --mdc-typography-body1-font-family
17
+ );
18
+ --mdc-typography-subtitle1-font-size: var(
19
+ --mdc-typography-body1-font-size,
20
+ 1rem
21
+ );
22
+ --mdc-typography-subtitle1-font-weight: var(
23
+ --mdc-typography-body1-font-weight,
24
+ 400
25
+ );
26
+ }
27
+
28
+ :host([dense]) {
29
+ height: 48px;
30
+ }
31
+
32
+ .mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__icon {
33
+ color: var(--mdc-theme-text-icon-on-background);
34
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentTextField } from './textfield';
6
+
7
+ describe('Text field', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentTextField()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,60 @@
1
+ import './textfield';
2
+
3
+ export default {
4
+ title: 'Components/Text field',
5
+ argTypes: {
6
+ style: {
7
+ options: ['outlined', 'filled'],
8
+ control: { type: 'radio' },
9
+ },
10
+ },
11
+ args: {
12
+ style: 'outlined',
13
+ disabled: false,
14
+ },
15
+ };
16
+
17
+ const Template = ({
18
+ icon,
19
+ iconTrailing,
20
+ label,
21
+ style,
22
+ disabled,
23
+ required,
24
+ helper,
25
+ }) => {
26
+ return `
27
+ <cv-textfield
28
+ label="${label ?? style}"
29
+ ${style}
30
+ ${
31
+ iconTrailing && icon
32
+ ? `iconTrailing="${icon}"`
33
+ : icon
34
+ ? `icon="${icon}"`
35
+ : null
36
+ }
37
+ ${helper ? `helper="${helper}"` : null}
38
+ ${disabled ? `disabled` : null}
39
+ ${required ? `required` : null}>
40
+ </cv-textfield>`;
41
+ };
42
+
43
+ export const Basic = Template.bind({});
44
+
45
+ export const Required = Template.bind({});
46
+ Required.args = {
47
+ required: true,
48
+ };
49
+
50
+ export const Icon = Template.bind({});
51
+ Icon.args = {
52
+ icon: 'houseboat',
53
+ iconTrailing: false,
54
+ };
55
+
56
+ export const HelperText = Template.bind({});
57
+ HelperText.args = {
58
+ label: 'Click to see helper text',
59
+ helper: 'Helper Text',
60
+ };
@@ -0,0 +1,25 @@
1
+ import { css, unsafeCSS } from 'lit';
2
+ import { customElement } from 'lit/decorators.js';
3
+ import { TextFieldBase } from '@material/mwc-textfield/mwc-textfield-base';
4
+ import { styles as baseTextFieldStyles } from '@material/mwc-textfield/mwc-textfield.css';
5
+ import styles from './textfield.scss?inline';
6
+
7
+ declare global {
8
+ interface HTMLElementTagNameMap {
9
+ 'cv-textfield': CovalentTextField;
10
+ }
11
+ }
12
+
13
+ @customElement('cv-textfield')
14
+ export class CovalentTextField extends TextFieldBase {
15
+ static override styles = [
16
+ baseTextFieldStyles,
17
+ css`
18
+ ${unsafeCSS(styles)}
19
+ `,
20
+ ];
21
+
22
+ override outlined = true;
23
+ }
24
+
25
+ export default CovalentTextField;
@@ -0,0 +1,46 @@
1
+ @mixin css-variable-tokens($theme, $prefix: 'cv-theme') {
2
+ @each $key, $value in $theme {
3
+ --#{$prefix}-#{$key}: #{map-get($theme, $key)};
4
+ }
5
+ }
6
+
7
+ @mixin components-theme($theme, $typography) {
8
+ // Covalent theme tokens as css variables
9
+ @include css-variable-tokens($theme);
10
+ // Covalent typography tokens as css variables
11
+ @include css-variable-tokens($typography, 'cv-typography');
12
+ // Material tokens as css variables
13
+ @include css-variable-tokens($theme, 'mdc-theme');
14
+ // Material typography tokens as css variables
15
+ @include css-variable-tokens($typography, 'mdc-typography');
16
+
17
+ // Overrides that dont fit in the theme map
18
+ --mdc-theme-border: #{map-get($theme, divider)};
19
+ --mdc-theme-surface-accent: #{map-get($theme, surface-primary)};
20
+ --mdc-theme-surface-accent-highlight: #{map-get(
21
+ $theme,
22
+ surface-primary-highlight
23
+ )};
24
+ --mdc-theme-surface-accent-highlight-hover: #{map-get(
25
+ $theme,
26
+ surface-primary-highlight-hover
27
+ )};
28
+ --mdc-typography-button-letter-spacing: 0;
29
+
30
+ // Icons
31
+ --mdc-icon-font: 'Material Symbols Outlined';
32
+
33
+ // Ripple
34
+ --mdc-ripple-color: #{map-get($theme, on-surface)};
35
+
36
+ // Shape
37
+ --mdc-shape-small: 8px;
38
+ --mdc-shape-medium: 8px;
39
+
40
+ // Tooltip
41
+ --mdc-plain-tooltip-container-color: #{map-get($theme, inverse-surface)};
42
+ --mdc-plain-tooltip-supporting-text-color: #{map-get(
43
+ $theme,
44
+ inverse-on-surface
45
+ )};
46
+ }
@@ -0,0 +1,17 @@
1
+ @use '@covalent/tokens' as tokens;
2
+ @use '../../data-table/data-table.theme' as data-table;
3
+ @use '../' as theme;
4
+
5
+ $theme-tokens: map-get(tokens.$tokens, 'theme');
6
+ $dark-tokens: map-get($theme-tokens, 'dark');
7
+ $dark-colors: map-get($dark-tokens, 'colors');
8
+ $typography: map-get(tokens.$tokens, 'typography');
9
+ // Deprecated tokens
10
+ $dark-colors: map-merge($dark-colors, map-get(tokens.$tokens, 'dark'));
11
+
12
+ // Define the base theme using dark tokens w/ dark tokens
13
+ :root {
14
+ @include theme.components-theme($dark-colors, $typography);
15
+
16
+ @include data-table.data-table-theme($dark-colors);
17
+ }
@@ -0,0 +1,17 @@
1
+ @use '@covalent/tokens' as tokens;
2
+ @use '../../data-table/data-table.theme' as data-table;
3
+ @use '../' as theme;
4
+
5
+ $theme-tokens: map-get(tokens.$tokens, 'theme');
6
+ $light-tokens: map-get($theme-tokens, 'light');
7
+ $light-colors: map-get($light-tokens, 'colors');
8
+ $typography: map-get(tokens.$tokens, 'typography');
9
+ // Deprecated tokens
10
+ $light-colors: map-merge($light-colors, map-get(tokens.$tokens, 'light'));
11
+
12
+ // Define the base theme using light tokens w/ light tokens
13
+ :root {
14
+ @include theme.components-theme($light-colors, $typography);
15
+
16
+ @include data-table.data-table-theme($light-colors);
17
+ }
@@ -0,0 +1,37 @@
1
+ @use '@material/mwc-top-app-bar/node_modules/@material/top-app-bar/mdc-top-app-bar';
2
+
3
+ :host {
4
+ display: block;
5
+ }
6
+
7
+ :host([sticky]) {
8
+ position: sticky;
9
+ top: 0;
10
+ }
11
+
12
+ .mdc-top-app-bar__title {
13
+ padding-left: 0;
14
+ }
15
+
16
+ @media screen and (max-width: 768px) {
17
+ .mdc-top-app-bar__title {
18
+ font-family: var(--mdc-typography-subtitle2-font-family);
19
+ font-size: var(--mdc-typography-subtitle2-font-size);
20
+ font-weight: var(--mdc-typography-subtitle2-font-weight);
21
+ line-height: var(--mdc-typography-subtitle2-line-height);
22
+ }
23
+ }
24
+
25
+ .mdc-top-app-bar {
26
+ position: static;
27
+ background-color: transparent;
28
+ background-color: var(--mdc-theme-surface);
29
+ color: var(--mdc-theme-on-surface);
30
+ border-top-left-radius: var(--cv-border-radius-outer);
31
+ border-top-right-radius: var(--cv-border-radius-outer);
32
+ }
33
+
34
+ .mdc-top-app-bar--fixed-adjust,
35
+ .mdc-top-app-bar--dense-fixed-adjust {
36
+ padding-top: 0;
37
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentToolbar } from './toolbar';
6
+
7
+ describe('Toolbar', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentToolbar()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,66 @@
1
+ import './toolbar';
2
+
3
+ import '../button/button';
4
+ import '../icon-button/icon-button';
5
+
6
+ export default {
7
+ title: 'Components/Toolbar',
8
+ args: {
9
+ title: 'Page title',
10
+ dense: false,
11
+ filter: true,
12
+ search: true,
13
+ add: true,
14
+ secondaryAction: true,
15
+ action: true,
16
+ },
17
+ parameters: {
18
+ layout: 'fullscreen',
19
+ },
20
+ };
21
+
22
+ export const Toolbar = ({
23
+ dense,
24
+ title,
25
+ filter,
26
+ search,
27
+ add,
28
+ secondaryAction,
29
+ action,
30
+ }) => {
31
+ return `
32
+ <cv-toolbar ${dense ? 'dense' : ''}>
33
+ <span slot="title">${title}</span>
34
+ ${
35
+ filter
36
+ ? '<cv-icon-button icon="filter_list" slot="actionItems"></cv-icon-button>'
37
+ : ''
38
+ }
39
+ ${
40
+ search
41
+ ? '<cv-icon-button icon="search" slot="actionItems"></cv-icon-button>'
42
+ : ''
43
+ }
44
+ ${
45
+ add
46
+ ? '<cv-icon-button icon="add" slot="actionItems"></cv-icon-button>'
47
+ : ''
48
+ }
49
+ ${
50
+ secondaryAction
51
+ ? '<cv-button outlined slot="actionItems">Button text</cv-button>'
52
+ : ''
53
+ }
54
+ ${
55
+ action
56
+ ? '<cv-button outlined slot="actionItems">Button text</cv-button>'
57
+ : ''
58
+ }
59
+ </cv-toolbar>
60
+ `;
61
+ };
62
+
63
+ export const denseToolbar = Toolbar.bind({});
64
+ denseToolbar.args = {
65
+ dense: 'true',
66
+ };
@@ -0,0 +1,27 @@
1
+ import { css, unsafeCSS } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import { TopAppBarBase } from '@material/mwc-top-app-bar/mwc-top-app-bar-base';
4
+ import styles from './toolbar.scss?inline';
5
+
6
+ declare global {
7
+ interface HTMLElementTagNameMap {
8
+ 'cv-toolbar': CovalentToolbar;
9
+ }
10
+ }
11
+
12
+ @customElement('cv-toolbar')
13
+ export class CovalentToolbar extends TopAppBarBase {
14
+ static override styles = [
15
+ css`
16
+ ${unsafeCSS(styles)}
17
+ `,
18
+ ];
19
+
20
+ /**
21
+ * position sticky when scrolled
22
+ */
23
+ @property({ type: Boolean, reflect: true })
24
+ sticky = false;
25
+ }
26
+
27
+ export default CovalentToolbar;
@@ -0,0 +1,16 @@
1
+ @use '@material/tooltip/tooltip-theme' as tooltip-theme;
2
+ @use '@material/tooltip/styles' as tooltip;
3
+
4
+ @include tooltip-theme.fill-color(var(--mdc-plain-tooltip-container-color));
5
+ @include tooltip-theme.label-ink-color(
6
+ var(--mdc-plain-tooltip-supporting-text-color)
7
+ );
8
+
9
+ .mdc-tooltip {
10
+ @include tooltip-theme.rich-fill-color(var(--cv-theme-surface-container));
11
+ @include tooltip-theme.rich-text-ink-color(
12
+ var(--cv-theme-on-surface-variant),
13
+ var(--cv-theme-on-surface-variant),
14
+ var(--mdc-theme-accent)
15
+ );
16
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentTooltip } from './tooltip';
6
+
7
+ describe('Tooltip', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentTooltip()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,72 @@
1
+ import './tooltip';
2
+ import '../icon/icon';
3
+
4
+ export default {
5
+ title: 'Components/Tooltip',
6
+ argTypes: {
7
+ showDelayInMs: {
8
+ control: 'number',
9
+ label: 'show delay in milliseconds',
10
+ },
11
+ hideDelayInMs: {
12
+ control: 'number',
13
+ label: 'hide delay in milliseconds',
14
+ },
15
+ },
16
+ args: {
17
+ content: "I'm a tooltip!",
18
+ },
19
+ };
20
+
21
+ const Template = ({
22
+ richTitle,
23
+ isRich,
24
+ isPersistent,
25
+ content,
26
+ showDelayInMs,
27
+ hideDelayInMs,
28
+ }) => {
29
+ document.addEventListener('DOMContentLoaded', () => {
30
+ window.tooltip.anchor = window.button;
31
+ });
32
+ return `
33
+ <cv-icon
34
+ style="font-size: 36px;"
35
+ aria-expanded="true"
36
+ aria-haspopup="dialog"
37
+ id="button">
38
+ help
39
+ </cv-icon>
40
+ <cv-tooltip
41
+ id="tooltip"
42
+ ${richTitle ? `richTitle="${richTitle}"` : ''}
43
+ ${showDelayInMs >= 0 ? `showDelay="${showDelayInMs}"` : ''}
44
+ ${hideDelayInMs >= 0 ? `hideDelay="${hideDelayInMs}"` : ''}
45
+ ${isRich ? 'rich' : ''}
46
+ ${isPersistent ? 'persistent' : ''}>
47
+ ${content}
48
+ </cv-tooltip>
49
+ `;
50
+ };
51
+
52
+ export const Basic = Template.bind({});
53
+
54
+ export const Rich = Template.bind({});
55
+ Rich.args = {
56
+ isRich: true,
57
+ isPersistent: true,
58
+ richTitle: 'This is the rich title!',
59
+ content: `
60
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur
61
+ pretium vitae est et dapibus. Aenean sit amet felis eu lorem fermentum
62
+ aliquam sit amet sit amet eros.
63
+ <a class="mdc-tooltip__content-link" href="http://teradata.com" target="_blank">Learn more</a>.
64
+ <cv-button slot="actionItems" label="Action"></button>
65
+ `,
66
+ };
67
+
68
+ export const NoDelay = Template.bind({});
69
+ NoDelay.args = {
70
+ showDelayInMs: 0,
71
+ hideDelayInMs: 0,
72
+ };