@redvars/peacock 3.2.7 → 3.2.9

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 (145) hide show
  1. package/dist/PeacockComponent-CxJc63xj.js +73 -0
  2. package/dist/PeacockComponent-CxJc63xj.js.map +1 -0
  3. package/dist/assets/styles.css +1 -1
  4. package/dist/assets/styles.css.map +1 -1
  5. package/dist/button-2MeDq0Yy.js +898 -0
  6. package/dist/button-2MeDq0Yy.js.map +1 -0
  7. package/dist/button-group.js +7 -5
  8. package/dist/button-group.js.map +1 -1
  9. package/dist/button.js +7 -0
  10. package/dist/button.js.map +1 -0
  11. package/dist/{class-map-BmCohX9p.js → class-map-BvQRv7eW.js} +2 -2
  12. package/dist/{class-map-BmCohX9p.js.map → class-map-BvQRv7eW.js.map} +1 -1
  13. package/dist/clock.js +26 -24
  14. package/dist/clock.js.map +1 -1
  15. package/dist/code-editor.js +43877 -0
  16. package/dist/code-editor.js.map +1 -0
  17. package/dist/code-highlighter.js +9 -7
  18. package/dist/code-highlighter.js.map +1 -1
  19. package/dist/custom-elements-jsdocs.json +561 -0
  20. package/dist/custom-elements.json +838 -227
  21. package/dist/{utils-DGMeCC48.js → dispatch-event-utils-vbdiOSeC.js} +19 -2
  22. package/dist/dispatch-event-utils-vbdiOSeC.js.map +1 -0
  23. package/dist/image-DK6VQW7N.js +7042 -0
  24. package/dist/image-DK6VQW7N.js.map +1 -0
  25. package/dist/index.js +10 -33
  26. package/dist/index.js.map +1 -1
  27. package/dist/number-counter.js +7 -5
  28. package/dist/number-counter.js.map +1 -1
  29. package/dist/observe-theme-change-NneLARW8.js +51 -0
  30. package/dist/observe-theme-change-NneLARW8.js.map +1 -0
  31. package/dist/peacock-loader.js +973 -37
  32. package/dist/peacock-loader.js.map +1 -1
  33. package/dist/src/PeacockComponent.d.ts +1 -0
  34. package/dist/src/code-editor/code-editor.d.ts +45 -0
  35. package/dist/src/code-editor/index.d.ts +2 -0
  36. package/dist/src/image/image.d.ts +45 -0
  37. package/dist/src/image/index.d.ts +1 -0
  38. package/dist/src/index.d.ts +2 -0
  39. package/dist/src/utils/dispatch-event-utils.d.ts +72 -0
  40. package/dist/src/utils/observe-theme-change.d.ts +3 -0
  41. package/dist/src/utils.d.ts +1 -72
  42. package/dist/{state-CV1fRmOT.js → state-B09bP3XH.js} +2 -2
  43. package/dist/{state-CV1fRmOT.js.map → state-B09bP3XH.js.map} +1 -1
  44. package/dist/{style-map-CdmclYgz.js → style-map-B8xgVEc9.js} +2 -2
  45. package/dist/{style-map-CdmclYgz.js.map → style-map-B8xgVEc9.js.map} +1 -1
  46. package/dist/tsconfig.tsbuildinfo +1 -1
  47. package/dist/{unsafe-html-BS8X6Gto.js → unsafe-html-B-dV3Jps.js} +2 -2
  48. package/dist/{unsafe-html-BS8X6Gto.js.map → unsafe-html-B-dV3Jps.js.map} +1 -1
  49. package/package.json +5 -3
  50. package/readme.md +2 -2
  51. package/scss/styles.scss +57 -1
  52. package/scss/tokens.css +1 -0
  53. package/src/PeacockComponent.ts +3 -0
  54. package/src/accordion/accordion-item/accordion-item.scss +1 -1
  55. package/src/button/BaseButton.ts +1 -1
  56. package/src/button/button/button.ts +3 -1
  57. package/src/button/button-group/button-group.ts +2 -0
  58. package/src/clock/clock.ts +4 -1
  59. package/src/code-editor/code-editor.scss +52 -0
  60. package/src/code-editor/code-editor.ts +215 -0
  61. package/src/code-editor/demo/index.html +37 -0
  62. package/src/code-editor/index.ts +3 -0
  63. package/src/code-highlighter/code-highlighter.ts +2 -0
  64. package/src/container/container.scss +1 -1
  65. package/src/date-picker/date-picker.ts +1 -1
  66. package/src/image/image.scss +49 -0
  67. package/src/image/image.ts +135 -0
  68. package/src/image/index.ts +1 -0
  69. package/src/index.ts +2 -0
  70. package/src/input/input.ts +1 -2
  71. package/src/menu/menu-item/menu-item.scss +5 -4
  72. package/src/menu/menu-list/menu-list.scss +1 -0
  73. package/src/number-counter/number-counter.ts +2 -0
  74. package/src/number-field/number-field.ts +1 -1
  75. package/src/peacock-loader.ts +7 -0
  76. package/src/textarea/textarea.ts +1 -1
  77. package/src/time-picker/time-picker.ts +1 -1
  78. package/src/utils/dispatch-event-utils.ts +131 -0
  79. package/src/utils/observe-theme-change.ts +30 -0
  80. package/src/utils.ts +5 -131
  81. package/dist/BaseButton.js +0 -209
  82. package/dist/BaseButton.js.map +0 -1
  83. package/dist/BaseInput.js +0 -27
  84. package/dist/BaseInput.js.map +0 -1
  85. package/dist/accordion-item.js +0 -191
  86. package/dist/accordion-item.js.map +0 -1
  87. package/dist/accordion.js +0 -142
  88. package/dist/accordion.js.map +0 -1
  89. package/dist/avatar.js +0 -106
  90. package/dist/avatar.js.map +0 -1
  91. package/dist/badge.js +0 -84
  92. package/dist/badge.js.map +0 -1
  93. package/dist/base-progress.js +0 -33
  94. package/dist/base-progress.js.map +0 -1
  95. package/dist/breadcrumb-item.js +0 -160
  96. package/dist/breadcrumb-item.js.map +0 -1
  97. package/dist/breadcrumb.js +0 -84
  98. package/dist/breadcrumb.js.map +0 -1
  99. package/dist/checkbox.js +0 -530
  100. package/dist/checkbox.js.map +0 -1
  101. package/dist/chip.js +0 -303
  102. package/dist/chip.js.map +0 -1
  103. package/dist/container.js +0 -135
  104. package/dist/container.js.map +0 -1
  105. package/dist/divider.js +0 -126
  106. package/dist/divider.js.map +0 -1
  107. package/dist/elevation.js +0 -79
  108. package/dist/elevation.js.map +0 -1
  109. package/dist/empty-state.js +0 -171
  110. package/dist/empty-state.js.map +0 -1
  111. package/dist/field.js +0 -416
  112. package/dist/field.js.map +0 -1
  113. package/dist/focus-ring.js +0 -107
  114. package/dist/focus-ring.js.map +0 -1
  115. package/dist/icon.js +0 -183
  116. package/dist/icon.js.map +0 -1
  117. package/dist/link.js +0 -91
  118. package/dist/link.js.map +0 -1
  119. package/dist/lit-element-CA46RFZ_.js +0 -28
  120. package/dist/lit-element-CA46RFZ_.js.map +0 -1
  121. package/dist/menu-item.js +0 -232
  122. package/dist/menu-item.js.map +0 -1
  123. package/dist/menu-list.js +0 -108
  124. package/dist/menu-list.js.map +0 -1
  125. package/dist/menu.js +0 -117
  126. package/dist/menu.js.map +0 -1
  127. package/dist/property-DNVWDdPC.js +0 -45
  128. package/dist/property-DNVWDdPC.js.map +0 -1
  129. package/dist/query-QBcUV-L_.js +0 -15
  130. package/dist/query-QBcUV-L_.js.map +0 -1
  131. package/dist/ripple.js +0 -128
  132. package/dist/ripple.js.map +0 -1
  133. package/dist/skeleton.js +0 -113
  134. package/dist/skeleton.js.map +0 -1
  135. package/dist/spinner.js +0 -93
  136. package/dist/spinner.js.map +0 -1
  137. package/dist/spread-axRTFMoH.js +0 -32
  138. package/dist/spread-axRTFMoH.js.map +0 -1
  139. package/dist/switch-DqxIiVsB.js +0 -2738
  140. package/dist/switch-DqxIiVsB.js.map +0 -1
  141. package/dist/tag.js +0 -323
  142. package/dist/tag.js.map +0 -1
  143. package/dist/tooltip.js +0 -1857
  144. package/dist/tooltip.js.map +0 -1
  145. package/dist/utils-DGMeCC48.js.map +0 -1
