@francofantomius/material-components 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/README.md +277 -83
- package/custom-elements.json +21010 -2354
- package/dist/chunks/badge-G4EjcMoy.js +89 -0
- package/dist/chunks/badge-G4EjcMoy.js.map +1 -0
- package/dist/chunks/button-B4TSZ7Sl.js +250 -0
- package/dist/chunks/button-B4TSZ7Sl.js.map +1 -0
- package/dist/chunks/card-DVffdPpv.js +163 -0
- package/dist/chunks/card-DVffdPpv.js.map +1 -0
- package/dist/chunks/checkbox-BqlboAHd.js +194 -0
- package/dist/chunks/checkbox-BqlboAHd.js.map +1 -0
- package/dist/chunks/chip-CI1ZINnr.js +169 -0
- package/dist/chunks/chip-CI1ZINnr.js.map +1 -0
- package/dist/chunks/code-C5UFBkCh.js +1830 -0
- package/dist/chunks/code-C5UFBkCh.js.map +1 -0
- package/dist/chunks/decorate-DXuynaiA.js +39 -0
- package/dist/chunks/decorate-DXuynaiA.js.map +1 -0
- package/dist/chunks/dialog-DGVEE5m_.js +158 -0
- package/dist/chunks/dialog-DGVEE5m_.js.map +1 -0
- package/dist/chunks/divider-DNepwoZv.js +82 -0
- package/dist/chunks/divider-DNepwoZv.js.map +1 -0
- package/dist/chunks/fab-C9j3WBHE.js +150 -0
- package/dist/chunks/fab-C9j3WBHE.js.map +1 -0
- package/dist/chunks/focus-ring-CuiJuM-y.js +71 -0
- package/dist/chunks/focus-ring-CuiJuM-y.js.map +1 -0
- package/dist/chunks/{form-associated-fKbeX_2P.js → form-associated-Cty_ZaS9.js} +26 -27
- package/dist/chunks/form-associated-Cty_ZaS9.js.map +1 -0
- package/dist/chunks/icon-DrNqcNEL.js +62 -0
- package/dist/chunks/icon-DrNqcNEL.js.map +1 -0
- package/dist/chunks/icon-button-BdSc7eot.js +188 -0
- package/dist/chunks/icon-button-BdSc7eot.js.map +1 -0
- package/dist/chunks/list-D8olR7oZ.js +204 -0
- package/dist/chunks/list-D8olR7oZ.js.map +1 -0
- package/dist/chunks/navigation-drawer-CKl44Ef5.js +531 -0
- package/dist/chunks/navigation-drawer-CKl44Ef5.js.map +1 -0
- package/dist/chunks/player-C4ydiIpr.js +1582 -0
- package/dist/chunks/player-C4ydiIpr.js.map +1 -0
- package/dist/chunks/progress-LQmLMDjX.js +266 -0
- package/dist/chunks/progress-LQmLMDjX.js.map +1 -0
- package/dist/chunks/radio-Bily78NT.js +205 -0
- package/dist/chunks/radio-Bily78NT.js.map +1 -0
- package/dist/chunks/ripple-squbKHhj.js +135 -0
- package/dist/chunks/ripple-squbKHhj.js.map +1 -0
- package/dist/chunks/search-bar-TXnqJ-gd.js +698 -0
- package/dist/chunks/search-bar-TXnqJ-gd.js.map +1 -0
- package/dist/chunks/snackbar-Wsz3BzEY.js +161 -0
- package/dist/chunks/snackbar-Wsz3BzEY.js.map +1 -0
- package/dist/chunks/switch-DdukrvXb.js +190 -0
- package/dist/chunks/switch-DdukrvXb.js.map +1 -0
- package/dist/chunks/table-aRTYzDyE.js +773 -0
- package/dist/chunks/table-aRTYzDyE.js.map +1 -0
- package/dist/chunks/tabs-BfOtoeir.js +191 -0
- package/dist/chunks/tabs-BfOtoeir.js.map +1 -0
- package/dist/chunks/text-field-hN6-2HQy.js +338 -0
- package/dist/chunks/text-field-hN6-2HQy.js.map +1 -0
- package/dist/chunks/top-app-bar-Dgbp6CFv.js +228 -0
- package/dist/chunks/top-app-bar-Dgbp6CFv.js.map +1 -0
- package/dist/components/account-menu/account-menu.css.d.ts +3 -0
- package/dist/components/account-menu/account-menu.css.d.ts.map +1 -0
- package/dist/components/account-menu/account-menu.d.ts +111 -0
- package/dist/components/account-menu/account-menu.d.ts.map +1 -0
- package/dist/components/app-drawer/app-drawer.css.d.ts +3 -0
- package/dist/components/app-drawer/app-drawer.css.d.ts.map +1 -0
- package/dist/components/app-drawer/app-drawer.d.ts +173 -0
- package/dist/components/app-drawer/app-drawer.d.ts.map +1 -0
- package/dist/components/badge/badge.js +2 -91
- package/dist/components/button/button.js +2 -261
- package/dist/components/card/card.js +2 -167
- package/dist/components/checkbox/checkbox.css.d.ts.map +1 -1
- package/dist/components/checkbox/checkbox.js +2 -186
- package/dist/components/chip/chip.js +3 -172
- package/dist/components/code/code.css.d.ts +2 -0
- package/dist/components/code/code.css.d.ts.map +1 -0
- package/dist/components/code/code.d.ts +106 -0
- package/dist/components/code/code.d.ts.map +1 -0
- package/dist/components/code/code.js +5 -0
- package/dist/components/code/highlighter.d.ts +8 -0
- package/dist/components/code/highlighter.d.ts.map +1 -0
- package/dist/components/code/linter.d.ts +44 -0
- package/dist/components/code/linter.d.ts.map +1 -0
- package/dist/components/dialog/dialog.js +2 -165
- package/dist/components/divider/divider.js +2 -79
- package/dist/components/fab/fab.js +2 -153
- package/dist/components/icon/icon.js +2 -68
- package/dist/components/icon-button/icon-button.css.d.ts.map +1 -1
- package/dist/components/icon-button/icon-button.js +1 -189
- package/dist/components/list/list.css.d.ts.map +1 -1
- package/dist/components/list/list.d.ts.map +1 -1
- package/dist/components/list/list.js +3 -188
- package/dist/components/navigation-drawer/navigation-drawer.css.d.ts +3 -0
- package/dist/components/navigation-drawer/navigation-drawer.css.d.ts.map +1 -0
- package/dist/components/navigation-drawer/navigation-drawer.d.ts +76 -0
- package/dist/components/navigation-drawer/navigation-drawer.d.ts.map +1 -0
- package/dist/components/navigation-drawer/navigation-drawer.js +8 -0
- package/dist/components/player/player.css.d.ts +2 -0
- package/dist/components/player/player.css.d.ts.map +1 -0
- package/dist/components/player/player.d.ts +99 -0
- package/dist/components/player/player.d.ts.map +1 -0
- package/dist/components/player/player.js +7 -0
- package/dist/components/progress/progress.css.d.ts.map +1 -1
- package/dist/components/progress/progress.d.ts +2 -0
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/progress/progress.js +3 -181
- package/dist/components/radio/radio.css.d.ts.map +1 -1
- package/dist/components/radio/radio.js +3 -203
- package/dist/components/search-bar/search-bar.css.d.ts +2 -0
- package/dist/components/search-bar/search-bar.css.d.ts.map +1 -0
- package/dist/components/search-bar/search-bar.d.ts +81 -0
- package/dist/components/search-bar/search-bar.d.ts.map +1 -0
- package/dist/components/search-bar/search-bar.js +5 -0
- package/dist/components/snackbar/snackbar.js +2 -162
- package/dist/components/switch/switch.css.d.ts.map +1 -1
- package/dist/components/switch/switch.js +2 -169
- package/dist/components/table/table.css.d.ts +8 -0
- package/dist/components/table/table.css.d.ts.map +1 -0
- package/dist/components/table/table.d.ts +158 -0
- package/dist/components/table/table.d.ts.map +1 -0
- package/dist/components/table/table.js +13 -0
- package/dist/components/tabs/tabs.js +3 -198
- package/dist/components/text-field/text-field.css.d.ts.map +1 -1
- package/dist/components/text-field/text-field.d.ts +1 -1
- package/dist/components/text-field/text-field.d.ts.map +1 -1
- package/dist/components/text-field/text-field.js +2 -325
- package/dist/components/top-app-bar/top-app-bar.css.d.ts +2 -0
- package/dist/components/top-app-bar/top-app-bar.css.d.ts.map +1 -0
- package/dist/components/top-app-bar/top-app-bar.d.ts +29 -0
- package/dist/components/top-app-bar/top-app-bar.d.ts.map +1 -0
- package/dist/components/top-app-bar/top-app-bar.js +5 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2264 -58
- package/dist/index.js.map +1 -1
- package/dist/internal/focus-ring/focus-ring.d.ts.map +1 -1
- package/dist/internal/focus-ring/focus-ring.js +4 -0
- package/dist/internal/ripple/ripple.css.d.ts.map +1 -1
- package/dist/internal/ripple/ripple.d.ts +0 -3
- package/dist/internal/ripple/ripple.d.ts.map +1 -1
- package/dist/internal/ripple/ripple.js +2 -142
- package/dist/tokens/index.js +336 -11
- package/dist/tokens/index.js.map +1 -1
- package/package.json +118 -12
- package/dist/chunks/base-component-DQTjlEVL.js +0 -34
- package/dist/chunks/base-component-DQTjlEVL.js.map +0 -1
- package/dist/chunks/focus-ring-Dl-XoEKK.js +0 -71
- package/dist/chunks/focus-ring-Dl-XoEKK.js.map +0 -1
- package/dist/chunks/form-associated-fKbeX_2P.js.map +0 -1
- package/dist/chunks/theme.css-DV3DRha-.js +0 -263
- package/dist/chunks/theme.css-DV3DRha-.js.map +0 -1
- package/dist/components/badge/badge.js.map +0 -1
- package/dist/components/button/button.js.map +0 -1
- package/dist/components/card/card.js.map +0 -1
- package/dist/components/checkbox/checkbox.js.map +0 -1
- package/dist/components/chip/chip.js.map +0 -1
- package/dist/components/dialog/dialog.js.map +0 -1
- package/dist/components/divider/divider.js.map +0 -1
- package/dist/components/fab/fab.js.map +0 -1
- package/dist/components/icon/icon.js.map +0 -1
- package/dist/components/icon-button/icon-button.js.map +0 -1
- package/dist/components/list/list.js.map +0 -1
- package/dist/components/progress/progress.js.map +0 -1
- package/dist/components/radio/radio.js.map +0 -1
- package/dist/components/snackbar/snackbar.js.map +0 -1
- package/dist/components/switch/switch.js.map +0 -1
- package/dist/components/tabs/tabs.js.map +0 -1
- package/dist/components/text-field/text-field.js.map +0 -1
- package/dist/internal/ripple/ripple.js.map +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { n as s, t } from "./decorate-DXuynaiA.js";
|
|
2
|
+
import { css as i, html as a, nothing as n } from "lit";
|
|
3
|
+
import { customElement as l, property as o, queryAssignedElements as d } from "lit/decorators.js";
|
|
4
|
+
var h = i`
|
|
5
|
+
:host {
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
position: relative;
|
|
8
|
+
vertical-align: middle;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.badge {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
background-color: var(--md-sys-color-error, #B3261E);
|
|
17
|
+
color: var(--md-sys-color-on-error, #FFFFFF);
|
|
18
|
+
font-family: var(--md-sys-typescale-font-family, inherit);
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
line-height: 1;
|
|
21
|
+
white-space: nowrap;
|
|
22
|
+
user-select: none;
|
|
23
|
+
border-radius: var(--md-sys-shape-corner-full, 9999px);
|
|
24
|
+
transition: transform 150ms cubic-bezier(0.2, 0, 0, 1),
|
|
25
|
+
opacity 150ms cubic-bezier(0.2, 0, 0, 1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Small Dot Badge */
|
|
29
|
+
:host(:not([value])) .badge,
|
|
30
|
+
:host([dot]) .badge {
|
|
31
|
+
width: 6px;
|
|
32
|
+
height: 6px;
|
|
33
|
+
padding: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Large Badge with text */
|
|
37
|
+
:host([value]:not([dot])) .badge {
|
|
38
|
+
min-width: 16px;
|
|
39
|
+
height: 16px;
|
|
40
|
+
padding: 0 4px;
|
|
41
|
+
font-size: 11px;
|
|
42
|
+
letter-spacing: 0.5px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Anchored Positioning over slotted element */
|
|
46
|
+
:host([anchored]) .badge {
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 0;
|
|
49
|
+
right: 0;
|
|
50
|
+
transform: translate(50%, -50%);
|
|
51
|
+
z-index: 10;
|
|
52
|
+
}
|
|
53
|
+
`, e = class extends s {
|
|
54
|
+
constructor(...r) {
|
|
55
|
+
super(...r), this.value = "", this.dot = !1, this.anchored = !1, this.handleSlotChange = () => {
|
|
56
|
+
this.anchored = this.assignedChildren.length > 0;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
static {
|
|
60
|
+
this.styles = [s.styles, h];
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
return a`
|
|
64
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
65
|
+
<span class="badge">
|
|
66
|
+
${!this.dot && this.value ? this.value : n}
|
|
67
|
+
</span>
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
t([o({
|
|
72
|
+
type: String,
|
|
73
|
+
reflect: !0
|
|
74
|
+
})], e.prototype, "value", void 0);
|
|
75
|
+
t([o({
|
|
76
|
+
type: Boolean,
|
|
77
|
+
reflect: !0
|
|
78
|
+
})], e.prototype, "dot", void 0);
|
|
79
|
+
t([o({
|
|
80
|
+
type: Boolean,
|
|
81
|
+
reflect: !0
|
|
82
|
+
})], e.prototype, "anchored", void 0);
|
|
83
|
+
t([d()], e.prototype, "assignedChildren", void 0);
|
|
84
|
+
e = t([l("md-badge")], e);
|
|
85
|
+
export {
|
|
86
|
+
e as t
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=badge-G4EjcMoy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge-G4EjcMoy.js","names":[],"sources":["../../src/components/badge/badge.css.ts","../../src/components/badge/badge.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const badgeStyles = css`\n :host {\n display: inline-flex;\n position: relative;\n vertical-align: middle;\n }\n\n .badge {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background-color: var(--md-sys-color-error, #B3261E);\n color: var(--md-sys-color-on-error, #FFFFFF);\n font-family: var(--md-sys-typescale-font-family, inherit);\n font-weight: 500;\n line-height: 1;\n white-space: nowrap;\n user-select: none;\n border-radius: var(--md-sys-shape-corner-full, 9999px);\n transition: transform 150ms cubic-bezier(0.2, 0, 0, 1),\n opacity 150ms cubic-bezier(0.2, 0, 0, 1);\n }\n\n /* Small Dot Badge */\n :host(:not([value])) .badge,\n :host([dot]) .badge {\n width: 6px;\n height: 6px;\n padding: 0;\n }\n\n /* Large Badge with text */\n :host([value]:not([dot])) .badge {\n min-width: 16px;\n height: 16px;\n padding: 0 4px;\n font-size: 11px;\n letter-spacing: 0.5px;\n }\n\n /* Anchored Positioning over slotted element */\n :host([anchored]) .badge {\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n z-index: 10;\n }\n`;\n\n","import { html, nothing } from 'lit';\nimport { customElement, property, queryAssignedElements } from 'lit/decorators.js';\nimport { MdBaseElement } from '../../internal/base-component.js';\nimport { badgeStyles } from './badge.css.js';\n\n@customElement('md-badge')\nexport class MdBadge extends MdBaseElement {\n static override styles = [MdBaseElement.styles, badgeStyles];\n\n @property({ type: String, reflect: true })\n value = '';\n\n @property({ type: Boolean, reflect: true })\n dot = false;\n\n @property({ type: Boolean, reflect: true })\n anchored = false;\n\n @queryAssignedElements()\n private assignedChildren!: HTMLElement[];\n\n private handleSlotChange = () => {\n this.anchored = this.assignedChildren.length > 0;\n };\n\n override render() {\n return html`\n <slot @slotchange=${this.handleSlotChange}></slot>\n <span class=\"badge\">\n ${!this.dot && this.value ? this.value : nothing}\n </span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-badge': MdBadge;\n }\n}\n\n"],"mappings":";;;AAEA,IAAa,IAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GCId,IAAN,cAAsB,EAAc;AAAA;iBAIjC,KAAA,QAAA,IAGF,KAAA,MAAA,IAGK,KAAA,WAAA,IAKsB,KAAA,mBAAA,MAAA;AAC/B,WAAK,WAAW,KAAK,iBAAiB,SAAS;AAAA,IACjD;AAAA;;AAhByB,SAAA,SAAA,CAAC,EAAc,QAAQ,CAAW;AAAA;EAkB3D,SAAkB;AAChB,WAAO;AAAA,0BACe,KAAK,gBAAA;AAAA;AAAA,UAErB,CAAC,KAAK,OAAO,KAAK,QAAQ,KAAK,QAAQ,CAAA;AAAA;AAAA;AAAA,EAG/C;AACF;AAxBG,EAAA,CAAA,EAAS;AAAA,EAAE,MAAM;AAAA,EAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,MAAA;AAGxC,EAAA,CAAA,EAAS;AAAA,EAAE,MAAM;AAAA,EAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,OAAA,MAAA;AAGzC,EAAA,CAAA,EAAS;AAAA,EAAE,MAAM;AAAA,EAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,MAAA;AAGzC,EAAA,CAAA,EAAsB,CAAA,GAAA,EAAA,WAAA,oBAAA,MAAA;AAbxB,IAAA,EAAA,CAAA,EAAc,UAAU,CAAA,GAAA,CAAA"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { n as l, t as o } from "./decorate-DXuynaiA.js";
|
|
2
|
+
import "./ripple-squbKHhj.js";
|
|
3
|
+
import "./focus-ring-CuiJuM-y.js";
|
|
4
|
+
import "./icon-DrNqcNEL.js";
|
|
5
|
+
import { css as h, html as e, nothing as n } from "lit";
|
|
6
|
+
import { customElement as c, property as i, queryAssignedElements as d } from "lit/decorators.js";
|
|
7
|
+
var p = h`
|
|
8
|
+
:host {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
outline: none;
|
|
11
|
+
vertical-align: middle;
|
|
12
|
+
-webkit-tap-highlight-color: transparent;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host([disabled]) {
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
button, a {
|
|
20
|
+
position: relative;
|
|
21
|
+
display: inline-flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
min-width: 64px;
|
|
26
|
+
height: 40px;
|
|
27
|
+
padding: 0 24px;
|
|
28
|
+
border: none;
|
|
29
|
+
border-radius: var(--md-sys-shape-corner-full, 9999px);
|
|
30
|
+
font-family: var(--md-sys-typescale-font-family, inherit);
|
|
31
|
+
font-size: var(--md-sys-typescale-label-large-size, 14px);
|
|
32
|
+
font-weight: 500;
|
|
33
|
+
line-height: 20px;
|
|
34
|
+
letter-spacing: 0.1px;
|
|
35
|
+
text-decoration: none;
|
|
36
|
+
text-align: center;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
user-select: none;
|
|
39
|
+
outline: none;
|
|
40
|
+
transition: box-shadow 200ms cubic-bezier(0.2, 0, 0, 1),
|
|
41
|
+
background-color 200ms cubic-bezier(0.2, 0, 0, 1),
|
|
42
|
+
color 200ms cubic-bezier(0.2, 0, 0, 1);
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:host([has-icon]) button,
|
|
47
|
+
:host([has-icon]) a {
|
|
48
|
+
padding-left: 16px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host([has-trailing-icon]) button,
|
|
52
|
+
:host([has-trailing-icon]) a {
|
|
53
|
+
padding-right: 16px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* --- Filled (Default) --- */
|
|
57
|
+
:host(:not([variant])) button,
|
|
58
|
+
:host(:not([variant])) a,
|
|
59
|
+
:host([variant="filled"]) button,
|
|
60
|
+
:host([variant="filled"]) a {
|
|
61
|
+
background-color: var(--md-sys-color-primary, #6750a4);
|
|
62
|
+
color: var(--md-sys-color-on-primary, #ffffff);
|
|
63
|
+
box-shadow: var(--md-sys-elevation-level0, none);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
:host([variant="filled"]:hover) button,
|
|
67
|
+
:host([variant="filled"]:hover) a,
|
|
68
|
+
:host(:not([variant]):hover) button,
|
|
69
|
+
:host(:not([variant]):hover) a {
|
|
70
|
+
box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0,0,0,0.15));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* --- Elevated --- */
|
|
74
|
+
:host([variant="elevated"]) button,
|
|
75
|
+
:host([variant="elevated"]) a {
|
|
76
|
+
background-color: var(--md-sys-color-surface-container-low, #f7f2fa);
|
|
77
|
+
color: var(--md-sys-color-primary, #6750a4);
|
|
78
|
+
box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0,0,0,0.15));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:host([variant="elevated"]:hover) button,
|
|
82
|
+
:host([variant="elevated"]:hover) a {
|
|
83
|
+
box-shadow: var(--md-sys-elevation-level2, 0px 2px 6px 2px rgba(0,0,0,0.15));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* --- Filled Tonal --- */
|
|
87
|
+
:host([variant="tonal"]) button,
|
|
88
|
+
:host([variant="tonal"]) a {
|
|
89
|
+
background-color: var(--md-sys-color-secondary-container, #e8def8);
|
|
90
|
+
color: var(--md-sys-color-on-secondary-container, #1d192b);
|
|
91
|
+
box-shadow: var(--md-sys-elevation-level0, none);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:host([variant="tonal"]:hover) button,
|
|
95
|
+
:host([variant="tonal"]:hover) a {
|
|
96
|
+
box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0,0,0,0.15));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* --- Outlined --- */
|
|
100
|
+
:host([variant="outlined"]) button,
|
|
101
|
+
:host([variant="outlined"]) a {
|
|
102
|
+
background-color: transparent;
|
|
103
|
+
color: var(--md-sys-color-primary, #6750a4);
|
|
104
|
+
border: 1px solid var(--md-sys-color-outline, #79747e);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* --- Text --- */
|
|
108
|
+
:host([variant="text"]) button,
|
|
109
|
+
:host([variant="text"]) a {
|
|
110
|
+
background-color: transparent;
|
|
111
|
+
color: var(--md-sys-color-primary, #6750a4);
|
|
112
|
+
padding: 0 12px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* --- Disabled --- */
|
|
116
|
+
:host([disabled]) button,
|
|
117
|
+
:host([disabled]) a {
|
|
118
|
+
cursor: not-allowed;
|
|
119
|
+
box-shadow: none;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:host([disabled]:not([variant="outlined"]):not([variant="text"])) button,
|
|
123
|
+
:host([disabled]:not([variant="outlined"]):not([variant="text"])) a {
|
|
124
|
+
background-color: rgba(29, 27, 32, 0.12);
|
|
125
|
+
color: rgba(29, 27, 32, 0.38);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
:host([disabled][variant="outlined"]) button,
|
|
129
|
+
:host([disabled][variant="outlined"]) a {
|
|
130
|
+
border-color: rgba(29, 27, 32, 0.12);
|
|
131
|
+
color: rgba(29, 27, 32, 0.38);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:host([disabled][variant="text"]) button,
|
|
135
|
+
:host([disabled][variant="text"]) a {
|
|
136
|
+
color: rgba(29, 27, 32, 0.38);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.content {
|
|
140
|
+
display: inline-flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
gap: 8px;
|
|
143
|
+
position: relative;
|
|
144
|
+
z-index: 1;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.spinner {
|
|
148
|
+
width: 18px;
|
|
149
|
+
height: 18px;
|
|
150
|
+
border: 2px solid currentColor;
|
|
151
|
+
border-top-color: transparent;
|
|
152
|
+
border-radius: 50%;
|
|
153
|
+
animation: md-spin 800ms linear infinite;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@keyframes md-spin {
|
|
157
|
+
to {
|
|
158
|
+
transform: rotate(360deg);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
`, t = class extends l {
|
|
162
|
+
constructor(...a) {
|
|
163
|
+
super(...a), this.variant = "filled", this.disabled = !1, this.loading = !1, this.type = "button", this.href = "", this.target = "", this.icon = "", this.trailingIcon = "", this.handleClick = (s) => {
|
|
164
|
+
if (this.disabled || this.loading) {
|
|
165
|
+
s.preventDefault(), s.stopImmediatePropagation();
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (this.type === "submit" || this.type === "reset") {
|
|
169
|
+
const r = this.closest("form");
|
|
170
|
+
r && (this.type === "submit" ? r.requestSubmit() : r.reset());
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
static {
|
|
175
|
+
this.styles = [l.styles, p];
|
|
176
|
+
}
|
|
177
|
+
handleSlotChange() {
|
|
178
|
+
const a = !!(this.icon || this.assignedIcons && this.assignedIcons.length > 0), s = !!(this.trailingIcon || this.assignedTrailingIcons && this.assignedTrailingIcons.length > 0);
|
|
179
|
+
this.toggleAttribute("has-icon", a), this.toggleAttribute("has-trailing-icon", s);
|
|
180
|
+
}
|
|
181
|
+
firstUpdated() {
|
|
182
|
+
this.handleSlotChange();
|
|
183
|
+
}
|
|
184
|
+
render() {
|
|
185
|
+
const a = e`
|
|
186
|
+
<md-ripple ?disabled=${this.disabled || this.loading}></md-ripple>
|
|
187
|
+
<md-focus-ring></md-focus-ring>
|
|
188
|
+
<span class="content">
|
|
189
|
+
${this.loading ? e`<span class="spinner" aria-hidden="true"></span>` : e`
|
|
190
|
+
<slot name="icon" @slotchange=${this.handleSlotChange}>
|
|
191
|
+
${this.icon ? e`<md-icon name=${this.icon}></md-icon>` : n}
|
|
192
|
+
</slot>
|
|
193
|
+
`}
|
|
194
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
195
|
+
${this.loading ? n : e`
|
|
196
|
+
<slot name="trailing-icon" @slotchange=${this.handleSlotChange}>
|
|
197
|
+
${this.trailingIcon ? e`<md-icon name=${this.trailingIcon}></md-icon>` : n}
|
|
198
|
+
</slot>
|
|
199
|
+
`}
|
|
200
|
+
</span>
|
|
201
|
+
`;
|
|
202
|
+
return this.href ? e`
|
|
203
|
+
<a
|
|
204
|
+
href=${this.disabled ? n : this.href}
|
|
205
|
+
target=${this.target || n}
|
|
206
|
+
aria-disabled=${this.disabled ? "true" : n}
|
|
207
|
+
tabindex=${this.disabled ? "-1" : "0"}
|
|
208
|
+
@click=${this.handleClick}
|
|
209
|
+
>
|
|
210
|
+
${a}
|
|
211
|
+
</a>
|
|
212
|
+
` : e`
|
|
213
|
+
<button
|
|
214
|
+
type=${this.type}
|
|
215
|
+
?disabled=${this.disabled || this.loading}
|
|
216
|
+
@click=${this.handleClick}
|
|
217
|
+
>
|
|
218
|
+
${a}
|
|
219
|
+
</button>
|
|
220
|
+
`;
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
o([i({
|
|
224
|
+
type: String,
|
|
225
|
+
reflect: !0
|
|
226
|
+
})], t.prototype, "variant", void 0);
|
|
227
|
+
o([i({
|
|
228
|
+
type: Boolean,
|
|
229
|
+
reflect: !0
|
|
230
|
+
})], t.prototype, "disabled", void 0);
|
|
231
|
+
o([i({
|
|
232
|
+
type: Boolean,
|
|
233
|
+
reflect: !0
|
|
234
|
+
})], t.prototype, "loading", void 0);
|
|
235
|
+
o([i({ type: String })], t.prototype, "type", void 0);
|
|
236
|
+
o([i({ type: String })], t.prototype, "href", void 0);
|
|
237
|
+
o([i({ type: String })], t.prototype, "target", void 0);
|
|
238
|
+
o([i({ type: String })], t.prototype, "icon", void 0);
|
|
239
|
+
o([i({
|
|
240
|
+
type: String,
|
|
241
|
+
attribute: "trailing-icon"
|
|
242
|
+
})], t.prototype, "trailingIcon", void 0);
|
|
243
|
+
o([d({ slot: "icon" })], t.prototype, "assignedIcons", void 0);
|
|
244
|
+
o([d({ slot: "trailing-icon" })], t.prototype, "assignedTrailingIcons", void 0);
|
|
245
|
+
t = o([c("md-button")], t);
|
|
246
|
+
export {
|
|
247
|
+
t
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
//# sourceMappingURL=button-B4TSZ7Sl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-B4TSZ7Sl.js","names":[],"sources":["../../src/components/button/button.css.ts","../../src/components/button/button.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const buttonStyles = css`\n :host {\n display: inline-flex;\n outline: none;\n vertical-align: middle;\n -webkit-tap-highlight-color: transparent;\n }\n\n :host([disabled]) {\n pointer-events: none;\n }\n\n button, a {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n min-width: 64px;\n height: 40px;\n padding: 0 24px;\n border: none;\n border-radius: var(--md-sys-shape-corner-full, 9999px);\n font-family: var(--md-sys-typescale-font-family, inherit);\n font-size: var(--md-sys-typescale-label-large-size, 14px);\n font-weight: 500;\n line-height: 20px;\n letter-spacing: 0.1px;\n text-decoration: none;\n text-align: center;\n cursor: pointer;\n user-select: none;\n outline: none;\n transition: box-shadow 200ms cubic-bezier(0.2, 0, 0, 1),\n background-color 200ms cubic-bezier(0.2, 0, 0, 1),\n color 200ms cubic-bezier(0.2, 0, 0, 1);\n overflow: hidden;\n }\n\n :host([has-icon]) button,\n :host([has-icon]) a {\n padding-left: 16px;\n }\n\n :host([has-trailing-icon]) button,\n :host([has-trailing-icon]) a {\n padding-right: 16px;\n }\n\n /* --- Filled (Default) --- */\n :host(:not([variant])) button,\n :host(:not([variant])) a,\n :host([variant=\"filled\"]) button,\n :host([variant=\"filled\"]) a {\n background-color: var(--md-sys-color-primary, #6750a4);\n color: var(--md-sys-color-on-primary, #ffffff);\n box-shadow: var(--md-sys-elevation-level0, none);\n }\n\n :host([variant=\"filled\"]:hover) button,\n :host([variant=\"filled\"]:hover) a,\n :host(:not([variant]):hover) button,\n :host(:not([variant]):hover) a {\n box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0,0,0,0.15));\n }\n\n /* --- Elevated --- */\n :host([variant=\"elevated\"]) button,\n :host([variant=\"elevated\"]) a {\n background-color: var(--md-sys-color-surface-container-low, #f7f2fa);\n color: var(--md-sys-color-primary, #6750a4);\n box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0,0,0,0.15));\n }\n\n :host([variant=\"elevated\"]:hover) button,\n :host([variant=\"elevated\"]:hover) a {\n box-shadow: var(--md-sys-elevation-level2, 0px 2px 6px 2px rgba(0,0,0,0.15));\n }\n\n /* --- Filled Tonal --- */\n :host([variant=\"tonal\"]) button,\n :host([variant=\"tonal\"]) a {\n background-color: var(--md-sys-color-secondary-container, #e8def8);\n color: var(--md-sys-color-on-secondary-container, #1d192b);\n box-shadow: var(--md-sys-elevation-level0, none);\n }\n\n :host([variant=\"tonal\"]:hover) button,\n :host([variant=\"tonal\"]:hover) a {\n box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0,0,0,0.15));\n }\n\n /* --- Outlined --- */\n :host([variant=\"outlined\"]) button,\n :host([variant=\"outlined\"]) a {\n background-color: transparent;\n color: var(--md-sys-color-primary, #6750a4);\n border: 1px solid var(--md-sys-color-outline, #79747e);\n }\n\n /* --- Text --- */\n :host([variant=\"text\"]) button,\n :host([variant=\"text\"]) a {\n background-color: transparent;\n color: var(--md-sys-color-primary, #6750a4);\n padding: 0 12px;\n }\n\n /* --- Disabled --- */\n :host([disabled]) button,\n :host([disabled]) a {\n cursor: not-allowed;\n box-shadow: none;\n }\n\n :host([disabled]:not([variant=\"outlined\"]):not([variant=\"text\"])) button,\n :host([disabled]:not([variant=\"outlined\"]):not([variant=\"text\"])) a {\n background-color: rgba(29, 27, 32, 0.12);\n color: rgba(29, 27, 32, 0.38);\n }\n\n :host([disabled][variant=\"outlined\"]) button,\n :host([disabled][variant=\"outlined\"]) a {\n border-color: rgba(29, 27, 32, 0.12);\n color: rgba(29, 27, 32, 0.38);\n }\n\n :host([disabled][variant=\"text\"]) button,\n :host([disabled][variant=\"text\"]) a {\n color: rgba(29, 27, 32, 0.38);\n }\n\n .content {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n position: relative;\n z-index: 1;\n }\n\n .spinner {\n width: 18px;\n height: 18px;\n border: 2px solid currentColor;\n border-top-color: transparent;\n border-radius: 50%;\n animation: md-spin 800ms linear infinite;\n }\n\n @keyframes md-spin {\n to {\n transform: rotate(360deg);\n }\n }\n`;\n\n","import { html, nothing } from 'lit';\nimport { customElement, property, queryAssignedElements } from 'lit/decorators.js';\nimport { MdBaseElement } from '../../internal/base-component.js';\nimport '../../internal/ripple/ripple.js';\nimport '../../internal/focus-ring/focus-ring.js';\nimport '../icon/icon.js';\nimport { buttonStyles } from './button.css.js';\n\nexport type ButtonVariant = 'filled' | 'elevated' | 'tonal' | 'outlined' | 'text';\n\n@customElement('md-button')\nexport class MdButton extends MdBaseElement {\n static override styles = [MdBaseElement.styles, buttonStyles];\n\n @property({ type: String, reflect: true })\n variant: ButtonVariant = 'filled';\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: Boolean, reflect: true })\n loading = false;\n\n @property({ type: String })\n type: 'button' | 'submit' | 'reset' = 'button';\n\n @property({ type: String })\n href = '';\n\n @property({ type: String })\n target = '';\n\n @property({ type: String })\n icon = '';\n\n @property({ type: String, attribute: 'trailing-icon' })\n trailingIcon = '';\n\n @queryAssignedElements({ slot: 'icon' })\n private assignedIcons!: HTMLElement[];\n\n @queryAssignedElements({ slot: 'trailing-icon' })\n private assignedTrailingIcons!: HTMLElement[];\n\n private handleClick = (event: MouseEvent): void => {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n\n if (this.type === 'submit' || this.type === 'reset') {\n const form = this.closest('form');\n if (form) {\n if (this.type === 'submit') {\n form.requestSubmit();\n } else {\n form.reset();\n }\n }\n }\n };\n\n private handleSlotChange(): void {\n const hasLeading = Boolean(this.icon || (this.assignedIcons && this.assignedIcons.length > 0));\n const hasTrailing = Boolean(this.trailingIcon || (this.assignedTrailingIcons && this.assignedTrailingIcons.length > 0));\n\n this.toggleAttribute('has-icon', hasLeading);\n this.toggleAttribute('has-trailing-icon', hasTrailing);\n }\n\n override firstUpdated() {\n this.handleSlotChange();\n }\n\n override render() {\n const content = html`\n <md-ripple ?disabled=${this.disabled || this.loading}></md-ripple>\n <md-focus-ring></md-focus-ring>\n <span class=\"content\">\n ${this.loading\n ? html`<span class=\"spinner\" aria-hidden=\"true\"></span>`\n : html`\n <slot name=\"icon\" @slotchange=${this.handleSlotChange}>\n ${this.icon ? html`<md-icon name=${this.icon}></md-icon>` : nothing}\n </slot>\n `}\n <slot @slotchange=${this.handleSlotChange}></slot>\n ${!this.loading\n ? html`\n <slot name=\"trailing-icon\" @slotchange=${this.handleSlotChange}>\n ${this.trailingIcon ? html`<md-icon name=${this.trailingIcon}></md-icon>` : nothing}\n </slot>\n `\n : nothing}\n </span>\n `;\n\n if (this.href) {\n return html`\n <a\n href=${this.disabled ? nothing : this.href}\n target=${this.target || nothing}\n aria-disabled=${this.disabled ? 'true' : nothing}\n tabindex=${this.disabled ? '-1' : '0'}\n @click=${this.handleClick}\n >\n ${content}\n </a>\n `;\n }\n\n return html`\n <button\n type=${this.type}\n ?disabled=${this.disabled || this.loading}\n @click=${this.handleClick}\n >\n ${content}\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-button': MdButton;\n }\n}\n\n"],"mappings":";;;;;;AAEA,IAAa,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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GzB,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,MAAA;AAGzB,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,UAAA,MAAA;AAGzB,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,MAAA;AAGzB,EAAA,CAAA,EAAS;AAAA,EAAE,MAAM;AAAA,EAAQ,WAAW;AAAgB,CAAC,CAAA,GAAA,EAAA,WAAA,gBAAA,MAAA;AAGrD,EAAA,CAAA,EAAsB,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,iBAAA,MAAA;AAGtC,EAAA,CAAA,EAAsB,EAAE,MAAM,gBAAgB,CAAC,CAAA,GAAA,EAAA,WAAA,yBAAA,MAAA;AA/BjD,IAAA,EAAA,CAAA,EAAc,WAAW,CAAA,GAAA,CAAA"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { n as d, t as i } from "./decorate-DXuynaiA.js";
|
|
2
|
+
import "./ripple-squbKHhj.js";
|
|
3
|
+
import "./focus-ring-CuiJuM-y.js";
|
|
4
|
+
import { css as n, html as r, nothing as t } from "lit";
|
|
5
|
+
import { customElement as l, property as a } from "lit/decorators.js";
|
|
6
|
+
var c = n`
|
|
7
|
+
:host {
|
|
8
|
+
display: block;
|
|
9
|
+
border-radius: var(--md-sys-shape-corner-medium, 12px);
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
font-family: var(--md-sys-typescale-font-family, inherit);
|
|
12
|
+
position: relative;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
transition: box-shadow 200ms cubic-bezier(0.2, 0, 0, 1),
|
|
15
|
+
background-color 200ms cubic-bezier(0.2, 0, 0, 1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* --- Elevated (Default) --- */
|
|
19
|
+
:host(:not([variant])),
|
|
20
|
+
:host([variant="elevated"]) {
|
|
21
|
+
background-color: var(--md-sys-color-surface-container-low, #F7F2FA);
|
|
22
|
+
box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0,0,0,0.15));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host(:not([variant])[interactive]:hover),
|
|
26
|
+
:host([variant="elevated"][interactive]:hover) {
|
|
27
|
+
box-shadow: var(--md-sys-elevation-level2, 0px 2px 6px 2px rgba(0,0,0,0.15));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* --- Filled --- */
|
|
31
|
+
:host([variant="filled"]) {
|
|
32
|
+
background-color: var(--md-sys-color-surface-container-highest, #E6E0E9);
|
|
33
|
+
box-shadow: var(--md-sys-elevation-level0, none);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
:host([variant="filled"][interactive]:hover) {
|
|
37
|
+
box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0,0,0,0.15));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* --- Outlined --- */
|
|
41
|
+
:host([variant="outlined"]) {
|
|
42
|
+
background-color: var(--md-sys-color-surface, #FEF7FF);
|
|
43
|
+
border: 1px solid var(--md-sys-color-outline-variant, #CAC4D0);
|
|
44
|
+
box-shadow: var(--md-sys-elevation-level0, none);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:host([variant="outlined"][interactive]:hover) {
|
|
48
|
+
box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0,0,0,0.15));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host([interactive]) {
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:host([disabled]) {
|
|
56
|
+
pointer-events: none;
|
|
57
|
+
opacity: 0.38;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.card-container {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
height: 100%;
|
|
64
|
+
position: relative;
|
|
65
|
+
text-decoration: none;
|
|
66
|
+
color: inherit;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
::slotted([slot="media"]) {
|
|
70
|
+
width: 100%;
|
|
71
|
+
max-height: 200px;
|
|
72
|
+
object-fit: cover;
|
|
73
|
+
display: block;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.header {
|
|
77
|
+
padding: 16px 16px 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.body {
|
|
81
|
+
padding: 16px;
|
|
82
|
+
flex: 1;
|
|
83
|
+
font-size: var(--md-sys-typescale-body-medium-size, 14px);
|
|
84
|
+
line-height: 20px;
|
|
85
|
+
color: var(--md-sys-color-on-surface-variant, #49454F);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.actions {
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
justify-content: flex-end;
|
|
92
|
+
gap: 8px;
|
|
93
|
+
padding: 8px 16px 16px;
|
|
94
|
+
}
|
|
95
|
+
`, e = class extends d {
|
|
96
|
+
constructor(...o) {
|
|
97
|
+
super(...o), this.variant = "elevated", this.interactive = !1, this.disabled = !1, this.href = "", this.target = "", this.handleClick = (s) => {
|
|
98
|
+
if (this.disabled) {
|
|
99
|
+
s.preventDefault(), s.stopImmediatePropagation();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
this.interactive && this.emitEvent("card-click");
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
static {
|
|
106
|
+
this.styles = [d.styles, c];
|
|
107
|
+
}
|
|
108
|
+
render() {
|
|
109
|
+
const o = r`
|
|
110
|
+
${this.interactive ? r`<md-ripple ?disabled=${this.disabled}></md-ripple><md-focus-ring></md-focus-ring>` : t}
|
|
111
|
+
<slot name="media"></slot>
|
|
112
|
+
<div class="header">
|
|
113
|
+
<slot name="header"></slot>
|
|
114
|
+
</div>
|
|
115
|
+
<div class="body">
|
|
116
|
+
<slot></slot>
|
|
117
|
+
</div>
|
|
118
|
+
<div class="actions">
|
|
119
|
+
<slot name="actions"></slot>
|
|
120
|
+
</div>
|
|
121
|
+
`;
|
|
122
|
+
return this.href ? r`
|
|
123
|
+
<a
|
|
124
|
+
class="card-container"
|
|
125
|
+
href=${this.disabled ? t : this.href}
|
|
126
|
+
target=${this.target || t}
|
|
127
|
+
aria-disabled=${this.disabled ? "true" : t}
|
|
128
|
+
tabindex=${this.disabled ? "-1" : this.interactive ? "0" : t}
|
|
129
|
+
@click=${this.handleClick}
|
|
130
|
+
>
|
|
131
|
+
${o}
|
|
132
|
+
</a>
|
|
133
|
+
` : r`
|
|
134
|
+
<div
|
|
135
|
+
class="card-container"
|
|
136
|
+
tabindex=${this.interactive && !this.disabled ? "0" : t}
|
|
137
|
+
@click=${this.handleClick}
|
|
138
|
+
>
|
|
139
|
+
${o}
|
|
140
|
+
</div>
|
|
141
|
+
`;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
i([a({
|
|
145
|
+
type: String,
|
|
146
|
+
reflect: !0
|
|
147
|
+
})], e.prototype, "variant", void 0);
|
|
148
|
+
i([a({
|
|
149
|
+
type: Boolean,
|
|
150
|
+
reflect: !0
|
|
151
|
+
})], e.prototype, "interactive", void 0);
|
|
152
|
+
i([a({
|
|
153
|
+
type: Boolean,
|
|
154
|
+
reflect: !0
|
|
155
|
+
})], e.prototype, "disabled", void 0);
|
|
156
|
+
i([a({ type: String })], e.prototype, "href", void 0);
|
|
157
|
+
i([a({ type: String })], e.prototype, "target", void 0);
|
|
158
|
+
e = i([l("md-card")], e);
|
|
159
|
+
export {
|
|
160
|
+
e as t
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
//# sourceMappingURL=card-DVffdPpv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-DVffdPpv.js","names":[],"sources":["../../src/components/card/card.css.ts","../../src/components/card/card.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const cardStyles = css`\n :host {\n display: block;\n border-radius: var(--md-sys-shape-corner-medium, 12px);\n box-sizing: border-box;\n font-family: var(--md-sys-typescale-font-family, inherit);\n position: relative;\n overflow: hidden;\n transition: box-shadow 200ms cubic-bezier(0.2, 0, 0, 1),\n background-color 200ms cubic-bezier(0.2, 0, 0, 1);\n }\n\n /* --- Elevated (Default) --- */\n :host(:not([variant])),\n :host([variant=\"elevated\"]) {\n background-color: var(--md-sys-color-surface-container-low, #F7F2FA);\n box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0,0,0,0.15));\n }\n\n :host(:not([variant])[interactive]:hover),\n :host([variant=\"elevated\"][interactive]:hover) {\n box-shadow: var(--md-sys-elevation-level2, 0px 2px 6px 2px rgba(0,0,0,0.15));\n }\n\n /* --- Filled --- */\n :host([variant=\"filled\"]) {\n background-color: var(--md-sys-color-surface-container-highest, #E6E0E9);\n box-shadow: var(--md-sys-elevation-level0, none);\n }\n\n :host([variant=\"filled\"][interactive]:hover) {\n box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0,0,0,0.15));\n }\n\n /* --- Outlined --- */\n :host([variant=\"outlined\"]) {\n background-color: var(--md-sys-color-surface, #FEF7FF);\n border: 1px solid var(--md-sys-color-outline-variant, #CAC4D0);\n box-shadow: var(--md-sys-elevation-level0, none);\n }\n\n :host([variant=\"outlined\"][interactive]:hover) {\n box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0,0,0,0.15));\n }\n\n :host([interactive]) {\n cursor: pointer;\n }\n\n :host([disabled]) {\n pointer-events: none;\n opacity: 0.38;\n }\n\n .card-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n position: relative;\n text-decoration: none;\n color: inherit;\n }\n\n ::slotted([slot=\"media\"]) {\n width: 100%;\n max-height: 200px;\n object-fit: cover;\n display: block;\n }\n\n .header {\n padding: 16px 16px 0;\n }\n\n .body {\n padding: 16px;\n flex: 1;\n font-size: var(--md-sys-typescale-body-medium-size, 14px);\n line-height: 20px;\n color: var(--md-sys-color-on-surface-variant, #49454F);\n }\n\n .actions {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n padding: 8px 16px 16px;\n }\n`;\n\n","import { html, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { MdBaseElement } from '../../internal/base-component.js';\nimport '../../internal/ripple/ripple.js';\nimport '../../internal/focus-ring/focus-ring.js';\nimport { cardStyles } from './card.css.js';\n\nexport type CardVariant = 'elevated' | 'filled' | 'outlined';\n\n@customElement('md-card')\nexport class MdCard extends MdBaseElement {\n static override styles = [MdBaseElement.styles, cardStyles];\n\n @property({ type: String, reflect: true })\n variant: CardVariant = 'elevated';\n\n @property({ type: Boolean, reflect: true })\n interactive = false;\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: String })\n href = '';\n\n @property({ type: String })\n target = '';\n\n private handleClick = (event: MouseEvent) => {\n if (this.disabled) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n if (this.interactive) {\n this.emitEvent('card-click');\n }\n };\n\n override render() {\n const innerContent = html`\n ${this.interactive ? html`<md-ripple ?disabled=${this.disabled}></md-ripple><md-focus-ring></md-focus-ring>` : nothing}\n <slot name=\"media\"></slot>\n <div class=\"header\">\n <slot name=\"header\"></slot>\n </div>\n <div class=\"body\">\n <slot></slot>\n </div>\n <div class=\"actions\">\n <slot name=\"actions\"></slot>\n </div>\n `;\n\n if (this.href) {\n return html`\n <a\n class=\"card-container\"\n href=${this.disabled ? nothing : this.href}\n target=${this.target || nothing}\n aria-disabled=${this.disabled ? 'true' : nothing}\n tabindex=${this.disabled ? '-1' : (this.interactive ? '0' : nothing)}\n @click=${this.handleClick}\n >\n ${innerContent}\n </a>\n `;\n }\n\n return html`\n <div\n class=\"card-container\"\n tabindex=${this.interactive && !this.disabled ? '0' : nothing}\n @click=${this.handleClick}\n >\n ${innerContent}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagN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