@redvars/peacock 3.4.0 → 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 (200) hide show
  1. package/dist/assets/styles.css +1 -1
  2. package/dist/assets/styles.css.map +1 -1
  3. package/dist/banner.js +202 -0
  4. package/dist/banner.js.map +1 -0
  5. package/dist/bottom-sheet.js +2 -2
  6. package/dist/{button-COYCtuA8.js → button-DMN1dPAg.js} +58 -75
  7. package/dist/button-DMN1dPAg.js.map +1 -0
  8. package/dist/{button-group-DsXquZQn.js → button-group-CX9CUUXk.js} +9 -14
  9. package/dist/button-group-CX9CUUXk.js.map +1 -0
  10. package/dist/button-group.js +8 -5
  11. package/dist/button-group.js.map +1 -1
  12. package/dist/button.js +7 -4
  13. package/dist/button.js.map +1 -1
  14. package/dist/card.js +15 -5
  15. package/dist/card.js.map +1 -1
  16. package/dist/chart-bar.js +2 -2
  17. package/dist/chart-bar.js.map +1 -1
  18. package/dist/chart-doughnut.js.map +1 -1
  19. package/dist/chart-pie.js.map +1 -1
  20. package/dist/chart-stacked-bar.js +2 -2
  21. package/dist/chart-stacked-bar.js.map +1 -1
  22. package/dist/{class-map-3TAnCMAX.js → class-map-YU7g0o3B.js} +2 -2
  23. package/dist/{class-map-3TAnCMAX.js.map → class-map-YU7g0o3B.js.map} +1 -1
  24. package/dist/clock.js.map +1 -1
  25. package/dist/code-editor.js +4 -4
  26. package/dist/code-editor.js.map +1 -1
  27. package/dist/code-highlighter.js +3 -3
  28. package/dist/code-highlighter.js.map +1 -1
  29. package/dist/custom-elements-jsdocs.json +2918 -1379
  30. package/dist/custom-elements.json +2783 -1054
  31. package/dist/directive-ZPhl09Yt.js +9 -0
  32. package/dist/directive-ZPhl09Yt.js.map +1 -0
  33. package/dist/dispatch-event-utils-CuEqjlPT.js +127 -0
  34. package/dist/dispatch-event-utils-CuEqjlPT.js.map +1 -0
  35. package/dist/fab-C5Nzxk0E.js +497 -0
  36. package/dist/fab-C5Nzxk0E.js.map +1 -0
  37. package/dist/fab.js +11 -0
  38. package/dist/fab.js.map +1 -0
  39. package/dist/index.js +17 -9
  40. package/dist/index.js.map +1 -1
  41. package/dist/{observe-theme-change-DKAIv5BB.js → is-dark-mode-DicqGkCJ.js} +6 -2
  42. package/dist/is-dark-mode-DicqGkCJ.js.map +1 -0
  43. package/dist/notification.js +417 -0
  44. package/dist/notification.js.map +1 -0
  45. package/dist/number-counter.js +2 -2
  46. package/dist/number-counter.js.map +1 -1
  47. package/dist/observe-slot-change-BGJfgg2E.js +31 -0
  48. package/dist/observe-slot-change-BGJfgg2E.js.map +1 -0
  49. package/dist/peacock-loader.js +32 -9
  50. package/dist/peacock-loader.js.map +1 -1
  51. package/dist/search.js +452 -0
  52. package/dist/search.js.map +1 -0
  53. package/dist/{select-C3XAzenC.js → select-4pl4XBj7.js} +778 -374
  54. package/dist/select-4pl4XBj7.js.map +1 -0
  55. package/dist/side-sheet.js +2 -2
  56. package/dist/spread-B5cgadZl.js +32 -0
  57. package/dist/spread-B5cgadZl.js.map +1 -0
  58. package/dist/src/__base_element/BaseHyperlink.d.ts +20 -0
  59. package/dist/src/__utils/cache-fetch.d.ts +1 -0
  60. package/dist/src/__utils/is-dark-mode.d.ts +1 -0
  61. package/dist/src/__utils/is-in-viewport.d.ts +1 -0
  62. package/dist/src/__utils/observe-slot-change.d.ts +1 -0
  63. package/dist/src/__utils/sanitize-svg.d.ts +1 -0
  64. package/dist/src/__utils/throttle.d.ts +4 -0
  65. package/dist/src/accordion/accordion-item.d.ts +33 -9
  66. package/dist/src/accordion/accordion.d.ts +21 -5
  67. package/dist/src/banner/banner.d.ts +47 -0
  68. package/dist/src/banner/index.d.ts +1 -0
  69. package/dist/src/button/BaseButton.d.ts +6 -13
  70. package/dist/src/button/button-group/button-group.d.ts +2 -2
  71. package/dist/src/empty-state/empty-state.d.ts +1 -1
  72. package/dist/src/fab/fab.d.ts +111 -0
  73. package/dist/src/fab/index.d.ts +1 -0
  74. package/dist/src/index.d.ts +5 -0
  75. package/dist/src/link/link.d.ts +3 -10
  76. package/dist/src/menu/menu/menu.d.ts +3 -2
  77. package/dist/src/menu/sub-menu/sub-menu.d.ts +1 -0
  78. package/dist/src/notification/index.d.ts +1 -0
  79. package/dist/src/notification/notification.d.ts +69 -0
  80. package/dist/src/pagination/pagination.d.ts +8 -1
  81. package/dist/src/search/index.d.ts +1 -0
  82. package/dist/src/search/search.d.ts +76 -0
  83. package/dist/src/select/select.d.ts +3 -5
  84. package/dist/src/slider/slider.d.ts +4 -0
  85. package/dist/src/snackbar/snackbar.d.ts +14 -1
  86. package/dist/src/toolbar/index.d.ts +1 -0
  87. package/dist/src/toolbar/toolbar.d.ts +86 -0
  88. package/dist/{style-map-CRFEoCEg.js → style-map-DVmWOuYy.js} +2 -2
  89. package/dist/{style-map-CRFEoCEg.js.map → style-map-DVmWOuYy.js.map} +1 -1
  90. package/dist/test/banner.test.d.ts +1 -0
  91. package/dist/test/search.test.d.ts +1 -0
  92. package/dist/test/toolbar.test.d.ts +1 -0
  93. package/dist/throttle-C7ZAPqtu.js +24 -0
  94. package/dist/throttle-C7ZAPqtu.js.map +1 -0
  95. package/dist/toolbar.js +306 -0
  96. package/dist/toolbar.js.map +1 -0
  97. package/dist/tsconfig.tsbuildinfo +1 -1
  98. package/dist/{unsafe-html-D3GHRaGQ.js → unsafe-html-BsGUjx94.js} +2 -2
  99. package/dist/{unsafe-html-D3GHRaGQ.js.map → unsafe-html-BsGUjx94.js.map} +1 -1
  100. package/package.json +1 -1
  101. package/readme.md +2 -2
  102. package/scss/styles.scss +4 -0
  103. package/src/__base_element/BaseHyperlink.ts +42 -0
  104. package/src/__base_element/README.md +19 -0
  105. package/src/__utils/cache-fetch.ts +65 -0
  106. package/src/__utils/is-dark-mode.ts +3 -0
  107. package/src/__utils/is-in-viewport.ts +6 -0
  108. package/src/__utils/observe-slot-change.ts +38 -0
  109. package/src/__utils/sanitize-svg.ts +27 -0
  110. package/src/__utils/throttle.ts +27 -0
  111. package/src/accordion/accordion-item.scss +136 -65
  112. package/src/accordion/accordion-item.ts +117 -44
  113. package/src/accordion/accordion.scss +24 -5
  114. package/src/accordion/accordion.ts +29 -23
  115. package/src/accordion/demo/index.html +74 -35
  116. package/src/banner/banner.scss +87 -0
  117. package/src/banner/banner.ts +107 -0
  118. package/src/banner/index.ts +1 -0
  119. package/src/button/BaseButton.ts +14 -27
  120. package/src/button/button/button-colors.scss +14 -14
  121. package/src/button/button/button.ts +6 -5
  122. package/src/button/button-group/button-group.ts +3 -3
  123. package/src/button/icon-button/icon-button.ts +4 -11
  124. package/src/card/card.ts +41 -31
  125. package/src/chart-bar/chart-bar.ts +1 -1
  126. package/src/chart-bar/chart-stacked-bar.ts +3 -1
  127. package/src/chart-doughnut/chart-doughnut.ts +1 -1
  128. package/src/chart-pie/chart-pie.ts +1 -1
  129. package/src/checkbox/checkbox.ts +1 -1
  130. package/src/clock/clock.ts +1 -1
  131. package/src/code-editor/code-editor.ts +4 -4
  132. package/src/code-highlighter/code-highlighter.ts +2 -2
  133. package/src/date-picker/date-picker.ts +5 -2
  134. package/src/divider/divider.ts +3 -1
  135. package/src/empty-state/empty-state.scss +7 -9
  136. package/src/empty-state/empty-state.ts +1 -1
  137. package/src/fab/fab-colors.scss +49 -0
  138. package/src/fab/fab-sizes.scss +47 -0
  139. package/src/fab/fab.scss +137 -0
  140. package/src/fab/fab.ts +285 -0
  141. package/src/fab/index.ts +1 -0
  142. package/src/field/field.ts +3 -1
  143. package/src/icon/datasource.ts +1 -1
  144. package/src/icon/icon.ts +3 -1
  145. package/src/image/image.ts +3 -2
  146. package/src/index.ts +5 -0
  147. package/src/input/input.ts +5 -2
  148. package/src/link/link.ts +2 -15
  149. package/src/menu/menu/menu.scss +7 -0
  150. package/src/menu/menu/menu.ts +7 -4
  151. package/src/menu/sub-menu/sub-menu.ts +1 -0
  152. package/src/notification/index.ts +1 -0
  153. package/src/notification/notification.scss +201 -0
  154. package/src/notification/notification.ts +206 -0
  155. package/src/number-counter/number-counter.ts +3 -1
  156. package/src/number-field/number-field.ts +4 -2
  157. package/src/pagination/pagination.scss +33 -24
  158. package/src/pagination/pagination.ts +113 -60
  159. package/src/peacock-loader.ts +20 -0
  160. package/src/radio/radio.ts +3 -1
  161. package/src/search/index.ts +1 -0
  162. package/src/search/search-colors.scss +14 -0
  163. package/src/search/search.scss +204 -0
  164. package/src/search/search.ts +240 -0
  165. package/src/select/option.ts +1 -1
  166. package/src/select/select.scss +5 -0
  167. package/src/select/select.ts +71 -37
  168. package/src/slider/slider.scss +19 -0
  169. package/src/slider/slider.ts +30 -19
  170. package/src/snackbar/snackbar.scss +62 -31
  171. package/src/snackbar/snackbar.ts +92 -12
  172. package/src/switch/switch.ts +3 -1
  173. package/src/table/table.ts +3 -1
  174. package/src/tabs/tab.ts +6 -3
  175. package/src/textarea/textarea.ts +4 -2
  176. package/src/time-picker/time-picker.ts +4 -2
  177. package/src/toolbar/index.ts +1 -0
  178. package/src/toolbar/toolbar-colors.scss +16 -0
  179. package/src/toolbar/toolbar.scss +165 -0
  180. package/src/toolbar/toolbar.ts +137 -0
  181. package/dist/button-COYCtuA8.js.map +0 -1
  182. package/dist/button-group-DsXquZQn.js.map +0 -1
  183. package/dist/directive-Cuw6h7YA.js +0 -9
  184. package/dist/directive-Cuw6h7YA.js.map +0 -1
  185. package/dist/dispatch-event-utils-B4odODQf.js +0 -277
  186. package/dist/dispatch-event-utils-B4odODQf.js.map +0 -1
  187. package/dist/observe-theme-change-DKAIv5BB.js.map +0 -1
  188. package/dist/select-C3XAzenC.js.map +0 -1
  189. package/dist/src/styleMixins.css.d.ts +0 -9
  190. package/dist/src/utils.d.ts +0 -9
  191. package/src/styleMixins.css.ts +0 -55
  192. package/src/utils.ts +0 -193
  193. /package/dist/src/{spread.d.ts → __directive/spread.d.ts} +0 -0
  194. /package/dist/src/{utils → __utils}/copy-to-clipboard.d.ts +0 -0
  195. /package/dist/src/{utils → __utils}/dispatch-event-utils.d.ts +0 -0
  196. /package/dist/src/{utils → __utils}/observe-theme-change.d.ts +0 -0
  197. /package/src/{spread.ts → __directive/spread.ts} +0 -0
  198. /package/src/{utils → __utils}/copy-to-clipboard.ts +0 -0
  199. /package/src/{utils → __utils}/dispatch-event-utils.ts +0 -0
  200. /package/src/{utils → __utils}/observe-theme-change.ts +0 -0
