@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 './icon';
2
+ import './icon-demo';
3
+ import { MAT_ICON_LIST, COV_ICON_LIST } from './_icon-list';
4
+
5
+ export default {
6
+ title: 'Components/Icon',
7
+ argTypes: {
8
+ icon: {
9
+ options: MAT_ICON_LIST,
10
+ control: { type: 'select' },
11
+ },
12
+ size: {
13
+ options: ['64px', '48px', '24px', '16px'],
14
+ control: { type: 'select' },
15
+ },
16
+ },
17
+ args: {
18
+ icon: 'houseboat',
19
+ size: '48px',
20
+ },
21
+ };
22
+
23
+ const Template = ({ icon, size }, ...args) => {
24
+ const icoElem = document.createElement('cv-icon');
25
+ icoElem.innerText = icon;
26
+ icoElem.style.fontSize = size;
27
+
28
+ if (args[0].parameters.showCovIcons) {
29
+ icoElem.setAttribute('iconFont', 'covalent-icons');
30
+ }
31
+
32
+ return icoElem;
33
+ };
34
+
35
+ const AllCovalentIconsTemplate = () => {
36
+ return `<cv-icon-demo></cv-icon-demo>`;
37
+ };
38
+
39
+ export const MaterialIcons = Template.bind({});
40
+
41
+ export const CovalentIcons = Template.bind({});
42
+ CovalentIcons.parameters = {
43
+ showCovIcons: true,
44
+ };
45
+
46
+ CovalentIcons.argTypes = {
47
+ icon: {
48
+ options: COV_ICON_LIST,
49
+ },
50
+ };
51
+ CovalentIcons.args = {
52
+ icon: 'product_editor',
53
+ };
54
+
55
+ export const AllCovalentIcons = AllCovalentIconsTemplate.bind({});
@@ -0,0 +1,16 @@
1
+ import { Icon } from '@material/mwc-icon/mwc-icon';
2
+ import { styles } from '@material/mwc-icon/mwc-icon-host.css';
3
+ import { customElement } from 'lit/decorators.js';
4
+
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ 'cv-icon': CovalentIcon;
8
+ }
9
+ }
10
+
11
+ @customElement('cv-icon')
12
+ export class CovalentIcon extends Icon {
13
+ static override styles = [styles];
14
+ }
15
+
16
+ export default CovalentIcon
@@ -0,0 +1,9 @@
1
+ @use '@material/icon-button';
2
+
3
+ @mixin icon-button-theme($theme) {
4
+ $icon: map-get($theme, text-icon-on-background);
5
+
6
+ .mdc-icon-button {
7
+ @include icon-button.ink-color($icon);
8
+ }
9
+ }
@@ -0,0 +1,12 @@
1
+ :host {
2
+ color: var(--mdc-theme-text-icon-on-background);
3
+
4
+ .mdc-icon-button {
5
+ cursor: var(--cv-icon-button-cursor, pointer);
6
+
7
+ &:active,
8
+ &:focus {
9
+ font-variation-settings: 'FILL' 1;
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentIconButton } from './icon-button';
6
+
7
+ describe('Icon button', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentIconButton()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,24 @@
1
+ import './icon-button';
2
+ import iconList from '../../../icons/material-codepoints.json';
3
+
4
+ export default {
5
+ title: 'Components/Icon Button',
6
+ argTypes: {
7
+ icon: {
8
+ control: 'select',
9
+ options: Object.keys(iconList),
10
+ },
11
+ },
12
+ args: {
13
+ icon: 'houseboat',
14
+ disabled: false,
15
+ },
16
+ };
17
+
18
+ const Template = ({ disabled, icon }) => {
19
+ return `
20
+ <cv-icon-button icon="${icon}" ${disabled ? `disabled` : ``}>
21
+ </cv-icon-button>`;
22
+ };
23
+
24
+ export const Basic = Template.bind({});
@@ -0,0 +1,19 @@
1
+ import { css, unsafeCSS } from 'lit';
2
+ import { customElement } from 'lit/decorators.js';
3
+ import { IconButtonBase } from '@material/mwc-icon-button/mwc-icon-button-base';
4
+ import { styles as baseStyles } from '@material/mwc-icon-button/mwc-icon-button.css';
5
+ import styles from './icon-button.scss?inline';
6
+
7
+ declare global {
8
+ interface HTMLElementTagNameMap {
9
+ 'cv-icon-button': CovalentIconButton;
10
+ }
11
+ }
12
+
13
+ @customElement('cv-icon-button')
14
+ export class CovalentIconButton extends IconButtonBase {
15
+ static override styles = [baseStyles, css`${unsafeCSS(styles)}`];
16
+ }
17
+
18
+
19
+ export default CovalentIconButton;
@@ -0,0 +1,19 @@
1
+ :host {
2
+ border-radius: 50%;
3
+ color: var(--cv-theme-on-surface-variant);
4
+ }
5
+
6
+ :host([disabled]) {
7
+ background-color: transparent;
8
+ }
9
+
10
+ :host([on]) {
11
+ --mdc-ripple-color: var(--cv-theme-on-surface);
12
+
13
+ background-color: var(--cv-theme-secondary-container);
14
+ color: var(--cv-theme-on-secondary-container);
15
+
16
+ .material-icons {
17
+ font-variation-settings: 'FILL' 1;
18
+ }
19
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentIconButtonToggle } from './icon-button-toggle';
6
+
7
+ describe('Icon button toggle', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentIconButtonToggle()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,32 @@
1
+ import './icon-button-toggle';
2
+ import iconList from '../../../icons/material-codepoints.json';
3
+
4
+ export default {
5
+ title: 'Components/Icon Button Toggle',
6
+ argTypes: {
7
+ onIcon: {
8
+ control: 'select',
9
+ options: Object.keys(iconList),
10
+ },
11
+ offIcon: {
12
+ control: 'select',
13
+ options: Object.keys(iconList),
14
+ },
15
+ },
16
+ args: {
17
+ onIcon: 'flashlight_on',
18
+ offIcon: 'flashlight_off',
19
+ disabled: false,
20
+ toggledOn: false,
21
+ },
22
+ };
23
+
24
+ const Template = ({ disabled, onIcon, offIcon, toggledOn }) => {
25
+ return `
26
+ <cv-icon-button-toggle onIcon="${onIcon}" offIcon="${offIcon}"${
27
+ disabled ? ` disabled` : ``
28
+ }${toggledOn ? ' toggledOn' : ''}>
29
+ </cv-icon-button-toggle>`;
30
+ };
31
+
32
+ export const Basic = Template.bind({});
@@ -0,0 +1,50 @@
1
+ import { css, html, PropertyValues, unsafeCSS } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import { IconButtonToggle } from '@material/mwc-icon-button-toggle/mwc-icon-button-toggle';
4
+ import styles from './icon-button-toggle.scss?inline';
5
+
6
+ declare global {
7
+ interface HTMLElementTagNameMap {
8
+ 'cv-icon-button-toggle': CovalentIconButtonToggle;
9
+ }
10
+ }
11
+
12
+ @customElement('cv-icon-button-toggle')
13
+ export class CovalentIconButtonToggle extends IconButtonToggle {
14
+ /**
15
+ * Angular doesn't allow properties that begin with 'on' to be set due to security reasons.
16
+ * This is an alias for the 'on' property in mwc-icon-button-toggle, which can be used to toggle the button on/off.
17
+ */
18
+ @property({ type: Boolean, reflect: true })
19
+ toggledOn = false;
20
+
21
+ static override styles = [
22
+ ...IconButtonToggle.styles,
23
+ css`
24
+ ${unsafeCSS(styles)}
25
+ `,
26
+ ];
27
+
28
+ protected update(changedProperties: PropertyValues) {
29
+ if (changedProperties.has('toggledOn') && this.toggledOn !== this.on) {
30
+ this.on = this.toggledOn;
31
+ }
32
+ if (changedProperties.has('on') && this.toggledOn !== this.on) {
33
+ this.toggledOn = this.on;
34
+ }
35
+ super.update(changedProperties);
36
+ }
37
+
38
+ protected renderRipple() {
39
+ return this.shouldRenderRipple
40
+ ? html` <mwc-ripple
41
+ .disabled="${this.disabled}"
42
+ .activated="${this.toggledOn}"
43
+ unbounded
44
+ >
45
+ </mwc-ripple>`
46
+ : '';
47
+ }
48
+ }
49
+
50
+ export default CovalentIconButtonToggle;
@@ -0,0 +1,64 @@
1
+ import { css, html, unsafeCSS } from 'lit';
2
+ import { customElement, property, query } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import { styleMap } from 'lit/directives/style-map.js';
5
+ import { CheckboxBase } from '@material/mwc-checkbox/mwc-checkbox-base';
6
+ import { styles as checkboxStyle } from '@material/mwc-checkbox/mwc-checkbox.css';
7
+ import styles from './icon-checkbox.scss?inline';
8
+
9
+ declare global {
10
+ interface HTMLElementTagNameMap {
11
+ 'cv-icon-check-item': CovalentIconCheckToggle;
12
+ }
13
+ }
14
+
15
+ @customElement('cv-checkbox-icon')
16
+ export class CovalentIconCheckToggle extends CheckboxBase {
17
+ static override styles = [
18
+ css`
19
+ ${unsafeCSS(styles)}
20
+ `,
21
+ checkboxStyle,
22
+ ];
23
+
24
+ @property() width: number | string = '200';
25
+ @property() height: number | string = '160';
26
+ @property({ type: Boolean }) iconOnly = false;
27
+
28
+ @query('.container') declare protected mdcRoot: HTMLElement;
29
+
30
+ override render() {
31
+ const classes = {
32
+ checked: this.checked,
33
+ cornerFill: this.checked,
34
+ };
35
+ const checkmark = {
36
+ showCheck: this.checked,
37
+ };
38
+ const styles = {
39
+ '--width': this.width == 'fill' ? '100%' : `${this.width}px`,
40
+ '--height': `${this.height}px`,
41
+ };
42
+ return html`
43
+ <div class="${classMap(classes)} container" style="${styleMap(styles)}" @click="${this._handleClick}">
44
+ <input type="checkbox" class="mdc-checkbox__native-control"></input>
45
+ <div class="mdc-toggle__background">
46
+ <svg class="mdc-toggle__checkmark ${classMap(
47
+ checkmark,
48
+ )}" viewBox="0 0 24 24">
49
+ <path class="mdc-toggle__checkmark-path ${classMap(
50
+ checkmark,
51
+ )}" fill="none" d="M1.73,12.91 8.1,19.28 22.79,4.59"></path>
52
+ </svg>
53
+ </div>
54
+ <slot name="icon"></slot>
55
+ ${this.iconOnly ? '' : html`<div><slot name="text"></slot></div>`}
56
+ </div>
57
+ `;
58
+ }
59
+ private _handleClick() {
60
+ this.checked = !this.checked;
61
+ }
62
+ }
63
+
64
+ export default CovalentIconCheckToggle;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentIconCheckToggle } from './icon-check-toggle';
6
+
7
+ describe('Icon check', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentIconCheckToggle()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,95 @@
1
+ @use '@material/ripple';
2
+
3
+ :host {
4
+ .mdc-toggle__background {
5
+ position: absolute;
6
+ top: 4px;
7
+ right: 4px;
8
+ width: 15px;
9
+ height: 15px;
10
+ border: none;
11
+ color: var(--mdc-theme-on-primary);
12
+ }
13
+
14
+ .mdc-toggle__checkmark-path {
15
+ transition: stroke-dashoffset 180ms cubic-bezier(0.4, 0, 0.6, 1) 0ms;
16
+ stroke: currentcolor;
17
+ stroke-width: 3.12px;
18
+ stroke-dashoffset: 29.7833;
19
+ stroke-dasharray: 29.7833;
20
+ }
21
+
22
+ .showCheck {
23
+ stroke-dashoffset: 0;
24
+ opacity: 1;
25
+ }
26
+ }
27
+
28
+ :host([width='fill']) {
29
+ width: 100%;
30
+ }
31
+
32
+ .container {
33
+ display: flex;
34
+ justify-content: center;
35
+ align-items: center;
36
+ flex-direction: column;
37
+ text-align: center;
38
+ row-gap: 8px;
39
+ width: var(--width);
40
+ height: var(--height);
41
+ border: solid 2px var(--mdc-theme-border);
42
+ border-radius: 8px;
43
+ color: var(--mdc-theme-text-primary-on-background);
44
+ @include ripple.surface;
45
+ @include ripple.radius-unbounded;
46
+ @include ripple.states;
47
+ }
48
+
49
+ .container::after,
50
+ .container::before {
51
+ border-radius: 8px;
52
+ }
53
+
54
+ .container:hover {
55
+ cursor: pointer;
56
+ }
57
+
58
+ .cornerFill {
59
+ background: linear-gradient(
60
+ 225deg,
61
+ var(--mdc-theme-primary) 28px,
62
+ transparent 0
63
+ );
64
+ }
65
+
66
+ .checked {
67
+ border: solid 2px var(--mdc-theme-primary);
68
+ background-color: var(--mdc-theme-surface-primary-highlight);
69
+ }
70
+
71
+ .checked:hover {
72
+ background-color: var(--mdc-theme-surface-primary-highlight-hover);
73
+ }
74
+
75
+ [name='icon']::slotted(*) {
76
+ font-size: 40px;
77
+ color: var(--mdc-theme-text-icon-on-background);
78
+ }
79
+
80
+ [name='text']::slotted(*) {
81
+ color: var(--mdc-theme-text-primary-on-background);
82
+ font-family: var(--mdc-typography-body1-font-family);
83
+ font-size: var(--mdc-typography-body1-font-size);
84
+ font-weight: var(--mdc-typography-body1-font-weight);
85
+ line-height: var(--mdc-typography-body1-line-height);
86
+ letter-spacing: 0.4px;
87
+ }
88
+
89
+ [name='text']::slotted(*:last-child) {
90
+ color: var(--mdc-theme-text-secondary-on-background);
91
+ font-family: var(--mdc-typography-body2-font-family);
92
+ font-size: var(--mdc-typography-body2-font-size);
93
+ font-weight: var(--mdc-typography-body2-font-weight);
94
+ line-height: var(--mdc-typography-body2-line-height);
95
+ }
@@ -0,0 +1,77 @@
1
+ import './icon-check-toggle';
2
+ import '../icon/icon';
3
+
4
+ export default {
5
+ title: 'Components/Icon Checkbox',
6
+ args: {
7
+ width: 200,
8
+ height: 160,
9
+ iconOnly: false,
10
+ },
11
+ };
12
+
13
+ export const Template = ({ width, height, iconOnly }) => {
14
+ return `
15
+ <cv-checkbox-icon ${iconOnly ? ' iconOnly' : ''}>
16
+ <cv-icon slot="icon">work</cv-icon>
17
+ <div slot="text">Balanced</div>
18
+ <div slot="text">Every week</div>
19
+ </cv-checkbox-icon>
20
+ <cv-checkbox-icon ${iconOnly ? 'iconOnly' : ''}>
21
+ <cv-icon slot="icon">work</cv-icon>
22
+ <div slot="text">Balanced</div>
23
+ <div slot="text">Every week</div>
24
+ </cv-checkbox-icon>
25
+ `;
26
+ };
27
+
28
+ const GridExample = ({ iconOnly }) => {
29
+ return `
30
+ <div class="mdc-layout-grid">
31
+ <div class="mdc-layout-grid__inner">
32
+ <cv-checkbox-icon ${
33
+ iconOnly ? 'iconOnly' : ''
34
+ } class="mdc-layout-grid__cell">
35
+ <cv-icon slot="icon">storage</cv-icon>
36
+ <div slot="text">Data</div>
37
+ </cv-checkbox-icon>
38
+ <cv-checkbox-icon ${
39
+ iconOnly ? 'iconOnly' : ''
40
+ } class="mdc-layout-grid__cell">
41
+ <cv-icon slot="icon">description</cv-icon>
42
+ <div slot="text">Files</div>
43
+ </cv-checkbox-icon>
44
+ <cv-checkbox-icon ${
45
+ iconOnly ? 'iconOnly' : ''
46
+ } class="mdc-layout-grid__cell">
47
+ <cv-icon slot="icon">bookmark</cv-icon>
48
+ <div slot="text">Articles</div>
49
+ </cv-checkbox-icon>
50
+ <cv-checkbox-icon ${
51
+ iconOnly ? 'iconOnly' : ''
52
+ } class="mdc-layout-grid__cell">
53
+ <cv-icon slot="icon">folder</cv-icon>
54
+ <div slot="text">Projects</div>
55
+ </cv-checkbox-icon>
56
+ <cv-checkbox-icon ${
57
+ iconOnly ? 'iconOnly' : ''
58
+ } class="mdc-layout-grid__cell">
59
+ <cv-icon slot="icon">assignment</cv-icon>
60
+ <div slot="text">Notebooks</div>
61
+ </cv-checkbox-icon>
62
+ <cv-checkbox-icon ${
63
+ iconOnly ? 'iconOnly' : ''
64
+ } class="mdc-layout-grid__cell">
65
+ <cv-icon slot="icon" >receipt_long</cv-icon>
66
+ <div slot="text">Scripts</div>
67
+ </cv-checkbox-icon>
68
+ </div>
69
+ </div>
70
+ `;
71
+ };
72
+
73
+ export const WithGrid = GridExample.bind({});
74
+ WithGrid.args = {
75
+ width: '105',
76
+ height: '100',
77
+ };
@@ -0,0 +1,47 @@
1
+ .filled {
2
+ font-variation-settings: 'FILL' 1;
3
+ }
4
+
5
+ .hidden {
6
+ display: none;
7
+ }
8
+
9
+ .icon-lockup {
10
+ align-items: center;
11
+ display: flex;
12
+ gap: 4px;
13
+ max-width: 100%;
14
+
15
+ cv-typography {
16
+ flex: 1 0 0;
17
+ }
18
+ }
19
+
20
+ .icon-lockup--primary,
21
+ .icon-lockup--loading {
22
+ color: var(--cv-theme-primary);
23
+ }
24
+
25
+ .icon-lockup--positive {
26
+ color: var(--cv-theme-positive);
27
+ }
28
+
29
+ .icon-lockup--negative {
30
+ color: var(--cv-theme-negative);
31
+ }
32
+
33
+ .icon-lockup--caution {
34
+ color: var(--cv-theme-caution);
35
+ }
36
+
37
+ .text {
38
+ font-feature-settings: 'liga' off, 'clig' off;
39
+ max-width: 100%;
40
+ overflow: hidden;
41
+ text-overflow: ellipsis;
42
+ white-space: nowrap;
43
+ }
44
+
45
+ .trailing-icon {
46
+ flex-direction: row-reverse;
47
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ import { it, describe, expect } from 'vitest';
5
+ import { CovalentIconLockup } from './icon-lockup';
6
+
7
+ describe('Icon lockup', () => {
8
+ it('should work', () => {
9
+ expect(new CovalentIconLockup()).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,93 @@
1
+ import './icon-lockup';
2
+ import '../circular-progress/circular-progress';
3
+
4
+ export default {
5
+ title: 'Components/Icon lockup',
6
+ argTypes: {
7
+ scale: {
8
+ options: [
9
+ 'headline1',
10
+ 'headline2',
11
+ 'headline3',
12
+ 'headline4',
13
+ 'headline5',
14
+ 'headline6',
15
+ 'subtitle1',
16
+ 'subtitle2',
17
+ 'button',
18
+ 'caption',
19
+ 'overline',
20
+ 'body1',
21
+ 'body2',
22
+ ],
23
+ control: { type: 'select' },
24
+ },
25
+ state: {
26
+ options: ['primary', 'positive', 'negative', 'caution', null],
27
+ control: { type: 'select' },
28
+ },
29
+ },
30
+ args: {
31
+ covalentIcon: false,
32
+ filledIcon: false,
33
+ icon: 'houseboat',
34
+ scale: 'body1',
35
+ state: 'null',
36
+ trailingIcon: false,
37
+ },
38
+ };
39
+
40
+ const Template = ({
41
+ icon,
42
+ scale,
43
+ trailingIcon,
44
+ state,
45
+ covalentIcon,
46
+ filledIcon,
47
+ }) => {
48
+ return `<cv-icon-lockup icon="${icon}" scale="${scale}"${
49
+ trailingIcon ? ' trailingIcon' : ''
50
+ }${covalentIcon ? ' covalentIcon' : ''}${filledIcon ? ' filledIcon' : ''}${
51
+ state ? ` state=${state}` : ''
52
+ }>Lorem ipsum dolor sit amet</cv-icon-lockup>`;
53
+ };
54
+
55
+ const LoadingTemplate = ({ scale, trailingIcon, state }) => {
56
+ return `<cv-icon-lockup scale="${scale}"${
57
+ trailingIcon ? ' trailingIcon' : ''
58
+ }${state ? ` state=${state}` : ''}>Lorem ipsum dolor sit amet
59
+ <cv-circular-progress indeterminate slot="icon" density="-6"></cv-circular-progress>
60
+ </cv-icon-lockup>`;
61
+ };
62
+
63
+ export const Basic = Template.bind({});
64
+
65
+ export const Primary = Template.bind({});
66
+ Primary.args = {
67
+ state: 'primary',
68
+ };
69
+
70
+ export const Positive = Template.bind({});
71
+ Positive.args = {
72
+ state: 'positive',
73
+ icon: 'check',
74
+ };
75
+
76
+ export const Negative = Template.bind({});
77
+ Negative.args = {
78
+ state: 'negative',
79
+ icon: 'error',
80
+ filledIcon: true,
81
+ };
82
+
83
+ export const Caution = Template.bind({});
84
+ Caution.args = {
85
+ state: 'caution',
86
+ icon: 'warning',
87
+ filledIcon: true,
88
+ };
89
+
90
+ export const Loading = LoadingTemplate.bind({});
91
+ Loading.args = {
92
+ state: 'primary',
93
+ };