@universal-material/web 3.0.19 → 3.0.21
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/app-bar/top-app-bar.d.ts +42 -0
- package/app-bar/top-app-bar.d.ts.map +1 -0
- package/app-bar/top-app-bar.js +139 -0
- package/app-bar/top-app-bar.js.map +1 -0
- package/{button/button-base.styles.d.ts → app-bar/top-app-bar.styles.d.ts} +1 -1
- package/app-bar/top-app-bar.styles.d.ts.map +1 -0
- package/app-bar/top-app-bar.styles.js +87 -0
- package/app-bar/top-app-bar.styles.js.map +1 -0
- package/button/button-base.d.ts +2 -30
- package/button/button-base.d.ts.map +1 -1
- package/button/button-base.js +4 -94
- package/button/button-base.js.map +1 -1
- package/button/button.d.ts +1 -1
- package/button/button.d.ts.map +1 -1
- package/button/button.js +9 -7
- package/button/button.js.map +1 -1
- package/button/button.styles.d.ts.map +1 -1
- package/button/button.styles.js +14 -10
- package/button/button.styles.js.map +1 -1
- package/button/fab.d.ts.map +1 -1
- package/button/fab.js +2 -2
- package/button/fab.js.map +1 -1
- package/button/icon-button.d.ts +2 -2
- package/button/icon-button.d.ts.map +1 -1
- package/button/icon-button.js +5 -4
- package/button/icon-button.js.map +1 -1
- package/button/icon-button.styles.js +8 -8
- package/button/icon-button.styles.js.map +1 -1
- package/card/card.d.ts +3 -3
- package/card/card.d.ts.map +1 -1
- package/card/card.js +4 -4
- package/card/card.js.map +1 -1
- package/checkbox/checkbox.d.ts.map +1 -1
- package/checkbox/checkbox.js +0 -1
- package/checkbox/checkbox.js.map +1 -1
- package/config.d.ts +6 -0
- package/config.d.ts.map +1 -0
- package/config.js +7 -0
- package/config.js.map +1 -0
- package/container/container.d.ts +1 -1
- package/container/container.d.ts.map +1 -1
- package/container/container.js +4 -4
- package/container/container.js.map +1 -1
- package/container/grid-base.styles.js +4 -4
- package/container/grid-base.styles.js.map +1 -1
- package/container/grid.d.ts +2 -2
- package/container/grid.d.ts.map +1 -1
- package/container/grid.js +4 -4
- package/container/grid.js.map +1 -1
- package/css/universal-material.css +1333 -0
- package/css/universal-material.min.css +2 -0
- package/custom-elements.json +2772 -814
- package/elevation/elevation.d.ts +1 -1
- package/elevation/elevation.d.ts.map +1 -1
- package/elevation/elevation.js +2 -2
- package/elevation/elevation.js.map +1 -1
- package/index.d.ts +41 -29
- package/index.d.ts.map +1 -1
- package/index.js +41 -29
- package/index.js.map +1 -1
- package/menu/menu-item.d.ts +26 -0
- package/menu/menu-item.d.ts.map +1 -0
- package/menu/menu-item.js +62 -0
- package/menu/menu-item.js.map +1 -0
- package/{table/table-row.styles.d.ts → menu/menu-item.styles.d.ts} +1 -1
- package/menu/menu-item.styles.d.ts.map +1 -0
- package/menu/menu-item.styles.js +37 -0
- package/menu/menu-item.styles.js.map +1 -0
- package/menu/menu.d.ts +55 -0
- package/menu/menu.d.ts.map +1 -0
- package/menu/menu.js +215 -0
- package/menu/menu.js.map +1 -0
- package/{table/table.styles.d.ts → menu/menu.styles.d.ts} +1 -1
- package/menu/menu.styles.d.ts.map +1 -0
- package/menu/menu.styles.js +95 -0
- package/menu/menu.styles.js.map +1 -0
- package/navigation/drawer-item.d.ts +39 -0
- package/navigation/drawer-item.d.ts.map +1 -0
- package/navigation/drawer-item.js +98 -0
- package/navigation/drawer-item.js.map +1 -0
- package/{table/table-body.styles.d.ts → navigation/drawer-item.styles.d.ts} +1 -1
- package/navigation/drawer-item.styles.d.ts.map +1 -0
- package/navigation/drawer-item.styles.js +43 -0
- package/navigation/drawer-item.styles.js.map +1 -0
- package/{table/table-row.d.ts → navigation/drawer.d.ts} +3 -3
- package/navigation/drawer.d.ts.map +1 -0
- package/{table/table-row.js → navigation/drawer.js} +11 -8
- package/navigation/drawer.js.map +1 -0
- package/{table/table-cell.styles.d.ts → navigation/drawer.styles.d.ts} +1 -1
- package/navigation/drawer.styles.d.ts.map +1 -0
- package/navigation/drawer.styles.js +17 -0
- package/navigation/drawer.styles.js.map +1 -0
- package/navigation/side-navigation-swiper.styles.d.ts +2 -0
- package/navigation/side-navigation-swiper.styles.d.ts.map +1 -0
- package/navigation/side-navigation-swiper.styles.js +131 -0
- package/navigation/side-navigation-swiper.styles.js.map +1 -0
- package/navigation/side-navigation.d.ts +32 -0
- package/navigation/side-navigation.d.ts.map +1 -0
- package/navigation/side-navigation.js +154 -0
- package/navigation/side-navigation.js.map +1 -0
- package/navigation/side-navigation.styles.d.ts +2 -0
- package/navigation/side-navigation.styles.d.ts.map +1 -0
- package/navigation/side-navigation.styles.js +124 -0
- package/navigation/side-navigation.styles.js.map +1 -0
- package/package.json +47 -21
- package/scss/_api.scss +2 -0
- package/scss/_common.scss +38 -0
- package/scss/_css-vars.scss +30 -0
- package/scss/_functions.scss +25 -0
- package/scss/_mixins.scss +3 -0
- package/scss/_variables.scss +110 -0
- package/scss/data-table/_data-table.scss +33 -0
- package/scss/data-table/_variables.scss +24 -0
- package/scss/functions/_font.scss +29 -0
- package/scss/mixins/_breakpoints.scss +21 -0
- package/scss/mixins/_colors.scss +6 -0
- package/scss/mixins/_text-bg.scss +33 -0
- package/scss/mixins/_typo.scss +26 -0
- package/scss/text-bg/_text-bg.scss +38 -0
- package/scss/text-bg/_text.scss +73 -0
- package/scss/typo/_font.scss +5 -0
- package/scss/typo/_typo.scss +19 -0
- package/scss/typo/_variables.scss +19 -0
- package/scss/universal-material.scss +7 -0
- package/shared/base.styles.js +1 -1
- package/shared/base.styles.js.map +1 -1
- package/shared/button-wrapper.d.ts +35 -0
- package/shared/button-wrapper.d.ts.map +1 -0
- package/shared/button-wrapper.js +110 -0
- package/shared/button-wrapper.js.map +1 -0
- package/shared/button-wrapper.styles.d.ts +2 -0
- package/shared/button-wrapper.styles.d.ts.map +1 -0
- package/{button/button-base.styles.js → shared/button-wrapper.styles.js} +27 -9
- package/shared/button-wrapper.styles.js.map +1 -0
- package/snackbar/snackbar.d.ts +38 -0
- package/snackbar/snackbar.d.ts.map +1 -0
- package/snackbar/snackbar.js +122 -0
- package/snackbar/snackbar.js.map +1 -0
- package/{table/table-head.styles.d.ts → snackbar/snackbar.styles.d.ts} +1 -1
- package/snackbar/snackbar.styles.d.ts.map +1 -0
- package/snackbar/snackbar.styles.js +81 -0
- package/snackbar/snackbar.styles.js.map +1 -0
- package/theme/css-var-builder.js +1 -1
- package/theme/css-var-builder.js.map +1 -1
- package/theme/index.d.ts +1 -1
- package/theme/index.d.ts.map +1 -1
- package/theme/index.js +1 -1
- package/theme/index.js.map +1 -1
- package/theme/neutral-colors.d.ts +1 -1
- package/theme/neutral-colors.d.ts.map +1 -1
- package/theme/neutral-colors.js +5 -0
- package/theme/neutral-colors.js.map +1 -1
- package/theme/theme-builder.d.ts +2 -3
- package/theme/theme-builder.d.ts.map +1 -1
- package/theme/theme-builder.js +41 -15
- package/theme/theme-builder.js.map +1 -1
- package/theme/theme-color.d.ts +1 -1
- package/theme/theme-color.d.ts.map +1 -1
- package/theme/theme-color.js.map +1 -1
- package/button/button-base.styles.d.ts.map +0 -1
- package/button/button-base.styles.js.map +0 -1
- package/table/table-body.d.ts +0 -11
- package/table/table-body.d.ts.map +0 -1
- package/table/table-body.js +0 -21
- package/table/table-body.js.map +0 -1
- package/table/table-body.styles.d.ts.map +0 -1
- package/table/table-body.styles.js +0 -11
- package/table/table-body.styles.js.map +0 -1
- package/table/table-cell.d.ts +0 -11
- package/table/table-cell.d.ts.map +0 -1
- package/table/table-cell.js +0 -21
- package/table/table-cell.js.map +0 -1
- package/table/table-cell.styles.d.ts.map +0 -1
- package/table/table-cell.styles.js +0 -11
- package/table/table-cell.styles.js.map +0 -1
- package/table/table-head.d.ts +0 -11
- package/table/table-head.d.ts.map +0 -1
- package/table/table-head.js +0 -21
- package/table/table-head.js.map +0 -1
- package/table/table-head.styles.d.ts.map +0 -1
- package/table/table-head.styles.js +0 -11
- package/table/table-head.styles.js.map +0 -1
- package/table/table-header-cell.d.ts +0 -11
- package/table/table-header-cell.d.ts.map +0 -1
- package/table/table-header-cell.js +0 -21
- package/table/table-header-cell.js.map +0 -1
- package/table/table-header-cell.styles.d.ts +0 -2
- package/table/table-header-cell.styles.d.ts.map +0 -1
- package/table/table-header-cell.styles.js +0 -12
- package/table/table-header-cell.styles.js.map +0 -1
- package/table/table-row.d.ts.map +0 -1
- package/table/table-row.js.map +0 -1
- package/table/table-row.styles.d.ts.map +0 -1
- package/table/table-row.styles.js +0 -7
- package/table/table-row.styles.js.map +0 -1
- package/table/table.d.ts +0 -16
- package/table/table.d.ts.map +0 -1
- package/table/table.js +0 -19
- package/table/table.js.map +0 -1
- package/table/table.styles.d.ts.map +0 -1
- package/table/table.styles.js +0 -16
- package/table/table.styles.js.map +0 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PropertyValues } from '@lit/reactive-element';
|
|
2
|
+
import { HTMLTemplateResult, LitElement } from 'lit';
|
|
3
|
+
export declare class UmTopAppBar extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult;
|
|
5
|
+
/**
|
|
6
|
+
* Whether the app bar has leading icon or not
|
|
7
|
+
*
|
|
8
|
+
* _Note:_ Readonly
|
|
9
|
+
*/
|
|
10
|
+
hasLeadingIcon: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the app bar has trailing icon or not
|
|
13
|
+
*
|
|
14
|
+
* _Note:_ Readonly
|
|
15
|
+
*/
|
|
16
|
+
hasTrailingIcon: boolean;
|
|
17
|
+
position: 'fixed' | 'absolute' | 'static';
|
|
18
|
+
get scrollContainer(): 'none' | 'window' | string | undefined;
|
|
19
|
+
set scrollContainer(idOrElement: string | HTMLElement | undefined);
|
|
20
|
+
containerScrolled: boolean;
|
|
21
|
+
private readonly assignedLeadingIcons;
|
|
22
|
+
private readonly assignedTrailingIcons;
|
|
23
|
+
content: HTMLElement;
|
|
24
|
+
private contentSizeObserver;
|
|
25
|
+
private scrollContainerElement;
|
|
26
|
+
private getScrollContainer;
|
|
27
|
+
private handleLeadingIconSlotChange;
|
|
28
|
+
private handleTrailingIconSlotChange;
|
|
29
|
+
render(): HTMLTemplateResult;
|
|
30
|
+
firstUpdated(changedProperties: PropertyValues): void;
|
|
31
|
+
connectedCallback(): void;
|
|
32
|
+
disconnectedCallback(): void;
|
|
33
|
+
onContainerScroll: (e: Event) => void;
|
|
34
|
+
private static getScrollTop;
|
|
35
|
+
private setContentHeightProperty;
|
|
36
|
+
}
|
|
37
|
+
declare global {
|
|
38
|
+
interface HTMLElementTagNameMap {
|
|
39
|
+
'u-top-app-bar': UmTopAppBar;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=top-app-bar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"top-app-bar.d.ts","sourceRoot":"","sources":["../../src/app-bar/top-app-bar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAQ,kBAAkB,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAK3D,qBACa,WAAY,SAAQ,UAAU;IAEzC,OAAgB,MAAM,0BAAU;IAEhC;;;;OAIG;IACsE,cAAc,UAAS;IAEhG;;;;OAIG;IACuE,eAAe,UAAS;IAEvE,QAAQ,EAAE,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAW;IAE/E,IACI,eAAe,IAAI,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAE5D;IACD,IAAI,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,EAShE;IAGD,iBAAiB,EAAE,OAAO,CAAS;IAGnC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAiB;IAGtD,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAiB;IAE9B,OAAO,EAAG,WAAW,CAAA;IAE9C,OAAO,CAAC,mBAAmB,CAA+B;IAE1D,OAAO,CAAC,sBAAsB,CAGd;IAEhB,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,2BAA2B;IAInC,OAAO,CAAC,4BAA4B;IAI3B,MAAM,IAAI,kBAAkB;IAqB5B,YAAY,CAAC,iBAAiB,EAAE,cAAc;IAO9C,iBAAiB;IAMjB,oBAAoB;IAO7B,iBAAiB,MAAO,KAAK,UAM5B;IAED,OAAO,CAAC,MAAM,CAAC,YAAY;IAY3B,OAAO,CAAC,wBAAwB;CAGjC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,WAAW,CAAC;KAC9B;CACF"}
|
|
@@ -0,0 +1,139 @@
|
|
|
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
|
+
var UmTopAppBar_1;
|
|
8
|
+
import { html, LitElement } from 'lit';
|
|
9
|
+
import { customElement, property, query, queryAssignedElements } from 'lit/decorators.js';
|
|
10
|
+
import { styles } from './top-app-bar.styles';
|
|
11
|
+
let UmTopAppBar = UmTopAppBar_1 = class UmTopAppBar extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
/**
|
|
15
|
+
* Whether the app bar has leading icon or not
|
|
16
|
+
*
|
|
17
|
+
* _Note:_ Readonly
|
|
18
|
+
*/
|
|
19
|
+
this.hasLeadingIcon = false;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the app bar has trailing icon or not
|
|
22
|
+
*
|
|
23
|
+
* _Note:_ Readonly
|
|
24
|
+
*/
|
|
25
|
+
this.hasTrailingIcon = false;
|
|
26
|
+
this.position = 'fixed';
|
|
27
|
+
this.containerScrolled = false;
|
|
28
|
+
this.contentSizeObserver = null;
|
|
29
|
+
this.scrollContainerElement = null;
|
|
30
|
+
this.onContainerScroll = (e) => {
|
|
31
|
+
const container = e.currentTarget;
|
|
32
|
+
const scrollTop = UmTopAppBar_1.getScrollTop(container);
|
|
33
|
+
this.containerScrolled = !!scrollTop;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
get scrollContainer() {
|
|
37
|
+
return this.attributes.getNamedItem('scrollContainer')?.value;
|
|
38
|
+
}
|
|
39
|
+
set scrollContainer(idOrElement) {
|
|
40
|
+
this.scrollContainerElement?.removeEventListener('scroll', this.onContainerScroll);
|
|
41
|
+
if (idOrElement === 'none') {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.scrollContainerElement = this.getScrollContainer(idOrElement);
|
|
45
|
+
this.scrollContainerElement?.addEventListener('scroll', this.onContainerScroll);
|
|
46
|
+
}
|
|
47
|
+
getScrollContainer(idOrElement) {
|
|
48
|
+
if (idOrElement instanceof HTMLElement) {
|
|
49
|
+
return idOrElement;
|
|
50
|
+
}
|
|
51
|
+
if (idOrElement === 'window') {
|
|
52
|
+
return window;
|
|
53
|
+
}
|
|
54
|
+
return document.getElementById(idOrElement);
|
|
55
|
+
}
|
|
56
|
+
handleLeadingIconSlotChange() {
|
|
57
|
+
this.hasLeadingIcon = this.assignedLeadingIcons.length > 0;
|
|
58
|
+
}
|
|
59
|
+
handleTrailingIconSlotChange() {
|
|
60
|
+
this.hasTrailingIcon = this.assignedTrailingIcons.length > 0;
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
return html `
|
|
64
|
+
<div class="content">
|
|
65
|
+
<div class="icon leading-icon">
|
|
66
|
+
<slot
|
|
67
|
+
name="leading-icon"
|
|
68
|
+
@slotchange="${this.handleLeadingIconSlotChange}"></slot>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="headline">
|
|
71
|
+
<slot></slot>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<div class="icon trailing-icon">
|
|
75
|
+
<slot
|
|
76
|
+
name="trailing-icon"
|
|
77
|
+
@slotchange="${this.handleTrailingIconSlotChange}"></slot>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
firstUpdated(changedProperties) {
|
|
83
|
+
super.firstUpdated(changedProperties);
|
|
84
|
+
this.contentSizeObserver = new ResizeObserver(() => this.setContentHeightProperty());
|
|
85
|
+
this.contentSizeObserver.observe(this.content);
|
|
86
|
+
this.setContentHeightProperty();
|
|
87
|
+
}
|
|
88
|
+
connectedCallback() {
|
|
89
|
+
super.connectedCallback();
|
|
90
|
+
this.scrollContainer = this.scrollContainer || 'window';
|
|
91
|
+
}
|
|
92
|
+
disconnectedCallback() {
|
|
93
|
+
super.disconnectedCallback();
|
|
94
|
+
this.contentSizeObserver.disconnect();
|
|
95
|
+
this.contentSizeObserver = null;
|
|
96
|
+
}
|
|
97
|
+
static getScrollTop(container) {
|
|
98
|
+
if (typeof container.scrollY === 'number') {
|
|
99
|
+
return container.scrollY;
|
|
100
|
+
}
|
|
101
|
+
if (typeof container.scrollTop === 'number') {
|
|
102
|
+
return container.scrollTop;
|
|
103
|
+
}
|
|
104
|
+
return document.body.scrollTop;
|
|
105
|
+
}
|
|
106
|
+
setContentHeightProperty() {
|
|
107
|
+
this.style.setProperty('--_content-height', `${this.content.clientHeight}px`);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
UmTopAppBar.styles = styles;
|
|
111
|
+
__decorate([
|
|
112
|
+
property({ type: Boolean, attribute: 'has-leading-icon', reflect: true })
|
|
113
|
+
], UmTopAppBar.prototype, "hasLeadingIcon", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
property({ type: Boolean, attribute: 'has-trailing-icon', reflect: true })
|
|
116
|
+
], UmTopAppBar.prototype, "hasTrailingIcon", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
property({ reflect: true })
|
|
119
|
+
], UmTopAppBar.prototype, "position", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
property({ reflect: true })
|
|
122
|
+
], UmTopAppBar.prototype, "scrollContainer", null);
|
|
123
|
+
__decorate([
|
|
124
|
+
property({ type: Boolean, attribute: 'container-scrolled', reflect: true })
|
|
125
|
+
], UmTopAppBar.prototype, "containerScrolled", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
queryAssignedElements({ slot: 'leading-icon', flatten: true })
|
|
128
|
+
], UmTopAppBar.prototype, "assignedLeadingIcons", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
queryAssignedElements({ slot: 'trailing-icon', flatten: true })
|
|
131
|
+
], UmTopAppBar.prototype, "assignedTrailingIcons", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
query('.content', true)
|
|
134
|
+
], UmTopAppBar.prototype, "content", void 0);
|
|
135
|
+
UmTopAppBar = UmTopAppBar_1 = __decorate([
|
|
136
|
+
customElement('u-top-app-bar')
|
|
137
|
+
], UmTopAppBar);
|
|
138
|
+
export { UmTopAppBar };
|
|
139
|
+
//# sourceMappingURL=top-app-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"top-app-bar.js","sourceRoot":"","sources":["../../src/app-bar/top-app-bar.ts"],"names":[],"mappings":"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","sourcesContent":["import { PropertyValues } from '@lit/reactive-element';\nimport { html, HTMLTemplateResult, LitElement } from 'lit';\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js';\n\nimport { styles } from './top-app-bar.styles';\n\n@customElement('u-top-app-bar')\nexport class UmTopAppBar extends LitElement {\n\n static override styles = styles;\n\n /**\n * Whether the app bar has leading icon or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-leading-icon', reflect: true}) hasLeadingIcon = false;\n\n /**\n * Whether the app bar has trailing icon or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-trailing-icon', reflect: true}) hasTrailingIcon = false;\n\n @property({reflect: true}) position: 'fixed' | 'absolute' | 'static' = 'fixed';\n\n @property({reflect: true})\n get scrollContainer(): 'none' | 'window' | string | undefined {\n return this.attributes.getNamedItem('scrollContainer')?.value;\n }\n set scrollContainer(idOrElement: string | HTMLElement | undefined) {\n this.scrollContainerElement?.removeEventListener('scroll', this.onContainerScroll);\n\n if (idOrElement === 'none') {\n return;\n }\n\n this.scrollContainerElement = this.getScrollContainer(idOrElement)!;\n this.scrollContainerElement?.addEventListener('scroll', this.onContainerScroll);\n }\n\n @property({type: Boolean, attribute: 'container-scrolled', reflect: true})\n containerScrolled: boolean = false;\n\n @queryAssignedElements({slot: 'leading-icon', flatten: true})\n private readonly assignedLeadingIcons!: HTMLElement[];\n\n @queryAssignedElements({slot: 'trailing-icon', flatten: true})\n private readonly assignedTrailingIcons!: HTMLElement[];\n\n @query('.content', true) content!: HTMLElement\n\n private contentSizeObserver: ResizeObserver | null = null;\n\n private scrollContainerElement: {\n addEventListener: typeof window.addEventListener;\n removeEventListener: typeof window.removeEventListener;\n } | null = null;\n\n private getScrollContainer(idOrElement: string | HTMLElement | undefined): {\n addEventListener: typeof window.addEventListener;\n removeEventListener: typeof window.removeEventListener;\n } | undefined {\n if (idOrElement instanceof HTMLElement) {\n return idOrElement;\n }\n\n if (idOrElement === 'window') {\n return window;\n }\n\n return document.getElementById(idOrElement!)!;\n }\n\n private handleLeadingIconSlotChange() {\n this.hasLeadingIcon = this.assignedLeadingIcons.length > 0;\n }\n\n private handleTrailingIconSlotChange() {\n this.hasTrailingIcon = this.assignedTrailingIcons.length > 0;\n }\n\n override render(): HTMLTemplateResult {\n return html`\n <div class=\"content\">\n <div class=\"icon leading-icon\">\n <slot\n name=\"leading-icon\"\n @slotchange=\"${this.handleLeadingIconSlotChange}\"></slot>\n </div>\n <div class=\"headline\">\n <slot></slot>\n </div>\n\n <div class=\"icon trailing-icon\">\n <slot\n name=\"trailing-icon\"\n @slotchange=\"${this.handleTrailingIconSlotChange}\"></slot>\n </div>\n </div>\n `;\n }\n\n override firstUpdated(changedProperties: PropertyValues) {\n super.firstUpdated(changedProperties);\n this.contentSizeObserver = new ResizeObserver(() => this.setContentHeightProperty())\n this.contentSizeObserver.observe(this.content);\n this.setContentHeightProperty();\n }\n\n override connectedCallback() {\n super.connectedCallback();\n\n this.scrollContainer = this.scrollContainer || 'window';\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n\n this.contentSizeObserver!.disconnect();\n this.contentSizeObserver = null;\n }\n\n onContainerScroll = (e: Event) => {\n const container = e.currentTarget as HTMLElement & Window;\n\n const scrollTop = UmTopAppBar.getScrollTop(container);\n\n this.containerScrolled = !!scrollTop;\n }\n\n private static getScrollTop(container: HTMLElement & Window): number | null {\n if (typeof container.scrollY === 'number') {\n return container.scrollY;\n }\n\n if (typeof container.scrollTop === 'number') {\n return container.scrollTop;\n }\n\n return document.body.scrollTop;\n }\n\n private setContentHeightProperty() {\n this.style.setProperty('--_content-height', `${this.content.clientHeight}px`);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-top-app-bar': UmTopAppBar;\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const styles: import("lit").CSSResult;
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=top-app-bar.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"top-app-bar.styles.d.ts","sourceRoot":"","sources":["../../src/app-bar/top-app-bar.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAoFlB,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
background-color: var(--u-top-app-bar-background-color, var(--u-color-background, var(--u-color-surface, rgb(254, 247, 255))));
|
|
6
|
+
color: var(--u-top-app-bar-text-color, var(--u-color-on-surface, rgb(29, 27, 32)));
|
|
7
|
+
transition: background-color 100ms, inset 375ms cubic-bezier(0.19, 1, 0.22, 1);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:host([container-scrolled]) {
|
|
11
|
+
background-color: var(--u-top-app-bar-elevated-background-color, var(--u-color-surface-container, rgb(243, 237, 247)));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:host(:not([has-leading-icon])) .leading-icon {
|
|
15
|
+
display: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host(:not([has-trailing-icon])) .trailing-icon {
|
|
19
|
+
display: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
slot[name=leading-icon],
|
|
23
|
+
slot[name=trailing-icon] {
|
|
24
|
+
display: inline-flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: var(--u-top-app-bar-icons-gap, 8px);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
slot[name=leading-icon]::slotted(u-icon-button) {
|
|
30
|
+
color: inherit;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host([position=absolute]) .content {
|
|
34
|
+
position: absolute;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host([position=fixed]) .content {
|
|
38
|
+
position: fixed;
|
|
39
|
+
inset-inline: 0;
|
|
40
|
+
inset-block-start: 0;
|
|
41
|
+
inset-inline-start: var(--u-app-bar-offset, 0);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:host([position=absolute]),
|
|
45
|
+
:host([position=fixed]) {
|
|
46
|
+
padding-top: var(--_content-height);
|
|
47
|
+
}
|
|
48
|
+
:host([position=absolute]) .content,
|
|
49
|
+
:host([position=fixed]) .content {
|
|
50
|
+
z-index: var(--u-fixed-app-bar-z-index, 1010);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.content {
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
background-color: inherit;
|
|
57
|
+
transition: inherit;
|
|
58
|
+
min-height: var(--u-top-app-bar-min-height, 56px);
|
|
59
|
+
}
|
|
60
|
+
@media (min-width: 840px) {
|
|
61
|
+
.content {
|
|
62
|
+
min-height: var(--u-top-app-bar-extended-min-height, 64px);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.headline {
|
|
67
|
+
font-family: var(--u-font-family, var(--u-font-family, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"));
|
|
68
|
+
line-height: var(--u-top-app-bar-headline-line-height, var(--u-title-l-line-height, 1.75rem));
|
|
69
|
+
font-size: var(--u-top-app-bar-headline-font-size, var(--u-title-l-font-size, 1.375rem));
|
|
70
|
+
letter-spacing: var(--u-top-app-bar-headline-letter-spacing, var(--u-title-l-letter-spacing, 0rem));
|
|
71
|
+
font-weight: var(--u-top-app-bar-headline-font-weight, var(--u-title-l-font-weight, var(--u-font-weight-regular, 400)));
|
|
72
|
+
margin-inline: var(--u-headline-margin, 16px);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.leading-icon {
|
|
76
|
+
margin-inline: var(--u-leading-icon-margin, 8px);
|
|
77
|
+
}
|
|
78
|
+
.leading-icon + .headline {
|
|
79
|
+
margin-inline-start: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.trailing-icon {
|
|
83
|
+
padding-inline: var(--u-trailing-icon-margin, 8px);
|
|
84
|
+
margin-inline-start: auto;
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
//# sourceMappingURL=top-app-bar.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"top-app-bar.styles.js","sourceRoot":"","sources":["../../src/app-bar/top-app-bar.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoFzB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css `\n :host {\n display: block;\n background-color: var(--u-top-app-bar-background-color, var(--u-color-background, var(--u-color-surface, rgb(254, 247, 255))));\n color: var(--u-top-app-bar-text-color, var(--u-color-on-surface, rgb(29, 27, 32)));\n transition: background-color 100ms, inset 375ms cubic-bezier(0.19, 1, 0.22, 1);\n }\n\n :host([container-scrolled]) {\n background-color: var(--u-top-app-bar-elevated-background-color, var(--u-color-surface-container, rgb(243, 237, 247)));\n }\n\n :host(:not([has-leading-icon])) .leading-icon {\n display: none;\n }\n\n :host(:not([has-trailing-icon])) .trailing-icon {\n display: none;\n }\n\n slot[name=leading-icon],\n slot[name=trailing-icon] {\n display: inline-flex;\n align-items: center;\n gap: var(--u-top-app-bar-icons-gap, 8px);\n }\n\n slot[name=leading-icon]::slotted(u-icon-button) {\n color: inherit;\n }\n\n :host([position=absolute]) .content {\n position: absolute;\n }\n\n :host([position=fixed]) .content {\n position: fixed;\n inset-inline: 0;\n inset-block-start: 0;\n inset-inline-start: var(--u-app-bar-offset, 0);\n }\n\n :host([position=absolute]),\n :host([position=fixed]) {\n padding-top: var(--_content-height);\n }\n :host([position=absolute]) .content,\n :host([position=fixed]) .content {\n z-index: var(--u-fixed-app-bar-z-index, 1010);\n }\n\n .content {\n display: flex;\n align-items: center;\n background-color: inherit;\n transition: inherit;\n min-height: var(--u-top-app-bar-min-height, 56px);\n }\n @media (min-width: 840px) {\n .content {\n min-height: var(--u-top-app-bar-extended-min-height, 64px);\n }\n }\n\n .headline {\n font-family: var(--u-font-family, var(--u-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"));\n line-height: var(--u-top-app-bar-headline-line-height, var(--u-title-l-line-height, 1.75rem));\n font-size: var(--u-top-app-bar-headline-font-size, var(--u-title-l-font-size, 1.375rem));\n letter-spacing: var(--u-top-app-bar-headline-letter-spacing, var(--u-title-l-letter-spacing, 0rem));\n font-weight: var(--u-top-app-bar-headline-font-weight, var(--u-title-l-font-weight, var(--u-font-weight-regular, 400)));\n margin-inline: var(--u-headline-margin, 16px);\n }\n\n .leading-icon {\n margin-inline: var(--u-leading-icon-margin, 8px);\n }\n .leading-icon + .headline {\n margin-inline-start: 0;\n }\n\n .trailing-icon {\n padding-inline: var(--u-trailing-icon-margin, 8px);\n margin-inline-start: auto;\n }\n`;\n"]}
|
package/button/button-base.d.ts
CHANGED
|
@@ -1,43 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import '../ripple/ripple.js';
|
|
4
|
-
export declare abstract class UmButtonBase extends LitElement {
|
|
1
|
+
import { UmButtonWrapper } from '../shared/button-wrapper';
|
|
2
|
+
export declare abstract class UmButtonBase extends UmButtonWrapper {
|
|
5
3
|
#private;
|
|
6
4
|
static readonly formAssociated = true;
|
|
7
|
-
/**
|
|
8
|
-
* Whether the button is disabled or not.
|
|
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: string;
|
|
20
5
|
type: string;
|
|
21
6
|
value: string;
|
|
22
|
-
name: string | undefined;
|
|
23
|
-
private readonly buttonElement;
|
|
24
|
-
private readonly ripple;
|
|
25
7
|
/**
|
|
26
8
|
* The `<form>` element to associate the button with (its form owner). The value of this attribute must be the id of a `<form>` in the same document. (If this attribute is not set, the button is associated with its ancestor `<form>` element, if any.)
|
|
27
9
|
* @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#form
|
|
28
10
|
*/
|
|
29
11
|
get form(): HTMLFormElement | null;
|
|
30
12
|
constructor();
|
|
31
|
-
protected render(): import("lit-html").TemplateResult<1>;
|
|
32
|
-
private renderButton;
|
|
33
|
-
private renderLink;
|
|
34
|
-
protected abstract renderContent(): HTMLTemplateResult;
|
|
35
|
-
connectedCallback(): void;
|
|
36
|
-
disconnectedCallback(): void;
|
|
37
|
-
focus(): void;
|
|
38
|
-
blur(): void;
|
|
39
|
-
protected getAriaLabel(): string | null | typeof nothing;
|
|
40
|
-
private innerHandleClick;
|
|
41
13
|
protected handleClick(_: UIEvent): void;
|
|
42
14
|
}
|
|
43
15
|
//# sourceMappingURL=button-base.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-base.d.ts","sourceRoot":"","sources":["../../src/button/button-base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"button-base.d.ts","sourceRoot":"","sources":["../../src/button/button-base.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,8BAAsB,YAAa,SAAQ,eAAe;;IAExD,MAAM,CAAC,QAAQ,CAAC,cAAc,QAAQ;IAE1B,IAAI,EAAE,MAAM,CAAY;IAET,KAAK,EAAE,MAAM,CAAM;IAE9C;;;OAGG;IACH,IACI,IAAI,IAAI,eAAe,GAAG,IAAI,CAEjC;;cASkB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI;CAmBjD"}
|
package/button/button-base.js
CHANGED
|
@@ -16,11 +16,9 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
16
16
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
17
17
|
};
|
|
18
18
|
var _UmButtonBase_elementInternals;
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
import '../ripple/ripple.js';
|
|
23
|
-
export class UmButtonBase extends LitElement {
|
|
19
|
+
import { property } from 'lit/decorators.js';
|
|
20
|
+
import { UmButtonWrapper } from '../shared/button-wrapper';
|
|
21
|
+
export class UmButtonBase extends UmButtonWrapper {
|
|
24
22
|
/**
|
|
25
23
|
* The `<form>` element to associate the button with (its form owner). The value of this attribute must be the id of a `<form>` in the same document. (If this attribute is not set, the button is associated with its ancestor `<form>` element, if any.)
|
|
26
24
|
* @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#form
|
|
@@ -30,80 +28,12 @@ export class UmButtonBase extends LitElement {
|
|
|
30
28
|
}
|
|
31
29
|
constructor() {
|
|
32
30
|
super();
|
|
33
|
-
/**
|
|
34
|
-
* Whether the button is disabled or not.
|
|
35
|
-
*/
|
|
36
|
-
this.disabled = false;
|
|
37
|
-
/**
|
|
38
|
-
* The URL that the link button points to.
|
|
39
|
-
*/
|
|
40
|
-
this.href = '';
|
|
41
|
-
/**
|
|
42
|
-
* Where to display the linked `href` URL for a link button. Common options
|
|
43
|
-
* include `_blank` to open in a new tab.
|
|
44
|
-
*/
|
|
45
|
-
this.target = '';
|
|
46
31
|
this.type = 'submit';
|
|
47
32
|
this.value = '';
|
|
48
33
|
_UmButtonBase_elementInternals.set(this, void 0);
|
|
49
34
|
__classPrivateFieldSet(this, _UmButtonBase_elementInternals, this.attachInternals(), "f");
|
|
50
35
|
}
|
|
51
|
-
|
|
52
|
-
return this.href
|
|
53
|
-
? this.renderLink()
|
|
54
|
-
: this.renderButton();
|
|
55
|
-
}
|
|
56
|
-
renderButton() {
|
|
57
|
-
return html `
|
|
58
|
-
<button
|
|
59
|
-
id="button"
|
|
60
|
-
class="button"
|
|
61
|
-
?disabled=${this.disabled}
|
|
62
|
-
aria-label="${this.getAriaLabel()}"
|
|
63
|
-
type="button">
|
|
64
|
-
<u-ripple ?disabled=${this.disabled}></u-ripple>
|
|
65
|
-
<u-elevation></u-elevation>
|
|
66
|
-
</button>
|
|
67
|
-
${this.renderContent()}`;
|
|
68
|
-
}
|
|
69
|
-
renderLink() {
|
|
70
|
-
return html `<a
|
|
71
|
-
id="link"
|
|
72
|
-
class="button"
|
|
73
|
-
href=${this.disabled ? nothing : this.href}
|
|
74
|
-
aria-disabled=${this.disabled || nothing}
|
|
75
|
-
aria-label="${this.getAriaLabel()}"
|
|
76
|
-
target=${this.target || nothing}>
|
|
77
|
-
<u-elevation></u-elevation>
|
|
78
|
-
<u-ripple ?disabled=${this.disabled}></u-ripple>
|
|
79
|
-
</a>
|
|
80
|
-
${this.renderContent()}`;
|
|
81
|
-
}
|
|
82
|
-
connectedCallback() {
|
|
83
|
-
super.connectedCallback();
|
|
84
|
-
this.addEventListener('click', this.innerHandleClick);
|
|
85
|
-
}
|
|
86
|
-
disconnectedCallback() {
|
|
87
|
-
super.disconnectedCallback();
|
|
88
|
-
this.removeEventListener('click', this.innerHandleClick);
|
|
89
|
-
}
|
|
90
|
-
focus() {
|
|
91
|
-
this.buttonElement?.focus();
|
|
92
|
-
}
|
|
93
|
-
blur() {
|
|
94
|
-
this.buttonElement?.blur();
|
|
95
|
-
}
|
|
96
|
-
getAriaLabel() {
|
|
97
|
-
return this.ariaLabel || nothing;
|
|
98
|
-
}
|
|
99
|
-
innerHandleClick(event) {
|
|
100
|
-
if (this.disabled) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (event.detail === 0) {
|
|
104
|
-
this.ripple.createRipple();
|
|
105
|
-
}
|
|
106
|
-
this.handleClick(event);
|
|
36
|
+
handleClick(_) {
|
|
107
37
|
if (this.type === 'button' || !!this.href) {
|
|
108
38
|
return;
|
|
109
39
|
}
|
|
@@ -117,35 +47,15 @@ export class UmButtonBase extends LitElement {
|
|
|
117
47
|
}
|
|
118
48
|
this.form.reset();
|
|
119
49
|
}
|
|
120
|
-
handleClick(_) {
|
|
121
|
-
}
|
|
122
50
|
}
|
|
123
51
|
_UmButtonBase_elementInternals = new WeakMap();
|
|
124
52
|
UmButtonBase.formAssociated = true;
|
|
125
|
-
__decorate([
|
|
126
|
-
property({ type: Boolean, reflect: true })
|
|
127
|
-
], UmButtonBase.prototype, "disabled", void 0);
|
|
128
|
-
__decorate([
|
|
129
|
-
property()
|
|
130
|
-
], UmButtonBase.prototype, "href", void 0);
|
|
131
|
-
__decorate([
|
|
132
|
-
property()
|
|
133
|
-
], UmButtonBase.prototype, "target", void 0);
|
|
134
53
|
__decorate([
|
|
135
54
|
property()
|
|
136
55
|
], UmButtonBase.prototype, "type", void 0);
|
|
137
56
|
__decorate([
|
|
138
57
|
property({ reflect: true })
|
|
139
58
|
], UmButtonBase.prototype, "value", void 0);
|
|
140
|
-
__decorate([
|
|
141
|
-
property()
|
|
142
|
-
], UmButtonBase.prototype, "name", void 0);
|
|
143
|
-
__decorate([
|
|
144
|
-
query('.button')
|
|
145
|
-
], UmButtonBase.prototype, "buttonElement", void 0);
|
|
146
|
-
__decorate([
|
|
147
|
-
query('u-ripple')
|
|
148
|
-
], UmButtonBase.prototype, "ripple", void 0);
|
|
149
59
|
__decorate([
|
|
150
60
|
property()
|
|
151
61
|
], UmButtonBase.prototype, "form", null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-base.js","sourceRoot":"","sources":["../../src/button/button-base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"button-base.js","sourceRoot":"","sources":["../../src/button/button-base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,OAAgB,YAAa,SAAQ,eAAe;IAQxD;;;OAGG;IAEH,IAAI,IAAI;QACN,OAAO,uBAAA,IAAI,sCAAkB,CAAC,IAAI,CAAC;IACrC,CAAC;IAID;QACE,KAAK,EAAE,CAAC;QAhBE,SAAI,GAAW,QAAQ,CAAC;QAET,UAAK,GAAW,EAAE,CAAC;QAWrC,iDAAoC;QAI3C,uBAAA,IAAI,kCAAqB,IAAI,CAAC,eAAe,EAAE,MAAA,CAAC;IAClD,CAAC;IAEkB,WAAW,CAAC,CAAU;QACvC,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAC1C,OAAO;QACT,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QAED,uBAAA,IAAI,sCAAkB,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEhD,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;;;AAvCe,2BAAc,GAAG,IAAI,AAAP,CAAQ;AAE1B;IAAX,QAAQ,EAAE;0CAAyB;AAET;IAA1B,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;2CAAoB;AAO9C;IADC,QAAQ,EAAE;wCAGV","sourcesContent":["import { property } from 'lit/decorators.js';\n\nimport { UmButtonWrapper } from '../shared/button-wrapper';\n\nexport abstract class UmButtonBase extends UmButtonWrapper {\n\n static readonly formAssociated = true;\n\n @property() type: string = 'submit';\n\n @property({reflect: true}) value: string = '';\n\n /**\n * The `<form>` element to associate the button with (its form owner). The value of this attribute must be the id of a `<form>` in the same document. (If this attribute is not set, the button is associated with its ancestor `<form>` element, if any.)\n * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#form\n */\n @property()\n get form(): HTMLFormElement | null {\n return this.#elementInternals.form;\n }\n\n readonly #elementInternals: ElementInternals;\n\n constructor() {\n super();\n this.#elementInternals = this.attachInternals();\n }\n\n protected override handleClick(_: UIEvent): void {\n if (this.type === 'button' || !!this.href) {\n return;\n }\n\n if (!this.form) {\n return;\n }\n\n this.#elementInternals.setFormValue(this.value);\n\n if (this.type === 'submit') {\n this.form.requestSubmit();\n return;\n }\n\n this.form.reset();\n }\n\n}\n"]}
|
package/button/button.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSResult, HTMLTemplateResult } from 'lit';
|
|
2
2
|
import { UmButtonBase } from './button-base';
|
|
3
|
-
import '../ripple/ripple
|
|
3
|
+
import '../ripple/ripple';
|
|
4
4
|
export type UmButtonVariant = 'filled' | 'tonal' | 'elevated' | 'outlined' | 'text';
|
|
5
5
|
export type UmButtonColor = 'primary' | 'secondary' | 'tertiary' | 'error' | undefined;
|
|
6
6
|
export declare class UmButton extends UmButtonBase {
|
package/button/button.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAQ,kBAAkB,EAAW,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAQ,kBAAkB,EAAW,MAAM,KAAK,CAAC;AAInE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,kBAAkB,CAAC;AAE1B,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;AACpF,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;AAEvF,qBACa,QAAS,SAAQ,YAAY;IAExC,OAAgB,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,CAAiC;IAEhF;;OAEG;IACwB,OAAO,EAAE,eAAe,CAAY;IAE/D;;;;OAIG;IACwB,KAAK,EAAE,aAAa,CAAC;IAEsB,YAAY,UAAS;IAE3F;;;;OAIG;IAC8D,OAAO,UAAS;IAGjF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;cAE5B,aAAa,IAAI,kBAAkB;IAgBtD,OAAO,CAAC,gBAAgB;CAGzB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,QAAQ,CAAC;KACtB;CACF"}
|
package/button/button.js
CHANGED
|
@@ -6,10 +6,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html, nothing } from 'lit';
|
|
8
8
|
import { customElement, property, queryAssignedElements } from 'lit/decorators.js';
|
|
9
|
+
import { styles as buttonWrapperStyles } from '../shared/button-wrapper.styles';
|
|
9
10
|
import { UmButtonBase } from './button-base';
|
|
10
|
-
import { styles as buttonBaseStyles } from './button-base.styles';
|
|
11
11
|
import { styles } from './button.styles';
|
|
12
|
-
import '../ripple/ripple
|
|
12
|
+
import '../ripple/ripple';
|
|
13
13
|
let UmButton = class UmButton extends UmButtonBase {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
@@ -27,10 +27,12 @@ let UmButton = class UmButton extends UmButtonBase {
|
|
|
27
27
|
}
|
|
28
28
|
renderContent() {
|
|
29
29
|
const icon = html `
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
<span class="icon">
|
|
31
|
+
<slot
|
|
32
|
+
name="icon"
|
|
33
|
+
aria-hidden="true"
|
|
34
|
+
@slotchange="${this.handleSlotChange}"></slot>
|
|
35
|
+
</span>`;
|
|
34
36
|
return html `
|
|
35
37
|
${this.trailingIcon ? nothing : icon}
|
|
36
38
|
<span><slot></slot></span>
|
|
@@ -41,7 +43,7 @@ let UmButton = class UmButton extends UmButtonBase {
|
|
|
41
43
|
this.hasIcon = this.assignedIcons.length > 0;
|
|
42
44
|
}
|
|
43
45
|
};
|
|
44
|
-
UmButton.styles = [
|
|
46
|
+
UmButton.styles = [buttonWrapperStyles, styles];
|
|
45
47
|
__decorate([
|
|
46
48
|
property({ reflect: true })
|
|
47
49
|
], UmButton.prototype, "variant", void 0);
|
package/button/button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAa,IAAI,EAAsB,OAAO,EAAE,MAAM,KAAK,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEnF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAa,IAAI,EAAsB,OAAO,EAAE,MAAM,KAAK,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEnF,OAAO,EAAE,MAAM,IAAI,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,kBAAkB,CAAC;AAMnB,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,YAAY;IAAnC;;QAIL;;WAEG;QACwB,YAAO,GAAoB,QAAQ,CAAC;QASO,iBAAY,GAAG,KAAK,CAAC;QAE3F;;;;WAIG;QAC8D,YAAO,GAAG,KAAK,CAAC;IAwBnF,CAAC;IAnBoB,aAAa;QAC9B,MAAM,IAAI,GAAG,IAAI,CAAA;;;;;yBAKI,IAAI,CAAC,gBAAgB;cAChC,CAAC;QAEX,OAAO,IAAI,CAAA;QACP,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;;QAElC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO;KACrC,CAAC;IACJ,CAAC;IAEO,gBAAgB;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/C,CAAC;;AA5Ce,eAAM,GAA4B,CAAC,mBAAmB,EAAE,MAAM,CAAC,AAAzD,CAA0D;AAKrD;IAA1B,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;yCAAqC;AAOpC;IAA1B,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;uCAAsB;AAEsB;IAArE,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;8CAAsB;AAO1B;IAAhE,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;yCAAiB;AAGhE;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;+CACN;AA1BpC,QAAQ;IADpB,aAAa,CAAC,UAAU,CAAC;GACb,QAAQ,CA+CpB","sourcesContent":["import { CSSResult, html, HTMLTemplateResult, nothing } from 'lit';\nimport { customElement, property, queryAssignedElements } from 'lit/decorators.js';\n\nimport { styles as buttonWrapperStyles } from '../shared/button-wrapper.styles';\nimport { UmButtonBase } from './button-base';\nimport { styles } from './button.styles';\nimport '../ripple/ripple';\n\nexport type UmButtonVariant = 'filled' | 'tonal' | 'elevated' | 'outlined' | 'text';\nexport type UmButtonColor = 'primary' | 'secondary' | 'tertiary' | 'error' | undefined;\n\n@customElement('u-button')\nexport class UmButton extends UmButtonBase {\n\n static override styles: CSSResult | CSSResult[] = [buttonWrapperStyles, styles];\n\n /**\n * The Button variant to render\n */\n @property({reflect: true}) variant: UmButtonVariant = 'filled';\n\n /**\n * The Button color\n *\n * _Note:_ Filled buttons only\n */\n @property({reflect: true}) color: UmButtonColor;\n\n @property({type: Boolean, attribute: 'trailing-icon', reflect: true}) trailingIcon = false;\n\n /**\n * Whether the button has icon or not\n *\n * _Note:_ Readonly\n */\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`\n <span class=\"icon\">\n <slot\n name=\"icon\"\n aria-hidden=\"true\"\n @slotchange=\"${this.handleSlotChange}\"></slot>\n </span>`;\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': UmButton;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.styles.d.ts","sourceRoot":"","sources":["../../src/button/button.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"button.styles.d.ts","sourceRoot":"","sources":["../../src/button/button.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAiGlB,CAAC"}
|
package/button/button.styles.js
CHANGED
|
@@ -6,9 +6,11 @@ export const styles = css `
|
|
|
6
6
|
--u-common-button-font-weight: var(--u-font-weight-medium, 500);
|
|
7
7
|
--_common-button-height: var(--u-common-button-height, 2.5rem);
|
|
8
8
|
--_common-button-padding: var(--u-common-button-padding, 24px);
|
|
9
|
+
--_common-button-icon-size: var(--u-common-button-icon-size, 1.125rem);
|
|
9
10
|
--_common-button-icon-padding: var(--u-common-button-icon-padding, 16px);
|
|
11
|
+
--_common-button-icon-margin: var(--u-common-button-icon-margin, 8px);
|
|
10
12
|
border-radius: var(--u-common-button-shape-corner, var(--u-shape-corner-full, 9999px));
|
|
11
|
-
font-family: var(--u-font-family-
|
|
13
|
+
font-family: var(--u-font-family, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");
|
|
12
14
|
height: var(--u-common-button-height, 40px);
|
|
13
15
|
font-size: var(--u-common-button-font-size);
|
|
14
16
|
font-weight: var(--u-common-button-font-weight);
|
|
@@ -80,17 +82,19 @@ export const styles = css `
|
|
|
80
82
|
padding-inline: var(--_common-button-padding) var(--_common-button-icon-padding);
|
|
81
83
|
}
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
display:
|
|
85
|
-
width: var(--u-common-button-icon-size, 1.125rem);
|
|
86
|
-
height: var(--u-common-button-icon-size, 1.125rem);
|
|
87
|
-
margin-inline-end: 8px;
|
|
88
|
-
font-size: var(--u-common-button-icon-size, 1.125rem);
|
|
89
|
-
line-height: var(--u-common-button-icon-size, 1.125rem);
|
|
85
|
+
:host(:not([has-icon])) .icon {
|
|
86
|
+
display: none;
|
|
90
87
|
}
|
|
91
88
|
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
.icon {
|
|
90
|
+
font-size: var(--_common-button-icon-size);
|
|
91
|
+
padding-inline-end: var(--_common-button-icon-margin);
|
|
92
|
+
margin-inline-end: auto;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:host([trailing-icon]) .icon {
|
|
96
|
+
padding-inline: var(--_common-button-icon-margin) 0;
|
|
97
|
+
margin-inline: auto 0;
|
|
94
98
|
}
|
|
95
99
|
`;
|
|
96
100
|
//# sourceMappingURL=button.styles.js.map
|