@redvars/peacock 3.3.3 → 3.5.0

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 (280) hide show
  1. package/dist/IndividualComponent-DUINtMGK.js +67 -0
  2. package/dist/IndividualComponent-DUINtMGK.js.map +1 -0
  3. package/dist/assets/images/empty-state/no-document.svg +11 -12
  4. package/dist/assets/images/empty-state/page.svg +15 -9
  5. package/dist/assets/styles.css +1 -1
  6. package/dist/assets/styles.css.map +1 -1
  7. package/dist/banner.js +202 -0
  8. package/dist/banner.js.map +1 -0
  9. package/dist/bottom-sheet.js +238 -0
  10. package/dist/bottom-sheet.js.map +1 -0
  11. package/dist/{button-ClzS8JLq.js → button-DMN1dPAg.js} +358 -218
  12. package/dist/button-DMN1dPAg.js.map +1 -0
  13. package/dist/button-group-CX9CUUXk.js +435 -0
  14. package/dist/button-group-CX9CUUXk.js.map +1 -0
  15. package/dist/button-group.js +11 -6
  16. package/dist/button-group.js.map +1 -1
  17. package/dist/button.js +10 -5
  18. package/dist/button.js.map +1 -1
  19. package/dist/card-content.js +29 -0
  20. package/dist/card-content.js.map +1 -0
  21. package/dist/card.js +428 -44
  22. package/dist/card.js.map +1 -1
  23. package/dist/{chart-bar-DbnXQgvS.js → chart-bar-cn6rrna-.js} +2 -2
  24. package/dist/{chart-bar-DbnXQgvS.js.map → chart-bar-cn6rrna-.js.map} +1 -1
  25. package/dist/chart-bar.js +5 -4
  26. package/dist/chart-bar.js.map +1 -1
  27. package/dist/chart-doughnut.js +2 -1
  28. package/dist/chart-doughnut.js.map +1 -1
  29. package/dist/chart-pie.js +2 -1
  30. package/dist/chart-pie.js.map +1 -1
  31. package/dist/chart-stacked-bar.js +5 -4
  32. package/dist/chart-stacked-bar.js.map +1 -1
  33. package/dist/{class-map-59YGWLnx.js → class-map-YU7g0o3B.js} +4 -10
  34. package/dist/class-map-YU7g0o3B.js.map +1 -0
  35. package/dist/clock.js +2 -1
  36. package/dist/clock.js.map +1 -1
  37. package/dist/code-editor.js +8 -6
  38. package/dist/code-editor.js.map +1 -1
  39. package/dist/code-highlighter.js +6 -4
  40. package/dist/code-highlighter.js.map +1 -1
  41. package/dist/custom-elements-jsdocs.json +6270 -5026
  42. package/dist/custom-elements.json +5763 -2049
  43. package/dist/directive-ZPhl09Yt.js +9 -0
  44. package/dist/directive-ZPhl09Yt.js.map +1 -0
  45. package/dist/dispatch-event-utils-CuEqjlPT.js +127 -0
  46. package/dist/dispatch-event-utils-CuEqjlPT.js.map +1 -0
  47. package/dist/fab-C5Nzxk0E.js +497 -0
  48. package/dist/fab-C5Nzxk0E.js.map +1 -0
  49. package/dist/fab.js +11 -0
  50. package/dist/fab.js.map +1 -0
  51. package/dist/index.js +24 -12
  52. package/dist/index.js.map +1 -1
  53. package/dist/{observe-theme-change-pALI5fmV.js → is-dark-mode-DicqGkCJ.js} +8 -3
  54. package/dist/is-dark-mode-DicqGkCJ.js.map +1 -0
  55. package/dist/notification.js +417 -0
  56. package/dist/notification.js.map +1 -0
  57. package/dist/number-counter.js +4 -3
  58. package/dist/number-counter.js.map +1 -1
  59. package/dist/observe-slot-change-BGJfgg2E.js +31 -0
  60. package/dist/observe-slot-change-BGJfgg2E.js.map +1 -0
  61. package/dist/peacock-loader.js +59 -10
  62. package/dist/peacock-loader.js.map +1 -1
  63. package/dist/property-1psGvXOq.js +10 -0
  64. package/dist/property-1psGvXOq.js.map +1 -0
  65. package/dist/search.js +452 -0
  66. package/dist/search.js.map +1 -0
  67. package/dist/{radio-b70_Ie9n.js → select-4pl4XBj7.js} +2439 -521
  68. package/dist/select-4pl4XBj7.js.map +1 -0
  69. package/dist/side-sheet.js +186 -0
  70. package/dist/side-sheet.js.map +1 -0
  71. package/dist/spread-B5cgadZl.js +32 -0
  72. package/dist/spread-B5cgadZl.js.map +1 -0
  73. package/dist/src/__base_element/BaseHyperlink.d.ts +20 -0
  74. package/dist/src/__utils/cache-fetch.d.ts +1 -0
  75. package/dist/src/__utils/is-dark-mode.d.ts +1 -0
  76. package/dist/src/__utils/is-in-viewport.d.ts +1 -0
  77. package/dist/src/__utils/observe-slot-change.d.ts +1 -0
  78. package/dist/src/__utils/sanitize-svg.d.ts +1 -0
  79. package/dist/src/__utils/throttle.d.ts +4 -0
  80. package/dist/src/accordion/accordion-item.d.ts +33 -9
  81. package/dist/src/accordion/accordion.d.ts +21 -5
  82. package/dist/src/banner/banner.d.ts +47 -0
  83. package/dist/src/banner/index.d.ts +1 -0
  84. package/dist/src/bottom-sheet/bottom-sheet.d.ts +42 -0
  85. package/dist/src/bottom-sheet/index.d.ts +1 -0
  86. package/dist/src/button/BaseButton.d.ts +7 -13
  87. package/dist/src/button/button/button.d.ts +4 -0
  88. package/dist/src/button/button-group/button-group.d.ts +32 -3
  89. package/dist/src/button/icon-button/icon-button.d.ts +4 -0
  90. package/dist/src/card/card-content.d.ts +15 -0
  91. package/dist/src/card/card.d.ts +37 -3
  92. package/dist/src/card/index.d.ts +1 -0
  93. package/dist/src/container/container.d.ts +1 -1
  94. package/dist/src/empty-state/empty-state.d.ts +1 -1
  95. package/dist/src/fab/fab.d.ts +111 -0
  96. package/dist/src/fab/index.d.ts +1 -0
  97. package/dist/src/focus-ring/focus-ring.d.ts +4 -1
  98. package/dist/src/index.d.ts +11 -1
  99. package/dist/src/link/link.d.ts +3 -10
  100. package/dist/src/menu/menu/menu.d.ts +4 -2
  101. package/dist/src/menu/menu-item/menu-item.d.ts +0 -1
  102. package/dist/src/menu/sub-menu/sub-menu.d.ts +1 -0
  103. package/dist/src/notification/index.d.ts +1 -0
  104. package/dist/src/notification/notification.d.ts +69 -0
  105. package/dist/src/pagination/pagination.d.ts +8 -1
  106. package/dist/src/ripple/ripple.d.ts +19 -3
  107. package/dist/src/search/index.d.ts +1 -0
  108. package/dist/src/search/search.d.ts +76 -0
  109. package/dist/src/segmented-button/index.d.ts +2 -0
  110. package/dist/src/segmented-button/segmented-button-group.d.ts +46 -0
  111. package/dist/src/segmented-button/segmented-button.d.ts +65 -0
  112. package/dist/src/select/index.d.ts +3 -0
  113. package/dist/src/select/option.d.ts +55 -0
  114. package/dist/src/select/select.d.ts +114 -0
  115. package/dist/src/side-sheet/index.d.ts +1 -0
  116. package/dist/src/side-sheet/side-sheet.d.ts +41 -0
  117. package/dist/src/slider/slider.d.ts +4 -0
  118. package/dist/src/snackbar/snackbar.d.ts +14 -1
  119. package/dist/src/tabs/tab-group.d.ts +0 -1
  120. package/dist/src/tabs/tab.d.ts +8 -2
  121. package/dist/src/tabs/tabs.d.ts +13 -1
  122. package/dist/src/toolbar/index.d.ts +1 -0
  123. package/dist/src/toolbar/toolbar.d.ts +86 -0
  124. package/dist/state-DwbEjqVk.js +10 -0
  125. package/dist/state-DwbEjqVk.js.map +1 -0
  126. package/dist/{style-map-DcB52w-l.js → style-map-DVmWOuYy.js} +3 -3
  127. package/dist/{style-map-DcB52w-l.js.map → style-map-DVmWOuYy.js.map} +1 -1
  128. package/dist/test/search.test.d.ts +1 -0
  129. package/dist/test/toolbar.test.d.ts +1 -0
  130. package/dist/throttle-C7ZAPqtu.js +24 -0
  131. package/dist/throttle-C7ZAPqtu.js.map +1 -0
  132. package/dist/toolbar.js +306 -0
  133. package/dist/toolbar.js.map +1 -0
  134. package/dist/tsconfig.tsbuildinfo +1 -1
  135. package/dist/{unsafe-html-C2r3PyzF.js → unsafe-html-BsGUjx94.js} +3 -3
  136. package/dist/{unsafe-html-C2r3PyzF.js.map → unsafe-html-BsGUjx94.js.map} +1 -1
  137. package/package.json +1 -1
  138. package/readme.md +2 -2
  139. package/scss/styles.scss +4 -0
  140. package/src/__base_element/BaseHyperlink.ts +42 -0
  141. package/src/__base_element/README.md +19 -0
  142. package/src/__utils/cache-fetch.ts +65 -0
  143. package/src/{utils → __utils}/dispatch-event-utils.ts +1 -0
  144. package/src/__utils/is-dark-mode.ts +3 -0
  145. package/src/__utils/is-in-viewport.ts +6 -0
  146. package/src/__utils/observe-slot-change.ts +38 -0
  147. package/src/__utils/sanitize-svg.ts +27 -0
  148. package/src/__utils/throttle.ts +27 -0
  149. package/src/accordion/accordion-item.scss +136 -65
  150. package/src/accordion/accordion-item.ts +117 -44
  151. package/src/accordion/accordion.scss +24 -5
  152. package/src/accordion/accordion.ts +29 -23
  153. package/src/accordion/demo/index.html +74 -35
  154. package/src/banner/banner.scss +87 -0
  155. package/src/banner/banner.ts +107 -0
  156. package/src/banner/index.ts +1 -0
  157. package/src/bottom-sheet/bottom-sheet.scss +88 -0
  158. package/src/bottom-sheet/bottom-sheet.ts +135 -0
  159. package/src/bottom-sheet/index.ts +1 -0
  160. package/src/button/BaseButton.ts +26 -30
  161. package/src/button/button/button-colors.scss +90 -19
  162. package/src/button/button/button-sizes.scss +39 -19
  163. package/src/button/button/button.scss +117 -116
  164. package/src/button/button/button.ts +29 -6
  165. package/src/button/button-group/button-group.scss +25 -22
  166. package/src/button/button-group/button-group.ts +122 -5
  167. package/src/button/icon-button/icon-button-sizes.scss +35 -15
  168. package/src/button/icon-button/icon-button.ts +25 -12
  169. package/src/card/card-colors.scss +10 -0
  170. package/src/card/card-content.ts +26 -0
  171. package/src/card/card.scss +221 -41
  172. package/src/card/card.ts +251 -8
  173. package/src/card/index.ts +1 -0
  174. package/src/chart-bar/chart-bar.ts +1 -1
  175. package/src/chart-bar/chart-stacked-bar.ts +3 -1
  176. package/src/chart-doughnut/chart-doughnut.ts +1 -1
  177. package/src/chart-pie/chart-pie.ts +1 -1
  178. package/src/checkbox/checkbox.ts +1 -1
  179. package/src/clock/clock.ts +1 -1
  180. package/src/code-editor/code-editor.ts +5 -5
  181. package/src/code-highlighter/code-highlighter.ts +2 -2
  182. package/src/container/container.ts +1 -1
  183. package/src/date-picker/date-picker.ts +5 -2
  184. package/src/divider/divider.ts +3 -1
  185. package/src/empty-state/empty-state.scss +9 -3
  186. package/src/empty-state/empty-state.ts +2 -2
  187. package/src/fab/fab-colors.scss +49 -0
  188. package/src/fab/fab-sizes.scss +47 -0
  189. package/src/fab/fab.scss +137 -0
  190. package/src/fab/fab.ts +285 -0
  191. package/src/fab/index.ts +1 -0
  192. package/src/field/field.ts +3 -1
  193. package/src/focus-ring/focus-ring.ts +37 -19
  194. package/src/icon/datasource.ts +1 -1
  195. package/src/icon/icon.ts +3 -1
  196. package/src/image/image.ts +3 -2
  197. package/src/index.ts +12 -1
  198. package/src/input/input.ts +5 -2
  199. package/src/link/link.ts +2 -15
  200. package/src/menu/menu/menu.scss +31 -3
  201. package/src/menu/menu/menu.ts +30 -6
  202. package/src/menu/menu-item/menu-item.scss +1 -0
  203. package/src/menu/menu-item/menu-item.ts +1 -9
  204. package/src/menu/sub-menu/sub-menu.ts +1 -0
  205. package/src/notification/index.ts +1 -0
  206. package/src/notification/notification.scss +201 -0
  207. package/src/notification/notification.ts +206 -0
  208. package/src/number-counter/number-counter.ts +3 -1
  209. package/src/number-field/number-field.ts +4 -2
  210. package/src/pagination/pagination.scss +33 -24
  211. package/src/pagination/pagination.ts +113 -60
  212. package/src/peacock-loader.ts +48 -0
  213. package/src/radio/radio.ts +3 -1
  214. package/src/ripple/ripple.ts +19 -3
  215. package/src/search/index.ts +1 -0
  216. package/src/search/search-colors.scss +14 -0
  217. package/src/search/search.scss +204 -0
  218. package/src/search/search.ts +240 -0
  219. package/src/segmented-button/index.ts +2 -0
  220. package/src/segmented-button/segmented-button-group.scss +21 -0
  221. package/src/segmented-button/segmented-button-group.ts +110 -0
  222. package/src/segmented-button/segmented-button.scss +115 -0
  223. package/src/segmented-button/segmented-button.ts +175 -0
  224. package/src/select/index.ts +3 -0
  225. package/src/select/option.ts +109 -0
  226. package/src/select/select.scss +125 -0
  227. package/src/select/select.ts +520 -0
  228. package/src/side-sheet/index.ts +1 -0
  229. package/src/side-sheet/side-sheet.scss +79 -0
  230. package/src/side-sheet/side-sheet.ts +100 -0
  231. package/src/slider/slider.scss +19 -1
  232. package/src/slider/slider.ts +30 -19
  233. package/src/snackbar/snackbar.scss +62 -31
  234. package/src/snackbar/snackbar.ts +92 -12
  235. package/src/switch/switch.ts +3 -1
  236. package/src/table/table.ts +3 -1
  237. package/src/tabs/demo/index.html +90 -0
  238. package/src/tabs/tab-group.ts +0 -3
  239. package/src/tabs/tab.scss +237 -25
  240. package/src/tabs/tab.ts +91 -14
  241. package/src/tabs/tabs.scss +37 -3
  242. package/src/tabs/tabs.ts +118 -2
  243. package/src/textarea/textarea.ts +4 -2
  244. package/src/time-picker/time-picker.ts +4 -2
  245. package/src/toolbar/index.ts +1 -0
  246. package/src/toolbar/toolbar-colors.scss +16 -0
  247. package/src/toolbar/toolbar.scss +165 -0
  248. package/src/toolbar/toolbar.ts +137 -0
  249. package/dist/IndividualComponent-Dt5xirYG.js +0 -73
  250. package/dist/IndividualComponent-Dt5xirYG.js.map +0 -1
  251. package/dist/button-ClzS8JLq.js.map +0 -1
  252. package/dist/button-group-BMS5WvaF.js +0 -292
  253. package/dist/button-group-BMS5WvaF.js.map +0 -1
  254. package/dist/chart-donut.js +0 -309
  255. package/dist/chart-donut.js.map +0 -1
  256. package/dist/class-map-59YGWLnx.js.map +0 -1
  257. package/dist/directive-Cuw6h7YA.js +0 -9
  258. package/dist/directive-Cuw6h7YA.js.map +0 -1
  259. package/dist/dispatch-event-utils-B4odODQf.js +0 -277
  260. package/dist/dispatch-event-utils-B4odODQf.js.map +0 -1
  261. package/dist/observe-theme-change-pALI5fmV.js.map +0 -1
  262. package/dist/radio-b70_Ie9n.js.map +0 -1
  263. package/dist/src/chart-donut/chart-donut.d.ts +0 -53
  264. package/dist/src/chart-donut/index.d.ts +0 -1
  265. package/dist/src/styleMixins.css.d.ts +0 -9
  266. package/dist/src/utils.d.ts +0 -9
  267. package/src/chart-donut/chart-donut.scss +0 -37
  268. package/src/chart-donut/chart-donut.ts +0 -287
  269. package/src/chart-donut/demo/index.html +0 -51
  270. package/src/chart-donut/index.ts +0 -1
  271. package/src/styleMixins.css.ts +0 -55
  272. package/src/utils.ts +0 -193
  273. /package/dist/src/{spread.d.ts → __directive/spread.d.ts} +0 -0
  274. /package/dist/src/{utils → __utils}/copy-to-clipboard.d.ts +0 -0
  275. /package/dist/src/{utils → __utils}/dispatch-event-utils.d.ts +0 -0
  276. /package/dist/src/{utils → __utils}/observe-theme-change.d.ts +0 -0
  277. /package/dist/test/{card.test.d.ts → banner.test.d.ts} +0 -0
  278. /package/src/{spread.ts → __directive/spread.ts} +0 -0
  279. /package/src/{utils → __utils}/copy-to-clipboard.ts +0 -0
  280. /package/src/{utils → __utils}/observe-theme-change.ts +0 -0
