@universal-material/web 3.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/all.d.ts +9 -0
- package/all.d.ts.map +1 -0
- package/all.js +9 -0
- package/all.js.map +1 -0
- package/button/button-base.d.ts +37 -0
- package/button/button-base.d.ts.map +1 -0
- package/button/button-base.js +199 -0
- package/button/button-base.js.map +1 -0
- package/button/button-set.d.ts +11 -0
- package/button/button-set.d.ts.map +1 -0
- package/button/button-set.js +27 -0
- package/button/button-set.js.map +1 -0
- package/button/button.d.ts +18 -0
- package/button/button.d.ts.map +1 -0
- package/button/button.js +137 -0
- package/button/button.js.map +1 -0
- package/button/fab.d.ts +17 -0
- package/button/fab.d.ts.map +1 -0
- package/button/fab.js +144 -0
- package/button/fab.js.map +1 -0
- package/button/icon-button.d.ts +35 -0
- package/button/icon-button.d.ts.map +1 -0
- package/button/icon-button.js +153 -0
- package/button/icon-button.js.map +1 -0
- package/card/button-set.d.ts +11 -0
- package/card/button-set.d.ts.map +1 -0
- package/card/button-set.js +26 -0
- package/card/button-set.js.map +1 -0
- package/card/card-content.d.ts +11 -0
- package/card/card-content.d.ts.map +1 -0
- package/card/card-content.js +24 -0
- package/card/card-content.js.map +1 -0
- package/card/card-media.d.ts +12 -0
- package/card/card-media.d.ts.map +1 -0
- package/card/card-media.js +37 -0
- package/card/card-media.js.map +1 -0
- package/card/card.d.ts +15 -0
- package/card/card.d.ts.map +1 -0
- package/card/card.js +52 -0
- package/card/card.js.map +1 -0
- package/divider/divider.d.ts +11 -0
- package/divider/divider.d.ts.map +1 -0
- package/divider/divider.js +35 -0
- package/divider/divider.js.map +1 -0
- package/elevation/elevation.d.ts +10 -0
- package/elevation/elevation.d.ts.map +1 -0
- package/elevation/elevation.js +47 -0
- package/elevation/elevation.js.map +1 -0
- package/package.json +82 -0
- package/ripple/ripple.d.ts +19 -0
- package/ripple/ripple.d.ts.map +1 -0
- package/ripple/ripple.js +173 -0
- package/ripple/ripple.js.map +1 -0
- package/shared/area-hidden-element.d.ts +5 -0
- package/shared/area-hidden-element.d.ts.map +1 -0
- package/shared/area-hidden-element.js +10 -0
- package/shared/area-hidden-element.js.map +1 -0
package/all.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import './button/button';
|
|
2
|
+
import './button/fab';
|
|
3
|
+
import './button/icon-button';
|
|
4
|
+
import './button/button-set';
|
|
5
|
+
import './card/card';
|
|
6
|
+
import './divider/divider';
|
|
7
|
+
import './elevation/elevation';
|
|
8
|
+
import './ripple/ripple';
|
|
9
|
+
//# sourceMappingURL=all.d.ts.map
|
package/all.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all.d.ts","sourceRoot":"","sources":["../src/all.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AACzB,OAAO,cAAc,CAAC;AACtB,OAAO,sBAAsB,CAAC;AAC9B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,aAAa,CAAC;AACrB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,iBAAiB,CAAC"}
|
package/all.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import './button/button';
|
|
2
|
+
import './button/fab';
|
|
3
|
+
import './button/icon-button';
|
|
4
|
+
import './button/button-set';
|
|
5
|
+
import './card/card';
|
|
6
|
+
import './divider/divider';
|
|
7
|
+
import './elevation/elevation';
|
|
8
|
+
import './ripple/ripple';
|
|
9
|
+
//# sourceMappingURL=all.js.map
|
package/all.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all.js","sourceRoot":"","sources":["../src/all.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AACzB,OAAO,cAAc,CAAC;AACtB,OAAO,sBAAsB,CAAC;AAC9B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,aAAa,CAAC;AACrB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,iBAAiB,CAAC","sourcesContent":["import './button/button';\nimport './button/fab';\nimport './button/icon-button';\nimport './button/button-set';\nimport './card/card';\nimport './divider/divider';\nimport './elevation/elevation';\nimport './ripple/ripple';\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { CSSResult, HTMLTemplateResult, LitElement, nothing } from 'lit';
|
|
2
|
+
import '../elevation/elevation';
|
|
3
|
+
import '../ripple/ripple';
|
|
4
|
+
export declare abstract class ButtonBase extends LitElement {
|
|
5
|
+
static readonly formAssociated = true;
|
|
6
|
+
static styles: CSSResult | CSSResult[];
|
|
7
|
+
/**
|
|
8
|
+
* Whether or not the button is disabled.
|
|
9
|
+
*/
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The URL that the link button points to.
|
|
13
|
+
*/
|
|
14
|
+
href: string;
|
|
15
|
+
/**
|
|
16
|
+
* Where to display the linked `href` URL for a link button. Common options
|
|
17
|
+
* include `_blank` to open in a new tab.
|
|
18
|
+
*/
|
|
19
|
+
target: '_blank' | '_parent' | '_self' | '_top' | '';
|
|
20
|
+
type: 'submit' | 'button' | 'reset';
|
|
21
|
+
form: string | null;
|
|
22
|
+
private readonly buttonElement;
|
|
23
|
+
private readonly ripple;
|
|
24
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
25
|
+
private renderButton;
|
|
26
|
+
private renderLink;
|
|
27
|
+
protected abstract renderContent(): HTMLTemplateResult;
|
|
28
|
+
connectedCallback(): void;
|
|
29
|
+
disconnectedCallback(): void;
|
|
30
|
+
focus(): void;
|
|
31
|
+
blur(): void;
|
|
32
|
+
protected getAriaLabel(): string | null | typeof nothing;
|
|
33
|
+
private innerHandleClick;
|
|
34
|
+
protected handleClick(_: UIEvent): void;
|
|
35
|
+
private getFormElement;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=button-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-base.d.ts","sourceRoot":"","sources":["../../src/button/button-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,SAAS,EAAQ,kBAAkB,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AAGlF,OAAO,wBAAwB,CAAC;AAChC,OAAO,kBAAkB,CAAC;AAG1B,8BAAsB,UAAW,SAAQ,UAAU;IAEjD,MAAM,CAAC,QAAQ,CAAC,cAAc,QAAQ;IAEtC,OAAgB,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,CAmE/C;IAEA;;OAEG;IACuC,QAAQ,UAAS;IAE3D;;OAEG;IACS,IAAI,SAAM;IAEtB;;;OAGG;IACS,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,EAAE,CAAM;IAE1D,IAAI,EAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAY;IAGhD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAQ;IAErB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAe;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;cAGjC,MAAM;IAOzB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,UAAU;IAgBlB,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,kBAAkB;IAE7C,iBAAiB;IAMjB,oBAAoB;IAKpB,KAAK;IAIL,IAAI;IAIb,SAAS,CAAC,YAAY,IAAI,MAAM,GAAG,IAAI,GAAG,OAAO,OAAO;IAIxD,OAAO,CAAC,gBAAgB;IA0BxB,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI;IAIvC,OAAO,CAAC,cAAc;CAOvB"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
8
|
+
import { property, query } from 'lit/decorators.js';
|
|
9
|
+
import '../elevation/elevation';
|
|
10
|
+
import '../ripple/ripple';
|
|
11
|
+
export class ButtonBase extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
/**
|
|
15
|
+
* Whether or not the button is disabled.
|
|
16
|
+
*/
|
|
17
|
+
this.disabled = false;
|
|
18
|
+
/**
|
|
19
|
+
* The URL that the link button points to.
|
|
20
|
+
*/
|
|
21
|
+
this.href = '';
|
|
22
|
+
/**
|
|
23
|
+
* Where to display the linked `href` URL for a link button. Common options
|
|
24
|
+
* include `_blank` to open in a new tab.
|
|
25
|
+
*/
|
|
26
|
+
this.target = '';
|
|
27
|
+
this.type = 'submit';
|
|
28
|
+
// @property() variant: 'filled' | 'tonal' | 'outlined' | 'text' = 'filled';
|
|
29
|
+
this.form = null;
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
return this.href
|
|
33
|
+
? this.renderLink()
|
|
34
|
+
: this.renderButton();
|
|
35
|
+
}
|
|
36
|
+
renderButton() {
|
|
37
|
+
// Needed for closure conformance
|
|
38
|
+
return html `
|
|
39
|
+
<button
|
|
40
|
+
id="button"
|
|
41
|
+
class="button"
|
|
42
|
+
?disabled=${this.disabled}
|
|
43
|
+
aria-label="${this.getAriaLabel()}"
|
|
44
|
+
type="button">
|
|
45
|
+
<u-elevation></u-elevation>
|
|
46
|
+
<u-ripple ?disabled=${this.disabled}></u-ripple>
|
|
47
|
+
${this.renderContent()}
|
|
48
|
+
</button>`;
|
|
49
|
+
}
|
|
50
|
+
renderLink() {
|
|
51
|
+
// Needed for closure conformance
|
|
52
|
+
// const {ariaLabel, ariaHasPopup, ariaExpanded} = this as ARIAMixinStrict;
|
|
53
|
+
return html `<a
|
|
54
|
+
id="link"
|
|
55
|
+
class="button"
|
|
56
|
+
href=${this.disabled ? nothing : this.href}
|
|
57
|
+
aria-disabled=${this.disabled || nothing}
|
|
58
|
+
aria-label="${this.getAriaLabel()}"
|
|
59
|
+
target=${this.target || nothing}>
|
|
60
|
+
<u-elevation></u-elevation>
|
|
61
|
+
<u-ripple ?disabled=${this.disabled}></u-ripple>
|
|
62
|
+
${this.renderContent()}
|
|
63
|
+
</a>`;
|
|
64
|
+
}
|
|
65
|
+
connectedCallback() {
|
|
66
|
+
super.connectedCallback();
|
|
67
|
+
this.addEventListener('click', this.innerHandleClick);
|
|
68
|
+
}
|
|
69
|
+
disconnectedCallback() {
|
|
70
|
+
super.disconnectedCallback();
|
|
71
|
+
this.removeEventListener('click', this.innerHandleClick);
|
|
72
|
+
}
|
|
73
|
+
focus() {
|
|
74
|
+
this.buttonElement?.focus();
|
|
75
|
+
}
|
|
76
|
+
blur() {
|
|
77
|
+
this.buttonElement?.blur();
|
|
78
|
+
}
|
|
79
|
+
getAriaLabel() {
|
|
80
|
+
return this.ariaLabel || nothing;
|
|
81
|
+
}
|
|
82
|
+
innerHandleClick(event) {
|
|
83
|
+
if (this.disabled) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (event.detail === 0) {
|
|
87
|
+
this.ripple.createRipple();
|
|
88
|
+
}
|
|
89
|
+
this.handleClick(event);
|
|
90
|
+
if (this.type === 'button' || !!this.href) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const formElement = this.getFormElement();
|
|
94
|
+
if (this.type === 'submit') {
|
|
95
|
+
formElement?.submit();
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
formElement?.reset();
|
|
99
|
+
}
|
|
100
|
+
handleClick(_) {
|
|
101
|
+
}
|
|
102
|
+
getFormElement() {
|
|
103
|
+
if (!this.form) {
|
|
104
|
+
return this.closest('FORM');
|
|
105
|
+
}
|
|
106
|
+
return document.getElementById(this.form);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
ButtonBase.formAssociated = true;
|
|
110
|
+
ButtonBase.styles = css `
|
|
111
|
+
|
|
112
|
+
:host {
|
|
113
|
+
--_primary-color: var(--u-primary-color, #6750a4);
|
|
114
|
+
--_shadow-color-rgb: var(--u-shadow-color-rgb, 0,0,0);
|
|
115
|
+
|
|
116
|
+
-webkit-tap-highlight-color: transparent;
|
|
117
|
+
display: inline-block;
|
|
118
|
+
vertical-align: baseline;
|
|
119
|
+
transition: color 150ms ease-in-out, background-color 150ms ease-in-out;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:host([disabled]) {
|
|
123
|
+
--u-elevation-level: 0 !important;
|
|
124
|
+
background-color: var(--u-button-disabled-background-color, rgba(var(--u-on-surface-color-rgb, 29, 27, 32), .12)) !important;
|
|
125
|
+
color: var(--u-button-disabled-text-color, rgba(var(--u-on-surface-color-rgb, 29, 27, 32), .38)) !important;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
:host([disabled]) .button {
|
|
129
|
+
cursor: default;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
* {
|
|
133
|
+
color: inherit;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
u-elevation {
|
|
137
|
+
z-index: -1;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.button {
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
justify-content: center;
|
|
145
|
+
position: relative;
|
|
146
|
+
width: 100%;
|
|
147
|
+
height: 100%;
|
|
148
|
+
margin: 0;
|
|
149
|
+
font-family: inherit;
|
|
150
|
+
border-radius: inherit;
|
|
151
|
+
color: inherit;
|
|
152
|
+
border: none;
|
|
153
|
+
text-align: center;
|
|
154
|
+
white-space: nowrap;
|
|
155
|
+
background: transparent;
|
|
156
|
+
user-select: none;
|
|
157
|
+
text-decoration: none;
|
|
158
|
+
outline: 0;
|
|
159
|
+
z-index: 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.button:focus-visible {
|
|
163
|
+
animation: offset-pulse 400ms ease;
|
|
164
|
+
animation-fill-mode: forwards;
|
|
165
|
+
outline-offset: 2px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
::slotted([slot=icon]) {
|
|
169
|
+
display: inline-block;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@keyframes offset-pulse {
|
|
173
|
+
0% {outline: 4px solid var(--u-primary-color, #6750a4)}
|
|
174
|
+
50% {outline: 8px solid var(--u-primary-color, #6750a4)}
|
|
175
|
+
100% {outline: 4px solid var(--u-primary-color, #6750a4)}
|
|
176
|
+
}
|
|
177
|
+
`;
|
|
178
|
+
__decorate([
|
|
179
|
+
property({ type: Boolean, reflect: true })
|
|
180
|
+
], ButtonBase.prototype, "disabled", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
property()
|
|
183
|
+
], ButtonBase.prototype, "href", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
property()
|
|
186
|
+
], ButtonBase.prototype, "target", void 0);
|
|
187
|
+
__decorate([
|
|
188
|
+
property()
|
|
189
|
+
], ButtonBase.prototype, "type", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
property()
|
|
192
|
+
], ButtonBase.prototype, "form", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
query('.button')
|
|
195
|
+
], ButtonBase.prototype, "buttonElement", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
query('u-ripple')
|
|
198
|
+
], ButtonBase.prototype, "ripple", void 0);
|
|
199
|
+
//# sourceMappingURL=button-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-base.js","sourceRoot":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QAED,OAAwB,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;;AApMe,yBAAc,GAAG,IAAI,AAAP,CAAQ;AAEtB,iBAAM,GAA4B,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmEtD,AAnEuB,CAmEtB;AAK0C;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CAAkB;AAK/C;IAAX,QAAQ,EAAE;wCAAW;AAMV;IAAX,QAAQ,EAAE;0CAA2D;AAE1D;IAAX,QAAQ,EAAE;wCAAiD;AAGhD;IAAX,QAAQ,EAAE;wCAA4B;AAEJ;IAAlC,KAAK,CAAC,SAAS,CAAC;iDAA8C;AAC3B;IAAnC,KAAK,CAAC,UAAU,CAAC;0CAAkC","sourcesContent":["import {css, CSSResult, html, HTMLTemplateResult, LitElement, nothing} from 'lit';\nimport {property, query} from 'lit/decorators.js';\n\nimport '../elevation/elevation';\nimport '../ripple/ripple';\nimport {Ripple} from '../ripple/ripple';\n\nexport abstract class ButtonBase extends LitElement {\n\n static readonly formAssociated = true;\n\n static override styles: CSSResult | CSSResult[] = css`\n\n :host {\n --_primary-color: var(--u-primary-color, #6750a4);\n --_shadow-color-rgb: var(--u-shadow-color-rgb, 0,0,0);\n\n -webkit-tap-highlight-color: transparent;\n display: inline-block;\n vertical-align: baseline;\n transition: color 150ms ease-in-out, background-color 150ms ease-in-out;\n }\n\n :host([disabled]) {\n --u-elevation-level: 0 !important;\n background-color: var(--u-button-disabled-background-color, rgba(var(--u-on-surface-color-rgb, 29, 27, 32), .12)) !important;\n color: var(--u-button-disabled-text-color, rgba(var(--u-on-surface-color-rgb, 29, 27, 32), .38)) !important;\n }\n\n :host([disabled]) .button {\n cursor: default;\n }\n \n * {\n color: inherit;\n }\n \n u-elevation {\n z-index: -1;\n }\n\n .button {\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n width: 100%;\n height: 100%;\n margin: 0;\n font-family: inherit;\n border-radius: inherit;\n color: inherit;\n border: none;\n text-align: center;\n white-space: nowrap;\n background: transparent;\n user-select: none;\n text-decoration: none;\n outline: 0;\n z-index: 0;\n }\n \n .button:focus-visible {\n animation: offset-pulse 400ms ease;\n animation-fill-mode: forwards;\n outline-offset: 2px;\n }\n\n ::slotted([slot=icon]) {\n display: inline-block;\n }\n \n @keyframes offset-pulse {\n 0% {outline: 4px solid var(--u-primary-color, #6750a4)}\n 50% {outline: 8px solid var(--u-primary-color, #6750a4)}\n 100% {outline: 4px solid var(--u-primary-color, #6750a4)}\n }\n`;\n\n /**\n * Whether or not the button is disabled.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * The URL that the link button points to.\n */\n @property() href = '';\n\n /**\n * Where to display the linked `href` URL for a link button. Common options\n * include `_blank` to open in a new tab.\n */\n @property() target: '_blank' | '_parent' | '_self' | '_top' | '' = '';\n\n @property() type : 'submit' | 'button' | 'reset' = 'submit';\n // @property() variant: 'filled' | 'tonal' | 'outlined' | 'text' = 'filled';\n\n @property() form: string | null = null;\n\n @query('.button') private readonly buttonElement!: HTMLElement;\n @query('u-ripple') private readonly ripple!: Ripple;\n\n\n protected override render() {\n return this.href\n ? this.renderLink()\n : this.renderButton();\n }\n\n\n private renderButton() {\n\n // Needed for closure conformance\n return html`\n <button\n id=\"button\"\n class=\"button\"\n ?disabled=${this.disabled}\n aria-label=\"${this.getAriaLabel()}\"\n type=\"button\">\n <u-elevation></u-elevation>\n <u-ripple ?disabled=${this.disabled}></u-ripple>\n ${this.renderContent()}\n </button>`;\n }\n\n private renderLink() {\n // Needed for closure conformance\n // const {ariaLabel, ariaHasPopup, ariaExpanded} = this as ARIAMixinStrict;\n return html`<a\n id=\"link\"\n class=\"button\"\n href=${this.disabled ? nothing : this.href}\n aria-disabled=${this.disabled || nothing}\n aria-label=\"${this.getAriaLabel()}\"\n target=${this.target || nothing}>\n <u-elevation></u-elevation>\n <u-ripple ?disabled=${this.disabled}></u-ripple>\n ${this.renderContent()}\n </a>`;\n }\n\n protected abstract renderContent(): HTMLTemplateResult;\n\n override connectedCallback() {\n super.connectedCallback();\n\n this.addEventListener('click', this.innerHandleClick);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('click', this.innerHandleClick);\n }\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n this.buttonElement?.blur();\n }\n\n protected getAriaLabel(): string | null | typeof nothing {\n return this.ariaLabel || nothing;\n }\n\n private innerHandleClick(event: UIEvent): void {\n\n if (this.disabled) {\n return;\n }\n\n if (event.detail === 0) {\n this.ripple.createRipple();\n }\n\n this.handleClick(event);\n\n if (this.type === 'button' || !!this.href) {\n return;\n }\n\n const formElement = this.getFormElement();\n\n if (this.type === 'submit') {\n formElement?.submit()\n return;\n }\n\n formElement?.reset();\n }\n\n protected handleClick(_: UIEvent): void {\n\n }\n\n private getFormElement(): HTMLFormElement | null {\n if (!this.form) {\n return this.closest<HTMLFormElement>('FORM');\n }\n\n return <HTMLFormElement>document.getElementById(this.form);\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HTMLTemplateResult, LitElement } from 'lit';
|
|
2
|
+
export declare class ButtonSet extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult;
|
|
4
|
+
render(): HTMLTemplateResult;
|
|
5
|
+
}
|
|
6
|
+
declare global {
|
|
7
|
+
interface HTMLElementTagNameMap {
|
|
8
|
+
'u-button-set': ButtonSet;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=button-set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-set.d.ts","sourceRoot":"","sources":["../../src/button/button-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,UAAU,EAAY,MAAM,KAAK,CAAC;AAG9D,qBACa,SAAU,SAAQ,UAAU;IAEvC,OAAgB,MAAM,0BAQpB;IAEO,MAAM,IAAI,kBAAkB;CAGtC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,SAAS,CAAC;KAC3B;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, css, html } from 'lit';
|
|
8
|
+
import { customElement } from 'lit/decorators.js';
|
|
9
|
+
let ButtonSet = class ButtonSet extends LitElement {
|
|
10
|
+
render() {
|
|
11
|
+
return html `<slot></slot>`;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
ButtonSet.styles = css `
|
|
15
|
+
:host {
|
|
16
|
+
display: flex;
|
|
17
|
+
gap: 8px;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: flex-end;
|
|
20
|
+
flex-wrap: wrap;
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
ButtonSet = __decorate([
|
|
24
|
+
customElement('u-button-set')
|
|
25
|
+
], ButtonSet);
|
|
26
|
+
export { ButtonSet };
|
|
27
|
+
//# sourceMappingURL=button-set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-set.js","sourceRoot":"","sources":["../../src/button/button-set.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAqB,UAAU,EAAE,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG3C,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAY9B,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;;AAZe,gBAAM,GAAG,GAAG,CAAA;;;;;;;;GAQ3B,AARqB,CAQpB;AAVS,SAAS;IADrB,aAAa,CAAC,cAAc,CAAC;GACjB,SAAS,CAerB","sourcesContent":["import {HTMLTemplateResult, LitElement, css, html} from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\n@customElement('u-button-set')\nexport class ButtonSet extends LitElement {\n\n static override styles = css`\n :host {\n display: flex;\n gap: 8px;\n align-items: center;\n justify-content: flex-end;\n flex-wrap: wrap;\n }\n `;\n\n override render(): HTMLTemplateResult {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-button-set': ButtonSet;\n }\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CSSResult, HTMLTemplateResult } from 'lit';
|
|
2
|
+
import '../ripple/ripple';
|
|
3
|
+
import { ButtonBase } from './button-base';
|
|
4
|
+
export declare class Button extends ButtonBase {
|
|
5
|
+
static styles: CSSResult | CSSResult[];
|
|
6
|
+
variant: 'filled' | 'tonal' | 'outlined' | 'text';
|
|
7
|
+
trailingIcon: boolean;
|
|
8
|
+
hasIcon: boolean;
|
|
9
|
+
private readonly assignedIcons;
|
|
10
|
+
protected renderContent(): HTMLTemplateResult;
|
|
11
|
+
private handleSlotChange;
|
|
12
|
+
}
|
|
13
|
+
declare global {
|
|
14
|
+
interface HTMLElementTagNameMap {
|
|
15
|
+
'u-button': Button;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,SAAS,EAAQ,kBAAkB,EAAU,MAAM,KAAK,CAAC;AAGtE,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,qBACa,MAAO,SAAQ,UAAU;IAEpC,OAAgB,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,CAuF7C;IAEyB,OAAO,EAAE,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAY;IAElB,YAAY,UAAS;IAC1B,OAAO,UAAS;IAGjF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;cAE5B,aAAa,IAAI,kBAAkB;IAatD,OAAO,CAAC,gBAAgB;CAGzB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,MAAM,CAAC;KACpB;CACF"}
|
package/button/button.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { css, html, nothing } from 'lit';
|
|
8
|
+
import { customElement, property, queryAssignedElements } from 'lit/decorators.js';
|
|
9
|
+
import '../ripple/ripple';
|
|
10
|
+
import { ButtonBase } from './button-base';
|
|
11
|
+
let Button = class Button extends ButtonBase {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.variant = 'filled';
|
|
15
|
+
this.trailingIcon = false;
|
|
16
|
+
this.hasIcon = false;
|
|
17
|
+
}
|
|
18
|
+
renderContent() {
|
|
19
|
+
const icon = html `<slot
|
|
20
|
+
name="icon"
|
|
21
|
+
aria-hidden="true"
|
|
22
|
+
@slotchange="${this.handleSlotChange}"></slot>`;
|
|
23
|
+
return html `
|
|
24
|
+
${this.trailingIcon ? nothing : icon}
|
|
25
|
+
<span><slot></slot></span>
|
|
26
|
+
${this.trailingIcon ? icon : nothing}
|
|
27
|
+
`;
|
|
28
|
+
}
|
|
29
|
+
handleSlotChange() {
|
|
30
|
+
this.hasIcon = this.assignedIcons.length > 0;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
Button.styles = [
|
|
34
|
+
ButtonBase.styles,
|
|
35
|
+
css `
|
|
36
|
+
|
|
37
|
+
:host {
|
|
38
|
+
--u-common-button-line-height: var(--u-label-large-line-height, 1.25rem);
|
|
39
|
+
--u-common-button-font-size: var(--u-label-large-font-size, 0.875rem);
|
|
40
|
+
--u-common-button-font-weight: var(--u-font-weight-medium, 500);
|
|
41
|
+
--_common-button-height: var(--u-common-button-height, 2.5rem);
|
|
42
|
+
--_common-button-padding: var(--u-common-button-padding, 24px);
|
|
43
|
+
--_common-button-icon-padding: var(--u-common-button-icon-padding, 16px);
|
|
44
|
+
|
|
45
|
+
border-radius: var(--u-common-button-shape, 9999px);
|
|
46
|
+
font-family: var(--u-font-family-base, system-ui);
|
|
47
|
+
height: var(--u-common-button-height, 40px);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:host([variant="filled"]) {
|
|
51
|
+
background-color: var(--u-filled-button-background-color, var(--_primary-color));
|
|
52
|
+
color: var(--u-filled-button-text-color, var(--u-on-primary-color, #fff));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:host([variant="tonal"]) {
|
|
56
|
+
background-color: var(--u-tonal-button-background-color, var(--u-secondary-container-color, #e8def8));
|
|
57
|
+
color: var(--u-tonal-button-text-color, var(--u-on-secondary-container-color, #1d192b));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:host([variant="elevated"]) {
|
|
61
|
+
background-color: var(--u-elevated-button-background-color, var(--u-surface-container-low-color, #f7f2fa));
|
|
62
|
+
color: var(--u-tonal-button-text-color, var(--u-on-secondary-container-color, #1d192b));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media (hover: hover) {
|
|
66
|
+
:host([variant="filled"]:hover:not(:focus-within):not(:active)),
|
|
67
|
+
:host([variant="tonal"]:hover:not(:focus-within):not(:active)) {
|
|
68
|
+
--u-elevation-level: var(--u-filled-button-hover-elevation-level, 1);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host([variant="outlined"]),
|
|
73
|
+
:host([variant="text"]),
|
|
74
|
+
:host([variant="elevated"]) {
|
|
75
|
+
color: var(--_primary-color);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:host([variant="outlined"]) {
|
|
79
|
+
border: 1px solid var(--u-outline-color, #79747e);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:host([variant="elevated"]) {
|
|
83
|
+
--u-elevation-level: var(--u-elevated-button-elevation-level, 1);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@media (hover: hover) {
|
|
87
|
+
:host([variant="elevated"]:hover) {
|
|
88
|
+
--u-elevation-level: var(--u-elevated-button-hover-elevation-level, 2);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.button {
|
|
93
|
+
font-size: var(--u-common-button-font-size);
|
|
94
|
+
font-weight: var(--u-common-button-font-weight);
|
|
95
|
+
padding-inline: var(--_common-button-padding);
|
|
96
|
+
box-sizing: border-box;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:host([has-icon]) .button {
|
|
100
|
+
padding-inline: var(--_common-button-icon-padding) var(--_common-button-padding);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
:host([has-icon][trailing-icon]) .button {
|
|
104
|
+
padding-inline: var(--_common-button-padding) var(--_common-button-icon-padding);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
::slotted([slot=icon]) {
|
|
108
|
+
display: inline-block;
|
|
109
|
+
width: var(--u-common-button-icon-size, 1.125rem);
|
|
110
|
+
height: var(--u-common-button-icon-size, 1.125rem);
|
|
111
|
+
margin-inline-end: 8px;
|
|
112
|
+
font-size: var(--u-common-button-icon-size, 1.125rem);
|
|
113
|
+
line-height: var(--u-common-button-icon-size, 1.125rem);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:host([trailing-icon]) ::slotted([slot=icon]) {
|
|
117
|
+
margin-inline: 8px 0;
|
|
118
|
+
}
|
|
119
|
+
`
|
|
120
|
+
];
|
|
121
|
+
__decorate([
|
|
122
|
+
property({ reflect: true })
|
|
123
|
+
], Button.prototype, "variant", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
property({ type: Boolean, attribute: 'trailing-icon', reflect: true })
|
|
126
|
+
], Button.prototype, "trailingIcon", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
property({ type: Boolean, attribute: 'has-icon', reflect: true })
|
|
129
|
+
], Button.prototype, "hasIcon", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
queryAssignedElements({ slot: 'icon', flatten: true })
|
|
132
|
+
], Button.prototype, "assignedIcons", void 0);
|
|
133
|
+
Button = __decorate([
|
|
134
|
+
customElement('u-button')
|
|
135
|
+
], Button);
|
|
136
|
+
export { Button };
|
|
137
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,GAAG,EAAa,IAAI,EAAsB,OAAO,EAAC,MAAM,KAAK,CAAC;AACtE,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAEjF,OAAO,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C,MAAM;IADlB,aAAa,CAAC,UAAU,CAAC;GACb,MAAM,CAmHlB","sourcesContent":["import {css, CSSResult, html, HTMLTemplateResult, nothing} from 'lit';\nimport {customElement, property, queryAssignedElements} from 'lit/decorators.js';\n\nimport '../ripple/ripple';\nimport {ButtonBase} from './button-base';\n\n@customElement('u-button')\nexport class Button extends ButtonBase {\n\n static override styles: CSSResult | CSSResult[] = [\n <CSSResult>ButtonBase.styles,\n css`\n \n :host {\n --u-common-button-line-height: var(--u-label-large-line-height, 1.25rem);\n --u-common-button-font-size: var(--u-label-large-font-size, 0.875rem);\n --u-common-button-font-weight: var(--u-font-weight-medium, 500);\n --_common-button-height: var(--u-common-button-height, 2.5rem);\n --_common-button-padding: var(--u-common-button-padding, 24px);\n --_common-button-icon-padding: var(--u-common-button-icon-padding, 16px);\n \n border-radius: var(--u-common-button-shape, 9999px);\n font-family: var(--u-font-family-base, system-ui);\n height: var(--u-common-button-height, 40px);\n }\n \n :host([variant=\"filled\"]) {\n background-color: var(--u-filled-button-background-color, var(--_primary-color));\n color: var(--u-filled-button-text-color, var(--u-on-primary-color, #fff));\n }\n \n :host([variant=\"tonal\"]) {\n background-color: var(--u-tonal-button-background-color, var(--u-secondary-container-color, #e8def8));\n color: var(--u-tonal-button-text-color, var(--u-on-secondary-container-color, #1d192b));\n }\n\n :host([variant=\"elevated\"]) {\n background-color: var(--u-elevated-button-background-color, var(--u-surface-container-low-color, #f7f2fa));\n color: var(--u-tonal-button-text-color, var(--u-on-secondary-container-color, #1d192b));\n }\n \n @media (hover: hover) {\n :host([variant=\"filled\"]:hover:not(:focus-within):not(:active)),\n :host([variant=\"tonal\"]:hover:not(:focus-within):not(:active)) {\n --u-elevation-level: var(--u-filled-button-hover-elevation-level, 1);\n }\n }\n \n :host([variant=\"outlined\"]),\n :host([variant=\"text\"]),\n :host([variant=\"elevated\"]) {\n color: var(--_primary-color);\n }\n \n :host([variant=\"outlined\"]) {\n border: 1px solid var(--u-outline-color, #79747e);\n }\n \n :host([variant=\"elevated\"]) {\n --u-elevation-level: var(--u-elevated-button-elevation-level, 1);\n }\n\n @media (hover: hover) {\n :host([variant=\"elevated\"]:hover) {\n --u-elevation-level: var(--u-elevated-button-hover-elevation-level, 2);\n }\n }\n \n .button {\n font-size: var(--u-common-button-font-size);\n font-weight: var(--u-common-button-font-weight);\n padding-inline: var(--_common-button-padding);\n box-sizing: border-box;\n }\n \n :host([has-icon]) .button {\n padding-inline: var(--_common-button-icon-padding) var(--_common-button-padding);\n }\n \n :host([has-icon][trailing-icon]) .button {\n padding-inline: var(--_common-button-padding) var(--_common-button-icon-padding);\n }\n \n ::slotted([slot=icon]) {\n display: inline-block;\n width: var(--u-common-button-icon-size, 1.125rem);\n height: var(--u-common-button-icon-size, 1.125rem);\n margin-inline-end: 8px;\n font-size: var(--u-common-button-icon-size, 1.125rem);\n line-height: var(--u-common-button-icon-size, 1.125rem);\n }\n \n :host([trailing-icon]) ::slotted([slot=icon]) {\n margin-inline: 8px 0;\n }\n `\n ];\n\n @property({reflect: true}) variant: 'filled' | 'tonal' | 'outlined' | 'text' = 'filled';\n\n @property({type: Boolean, attribute: 'trailing-icon', reflect: true}) trailingIcon = false;\n @property({type: Boolean, attribute: 'has-icon', reflect: true}) hasIcon = false;\n\n @queryAssignedElements({slot: 'icon', flatten: true})\n private readonly assignedIcons!: HTMLElement[];\n\n protected override renderContent(): HTMLTemplateResult {\n const icon = html`<slot\n name=\"icon\"\n aria-hidden=\"true\"\n @slotchange=\"${this.handleSlotChange}\"></slot>`;\n\n return html`\n ${this.trailingIcon ? nothing : icon}\n <span><slot></slot></span>\n ${this.trailingIcon ? icon : nothing}\n `;\n }\n\n private handleSlotChange() {\n this.hasIcon = this.assignedIcons.length > 0;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-button': Button;\n }\n}\n"]}
|
package/button/fab.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CSSResult, HTMLTemplateResult } from 'lit';
|
|
2
|
+
import { ButtonBase } from './button-base';
|
|
3
|
+
export declare class FabButton extends ButtonBase {
|
|
4
|
+
static styles: CSSResult | CSSResult[];
|
|
5
|
+
color: 'primary' | 'secondary' | 'tertiary' | 'surface' | 'branded';
|
|
6
|
+
size: 'small' | 'medium' | 'large';
|
|
7
|
+
label: string | null;
|
|
8
|
+
lowered: boolean;
|
|
9
|
+
get extended(): boolean;
|
|
10
|
+
protected renderContent(): HTMLTemplateResult;
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
'u-fab': FabButton;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=fab.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fab.d.ts","sourceRoot":"","sources":["../../src/button/fab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,SAAS,EAAQ,kBAAkB,EAAU,MAAM,KAAK,CAAC;AAGtE,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,qBACa,SAAU,SAAQ,UAAU;IAEvC,OAAgB,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,CA+F7C;IAEyB,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAa;IAChF,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAY;IAC9C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAQ;IACb,OAAO,UAAS;IAC1D,IACI,QAAQ,IAAI,OAAO,CAEtB;cAEkB,aAAa,IAAI,kBAAkB;CAQvD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,OAAO,EAAE,SAAS,CAAC;KACpB;CACF"}
|