@francofantomius/material-components 1.0.1 → 1.1.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 +39 -0
- package/README.md +41 -9
- package/custom-elements.json +19060 -9017
- package/dist/chunks/account-menu-Dau0UHTl.js +1290 -0
- package/dist/chunks/account-menu-Dau0UHTl.js.map +1 -0
- package/dist/chunks/app-drawer-Du1ePzxZ.js +903 -0
- package/dist/chunks/app-drawer-Du1ePzxZ.js.map +1 -0
- package/dist/chunks/bottom-sheet-q79BBYAj.js +402 -0
- package/dist/chunks/bottom-sheet-q79BBYAj.js.map +1 -0
- package/dist/chunks/{button-B4TSZ7Sl.js → button-D2vn7kJ8.js} +9 -8
- package/dist/chunks/button-D2vn7kJ8.js.map +1 -0
- package/dist/chunks/button-group-CNqvJx1n.js +143 -0
- package/dist/chunks/button-group-CNqvJx1n.js.map +1 -0
- package/dist/chunks/carousel-item-BG6kjjjk.js +371 -0
- package/dist/chunks/carousel-item-BG6kjjjk.js.map +1 -0
- package/dist/chunks/date-picker-DJeHi4w-.js +777 -0
- package/dist/chunks/date-picker-DJeHi4w-.js.map +1 -0
- package/dist/chunks/fab-menu.css-3pu930sZ.js +320 -0
- package/dist/chunks/fab-menu.css-3pu930sZ.js.map +1 -0
- package/dist/chunks/{icon-button-BdSc7eot.js → icon-button-BQz73GLa.js} +2 -2
- package/dist/chunks/icon-button-BQz73GLa.js.map +1 -0
- package/dist/chunks/loading-indicator-CvWnZr9o.js +193 -0
- package/dist/chunks/loading-indicator-CvWnZr9o.js.map +1 -0
- package/dist/chunks/menu-item-BBSp5Cqc.js +390 -0
- package/dist/chunks/menu-item-BBSp5Cqc.js.map +1 -0
- package/dist/chunks/navigation-bar-item-C9DfOEzg.js +397 -0
- package/dist/chunks/navigation-bar-item-C9DfOEzg.js.map +1 -0
- package/dist/chunks/navigation-rail-item-6pdhNHJK.js +357 -0
- package/dist/chunks/navigation-rail-item-6pdhNHJK.js.map +1 -0
- package/dist/chunks/segmented-button-B0BvGSQ7.js +265 -0
- package/dist/chunks/segmented-button-B0BvGSQ7.js.map +1 -0
- package/dist/chunks/side-sheet-S2w081AK.js +360 -0
- package/dist/chunks/side-sheet-S2w081AK.js.map +1 -0
- package/dist/chunks/slider-D-mnO8yQ.js +450 -0
- package/dist/chunks/slider-D-mnO8yQ.js.map +1 -0
- package/dist/chunks/split-button-DUfjukQY.js +450 -0
- package/dist/chunks/split-button-DUfjukQY.js.map +1 -0
- package/dist/chunks/{table-aRTYzDyE.js → table-CqHnneAj.js} +2 -2
- package/dist/chunks/{table-aRTYzDyE.js.map → table-CqHnneAj.js.map} +1 -1
- package/dist/chunks/time-picker-CZnb2sWz.js +785 -0
- package/dist/chunks/time-picker-CZnb2sWz.js.map +1 -0
- package/dist/chunks/toolbar-DXVQbQKJ.js +271 -0
- package/dist/chunks/toolbar-DXVQbQKJ.js.map +1 -0
- package/dist/chunks/tooltip-CE7JMHMu.js +398 -0
- package/dist/chunks/tooltip-CE7JMHMu.js.map +1 -0
- package/dist/components/account-menu/account-menu.js +8 -0
- package/dist/components/app-drawer/app-drawer.js +9 -0
- package/dist/components/bottom-sheet/bottom-sheet.css.d.ts +2 -0
- package/dist/components/bottom-sheet/bottom-sheet.css.d.ts.map +1 -0
- package/dist/components/bottom-sheet/bottom-sheet.d.ts +69 -0
- package/dist/components/bottom-sheet/bottom-sheet.d.ts.map +1 -0
- package/dist/components/bottom-sheet/bottom-sheet.js +4 -0
- package/dist/components/button/button.css.d.ts.map +1 -1
- package/dist/components/button/button.js +1 -1
- package/dist/components/button-group/button-group.css.d.ts +2 -0
- package/dist/components/button-group/button-group.css.d.ts.map +1 -0
- package/dist/components/button-group/button-group.d.ts +28 -0
- package/dist/components/button-group/button-group.d.ts.map +1 -0
- package/dist/components/button-group/button-group.js +4 -0
- package/dist/components/carousel/carousel-item.d.ts +33 -0
- package/dist/components/carousel/carousel-item.d.ts.map +1 -0
- package/dist/components/carousel/carousel-item.js +4 -0
- package/dist/components/carousel/carousel.css.d.ts +3 -0
- package/dist/components/carousel/carousel.css.d.ts.map +1 -0
- package/dist/components/carousel/carousel.d.ts +81 -0
- package/dist/components/carousel/carousel.d.ts.map +1 -0
- package/dist/components/carousel/carousel.js +284 -0
- package/dist/components/carousel/carousel.js.map +1 -0
- package/dist/components/date-picker/date-picker.css.d.ts +2 -0
- package/dist/components/date-picker/date-picker.css.d.ts.map +1 -0
- package/dist/components/date-picker/date-picker.d.ts +59 -0
- package/dist/components/date-picker/date-picker.d.ts.map +1 -0
- package/dist/components/date-picker/date-picker.js +4 -0
- package/dist/components/fab-menu/fab-menu-item.d.ts +35 -0
- package/dist/components/fab-menu/fab-menu-item.d.ts.map +1 -0
- package/dist/components/fab-menu/fab-menu-item.js +93 -0
- package/dist/components/fab-menu/fab-menu-item.js.map +1 -0
- package/dist/components/fab-menu/fab-menu.css.d.ts +3 -0
- package/dist/components/fab-menu/fab-menu.css.d.ts.map +1 -0
- package/dist/components/fab-menu/fab-menu.d.ts +72 -0
- package/dist/components/fab-menu/fab-menu.d.ts.map +1 -0
- package/dist/components/fab-menu/fab-menu.js +148 -0
- package/dist/components/fab-menu/fab-menu.js.map +1 -0
- package/dist/components/icon-button/icon-button.js +1 -1
- package/dist/components/loading-indicator/loading-indicator.css.d.ts +2 -0
- package/dist/components/loading-indicator/loading-indicator.css.d.ts.map +1 -0
- package/dist/components/loading-indicator/loading-indicator.d.ts +48 -0
- package/dist/components/loading-indicator/loading-indicator.d.ts.map +1 -0
- package/dist/components/loading-indicator/loading-indicator.js +4 -0
- package/dist/components/menu/menu-item.d.ts +41 -0
- package/dist/components/menu/menu-item.d.ts.map +1 -0
- package/dist/components/menu/menu-item.js +4 -0
- package/dist/components/menu/menu.css.d.ts +3 -0
- package/dist/components/menu/menu.css.d.ts.map +1 -0
- package/dist/components/menu/menu.d.ts +91 -0
- package/dist/components/menu/menu.d.ts.map +1 -0
- package/dist/components/menu/menu.js +205 -0
- package/dist/components/menu/menu.js.map +1 -0
- package/dist/components/navigation-bar/navigation-bar-item.d.ts +49 -0
- package/dist/components/navigation-bar/navigation-bar-item.d.ts.map +1 -0
- package/dist/components/navigation-bar/navigation-bar-item.js +5 -0
- package/dist/components/navigation-bar/navigation-bar.css.d.ts +3 -0
- package/dist/components/navigation-bar/navigation-bar.css.d.ts.map +1 -0
- package/dist/components/navigation-bar/navigation-bar.d.ts +50 -0
- package/dist/components/navigation-bar/navigation-bar.d.ts.map +1 -0
- package/dist/components/navigation-bar/navigation-bar.js +150 -0
- package/dist/components/navigation-bar/navigation-bar.js.map +1 -0
- package/dist/components/navigation-rail/navigation-rail-item.d.ts +36 -0
- package/dist/components/navigation-rail/navigation-rail-item.d.ts.map +1 -0
- package/dist/components/navigation-rail/navigation-rail-item.js +5 -0
- package/dist/components/navigation-rail/navigation-rail.css.d.ts +3 -0
- package/dist/components/navigation-rail/navigation-rail.css.d.ts.map +1 -0
- package/dist/components/navigation-rail/navigation-rail.d.ts +43 -0
- package/dist/components/navigation-rail/navigation-rail.d.ts.map +1 -0
- package/dist/components/navigation-rail/navigation-rail.js +121 -0
- package/dist/components/navigation-rail/navigation-rail.js.map +1 -0
- package/dist/components/segmented-button/segmented-button.css.d.ts +3 -0
- package/dist/components/segmented-button/segmented-button.css.d.ts.map +1 -0
- package/dist/components/segmented-button/segmented-button.d.ts +40 -0
- package/dist/components/segmented-button/segmented-button.d.ts.map +1 -0
- package/dist/components/segmented-button/segmented-button.js +5 -0
- package/dist/components/side-sheet/side-sheet.css.d.ts +2 -0
- package/dist/components/side-sheet/side-sheet.css.d.ts.map +1 -0
- package/dist/components/side-sheet/side-sheet.d.ts +57 -0
- package/dist/components/side-sheet/side-sheet.d.ts.map +1 -0
- package/dist/components/side-sheet/side-sheet.js +4 -0
- package/dist/components/slider/slider.css.d.ts +2 -0
- package/dist/components/slider/slider.css.d.ts.map +1 -0
- package/dist/components/slider/slider.d.ts +51 -0
- package/dist/components/slider/slider.d.ts.map +1 -0
- package/dist/components/slider/slider.js +4 -0
- package/dist/components/split-button/split-button.css.d.ts +2 -0
- package/dist/components/split-button/split-button.css.d.ts.map +1 -0
- package/dist/components/split-button/split-button.d.ts +89 -0
- package/dist/components/split-button/split-button.d.ts.map +1 -0
- package/dist/components/split-button/split-button.js +4 -0
- package/dist/components/table/table.js +1 -1
- package/dist/components/time-picker/time-picker.css.d.ts +2 -0
- package/dist/components/time-picker/time-picker.css.d.ts.map +1 -0
- package/dist/components/time-picker/time-picker.d.ts +87 -0
- package/dist/components/time-picker/time-picker.d.ts.map +1 -0
- package/dist/components/time-picker/time-picker.js +4 -0
- package/dist/components/toolbar/toolbar.css.d.ts +2 -0
- package/dist/components/toolbar/toolbar.css.d.ts.map +1 -0
- package/dist/components/toolbar/toolbar.d.ts +53 -0
- package/dist/components/toolbar/toolbar.d.ts.map +1 -0
- package/dist/components/toolbar/toolbar.js +4 -0
- package/dist/components/tooltip/tooltip.css.d.ts +2 -0
- package/dist/components/tooltip/tooltip.css.d.ts.map +1 -0
- package/dist/components/tooltip/tooltip.d.ts +89 -0
- package/dist/components/tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip/tooltip.js +4 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +148 -2263
- package/dist/tokens/index.js +4 -2
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/theme.css.d.ts.map +1 -1
- package/llms.txt +2326 -0
- package/package.json +99 -2
- package/dist/chunks/button-B4TSZ7Sl.js.map +0 -1
- package/dist/chunks/icon-button-BdSc7eot.js.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { n as l, t as e } 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 c, html as r, nothing as o } from "lit";
|
|
6
|
+
import { customElement as h, property as t } from "lit/decorators.js";
|
|
7
|
+
var w = c`
|
|
8
|
+
:host {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
width: var(--md-navigation-rail-width, 80px);
|
|
12
|
+
min-width: var(--md-navigation-rail-width, 80px);
|
|
13
|
+
height: var(--md-navigation-rail-height, 100%);
|
|
14
|
+
min-height: 100%;
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
background-color: var(--md-navigation-rail-container-color, var(--md-sys-color-surface, #FEF7FF));
|
|
17
|
+
color: var(--md-navigation-rail-on-container-color, var(--md-sys-color-on-surface, #1D1B20));
|
|
18
|
+
border-right: var(--md-navigation-rail-border, 1px solid var(--md-sys-color-outline-variant, #CAC4D0));
|
|
19
|
+
font-family: var(--md-sys-typescale-font-family, inherit);
|
|
20
|
+
user-select: none;
|
|
21
|
+
position: relative;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.rail {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
align-items: center;
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
padding: 12px 0;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
overflow-y: auto;
|
|
33
|
+
overflow-x: hidden;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.rail::-webkit-scrollbar {
|
|
37
|
+
width: 4px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rail::-webkit-scrollbar-thumb {
|
|
41
|
+
background-color: var(--md-sys-color-outline-variant, #CAC4D0);
|
|
42
|
+
border-radius: 4px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.header {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: 12px;
|
|
50
|
+
margin-bottom: 12px;
|
|
51
|
+
width: 100%;
|
|
52
|
+
flex-shrink: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.destinations {
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: 12px;
|
|
60
|
+
width: 100%;
|
|
61
|
+
flex: 1;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Alignment Variants */
|
|
65
|
+
:host([alignment="top"]) .destinations {
|
|
66
|
+
justify-content: flex-start;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
:host([alignment="center"]) .destinations {
|
|
70
|
+
justify-content: center;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:host([alignment="bottom"]) .destinations {
|
|
74
|
+
justify-content: flex-end;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.footer {
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
align-items: center;
|
|
81
|
+
gap: 8px;
|
|
82
|
+
margin-top: auto;
|
|
83
|
+
width: 100%;
|
|
84
|
+
padding-top: 12px;
|
|
85
|
+
flex-shrink: 0;
|
|
86
|
+
}
|
|
87
|
+
`, m = c`
|
|
88
|
+
:host {
|
|
89
|
+
display: block;
|
|
90
|
+
width: 100%;
|
|
91
|
+
box-sizing: border-box;
|
|
92
|
+
outline: none;
|
|
93
|
+
-webkit-tap-highlight-color: transparent;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
:host([disabled]) {
|
|
97
|
+
pointer-events: none;
|
|
98
|
+
opacity: 0.38;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.item {
|
|
102
|
+
position: relative;
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
align-items: center;
|
|
106
|
+
justify-content: center;
|
|
107
|
+
width: 100%;
|
|
108
|
+
min-height: 56px;
|
|
109
|
+
padding: 4px 0 8px 0;
|
|
110
|
+
box-sizing: border-box;
|
|
111
|
+
font-family: var(--md-sys-typescale-font-family, inherit);
|
|
112
|
+
color: var(--md-sys-color-on-surface-variant, #49454F);
|
|
113
|
+
text-decoration: none;
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
outline: none;
|
|
116
|
+
border-radius: 12px;
|
|
117
|
+
transition: color 150ms cubic-bezier(0.2, 0, 0, 1);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.indicator-wrapper {
|
|
121
|
+
position: relative;
|
|
122
|
+
display: flex;
|
|
123
|
+
align-items: center;
|
|
124
|
+
justify-content: center;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.active-indicator {
|
|
128
|
+
position: relative;
|
|
129
|
+
display: inline-flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
width: var(--md-navigation-rail-indicator-width, 56px);
|
|
133
|
+
height: var(--md-navigation-rail-indicator-height, 32px);
|
|
134
|
+
border-radius: var(--md-navigation-rail-indicator-shape, 16px);
|
|
135
|
+
background-color: transparent;
|
|
136
|
+
color: var(--md-sys-color-on-surface-variant, #49454F);
|
|
137
|
+
transition: background-color 200ms cubic-bezier(0.2, 0, 0, 1),
|
|
138
|
+
color 200ms cubic-bezier(0.2, 0, 0, 1);
|
|
139
|
+
overflow: hidden;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.item:hover .active-indicator {
|
|
143
|
+
background-color: var(--md-sys-color-surface-container-high, #ECE6F0);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* Active / Selected State */
|
|
147
|
+
:host([active]) .active-indicator,
|
|
148
|
+
:host([selected]) .active-indicator {
|
|
149
|
+
background-color: var(--md-navigation-rail-active-indicator-color, var(--md-sys-color-secondary-container, #E8DEF8));
|
|
150
|
+
color: var(--md-navigation-rail-active-icon-color, var(--md-sys-color-on-secondary-container, #1D192B));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
:host([active]) .item:hover .active-indicator,
|
|
154
|
+
:host([selected]) .item:hover .active-indicator {
|
|
155
|
+
background-color: var(--md-navigation-rail-active-indicator-hover-color, var(--md-sys-color-secondary-container, #E8DEF8));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.icon-slot {
|
|
159
|
+
display: inline-flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
justify-content: center;
|
|
162
|
+
color: inherit;
|
|
163
|
+
font-size: 24px;
|
|
164
|
+
line-height: 1;
|
|
165
|
+
z-index: 1;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.label-container {
|
|
169
|
+
display: flex;
|
|
170
|
+
justify-content: center;
|
|
171
|
+
align-items: center;
|
|
172
|
+
width: 100%;
|
|
173
|
+
margin-top: 4px;
|
|
174
|
+
box-sizing: border-box;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.label {
|
|
178
|
+
font-size: var(--md-sys-typescale-label-medium-size, 12px);
|
|
179
|
+
line-height: var(--md-sys-typescale-label-medium-line-height, 16px);
|
|
180
|
+
font-weight: 500;
|
|
181
|
+
letter-spacing: 0.5px;
|
|
182
|
+
text-align: center;
|
|
183
|
+
max-width: 72px;
|
|
184
|
+
overflow: hidden;
|
|
185
|
+
text-overflow: ellipsis;
|
|
186
|
+
white-space: nowrap;
|
|
187
|
+
color: var(--md-navigation-rail-label-color, var(--md-sys-color-on-surface-variant, #49454F));
|
|
188
|
+
transition: color 150ms cubic-bezier(0.2, 0, 0, 1),
|
|
189
|
+
font-weight 150ms cubic-bezier(0.2, 0, 0, 1);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
:host([active]) .label,
|
|
193
|
+
:host([selected]) .label {
|
|
194
|
+
color: var(--md-navigation-rail-active-label-color, var(--md-sys-color-on-surface, #1D1B20));
|
|
195
|
+
font-weight: 700;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
:host([hide-label]) .label-container,
|
|
199
|
+
:host([hide-labels]) .label-container {
|
|
200
|
+
display: none;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* Badge styling */
|
|
204
|
+
.badge-slot {
|
|
205
|
+
position: absolute;
|
|
206
|
+
top: -2px;
|
|
207
|
+
right: 4px;
|
|
208
|
+
z-index: 2;
|
|
209
|
+
pointer-events: none;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.badge {
|
|
213
|
+
display: inline-flex;
|
|
214
|
+
align-items: center;
|
|
215
|
+
justify-content: center;
|
|
216
|
+
min-width: 16px;
|
|
217
|
+
height: 16px;
|
|
218
|
+
padding: 0 4px;
|
|
219
|
+
border-radius: 8px;
|
|
220
|
+
font-size: 11px;
|
|
221
|
+
font-weight: 600;
|
|
222
|
+
line-height: 1;
|
|
223
|
+
background-color: var(--md-sys-color-error, #B3261E);
|
|
224
|
+
color: var(--md-sys-color-on-error, #FFFFFF);
|
|
225
|
+
box-sizing: border-box;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.badge.dot {
|
|
229
|
+
min-width: 6px;
|
|
230
|
+
width: 6px;
|
|
231
|
+
height: 6px;
|
|
232
|
+
padding: 0;
|
|
233
|
+
border-radius: 50%;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
:host([active]) .badge,
|
|
237
|
+
:host([selected]) .badge {
|
|
238
|
+
background-color: var(--md-sys-color-error, #B3261E);
|
|
239
|
+
color: var(--md-sys-color-on-error, #FFFFFF);
|
|
240
|
+
}
|
|
241
|
+
`, i = class extends l {
|
|
242
|
+
constructor(...a) {
|
|
243
|
+
super(...a), this.icon = "", this.activeIcon = "", this.label = "", this.headline = "", this.badge = "", this.badgeDot = !1, this.active = !1, this.selected = !1, this.disabled = !1, this.hideLabel = !1, this.href = "", this.target = "", this.value = "", this.handleClick = (n) => {
|
|
244
|
+
if (this.disabled) {
|
|
245
|
+
n.preventDefault(), n.stopImmediatePropagation();
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
this.emitEvent("item-click", {
|
|
249
|
+
label: this.label || this.headline,
|
|
250
|
+
icon: this.icon,
|
|
251
|
+
active: this.active,
|
|
252
|
+
value: this.value,
|
|
253
|
+
item: this
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
static {
|
|
258
|
+
this.styles = [l.styles, m];
|
|
259
|
+
}
|
|
260
|
+
willUpdate(a) {
|
|
261
|
+
super.willUpdate(a), a.has("active") && !a.has("selected") ? this.selected = this.active : a.has("selected") && !a.has("active") ? this.active = this.selected : a.has("active") && a.has("selected") && (this.active ? this.selected = !0 : this.selected && (this.active = !0));
|
|
262
|
+
}
|
|
263
|
+
render() {
|
|
264
|
+
const a = this.label || this.headline, n = this.active && this.activeIcon ? this.activeIcon : this.icon, v = () => this.badgeDot ? r`<span class="badge dot"></span>` : this.badge ? r`<span class="badge">${this.badge}</span>` : o, s = r`
|
|
265
|
+
<div class="indicator-wrapper">
|
|
266
|
+
<div class="active-indicator">
|
|
267
|
+
<md-ripple ?disabled=${this.disabled}></md-ripple>
|
|
268
|
+
<md-focus-ring></md-focus-ring>
|
|
269
|
+
<span class="icon-slot">
|
|
270
|
+
<slot name="icon">
|
|
271
|
+
${n ? r`<md-icon name=${n}></md-icon>` : o}
|
|
272
|
+
</slot>
|
|
273
|
+
</span>
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
<div class="badge-slot">
|
|
277
|
+
<slot name="badge">
|
|
278
|
+
${v()}
|
|
279
|
+
</slot>
|
|
280
|
+
</div>
|
|
281
|
+
</div>
|
|
282
|
+
|
|
283
|
+
<div class="label-container">
|
|
284
|
+
<slot>
|
|
285
|
+
${a ? r`<span class="label">${a}</span>` : o}
|
|
286
|
+
</slot>
|
|
287
|
+
</div>
|
|
288
|
+
`;
|
|
289
|
+
return this.href ? r`
|
|
290
|
+
<a
|
|
291
|
+
class="item"
|
|
292
|
+
href=${this.disabled ? o : this.href}
|
|
293
|
+
target=${this.target || o}
|
|
294
|
+
aria-disabled=${this.disabled ? "true" : o}
|
|
295
|
+
aria-current=${this.active ? "page" : o}
|
|
296
|
+
tabindex=${this.disabled ? "-1" : "0"}
|
|
297
|
+
@click=${this.handleClick}
|
|
298
|
+
>
|
|
299
|
+
${s}
|
|
300
|
+
</a>
|
|
301
|
+
` : r`
|
|
302
|
+
<div
|
|
303
|
+
class="item"
|
|
304
|
+
role="button"
|
|
305
|
+
tabindex=${this.disabled ? "-1" : "0"}
|
|
306
|
+
aria-disabled=${this.disabled ? "true" : o}
|
|
307
|
+
aria-pressed=${this.active ? "true" : "false"}
|
|
308
|
+
@click=${this.handleClick}
|
|
309
|
+
>
|
|
310
|
+
${s}
|
|
311
|
+
</div>
|
|
312
|
+
`;
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
e([t({ type: String })], i.prototype, "icon", void 0);
|
|
316
|
+
e([t({
|
|
317
|
+
type: String,
|
|
318
|
+
attribute: "active-icon"
|
|
319
|
+
})], i.prototype, "activeIcon", void 0);
|
|
320
|
+
e([t({ type: String })], i.prototype, "label", void 0);
|
|
321
|
+
e([t({ type: String })], i.prototype, "headline", void 0);
|
|
322
|
+
e([t({ type: String })], i.prototype, "badge", void 0);
|
|
323
|
+
e([t({
|
|
324
|
+
type: Boolean,
|
|
325
|
+
attribute: "badge-dot"
|
|
326
|
+
})], i.prototype, "badgeDot", void 0);
|
|
327
|
+
e([t({
|
|
328
|
+
type: Boolean,
|
|
329
|
+
reflect: !0
|
|
330
|
+
})], i.prototype, "active", void 0);
|
|
331
|
+
e([t({
|
|
332
|
+
type: Boolean,
|
|
333
|
+
reflect: !0
|
|
334
|
+
})], i.prototype, "selected", void 0);
|
|
335
|
+
e([t({
|
|
336
|
+
type: Boolean,
|
|
337
|
+
reflect: !0
|
|
338
|
+
})], i.prototype, "disabled", void 0);
|
|
339
|
+
e([t({
|
|
340
|
+
type: Boolean,
|
|
341
|
+
reflect: !0,
|
|
342
|
+
attribute: "hide-label"
|
|
343
|
+
})], i.prototype, "hideLabel", void 0);
|
|
344
|
+
e([t({ type: String })], i.prototype, "href", void 0);
|
|
345
|
+
e([t({ type: String })], i.prototype, "target", void 0);
|
|
346
|
+
e([t({ type: String })], i.prototype, "value", void 0);
|
|
347
|
+
i = e([h("md-navigation-rail-item")], i);
|
|
348
|
+
var d = class extends i {
|
|
349
|
+
};
|
|
350
|
+
d = e([h("md-nav-rail-item")], d);
|
|
351
|
+
export {
|
|
352
|
+
i as n,
|
|
353
|
+
w as r,
|
|
354
|
+
d as t
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
//# sourceMappingURL=navigation-rail-item-6pdhNHJK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-rail-item-6pdhNHJK.js","names":[],"sources":["../../src/components/navigation-rail/navigation-rail.css.ts","../../src/components/navigation-rail/navigation-rail-item.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const navigationRailStyles = css`\n :host {\n display: inline-flex;\n flex-direction: column;\n width: var(--md-navigation-rail-width, 80px);\n min-width: var(--md-navigation-rail-width, 80px);\n height: var(--md-navigation-rail-height, 100%);\n min-height: 100%;\n box-sizing: border-box;\n background-color: var(--md-navigation-rail-container-color, var(--md-sys-color-surface, #FEF7FF));\n color: var(--md-navigation-rail-on-container-color, var(--md-sys-color-on-surface, #1D1B20));\n border-right: var(--md-navigation-rail-border, 1px solid var(--md-sys-color-outline-variant, #CAC4D0));\n font-family: var(--md-sys-typescale-font-family, inherit);\n user-select: none;\n position: relative;\n }\n\n .rail {\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n height: 100%;\n padding: 12px 0;\n box-sizing: border-box;\n overflow-y: auto;\n overflow-x: hidden;\n }\n\n .rail::-webkit-scrollbar {\n width: 4px;\n }\n\n .rail::-webkit-scrollbar-thumb {\n background-color: var(--md-sys-color-outline-variant, #CAC4D0);\n border-radius: 4px;\n }\n\n .header {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n margin-bottom: 12px;\n width: 100%;\n flex-shrink: 0;\n }\n\n .destinations {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n width: 100%;\n flex: 1;\n }\n\n /* Alignment Variants */\n :host([alignment=\"top\"]) .destinations {\n justify-content: flex-start;\n }\n\n :host([alignment=\"center\"]) .destinations {\n justify-content: center;\n }\n\n :host([alignment=\"bottom\"]) .destinations {\n justify-content: flex-end;\n }\n\n .footer {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 8px;\n margin-top: auto;\n width: 100%;\n padding-top: 12px;\n flex-shrink: 0;\n }\n`;\n\nexport const navigationRailItemStyles = css`\n :host {\n display: block;\n width: 100%;\n box-sizing: border-box;\n outline: none;\n -webkit-tap-highlight-color: transparent;\n }\n\n :host([disabled]) {\n pointer-events: none;\n opacity: 0.38;\n }\n\n .item {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 100%;\n min-height: 56px;\n padding: 4px 0 8px 0;\n box-sizing: border-box;\n font-family: var(--md-sys-typescale-font-family, inherit);\n color: var(--md-sys-color-on-surface-variant, #49454F);\n text-decoration: none;\n cursor: pointer;\n outline: none;\n border-radius: 12px;\n transition: color 150ms cubic-bezier(0.2, 0, 0, 1);\n }\n\n .indicator-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .active-indicator {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--md-navigation-rail-indicator-width, 56px);\n height: var(--md-navigation-rail-indicator-height, 32px);\n border-radius: var(--md-navigation-rail-indicator-shape, 16px);\n background-color: transparent;\n color: var(--md-sys-color-on-surface-variant, #49454F);\n transition: 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 .item:hover .active-indicator {\n background-color: var(--md-sys-color-surface-container-high, #ECE6F0);\n }\n\n /* Active / Selected State */\n :host([active]) .active-indicator,\n :host([selected]) .active-indicator {\n background-color: var(--md-navigation-rail-active-indicator-color, var(--md-sys-color-secondary-container, #E8DEF8));\n color: var(--md-navigation-rail-active-icon-color, var(--md-sys-color-on-secondary-container, #1D192B));\n }\n\n :host([active]) .item:hover .active-indicator,\n :host([selected]) .item:hover .active-indicator {\n background-color: var(--md-navigation-rail-active-indicator-hover-color, var(--md-sys-color-secondary-container, #E8DEF8));\n }\n\n .icon-slot {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n color: inherit;\n font-size: 24px;\n line-height: 1;\n z-index: 1;\n }\n\n .label-container {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n margin-top: 4px;\n box-sizing: border-box;\n }\n\n .label {\n font-size: var(--md-sys-typescale-label-medium-size, 12px);\n line-height: var(--md-sys-typescale-label-medium-line-height, 16px);\n font-weight: 500;\n letter-spacing: 0.5px;\n text-align: center;\n max-width: 72px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--md-navigation-rail-label-color, var(--md-sys-color-on-surface-variant, #49454F));\n transition: color 150ms cubic-bezier(0.2, 0, 0, 1),\n font-weight 150ms cubic-bezier(0.2, 0, 0, 1);\n }\n\n :host([active]) .label,\n :host([selected]) .label {\n color: var(--md-navigation-rail-active-label-color, var(--md-sys-color-on-surface, #1D1B20));\n font-weight: 700;\n }\n\n :host([hide-label]) .label-container,\n :host([hide-labels]) .label-container {\n display: none;\n }\n\n /* Badge styling */\n .badge-slot {\n position: absolute;\n top: -2px;\n right: 4px;\n z-index: 2;\n pointer-events: none;\n }\n\n .badge {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 16px;\n height: 16px;\n padding: 0 4px;\n border-radius: 8px;\n font-size: 11px;\n font-weight: 600;\n line-height: 1;\n background-color: var(--md-sys-color-error, #B3261E);\n color: var(--md-sys-color-on-error, #FFFFFF);\n box-sizing: border-box;\n }\n\n .badge.dot {\n min-width: 6px;\n width: 6px;\n height: 6px;\n padding: 0;\n border-radius: 50%;\n }\n\n :host([active]) .badge,\n :host([selected]) .badge {\n background-color: var(--md-sys-color-error, #B3261E);\n color: var(--md-sys-color-on-error, #FFFFFF);\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 '../icon/icon.js';\nimport { navigationRailItemStyles } from './navigation-rail.css.js';\n\n/**\n * Material Design 3 Navigation Rail Item component.\n *\n * @slot icon - Custom leading icon.\n * @slot - Default slot for destination label.\n * @slot badge - Custom badge element.\n */\n@customElement('md-navigation-rail-item')\nexport class MdNavigationRailItem extends MdBaseElement {\n static override styles = [MdBaseElement.styles, navigationRailItemStyles];\n\n @property({ type: String })\n icon = '';\n\n @property({ type: String, attribute: 'active-icon' })\n activeIcon = '';\n\n @property({ type: String })\n label = '';\n\n @property({ type: String })\n headline = '';\n\n @property({ type: String })\n badge = '';\n\n @property({ type: Boolean, attribute: 'badge-dot' })\n badgeDot = false;\n\n @property({ type: Boolean, reflect: true })\n active = false;\n\n @property({ type: Boolean, reflect: true })\n selected = false;\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: Boolean, reflect: true, attribute: 'hide-label' })\n hideLabel = false;\n\n @property({ type: String })\n href = '';\n\n @property({ type: String })\n target = '';\n\n @property({ type: String })\n value = '';\n\n override willUpdate(changedProperties: Map<string, unknown>) {\n super.willUpdate(changedProperties);\n if (changedProperties.has('active') && !changedProperties.has('selected')) {\n this.selected = this.active;\n } else if (changedProperties.has('selected') && !changedProperties.has('active')) {\n this.active = this.selected;\n } else if (changedProperties.has('active') && changedProperties.has('selected')) {\n if (this.active) {\n this.selected = true;\n } else if (this.selected) {\n this.active = true;\n }\n }\n }\n\n private handleClick = (event: MouseEvent) => {\n if (this.disabled) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n this.emitEvent('item-click', {\n label: this.label || this.headline,\n icon: this.icon,\n active: this.active,\n value: this.value,\n item: this,\n });\n };\n\n override render() {\n const text = this.label || this.headline;\n const currentIcon = (this.active && this.activeIcon) ? this.activeIcon : this.icon;\n\n const renderBadge = () => {\n if (this.badgeDot) {\n return html`<span class=\"badge dot\"></span>`;\n }\n if (this.badge) {\n return html`<span class=\"badge\">${this.badge}</span>`;\n }\n return nothing;\n };\n\n const inner = html`\n <div class=\"indicator-wrapper\">\n <div class=\"active-indicator\">\n <md-ripple ?disabled=${this.disabled}></md-ripple>\n <md-focus-ring></md-focus-ring>\n <span class=\"icon-slot\">\n <slot name=\"icon\">\n ${currentIcon ? html`<md-icon name=${currentIcon}></md-icon>` : nothing}\n </slot>\n </span>\n </div>\n\n <div class=\"badge-slot\">\n <slot name=\"badge\">\n ${renderBadge()}\n </slot>\n </div>\n </div>\n\n <div class=\"label-container\">\n <slot>\n ${text ? html`<span class=\"label\">${text}</span>` : nothing}\n </slot>\n </div>\n `;\n\n if (this.href) {\n return html`\n <a\n class=\"item\"\n href=${this.disabled ? nothing : this.href}\n target=${this.target || nothing}\n aria-disabled=${this.disabled ? 'true' : nothing}\n aria-current=${this.active ? 'page' : nothing}\n tabindex=${this.disabled ? '-1' : '0'}\n @click=${this.handleClick}\n >\n ${inner}\n </a>\n `;\n }\n\n return html`\n <div\n class=\"item\"\n role=\"button\"\n tabindex=${this.disabled ? '-1' : '0'}\n aria-disabled=${this.disabled ? 'true' : nothing}\n aria-pressed=${this.active ? 'true' : 'false'}\n @click=${this.handleClick}\n >\n ${inner}\n </div>\n `;\n }\n}\n\n// Aliases\n@customElement('md-nav-rail-item')\nexport class MdNavRailItem extends MdNavigationRailItem {}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-navigation-rail-item': MdNavigationRailItem;\n 'md-nav-rail-item': MdNavRailItem;\n }\n}\n"],"mappings":";;;;;;AAEA,IAAa,IAAuB;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;AAA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;AAGlD,EAAA,CAAA,EAAS;AAAA,EAAE,MAAM;AAAA,EAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,UAAA,MAAA;AAGzC,EAAA,CAAA,EAAS;AAAA,EAAE,MAAM;AAAA,EAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,MAAA;AAGzC,EAAA,CAAA,EAAS;AAAA,EAAE,MAAM;AAAA,EAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,MAAA;AAGzC,EAAA,CAAA,EAAS;AAAA,EAAE,MAAM;AAAA,EAAS,SAAS;AAAA,EAAM,WAAW;AAAa,CAAC,CAAA,GAAA,EAAA,WAAA,aAAA,MAAA;AAGlE,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,SAAA,MAAA;AAxC3B,IAAA,EAAA,CAAA,EAAc,yBAAyB,CAAA,GAAA,CAAA;AAkJjC,IAAM,IAAN,cAA4B,EAAqB;AAAC;AADxD,IAAA,EAAA,CAAA,EAAc,kBAAkB,CAAA,GAAA,CAAA"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { n as u, 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 m, html as c, nothing as g } from "lit";
|
|
6
|
+
import { customElement as b, property as r, queryAssignedElements as f } from "lit/decorators.js";
|
|
7
|
+
var k = m`
|
|
8
|
+
:host {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
position: relative;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
height: 40px;
|
|
15
|
+
min-height: 40px;
|
|
16
|
+
padding: 0 16px;
|
|
17
|
+
background-color: transparent;
|
|
18
|
+
color: var(--md-sys-color-on-surface, #1D1B20);
|
|
19
|
+
font-family: var(--md-sys-typescale-font-family, inherit);
|
|
20
|
+
font-size: var(--md-sys-typescale-label-large-size, 14px);
|
|
21
|
+
font-weight: 500;
|
|
22
|
+
line-height: 20px;
|
|
23
|
+
letter-spacing: 0.1px;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
user-select: none;
|
|
26
|
+
outline: none;
|
|
27
|
+
text-decoration: none;
|
|
28
|
+
-webkit-tap-highlight-color: transparent;
|
|
29
|
+
transition: background-color 150ms cubic-bezier(0.2, 0, 0, 1),
|
|
30
|
+
color 150ms cubic-bezier(0.2, 0, 0, 1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host([selected]) {
|
|
34
|
+
background-color: var(--md-sys-color-secondary-container, #E8DEF8);
|
|
35
|
+
color: var(--md-sys-color-on-secondary-container, #1D192B);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host(:hover:not([disabled])) {
|
|
39
|
+
background-color: rgba(29, 27, 32, 0.08);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host([selected]:hover:not([disabled])) {
|
|
43
|
+
background-color: color-mix(in srgb, var(--md-sys-color-secondary-container, #E8DEF8) 90%, #1D192B 10%);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:host([disabled]) {
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
opacity: 0.38;
|
|
49
|
+
cursor: not-allowed;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.button {
|
|
53
|
+
display: inline-flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: 100%;
|
|
58
|
+
gap: 8px;
|
|
59
|
+
position: relative;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.icon {
|
|
63
|
+
display: inline-flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
font-size: 18px;
|
|
67
|
+
--md-icon-size: 18px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.checkmark-icon {
|
|
71
|
+
display: inline-flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
animation: checkmark-pop 150ms cubic-bezier(0.2, 0, 0, 1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@keyframes checkmark-pop {
|
|
78
|
+
0% {
|
|
79
|
+
transform: scale(0.6);
|
|
80
|
+
opacity: 0;
|
|
81
|
+
}
|
|
82
|
+
100% {
|
|
83
|
+
transform: scale(1);
|
|
84
|
+
opacity: 1;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.label {
|
|
89
|
+
display: inline-flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
text-overflow: ellipsis;
|
|
93
|
+
}
|
|
94
|
+
`, v = m`
|
|
95
|
+
:host {
|
|
96
|
+
display: inline-flex;
|
|
97
|
+
align-items: stretch;
|
|
98
|
+
position: relative;
|
|
99
|
+
border-radius: var(--md-sys-shape-corner-full, 9999px);
|
|
100
|
+
border: 1px solid var(--md-sys-color-outline, #79747E);
|
|
101
|
+
background-color: transparent;
|
|
102
|
+
overflow: hidden;
|
|
103
|
+
box-sizing: border-box;
|
|
104
|
+
vertical-align: middle;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
:host([disabled]) {
|
|
108
|
+
pointer-events: none;
|
|
109
|
+
opacity: 0.38;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
::slotted(md-segmented-button:not(:first-child)) {
|
|
113
|
+
border-left: 1px solid var(--md-sys-color-outline, #79747E);
|
|
114
|
+
}
|
|
115
|
+
`, a = class extends u {
|
|
116
|
+
constructor(...i) {
|
|
117
|
+
super(...i), this.selected = !1, this.disabled = !1, this.value = "", this.label = "", this.icon = "", this.noCheckmark = !1, this.handleClick = (e) => {
|
|
118
|
+
if (this.disabled) {
|
|
119
|
+
e.preventDefault(), e.stopImmediatePropagation();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
this.closest("md-segmented-button-set") || (this.selected = !this.selected, this.emitEvent("change", {
|
|
123
|
+
selected: this.selected,
|
|
124
|
+
value: this.value || this.label || this.textContent?.trim() || ""
|
|
125
|
+
}));
|
|
126
|
+
}, this.handleKeyDown = (e) => {
|
|
127
|
+
this.disabled || (e.key === " " || e.key === "Enter") && (e.preventDefault(), this.click());
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
static {
|
|
131
|
+
this.styles = [u.styles, k];
|
|
132
|
+
}
|
|
133
|
+
connectedCallback() {
|
|
134
|
+
super.connectedCallback(), this.setAttribute("role", "button"), this.updateAriaAttributes(), this.addEventListener("click", this.handleClick), this.addEventListener("keydown", this.handleKeyDown);
|
|
135
|
+
}
|
|
136
|
+
disconnectedCallback() {
|
|
137
|
+
super.disconnectedCallback(), this.removeEventListener("click", this.handleClick), this.removeEventListener("keydown", this.handleKeyDown);
|
|
138
|
+
}
|
|
139
|
+
updated(i) {
|
|
140
|
+
super.updated(i), (i.has("selected") || i.has("disabled")) && this.updateAriaAttributes();
|
|
141
|
+
}
|
|
142
|
+
updateAriaAttributes() {
|
|
143
|
+
this.setAttribute("aria-pressed", this.selected ? "true" : "false"), this.setAttribute("aria-disabled", this.disabled ? "true" : "false");
|
|
144
|
+
}
|
|
145
|
+
render() {
|
|
146
|
+
const i = this.selected && !this.noCheckmark, e = !!(this.icon || this.assignedIcons && this.assignedIcons.length > 0);
|
|
147
|
+
return c`
|
|
148
|
+
<div class="button">
|
|
149
|
+
<md-ripple ?disabled=${this.disabled}></md-ripple>
|
|
150
|
+
<md-focus-ring></md-focus-ring>
|
|
151
|
+
|
|
152
|
+
${i ? c`
|
|
153
|
+
<span class="icon checkmark-icon" aria-hidden="true">
|
|
154
|
+
<md-icon name="check" size="18"></md-icon>
|
|
155
|
+
</span>
|
|
156
|
+
` : e ? c`
|
|
157
|
+
<span class="icon">
|
|
158
|
+
<slot name="icon">
|
|
159
|
+
${this.icon ? c`<md-icon name=${this.icon} size="18"></md-icon>` : g}
|
|
160
|
+
</slot>
|
|
161
|
+
</span>
|
|
162
|
+
` : c`<slot name="icon"></slot>`}
|
|
163
|
+
|
|
164
|
+
<span class="label">
|
|
165
|
+
<slot>${this.label}</slot>
|
|
166
|
+
</span>
|
|
167
|
+
</div>
|
|
168
|
+
`;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
o([r({
|
|
172
|
+
type: Boolean,
|
|
173
|
+
reflect: !0
|
|
174
|
+
})], a.prototype, "selected", void 0);
|
|
175
|
+
o([r({
|
|
176
|
+
type: Boolean,
|
|
177
|
+
reflect: !0
|
|
178
|
+
})], a.prototype, "disabled", void 0);
|
|
179
|
+
o([r({ type: String })], a.prototype, "value", void 0);
|
|
180
|
+
o([r({ type: String })], a.prototype, "label", void 0);
|
|
181
|
+
o([r({ type: String })], a.prototype, "icon", void 0);
|
|
182
|
+
o([r({
|
|
183
|
+
type: Boolean,
|
|
184
|
+
attribute: "no-checkmark",
|
|
185
|
+
reflect: !0
|
|
186
|
+
})], a.prototype, "noCheckmark", void 0);
|
|
187
|
+
o([f({ slot: "icon" })], a.prototype, "assignedIcons", void 0);
|
|
188
|
+
a = o([b("md-segmented-button")], a);
|
|
189
|
+
var h = class extends u {
|
|
190
|
+
constructor(...i) {
|
|
191
|
+
super(...i), this.multiselect = !1, this.disabled = !1, this.handleSlotChange = () => {
|
|
192
|
+
this.syncRovingTabIndex(), this.disabled && this.syncDisabled();
|
|
193
|
+
}, this.handleClick = (e) => {
|
|
194
|
+
if (this.disabled) return;
|
|
195
|
+
const t = e.target.closest("md-segmented-button");
|
|
196
|
+
if (!t || t.disabled || !this.buttons.includes(t)) return;
|
|
197
|
+
const n = this.buttons.indexOf(t);
|
|
198
|
+
this.multiselect ? t.selected = !t.selected : this.buttons.forEach((s) => {
|
|
199
|
+
s.selected = s === t;
|
|
200
|
+
}), this.syncRovingTabIndex();
|
|
201
|
+
const d = this.buttons.filter((s) => s.selected).map((s) => s.value || s.label || s.textContent?.trim() || ""), l = t.value || t.label || t.textContent?.trim() || "";
|
|
202
|
+
this.emitEvent("change", {
|
|
203
|
+
target: t,
|
|
204
|
+
index: n,
|
|
205
|
+
selected: t.selected,
|
|
206
|
+
value: l,
|
|
207
|
+
values: d
|
|
208
|
+
});
|
|
209
|
+
}, this.handleKeyDown = (e) => {
|
|
210
|
+
const t = this.buttons.filter((s) => !s.disabled);
|
|
211
|
+
if (t.length === 0) return;
|
|
212
|
+
const n = document.activeElement, d = t.findIndex((s) => s === n || s.shadowRoot && s.shadowRoot.activeElement === n);
|
|
213
|
+
let l = -1;
|
|
214
|
+
if (e.key === "ArrowRight" || e.key === "ArrowDown" ? (e.preventDefault(), l = d >= 0 && d < t.length - 1 ? d + 1 : 0) : e.key === "ArrowLeft" || e.key === "ArrowUp" ? (e.preventDefault(), l = d > 0 ? d - 1 : t.length - 1) : e.key === "Home" ? (e.preventDefault(), l = 0) : e.key === "End" && (e.preventDefault(), l = t.length - 1), l !== -1 && t[l]) {
|
|
215
|
+
const s = t[l];
|
|
216
|
+
this.buttons.forEach((p) => {
|
|
217
|
+
p.tabIndex = p === s ? 0 : -1;
|
|
218
|
+
}), s.focus();
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
static {
|
|
223
|
+
this.styles = [u.styles, v];
|
|
224
|
+
}
|
|
225
|
+
connectedCallback() {
|
|
226
|
+
super.connectedCallback(), this.setAttribute("role", "group"), this.addEventListener("click", this.handleClick), this.addEventListener("keydown", this.handleKeyDown);
|
|
227
|
+
}
|
|
228
|
+
disconnectedCallback() {
|
|
229
|
+
super.disconnectedCallback(), this.removeEventListener("click", this.handleClick), this.removeEventListener("keydown", this.handleKeyDown);
|
|
230
|
+
}
|
|
231
|
+
updated(i) {
|
|
232
|
+
super.updated(i), i.has("disabled") && this.syncDisabled();
|
|
233
|
+
}
|
|
234
|
+
syncDisabled() {
|
|
235
|
+
this.buttons && this.buttons.forEach((i) => {
|
|
236
|
+
i.disabled = this.disabled;
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
syncRovingTabIndex() {
|
|
240
|
+
if (!this.buttons || this.buttons.length === 0) return;
|
|
241
|
+
const i = this.buttons.find((n) => n.selected && !n.disabled), e = this.buttons.find((n) => !n.disabled), t = i || e;
|
|
242
|
+
this.buttons.forEach((n) => {
|
|
243
|
+
n.tabIndex = n === t ? 0 : -1;
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
render() {
|
|
247
|
+
return c`<slot @slotchange=${this.handleSlotChange}></slot>`;
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
o([r({
|
|
251
|
+
type: Boolean,
|
|
252
|
+
reflect: !0
|
|
253
|
+
})], h.prototype, "multiselect", void 0);
|
|
254
|
+
o([r({
|
|
255
|
+
type: Boolean,
|
|
256
|
+
reflect: !0
|
|
257
|
+
})], h.prototype, "disabled", void 0);
|
|
258
|
+
o([f({ selector: "md-segmented-button" })], h.prototype, "buttons", void 0);
|
|
259
|
+
h = o([b("md-segmented-button-set")], h);
|
|
260
|
+
export {
|
|
261
|
+
h as n,
|
|
262
|
+
a as t
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
//# sourceMappingURL=segmented-button-B0BvGSQ7.js.map
|