@@ -0,0 +1,898 @@
1
+ import { i, _ as __decorate, n, a as i$2, A, c as __classPrivateFieldGet, b, P as PeacockComponent } from './PeacockComponent-CxJc63xj.js';
2
+ import { r } from './state-B09bP3XH.js';
3
+ import { e as e$2 } from './class-map-BvQRv7eW.js';
4
+ import { e as e$1, i as isActivationClick, d as dispatchActivationClick, t as throttle, o as observerSlotChangesWithCallback } from './dispatch-event-utils-vbdiOSeC.js';
5
+ import { e, i as i$1, t } from './directive-Cuw6h7YA.js';
6
+
7
+ var css_248z$2 = i`* {
8
+ box-sizing: border-box;
9
+ }
10
+
11
+ .screen-reader-only {
12
+ display: none !important;
13
+ }
14
+
15
+ :host {
16
+ display: inline-flex;
17
+ --z-index-button: 0;
18
+ --button-height: unset;
19
+ --button-icon-size: unset;
20
+ --button-container-shape: unset;
21
+ --button-container-shape-start-start: unset;
22
+ --button-container-shape-start-end: unset;
23
+ --button-container-shape-end-start: unset;
24
+ --button-container-shape-end-end: unset;
25
+ --button-container-shape-variant: unset;
26
+ }
27
+
28
+ /**
29
+ * Private CSS Variables
30
+ * These variables are used internally within the button component
31
+ */
32
+ slot::slotted(*) {
33
+ --icon-size: var(--button-icon-size, var(--_button-icon-size));
34
+ --icon-color: var(--_label-text-color);
35
+ }
36
+
37
+ /*
38
+ * Reset native button/link styles
39
+ */
40
+ .button.button-element {
41
+ background: transparent;
42
+ border: none;
43
+ appearance: none;
44
+ margin: 0;
45
+ outline: none;
46
+ text-decoration: none;
47
+ }
48
+
49
+ .button {
50
+ position: relative;
51
+ display: inline-flex;
52
+ flex-direction: column;
53
+ align-items: center;
54
+ justify-content: center;
55
+ height: var(--button-height, var(--_button-height));
56
+ padding: 0 var(--_container-padding);
57
+ width: 100%;
58
+ font-family: var(--font-family-sans) !important;
59
+ cursor: pointer;
60
+ --_container-shape-start-start: var(--button-container-shape-start-start, var(--button-container-shape, var(--shape-corner-medium)));
61
+ --_container-shape-start-end: var(--button-container-shape-start-end, var(--button-container-shape, var(--shape-corner-medium)));
62
+ --_container-shape-end-start: var(--button-container-shape-end-start, var(--button-container-shape, var(--shape-corner-medium)));
63
+ --_container-shape-end-end: var(--button-container-shape-end-end, var(--button-container-shape, var(--shape-corner-medium)));
64
+ --_container-corner-shape-variant: var(--button-container-shape-variant, squircle);
65
+ }
66
+ .button .button-content {
67
+ display: flex;
68
+ align-items: center;
69
+ justify-content: center;
70
+ gap: var(--_button-icon-label-spacing);
71
+ width: 100%;
72
+ z-index: 1;
73
+ color: var(--_label-text-color);
74
+ opacity: var(--_label-text-opacity, 1);
75
+ --icon-size: var(--button-icon-size, var(--_button-icon-size));
76
+ --icon-color: var(--_label-text-color);
77
+ }
78
+ .button .button-content .slot-container {
79
+ display: none;
80
+ }
81
+ .button.disabled {
82
+ cursor: not-allowed;
83
+ }
84
+ .button {
85
+ /*
86
+ Background layers
87
+ */
88
+ }
89
+ .button .focus-ring {
90
+ z-index: 2;
91
+ --focus-ring-container-shape-start-start: var(--_container-shape-start-start);
92
+ --focus-ring-container-shape-start-end: var(--_container-shape-start-end);
93
+ --focus-ring-container-shape-end-start: var(--_container-shape-end-start);
94
+ --focus-ring-container-shape-end-end: var(--_container-shape-end-end);
95
+ --focus-ring-container-shape-variant: var(--_container-corner-shape-variant);
96
+ }
97
+ .button .ripple {
98
+ border-start-start-radius: var(--_container-shape-start-start);
99
+ border-start-end-radius: var(--_container-shape-start-end);
100
+ border-end-start-radius: var(--_container-shape-end-start);
101
+ border-end-end-radius: var(--_container-shape-end-end);
102
+ corner-shape: var(--_container-corner-shape-variant);
103
+ --ripple-state-opacity: var(--_container-state-opacity, 0);
104
+ --ripple-pressed-color: var(--_container-state-color);
105
+ }
106
+ .button .background {
107
+ display: block;
108
+ position: absolute;
109
+ left: 0;
110
+ width: 100%;
111
+ height: 100%;
112
+ background-color: var(--_container-color);
113
+ opacity: var(--_container-opacity, 1);
114
+ border-start-start-radius: var(--_container-shape-start-start);
115
+ border-start-end-radius: var(--_container-shape-start-end);
116
+ border-end-start-radius: var(--_container-shape-end-start);
117
+ border-end-end-radius: var(--_container-shape-end-end);
118
+ corner-shape: var(--_container-corner-shape-variant);
119
+ pointer-events: none;
120
+ }
121
+ .button .skeleton {
122
+ display: none;
123
+ width: 100%;
124
+ height: 100%;
125
+ z-index: 2;
126
+ position: absolute;
127
+ top: 0;
128
+ left: 0;
129
+ --skeleton-container-shape-start-start: var(--_container-shape-start-start);
130
+ --skeleton-container-shape-start-end: var(--_container-shape-start-end);
131
+ --skeleton-container-shape-end-start: var(--_container-shape-end-start);
132
+ --skeleton-container-shape-end-end: var(--_container-shape-end-end);
133
+ --skeleton-container-shape-variant: var(--_container-corner-shape-variant);
134
+ }
135
+ .button .elevation {
136
+ --elevation-level: var(--_container-elevation-level);
137
+ transition-duration: 280ms;
138
+ --elevation-container-shape-start-start: var(--_container-shape-start-start);
139
+ --elevation-container-shape-start-end: var(--_container-shape-start-end);
140
+ --elevation-container-shape-end-start: var(--_container-shape-end-start);
141
+ --elevation-container-shape-end-end: var(--_container-shape-end-end);
142
+ --elevation-container-shape-variant: var(--_container-corner-shape-variant);
143
+ }
144
+ .button .neo-background {
145
+ display: none;
146
+ position: absolute;
147
+ background: var(--color-inverse-surface);
148
+ border-start-start-radius: var(--_container-shape-start-start);
149
+ border-start-end-radius: var(--_container-shape-start-end);
150
+ border-end-start-radius: var(--_container-shape-end-start);
151
+ border-end-end-radius: var(--_container-shape-end-end);
152
+ corner-shape: var(--_container-corner-shape-variant);
153
+ width: 100%;
154
+ height: 100%;
155
+ pointer-events: none;
156
+ transform: translateX(0.25rem) translateY(0.25rem);
157
+ }
158
+ .button .neo-background:before {
159
+ z-index: 0;
160
+ content: "";
161
+ position: absolute;
162
+ pointer-events: none;
163
+ border-start-start-radius: var(--_container-shape-start-start);
164
+ border-start-end-radius: var(--_container-shape-start-end);
165
+ border-end-start-radius: var(--_container-shape-end-start);
166
+ border-end-end-radius: var(--_container-shape-end-end);
167
+ corner-shape: var(--_container-corner-shape-variant);
168
+ width: 100%;
169
+ height: 100%;
170
+ background: white;
171
+ left: 0;
172
+ transform: translateX(-0.25rem) translateY(-0.25rem);
173
+ }
174
+ .button .outline {
175
+ z-index: 0;
176
+ display: none;
177
+ position: absolute;
178
+ left: 0;
179
+ width: 100%;
180
+ height: 100%;
181
+ pointer-events: none;
182
+ border: var(--_outline-width) solid var(--_outline-color);
183
+ opacity: var(--_outline-opacity, 1);
184
+ border-start-start-radius: var(--_container-shape-start-start);
185
+ border-start-end-radius: var(--_container-shape-start-end);
186
+ border-end-start-radius: var(--_container-shape-end-start);
187
+ border-end-end-radius: var(--_container-shape-end-end);
188
+ corner-shape: var(--_container-corner-shape-variant);
189
+ }
190
+ .button.has-content .slot-container {
191
+ display: flex;
192
+ flex: none;
193
+ justify-content: center;
194
+ }
195
+ .button.show-skeleton .background {
196
+ display: none;
197
+ }
198
+ .button.show-skeleton .neo-background {
199
+ display: none;
200
+ }
201
+ .button.show-skeleton .neo-background:before {
202
+ display: none;
203
+ }
204
+ .button.show-skeleton .ripple {
205
+ display: none;
206
+ }
207
+ .button.show-skeleton .skeleton {
208
+ display: block;
209
+ }
210
+ .button.icon-align-start .button-content {
211
+ flex-direction: row-reverse;
212
+ }
213
+ .button.icon-align-end .button-content {
214
+ flex-direction: row;
215
+ }
216
+
217
+ /**
218
+ * Button variant definitions
219
+ */
220
+ .button.variant-elevated {
221
+ --_container-color: var(--elevated-button-container-color);
222
+ --_label-text-color: var(--elevated-button-label-text-color);
223
+ --_container-elevation-level: 1;
224
+ --_container-state-color: var(--_label-text-color);
225
+ }
226
+ .button.variant-elevated:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
227
+ --_container-elevation-level: 2;
228
+ --_container-state-opacity: 0.08;
229
+ }
230
+ .button.variant-elevated.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
231
+ --_container-elevation-level: 1;
232
+ --_container-state-opacity: 0.12;
233
+ }
234
+ .button.variant-elevated.disabled {
235
+ --_container-color: var(--color-on-surface);
236
+ --_container-opacity: 0.1;
237
+ --_label-text-color: var(--color-on-surface);
238
+ --_label-text-opacity: 0.38;
239
+ }
240
+ .button.variant-elevated.disabled .ripple {
241
+ display: none;
242
+ }
243
+
244
+ .button.variant-filled {
245
+ --_container-color: var(--filled-button-container-color);
246
+ --_label-text-color: var(--filled-button-label-text-color);
247
+ --_container-state-color: var(--_label-text-color);
248
+ }
249
+ .button.variant-filled:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
250
+ --_container-elevation-level: 1;
251
+ --_container-state-opacity: 0.08;
252
+ }
253
+ .button.variant-filled.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
254
+ --_container-elevation-level: 0;
255
+ --_container-state-opacity: 0.1;
256
+ }
257
+ .button.variant-filled.disabled {
258
+ --_container-color: var(--color-on-surface);
259
+ --_container-opacity: 0.1;
260
+ --_label-text-color: var(--color-on-surface);
261
+ --_label-text-opacity: 0.38;
262
+ }
263
+ .button.variant-filled.disabled .ripple {
264
+ display: none;
265
+ }
266
+
267
+ .button.variant-tonal {
268
+ --_container-color: var(--tonal-button-container-color);
269
+ --_label-text-color: var(--tonal-button-label-text-color);
270
+ --_container-state-color: var(--_label-text-color);
271
+ }
272
+ .button.variant-tonal:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
273
+ --_container-elevation-level: 1;
274
+ --_container-state-opacity: 0.08;
275
+ }
276
+ .button.variant-tonal.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
277
+ --_container-elevation-level: 0;
278
+ --_container-state-opacity: 0.12;
279
+ }
280
+ .button.variant-tonal.disabled {
281
+ --_container-color: var(--color-on-surface);
282
+ --_container-opacity: 0.1;
283
+ --_label-text-color: var(--color-on-surface);
284
+ --_label-text-opacity: 0.38;
285
+ }
286
+ .button.variant-tonal.disabled .ripple {
287
+ display: none;
288
+ }
289
+
290
+ .button.variant-outlined {
291
+ --_outline-width: var(--outlined-button-outline-width, 0.0675rem);
292
+ --_outline-color: var(--outlined-button-outline-color);
293
+ --_label-text-color: var(--outlined-button-label-text-color);
294
+ --_container-state-color: var(--_label-text-color);
295
+ }
296
+ .button.variant-outlined .outline {
297
+ display: block;
298
+ }
299
+ .button.variant-outlined:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
300
+ --_container-state-opacity: 0.08;
301
+ }
302
+ .button.variant-outlined.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
303
+ --_container-state-opacity: 0.12;
304
+ }
305
+ .button.variant-outlined.disabled {
306
+ --_outline-color: var(--color-on-surface);
307
+ --_label-text-color: var(--color-on-surface);
308
+ --_label-text-opacity: 0.38;
309
+ --_outline-opacity: 0.12;
310
+ }
311
+ .button.variant-outlined.disabled .ripple {
312
+ display: none;
313
+ }
314
+
315
+ .button.variant-text {
316
+ --_label-text-color: var(--text-button-label-text-color);
317
+ --_container-state-color: var(--_label-text-color);
318
+ }
319
+ .button.variant-text:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
320
+ --_container-state-opacity: 0.08;
321
+ }
322
+ .button.variant-text.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
323
+ --_container-state-opacity: 0.12;
324
+ }
325
+ .button.variant-text.disabled {
326
+ --_label-text-color: var(--color-on-surface);
327
+ --_label-text-opacity: 0.38;
328
+ }
329
+ .button.variant-text.disabled .ripple {
330
+ display: none;
331
+ }
332
+
333
+ .button.variant-neo {
334
+ --_container-color: var(--neo-button-container-color);
335
+ --_label-text-color: var(--neo-button-label-text-color);
336
+ --_outline-width: var(--outlined-button-outline-width, 0.125rem);
337
+ --_outline-color: var(--color-inverse-surface);
338
+ }
339
+ .button.variant-neo .outline {
340
+ display: block;
341
+ }
342
+ .button.variant-neo .neo-background {
343
+ display: block;
344
+ }
345
+ .button.variant-neo .ripple {
346
+ display: none;
347
+ }
348
+ .button.variant-neo.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) .background, .button.variant-neo.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) .button-content, .button.variant-neo.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) .outline {
349
+ transform: translateX(0.25rem) translateY(0.25rem);
350
+ }
351
+ .button.variant-neo.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) .neo-background:before {
352
+ transform: translateX(0) translateY(0);
353
+ }
354
+ .button.variant-neo.disabled {
355
+ --_container-color: var(--color-on-surface);
356
+ --_container-opacity: 0.1;
357
+ --_label-text-color: var(--color-on-surface);
358
+ --_label-text-opacity: 0.38;
359
+ --_outline-opacity: 0.12;
360
+ }
361
+ .button.variant-neo.disabled .ripple {
362
+ display: none;
363
+ }
364
+
365
+ :host([block]) {
366
+ width: 100%;
367
+ }`;
368
+
369
+ var css_248z$1 = i`:host([color=primary]) {
370
+ --filled-button-container-color: var(--color-primary);
371
+ --filled-button-label-text-color: var(--color-on-primary);
372
+ --tonal-button-container-color: var(--color-primary-container);
373
+ --tonal-button-label-text-color: var(--color-on-primary-container);
374
+ --elevated-button-container-color: var(--color-surface-container-low);
375
+ --elevated-button-label-text-color: var(--color-primary);
376
+ --outlined-button-outline-color: var(--color-primary);
377
+ --outlined-button-label-text-color: var(--color-primary);
378
+ --text-button-label-text-color: var(--color-primary);
379
+ --neo-button-container-color: var(--color-primary);
380
+ --neo-button-label-text-color: var(--color-on-primary);
381
+ }
382
+
383
+ :host([color=secondary]) {
384
+ --filled-button-container-color: var(--color-secondary);
385
+ --filled-button-label-text-color: var(--color-on-secondary);
386
+ --tonal-button-container-color: var(--color-secondary-container);
387
+ --tonal-button-label-text-color: var(--color-on-secondary-container);
388
+ --elevated-button-container-color: var(--color-surface-container-low);
389
+ --elevated-button-label-text-color: var(--color-secondary);
390
+ --outlined-button-outline-color: var(--color-secondary);
391
+ --outlined-button-label-text-color: var(--color-secondary);
392
+ --text-button-label-text-color: var(--color-secondary);
393
+ --neo-button-container-color: var(--color-secondary);
394
+ --neo-button-label-text-color: var(--color-on-secondary);
395
+ }
396
+
397
+ :host([color=tertiary]) {
398
+ --filled-button-container-color: var(--color-tertiary);
399
+ --filled-button-label-text-color: var(--color-on-tertiary);
400
+ --tonal-button-container-color: var(--color-tertiary-container);
401
+ --tonal-button-label-text-color: var(--color-on-tertiary-container);
402
+ --elevated-button-container-color: var(--color-surface-container-low);
403
+ --elevated-button-label-text-color: var(--color-tertiary);
404
+ --outlined-button-outline-color: var(--color-tertiary);
405
+ --outlined-button-label-text-color: var(--color-tertiary);
406
+ --text-button-label-text-color: var(--color-tertiary);
407
+ --neo-button-container-color: var(--color-tertiary);
408
+ --neo-button-label-text-color: var(--color-on-tertiary);
409
+ }
410
+
411
+ :host([color=success]) {
412
+ --filled-button-container-color: var(--color-success);
413
+ --filled-button-label-text-color: var(--color-on-success);
414
+ --tonal-button-container-color: var(--color-success-container);
415
+ --tonal-button-label-text-color: var(--color-on-success-container);
416
+ --elevated-button-container-color: var(--color-surface-container-low);
417
+ --elevated-button-label-text-color: var(--color-success);
418
+ --outlined-button-outline-color: var(--color-success);
419
+ --outlined-button-label-text-color: var(--color-success);
420
+ --text-button-label-text-color: var(--color-success);
421
+ --neo-button-container-color: var(--color-success);
422
+ --neo-button-label-text-color: var(--color-on-success);
423
+ }
424
+
425
+ :host([color=danger]) {
426
+ --filled-button-container-color: var(--color-error);
427
+ --filled-button-label-text-color: var(--color-on-error);
428
+ --tonal-button-container-color: var(--color-error-container);
429
+ --tonal-button-label-text-color: var(--color-on-error-container);
430
+ --elevated-button-container-color: var(--color-surface-container-low);
431
+ --elevated-button-label-text-color: var(--color-error);
432
+ --outlined-button-outline-color: var(--color-error);
433
+ --outlined-button-label-text-color: var(--color-error);
434
+ --text-button-label-text-color: var(--color-error);
435
+ --neo-button-container-color: var(--color-error);
436
+ --neo-button-label-text-color: var(--color-on-error);
437
+ }
438
+
439
+ :host([color=dark]) {
440
+ --filled-button-container-color: var(--color-on-surface);
441
+ --filled-button-label-text-color: var(--color-surface);
442
+ --tonal-button-container-color: var(--color-surface-container);
443
+ --tonal-button-label-text-color: var(--color-on-surface-container);
444
+ --elevated-button-container-color: var(--color-surface-container-low);
445
+ --elevated-button-label-text-color: var(--color-on-surface);
446
+ --outlined-button-outline-color: var(--color-on-surface);
447
+ --outlined-button-label-text-color: var(--color-on-surface);
448
+ --text-button-label-text-color: var(--color-on-surface);
449
+ --neo-button-container-color: var(--color-on-surface);
450
+ --neo-button-label-text-color: var(--color-surface);
451
+ }
452
+
453
+ :host([color=light]) {
454
+ --filled-button-container-color: var(--color-surface);
455
+ --filled-button-label-text-color: var(--color-on-surface);
456
+ --tonal-button-container-color: var(--color-on-surface-container);
457
+ --tonal-button-label-text-color: var(--color-surface-container);
458
+ --elevated-button-container-color: var(--color-surface-container-low);
459
+ --elevated-button-label-text-color: var(--color-white);
460
+ --outlined-button-outline-color: var(--color-surface);
461
+ --outlined-button-label-text-color: var(--color-surface);
462
+ --text-button-label-text-color: var(--color-surface);
463
+ --neo-button-container-color: var(--color-surface);
464
+ --neo-button-label-text-color: var(--color-on-surface);
465
+ }`;
466
+
467
+ var css_248z = i`.button.size-xs,
468
+ .button.size-extra-small {
469
+ --_button-height: 2rem;
470
+ --_button-icon-size: 1rem;
471
+ --_container-padding: 0.75rem;
472
+ font-size: 0.875rem !important;
473
+ font-weight: var(--font-weight-medium) !important;
474
+ line-height: 1.25rem !important;
475
+ letter-spacing: 0.1px !important;
476
+ }
477
+
478
+ .button.size-sm,
479
+ .button.size-small {
480
+ --_button-height: 2.5rem;
481
+ --_button-icon-size: 1.25rem;
482
+ --_container-padding: 1rem;
483
+ --_button-icon-label-spacing: 0.5rem;
484
+ font-size: 0.875rem !important;
485
+ font-weight: var(--font-weight-medium) !important;
486
+ line-height: 1.25rem !important;
487
+ letter-spacing: 0.1px !important;
488
+ }
489
+
490
+ .button.size-md,
491
+ .button.size-medium {
492
+ --_button-height: 3.5rem;
493
+ --_button-icon-size: 1.5rem;
494
+ --_container-padding: 1.5rem;
495
+ font-size: 1rem !important;
496
+ font-weight: var(--font-weight-medium) !important;
497
+ line-height: 1.5rem !important;
498
+ letter-spacing: 0.15px !important;
499
+ }
500
+
501
+ .button.size-lg,
502
+ .button.size-large {
503
+ --_button-height: 6rem;
504
+ --_button-icon-size: 2rem;
505
+ --_container-padding: 3rem;
506
+ font-size: 1.5rem !important;
507
+ font-weight: var(--font-weight-regular) !important;
508
+ line-height: 2rem !important;
509
+ letter-spacing: 0 !important;
510
+ }
511
+
512
+ .button.size-xl {
513
+ --_button-height: 8.5rem;
514
+ --_button-icon-size: 2.5rem;
515
+ --_container-padding: 4rem;
516
+ font-size: 2rem !important;
517
+ font-weight: var(--font-weight-regular) !important;
518
+ line-height: 2.5rem !important;
519
+ letter-spacing: 0 !important;
520
+ }`;
521
+
522
+ class SpreadDirective extends i$1 {
523
+ constructor(partInfo) {
524
+ super(partInfo);
525
+ if (partInfo.type !== t.ELEMENT) {
526
+ throw new Error('spread() can only be used on elements');
527
+ }
528
+ }
529
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
530
+ render(_props) {
531
+ return '';
532
+ }
533
+ update(part, [props]) {
534
+ if (!props)
535
+ return;
536
+ // eslint-disable-next-line guard-for-in,no-restricted-syntax
537
+ for (const key in props) {
538
+ const value = props[key];
539
+ if (value === undefined || value === null) {
540
+ part.element.removeAttribute(key);
541
+ }
542
+ else {
543
+ part.element.setAttribute(key, value);
544
+ }
545
+ }
546
+ }
547
+ }
548
+ const spread = e(SpreadDirective);
549
+
550
+ var _BaseButton_id;
551
+ class BaseButton extends i$2 {
552
+ constructor() {
553
+ super(...arguments);
554
+ _BaseButton_id.set(this, crypto.randomUUID());
555
+ this.htmlType = 'button';
556
+ /**
557
+ * The visual style of the button.
558
+ *
559
+ * Possible variant values:
560
+ * `"filled"` is a filled button.
561
+ * `"outlined"` is an outlined button.
562
+ * `"text"` is a transparent button.
563
+ * `"tonal"` is a light color button.
564
+ * `"elevated"` is elevated button
565
+ */
566
+ this.variant = 'filled';
567
+ /**
568
+ * Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.
569
+ */
570
+ this.color = 'primary';
571
+ /**
572
+ * Button size.
573
+ * Possible values are `"sm"`, `"md"`, `"lg"`. Defaults to `"md"`.
574
+ */
575
+ this.size = 'sm';
576
+ /**
577
+ * If true, the user cannot interact with the button. Defaults to `false`.
578
+ */
579
+ this.disabled = false;
580
+ this.skeleton = false;
581
+ /**
582
+ * If true, the user cannot interact with the button and the button is visually styled as disabled. But the button is still focusable. Defaults to `false`.
583
+ */
584
+ this.softDisabled = false;
585
+ /**
586
+ * If button is disabled, the reason why it is disabled.
587
+ */
588
+ this.disabledReason = '';
589
+ /**
590
+ * Sets or retrieves the window or frame at which to target content.
591
+ */
592
+ this.target = '_self';
593
+ this.selected = false;
594
+ /**
595
+ * Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
596
+ */
597
+ this.throttleDelay = 200;
598
+ /**
599
+ * States
600
+ */
601
+ this.isPressed = false;
602
+ this.__handlePress = (event) => {
603
+ if (this.disabled || this.skeleton || this.softDisabled)
604
+ return;
605
+ if (event instanceof KeyboardEvent &&
606
+ event.type === 'keydown' &&
607
+ (event.key === 'Enter' || event.key === ' ')) {
608
+ this.isPressed = true;
609
+ }
610
+ else if (event.type === 'mousedown') {
611
+ this.isPressed = true;
612
+ }
613
+ else {
614
+ this.isPressed = false;
615
+ }
616
+ };
617
+ this.__dispatchClickWithThrottle = event => {
618
+ this.__dispatchClick(event);
619
+ };
620
+ this.__dispatchClick = (event) => {
621
+ // If the button is soft-disabled or a disabled link, we need to explicitly
622
+ // prevent the click from propagating to other event listeners as well as
623
+ // prevent the default action.
624
+ if (this.softDisabled || (this.disabled && this.href) || this.skeleton) {
625
+ event.stopImmediatePropagation();
626
+ event.preventDefault();
627
+ return;
628
+ }
629
+ if (!isActivationClick(event) || !this.buttonElement) {
630
+ return;
631
+ }
632
+ this.focus();
633
+ dispatchActivationClick(this.buttonElement);
634
+ };
635
+ }
636
+ focus() {
637
+ this.buttonElement?.focus();
638
+ }
639
+ blur() {
640
+ this.buttonElement?.blur();
641
+ }
642
+ connectedCallback() {
643
+ super.connectedCallback();
644
+ this.addEventListener('click', this.__dispatchClickWithThrottle);
645
+ window.addEventListener('mouseup', this.__handlePress);
646
+ }
647
+ disconnectedCallback() {
648
+ window.removeEventListener('mouseup', this.__handlePress);
649
+ this.removeEventListener('click', this.__dispatchClickWithThrottle);
650
+ super.disconnectedCallback();
651
+ }
652
+ __isLink() {
653
+ return !!this.href;
654
+ }
655
+ __convertTypeToVariantAndColor() {
656
+ if (this.type === 'primary') {
657
+ this.color = 'primary';
658
+ this.variant = 'filled';
659
+ }
660
+ else if (this.type === 'secondary') {
661
+ this.color = 'dark';
662
+ this.variant = 'outlined';
663
+ }
664
+ else if (this.type === 'tertiary') {
665
+ this.color = 'primary';
666
+ this.variant = 'text';
667
+ }
668
+ else if (this.type === 'danger') {
669
+ this.color = 'danger';
670
+ this.variant = 'filled';
671
+ }
672
+ }
673
+ __getDisabledReasonID() {
674
+ return this.disabled && this.disabledReason
675
+ ? `disabled-reason-${__classPrivateFieldGet(this, _BaseButton_id, "f")}`
676
+ : A;
677
+ }
678
+ __renderDisabledReason() {
679
+ const disabledReasonID = this.__getDisabledReasonID();
680
+ if (disabledReasonID)
681
+ return b `<div
682
+ id="disabled-reason-${__classPrivateFieldGet(this, _BaseButton_id, "f")}"
683
+ role="tooltip"
684
+ aria-label=${this.disabledReason}
685
+ class="screen-reader-only"
686
+ >
687
+ {this.disabledReason}
688
+ </div>`;
689
+ return A;
690
+ }
691
+ __renderTooltip() {
692
+ if (this.tooltip) {
693
+ return b `<base-tooltip for="button">${this.tooltip}</base-tooltip>`;
694
+ }
695
+ return A;
696
+ }
697
+ }
698
+ _BaseButton_id = new WeakMap();
699
+ __decorate([
700
+ n({ type: String })
701
+ ], BaseButton.prototype, "htmlType", void 0);
702
+ __decorate([
703
+ n({ type: String })
704
+ ], BaseButton.prototype, "type", void 0);
705
+ __decorate([
706
+ n()
707
+ ], BaseButton.prototype, "variant", void 0);
708
+ __decorate([
709
+ n({ reflect: true })
710
+ ], BaseButton.prototype, "color", void 0);
711
+ __decorate([
712
+ n()
713
+ ], BaseButton.prototype, "size", void 0);
714
+ __decorate([
715
+ n({ type: Boolean, reflect: true })
716
+ ], BaseButton.prototype, "disabled", void 0);
717
+ __decorate([
718
+ n()
719
+ ], BaseButton.prototype, "skeleton", void 0);
720
+ __decorate([
721
+ n({ reflect: true, attribute: 'soft-disabled' })
722
+ ], BaseButton.prototype, "softDisabled", void 0);
723
+ __decorate([
724
+ n({ attribute: 'disabled-reason' })
725
+ ], BaseButton.prototype, "disabledReason", void 0);
726
+ __decorate([
727
+ n({ reflect: true })
728
+ ], BaseButton.prototype, "href", void 0);
729
+ __decorate([
730
+ n({ reflect: true })
731
+ ], BaseButton.prototype, "configAria", void 0);
732
+ __decorate([
733
+ n()
734
+ ], BaseButton.prototype, "target", void 0);
735
+ __decorate([
736
+ n()
737
+ ], BaseButton.prototype, "selected", void 0);
738
+ __decorate([
739
+ n()
740
+ ], BaseButton.prototype, "throttleDelay", void 0);
741
+ __decorate([
742
+ n()
743
+ ], BaseButton.prototype, "tooltip", void 0);
744
+ __decorate([
745
+ r()
746
+ ], BaseButton.prototype, "isPressed", void 0);
747
+ __decorate([
748
+ e$1('.button')
749
+ ], BaseButton.prototype, "buttonElement", void 0);
750
+
751
+ var _Button_tabindex;
752
+ /**
753
+ * @label Button
754
+ * @tag base-button
755
+ * @rawTag button
756
+ *
757
+ * @summary Buttons help people initiate actions, from sending an email, to sharing a document, to liking a post.
758
+ * @overview
759
+ * <p>Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.</p>
760
+ *
761
+ * @cssprop --button-container-shape: Defines the border radius of the button container shape.
762
+ *
763
+ * @cssprop --button-container-shape-start-start: Defines the start position of the button container shape.
764
+ * @cssprop --button-container-shape-start-end: Defines the end position of the button container shape.
765
+ * @cssprop --button-container-shape-end-start: Defines the start position of the button container shape.
766
+ * @cssprop --button-container-shape-end-end: Defines the end position of the button container shape.
767
+ *
768
+ *
769
+ * @cssprop --filled-button-container-color: Color of the filled button container.
770
+ * @cssprop --filled-button-label-text-color: Text color of the filled button label.
771
+ *
772
+ * @cssprop --outlined-button-container-color: Color of the outlined button container.
773
+ * @cssprop --outlined-button-label-text-color: Text color of the outlined button label.
774
+ *
775
+ * @cssprop --text-button-label-text-color: Text color of the text button label.
776
+ *
777
+ * @cssprop --tonal-button-container-color: Color of the tonal button container.
778
+ * @cssprop --tonal-button-label-text-color: Text color of the tonal button label.
779
+ *
780
+ * @cssprop --elevated-button-container-color: Color of the elevated button container.
781
+ * @cssprop --elevated-button-label-text-color: Text color of the elevated button label.
782
+ *
783
+ * @cssprop --neo-button-container-color: Color of the neo button container.
784
+ * @cssprop --neo-button-label-text-color: Text color of the neo button label.
785
+ *
786
+ * @fires {MouseEvent} click - Dispatched when the button is clicked.
787
+ *
788
+ * @example
789
+ * ```html
790
+ * <base-button>Button</base-button>
791
+ * ```
792
+ * @tags display
793
+ */
794
+ let Button = class Button extends BaseButton {
795
+ constructor() {
796
+ super(...arguments);
797
+ _Button_tabindex.set(this, 0);
798
+ /**
799
+ * Icon alignment.
800
+ * Possible values are `"start"`, `"end"`. Defaults to `"end"`.
801
+ */
802
+ this.iconAlign = 'end';
803
+ this.slotHasContent = false;
804
+ }
805
+ firstUpdated() {
806
+ this.__dispatchClickWithThrottle = throttle(this.__dispatchClick, this.throttleDelay);
807
+ observerSlotChangesWithCallback(this.renderRoot.querySelector('slot'), hasContent => {
808
+ this.slotHasContent = hasContent;
809
+ this.requestUpdate();
810
+ });
811
+ this.__convertTypeToVariantAndColor();
812
+ }
813
+ render() {
814
+ const isLink = this.__isLink();
815
+ const cssClasses = {
816
+ button: true,
817
+ 'button-element': true,
818
+ [`size-${this.size}`]: true,
819
+ [`variant-${this.variant}`]: true,
820
+ [`color-${this.color}`]: true,
821
+ disabled: this.disabled || this.softDisabled,
822
+ pressed: this.isPressed,
823
+ 'has-content': this.slotHasContent,
824
+ 'show-skeleton': this.skeleton,
825
+ [`icon-align-${this.iconAlign}`]: true,
826
+ };
827
+ if (!isLink) {
828
+ return b `<button
829
+ class=${e$2(cssClasses)}
830
+ id="button"
831
+ tabindex=${__classPrivateFieldGet(this, _Button_tabindex, "f")}
832
+ type=${this.htmlType}
833
+ @mousedown=${this.__handlePress}
834
+ @keydown=${this.__handlePress}
835
+ @keyup=${this.__handlePress}
836
+ ?aria-describedby=${this.__getDisabledReasonID()}
837
+ aria-disabled=${`${this.disabled || this.softDisabled}`}
838
+ ?disabled=${this.disabled}
839
+ ${spread(this.configAria)}
840
+ >
841
+ ${this.renderButtonContent()}
842
+ </button>
843
+ ${this.__renderTooltip()}`;
844
+ }
845
+ return b `<a
846
+ class=${e$2(cssClasses)}
847
+ id="button"
848
+ tabindex=${__classPrivateFieldGet(this, _Button_tabindex, "f")}
849
+ href=${this.href}
850
+ target=${this.target}
851
+ @mousedown=${this.__handlePress}
852
+ @keydown=${this.__handlePress}
853
+ @keyup=${this.__handlePress}
854
+ role="button"
855
+ ?aria-describedby=${this.__getDisabledReasonID()}
856
+ aria-disabled=${`${this.disabled}`}
857
+ ${spread(this.configAria)}
858
+ >
859
+ ${this.renderButtonContent()}
860
+ </a>
861
+ ${this.__renderTooltip()}`;
862
+ }
863
+ renderButtonContent() {
864
+ return b `
865
+ <focus-ring class="focus-ring" .control=${this} element="buttonElement"></focus-ring>
866
+ <base-elevation class="elevation"></base-elevation>
867
+ <div class="neo-background"></div>
868
+ <div class="background"></div>
869
+ <div class="outline"></div>
870
+ <base-ripple class="ripple"></base-ripple>
871
+ <base-skeleton class="skeleton"></base-skeleton>
872
+
873
+ <div class="button-content">
874
+ <div class="slot-container">
875
+ <slot></slot>
876
+ </div>
877
+
878
+ <slot name="icon"></slot>
879
+ </div>
880
+
881
+ ${this.__renderDisabledReason()}
882
+ `;
883
+ }
884
+ };
885
+ _Button_tabindex = new WeakMap();
886
+ Button.styles = [css_248z$2, css_248z$1, css_248z];
887
+ __decorate([
888
+ n({ attribute: 'icon-align' })
889
+ ], Button.prototype, "iconAlign", void 0);
890
+ __decorate([
891
+ r()
892
+ ], Button.prototype, "slotHasContent", void 0);
893
+ Button = __decorate([
894
+ PeacockComponent
895
+ ], Button);
896
+
897
+ export { Button as B, css_248z$1 as a, BaseButton as b, css_248z$2 as c, spread as s };
898
+ //# sourceMappingURL=button-2MeDq0Yy.js.map