package/src/card/card.ts CHANGED
@@ -1,10 +1,15 @@
1
- import { LitElement, html } from 'lit';
2
- import { property } from 'lit/decorators.js';
3
- import IndividualComponent from '../IndividualComponent.js';
1
+ import { LitElement, html, nothing, PropertyValues } from 'lit';
2
+ import { property, query, state } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import { dispatchActivationClick, isActivationClick } from '../__utils/dispatch-event-utils.js';
5
+ import { observerSlotChangesWithCallback } from '@/__utils/observe-slot-change.js';
6
+ import { throttle } from '@/__utils/throttle.js';
7
+ import IndividualComponent from '@/IndividualComponent.js';
4
8
  import styles from './card.scss';
9
+ import colorStyles from './card-colors.scss';
5
10
 
6
11
  type CardVariant = 'elevated' | 'filled' | 'outlined';
7
- type CardElevation = 0 | 1 | 2 | 3 | 4 | 5;
12
+
8
13
  /**
9
14
  * @label Card
10
15
  * @tag wc-card
@@ -24,15 +29,253 @@ type CardElevation = 0 | 1 | 2 | 3 | 4 | 5;
24
29
  */
25
30
  @IndividualComponent
26
31
  export class Card extends LitElement {
27
- static styles = [styles];
32
+ static styles = [styles, colorStyles];
33
+
34
+ #id = crypto.randomUUID();
28
35
 
29
36
  @property({ type: String, reflect: true })
30
37
  variant: CardVariant = 'elevated';
31
38
 
32
- @property({ type: Number, reflect: true })
33
- elevation: CardElevation = 1;
39
+ @property({ type: Boolean, reflect: true })
40
+ disabled: boolean = false;
41
+
42
+ @property({ type: Boolean, reflect: true })
43
+ actionable: boolean = false;
44
+
45
+ /**
46
+ * If button is disabled, the reason why it is disabled.
47
+ */
48
+ @property({ attribute: 'disabled-reason' })
49
+ disabledReason: string = '';
50
+
51
+ /**
52
+ * Hyperlink to navigate to on click.
53
+ */
54
+ @property({ reflect: true }) href?: string;
55
+
56
+ /**
57
+ * Sets or retrieves the window or frame at which to target content.
58
+ */
59
+ @property() target: string = '_self';
60
+
61
+
62
+ /**
63
+ * Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
64
+ */
65
+ @property() throttleDelay = 200;
66
+
67
+ /**
68
+ * States
69
+ */
70
+ @state()
71
+ isPressed = false;
72
+
73
+ @state()
74
+ private slotHasContent = false;
75
+
76
+
77
+ @query('.card') readonly cardElement!: HTMLElement | null;
78
+
79
+ @query('slot') readonly contentSlot!: HTMLSlotElement | null;
80
+
81
+ #tabindex?: number = 0;
82
+
83
+ #slottedTabIndexMap = new WeakMap<HTMLElement, string | null>();
84
+
85
+ override firstUpdated() {
86
+ this.__dispatchClickWithThrottle = throttle(
87
+ this.__dispatchClick,
88
+ this.throttleDelay,
89
+ );
90
+ observerSlotChangesWithCallback(
91
+ this.renderRoot.querySelector('slot'),
92
+ hasContent => {
93
+ this.slotHasContent = hasContent;
94
+ this.__syncSlottedChildrenTabIndex();
95
+ this.requestUpdate();
96
+ },
97
+ );
98
+ this.__syncSlottedChildrenTabIndex();
99
+ }
100
+
101
+ override updated(changedProperties: PropertyValues<this>) {
102
+ if (changedProperties.has('actionable') || changedProperties.has('href')) {
103
+ this.__syncSlottedChildrenTabIndex();
104
+ }
105
+ }
106
+
107
+ __syncSlottedChildrenTabIndex() {
108
+ if (!this.contentSlot) return;
109
+
110
+ const shouldDisableTabbing = this.actionable || this.__isLink();
111
+ const assignedChildren = this.contentSlot.assignedElements({ flatten: true });
112
+
113
+ assignedChildren.forEach(node => {
114
+ if (!(node instanceof HTMLElement)) return;
115
+
116
+ if (shouldDisableTabbing) {
117
+ if (!this.#slottedTabIndexMap.has(node)) {
118
+ this.#slottedTabIndexMap.set(node, node.getAttribute('tabindex'));
119
+ }
120
+
121
+ if (node.getAttribute('tabindex') !== '-1') {
122
+ node.setAttribute('tabindex', '-1');
123
+ }
124
+ return;
125
+ }
126
+
127
+ const originalTabIndex = this.#slottedTabIndexMap.get(node);
128
+ if (originalTabIndex === null) {
129
+ if (node.hasAttribute('tabindex')) {
130
+ node.removeAttribute('tabindex');
131
+ }
132
+ } else if (originalTabIndex !== undefined) {
133
+ if (node.getAttribute('tabindex') !== originalTabIndex) {
134
+ node.setAttribute('tabindex', originalTabIndex);
135
+ }
136
+ }
137
+
138
+ this.#slottedTabIndexMap.delete(node);
139
+ });
140
+ }
141
+
142
+ __dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =
143
+ event => {
144
+ this.__dispatchClick(event);
145
+ };
146
+
147
+ __dispatchClick = (event: MouseEvent | KeyboardEvent) => {
148
+ // If the button is soft-disabled or a disabled link, we need to explicitly
149
+ // prevent the click from propagating to other event listeners as well as
150
+ // prevent the default action.
151
+ if (this.disabled && this.href) {
152
+ event.stopImmediatePropagation();
153
+ event.preventDefault();
154
+ return;
155
+ }
156
+
157
+ if (!isActivationClick(event) || !this.cardElement) {
158
+ return;
159
+ }
160
+
161
+ this.focus();
162
+ dispatchActivationClick(this.cardElement);
163
+ };
164
+
165
+ __isLink() {
166
+ return !!this.href;
167
+ }
168
+
169
+ __getDisabledReasonID() {
170
+ return this.disabled && this.disabledReason
171
+ ? `disabled-reason-${this.#id}`
172
+ : nothing;
173
+ }
174
+
175
+ __renderDisabledReason() {
176
+ const disabledReasonID = this.__getDisabledReasonID();
177
+ if (disabledReasonID)
178
+ return html`<div
179
+ id="disabled-reason-${this.#id}"
180
+ role="tooltip"
181
+ aria-label=${this.disabledReason}
182
+ class="screen-reader-only"
183
+ >
184
+ ${this.disabledReason}
185
+ </div>`;
186
+ return nothing;
187
+ }
188
+
189
+ __handlePress = (event: KeyboardEvent | MouseEvent) => {
190
+ if (this.disabled) return;
191
+ if (
192
+ event instanceof KeyboardEvent &&
193
+ event.type === 'keydown' &&
194
+ (event.key === 'Enter' || event.key === ' ')
195
+ ) {
196
+ this.isPressed = true;
197
+ } else if (event.type === 'mousedown') {
198
+ this.isPressed = true;
199
+ } else {
200
+ this.isPressed = false;
201
+ }
202
+ };
203
+
204
+
205
+
34
206
 
35
207
  render() {
36
- return html`<div class="card"><slot></slot></div>`;
208
+
209
+ const isLink = this.__isLink();
210
+
211
+ const cssClasses = {
212
+ card: true,
213
+ 'card-element': true,
214
+ [`variant-${this.variant}`]: true,
215
+ actionable: (this.actionable && !this.disabled) || isLink,
216
+ disabled: this.disabled,
217
+ pressed: this.isPressed,
218
+ 'has-content': this.slotHasContent,
219
+ };
220
+
221
+ if (!this.actionable && !isLink) {
222
+ return html`<div
223
+ class=${classMap(cssClasses)}
224
+ id="card"
225
+ >
226
+ ${this.renderCardContent()}
227
+ </div>`;
228
+ }
229
+
230
+ if (!isLink) {
231
+ return html`<button
232
+ class=${classMap(cssClasses)}
233
+ id="card"
234
+ tabindex=${this.#tabindex}
235
+ @click=${this.__dispatchClickWithThrottle}
236
+ @mousedown=${this.__handlePress}
237
+ @keydown=${this.__handlePress}
238
+ @keyup=${this.__handlePress}
239
+ ?aria-describedby=${this.__getDisabledReasonID()}
240
+ aria-disabled=${`${this.disabled}`}
241
+ ?disabled=${this.disabled}
242
+ >
243
+ ${this.renderCardContent()}
244
+ </button>`;
245
+ }
246
+ return html`<a
247
+ class=${classMap(cssClasses)}
248
+ id="card"
249
+ tabindex=${this.#tabindex}
250
+ href=${this.href}
251
+ target=${this.target}
252
+ @click=${this.__dispatchClickWithThrottle}
253
+ @mousedown=${this.__handlePress}
254
+ @keydown=${this.__handlePress}
255
+ @keyup=${this.__handlePress}
256
+ role="button"
257
+ ?aria-describedby=${this.__getDisabledReasonID()}
258
+ aria-disabled=${`${this.disabled}`}
259
+ >
260
+ ${this.renderCardContent()}
261
+ </a>`;
262
+ }
263
+
264
+ renderCardContent() {
265
+ return html`
266
+ <wc-focus-ring class="focus-ring" .control=${this} .forElement=${this.cardElement}></wc-focus-ring>
267
+ <wc-elevation class="elevation"></wc-elevation>
268
+ <div class="background"></div>
269
+ <div class="outline"></div>
270
+ <wc-ripple class="ripple"></wc-ripple>
271
+
272
+ <div class="card-content">
273
+
274
+ <div class="slot-container">
275
+ <slot @slotchange=${this.__syncSlottedChildrenTabIndex}></slot>
276
+ </div>
277
+
278
+ </div>
279
+ `;
37
280
  }
38
281
  }
