@redvars/peacock 3.4.0 → 3.5.1
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.
- package/dist/BaseButton-DuASuVth.js +219 -0
- package/dist/BaseButton-DuASuVth.js.map +1 -0
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js +65 -0
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js.map +1 -0
- package/dist/assets/components.css +1 -1
- package/dist/assets/components.css.map +1 -1
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/banner.js +187 -0
- package/dist/banner.js.map +1 -0
- package/dist/bottom-sheet.js +2 -2
- package/dist/{button-COYCtuA8.js → button-DouvOfEU.js} +92 -283
- package/dist/button-DouvOfEU.js.map +1 -0
- package/dist/{button-group-DsXquZQn.js → button-group-CEdMwvJJ.js} +72 -48
- package/dist/button-group-CEdMwvJJ.js.map +1 -0
- package/dist/button-group.js +8 -5
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +7 -4
- package/dist/button.js.map +1 -1
- package/dist/card.js +29 -74
- package/dist/card.js.map +1 -1
- package/dist/chart-bar.js +2 -2
- package/dist/chart-bar.js.map +1 -1
- package/dist/chart-doughnut.js +2 -2
- package/dist/chart-doughnut.js.map +1 -1
- package/dist/chart-pie.js +2 -2
- package/dist/chart-pie.js.map +1 -1
- package/dist/chart-stacked-bar.js +2 -2
- package/dist/chart-stacked-bar.js.map +1 -1
- package/dist/{class-map-3TAnCMAX.js → class-map-YU7g0o3B.js} +2 -2
- package/dist/{class-map-3TAnCMAX.js.map → class-map-YU7g0o3B.js.map} +1 -1
- package/dist/clock.js.map +1 -1
- package/dist/code-editor.js +4 -4
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +5 -4
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +6627 -3477
- package/dist/custom-elements.json +10954 -7810
- package/dist/directive-ZPhl09Yt.js +9 -0
- package/dist/directive-ZPhl09Yt.js.map +1 -0
- package/dist/dispatch-event-utils-CuEqjlPT.js +127 -0
- package/dist/dispatch-event-utils-CuEqjlPT.js.map +1 -0
- package/dist/fab.js +423 -0
- package/dist/fab.js.map +1 -0
- package/dist/index.js +17 -9
- package/dist/index.js.map +1 -1
- package/dist/{observe-theme-change-DKAIv5BB.js → is-dark-mode-DicqGkCJ.js} +6 -2
- package/dist/is-dark-mode-DicqGkCJ.js.map +1 -0
- package/dist/{select-C3XAzenC.js → navigation-rail-Lxetd5-Z.js} +2426 -898
- package/dist/navigation-rail-Lxetd5-Z.js.map +1 -0
- package/dist/notification.js +418 -0
- package/dist/notification.js.map +1 -0
- package/dist/number-counter.js +2 -2
- package/dist/number-counter.js.map +1 -1
- package/dist/observe-slot-change-BGJfgg2E.js +31 -0
- package/dist/observe-slot-change-BGJfgg2E.js.map +1 -0
- package/dist/peacock-loader.js +48 -13
- package/dist/peacock-loader.js.map +1 -1
- package/dist/search.js +456 -0
- package/dist/search.js.map +1 -0
- package/dist/side-sheet.js +2 -2
- package/dist/src/__mixins/BaseButtonMixin.d.ts +20 -0
- package/dist/src/__mixins/BaseHyperlinkMixin.d.ts +18 -0
- package/dist/src/__mixins/MixinConstructor.d.ts +1 -0
- package/dist/src/__utils/cache-fetch.d.ts +1 -0
- package/dist/src/__utils/is-dark-mode.d.ts +1 -0
- package/dist/src/__utils/is-in-viewport.d.ts +1 -0
- package/dist/src/__utils/observe-slot-change.d.ts +1 -0
- package/dist/src/__utils/sanitize-svg.d.ts +1 -0
- package/dist/src/__utils/throttle.d.ts +4 -0
- package/dist/src/accordion/accordion-item.d.ts +33 -9
- package/dist/src/accordion/accordion.d.ts +21 -5
- package/dist/src/banner/banner.d.ts +43 -0
- package/dist/src/banner/index.d.ts +1 -0
- package/dist/src/button/BaseButton.d.ts +7 -57
- package/dist/src/button/button/button.d.ts +32 -3
- package/dist/src/button/button-group/button-group.d.ts +4 -4
- package/dist/src/button/icon-button/icon-button.d.ts +33 -8
- package/dist/src/card/card.d.ts +4 -15
- package/dist/src/empty-state/empty-state.d.ts +1 -1
- package/dist/src/fab/fab.d.ts +80 -0
- package/dist/src/fab/index.d.ts +1 -0
- package/dist/src/focus-ring/focus-ring.d.ts +11 -5
- package/dist/src/index.d.ts +8 -1
- package/dist/src/link/link.d.ts +3 -10
- package/dist/src/menu/menu/menu.d.ts +3 -2
- package/dist/src/menu/sub-menu/sub-menu.d.ts +1 -0
- package/dist/src/navigation-rail/index.d.ts +2 -0
- package/dist/src/navigation-rail/navigation-rail-item.d.ts +55 -0
- package/dist/src/navigation-rail/navigation-rail.d.ts +71 -0
- package/dist/src/notification/index.d.ts +1 -0
- package/dist/src/notification/notification.d.ts +69 -0
- package/dist/src/pagination/pagination.d.ts +8 -1
- package/dist/src/search/index.d.ts +1 -0
- package/dist/src/search/search.d.ts +76 -0
- package/dist/src/select/select.d.ts +3 -5
- package/dist/src/sidebar-menu/index.d.ts +3 -0
- package/dist/src/sidebar-menu/sidebar-menu-item.d.ts +58 -0
- package/dist/src/sidebar-menu/sidebar-menu.d.ts +38 -0
- package/dist/src/sidebar-menu/sidebar-sub-menu.d.ts +35 -0
- package/dist/src/slider/slider.d.ts +4 -0
- package/dist/src/snackbar/snackbar.d.ts +14 -1
- package/dist/src/toolbar/index.d.ts +1 -0
- package/dist/src/toolbar/toolbar.d.ts +86 -0
- package/dist/src/tooltip/tooltip.d.ts +3 -0
- package/dist/src/url-field/index.d.ts +1 -0
- package/dist/src/url-field/url-field.d.ts +48 -0
- package/dist/{style-map-CRFEoCEg.js → style-map-DVmWOuYy.js} +2 -2
- package/dist/{style-map-CRFEoCEg.js.map → style-map-DVmWOuYy.js.map} +1 -1
- package/dist/test/banner.test.d.ts +1 -0
- package/dist/test/search.test.d.ts +1 -0
- package/dist/test/sidebar-menu.test.d.ts +1 -0
- package/dist/test/toolbar.test.d.ts +1 -0
- package/dist/toolbar.js +306 -0
- package/dist/toolbar.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{unsafe-html-D3GHRaGQ.js → unsafe-html-BsGUjx94.js} +2 -2
- package/dist/{unsafe-html-D3GHRaGQ.js.map → unsafe-html-BsGUjx94.js.map} +1 -1
- package/package.json +1 -1
- package/readme.md +73 -65
- package/scss/mixin.scss +16 -0
- package/scss/styles.scss +4 -0
- package/src/__mixins/BaseButtonMixin.ts +83 -0
- package/src/__mixins/BaseHyperlinkMixin.ts +68 -0
- package/src/__mixins/MixinConstructor.ts +1 -0
- package/src/__mixins/README.md +19 -0
- package/src/__utils/cache-fetch.ts +65 -0
- package/src/__utils/is-dark-mode.ts +3 -0
- package/src/__utils/is-in-viewport.ts +6 -0
- package/src/__utils/observe-slot-change.ts +38 -0
- package/src/__utils/sanitize-svg.ts +27 -0
- package/src/__utils/throttle.ts +27 -0
- package/src/accordion/accordion-item.scss +136 -65
- package/src/accordion/accordion-item.ts +117 -44
- package/src/accordion/accordion.scss +24 -5
- package/src/accordion/accordion.ts +29 -23
- package/src/accordion/demo/index.html +74 -35
- package/src/banner/banner.scss +83 -0
- package/src/banner/banner.ts +101 -0
- package/src/banner/index.ts +1 -0
- package/src/button/BaseButton.ts +13 -115
- package/src/button/button/button-colors.scss +14 -14
- package/src/button/button/button-sizes.scss +4 -2
- package/src/button/button/button.ts +80 -26
- package/src/button/button-group/button-group.ts +5 -5
- package/src/button/icon-button/icon-button.ts +79 -44
- package/src/card/card.ts +50 -100
- package/src/chart-bar/chart-bar.ts +10 -15
- package/src/chart-bar/chart-stacked-bar.ts +15 -19
- package/src/chart-doughnut/chart-doughnut.ts +24 -28
- package/src/chart-pie/chart-pie.ts +20 -24
- package/src/checkbox/checkbox.scss +17 -34
- package/src/checkbox/checkbox.ts +4 -2
- package/src/clock/clock.ts +1 -1
- package/src/code-editor/code-editor.ts +4 -4
- package/src/code-highlighter/code-highlighter.scss +1 -0
- package/src/code-highlighter/code-highlighter.ts +3 -3
- package/src/date-picker/date-picker.ts +6 -3
- package/src/divider/divider.ts +3 -1
- package/src/elevation/elevation.scss +5 -5
- package/src/empty-state/empty-state.scss +7 -9
- package/src/empty-state/empty-state.ts +1 -1
- package/src/fab/fab-colors.scss +49 -0
- package/src/fab/fab-sizes.scss +47 -0
- package/src/fab/fab.scss +137 -0
- package/src/fab/fab.ts +214 -0
- package/src/fab/index.ts +1 -0
- package/src/field/field.ts +3 -1
- package/src/focus-ring/focus-ring.ts +47 -40
- package/src/icon/datasource.ts +1 -1
- package/src/icon/icon.ts +3 -1
- package/src/image/image.ts +3 -2
- package/src/index.ts +8 -1
- package/src/input/input.ts +8 -3
- package/src/link/link.ts +2 -15
- package/src/menu/menu/menu.scss +7 -0
- package/src/menu/menu/menu.ts +7 -4
- package/src/menu/menu-item/menu-item.ts +3 -1
- package/src/menu/sub-menu/sub-menu.ts +1 -0
- package/src/navigation-rail/index.ts +2 -0
- package/src/navigation-rail/navigation-rail-item.scss +216 -0
- package/src/navigation-rail/navigation-rail-item.ts +223 -0
- package/src/navigation-rail/navigation-rail.scss +72 -0
- package/src/navigation-rail/navigation-rail.ts +149 -0
- package/src/notification/index.ts +1 -0
- package/src/notification/notification.scss +201 -0
- package/src/notification/notification.ts +207 -0
- package/src/number-counter/number-counter.ts +3 -1
- package/src/number-field/number-field.ts +10 -6
- package/src/pagination/pagination.scss +33 -24
- package/src/pagination/pagination.ts +115 -60
- package/src/peacock-loader.ts +42 -5
- package/src/radio/radio.ts +3 -1
- package/src/search/index.ts +1 -0
- package/src/search/search-colors.scss +14 -0
- package/src/search/search.scss +204 -0
- package/src/search/search.ts +244 -0
- package/src/select/option.ts +1 -1
- package/src/select/select.scss +5 -0
- package/src/select/select.ts +71 -37
- package/src/sidebar-menu/demo/index.html +68 -0
- package/src/sidebar-menu/index.ts +3 -0
- package/src/sidebar-menu/sidebar-menu-item.scss +102 -0
- package/src/sidebar-menu/sidebar-menu-item.ts +151 -0
- package/src/{tree-view/tree-view.scss → sidebar-menu/sidebar-menu.scss} +1 -1
- package/src/sidebar-menu/sidebar-menu.ts +182 -0
- package/src/sidebar-menu/sidebar-sub-menu.scss +130 -0
- package/src/sidebar-menu/sidebar-sub-menu.ts +160 -0
- package/src/skeleton/skeleton.scss +18 -24
- package/src/slider/slider.scss +19 -0
- package/src/slider/slider.ts +30 -19
- package/src/snackbar/snackbar.scss +62 -31
- package/src/snackbar/snackbar.ts +91 -11
- package/src/switch/switch.ts +3 -1
- package/src/table/table.ts +3 -1
- package/src/tabs/tab.ts +10 -6
- package/src/text/text.css-component.scss +7 -1
- package/src/textarea/textarea.ts +4 -2
- package/src/time-picker/time-picker.ts +5 -3
- package/src/toolbar/index.ts +1 -0
- package/src/toolbar/toolbar-colors.scss +16 -0
- package/src/toolbar/toolbar.scss +165 -0
- package/src/toolbar/toolbar.ts +137 -0
- package/src/tooltip/tooltip.ts +24 -0
- package/src/url-field/index.ts +1 -0
- package/src/url-field/url-field.scss +50 -0
- package/src/url-field/url-field.ts +239 -0
- package/dist/button-COYCtuA8.js.map +0 -1
- package/dist/button-group-DsXquZQn.js.map +0 -1
- package/dist/directive-Cuw6h7YA.js +0 -9
- package/dist/directive-Cuw6h7YA.js.map +0 -1
- package/dist/dispatch-event-utils-B4odODQf.js +0 -277
- package/dist/dispatch-event-utils-B4odODQf.js.map +0 -1
- package/dist/observe-theme-change-DKAIv5BB.js.map +0 -1
- package/dist/select-C3XAzenC.js.map +0 -1
- package/dist/src/styleMixins.css.d.ts +0 -9
- package/dist/src/tree-view/index.d.ts +0 -2
- package/dist/src/tree-view/tree-node.d.ts +0 -69
- package/dist/src/tree-view/tree-view.d.ts +0 -40
- package/dist/src/tree-view/wc-tree-view.d.ts +0 -6
- package/dist/src/utils.d.ts +0 -9
- package/dist/test/tree-view.test.d.ts +0 -1
- package/src/styleMixins.css.ts +0 -55
- package/src/tree-view/demo/index.html +0 -57
- package/src/tree-view/index.ts +0 -2
- package/src/tree-view/tree-node.scss +0 -101
- package/src/tree-view/tree-node.ts +0 -268
- package/src/tree-view/tree-view.ts +0 -182
- package/src/tree-view/wc-tree-view.ts +0 -9
- package/src/utils.ts +0 -193
- /package/dist/src/{spread.d.ts → __directive/spread.d.ts} +0 -0
- /package/dist/src/{utils → __utils}/copy-to-clipboard.d.ts +0 -0
- /package/dist/src/{utils → __utils}/dispatch-event-utils.d.ts +0 -0
- /package/dist/src/{utils → __utils}/observe-theme-change.d.ts +0 -0
- /package/src/{spread.ts → __directive/spread.ts} +0 -0
- /package/src/{utils → __utils}/copy-to-clipboard.ts +0 -0
- /package/src/{utils → __utils}/dispatch-event-utils.ts +0 -0
- /package/src/{utils → __utils}/observe-theme-change.ts +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { a as i, _ as __decorate,
|
|
1
|
+
import { a as i, _ as __decorate, b, I as IndividualComponent, i as i$1 } from './IndividualComponent-DUINtMGK.js';
|
|
2
2
|
import { n } from './property-1psGvXOq.js';
|
|
3
|
-
import { e } from './class-map-
|
|
4
|
-
import { c as css_248z$2, a as css_248z$3,
|
|
5
|
-
import {
|
|
3
|
+
import { e } from './class-map-YU7g0o3B.js';
|
|
4
|
+
import { c as css_248z$2, a as css_248z$3, B as Button } from './button-DouvOfEU.js';
|
|
5
|
+
import { B as BaseButton, o, s as spread } from './BaseButton-DuASuVth.js';
|
|
6
|
+
import { t as throttle } from './BaseHyperlinkMixin-BNuwbiEf.js';
|
|
6
7
|
|
|
7
8
|
var css_248z$1 = i`* {
|
|
8
9
|
box-sizing: border-box;
|
|
@@ -113,7 +114,6 @@ var css_248z = i`.button {
|
|
|
113
114
|
--_button-icon-size: 2.5rem;
|
|
114
115
|
}`;
|
|
115
116
|
|
|
116
|
-
var _IconButton_id, _IconButton_tabindex;
|
|
117
117
|
/**
|
|
118
118
|
* @label Icon Button
|
|
119
119
|
* @tag wc-icon-button
|
|
@@ -153,16 +153,33 @@ var _IconButton_id, _IconButton_tabindex;
|
|
|
153
153
|
*
|
|
154
154
|
* @example
|
|
155
155
|
* ```html
|
|
156
|
-
* <wc-icon-button name="home"></wc-icon-button>
|
|
156
|
+
* <wc-icon-button><wc-icon name="home"></wc-icon></wc-icon-button>
|
|
157
157
|
* ```
|
|
158
158
|
* @tags display
|
|
159
159
|
*/
|
|
160
160
|
class IconButton extends BaseButton {
|
|
161
161
|
constructor() {
|
|
162
162
|
super(...arguments);
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Button size.
|
|
165
|
+
* Possible values are `"xs"`, `"sm"`, `"md"`, `"lg"`, `"xl"`. Defaults to `"sm"`.
|
|
166
|
+
*/
|
|
167
|
+
this.size = 'sm';
|
|
168
|
+
/**
|
|
169
|
+
* The visual style of the button.
|
|
170
|
+
*
|
|
171
|
+
* Possible variant values:
|
|
172
|
+
* `"filled"` is a filled button.
|
|
173
|
+
* `"outlined"` is an outlined button.
|
|
174
|
+
* `"text"` is a transparent button.
|
|
175
|
+
* `"tonal"` is a light color button.
|
|
176
|
+
* `"elevated"` is elevated button
|
|
177
|
+
*/
|
|
178
|
+
this.variant = 'filled';
|
|
179
|
+
/**
|
|
180
|
+
* Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.
|
|
181
|
+
*/
|
|
182
|
+
this.color = 'primary';
|
|
166
183
|
}
|
|
167
184
|
focus() {
|
|
168
185
|
this.buttonElement?.focus();
|
|
@@ -170,20 +187,28 @@ class IconButton extends BaseButton {
|
|
|
170
187
|
blur() {
|
|
171
188
|
this.buttonElement?.blur();
|
|
172
189
|
}
|
|
173
|
-
connectedCallback() {
|
|
174
|
-
super.connectedCallback();
|
|
175
|
-
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
176
|
-
window.addEventListener('mouseup', this.__handlePress);
|
|
177
|
-
}
|
|
178
|
-
disconnectedCallback() {
|
|
179
|
-
window.removeEventListener('mouseup', this.__handlePress);
|
|
180
|
-
this.removeEventListener('click', this.__dispatchClickWithThrottle);
|
|
181
|
-
super.disconnectedCallback();
|
|
182
|
-
}
|
|
183
190
|
firstUpdated() {
|
|
184
191
|
this.__dispatchClickWithThrottle = throttle(this.__dispatchClick, this.throttleDelay);
|
|
185
192
|
this.__convertTypeToVariantAndColor();
|
|
186
193
|
}
|
|
194
|
+
__convertTypeToVariantAndColor() {
|
|
195
|
+
if (this.type === 'primary') {
|
|
196
|
+
this.color = 'primary';
|
|
197
|
+
this.variant = 'filled';
|
|
198
|
+
}
|
|
199
|
+
else if (this.type === 'secondary') {
|
|
200
|
+
this.color = 'surface';
|
|
201
|
+
this.variant = 'filled';
|
|
202
|
+
}
|
|
203
|
+
else if (this.type === 'tertiary') {
|
|
204
|
+
this.color = 'primary';
|
|
205
|
+
this.variant = 'text';
|
|
206
|
+
}
|
|
207
|
+
else if (this.type === 'danger') {
|
|
208
|
+
this.color = 'danger';
|
|
209
|
+
this.variant = 'filled';
|
|
210
|
+
}
|
|
211
|
+
}
|
|
187
212
|
render() {
|
|
188
213
|
const isLink = this.__isLink();
|
|
189
214
|
const cssClasses = {
|
|
@@ -200,17 +225,15 @@ class IconButton extends BaseButton {
|
|
|
200
225
|
return b `<button
|
|
201
226
|
class=${e(cssClasses)}
|
|
202
227
|
id="button"
|
|
203
|
-
tabindex=${__classPrivateFieldGet(this, _IconButton_tabindex, "f")}
|
|
204
228
|
type=${this.htmlType}
|
|
205
229
|
@click=${this.__dispatchClickWithThrottle}
|
|
206
230
|
@mousedown=${this.__handlePress}
|
|
207
231
|
@keydown=${this.__handlePress}
|
|
208
232
|
@keyup=${this.__handlePress}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
aria-disabled=${`${this.disabled || this.softDisabled}`}
|
|
233
|
+
|
|
234
|
+
aria-describedby=${o(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}
|
|
235
|
+
?aria-disabled=${this.softDisabled}
|
|
236
|
+
|
|
214
237
|
?disabled=${this.disabled}
|
|
215
238
|
${spread(this.configAria)}
|
|
216
239
|
>
|
|
@@ -221,18 +244,18 @@ class IconButton extends BaseButton {
|
|
|
221
244
|
return b `<a
|
|
222
245
|
class=${e(cssClasses)}
|
|
223
246
|
id="button"
|
|
224
|
-
tabindex=${__classPrivateFieldGet(this, _IconButton_tabindex, "f")}
|
|
225
247
|
href=${this.href}
|
|
226
248
|
target=${this.target}
|
|
227
|
-
|
|
249
|
+
tabindex=${this.disabled ? '-1' : '0'}
|
|
250
|
+
@click=${this.__dispatchClick}
|
|
228
251
|
@mousedown=${this.__handlePress}
|
|
229
252
|
@keydown=${this.__handlePress}
|
|
230
253
|
@keyup=${this.__handlePress}
|
|
231
254
|
role="button"
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
255
|
+
|
|
256
|
+
aria-describedby=${o(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}
|
|
257
|
+
?aria-disabled=${this.softDisabled}
|
|
258
|
+
|
|
236
259
|
${spread(this.configAria)}
|
|
237
260
|
>
|
|
238
261
|
${this.renderButtonContent()}
|
|
@@ -241,7 +264,7 @@ class IconButton extends BaseButton {
|
|
|
241
264
|
}
|
|
242
265
|
renderButtonContent() {
|
|
243
266
|
return b `
|
|
244
|
-
<wc-focus-ring class="focus-ring"
|
|
267
|
+
<wc-focus-ring class="focus-ring" for='button'></wc-focus-ring>
|
|
245
268
|
<wc-elevation class="elevation"></wc-elevation>
|
|
246
269
|
<div class="neo-background"></div>
|
|
247
270
|
<div class="background"></div>
|
|
@@ -250,28 +273,29 @@ class IconButton extends BaseButton {
|
|
|
250
273
|
<wc-skeleton class="skeleton"></wc-skeleton>
|
|
251
274
|
|
|
252
275
|
<div class="button-content">
|
|
253
|
-
<
|
|
254
|
-
name=${this.name}
|
|
255
|
-
src=${this.src}
|
|
256
|
-
provider=${this.provider}
|
|
257
|
-
></wc-icon>
|
|
276
|
+
<slot></slot>
|
|
258
277
|
</div>
|
|
259
278
|
|
|
260
|
-
${this.__renderDisabledReason()}
|
|
279
|
+
${this.__renderDisabledReason(this.softDisabled)}
|
|
261
280
|
`;
|
|
262
281
|
}
|
|
263
282
|
}
|
|
264
|
-
_IconButton_id = new WeakMap(), _IconButton_tabindex = new WeakMap();
|
|
265
283
|
IconButton.styles = [css_248z$2, css_248z$3, css_248z];
|
|
266
284
|
__decorate([
|
|
267
|
-
n({
|
|
268
|
-
], IconButton.prototype, "
|
|
269
|
-
__decorate([
|
|
270
|
-
n({ type: String, reflect: true })
|
|
271
|
-
], IconButton.prototype, "src", void 0);
|
|
285
|
+
n({ reflect: true })
|
|
286
|
+
], IconButton.prototype, "size", void 0);
|
|
272
287
|
__decorate([
|
|
273
288
|
n({ type: String })
|
|
274
|
-
], IconButton.prototype, "
|
|
289
|
+
], IconButton.prototype, "type", void 0);
|
|
290
|
+
__decorate([
|
|
291
|
+
n()
|
|
292
|
+
], IconButton.prototype, "variant", void 0);
|
|
293
|
+
__decorate([
|
|
294
|
+
n({ reflect: true })
|
|
295
|
+
], IconButton.prototype, "color", void 0);
|
|
296
|
+
__decorate([
|
|
297
|
+
n({ reflect: true })
|
|
298
|
+
], IconButton.prototype, "configAria", void 0);
|
|
275
299
|
|
|
276
300
|
/**
|
|
277
301
|
* @label Button Group
|
|
@@ -283,8 +307,8 @@ __decorate([
|
|
|
283
307
|
* @example
|
|
284
308
|
* ```html
|
|
285
309
|
* <wc-button-group variant="connected">
|
|
286
|
-
* <wc-icon-button name="home"
|
|
287
|
-
* <wc-icon-button name="alarm"
|
|
310
|
+
* <wc-icon-button toggle selected><wc-icon name="home"></wc-icon></wc-icon-button>
|
|
311
|
+
* <wc-icon-button toggle><wc-icon name="alarm"></wc-icon></wc-icon-button>
|
|
288
312
|
* </wc-button-group>
|
|
289
313
|
* ```
|
|
290
314
|
*
|
|
@@ -437,4 +461,4 @@ ButtonGroup = __decorate([
|
|
|
437
461
|
], ButtonGroup);
|
|
438
462
|
|
|
439
463
|
export { ButtonGroup as B, IconButton as I };
|
|
440
|
-
//# sourceMappingURL=button-group-
|
|
464
|
+
//# sourceMappingURL=button-group-CEdMwvJJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-group-CEdMwvJJ.js","sources":["../../src/button/icon-button/icon-button.ts","../../src/button/button-group/button-group.ts"],"sourcesContent":["import { html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport styles from '../button/button.scss';\nimport colorStyles from '../button/button-colors.scss';\nimport sizeStyles from './icon-button-sizes.scss';\nimport { spread } from '@/__directive/spread.js';\nimport { throttle } from '@/__utils/throttle.js';\nimport { BaseButton } from '../BaseButton.js';\n\n/**\n * @label Icon Button\n * @tag wc-icon-button\n * @rawTag icon-button\n *\n * @summary Icon buttons allow users to take actions, and make choices, with a single tap.\n *\n * @overview\n * <p>Icon 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. IconButton labels express what action will occur when the user interacts with it.</p>\n *\n * @cssprop --button-container-shape: Defines the border radius of the button container shape.\n *\n * @cssprop --button-container-shape-start-start: Defines the start position of the button container shape.\n * @cssprop --button-container-shape-start-end: Defines the end position of the button container shape.\n * @cssprop --button-container-shape-end-start: Defines the start position of the button container shape.\n * @cssprop --button-container-shape-end-end: Defines the end position of the button container shape.\n *\n *\n * @cssprop --filled-button-container-color: Color of the filled button container.\n * @cssprop --filled-button-label-text-color: Text color of the filled button label.\n *\n * @cssprop --outlined-button-container-color: Color of the outlined button container.\n * @cssprop --outlined-button-label-text-color: Text color of the outlined button label.\n *\n * @cssprop --text-button-label-text-color: Text color of the text button label.\n *\n * @cssprop --tonal-button-container-color: Color of the tonal button container.\n * @cssprop --tonal-button-label-text-color: Text color of the tonal button label.\n *\n * @cssprop --elevated-button-container-color: Color of the elevated button container.\n * @cssprop --elevated-button-label-text-color: Text color of the elevated button label.\n *\n * @cssprop --neo-button-container-color: Color of the neo button container.\n * @cssprop --neo-button-label-text-color: Text color of the neo button label.\n *\n * @fires {CustomEvent} button:click - Dispatched when the button is clicked.\n *\n * @example\n * ```html\n * <wc-icon-button><wc-icon name=\"home\"></wc-icon></wc-icon-button>\n * ```\n * @tags display\n */\nexport class IconButton extends BaseButton {\n static override styles = [styles, colorStyles, sizeStyles];\n\n /**\n * Button size.\n * Possible values are `\"xs\"`, `\"sm\"`, `\"md\"`, `\"lg\"`, `\"xl\"`. Defaults to `\"sm\"`.\n */\n @property({ reflect: true }) size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';\n\n /**\n * Type is preset of color and variant. Type will be only applied.\n *\n */\n @property({ type: String }) type?: 'primary' | 'secondary' | 'tertiary';\n \n /**\n * The visual style of the button.\n *\n * Possible variant values:\n * `\"filled\"` is a filled button.\n * `\"outlined\"` is an outlined button.\n * `\"text\"` is a transparent button.\n * `\"tonal\"` is a light color button.\n * `\"elevated\"` is elevated button\n */\n @property() variant:\n | 'elevated'\n | 'filled'\n | 'tonal'\n | 'outlined'\n | 'text'\n | 'neo' = 'filled';\n \n /**\n * Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.\n */\n @property({ reflect: true }) color:\n | 'primary'\n | 'success'\n | 'danger'\n | 'warning'\n | 'surface'\n | 'on-surface' = 'primary';\n\n /**\n * Additional ARIA attributes to pass to the inner button/anchor element.\n */\n @property({ reflect: true })\n configAria?: { [key: string]: any };\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n this.buttonElement?.blur();\n }\n \n override firstUpdated() {\n this.__dispatchClickWithThrottle = throttle(\n this.__dispatchClick,\n this.throttleDelay,\n );\n this.__convertTypeToVariantAndColor();\n }\n\n __convertTypeToVariantAndColor() {\n if (this.type === 'primary') {\n this.color = 'primary';\n this.variant = 'filled';\n } else if (this.type === 'secondary') {\n this.color = 'surface';\n this.variant = 'filled';\n } else if (this.type === 'tertiary') {\n this.color = 'primary';\n this.variant = 'text';\n } else if (this.type === 'danger') {\n this.color = 'danger';\n this.variant = 'filled';\n }\n }\n\n override render() {\n const isLink = this.__isLink();\n\n const cssClasses = {\n button: true,\n 'button-element': true,\n [`size-${this.size}`]: true,\n [`variant-${this.variant}`]: true,\n [`color-${this.color}`]: true,\n disabled: this.disabled || this.softDisabled,\n pressed: this.isPressed,\n skeleton: this.skeleton,\n };\n\n if (!isLink) {\n return html`<button\n class=${classMap(cssClasses)}\n id=\"button\"\n type=${this.htmlType}\n @click=${this.__dispatchClickWithThrottle}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n \n aria-describedby=${ifDefined(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}\n ?aria-disabled=${this.softDisabled}\n\n ?disabled=${this.disabled}\n ${spread(this.configAria)}\n >\n ${this.renderButtonContent()}\n </button>\n ${this.__renderTooltip()}`;\n }\n return html`<a\n class=${classMap(cssClasses)}\n id=\"button\"\n href=${this.href}\n target=${this.target}\n tabindex=${this.disabled ? '-1' : '0'}\n @click=${this.__dispatchClick}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n role=\"button\"\n \n aria-describedby=${ifDefined(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}\n ?aria-disabled=${this.softDisabled}\n\n ${spread(this.configAria)}\n >\n ${this.renderButtonContent()}\n </a>\n ${this.__renderTooltip()}`;\n }\n\n renderButtonContent() {\n return html`\n <wc-focus-ring class=\"focus-ring\" for='button'></wc-focus-ring>\n <wc-elevation class=\"elevation\"></wc-elevation>\n <div class=\"neo-background\"></div>\n <div class=\"background\"></div>\n <div class=\"outline\"></div>\n <wc-ripple class=\"ripple\"></wc-ripple>\n <wc-skeleton class=\"skeleton\"></wc-skeleton>\n\n <div class=\"button-content\">\n <slot></slot>\n </div>\n\n ${this.__renderDisabledReason(this.softDisabled)}\n `;\n }\n}\n","import { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport styles from './button-group.scss';\nimport { Button } from '../button/button.js';\nimport { IconButton } from '../icon-button/icon-button.js';\nimport { BaseButton } from '../BaseButton.js';\n\n/**\n * @label Button Group\n * @tag wc-button-group\n * @rawTag button-group\n *\n * @summary Group a series of buttons together on a single line with the button group, and super-power.\n\n * @example\n * ```html\n * <wc-button-group variant=\"connected\">\n * <wc-icon-button toggle selected><wc-icon name=\"home\"></wc-icon></wc-icon-button>\n * <wc-icon-button toggle><wc-icon name=\"alarm\"></wc-icon></wc-icon-button>\n * </wc-button-group>\n * ```\n *\n * @tags controls\n */\n@IndividualComponent\nexport class ButtonGroup extends LitElement {\n // Lit prefers CSS-in-JS for better performance and scoping.\n // If you prefer keeping the SCSS file, you'll need a build tool (like Vite or Webpack)\n // that can import .scss files as lit-css.\n static styles = [styles];\n\n static Button = Button;\n\n static IconButton = IconButton;\n\n /**\n * Button size.\n * Possible values are `\"sm\"`, `\"md\"`, `\"lg\"`. Defaults to `\"md\"`.\n */\n @property() size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';\n\n /**\n * Layout variant of the button group.\n * `\"standard\"` shows buttons with a small gap between them.\n * `\"connected\"` places buttons with a 2px gap; in horizontal orientation outer buttons have fully\n * rounded outer corners and middle buttons keep standard rounded corners. In vertical orientation\n * all buttons keep their default corner shape.\n * Defaults to `\"standard\"`.\n */\n @property({ reflect: true }) variant: 'standard' | 'connected' = 'standard';\n\n /**\n * Orientation of the button group.\n * `\"horizontal\"` lays buttons out in a row.\n * `\"vertical\"` stacks buttons in a column.\n * Defaults to `\"horizontal\"`.\n */\n @property({ reflect: true }) orientation: 'horizontal' | 'vertical' = 'horizontal';\n\n /**\n * Color applied to all buttons in the group.\n * Possible values are `\"primary\"`, `\"success\"`, `\"danger\"`, `\"warning\"`, `\"surface\"`, `\"on-surface\"`.\n */\n @property({ reflect: true }) color?: 'primary' | 'success' | 'danger' | 'warning' | 'surface' | 'on-surface';\n\n /**\n * Visual style applied to all buttons in the group.\n * Possible values are `\"filled\"`, `\"tonal\"`, `\"outlined\"`.\n */\n @property({ attribute: 'button-variant', reflect: true }) buttonVariant?: 'filled' | 'tonal' | 'outlined';\n\n override updated() {\n this._syncChildren();\n }\n\n private _getSlottedElements(): HTMLElement[] {\n const slot = this.shadowRoot?.querySelector('slot');\n return (slot?.assignedElements({ flatten: true }) ?? []) as HTMLElement[];\n }\n\n private _syncChildren() {\n const children = this._getSlottedElements();\n const isVertical = this.orientation === 'vertical';\n\n children.forEach((child, index) => {\n const isFirst = index === 0;\n const isLast = index === children.length - 1;\n const isOnly = children.length === 1;\n\n if (this.color && 'color' in child) {\n (child as BaseButton).color = this.color;\n }\n\n if (this.buttonVariant && 'variant' in child) {\n (child as BaseButton).variant = this.buttonVariant;\n }\n\n if (this.variant === 'connected') {\n child.style.setProperty('--button-container-shape-variant', 'round');\n\n if (isOnly) {\n child.style.setProperty('--button-container-shape', 'var(--shape-corner-full)');\n child.style.removeProperty('--button-container-shape-start-start');\n child.style.removeProperty('--button-container-shape-end-start');\n child.style.removeProperty('--button-container-shape-start-end');\n child.style.removeProperty('--button-container-shape-end-end');\n } else if (isFirst) {\n child.style.removeProperty('--button-container-shape');\n if (isVertical) {\n // Top button in vertical group: leave default corner shape\n child.style.removeProperty('--button-container-shape-start-start');\n child.style.removeProperty('--button-container-shape-start-end');\n child.style.removeProperty('--button-container-shape-end-start');\n child.style.removeProperty('--button-container-shape-end-end');\n } else {\n // Left button in horizontal group: round left corners, standard right corners\n child.style.setProperty('--button-container-shape-start-start', 'calc(var(--button-height) / 2)');\n child.style.setProperty('--button-container-shape-end-start', 'calc(var(--button-height) / 2)');\n child.style.setProperty('--button-container-shape-start-end', 'var(--shape-corner-medium)');\n child.style.setProperty('--button-container-shape-end-end', 'var(--shape-corner-medium)');\n }\n } else if (isLast) {\n child.style.removeProperty('--button-container-shape');\n if (isVertical) {\n // Bottom button in vertical group: leave default corner shape\n child.style.removeProperty('--button-container-shape-start-start');\n child.style.removeProperty('--button-container-shape-start-end');\n child.style.removeProperty('--button-container-shape-end-start');\n child.style.removeProperty('--button-container-shape-end-end');\n } else {\n // Right button in horizontal group: standard left corners, round right corners\n child.style.setProperty('--button-container-shape-start-start', 'var(--shape-corner-medium)');\n child.style.setProperty('--button-container-shape-end-start', 'var(--shape-corner-medium)');\n child.style.setProperty('--button-container-shape-start-end', 'calc(var(--button-height) / 2)');\n child.style.setProperty('--button-container-shape-end-end', 'calc(var(--button-height) / 2)');\n }\n } else {\n // Middle buttons: standard rounded corners on all sides\n child.style.setProperty('--button-container-shape', 'var(--shape-corner-medium)');\n child.style.removeProperty('--button-container-shape-start-start');\n child.style.removeProperty('--button-container-shape-end-start');\n child.style.removeProperty('--button-container-shape-start-end');\n child.style.removeProperty('--button-container-shape-end-end');\n }\n } else {\n child.style.removeProperty('--button-container-shape');\n child.style.removeProperty('--button-container-shape-start-start');\n child.style.removeProperty('--button-container-shape-end-start');\n child.style.removeProperty('--button-container-shape-start-end');\n child.style.removeProperty('--button-container-shape-end-end');\n child.style.removeProperty('--button-container-shape-variant');\n }\n });\n }\n\n render() {\n const cssClasses = {\n 'button-group': true,\n [`size-${this.size}`]: true,\n [`variant-${this.variant}`]: true,\n [`orientation-${this.orientation}`]: true,\n };\n return html`\n <div class=${classMap(cssClasses)}>\n <slot @slotchange=${() => this._syncChildren()}></slot>\n </div>\n `;\n }\n}\n"],"names":["html","classMap","ifDefined","styles","colorStyles","sizeStyles","property","LitElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CG;AACG,MAAO,UAAW,SAAQ,UAAU,CAAA;AAA1C,IAAA,WAAA,GAAA;;AAGE;;;AAGG;QAC0B,IAAA,CAAA,IAAI,GAAqC,IAAI;AAQxE;;;;;;;;;AASG;QACS,IAAA,CAAA,OAAO,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AE,OAAO,EAAE,IAAI,EAAE;AAAkD,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AA5C/F,WAAW,GAAA,UAAA,CAAA;IADvB;AACY,CAAA,EAAA,WAAW,CA+IvB;;;;"}
|
package/dist/button-group.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import './IndividualComponent-DUINtMGK.js';
|
|
2
2
|
import './property-1psGvXOq.js';
|
|
3
|
-
import './class-map-
|
|
4
|
-
export { B as ButtonGroup } from './button-group-
|
|
5
|
-
import './button-
|
|
6
|
-
import './directive-
|
|
7
|
-
import './
|
|
3
|
+
import './class-map-YU7g0o3B.js';
|
|
4
|
+
export { B as ButtonGroup } from './button-group-CEdMwvJJ.js';
|
|
5
|
+
import './button-DouvOfEU.js';
|
|
6
|
+
import './directive-ZPhl09Yt.js';
|
|
7
|
+
import './BaseButton-DuASuVth.js';
|
|
8
8
|
import './state-DwbEjqVk.js';
|
|
9
9
|
import './query-QBcUV-L_.js';
|
|
10
|
+
import './dispatch-event-utils-CuEqjlPT.js';
|
|
11
|
+
import './BaseHyperlinkMixin-BNuwbiEf.js';
|
|
12
|
+
import './observe-slot-change-BGJfgg2E.js';
|
|
10
13
|
//# sourceMappingURL=button-group.js.map
|
package/dist/button-group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"button-group.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
package/dist/button.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import './IndividualComponent-DUINtMGK.js';
|
|
2
2
|
import './property-1psGvXOq.js';
|
|
3
3
|
import './state-DwbEjqVk.js';
|
|
4
|
-
import './class-map-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import './
|
|
4
|
+
import './class-map-YU7g0o3B.js';
|
|
5
|
+
import './BaseButton-DuASuVth.js';
|
|
6
|
+
export { B as Button } from './button-DouvOfEU.js';
|
|
7
|
+
import './observe-slot-change-BGJfgg2E.js';
|
|
8
|
+
import './BaseHyperlinkMixin-BNuwbiEf.js';
|
|
9
|
+
import './directive-ZPhl09Yt.js';
|
|
8
10
|
import './query-QBcUV-L_.js';
|
|
11
|
+
import './dispatch-event-utils-CuEqjlPT.js';
|
|
9
12
|
//# sourceMappingURL=button.js.map
|
package/dist/button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"button.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
package/dist/card.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { a as i,
|
|
1
|
+
import { a as i, i as i$1, A, c as __classPrivateFieldGet, b, _ as __decorate, I as IndividualComponent } from './IndividualComponent-DUINtMGK.js';
|
|
2
2
|
import { n } from './property-1psGvXOq.js';
|
|
3
3
|
import { r } from './state-DwbEjqVk.js';
|
|
4
|
-
import { e } from './query-QBcUV-L_.js';
|
|
5
|
-
import { e
|
|
6
|
-
import { i as isActivationClick, d as dispatchActivationClick
|
|
7
|
-
import './
|
|
4
|
+
import { e as e$1 } from './query-QBcUV-L_.js';
|
|
5
|
+
import { e } from './class-map-YU7g0o3B.js';
|
|
6
|
+
import { i as isActivationClick, d as dispatchActivationClick } from './dispatch-event-utils-CuEqjlPT.js';
|
|
7
|
+
import { o as observerSlotChangesWithCallback } from './observe-slot-change-BGJfgg2E.js';
|
|
8
|
+
import { B as BaseHyperlinkMixin, t as throttle } from './BaseHyperlinkMixin-BNuwbiEf.js';
|
|
9
|
+
import './directive-ZPhl09Yt.js';
|
|
8
10
|
|
|
9
11
|
var css_248z$1 = i`* {
|
|
10
12
|
box-sizing: border-box;
|
|
@@ -227,7 +229,7 @@ var css_248z = i`:host {
|
|
|
227
229
|
--outlined-card-label-text-color: var(--color-on-surface);
|
|
228
230
|
}`;
|
|
229
231
|
|
|
230
|
-
var _Card_id, _Card_tabindex
|
|
232
|
+
var _Card_id, _Card_tabindex;
|
|
231
233
|
/**
|
|
232
234
|
* @label Card
|
|
233
235
|
* @tag wc-card
|
|
@@ -245,7 +247,7 @@ var _Card_id, _Card_tabindex, _Card_slottedTabIndexMap;
|
|
|
245
247
|
* </wc-card>
|
|
246
248
|
* ```
|
|
247
249
|
*/
|
|
248
|
-
let Card = class Card extends i$1 {
|
|
250
|
+
let Card = class Card extends BaseHyperlinkMixin(i$1) {
|
|
249
251
|
constructor() {
|
|
250
252
|
super(...arguments);
|
|
251
253
|
_Card_id.set(this, crypto.randomUUID());
|
|
@@ -256,10 +258,6 @@ let Card = class Card extends i$1 {
|
|
|
256
258
|
* If button is disabled, the reason why it is disabled.
|
|
257
259
|
*/
|
|
258
260
|
this.disabledReason = '';
|
|
259
|
-
/**
|
|
260
|
-
* Sets or retrieves the window or frame at which to target content.
|
|
261
|
-
*/
|
|
262
|
-
this.target = '_self';
|
|
263
261
|
/**
|
|
264
262
|
* Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
|
|
265
263
|
*/
|
|
@@ -270,7 +268,6 @@ let Card = class Card extends i$1 {
|
|
|
270
268
|
this.isPressed = false;
|
|
271
269
|
this.slotHasContent = false;
|
|
272
270
|
_Card_tabindex.set(this, 0);
|
|
273
|
-
_Card_slottedTabIndexMap.set(this, new WeakMap());
|
|
274
271
|
this.__dispatchClickWithThrottle = event => {
|
|
275
272
|
this.__dispatchClick(event);
|
|
276
273
|
};
|
|
@@ -309,49 +306,8 @@ let Card = class Card extends i$1 {
|
|
|
309
306
|
this.__dispatchClickWithThrottle = throttle(this.__dispatchClick, this.throttleDelay);
|
|
310
307
|
observerSlotChangesWithCallback(this.renderRoot.querySelector('slot'), hasContent => {
|
|
311
308
|
this.slotHasContent = hasContent;
|
|
312
|
-
this.__syncSlottedChildrenTabIndex();
|
|
313
309
|
this.requestUpdate();
|
|
314
310
|
});
|
|
315
|
-
this.__syncSlottedChildrenTabIndex();
|
|
316
|
-
}
|
|
317
|
-
updated(changedProperties) {
|
|
318
|
-
if (changedProperties.has('actionable') || changedProperties.has('href')) {
|
|
319
|
-
this.__syncSlottedChildrenTabIndex();
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
__syncSlottedChildrenTabIndex() {
|
|
323
|
-
if (!this.contentSlot)
|
|
324
|
-
return;
|
|
325
|
-
const shouldDisableTabbing = this.actionable || this.__isLink();
|
|
326
|
-
const assignedChildren = this.contentSlot.assignedElements({ flatten: true });
|
|
327
|
-
assignedChildren.forEach(node => {
|
|
328
|
-
if (!(node instanceof HTMLElement))
|
|
329
|
-
return;
|
|
330
|
-
if (shouldDisableTabbing) {
|
|
331
|
-
if (!__classPrivateFieldGet(this, _Card_slottedTabIndexMap, "f").has(node)) {
|
|
332
|
-
__classPrivateFieldGet(this, _Card_slottedTabIndexMap, "f").set(node, node.getAttribute('tabindex'));
|
|
333
|
-
}
|
|
334
|
-
if (node.getAttribute('tabindex') !== '-1') {
|
|
335
|
-
node.setAttribute('tabindex', '-1');
|
|
336
|
-
}
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
const originalTabIndex = __classPrivateFieldGet(this, _Card_slottedTabIndexMap, "f").get(node);
|
|
340
|
-
if (originalTabIndex === null) {
|
|
341
|
-
if (node.hasAttribute('tabindex')) {
|
|
342
|
-
node.removeAttribute('tabindex');
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
else if (originalTabIndex !== undefined) {
|
|
346
|
-
if (node.getAttribute('tabindex') !== originalTabIndex) {
|
|
347
|
-
node.setAttribute('tabindex', originalTabIndex);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
__classPrivateFieldGet(this, _Card_slottedTabIndexMap, "f").delete(node);
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
__isLink() {
|
|
354
|
-
return !!this.href;
|
|
355
311
|
}
|
|
356
312
|
__getDisabledReasonID() {
|
|
357
313
|
return this.disabled && this.disabledReason
|
|
@@ -373,6 +329,7 @@ let Card = class Card extends i$1 {
|
|
|
373
329
|
}
|
|
374
330
|
render() {
|
|
375
331
|
const isLink = this.__isLink();
|
|
332
|
+
const disableSlotTabbing = this.actionable || isLink;
|
|
376
333
|
const cssClasses = {
|
|
377
334
|
card: true,
|
|
378
335
|
'card-element': true,
|
|
@@ -382,10 +339,18 @@ let Card = class Card extends i$1 {
|
|
|
382
339
|
pressed: this.isPressed,
|
|
383
340
|
'has-content': this.slotHasContent,
|
|
384
341
|
};
|
|
342
|
+
if (!this.actionable && !isLink) {
|
|
343
|
+
return b `<div
|
|
344
|
+
class=${e(cssClasses)}
|
|
345
|
+
id="card"
|
|
346
|
+
>
|
|
347
|
+
${this.renderCardContent(disableSlotTabbing)}
|
|
348
|
+
</div>`;
|
|
349
|
+
}
|
|
385
350
|
if (!isLink) {
|
|
386
351
|
return b `<button
|
|
387
|
-
class=${e
|
|
388
|
-
id="
|
|
352
|
+
class=${e(cssClasses)}
|
|
353
|
+
id="card"
|
|
389
354
|
tabindex=${__classPrivateFieldGet(this, _Card_tabindex, "f")}
|
|
390
355
|
@click=${this.__dispatchClickWithThrottle}
|
|
391
356
|
@mousedown=${this.__handlePress}
|
|
@@ -395,12 +360,12 @@ let Card = class Card extends i$1 {
|
|
|
395
360
|
aria-disabled=${`${this.disabled}`}
|
|
396
361
|
?disabled=${this.disabled}
|
|
397
362
|
>
|
|
398
|
-
${this.renderCardContent()}
|
|
363
|
+
${this.renderCardContent(disableSlotTabbing)}
|
|
399
364
|
</button>`;
|
|
400
365
|
}
|
|
401
366
|
return b `<a
|
|
402
|
-
class=${e
|
|
403
|
-
id="
|
|
367
|
+
class=${e(cssClasses)}
|
|
368
|
+
id="card"
|
|
404
369
|
tabindex=${__classPrivateFieldGet(this, _Card_tabindex, "f")}
|
|
405
370
|
href=${this.href}
|
|
406
371
|
target=${this.target}
|
|
@@ -412,12 +377,12 @@ let Card = class Card extends i$1 {
|
|
|
412
377
|
?aria-describedby=${this.__getDisabledReasonID()}
|
|
413
378
|
aria-disabled=${`${this.disabled}`}
|
|
414
379
|
>
|
|
415
|
-
${this.renderCardContent()}
|
|
380
|
+
${this.renderCardContent(disableSlotTabbing)}
|
|
416
381
|
</a>`;
|
|
417
382
|
}
|
|
418
|
-
renderCardContent() {
|
|
383
|
+
renderCardContent(disableSlotTabbing) {
|
|
419
384
|
return b `
|
|
420
|
-
|
|
385
|
+
<wc-focus-ring class="focus-ring" for='card'></wc-focus-ring>
|
|
421
386
|
<wc-elevation class="elevation"></wc-elevation>
|
|
422
387
|
<div class="background"></div>
|
|
423
388
|
<div class="outline"></div>
|
|
@@ -425,8 +390,8 @@ let Card = class Card extends i$1 {
|
|
|
425
390
|
|
|
426
391
|
<div class="card-content">
|
|
427
392
|
|
|
428
|
-
<div class="slot-container">
|
|
429
|
-
<slot
|
|
393
|
+
<div class="slot-container" ?inert=${disableSlotTabbing}>
|
|
394
|
+
<slot></slot>
|
|
430
395
|
</div>
|
|
431
396
|
|
|
432
397
|
</div>
|
|
@@ -435,7 +400,6 @@ let Card = class Card extends i$1 {
|
|
|
435
400
|
};
|
|
436
401
|
_Card_id = new WeakMap();
|
|
437
402
|
_Card_tabindex = new WeakMap();
|
|
438
|
-
_Card_slottedTabIndexMap = new WeakMap();
|
|
439
403
|
Card.styles = [css_248z$1, css_248z];
|
|
440
404
|
__decorate([
|
|
441
405
|
n({ type: String, reflect: true })
|
|
@@ -449,12 +413,6 @@ __decorate([
|
|
|
449
413
|
__decorate([
|
|
450
414
|
n({ attribute: 'disabled-reason' })
|
|
451
415
|
], Card.prototype, "disabledReason", void 0);
|
|
452
|
-
__decorate([
|
|
453
|
-
n({ reflect: true })
|
|
454
|
-
], Card.prototype, "href", void 0);
|
|
455
|
-
__decorate([
|
|
456
|
-
n()
|
|
457
|
-
], Card.prototype, "target", void 0);
|
|
458
416
|
__decorate([
|
|
459
417
|
n()
|
|
460
418
|
], Card.prototype, "throttleDelay", void 0);
|
|
@@ -465,11 +423,8 @@ __decorate([
|
|
|
465
423
|
r()
|
|
466
424
|
], Card.prototype, "slotHasContent", void 0);
|
|
467
425
|
__decorate([
|
|
468
|
-
e('.card')
|
|
426
|
+
e$1('.card')
|
|
469
427
|
], Card.prototype, "cardElement", void 0);
|
|
470
|
-
__decorate([
|
|
471
|
-
e('slot')
|
|
472
|
-
], Card.prototype, "contentSlot", void 0);
|
|
473
428
|
Card = __decorate([
|
|
474
429
|
IndividualComponent
|
|
475
430
|
], Card);
|
package/dist/card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","sources":["../../src/card/card.ts"],"sourcesContent":["import { LitElement, html, nothing, PropertyValues } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { dispatchActivationClick, isActivationClick } from '../utils/dispatch-event-utils.js';\nimport { observerSlotChangesWithCallback, throttle } from '../utils.js';\nimport IndividualComponent from '../IndividualComponent.js';\nimport styles from './card.scss';\nimport colorStyles from './card-colors.scss';\n\ntype CardVariant = 'elevated' | 'filled' | 'outlined';\n\n/**\n * @label Card\n * @tag wc-card\n * @rawTag card\n * @summary A Material 3 inspired card surface for grouping related content.\n * @cssprop --card-padding - Inner padding for the card container. Defaults to 1rem.\n * @cssprop --card-shape - Corner radius for the card container. Defaults to a large radius.\n * @cssprop --card-gap - Gap between slotted children.\n *\n * @example\n * ```html\n * <wc-card variant=\"outlined\">\n * <h3>Title</h3>\n * <p>Supportive text</p>\n * </wc-card>\n * ```\n */\n@IndividualComponent\nexport class Card extends LitElement {\n static styles = [styles, colorStyles];\n\n #id = crypto.randomUUID();\n \n @property({ type: String, reflect: true })\n variant: CardVariant = 'elevated';\n\n @property({type: Boolean, reflect: true})\n disabled: boolean = false;\n\n @property({ type: Boolean, reflect: true })\n actionable: boolean = false;\n\n /**\n * If button is disabled, the reason why it is disabled.\n */\n @property({ attribute: 'disabled-reason' })\n disabledReason: string = '';\n\n /**\n * Hyperlink to navigate to on click.\n */\n @property({ reflect: true }) href?: string;\n\n /**\n * Sets or retrieves the window or frame at which to target content.\n */\n @property() target: string = '_self';\n\n\n /**\n * Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.\n */\n @property() throttleDelay = 200;\n\n /**\n * States\n */\n @state()\n isPressed = false;\n\n @state()\n private slotHasContent = false;\n\n\n @query('.card') readonly cardElement!: HTMLElement | null;\n\n @query('slot') readonly contentSlot!: HTMLSlotElement | null;\n\n #tabindex?: number = 0;\n\n #slottedTabIndexMap = new WeakMap<HTMLElement, string | null>();\n\n override firstUpdated() {\n this.__dispatchClickWithThrottle = throttle(\n this.__dispatchClick,\n this.throttleDelay,\n );\n observerSlotChangesWithCallback(\n this.renderRoot.querySelector('slot'),\n hasContent => {\n this.slotHasContent = hasContent;\n this.__syncSlottedChildrenTabIndex();\n this.requestUpdate();\n },\n );\n this.__syncSlottedChildrenTabIndex();\n }\n\n override updated(changedProperties: PropertyValues<this>) {\n if (changedProperties.has('actionable') || changedProperties.has('href')) {\n this.__syncSlottedChildrenTabIndex();\n }\n }\n\n __syncSlottedChildrenTabIndex() {\n if (!this.contentSlot) return;\n\n const shouldDisableTabbing = this.actionable || this.__isLink();\n const assignedChildren = this.contentSlot.assignedElements({ flatten: true });\n\n assignedChildren.forEach(node => {\n if (!(node instanceof HTMLElement)) return;\n\n if (shouldDisableTabbing) {\n if (!this.#slottedTabIndexMap.has(node)) {\n this.#slottedTabIndexMap.set(node, node.getAttribute('tabindex'));\n }\n\n if (node.getAttribute('tabindex') !== '-1') {\n node.setAttribute('tabindex', '-1');\n }\n return;\n }\n\n const originalTabIndex = this.#slottedTabIndexMap.get(node);\n if (originalTabIndex === null) {\n if (node.hasAttribute('tabindex')) {\n node.removeAttribute('tabindex');\n }\n } else if (originalTabIndex !== undefined) {\n if (node.getAttribute('tabindex') !== originalTabIndex) {\n node.setAttribute('tabindex', originalTabIndex);\n }\n }\n\n this.#slottedTabIndexMap.delete(node);\n });\n }\n\n __dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =\n event => {\n this.__dispatchClick(event);\n };\n\n __dispatchClick = (event: MouseEvent | KeyboardEvent) => {\n // If the button is soft-disabled or a disabled link, we need to explicitly\n // prevent the click from propagating to other event listeners as well as\n // prevent the default action.\n if (this.disabled && this.href) {\n event.stopImmediatePropagation();\n event.preventDefault();\n return;\n }\n \n if (!isActivationClick(event) || !this.cardElement) {\n return;\n }\n \n this.focus();\n dispatchActivationClick(this.cardElement);\n };\n\n __isLink() {\n return !!this.href;\n }\n\n __getDisabledReasonID() {\n return this.disabled && this.disabledReason\n ? `disabled-reason-${this.#id}`\n : nothing;\n }\n\n __renderDisabledReason() {\n const disabledReasonID = this.__getDisabledReasonID();\n if (disabledReasonID)\n return html`<div\n id=\"disabled-reason-${this.#id}\"\n role=\"tooltip\"\n aria-label=${this.disabledReason}\n class=\"screen-reader-only\"\n >\n ${this.disabledReason}\n </div>`;\n return nothing;\n }\n\n __handlePress = (event: KeyboardEvent | MouseEvent) => {\n if (this.disabled) return;\n if (\n event instanceof KeyboardEvent &&\n event.type === 'keydown' &&\n (event.key === 'Enter' || event.key === ' ')\n ) {\n this.isPressed = true;\n } else if (event.type === 'mousedown') {\n this.isPressed = true;\n } else {\n this.isPressed = false;\n }\n };\n\n\n \n\n render() {\n\n const isLink = this.__isLink();\n\n const cssClasses = {\n card: true,\n 'card-element': true,\n [`variant-${this.variant}`]: true,\n actionable: (this.actionable && !this.disabled) || isLink,\n disabled: this.disabled,\n pressed: this.isPressed,\n 'has-content': this.slotHasContent,\n };\n\n if (!isLink) {\n return html`<button\n class=${classMap(cssClasses)}\n id=\"button\"\n tabindex=${this.#tabindex}\n @click=${this.__dispatchClickWithThrottle}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n ?aria-describedby=${this.__getDisabledReasonID()}\n aria-disabled=${`${this.disabled}`}\n ?disabled=${this.disabled}\n >\n ${this.renderCardContent()}\n </button>`;\n }\n return html`<a\n class=${classMap(cssClasses)}\n id=\"button\"\n tabindex=${this.#tabindex}\n href=${this.href}\n target=${this.target}\n @click=${this.__dispatchClickWithThrottle}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n role=\"button\"\n ?aria-describedby=${this.__getDisabledReasonID()}\n aria-disabled=${`${this.disabled}`}\n >\n ${this.renderCardContent()}\n </a>`;\n }\n\n renderCardContent() {\n return html`\n <wc-focus-ring class=\"focus-ring\" .control=${this} .forElement=${this.cardElement}></wc-focus-ring>\n <wc-elevation class=\"elevation\"></wc-elevation>\n <div class=\"background\"></div>\n <div class=\"outline\"></div>\n <wc-ripple class=\"ripple\"></wc-ripple> \n\n <div class=\"card-content\">\n\n <div class=\"slot-container\">\n <slot @slotchange=${this.__syncSlottedChildrenTabIndex}></slot>\n </div>\n\n </div>\n `;\n }\n}\n"],"names":["LitElement","nothing","html","classMap","styles","colorStyles","property","state","query"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA;;;;;;;;;;;;;;;;AAgBG;AAEI,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQA,GAAU,CAAA;AAA7B,IAAA,WAAA,GAAA;;AAGJ,QAAA,QAAA,CAAA,GAAA,CAAA,IAAA,EAAM,MAAM,CAAC,UAAU,EAAE,CAAA;QAG1B,IAAA,CAAA,OAAO,GAAgB,UAAU;QAGjC,IAAA,CAAA,QAAQ,GAAY,KAAK;QAGzB,IAAA,CAAA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AAA,MAAA,CAAA;AAKC,UAAA,CAAA;AAA5B,IAAAA,CAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AAAgB,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAK/B,UAAA,CAAA;AAAX,IAAAA,CAAQ;AAA4B,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAMzB,UAAA,CAAA;AAAX,IAAAA,CAAQ;AAAuB,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAMhC,UAAA,CAAA;AADC,IAAAC,CAAK;AACY,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAGV,UAAA,CAAA;AADP,IAAAA,CAAK;AACyB,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AAGN,UAAA,CAAA;IAAxBC,CAAK,CAAC,OAAO;AAA4C,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AAElC,UAAA,CAAA;IAAvBA,CAAK,CAAC,MAAM;AAAgD,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AAhDlD,IAAI,GAAA,UAAA,CAAA;IADhB;AACY,CAAA,EAAA,IAAI,CAiPhB;;;;"}
|
|
1
|
+
{"version":3,"file":"card.js","sources":["../../src/card/card.ts"],"sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { dispatchActivationClick, isActivationClick } from '../__utils/dispatch-event-utils.js';\nimport { observerSlotChangesWithCallback } from '@/__utils/observe-slot-change.js';\nimport { throttle } from '@/__utils/throttle.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport styles from './card.scss';\nimport colorStyles from './card-colors.scss';\nimport BaseHyperlinkMixin from '@/__mixins/BaseHyperlinkMixin.js';\n\ntype CardVariant = 'elevated' | 'filled' | 'outlined';\n\n/**\n * @label Card\n * @tag wc-card\n * @rawTag card\n * @summary A Material 3 inspired card surface for grouping related content.\n * @cssprop --card-padding - Inner padding for the card container. Defaults to 1rem.\n * @cssprop --card-shape - Corner radius for the card container. Defaults to a large radius.\n * @cssprop --card-gap - Gap between slotted children.\n *\n * @example\n * ```html\n * <wc-card variant=\"outlined\">\n * <h3>Title</h3>\n * <p>Supportive text</p>\n * </wc-card>\n * ```\n */\n@IndividualComponent\nexport class Card extends BaseHyperlinkMixin(LitElement) {\n static styles = [styles, colorStyles];\n\n #id = crypto.randomUUID();\n\n @property({ type: String, reflect: true })\n variant: CardVariant = 'elevated';\n\n @property({ type: Boolean, reflect: true })\n disabled: boolean = false;\n\n @property({ type: Boolean, reflect: true })\n actionable: boolean = false;\n\n /**\n * If button is disabled, the reason why it is disabled.\n */\n @property({ attribute: 'disabled-reason' })\n disabledReason: string = '';\n\n /**\n * Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.\n */\n @property() throttleDelay = 200;\n\n /**\n * States\n */\n @state()\n isPressed = false;\n\n @state()\n private slotHasContent = false;\n\n\n @query('.card') readonly cardElement!: HTMLElement | null;\n\n #tabindex?: number = 0;\n\n override firstUpdated() {\n this.__dispatchClickWithThrottle = throttle(\n this.__dispatchClick,\n this.throttleDelay,\n );\n observerSlotChangesWithCallback(\n this.renderRoot.querySelector('slot'),\n hasContent => {\n this.slotHasContent = hasContent;\n this.requestUpdate();\n },\n );\n }\n\n __dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =\n event => {\n this.__dispatchClick(event);\n };\n\n __dispatchClick = (event: MouseEvent | KeyboardEvent) => {\n // If the button is soft-disabled or a disabled link, we need to explicitly\n // prevent the click from propagating to other event listeners as well as\n // prevent the default action.\n if (this.disabled && this.href) {\n event.stopImmediatePropagation();\n event.preventDefault();\n return;\n }\n\n if (!isActivationClick(event) || !this.cardElement) {\n return;\n }\n\n this.focus();\n dispatchActivationClick(this.cardElement);\n };\n\n __getDisabledReasonID() {\n return this.disabled && this.disabledReason\n ? `disabled-reason-${this.#id}`\n : nothing;\n }\n\n __renderDisabledReason() {\n const disabledReasonID = this.__getDisabledReasonID();\n if (disabledReasonID)\n return html`<div\n id=\"disabled-reason-${this.#id}\"\n role=\"tooltip\"\n aria-label=${this.disabledReason}\n class=\"screen-reader-only\"\n >\n ${this.disabledReason}\n </div>`;\n return nothing;\n }\n\n __handlePress = (event: KeyboardEvent | MouseEvent) => {\n if (this.disabled) return;\n if (\n event instanceof KeyboardEvent &&\n event.type === 'keydown' &&\n (event.key === 'Enter' || event.key === ' ')\n ) {\n this.isPressed = true;\n } else if (event.type === 'mousedown') {\n this.isPressed = true;\n } else {\n this.isPressed = false;\n }\n };\n\n\n\n\n render() {\n\n const isLink = this.__isLink();\n const disableSlotTabbing = this.actionable || isLink;\n\n const cssClasses = {\n card: true,\n 'card-element': true,\n [`variant-${this.variant}`]: true,\n actionable: (this.actionable && !this.disabled) || isLink,\n disabled: this.disabled,\n pressed: this.isPressed,\n 'has-content': this.slotHasContent,\n };\n\n if (!this.actionable && !isLink) {\n return html`<div\n class=${classMap(cssClasses)}\n id=\"card\"\n >\n ${this.renderCardContent(disableSlotTabbing)}\n </div>`;\n }\n\n if (!isLink) {\n return html`<button\n class=${classMap(cssClasses)}\n id=\"card\"\n tabindex=${this.#tabindex}\n @click=${this.__dispatchClickWithThrottle}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n ?aria-describedby=${this.__getDisabledReasonID()}\n aria-disabled=${`${this.disabled}`}\n ?disabled=${this.disabled}\n >\n ${this.renderCardContent(disableSlotTabbing)}\n </button>`;\n }\n return html`<a\n class=${classMap(cssClasses)}\n id=\"card\"\n tabindex=${this.#tabindex}\n href=${this.href}\n target=${this.target}\n @click=${this.__dispatchClickWithThrottle}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n role=\"button\"\n ?aria-describedby=${this.__getDisabledReasonID()}\n aria-disabled=${`${this.disabled}`}\n >\n ${this.renderCardContent(disableSlotTabbing)}\n </a>`;\n }\n\n renderCardContent(disableSlotTabbing: boolean) {\n return html`\n <wc-focus-ring class=\"focus-ring\" for='card'></wc-focus-ring>\n <wc-elevation class=\"elevation\"></wc-elevation>\n <div class=\"background\"></div>\n <div class=\"outline\"></div>\n <wc-ripple class=\"ripple\"></wc-ripple> \n\n <div class=\"card-content\">\n\n <div class=\"slot-container\" ?inert=${disableSlotTabbing}>\n <slot></slot>\n </div>\n\n </div>\n `;\n }\n}\n"],"names":["LitElement","nothing","html","classMap","styles","colorStyles","property","state","query"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;;;;;;;;;;;;;;;;AAgBG;AAEI,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,kBAAkB,CAACA,GAAU,CAAC,CAAA;AAAjD,IAAA,WAAA,GAAA;;AAGL,QAAA,QAAA,CAAA,GAAA,CAAA,IAAA,EAAM,MAAM,CAAC,UAAU,EAAE,CAAA;QAGzB,IAAA,CAAA,OAAO,GAAgB,UAAU;QAGjC,IAAA,CAAA,QAAQ,GAAY,KAAK;QAGzB,IAAA,CAAA,UAAU,GAAY,KAAK;AAE3B;;AAEE;QAEF,IAAA,CAAA,cAAc,GAAW,EAAE;AAE3B;;AAEG;QACS,IAAA,CAAA,aAAa,GAAG,GAAG;AAE/B;;AAEG;QAEH,IAAA,CAAA,SAAS,GAAG,KAAK;QAGT,IAAA,CAAA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;;;"}
|
package/dist/chart-bar.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { _ as __decorate, I as IndividualComponent, i, b } from './IndividualComponent-DUINtMGK.js';
|
|
2
2
|
import { n } from './property-1psGvXOq.js';
|
|
3
3
|
import { e } from './query-QBcUV-L_.js';
|
|
4
|
-
import { o } from './style-map-
|
|
4
|
+
import { o } from './style-map-DVmWOuYy.js';
|
|
5
5
|
import { o as ordinal, s as select } from './transform-DSwFSqzD.js';
|
|
6
6
|
import { c as css_248z, b as band, m as max, l as linear, a as axisLeft, d as axisBottom } from './chart-bar-cn6rrna-.js';
|
|
7
|
-
import './directive-
|
|
7
|
+
import './directive-ZPhl09Yt.js';
|
|
8
8
|
|
|
9
9
|
const chartColors = [];
|
|
10
10
|
['purple', 'blue', 'red', 'green', 'yellow', 'orange'].forEach(colorName => {
|