@@ -0,0 +1,107 @@
1
+ import { LitElement, html, nothing } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+
5
+ import IndividualComponent from '@/IndividualComponent.js';
6
+ import styles from './banner.scss';
7
+
8
+ type BannerVariant = 'note' | 'info' | 'success' | 'warning' | 'error';
9
+
10
+ const VARIANT_LABELS: Record<BannerVariant, string> = {
11
+ note: 'Note',
12
+ info: 'Info',
13
+ success: 'Success',
14
+ warning: 'Warning',
15
+ error: 'Error',
16
+ };
17
+
18
+ const VARIANT_ICONS: Record<BannerVariant, string> = {
19
+ note: 'star',
20
+ info: 'info',
21
+ success: 'check_circle',
22
+ warning: 'warning',
23
+ error: 'error',
24
+ };
25
+
26
+ /**
27
+ * @label Banner
28
+ * @tag wc-banner
29
+ * @rawTag banner
30
+ * @summary Banners show short, prominent contextual messages with optional icon and description.
31
+ *
32
+ * @cssprop --banner-container-color - Background color of the banner container.
33
+ * @cssprop --banner-label-text-color - Label text color.
34
+ * @cssprop --banner-description-text-color - Description text color.
35
+ * @cssprop --banner-icon-color - Icon color.
36
+ * @cssprop --banner-border-radius - Border radius of the banner surface.
37
+ *
38
+ * @example
39
+ * ```html
40
+ * <wc-banner variant="note" description="Use semantic roles that preserve a 3:1 contrast ratio."></wc-banner>
41
+ * ```
42
+ * @tags display, feedback
43
+ */
44
+ @IndividualComponent
45
+ export class Banner extends LitElement {
46
+ static styles = [styles];
47
+
48
+ /**
49
+ * Visual intent of the banner.
50
+ */
51
+ @property({ type: String, reflect: true })
52
+ variant: BannerVariant = 'note';
53
+
54
+ /**
55
+ * Optional explicit label text. Falls back to a variant-based label.
56
+ */
57
+ @property({ type: String })
58
+ label?: string;
59
+
60
+ /**
61
+ * Optional explicit icon name. Falls back to a variant-based icon.
62
+ */
63
+ @property({ type: String })
64
+ icon?: string;
65
+
66
+ /**
67
+ * Optional description text when a default slot is not provided.
68
+ */
69
+ @property({ type: String })
70
+ description = '';
71
+
72
+ /**
73
+ * When true, label and description are rendered on a single line.
74
+ */
75
+ @property({ type: Boolean, reflect: true })
76
+ inline = false;
77
+
78
+ private get resolvedLabel() {
79
+ return this.label || VARIANT_LABELS[this.variant];
80
+ }
81
+
82
+ private get resolvedIcon() {
83
+ return this.icon || VARIANT_ICONS[this.variant];
84
+ }
85
+
86
+ render() {
87
+ return html`
88
+ <div class=${classMap({ 'banner': true, [this.variant]: true })} role="status" aria-live="polite">
89
+ <div class="banner-icon" aria-hidden="true">
90
+ <slot name="icon">
91
+ <wc-icon name=${this.resolvedIcon}></wc-icon>
92
+ </slot>
93
+ </div>
94
+
95
+ <div class=${classMap({ 'banner-content': true, [this.variant]: true, inline: this.inline })}>
96
+ <div class="banner-label">
97
+ <slot name="label">${this.resolvedLabel}:</slot>
98
+ </div>
99
+
100
+ <div class="banner-description">
101
+ <slot>${this.description || nothing}</slot>
102
+ </div>
103
+ </div>
104
+ </div>
105
+ `;
106
+ }
107
+ }
@@ -0,0 +1 @@
1
+ export { Banner } from './banner.js';
@@ -1,9 +1,10 @@
1
1
  import { html, LitElement, nothing } from 'lit';
