@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,187 @@
1
+ <cv-button data-num="1" raised>Basic</cv-button>
2
+ <cv-dialog id="dialog1" heading="Dialog header">
3
+ Dialog body text
4
+ <cv-button slot="primaryAction" dialogAction="ok">Action 2</cv-button>
5
+ <cv-button slot="secondaryAction" dialogAction="cancel">Action 1</cv-button>
6
+ </cv-dialog>
7
+
8
+ <cv-button data-num="2" raised>Actions</cv-button>
9
+ <cv-dialog id="dialog2" heading="Actions">
10
+ <p>
11
+ By setting the dialogAction="my-action" attribute on any element projected
12
+ into mwc-dialog, you can close the dialog by clicking on that element. The
13
+ dialog will then fire a non-bubbling "closing" event and a non-bubbling
14
+ "closed" event with an event detail of {action: "my-action"}
15
+ </p>
16
+ <cv-button slot="primaryAction" dialogAction="customAction"
17
+ >This has action</cv-button
18
+ >
19
+ <cv-button slot="secondaryAction">This does not</cv-button>
20
+ </cv-dialog>
21
+
22
+ <cv-button data-num="3" raised>Scrollable</cv-button>
23
+ <cv-dialog id="dialog3" heading="My Title">
24
+ <p>
25
+ Really long text will scroll. Really long text will scroll. Really long text
26
+ will scroll. Really long text will scroll. Really long text will scroll.
27
+ Really long text will scroll. Really long text will scroll. Really long text
28
+ will scroll. Really long text will scroll. Really long text will scroll.
29
+ Really long text will scroll. Really long text will scroll. Really long text
30
+ will scroll. Really long text will scroll. Really long text will scroll.
31
+ Really long text will scroll. Really long text will scroll. Really long text
32
+ will scroll. Really long text will scroll. Really long text will scroll.
33
+ Really long text will scroll. Really long text will scroll. Really long text
34
+ will scroll. Really long text will scroll. Really long text will scroll.
35
+ Really long text will scroll. Really long text will scroll. Really long text
36
+ will scroll. Really long text will scroll. Really long text will scroll.
37
+ Really long text will scroll. Really log text will scroll. Really log text
38
+ will scroll. Really log text will scroll. Really log text will scroll.
39
+ Really log text will scroll. Really log text will scroll. Really log text
40
+ will scroll. Really log text will scroll. Really log text will scroll.
41
+ Really log text will scroll. Really log text will scroll. Really log text
42
+ will scroll. Really log text will scroll. Really log text will scroll.
43
+ Really log text will scroll. Really log text will scroll. Really log text
44
+ will scroll. Really log text will scroll. Really log text will scroll.
45
+ Really log text will scroll. Really log text will scroll. Really log text
46
+ will scroll. Really log text will scroll. Really log text will scroll.
47
+ Really log text will scroll. Really log text will scroll. Really log text
48
+ will scroll. Really log text will scroll. Really log text will scroll.
49
+ Really log text will scroll. Really log text will scroll. Really log text
50
+ will scroll. Really log text will scroll. Really log text will scroll.
51
+ Really log text will scroll. Really log text will scroll. Really log text
52
+ will scroll. Really log text will scroll. Really log text will scroll.
53
+ Really log text will scroll. Really log text will scroll. Really log text
54
+ will scroll. Really log text will scroll. Really log text will scroll.
55
+ Really log text will scroll. Really log text will scroll. Really log text
56
+ will scroll. Really log text will scroll. Really log text will scroll.
57
+ Really log text will scroll. Really log text will scroll. Really log text
58
+ will scroll. Really log text will scroll. Really log text will scroll.
59
+ Really log text will scroll. Really log text will scroll. Really log text
60
+ will scroll. Really log text will scroll. Really log text will scroll.
61
+ Really log text will scroll. Really log text will scroll. Really log text
62
+ will scroll. Really log text will scroll. Really log text will scroll.
63
+ Really log text will scroll. Really log text will scroll. Really log text
64
+ will scroll. Really log text will scroll. Really log text will scroll.
65
+ Really log text will scroll. Really log text will scroll. Really log text
66
+ will scroll. Really log text will scroll. Really log text will scroll.
67
+ Really log text will scroll. Really log text will scroll. Really log text
68
+ will scroll. Really log text will scroll. Really log text will scroll.
69
+ Really log text will scroll. Really log text will scroll. Really log text
70
+ will scroll. Really log text will scroll. Really log text will scroll.
71
+ Really log text will scroll. Really log text will scroll. Really log text
72
+ will scroll. Really log text will scroll. Really log text will scroll.
73
+ Really log text will scroll. Really log text will scroll. Really log text
74
+ will scroll. Really log text will scroll. Really log text will scroll.
75
+ Really log text will scroll. Really log text will scroll. Really log text
76
+ will scroll. Really log text will scroll. Really log text will scroll.
77
+ Really log text will scroll. Really log text will scroll. Really log text
78
+ will scroll. Really log text will scroll. Really log text will scroll.
79
+ Really log text will scroll. Really log text will scroll. Really log text
80
+ will scroll. Really log text will scroll. Really log text will scroll.
81
+ Really log text will scroll. Really log text will scroll. Really log text
82
+ will scroll. Really log text will scroll. Really log text will scroll.
83
+ Really log text will scroll. Really log text will scroll. Really log text
84
+ will scroll. Really log text will scroll. Really log text will scroll.
85
+ Really log text will scroll. Really log text will scroll. Really log text
86
+ will scroll. Really log text will scroll. Really log text will scroll.
87
+ Really log text will scroll. Really log text will scroll. Really log text
88
+ will scroll. Really log text will scroll. Really log text will scroll.
89
+ Really log text will scroll. Really log text will scroll. Really log text
90
+ will scroll. Really log text will scroll. Really log text will scroll.
91
+ Really log text will scroll. Really log text will scroll. Really log text
92
+ will scroll. Really log text will scroll.
93
+ </p>
94
+ <cv-button slot="primaryAction" dialogAction="close">Close this!</cv-button>
95
+ </cv-dialog>
96
+
97
+ <cv-button data-num="4" raised>Hide actions</cv-button>
98
+ <cv-dialog id="dialog4" heading="Hide Actions">
99
+ <p>
100
+ If you don't have actions, you may want to set the "hideActions" property.
101
+ This property will remove extra whitespace at the bottom of this dialog.
102
+ This button will toggle that whitespace:
103
+ </p>
104
+ <cv-button raised id="toggleActions">Toggle hideActions</cv-button>
105
+ <div>
106
+ mwc-dialog.hideActions is currently:
107
+ <span id="hideActionVal"> false </span>
108
+ </div>
109
+ </cv-dialog>
110
+
111
+ <style>
112
+ .styled {
113
+ --mdc-theme-surface: #fff;
114
+ --mdc-dialog-scrim-color: rgba(35, 47, 52, 0.32);
115
+ --mdc-dialog-heading-ink-color: #232f34;
116
+ --mdc-dialog-content-ink-color: #232f34;
117
+ --mdc-dialog-scroll-divider-color: transparent;
118
+ --mdc-dialog-min-width: 500px;
119
+ --mdc-dialog-max-width: 700px;
120
+ --mdc-dialog-max-height: 350px;
121
+ --mdc-dialog-shape-radius: 0px;
122
+
123
+ /* color buttons */
124
+ --mdc-theme-primary: #344955;
125
+ }
126
+ </style>
127
+
128
+ <cv-button data-num="5" raised>Styled</cv-button>
129
+ <cv-dialog id="dialog5" heading="Styled" class="styled">
130
+ <div>These are the current styles applied to this dialog</div>
131
+ <pre>
132
+ --mdc-theme-surface: #FFF;
133
+ --mdc-dialog-scrim-color: rgba(35, 47, 52, .32);
134
+ --mdc-dialog-heading-ink-color: #232F34;
135
+ --mdc-dialog-content-ink-color: #232F34;
136
+ --mdc-dialog-scroll-divider-color: transparent;
137
+ --mdc-dialog-min-width: 500px;
138
+ --mdc-dialog-max-width: 700px;
139
+ --mdc-dialog-max-height: 350px;
140
+ --mdc-dialog-shape-radius: 0px;
141
+
142
+ /* color buttons */
143
+ --mdc-theme-primary: #344955;
144
+ </pre
145
+ >
146
+ <cv-button slot="primaryAction" dialogAction="close">
147
+ Too stylish for me!
148
+ </cv-button>
149
+ </cv-dialog>
150
+
151
+ <cv-button data-num="6" raised>Stacked</cv-button>
152
+ <cv-dialog id="dialog6" heading="Stacked" stacked>
153
+ <div>
154
+ This is what happens when you set the stacked property on mwc-dialog. Notice
155
+ that the primary action is now on top.
156
+ </div>
157
+ <cv-button slot="primaryAction" dialogAction="close"> Primary </cv-button>
158
+ <cv-button slot="secondaryAction" dialogAction="close"> Secondary </cv-button>
159
+ </cv-dialog>
160
+
161
+ <cv-button data-num="7" raised>Initial focus</cv-button>
162
+ <cv-dialog id="dialog7" heading="Initial Focus">
163
+ <p>
164
+ In this example we set "dialogInitialFocus" on the mwc-textfield. When this
165
+ dialog opens, it is auto-focused.
166
+ </p>
167
+ <cv-textfield label="i am auto-focused" dialogInitialFocus> </cv-textfield>
168
+ <cv-button slot="primaryAction" dialogAction="close"> Primary </cv-button>
169
+ <cv-button slot="secondaryAction" dialogAction="close"> Secondary </cv-button>
170
+ </cv-dialog>
171
+
172
+ <cv-button data-num="8" raised>Form validation</cv-button>
173
+ <cv-dialog id="dialog8" heading="Form Validation">
174
+ <p>This dialog can validate user input before closing.</p>
175
+ <cv-textfield
176
+ id="dialog8-text-field"
177
+ minlength="3"
178
+ maxlength="64"
179
+ placeholder="First name"
180
+ required
181
+ >
182
+ </cv-textfield>
183
+ <cv-button id="dialog8-primary-action-button" slot="primaryAction">
184
+ Confirm
185
+ </cv-button>
186
+ <cv-button slot="secondaryAction" dialogAction="close"> Cancel </cv-button>
187
+ </cv-dialog>
@@ -0,0 +1,57 @@
1
+ // Material Dialog example taken Material Components Catalog
2
+ // https://github.com/material-components/material-web/blob/master/demos/dialog
3
+ import dialogTemplate from './dialog.component.html?raw';
4
+
5
+ export default ({}) => {
6
+ document.addEventListener(
7
+ 'DOMContentLoaded',
8
+ () => {
9
+ const buttons = document.body.querySelectorAll('cv-button[data-num]');
10
+
11
+ for (let i = 0; i < buttons.length; i++) {
12
+ const button = buttons[i];
13
+ const buttonNum = button.dataset.num;
14
+
15
+ const listenerFactory = (numButton) => {
16
+ return function () {
17
+ const dialog = document.body.querySelector('#dialog' + numButton);
18
+ dialog.open = true;
19
+ };
20
+ };
21
+
22
+ const listener = listenerFactory(buttonNum);
23
+
24
+ button.addEventListener('click', listener);
25
+ }
26
+
27
+ window.toggleActions.onclick = function () {
28
+ const dialog = document.body.querySelector('#dialog4');
29
+ const hideActionSpan = document.body.querySelector('#hideActionVal');
30
+
31
+ const hideAction = !dialog.hideActions;
32
+ dialog.hideActions = hideAction;
33
+ hideActionSpan.innerText = hideAction;
34
+ };
35
+
36
+ const dialog = document.querySelector('#dialog8');
37
+ const textField = document.querySelector('#dialog8-text-field');
38
+ const primaryButton = document.querySelector(
39
+ '#dialog8-primary-action-button'
40
+ );
41
+
42
+ primaryButton.addEventListener('click', () => {
43
+ // validate, possible asynchronous such as a server response
44
+ const isValid = textField.checkValidity();
45
+ if (isValid) {
46
+ dialog.close();
47
+ return;
48
+ }
49
+
50
+ textField.reportValidity();
51
+ });
52
+ },
53
+ { once: true }
54
+ );
55
+
56
+ return dialogTemplate;
57
+ };
@@ -0,0 +1,99 @@
1
+ <style>
2
+ .demo-grid {
3
+ background: rgba(0, 0, 0, 0.2);
4
+ min-width: 360px;
5
+ }
6
+
7
+ .demo-grid--alignment {
8
+ max-width: 800px;
9
+ }
10
+
11
+ .demo-grid--cell-alignment {
12
+ min-height: 200px;
13
+ }
14
+
15
+ .demo-inner {
16
+ min-height: 200px;
17
+ }
18
+
19
+ .demo-cell {
20
+ background: rgba(0, 0, 0, 0.2);
21
+ height: 100px;
22
+ }
23
+
24
+ .demo-cell--alignment {
25
+ max-height: 50px;
26
+ }
27
+ </style>
28
+ <div>
29
+ <h3 class="mdc-typography--subtitle1">Columns</h3>
30
+ <div class="mdc-layout-grid demo-grid">
31
+ <div class="mdc-layout-grid__inner">
32
+ <div
33
+ class="mdc-layout-grid__cell mdc-layout-grid__cell--span-6 demo-cell"
34
+ ></div>
35
+ <div
36
+ class="mdc-layout-grid__cell mdc-layout-grid__cell--span-3 demo-cell"
37
+ ></div>
38
+ <div
39
+ class="mdc-layout-grid__cell mdc-layout-grid__cell--span-2 demo-cell"
40
+ ></div>
41
+ <div
42
+ class="mdc-layout-grid__cell mdc-layout-grid__cell--span-1 demo-cell"
43
+ ></div>
44
+ <div
45
+ class="mdc-layout-grid__cell mdc-layout-grid__cell--span-3 demo-cell"
46
+ ></div>
47
+ <div
48
+ class="mdc-layout-grid__cell mdc-layout-grid__cell--span-1 demo-cell"
49
+ ></div>
50
+ <div
51
+ class="mdc-layout-grid__cell mdc-layout-grid__cell--span-8 demo-cell"
52
+ ></div>
53
+ </div>
54
+ </div>
55
+ <h3 class="mdc-typography--subtitle1">Grid Left Alignment</h3>
56
+ <p class="mdc-typography--body2">
57
+ This requires a max-width on the top-level grid element.
58
+ </p>
59
+ <div
60
+ class="mdc-layout-grid mdc-layout-grid--align-left demo-grid demo-grid--alignment"
61
+ >
62
+ <div class="mdc-layout-grid__inner">
63
+ <div class="mdc-layout-grid__cell demo-cell"></div>
64
+ <div class="mdc-layout-grid__cell demo-cell"></div>
65
+ <div class="mdc-layout-grid__cell demo-cell"></div>
66
+ </div>
67
+ </div>
68
+ <h3 class="mdc-typography--subtitle1">Right Alignment</h3>
69
+ <p class="mdc-typography--body2">
70
+ This requires a max-width on the top-level grid element.
71
+ </p>
72
+ <div
73
+ class="mdc-layout-grid mdc-layout-grid--align-right demo-grid demo-grid--alignment"
74
+ >
75
+ <div class="mdc-layout-grid__inner">
76
+ <div class="mdc-layout-grid__cell demo-cell"></div>
77
+ <div class="mdc-layout-grid__cell demo-cell"></div>
78
+ <div class="mdc-layout-grid__cell demo-cell"></div>
79
+ </div>
80
+ </div>
81
+ <h3 class="mdc-typography--subtitle1">Cell Alignment</h3>
82
+ <p class="mdc-typography--body2">
83
+ Cell alignment requires a cell height smaller than the inner height of the
84
+ grid.
85
+ </p>
86
+ <div class="mdc-layout-grid demo-grid demo-grid--cell-alignment">
87
+ <div class="mdc-layout-grid__inner demo-inner">
88
+ <div
89
+ class="mdc-layout-grid__cell mdc-layout-grid__cell--align-top demo-cell demo-cell--alignment"
90
+ ></div>
91
+ <div
92
+ class="mdc-layout-grid__cell mdc-layout-grid__cell--align-middle demo-cell demo-cell--alignment"
93
+ ></div>
94
+ <div
95
+ class="mdc-layout-grid__cell mdc-layout-grid__cell--align-bottom demo-cell demo-cell--alignment"
96
+ ></div>
97
+ </div>
98
+ </div>
99
+ </div>