package/src/card/index.ts CHANGED
@@ -1 +1,2 @@
1
1
  export { Card } from './card.js';
2
+ export { CardContent } from './card-content.js';
@@ -1,7 +1,7 @@
1
1
  import { html, LitElement, PropertyValues } from 'lit';
2
2
  import { property, query } from 'lit/decorators.js';
3
3
  import { styleMap } from 'lit/directives/style-map.js';
4
- import IndividualComponent from 'src/IndividualComponent.js';
4
+ import IndividualComponent from '@/IndividualComponent.js';
5
5
  import * as d3 from 'd3';
6
6
  import styles from './chart-bar.scss';
7
7
 
@@ -1,8 +1,10 @@
1
1
  import { html, LitElement, PropertyValues } from 'lit';
2
2
  import { property, query } from 'lit/decorators.js';
3
3
  import { styleMap } from 'lit/directives/style-map.js';
4
- import IndividualComponent from 'src/IndividualComponent.js';
5
4
  import * as d3 from 'd3';
5
+
6
+ import IndividualComponent from '@/IndividualComponent.js';
7
+
6
8
  import styles from './chart-bar.scss';
7
9
 
8
10
  export type ChartStackedSegment = {
@@ -1,6 +1,6 @@
1
1
  import { html, LitElement, PropertyValues } from 'lit';
2
2
  import { property, query } from 'lit/decorators.js';
3
- import IndividualComponent from 'src/IndividualComponent.js';
3
+ import IndividualComponent from '@/IndividualComponent.js';
4
4
  import * as d3 from 'd3';
5
5
  import styles from './chart-donut.scss';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { html, LitElement, PropertyValues } from 'lit';
2
2
  import { property, query } from 'lit/decorators.js';
3
- import IndividualComponent from 'src/IndividualComponent.js';
3
+ import IndividualComponent from '@/IndividualComponent.js';
4
4
  import * as d3 from 'd3';
5
5
  import styles from './chart-pie.scss';
6
6
 
@@ -1,7 +1,7 @@
1
1
  import { html, LitElement, svg } from 'lit';
2
2
  import { property, query, state } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
- import { spread } from '../spread.js';
4
+ import { spread } from '@/__directive/spread.js';
5
5
  import styles from './checkbox.scss';
6
6
 
7
7
  /**
@@ -1,6 +1,6 @@
1
1
  import { html, LitElement } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
- import IndividualComponent from 'src/IndividualComponent.js';
3
+ import IndividualComponent from '@/IndividualComponent.js';
4
4
  import { ClockController } from './ClockController.js';
5
5
 
6
6
  import styles from './clock.scss';
@@ -2,13 +2,13 @@ import { html, nothing } from 'lit';
2
2
  import { property, state, query } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
4
  import {init} from 'modern-monaco';
5
- import IndividualComponent from 'src/IndividualComponent.js';
5
+ import IndividualComponent from '@/IndividualComponent.js';
6
6
  import BaseInput from '../input/BaseInput.js';
7
- import { observeThemeChange } from '../utils/observe-theme-change.js';
8
- import { redispatchEvent } from '../utils/dispatch-event-utils.js';
7
+ import { observeThemeChange } from '../__utils/observe-theme-change.js';
8
+ import { redispatchEvent } from '../__utils/dispatch-event-utils.js';
9
9
  import {
10
10
  isDarkMode,
11
- } from '../utils.js';
11
+ } from '@/__utils/is-dark-mode.js';
12
12
 
13
13
  import styles from './code-editor.scss';
14
14
 
@@ -21,7 +21,7 @@ import styles from './code-editor.scss';
21
21
  *
22
22
  * @example
23
23
  * ```html
24
- * <wc-code-editor language="javascript"></wc-code-editor>
24
+ * <wc-code-editor language="javascript" style="width: 80%;--code-editor-height: 9rem;height: 9rem;" ></wc-code-editor>
25
25
  * ```
26
26
  */
27
27
 
@@ -12,8 +12,8 @@ import * as prettierPluginEstree from 'prettier/plugins/estree';
12
12
 
13
13
  import { BundledLanguage, codeToHtml, ShikiTransformer } from 'shiki';
14
14
 
15
- import IndividualComponent from 'src/IndividualComponent.js';
16
- import { copyToClipboard } from '../utils/copy-to-clipboard.js';
15
+ import IndividualComponent from '@/IndividualComponent.js';
16
+ import { copyToClipboard } from '@/__utils/copy-to-clipboard.js';
17
17
  import styles from './code-highlighter.scss';
18
18
 
19
19
  const locale = {
@@ -16,7 +16,7 @@ type ContainerSize = 'max' | 'xl' | 'lg' | 'md' | 'sm' | 'full';
16
16
  *
17
17
  * @example
18
18
  * ```html
19
- * <wc-container size="lg">Content</wc-container>
19
+ * <wc-container style="width: 80%; border: 1px dotted black;" size="md">Content</wc-container>
20
20
  * ```
21
21
  */
22
22
  export class Container extends LitElement {
@@ -1,9 +1,12 @@
1
1
  import { html } from 'lit';
2
2
  import { property, query, state } from 'lit/decorators.js';
3
- import { redispatchEvent } from 'src/utils/dispatch-event-utils.js';
3
+
4
+ import { redispatchEvent } from '@/__utils/dispatch-event-utils.js';
5
+ import { spread } from '@/__directive/spread.js';
6
+
4
7
  import BaseInput from '../input/BaseInput.js';
5
8
  import styles from './date-picker.scss';
6
- import { spread } from '../spread.js';
9
+
7
10
 
8
11
  /**
9
12
  * @label Date Picker
@@ -1,8 +1,10 @@
1
1
  import { html, LitElement } from 'lit';
2
2
  import { property, state } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
+
5
+ import { observerSlotChangesWithCallback } from '@/__utils/observe-slot-change.js';
6
+
4
7
  import styles from './divider.scss';
5
- import { observerSlotChangesWithCallback } from '../utils.js';
6
8
 
7
9
  /**
8
10
  * @label Divider
@@ -38,8 +38,8 @@
38
38
  flex-direction: column;
39
39
  justify-content: center;
40
40
 
41
- .title {
42
- @include mixin.get-typography(headline-medium-emphasized);
41
+ .headline {
42
+ @include mixin.get-typography(headline-medium);
43
43
  margin-bottom: var(--spacing-200);
44
44
  color: var(--color-on-surface)
45
45
  }
@@ -71,7 +71,7 @@
71
71
  .empty-state {
72
72
  .empty-state-container {
73
73
  flex-direction: column;
74
- gap: var(--spacing-200);
74
+ gap: var(--spacing-150);
75
75
 
76
76
  .illustration {
77
77
  height: auto;
@@ -79,6 +79,12 @@
79
79
  justify-content: center;
80
80
  }
81
81
  }
82
+
83
+ .content {
84
+ .headline {
85
+ @include mixin.get-typography(headline-small);
86
+ }
87
+ }
82
88
  }
83
89
  }
84
90
 
@@ -12,7 +12,7 @@ import styles from './empty-state.scss';
12
12
  *
13
13
  * @example
14
14
  * ```html
15
- * <wc-empty-state headline="No items found"></wc-empty-state>
15
+ * <wc-empty-state style="width:100%" headline="No items found"></wc-empty-state>
16
16
  * ```
17
17
  */
18
18
  export class EmptyState extends LitElement {
@@ -52,7 +52,7 @@ export class EmptyState extends LitElement {
52
52
 
53
53
  __renderTitle() {
54
54
  if (!this.headline) return nothing;
55
- return html`<div class="title">${this.headline}</div>`;
55
+ return html`<div class="headline">${this.headline}</div>`;
56
56
  }
57
57
 
58
58
  __renderDescription() {
@@ -0,0 +1,49 @@
1
+ :host {
2
+ --tonal-fab-container-color: var(--color-surface-container-high);
3
+ --tonal-fab-label-text-color: var(--color-on-surface);
4
+
5
+ --filled-fab-container-color: var(--color-surface);
6
+ --filled-fab-label-text-color: var(--color-on-surface);
7
+ }
8
+
9
+ :host([color='surface']) {
10
+ --tonal-fab-container-color: var(--color-surface-container-high);
11
+ --tonal-fab-label-text-color: var(--color-on-surface);
12
+
13
+ --filled-fab-container-color: var(--color-surface);
14
+ --filled-fab-label-text-color: var(--color-on-surface);
15
+ }
16
+
17
+ :host([color='primary']) {
18
+ --tonal-fab-container-color: var(--color-primary-container);
19
+ --tonal-fab-label-text-color: var(--color-on-primary-container);
20
+
21
+ --filled-fab-container-color: var(--color-primary);
22
+ --filled-fab-label-text-color: var(--color-on-primary);
23
+ }
24
+
25
+ :host([color='secondary']) {
26
+ --tonal-fab-container-color: var(--color-secondary-container);
27
+ --tonal-fab-label-text-color: var(--color-on-secondary-container);
28
+
29
+ --filled-fab-container-color: var(--color-secondary);
30
+ --filled-fab-label-text-color: var(--color-on-secondary);
31
+ }
32
+
33
+ :host([color='tertiary']) {
34
+ --tonal-fab-container-color: var(--color-tertiary-container);
35
+ --tonal-fab-label-text-color: var(--color-on-tertiary-container);
36
+
37
+ --filled-fab-container-color: var(--color-tertiary);
38
+ --filled-fab-label-text-color: var(--color-on-tertiary);
39
+ }
40
+
41
+ .fab.variant-tonal {
42
+ --_fab-container-color: var(--tonal-fab-container-color);
43
+ --_fab-label-text-color: var(--tonal-fab-label-text-color);
44
+ }
45
+
46
+ .fab.variant-filled {
47
+ --_fab-container-color: var(--filled-fab-container-color);
48
+ --_fab-label-text-color: var(--filled-fab-label-text-color);
49
+ }
@@ -0,0 +1,47 @@
1
+ /* Small FAB: 40x40dp, shape-corner-medium */
2
+ :host([size='sm']) {
3
+ --fab-container-shape: var(--shape-corner-medium);
4
+ }
5
+
6
+ :host([size='sm']) .fab {
7
+ width: 2.5rem;
8
+ height: 2.5rem;
9
+ --_fab-icon-size: 1.5rem;
10
+ }
11
+
12
+ /* Standard/Medium FAB: 56x56dp, shape-corner-large (default) */
13
+ :host([size='md']) .fab {
14
+ width: 3.5rem;
15
+ height: 3.5rem;
16
+ --_fab-icon-size: 1.5rem;
17
+ }
18
+
19
+ /* Large FAB: 96x96dp, shape-corner-extra-large */
20
+ :host([size='lg']) {
21
+ --fab-container-shape: var(--shape-corner-extra-large);
22
+ }
23
+
24
+ :host([size='lg']) .fab {
25
+ width: 6rem;
26
+ height: 6rem;
27
+ --_fab-icon-size: 2.25rem;
28
+ }
29
+
30
+ /* Extended FAB overrides (height fixed, width auto) */
31
+ :host([size='sm']) .fab.extended {
32
+ width: auto;
33
+ min-width: 4rem;
34
+ height: 2.5rem;
35
+ }
36
+
37
+ :host([size='md']) .fab.extended {
38
+ width: auto;
39
+ min-width: 5rem;
40
+ height: 3.5rem;
41
+ }
42
+
43
+ :host([size='lg']) .fab.extended {
44
+ width: auto;
45
+ min-width: 6rem;
46
+ height: 6rem;
47
+ }