2
2
  import { property, query, state } from 'lit/decorators.js';
3
- import { dispatchActivationClick, isActivationClick } from '../utils/dispatch-event-utils.js';
3
+ import { dispatchActivationClick, isActivationClick } from '../__utils/dispatch-event-utils.js';
4
+ import BaseHyperlink from '@/__base_element/BaseHyperlink.js';
4
5
 
5
- export class BaseButton extends LitElement {
6
- #id = crypto.randomUUID();
6
+ export class BaseButton extends BaseHyperlink(LitElement) {
7
+ protected static readonly DISABLED_REASON_ID = 'disabled-reason';
7
8
 
8
9
  @property({ type: String }) htmlType: 'button' | 'submit' | 'reset' =
9
10
  'button';
@@ -40,8 +41,8 @@ export class BaseButton extends LitElement {
40
41
  | 'success'
41
42
  | 'danger'
42
43
  | 'warning'
43
- | 'light'
44
- | 'dark' = 'primary';
44
+ | 'surface'
45
+ | 'on-surface' = 'primary';
45
46
 
46
47
  /**
47
48
  * Button size.
@@ -68,16 +69,6 @@ export class BaseButton extends LitElement {
68
69
  */
69
70
  @property({ attribute: 'disabled-reason' })
70
71
  disabledReason: string = '';
71
-
72
- /**
73
- * Hyperlink to navigate to on click.
74
- */
75
- @property({ reflect: true }) href?: string;
76
-
77
- /**
78
- * Sets or retrieves the window or frame at which to target content.
79
- */
80
- @property() target: string = '_self';
81
72
 
82
73
 
83
74
  @property({ reflect: true })
@@ -139,10 +130,6 @@ export class BaseButton extends LitElement {
139
130
  }
140
131
  };
141
132
 
142
- __isLink() {
143
- return !!this.href;
144
- }
145
-
146
133
  __dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =
147
134
  event => {
148
135
  this.__dispatchClick(event);
@@ -175,8 +162,8 @@ export class BaseButton extends LitElement {
175
162
  this.color = 'primary';
176
163
  this.variant = 'filled';
177
164
  } else if (this.type === 'secondary') {
178
- this.color = 'dark';
179
- this.variant = 'outlined';
165
+ this.color = 'surface';
166
+ this.variant = 'filled';
180
167
  } else if (this.type === 'tertiary') {
181
168
  this.color = 'primary';
182
169
  this.variant = 'text';
@@ -186,22 +173,22 @@ export class BaseButton extends LitElement {
186
173
  }
187
174
  }
188
175
 
189
- __getDisabledReasonID() {
176
+ protected get __disabledReasonID(): string | undefined {
190
177
  return this.disabled && this.disabledReason
191
- ? `disabled-reason-${this.#id}`
192
- : nothing;
178
+ ? BaseButton.DISABLED_REASON_ID
179
+ : undefined;
193
180
  }
194
181
 
195
182
  __renderDisabledReason() {
196
- const disabledReasonID = this.__getDisabledReasonID();
183
+ const disabledReasonID = this.__disabledReasonID;
197
184
  if (disabledReasonID)
198
185
  return html`<div
199
- id="disabled-reason-${this.#id}"
186
+ id=${disabledReasonID}
200
187
  role="tooltip"
201
188
  aria-label=${this.disabledReason}
202
189
  class="screen-reader-only"
203
190
  >
204
- {this.disabledReason}
191
+ ${this.disabledReason}
205
192
  </div>`;
206
193
  return nothing;
207
194
  }
@@ -110,15 +110,15 @@
110
110
  }
111
111
 
112
112
 
113
- :host([color=dark]) {
113
+ :host([color=on-surface]) {
114
114
  --filled-button-container-color: var(--color-on-surface);
115
115
  --filled-button-label-text-color: var(--color-surface);
116
116
 
117
- --tonal-button-container-color: var(--color-surface-container);
118
- --tonal-button-label-text-color: var(--color-on-surface-container);
117
+ --tonal-button-container-color: var(--color-on-surface-container);
118
+ --tonal-button-label-text-color: var(--color-surface-container-high);
119
119
 
120
- --elevated-button-container-color: var(--color-surface-container-low);
121
- --elevated-button-label-text-color: var(--color-on-surface);
120
+ --elevated-button-container-color: var(--color-on-surface);
121
+ --elevated-button-label-text-color: var(--color-surface);
122
122
 
123
123
  --outlined-button-outline-color: var(--color-on-surface);
124
124
  --outlined-button-label-text-color: var(--color-on-surface);
@@ -129,20 +129,20 @@
129
129
  --neo-button-label-text-color: var(--color-surface);
130
130
  }
131
131
 
132
- :host([color=light]) {
133
- --filled-button-container-color: var(--color-surface);
132
+ :host([color=surface]) {
133
+ --filled-button-container-color: var(--color-surface-container-high);
134
134
  --filled-button-label-text-color: var(--color-on-surface);
135
135
 
136
- --tonal-button-container-color: var(--color-on-surface-container);
137
- --tonal-button-label-text-color: var(--color-surface-container);
136
+ --tonal-button-container-color: var(--color-surface-container-high);
137
+ --tonal-button-label-text-color: var(--color-on-surface-container);
138
138
 
139
- --elevated-button-container-color: var(--color-surface-container-low);
140
- --elevated-button-label-text-color: var(--color-white);
139
+ --elevated-button-container-color: var(--color-surface);
140
+ --elevated-button-label-text-color: var(--color-on-surface);
141
141
 
142
- --outlined-button-outline-color: var(--color-surface);
143
- --outlined-button-label-text-color: var(--color-surface);
142
+ --outlined-button-outline-color: var(--color-on-surface);
143
+ --outlined-button-label-text-color: var(--color-on-surface);
144
144
 
145
- --text-button-label-text-color: var(--color-surface);
145
+ --text-button-label-text-color: var(--color-on-surface);
146
146
 
147
147
  --neo-button-container-color: var(--color-surface);
148
148
  --neo-button-label-text-color: var(--color-on-surface);
@@ -1,12 +1,13 @@
1
1
  import { html } from 'lit';
2
2
  import { property, state } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
- import IndividualComponent from 'src/IndividualComponent.js';
4
+ import IndividualComponent from '@/IndividualComponent.js';
5
5
  import styles from './button.scss';
6
6
  import colorStyles from './button-colors.scss';
7
7
  import sizeStyles from './button-sizes.scss';
8
- import { observerSlotChangesWithCallback, throttle } from '../../utils.js';
9
- import { spread } from '../../spread.js';
8
+ import { observerSlotChangesWithCallback } from '@/__utils/observe-slot-change.js';
9
+ import { throttle } from '@/__utils/throttle.js';
10
+ import { spread } from '@/__directive/spread.js';
10
11
  import { BaseButton } from '../BaseButton.js';
11
12
 
12
13
  /**
@@ -129,7 +130,7 @@ export class Button extends BaseButton {
129
130
  @mousedown=${this.__handlePress}
130
131
  @keydown=${this.__handlePress}
131
132
  @keyup=${this.__handlePress}
132
- ?aria-describedby=${this.__getDisabledReasonID()}
133
+ aria-describedby=${this.__disabledReasonID}
133
134
  aria-disabled=${`${this.disabled || this.softDisabled}`}
134
135
  ?disabled=${this.disabled}
135
136
  ${spread(this.configAria)}
@@ -149,7 +150,7 @@ export class Button extends BaseButton {
149
150
  @keydown=${this.__handlePress}
150
151
  @keyup=${this.__handlePress}
151
152
  role="button"
152
- ?aria-describedby=${this.__getDisabledReasonID()}
153
+ aria-describedby=${this.__disabledReasonID}
153
154
  aria-disabled=${`${this.disabled}`}
154
155
  ${spread(this.configAria)}
155
156
  >
@@ -1,7 +1,7 @@
1
1
  import { html, LitElement } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
- import IndividualComponent from 'src/IndividualComponent.js';
4
+ import IndividualComponent from '@/IndividualComponent.js';
5
5
  import styles from './button-group.scss';
6
6
  import { Button } from '../button/button.js';
7
7
  import { IconButton } from '../icon-button/icon-button.js';
@@ -61,9 +61,9 @@ export class ButtonGroup extends LitElement {
61
61
 
62
62
  /**
63
63
  * Color applied to all buttons in the group.
64
- * Possible values are `"primary"`, `"success"`, `"danger"`, `"warning"`, `"light"`, `"dark"`.
64
+ * Possible values are `"primary"`, `"success"`, `"danger"`, `"warning"`, `"surface"`, `"on-surface"`.
65
65
  */
66
- @property({ reflect: true }) color?: 'primary' | 'success' | 'danger' | 'warning' | 'light' | 'dark';
66
+ @property({ reflect: true }) color?: 'primary' | 'success' | 'danger' | 'warning' | 'surface' | 'on-surface';
67
67
 
68
68
  /**
69
69
  * Visual style applied to all buttons in the group.
@@ -4,10 +4,10 @@ import { classMap } from 'lit/directives/class-map.js';
4
4
  import styles from '../button/button.scss';
5
5
  import colorStyles from '../button/button-colors.scss';
6
6
  import sizeStyles from './icon-button-sizes.scss';
7
- import { spread } from '../../spread.js';
7
+ import { spread } from '@/__directive/spread.js';
8
+ import { throttle } from '@/__utils/throttle.js';
8
9
  import { BaseButton } from '../BaseButton.js';
9
10
  import { IconProvider } from '../../icon/icon.js';
10
- import { throttle } from '../../utils.js';
11
11
 
12
12
  /**
13
13
  * @label Icon Button
@@ -55,8 +55,6 @@ import { throttle } from '../../utils.js';
55
55
  export class IconButton extends BaseButton {
56
56
  static override styles = [styles, colorStyles, sizeStyles];
57
57
 
58
- #id = crypto.randomUUID();
59
-
60
58
  #tabindex?: number = 0;
61
59
 
62
60
  @property({ type: String, reflect: true }) name?: string;
@@ -117,10 +115,7 @@ export class IconButton extends BaseButton {
117
115
  @mousedown=${this.__handlePress}
118
116
  @keydown=${this.__handlePress}
119
117
  @keyup=${this.__handlePress}
120
- ?aria-describedby=${(this.disabled || this.softDisabled) &&
121
- this.disabledReason
122
- ? `disabled-reason-${this.#id}`
123
- : null}
118
+ aria-describedby=${this.__disabledReasonID}
124
119
  aria-disabled=${`${this.disabled || this.softDisabled}`}
125
120
  ?disabled=${this.disabled}
126
121
  ${spread(this.configAria)}
@@ -140,9 +135,7 @@ export class IconButton extends BaseButton {
140
135
  @keydown=${this.__handlePress}
141
136
  @keyup=${this.__handlePress}
142
137
  role="button"
143
- aria-describedby=${this.disabled && this.disabledReason
144
- ? `disabled-reason-${this.#id}`
145
- : null}
138
+ aria-describedby=${this.__disabledReasonID}
146
139
  aria-disabled=${`${this.disabled}`}
147
140
  ${spread(this.configAria)}
148
141
  >
package/src/card/card.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { LitElement, html, nothing, PropertyValues } from 'lit';
2
2
  import { property, query, state } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
- import { dispatchActivationClick, isActivationClick } from '../utils/dispatch-event-utils.js';
5
- import { observerSlotChangesWithCallback, throttle } from '../utils.js';
6
- import IndividualComponent from '../IndividualComponent.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';
7
8
  import styles from './card.scss';
8
9
  import colorStyles from './card-colors.scss';
9
10
 
@@ -30,20 +31,20 @@ type CardVariant = 'elevated' | 'filled' | 'outlined';
30
31
  export class Card extends LitElement {
31
32
  static styles = [styles, colorStyles];
32
33
 
33
- #id = crypto.randomUUID();
34
-
34
+ #id = crypto.randomUUID();
35
+
35
36
  @property({ type: String, reflect: true })
36
37
  variant: CardVariant = 'elevated';
37
38
 
38
- @property({type: Boolean, reflect: true})
39
+ @property({ type: Boolean, reflect: true })
39
40
  disabled: boolean = false;
40
41
 
41
42
  @property({ type: Boolean, reflect: true })
42
43
  actionable: boolean = false;
43
44
 
44
- /**
45
- * If button is disabled, the reason why it is disabled.
46
- */
45
+ /**
46
+ * If button is disabled, the reason why it is disabled.
47
+ */
47
48
  @property({ attribute: 'disabled-reason' })
48
49
  disabledReason: string = '';
49
50
 
@@ -144,22 +145,22 @@ export class Card extends LitElement {
144
145
  };
145
146
 
146
147
  __dispatchClick = (event: MouseEvent | KeyboardEvent) => {
147
- // If the button is soft-disabled or a disabled link, we need to explicitly
148
- // prevent the click from propagating to other event listeners as well as
149
- // prevent the default action.
150
- if (this.disabled && this.href) {
151
- event.stopImmediatePropagation();
152
- event.preventDefault();
153
- return;
154
- }
155
-
156
- if (!isActivationClick(event) || !this.cardElement) {
157
- return;
158
- }
159
-
160
- this.focus();
161
- dispatchActivationClick(this.cardElement);
162
- };
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
+ };
163
164
 
164
165
  __isLink() {
165
166
  return !!this.href;
@@ -201,7 +202,7 @@ export class Card extends LitElement {
201
202
  };
202
203
 
203
204
 
204
-
205
+
205
206
 
206
207
  render() {
207
208
 
@@ -217,10 +218,19 @@ export class Card extends LitElement {
217
218
  'has-content': this.slotHasContent,
218
219
  };
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
+
220
230
  if (!isLink) {
221
- return html`<button
231
+ return html`<button
222
232
  class=${classMap(cssClasses)}
223
- id="button"
233
+ id="card"
224
234
  tabindex=${this.#tabindex}
225
235
  @click=${this.__dispatchClickWithThrottle}
226
236
  @mousedown=${this.__handlePress}
@@ -232,10 +242,10 @@ export class Card extends LitElement {
232
242
  >
233
243
  ${this.renderCardContent()}
234
244
  </button>`;
235
- }
236
- return html`<a
245
+ }
246
+ return html`<a
237
247
  class=${classMap(cssClasses)}
238
- id="button"
248
+ id="card"
239
249
  tabindex=${this.#tabindex}
240
250
  href=${this.href}
241
251
  target=${this.target}
@@ -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
 
@@ -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 = {
@@ -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
  }
@@ -64,10 +64,6 @@
64
64
  .content {
65
65
  width: 50%;
66
66
  }
67
-
68
- .headline {
69
- @include mixin.get-typography(title-medium);
70
- }
71
67
  }
72
68
  }
73
69
 
@@ -75,7 +71,7 @@
75
71
  .empty-state {
76
72
  .empty-state-container {
77
73
  flex-direction: column;
78
- gap: var(--spacing-200);
74
+ gap: var(--spacing-150);
79
75
 
80
76
  .illustration {
81
77
  height: auto;
@@ -84,8 +80,10 @@
84
80
  }
85
81
  }
86
82
 
87
- .headline {
88
- @include mixin.get-typography(title-small);
83
+ .content {
84
+ .headline {
85
+ @include mixin.get-typography(headline-small);
86
+ }
89
87
  }
90
88
  }
91
89
  }
@@ -12,7 +12,7 @@ import styles from './empty-state.scss';
12
12
  *
13
13
  * @example
14
14
  * ```html
15
- * <wc-empty-state width="80%" 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 {