@francofantomius/material-components 1.0.2 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -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/{search-bar-TXnqJ-gd.js → search-bar-fUD0qU2P.js} +22 -4
- package/dist/chunks/search-bar-fUD0qU2P.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/search-bar/search-bar.css.d.ts.map +1 -1
- package/dist/components/search-bar/search-bar.js +1 -1
- 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 +919 -0
- package/package.json +97 -1
- package/dist/chunks/button-B4TSZ7Sl.js.map +0 -1
- package/dist/chunks/icon-button-BdSc7eot.js.map +0 -1
- package/dist/chunks/search-bar-TXnqJ-gd.js.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { n as d, t as i } from "./decorate-DXuynaiA.js";
|
|
2
|
+
import "./ripple-squbKHhj.js";
|
|
3
|
+
import "./focus-ring-CuiJuM-y.js";
|
|
4
|
+
import "./icon-DrNqcNEL.js";
|
|
5
|
+
import { css as m, html as p, nothing as u } from "lit";
|
|
6
|
+
import { customElement as h, property as s, query as l, queryAssignedElements as b } from "lit/decorators.js";
|
|
7
|
+
var f = m`
|
|
8
|
+
:host {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
vertical-align: middle;
|
|
11
|
+
outline: none;
|
|
12
|
+
-webkit-tap-highlight-color: transparent;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host([disabled]) {
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.container {
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
align-items: stretch;
|
|
22
|
+
gap: var(--md-split-button-gap, 2px);
|
|
23
|
+
position: relative;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
button {
|
|
27
|
+
position: relative;
|
|
28
|
+
display: inline-flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
height: 40px;
|
|
33
|
+
border: none;
|
|
34
|
+
font-family: var(--md-sys-typescale-font-family, inherit);
|
|
35
|
+
font-size: var(--md-sys-typescale-label-large-size, 14px);
|
|
36
|
+
font-weight: 500;
|
|
37
|
+
line-height: 20px;
|
|
38
|
+
letter-spacing: 0.1px;
|
|
39
|
+
text-decoration: none;
|
|
40
|
+
text-align: center;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
user-select: none;
|
|
43
|
+
outline: none;
|
|
44
|
+
transition: box-shadow 200ms cubic-bezier(0.2, 0, 0, 1),
|
|
45
|
+
background-color 200ms cubic-bezier(0.2, 0, 0, 1),
|
|
46
|
+
color 200ms cubic-bezier(0.2, 0, 0, 1);
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.action-button {
|
|
51
|
+
min-width: 48px;
|
|
52
|
+
padding: 0 16px 0 24px;
|
|
53
|
+
border-radius: var(--md-sys-shape-corner-full, 9999px)
|
|
54
|
+
var(--md-sys-shape-corner-extra-small, 4px)
|
|
55
|
+
var(--md-sys-shape-corner-extra-small, 4px)
|
|
56
|
+
var(--md-sys-shape-corner-full, 9999px);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:host([has-icon]) .action-button {
|
|
60
|
+
padding-left: 16px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.menu-button {
|
|
64
|
+
width: 40px;
|
|
65
|
+
min-width: 40px;
|
|
66
|
+
padding: 0;
|
|
67
|
+
border-radius: var(--md-sys-shape-corner-extra-small, 4px)
|
|
68
|
+
var(--md-sys-shape-corner-full, 9999px)
|
|
69
|
+
var(--md-sys-shape-corner-full, 9999px)
|
|
70
|
+
var(--md-sys-shape-corner-extra-small, 4px);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.content {
|
|
74
|
+
display: inline-flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
gap: 8px;
|
|
77
|
+
position: relative;
|
|
78
|
+
z-index: 1;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.icon-wrapper {
|
|
82
|
+
display: inline-flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
position: relative;
|
|
86
|
+
z-index: 1;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* --- Filled Variant (Default) --- */
|
|
90
|
+
:host(:not([variant])) button,
|
|
91
|
+
:host([variant="filled"]) button {
|
|
92
|
+
background-color: var(--md-sys-color-primary, #6750a4);
|
|
93
|
+
color: var(--md-sys-color-on-primary, #ffffff);
|
|
94
|
+
box-shadow: var(--md-sys-elevation-level0, none);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
:host([variant="filled"]:hover) button,
|
|
98
|
+
:host(:not([variant]):hover) button {
|
|
99
|
+
box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0, 0, 0, 0.15));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* --- Elevated Variant --- */
|
|
103
|
+
:host([variant="elevated"]) button {
|
|
104
|
+
background-color: var(--md-sys-color-surface-container-low, #f7f2fa);
|
|
105
|
+
color: var(--md-sys-color-primary, #6750a4);
|
|
106
|
+
box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0, 0, 0, 0.15));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:host([variant="elevated"]:hover) button {
|
|
110
|
+
box-shadow: var(--md-sys-elevation-level2, 0px 2px 6px 2px rgba(0, 0, 0, 0.15));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* --- Tonal Variant --- */
|
|
114
|
+
:host([variant="tonal"]) button {
|
|
115
|
+
background-color: var(--md-sys-color-secondary-container, #e8def8);
|
|
116
|
+
color: var(--md-sys-color-on-secondary-container, #1d192b);
|
|
117
|
+
box-shadow: var(--md-sys-elevation-level0, none);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
:host([variant="tonal"]:hover) button {
|
|
121
|
+
box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0, 0, 0, 0.15));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* --- Outlined Variant --- */
|
|
125
|
+
:host([variant="outlined"]) button {
|
|
126
|
+
background-color: transparent;
|
|
127
|
+
color: var(--md-sys-color-primary, #6750a4);
|
|
128
|
+
border: 1px solid var(--md-sys-color-outline, #79747e);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* --- Disabled State --- */
|
|
132
|
+
:host([disabled]) button {
|
|
133
|
+
cursor: not-allowed;
|
|
134
|
+
box-shadow: none;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
:host([disabled]:not([variant="outlined"])) button {
|
|
138
|
+
background-color: rgba(29, 27, 32, 0.12);
|
|
139
|
+
color: rgba(29, 27, 32, 0.38);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
:host([disabled][variant="outlined"]) button {
|
|
143
|
+
border-color: rgba(29, 27, 32, 0.12);
|
|
144
|
+
color: rgba(29, 27, 32, 0.38);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* --- Backdrop --- */
|
|
148
|
+
.backdrop {
|
|
149
|
+
display: none;
|
|
150
|
+
position: fixed;
|
|
151
|
+
inset: 0;
|
|
152
|
+
z-index: 998;
|
|
153
|
+
background-color: transparent;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
:host([open]) .backdrop {
|
|
157
|
+
display: block;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* --- Submenu Surface --- */
|
|
161
|
+
.menu-surface {
|
|
162
|
+
display: none;
|
|
163
|
+
position: absolute;
|
|
164
|
+
z-index: 999;
|
|
165
|
+
min-width: var(--md-menu-min-width, 140px);
|
|
166
|
+
max-width: var(--md-menu-max-width, 280px);
|
|
167
|
+
max-height: var(--md-menu-max-height, calc(100vh - 32px));
|
|
168
|
+
box-sizing: border-box;
|
|
169
|
+
padding: 8px 0;
|
|
170
|
+
margin: 0;
|
|
171
|
+
border-radius: var(--md-sys-shape-corner-extra-small, 4px);
|
|
172
|
+
background-color: var(--md-sys-color-surface-container, #f3edf7);
|
|
173
|
+
color: var(--md-sys-color-on-surface, #1d1b20);
|
|
174
|
+
box-shadow: var(--md-sys-elevation-level2, 0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30));
|
|
175
|
+
overflow-y: auto;
|
|
176
|
+
overflow-x: hidden;
|
|
177
|
+
overscroll-behavior: contain;
|
|
178
|
+
outline: none;
|
|
179
|
+
user-select: none;
|
|
180
|
+
-webkit-overflow-scrolling: touch;
|
|
181
|
+
top: calc(100% + var(--md-split-button-menu-offset, 4px));
|
|
182
|
+
right: 0;
|
|
183
|
+
transform-origin: top right;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
:host([menu-placement="bottom-start"]) .menu-surface,
|
|
187
|
+
:host([menu-placement="bottom"]) .menu-surface {
|
|
188
|
+
left: 0;
|
|
189
|
+
right: auto;
|
|
190
|
+
transform-origin: top left;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
:host([menu-placement="top-end"]) .menu-surface {
|
|
194
|
+
top: auto;
|
|
195
|
+
bottom: calc(100% + var(--md-split-button-menu-offset, 4px));
|
|
196
|
+
right: 0;
|
|
197
|
+
left: auto;
|
|
198
|
+
transform-origin: bottom right;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
:host([menu-placement="top-start"]) .menu-surface,
|
|
202
|
+
:host([menu-placement="top"]) .menu-surface {
|
|
203
|
+
top: auto;
|
|
204
|
+
bottom: calc(100% + var(--md-split-button-menu-offset, 4px));
|
|
205
|
+
left: 0;
|
|
206
|
+
right: auto;
|
|
207
|
+
transform-origin: bottom left;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
:host([open]) .menu-surface {
|
|
211
|
+
display: flex;
|
|
212
|
+
flex-direction: column;
|
|
213
|
+
animation: md-split-menu-fade-in 150ms cubic-bezier(0.2, 0, 0, 1) forwards;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
@keyframes md-split-menu-fade-in {
|
|
217
|
+
from {
|
|
218
|
+
opacity: 0;
|
|
219
|
+
transform: scale(0.92, 0.8);
|
|
220
|
+
}
|
|
221
|
+
to {
|
|
222
|
+
opacity: 1;
|
|
223
|
+
transform: scale(1, 1);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.menu-surface::-webkit-scrollbar {
|
|
228
|
+
width: 6px;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.menu-surface::-webkit-scrollbar-thumb {
|
|
232
|
+
background-color: var(--md-sys-color-outline-variant, #cac4d0);
|
|
233
|
+
border-radius: 3px;
|
|
234
|
+
}
|
|
235
|
+
`, n = class extends d {
|
|
236
|
+
constructor(...e) {
|
|
237
|
+
super(...e), this.variant = "filled", this.disabled = !1, this.label = "", this.icon = "", this.trailingIcon = "arrow_drop_down", this.open = !1, this.type = "button", this.actionAriaLabel = "", this.menuAriaLabel = "More options", this.menuPlacement = "bottom-end", this.stayOpenOnFocusout = !1, this.closeOnItemClick = !0, this.handleDocumentClick = (t) => {
|
|
238
|
+
this.open && (t.composedPath().includes(this) || this.close());
|
|
239
|
+
}, this.handleWindowKeyDown = (t) => {
|
|
240
|
+
this.open && t.key === "Escape" && (t.preventDefault(), t.stopPropagation(), this.close(), this.menuButton?.focus());
|
|
241
|
+
}, this.handleSurfaceKeyDown = (t) => {
|
|
242
|
+
const o = this.getItems(!0);
|
|
243
|
+
if (o.length === 0) return;
|
|
244
|
+
let r = null;
|
|
245
|
+
try {
|
|
246
|
+
r = document.activeElement;
|
|
247
|
+
} catch {
|
|
248
|
+
r = null;
|
|
249
|
+
}
|
|
250
|
+
const a = o.findIndex((c) => c === r || c.contains(r));
|
|
251
|
+
switch (t.key) {
|
|
252
|
+
case "ArrowDown":
|
|
253
|
+
t.preventDefault(), o[a >= 0 && a < o.length - 1 ? a + 1 : 0]?.focus();
|
|
254
|
+
break;
|
|
255
|
+
case "ArrowUp":
|
|
256
|
+
t.preventDefault(), o[a > 0 ? a - 1 : o.length - 1]?.focus();
|
|
257
|
+
break;
|
|
258
|
+
case "Home":
|
|
259
|
+
t.preventDefault(), o[0]?.focus();
|
|
260
|
+
break;
|
|
261
|
+
case "End":
|
|
262
|
+
t.preventDefault(), o[o.length - 1]?.focus();
|
|
263
|
+
break;
|
|
264
|
+
case "Tab":
|
|
265
|
+
this.stayOpenOnFocusout || this.close();
|
|
266
|
+
}
|
|
267
|
+
}, this.handleItemSelection = (t) => {
|
|
268
|
+
const o = t.detail;
|
|
269
|
+
this.emitEvent("select", o), !o?.keepOpen && this.closeOnItemClick && (this.close(), this.menuButton?.focus());
|
|
270
|
+
}, this.handleActionClick = (t) => {
|
|
271
|
+
if (this.disabled) {
|
|
272
|
+
t.preventDefault(), t.stopImmediatePropagation();
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
if (this.type === "submit" || this.type === "reset") {
|
|
276
|
+
const o = this.closest("form");
|
|
277
|
+
o && (this.type === "submit" ? o.requestSubmit() : o.reset());
|
|
278
|
+
}
|
|
279
|
+
this.emitEvent("action", {
|
|
280
|
+
target: this,
|
|
281
|
+
open: this.open
|
|
282
|
+
});
|
|
283
|
+
}, this.handleMenuClick = (t) => {
|
|
284
|
+
if (t.stopPropagation(), this.disabled) {
|
|
285
|
+
t.preventDefault(), t.stopImmediatePropagation();
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
this.open = !this.open, this.emitEvent("trailing-click", {
|
|
289
|
+
target: this,
|
|
290
|
+
open: this.open
|
|
291
|
+
}), this.emitEvent("toggle", {
|
|
292
|
+
target: this,
|
|
293
|
+
open: this.open
|
|
294
|
+
});
|
|
295
|
+
}, this.handleBackdropClick = (t) => {
|
|
296
|
+
t.stopPropagation(), this.close();
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
static {
|
|
300
|
+
this.styles = [d.styles, f];
|
|
301
|
+
}
|
|
302
|
+
handleSlotChange() {
|
|
303
|
+
const e = !!(this.icon || this.assignedIcons && this.assignedIcons.length > 0);
|
|
304
|
+
this.toggleAttribute("has-icon", e);
|
|
305
|
+
}
|
|
306
|
+
connectedCallback() {
|
|
307
|
+
super.connectedCallback(), window.addEventListener("keydown", this.handleWindowKeyDown), document.addEventListener("pointerdown", this.handleDocumentClick), this.addEventListener("item-click", this.handleItemSelection), this.addEventListener("menu-item-click", this.handleItemSelection);
|
|
308
|
+
}
|
|
309
|
+
disconnectedCallback() {
|
|
310
|
+
super.disconnectedCallback(), window.removeEventListener("keydown", this.handleWindowKeyDown), document.removeEventListener("pointerdown", this.handleDocumentClick), this.removeEventListener("item-click", this.handleItemSelection), this.removeEventListener("menu-item-click", this.handleItemSelection);
|
|
311
|
+
}
|
|
312
|
+
firstUpdated() {
|
|
313
|
+
this.handleSlotChange();
|
|
314
|
+
}
|
|
315
|
+
updated(e) {
|
|
316
|
+
super.updated(e), e.has("open") && (this.open ? (this.emitEvent("open"), setTimeout(() => {
|
|
317
|
+
this.focusFirstItem();
|
|
318
|
+
}, 16)) : this.emitEvent("close"));
|
|
319
|
+
}
|
|
320
|
+
show() {
|
|
321
|
+
this.open || (this.open = !0);
|
|
322
|
+
}
|
|
323
|
+
close() {
|
|
324
|
+
this.open && (this.open = !1);
|
|
325
|
+
}
|
|
326
|
+
toggle() {
|
|
327
|
+
this.open = !this.open;
|
|
328
|
+
}
|
|
329
|
+
getItems(e = !1) {
|
|
330
|
+
const t = Array.from(this.querySelectorAll('md-menu-item, [role="menuitem"], button.menu-item'));
|
|
331
|
+
return e ? t.filter((o) => !(o.hasAttribute("disabled") || o.disabled)) : t;
|
|
332
|
+
}
|
|
333
|
+
focusFirstItem() {
|
|
334
|
+
const e = this.getItems(!0);
|
|
335
|
+
e.length > 0 ? e[0].focus() : this.menuSurfaceElement && this.menuSurfaceElement.focus();
|
|
336
|
+
}
|
|
337
|
+
focusLastItem() {
|
|
338
|
+
const e = this.getItems(!0);
|
|
339
|
+
e.length > 0 && e[e.length - 1].focus();
|
|
340
|
+
}
|
|
341
|
+
focusItemAtIndex(e) {
|
|
342
|
+
const t = this.getItems(!0);
|
|
343
|
+
e >= 0 && e < t.length && t[e].focus();
|
|
344
|
+
}
|
|
345
|
+
render() {
|
|
346
|
+
return p`
|
|
347
|
+
<div class="backdrop" @click=${this.handleBackdropClick}></div>
|
|
348
|
+
|
|
349
|
+
<div class="container" role="group">
|
|
350
|
+
<button
|
|
351
|
+
type=${this.type}
|
|
352
|
+
class="action-button"
|
|
353
|
+
?disabled=${this.disabled}
|
|
354
|
+
aria-label=${this.actionAriaLabel || u}
|
|
355
|
+
@click=${this.handleActionClick}
|
|
356
|
+
>
|
|
357
|
+
<md-ripple ?disabled=${this.disabled}></md-ripple>
|
|
358
|
+
<md-focus-ring></md-focus-ring>
|
|
359
|
+
<span class="content">
|
|
360
|
+
<slot name="icon" @slotchange=${this.handleSlotChange}>
|
|
361
|
+
${this.icon ? p`<md-icon name=${this.icon}></md-icon>` : u}
|
|
362
|
+
</slot>
|
|
363
|
+
<slot name="label">${this.label}</slot>
|
|
364
|
+
</span>
|
|
365
|
+
</button>
|
|
366
|
+
|
|
367
|
+
<button
|
|
368
|
+
type="button"
|
|
369
|
+
class="menu-button"
|
|
370
|
+
?disabled=${this.disabled}
|
|
371
|
+
aria-haspopup="menu"
|
|
372
|
+
aria-expanded=${this.open ? "true" : "false"}
|
|
373
|
+
aria-label=${this.menuAriaLabel}
|
|
374
|
+
@click=${this.handleMenuClick}
|
|
375
|
+
>
|
|
376
|
+
<md-ripple ?disabled=${this.disabled}></md-ripple>
|
|
377
|
+
<md-focus-ring></md-focus-ring>
|
|
378
|
+
<span class="icon-wrapper">
|
|
379
|
+
<slot name="trailing-icon">
|
|
380
|
+
<md-icon name=${this.trailingIcon || "arrow_drop_down"}></md-icon>
|
|
381
|
+
</slot>
|
|
382
|
+
</span>
|
|
383
|
+
</button>
|
|
384
|
+
|
|
385
|
+
<!-- Submenu Surface -->
|
|
386
|
+
<div
|
|
387
|
+
class="menu-surface"
|
|
388
|
+
role="menu"
|
|
389
|
+
tabindex="-1"
|
|
390
|
+
aria-label=${this.menuAriaLabel}
|
|
391
|
+
aria-hidden=${this.open ? "false" : "true"}
|
|
392
|
+
@keydown=${this.handleSurfaceKeyDown}
|
|
393
|
+
>
|
|
394
|
+
<slot name="menu"></slot>
|
|
395
|
+
<slot></slot>
|
|
396
|
+
</div>
|
|
397
|
+
</div>
|
|
398
|
+
`;
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
i([s({
|
|
402
|
+
type: String,
|
|
403
|
+
reflect: !0
|
|
404
|
+
})], n.prototype, "variant", void 0);
|
|
405
|
+
i([s({
|
|
406
|
+
type: Boolean,
|
|
407
|
+
reflect: !0
|
|
408
|
+
})], n.prototype, "disabled", void 0);
|
|
409
|
+
i([s({ type: String })], n.prototype, "label", void 0);
|
|
410
|
+
i([s({ type: String })], n.prototype, "icon", void 0);
|
|
411
|
+
i([s({
|
|
412
|
+
type: String,
|
|
413
|
+
attribute: "trailing-icon"
|
|
414
|
+
})], n.prototype, "trailingIcon", void 0);
|
|
415
|
+
i([s({
|
|
416
|
+
type: Boolean,
|
|
417
|
+
reflect: !0
|
|
418
|
+
})], n.prototype, "open", void 0);
|
|
419
|
+
i([s({ type: String })], n.prototype, "type", void 0);
|
|
420
|
+
i([s({
|
|
421
|
+
type: String,
|
|
422
|
+
attribute: "action-aria-label"
|
|
423
|
+
})], n.prototype, "actionAriaLabel", void 0);
|
|
424
|
+
i([s({
|
|
425
|
+
type: String,
|
|
426
|
+
attribute: "menu-aria-label"
|
|
427
|
+
})], n.prototype, "menuAriaLabel", void 0);
|
|
428
|
+
i([s({
|
|
429
|
+
type: String,
|
|
430
|
+
attribute: "menu-placement",
|
|
431
|
+
reflect: !0
|
|
432
|
+
})], n.prototype, "menuPlacement", void 0);
|
|
433
|
+
i([s({
|
|
434
|
+
type: Boolean,
|
|
435
|
+
attribute: "stay-open-on-focusout"
|
|
436
|
+
})], n.prototype, "stayOpenOnFocusout", void 0);
|
|
437
|
+
i([s({
|
|
438
|
+
type: Boolean,
|
|
439
|
+
attribute: "close-on-item-click"
|
|
440
|
+
})], n.prototype, "closeOnItemClick", void 0);
|
|
441
|
+
i([l(".action-button")], n.prototype, "actionButton", void 0);
|
|
442
|
+
i([l(".menu-button")], n.prototype, "menuButton", void 0);
|
|
443
|
+
i([l(".menu-surface")], n.prototype, "menuSurfaceElement", void 0);
|
|
444
|
+
i([b({ slot: "icon" })], n.prototype, "assignedIcons", void 0);
|
|
445
|
+
n = i([h("md-split-button")], n);
|
|
446
|
+
export {
|
|
447
|
+
n as t
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
//# sourceMappingURL=split-button-DUfjukQY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-button-DUfjukQY.js","names":[],"sources":["../../src/components/split-button/split-button.css.ts","../../src/components/split-button/split-button.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const splitButtonStyles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n outline: none;\n -webkit-tap-highlight-color: transparent;\n }\n\n :host([disabled]) {\n pointer-events: none;\n }\n\n .container {\n display: inline-flex;\n align-items: stretch;\n gap: var(--md-split-button-gap, 2px);\n position: relative;\n }\n\n button {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n height: 40px;\n border: none;\n font-family: var(--md-sys-typescale-font-family, inherit);\n font-size: var(--md-sys-typescale-label-large-size, 14px);\n font-weight: 500;\n line-height: 20px;\n letter-spacing: 0.1px;\n text-decoration: none;\n text-align: center;\n cursor: pointer;\n user-select: none;\n outline: none;\n transition: box-shadow 200ms cubic-bezier(0.2, 0, 0, 1),\n background-color 200ms cubic-bezier(0.2, 0, 0, 1),\n color 200ms cubic-bezier(0.2, 0, 0, 1);\n overflow: hidden;\n }\n\n .action-button {\n min-width: 48px;\n padding: 0 16px 0 24px;\n border-radius: var(--md-sys-shape-corner-full, 9999px)\n var(--md-sys-shape-corner-extra-small, 4px)\n var(--md-sys-shape-corner-extra-small, 4px)\n var(--md-sys-shape-corner-full, 9999px);\n }\n\n :host([has-icon]) .action-button {\n padding-left: 16px;\n }\n\n .menu-button {\n width: 40px;\n min-width: 40px;\n padding: 0;\n border-radius: var(--md-sys-shape-corner-extra-small, 4px)\n var(--md-sys-shape-corner-full, 9999px)\n var(--md-sys-shape-corner-full, 9999px)\n var(--md-sys-shape-corner-extra-small, 4px);\n }\n\n .content {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n position: relative;\n z-index: 1;\n }\n\n .icon-wrapper {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: relative;\n z-index: 1;\n }\n\n /* --- Filled Variant (Default) --- */\n :host(:not([variant])) button,\n :host([variant=\"filled\"]) button {\n background-color: var(--md-sys-color-primary, #6750a4);\n color: var(--md-sys-color-on-primary, #ffffff);\n box-shadow: var(--md-sys-elevation-level0, none);\n }\n\n :host([variant=\"filled\"]:hover) button,\n :host(:not([variant]):hover) button {\n box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0, 0, 0, 0.15));\n }\n\n /* --- Elevated Variant --- */\n :host([variant=\"elevated\"]) button {\n background-color: var(--md-sys-color-surface-container-low, #f7f2fa);\n color: var(--md-sys-color-primary, #6750a4);\n box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0, 0, 0, 0.15));\n }\n\n :host([variant=\"elevated\"]:hover) button {\n box-shadow: var(--md-sys-elevation-level2, 0px 2px 6px 2px rgba(0, 0, 0, 0.15));\n }\n\n /* --- Tonal Variant --- */\n :host([variant=\"tonal\"]) button {\n background-color: var(--md-sys-color-secondary-container, #e8def8);\n color: var(--md-sys-color-on-secondary-container, #1d192b);\n box-shadow: var(--md-sys-elevation-level0, none);\n }\n\n :host([variant=\"tonal\"]:hover) button {\n box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0, 0, 0, 0.15));\n }\n\n /* --- Outlined Variant --- */\n :host([variant=\"outlined\"]) button {\n background-color: transparent;\n color: var(--md-sys-color-primary, #6750a4);\n border: 1px solid var(--md-sys-color-outline, #79747e);\n }\n\n /* --- Disabled State --- */\n :host([disabled]) button {\n cursor: not-allowed;\n box-shadow: none;\n }\n\n :host([disabled]:not([variant=\"outlined\"])) button {\n background-color: rgba(29, 27, 32, 0.12);\n color: rgba(29, 27, 32, 0.38);\n }\n\n :host([disabled][variant=\"outlined\"]) button {\n border-color: rgba(29, 27, 32, 0.12);\n color: rgba(29, 27, 32, 0.38);\n }\n\n /* --- Backdrop --- */\n .backdrop {\n display: none;\n position: fixed;\n inset: 0;\n z-index: 998;\n background-color: transparent;\n }\n\n :host([open]) .backdrop {\n display: block;\n }\n\n /* --- Submenu Surface --- */\n .menu-surface {\n display: none;\n position: absolute;\n z-index: 999;\n min-width: var(--md-menu-min-width, 140px);\n max-width: var(--md-menu-max-width, 280px);\n max-height: var(--md-menu-max-height, calc(100vh - 32px));\n box-sizing: border-box;\n padding: 8px 0;\n margin: 0;\n border-radius: var(--md-sys-shape-corner-extra-small, 4px);\n background-color: var(--md-sys-color-surface-container, #f3edf7);\n color: var(--md-sys-color-on-surface, #1d1b20);\n box-shadow: var(--md-sys-elevation-level2, 0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30));\n overflow-y: auto;\n overflow-x: hidden;\n overscroll-behavior: contain;\n outline: none;\n user-select: none;\n -webkit-overflow-scrolling: touch;\n top: calc(100% + var(--md-split-button-menu-offset, 4px));\n right: 0;\n transform-origin: top right;\n }\n\n :host([menu-placement=\"bottom-start\"]) .menu-surface,\n :host([menu-placement=\"bottom\"]) .menu-surface {\n left: 0;\n right: auto;\n transform-origin: top left;\n }\n\n :host([menu-placement=\"top-end\"]) .menu-surface {\n top: auto;\n bottom: calc(100% + var(--md-split-button-menu-offset, 4px));\n right: 0;\n left: auto;\n transform-origin: bottom right;\n }\n\n :host([menu-placement=\"top-start\"]) .menu-surface,\n :host([menu-placement=\"top\"]) .menu-surface {\n top: auto;\n bottom: calc(100% + var(--md-split-button-menu-offset, 4px));\n left: 0;\n right: auto;\n transform-origin: bottom left;\n }\n\n :host([open]) .menu-surface {\n display: flex;\n flex-direction: column;\n animation: md-split-menu-fade-in 150ms cubic-bezier(0.2, 0, 0, 1) forwards;\n }\n\n @keyframes md-split-menu-fade-in {\n from {\n opacity: 0;\n transform: scale(0.92, 0.8);\n }\n to {\n opacity: 1;\n transform: scale(1, 1);\n }\n }\n\n .menu-surface::-webkit-scrollbar {\n width: 6px;\n }\n\n .menu-surface::-webkit-scrollbar-thumb {\n background-color: var(--md-sys-color-outline-variant, #cac4d0);\n border-radius: 3px;\n }\n`;\n","import { html, nothing } from 'lit';\nimport { customElement, property, queryAssignedElements, query } 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 { splitButtonStyles } from './split-button.css.js';\nimport { MdMenuItem } from '../menu/menu-item.js';\n\nexport type SplitButtonVariant = 'filled' | 'elevated' | 'tonal' | 'outlined';\nexport type SplitButtonMenuPlacement = 'bottom-end' | 'bottom-start' | 'top-end' | 'top-start';\n\n/**\n * Material Design 3 Split Button component.\n * Pairs a primary action button with a connected trailing dropdown button that opens a submenu of related secondary actions.\n *\n * @element md-split-button\n *\n * @slot - Default slot for `md-menu-item` submenu choices.\n * @slot menu - Slotted submenu items or custom menu container.\n * @slot label - Primary action button text label.\n * @slot icon - Leading icon for the primary action button.\n * @slot trailing-icon - Dropdown indicator icon for the menu button.\n *\n * @fires action - Dispatched when the leading primary action button is clicked.\n * @fires trailing-click - Dispatched when the trailing menu button is clicked.\n * @fires toggle - Dispatched when the trailing menu trigger is toggled with the new open state.\n * @fires open - Dispatched when the submenu opens.\n * @fires close - Dispatched when the submenu closes.\n * @fires select - Dispatched when a submenu item is selected.\n */\n@customElement('md-split-button')\nexport class MdSplitButton extends MdBaseElement {\n static override styles = [MdBaseElement.styles, splitButtonStyles];\n\n @property({ type: String, reflect: true })\n variant: SplitButtonVariant = 'filled';\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: String })\n label = '';\n\n @property({ type: String })\n icon = '';\n\n @property({ type: String, attribute: 'trailing-icon' })\n trailingIcon = 'arrow_drop_down';\n\n @property({ type: Boolean, reflect: true })\n open = false;\n\n @property({ type: String })\n type: 'button' | 'submit' | 'reset' = 'button';\n\n @property({ type: String, attribute: 'action-aria-label' })\n actionAriaLabel = '';\n\n @property({ type: String, attribute: 'menu-aria-label' })\n menuAriaLabel = 'More options';\n\n @property({ type: String, attribute: 'menu-placement', reflect: true })\n menuPlacement: SplitButtonMenuPlacement = 'bottom-end';\n\n @property({ type: Boolean, attribute: 'stay-open-on-focusout' })\n stayOpenOnFocusout = false;\n\n @property({ type: Boolean, attribute: 'close-on-item-click' })\n closeOnItemClick = true;\n\n @query('.action-button')\n actionButton!: HTMLButtonElement;\n\n @query('.menu-button')\n menuButton!: HTMLButtonElement;\n\n @query('.menu-surface')\n private menuSurfaceElement?: HTMLElement;\n\n @queryAssignedElements({ slot: 'icon' })\n private assignedIcons!: HTMLElement[];\n\n private handleSlotChange(): void {\n const hasLeading = Boolean(this.icon || (this.assignedIcons && this.assignedIcons.length > 0));\n this.toggleAttribute('has-icon', hasLeading);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n window.addEventListener('keydown', this.handleWindowKeyDown);\n document.addEventListener('pointerdown', this.handleDocumentClick);\n this.addEventListener('item-click', this.handleItemSelection as EventListener);\n this.addEventListener('menu-item-click', this.handleItemSelection as EventListener);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('keydown', this.handleWindowKeyDown);\n document.removeEventListener('pointerdown', this.handleDocumentClick);\n this.removeEventListener('item-click', this.handleItemSelection as EventListener);\n this.removeEventListener('menu-item-click', this.handleItemSelection as EventListener);\n }\n\n override firstUpdated() {\n this.handleSlotChange();\n }\n\n override updated(changedProperties: Map<string, unknown>): void {\n super.updated(changedProperties);\n\n if (changedProperties.has('open')) {\n if (this.open) {\n this.emitEvent('open');\n setTimeout(() => {\n this.focusFirstItem();\n }, 16);\n } else {\n this.emitEvent('close');\n }\n }\n }\n\n private handleDocumentClick = (event: MouseEvent | PointerEvent): void => {\n if (!this.open) return;\n const path = event.composedPath();\n if (path.includes(this)) return;\n this.close();\n };\n\n private handleWindowKeyDown = (event: KeyboardEvent): void => {\n if (!this.open) return;\n\n if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n this.close();\n this.menuButton?.focus();\n }\n };\n\n private handleSurfaceKeyDown = (event: KeyboardEvent): void => {\n const items = this.getItems(true);\n if (items.length === 0) return;\n\n let activeEl: Element | null = null;\n try {\n activeEl = document.activeElement;\n } catch {\n activeEl = null;\n }\n\n const currentIndex = items.findIndex(\n (item) => item === activeEl || item.contains(activeEl)\n );\n\n switch (event.key) {\n case 'ArrowDown': {\n event.preventDefault();\n const nextIndex = currentIndex >= 0 && currentIndex < items.length - 1 ? currentIndex + 1 : 0;\n items[nextIndex]?.focus();\n break;\n }\n case 'ArrowUp': {\n event.preventDefault();\n const prevIndex = currentIndex > 0 ? currentIndex - 1 : items.length - 1;\n items[prevIndex]?.focus();\n break;\n }\n case 'Home': {\n event.preventDefault();\n items[0]?.focus();\n break;\n }\n case 'End': {\n event.preventDefault();\n items[items.length - 1]?.focus();\n break;\n }\n case 'Tab': {\n if (!this.stayOpenOnFocusout) {\n this.close();\n }\n break;\n }\n }\n };\n\n private handleItemSelection = (event: CustomEvent): void => {\n const detail = event.detail;\n this.emitEvent('select', detail);\n\n if (!detail?.keepOpen && this.closeOnItemClick) {\n this.close();\n this.menuButton?.focus();\n }\n };\n\n private handleActionClick = (event: MouseEvent): void => {\n if (this.disabled) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n\n if (this.type === 'submit' || this.type === 'reset') {\n const form = this.closest('form');\n if (form) {\n if (this.type === 'submit') {\n form.requestSubmit();\n } else {\n form.reset();\n }\n }\n }\n\n this.emitEvent('action', {\n target: this,\n open: this.open,\n });\n };\n\n private handleMenuClick = (event: MouseEvent): void => {\n event.stopPropagation();\n if (this.disabled) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n\n this.open = !this.open;\n\n this.emitEvent('trailing-click', {\n target: this,\n open: this.open,\n });\n\n this.emitEvent('toggle', {\n target: this,\n open: this.open,\n });\n };\n\n private handleBackdropClick = (event: MouseEvent): void => {\n event.stopPropagation();\n this.close();\n };\n\n /**\n * Opens the submenu.\n */\n show(): void {\n if (!this.open) {\n this.open = true;\n }\n }\n\n /**\n * Closes the submenu.\n */\n close(): void {\n if (this.open) {\n this.open = false;\n }\n }\n\n /**\n * Toggles the submenu open/closed state.\n */\n toggle(): void {\n this.open = !this.open;\n }\n\n /**\n * Returns all menu items inside the split button submenu.\n * @param onlyEnabled - If true, filters out disabled items.\n */\n getItems(onlyEnabled = false): HTMLElement[] {\n const items = Array.from(\n this.querySelectorAll('md-menu-item, [role=\"menuitem\"], button.menu-item')\n ) as HTMLElement[];\n\n if (onlyEnabled) {\n return items.filter((item) => {\n const isDisabled = item.hasAttribute('disabled') || (item as any).disabled;\n return !isDisabled;\n });\n }\n return items;\n }\n\n /**\n * Focuses the first non-disabled menu item.\n */\n focusFirstItem(): void {\n const items = this.getItems(true);\n if (items.length > 0) {\n items[0]!.focus();\n } else if (this.menuSurfaceElement) {\n this.menuSurfaceElement.focus();\n }\n }\n\n /**\n * Focuses the last non-disabled menu item.\n */\n focusLastItem(): void {\n const items = this.getItems(true);\n if (items.length > 0) {\n items[items.length - 1]!.focus();\n }\n }\n\n /**\n * Focuses the menu item at the specified index.\n */\n focusItemAtIndex(index: number): void {\n const items = this.getItems(true);\n if (index >= 0 && index < items.length) {\n items[index]!.focus();\n }\n }\n\n override render() {\n return html`\n <div class=\"backdrop\" @click=${this.handleBackdropClick}></div>\n\n <div class=\"container\" role=\"group\">\n <button\n type=${this.type}\n class=\"action-button\"\n ?disabled=${this.disabled}\n aria-label=${this.actionAriaLabel || nothing}\n @click=${this.handleActionClick}\n >\n <md-ripple ?disabled=${this.disabled}></md-ripple>\n <md-focus-ring></md-focus-ring>\n <span class=\"content\">\n <slot name=\"icon\" @slotchange=${this.handleSlotChange}>\n ${this.icon ? html`<md-icon name=${this.icon}></md-icon>` : nothing}\n </slot>\n <slot name=\"label\">${this.label}</slot>\n </span>\n </button>\n\n <button\n type=\"button\"\n class=\"menu-button\"\n ?disabled=${this.disabled}\n aria-haspopup=\"menu\"\n aria-expanded=${this.open ? 'true' : 'false'}\n aria-label=${this.menuAriaLabel}\n @click=${this.handleMenuClick}\n >\n <md-ripple ?disabled=${this.disabled}></md-ripple>\n <md-focus-ring></md-focus-ring>\n <span class=\"icon-wrapper\">\n <slot name=\"trailing-icon\">\n <md-icon name=${this.trailingIcon || 'arrow_drop_down'}></md-icon>\n </slot>\n </span>\n </button>\n\n <!-- Submenu Surface -->\n <div\n class=\"menu-surface\"\n role=\"menu\"\n tabindex=\"-1\"\n aria-label=${this.menuAriaLabel}\n aria-hidden=${this.open ? 'false' : 'true'}\n @keydown=${this.handleSurfaceKeyDown}\n >\n <slot name=\"menu\"></slot>\n <slot></slot>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-split-button': MdSplitButton;\n }\n}\n"],"mappings":";;;;;;AAEA,IAAa,IAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,MAAA;AAGzB,EAAA,CAAA,EAAS;AAAA,EAAE,MAAM;AAAA,EAAQ,WAAW;AAAoB,CAAC,CAAA,GAAA,EAAA,WAAA,mBAAA,MAAA;AAGzD,EAAA,CAAA,EAAS;AAAA,EAAE,MAAM;AAAA,EAAQ,WAAW;AAAkB,CAAC,CAAA,GAAA,EAAA,WAAA,iBAAA,MAAA;AAGvD,EAAA,CAAA,EAAS;AAAA,EAAE,MAAM;AAAA,EAAQ,WAAW;AAAA,EAAkB,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,iBAAA,MAAA;AAGrE,EAAA,CAAA,EAAS;AAAA,EAAE,MAAM;AAAA,EAAS,WAAW;AAAwB,CAAC,CAAA,GAAA,EAAA,WAAA,sBAAA,MAAA;AAG9D,EAAA,CAAA,EAAS;AAAA,EAAE,MAAM;AAAA,EAAS,WAAW;AAAsB,CAAC,CAAA,GAAA,EAAA,WAAA,oBAAA,MAAA;AAG5D,EAAA,CAAA,EAAM,gBAAgB,CAAA,GAAA,EAAA,WAAA,gBAAA,MAAA;AAGtB,EAAA,CAAA,EAAM,cAAc,CAAA,GAAA,EAAA,WAAA,cAAA,MAAA;AAGpB,EAAA,CAAA,EAAM,eAAe,CAAA,GAAA,EAAA,WAAA,sBAAA,MAAA;AAGrB,EAAA,CAAA,EAAsB,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,iBAAA,MAAA;AAjDxC,IAAA,EAAA,CAAA,EAAc,iBAAiB,CAAA,GAAA,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { n, t as e } from "./decorate-DXuynaiA.js";
|
|
|
2
2
|
import "./ripple-squbKHhj.js";
|
|
3
3
|
import "./focus-ring-CuiJuM-y.js";
|
|
4
4
|
import "./icon-DrNqcNEL.js";
|
|
5
|
-
import "./icon-button-
|
|
5
|
+
import "./icon-button-BQz73GLa.js";
|
|
6
6
|
import "./checkbox-BqlboAHd.js";
|
|
7
7
|
import "./progress-LQmLMDjX.js";
|
|
8
8
|
import { css as v, html as r, nothing as u } from "lit";
|
|
@@ -770,4 +770,4 @@ export {
|
|
|
770
770
|
y as u
|
|
771
771
|
};
|
|
772
772
|
|
|
773
|
-
//# sourceMappingURL=table-
|
|
773
|
+
//# sourceMappingURL=table-CqHnneAj.js.map
|