@francofantomius/material-components 0.1.0 → 1.0.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.
Files changed (166) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +550 -90
  3. package/custom-elements.json +21010 -2354
  4. package/dist/chunks/badge-G4EjcMoy.js +89 -0
  5. package/dist/chunks/badge-G4EjcMoy.js.map +1 -0
  6. package/dist/chunks/button-B4TSZ7Sl.js +250 -0
  7. package/dist/chunks/button-B4TSZ7Sl.js.map +1 -0
  8. package/dist/chunks/card-DVffdPpv.js +163 -0
  9. package/dist/chunks/card-DVffdPpv.js.map +1 -0
  10. package/dist/chunks/checkbox-BqlboAHd.js +194 -0
  11. package/dist/chunks/checkbox-BqlboAHd.js.map +1 -0
  12. package/dist/chunks/chip-CI1ZINnr.js +169 -0
  13. package/dist/chunks/chip-CI1ZINnr.js.map +1 -0
  14. package/dist/chunks/code-C5UFBkCh.js +1830 -0
  15. package/dist/chunks/code-C5UFBkCh.js.map +1 -0
  16. package/dist/chunks/decorate-DXuynaiA.js +39 -0
  17. package/dist/chunks/decorate-DXuynaiA.js.map +1 -0
  18. package/dist/chunks/dialog-DGVEE5m_.js +158 -0
  19. package/dist/chunks/dialog-DGVEE5m_.js.map +1 -0
  20. package/dist/chunks/divider-DNepwoZv.js +82 -0
  21. package/dist/chunks/divider-DNepwoZv.js.map +1 -0
  22. package/dist/chunks/fab-C9j3WBHE.js +150 -0
  23. package/dist/chunks/fab-C9j3WBHE.js.map +1 -0
  24. package/dist/chunks/focus-ring-CuiJuM-y.js +71 -0
  25. package/dist/chunks/focus-ring-CuiJuM-y.js.map +1 -0
  26. package/dist/chunks/{form-associated-fKbeX_2P.js → form-associated-Cty_ZaS9.js} +26 -27
  27. package/dist/chunks/form-associated-Cty_ZaS9.js.map +1 -0
  28. package/dist/chunks/icon-DrNqcNEL.js +62 -0
  29. package/dist/chunks/icon-DrNqcNEL.js.map +1 -0
  30. package/dist/chunks/icon-button-BdSc7eot.js +188 -0
  31. package/dist/chunks/icon-button-BdSc7eot.js.map +1 -0
  32. package/dist/chunks/list-D8olR7oZ.js +204 -0
  33. package/dist/chunks/list-D8olR7oZ.js.map +1 -0
  34. package/dist/chunks/navigation-drawer-CKl44Ef5.js +531 -0
  35. package/dist/chunks/navigation-drawer-CKl44Ef5.js.map +1 -0
  36. package/dist/chunks/player-C4ydiIpr.js +1582 -0
  37. package/dist/chunks/player-C4ydiIpr.js.map +1 -0
  38. package/dist/chunks/progress-LQmLMDjX.js +266 -0
  39. package/dist/chunks/progress-LQmLMDjX.js.map +1 -0
  40. package/dist/chunks/radio-Bily78NT.js +205 -0
  41. package/dist/chunks/radio-Bily78NT.js.map +1 -0
  42. package/dist/chunks/ripple-squbKHhj.js +135 -0
  43. package/dist/chunks/ripple-squbKHhj.js.map +1 -0
  44. package/dist/chunks/search-bar-TXnqJ-gd.js +698 -0
  45. package/dist/chunks/search-bar-TXnqJ-gd.js.map +1 -0
  46. package/dist/chunks/snackbar-Wsz3BzEY.js +161 -0
  47. package/dist/chunks/snackbar-Wsz3BzEY.js.map +1 -0
  48. package/dist/chunks/switch-DdukrvXb.js +190 -0
  49. package/dist/chunks/switch-DdukrvXb.js.map +1 -0
  50. package/dist/chunks/table-aRTYzDyE.js +773 -0
  51. package/dist/chunks/table-aRTYzDyE.js.map +1 -0
  52. package/dist/chunks/tabs-BfOtoeir.js +191 -0
  53. package/dist/chunks/tabs-BfOtoeir.js.map +1 -0
  54. package/dist/chunks/text-field-hN6-2HQy.js +338 -0
  55. package/dist/chunks/text-field-hN6-2HQy.js.map +1 -0
  56. package/dist/chunks/top-app-bar-Dgbp6CFv.js +228 -0
  57. package/dist/chunks/top-app-bar-Dgbp6CFv.js.map +1 -0
  58. package/dist/components/account-menu/account-menu.css.d.ts +3 -0
  59. package/dist/components/account-menu/account-menu.css.d.ts.map +1 -0
  60. package/dist/components/account-menu/account-menu.d.ts +111 -0
  61. package/dist/components/account-menu/account-menu.d.ts.map +1 -0
  62. package/dist/components/app-drawer/app-drawer.css.d.ts +3 -0
  63. package/dist/components/app-drawer/app-drawer.css.d.ts.map +1 -0
  64. package/dist/components/app-drawer/app-drawer.d.ts +173 -0
  65. package/dist/components/app-drawer/app-drawer.d.ts.map +1 -0
  66. package/dist/components/badge/badge.js +2 -91
  67. package/dist/components/button/button.js +2 -261
  68. package/dist/components/card/card.js +2 -167
  69. package/dist/components/checkbox/checkbox.css.d.ts.map +1 -1
  70. package/dist/components/checkbox/checkbox.js +2 -186
  71. package/dist/components/chip/chip.js +3 -172
  72. package/dist/components/code/code.css.d.ts +2 -0
  73. package/dist/components/code/code.css.d.ts.map +1 -0
  74. package/dist/components/code/code.d.ts +106 -0
  75. package/dist/components/code/code.d.ts.map +1 -0
  76. package/dist/components/code/code.js +5 -0
  77. package/dist/components/code/highlighter.d.ts +8 -0
  78. package/dist/components/code/highlighter.d.ts.map +1 -0
  79. package/dist/components/code/linter.d.ts +44 -0
  80. package/dist/components/code/linter.d.ts.map +1 -0
  81. package/dist/components/dialog/dialog.js +2 -165
  82. package/dist/components/divider/divider.js +2 -79
  83. package/dist/components/fab/fab.js +2 -153
  84. package/dist/components/icon/icon.js +2 -68
  85. package/dist/components/icon-button/icon-button.css.d.ts.map +1 -1
  86. package/dist/components/icon-button/icon-button.js +1 -189
  87. package/dist/components/list/list.css.d.ts.map +1 -1
  88. package/dist/components/list/list.d.ts.map +1 -1
  89. package/dist/components/list/list.js +3 -188
  90. package/dist/components/navigation-drawer/navigation-drawer.css.d.ts +3 -0
  91. package/dist/components/navigation-drawer/navigation-drawer.css.d.ts.map +1 -0
  92. package/dist/components/navigation-drawer/navigation-drawer.d.ts +76 -0
  93. package/dist/components/navigation-drawer/navigation-drawer.d.ts.map +1 -0
  94. package/dist/components/navigation-drawer/navigation-drawer.js +8 -0
  95. package/dist/components/player/player.css.d.ts +2 -0
  96. package/dist/components/player/player.css.d.ts.map +1 -0
  97. package/dist/components/player/player.d.ts +99 -0
  98. package/dist/components/player/player.d.ts.map +1 -0
  99. package/dist/components/player/player.js +7 -0
  100. package/dist/components/progress/progress.css.d.ts.map +1 -1
  101. package/dist/components/progress/progress.d.ts +2 -0
  102. package/dist/components/progress/progress.d.ts.map +1 -1
  103. package/dist/components/progress/progress.js +3 -181
  104. package/dist/components/radio/radio.css.d.ts.map +1 -1
  105. package/dist/components/radio/radio.js +3 -203
  106. package/dist/components/search-bar/search-bar.css.d.ts +2 -0
  107. package/dist/components/search-bar/search-bar.css.d.ts.map +1 -0
  108. package/dist/components/search-bar/search-bar.d.ts +81 -0
  109. package/dist/components/search-bar/search-bar.d.ts.map +1 -0
  110. package/dist/components/search-bar/search-bar.js +5 -0
  111. package/dist/components/snackbar/snackbar.js +2 -162
  112. package/dist/components/switch/switch.css.d.ts.map +1 -1
  113. package/dist/components/switch/switch.js +2 -169
  114. package/dist/components/table/table.css.d.ts +8 -0
  115. package/dist/components/table/table.css.d.ts.map +1 -0
  116. package/dist/components/table/table.d.ts +158 -0
  117. package/dist/components/table/table.d.ts.map +1 -0
  118. package/dist/components/table/table.js +13 -0
  119. package/dist/components/tabs/tabs.js +3 -198
  120. package/dist/components/text-field/text-field.css.d.ts.map +1 -1
  121. package/dist/components/text-field/text-field.d.ts +1 -1
  122. package/dist/components/text-field/text-field.d.ts.map +1 -1
  123. package/dist/components/text-field/text-field.js +2 -325
  124. package/dist/components/top-app-bar/top-app-bar.css.d.ts +2 -0
  125. package/dist/components/top-app-bar/top-app-bar.css.d.ts.map +1 -0
  126. package/dist/components/top-app-bar/top-app-bar.d.ts +29 -0
  127. package/dist/components/top-app-bar/top-app-bar.d.ts.map +1 -0
  128. package/dist/components/top-app-bar/top-app-bar.js +5 -0
  129. package/dist/index.d.ts +8 -0
  130. package/dist/index.d.ts.map +1 -1
  131. package/dist/index.js +2264 -58
  132. package/dist/index.js.map +1 -1
  133. package/dist/internal/focus-ring/focus-ring.d.ts.map +1 -1
  134. package/dist/internal/focus-ring/focus-ring.js +4 -0
  135. package/dist/internal/ripple/ripple.css.d.ts.map +1 -1
  136. package/dist/internal/ripple/ripple.d.ts +0 -3
  137. package/dist/internal/ripple/ripple.d.ts.map +1 -1
  138. package/dist/internal/ripple/ripple.js +2 -142
  139. package/dist/tokens/index.js +336 -11
  140. package/dist/tokens/index.js.map +1 -1
  141. package/package.json +118 -12
  142. package/dist/chunks/base-component-DQTjlEVL.js +0 -34
  143. package/dist/chunks/base-component-DQTjlEVL.js.map +0 -1
  144. package/dist/chunks/focus-ring-Dl-XoEKK.js +0 -71
  145. package/dist/chunks/focus-ring-Dl-XoEKK.js.map +0 -1
  146. package/dist/chunks/form-associated-fKbeX_2P.js.map +0 -1
  147. package/dist/chunks/theme.css-DV3DRha-.js +0 -263
  148. package/dist/chunks/theme.css-DV3DRha-.js.map +0 -1
  149. package/dist/components/badge/badge.js.map +0 -1
  150. package/dist/components/button/button.js.map +0 -1
  151. package/dist/components/card/card.js.map +0 -1
  152. package/dist/components/checkbox/checkbox.js.map +0 -1
  153. package/dist/components/chip/chip.js.map +0 -1
  154. package/dist/components/dialog/dialog.js.map +0 -1
  155. package/dist/components/divider/divider.js.map +0 -1
  156. package/dist/components/fab/fab.js.map +0 -1
  157. package/dist/components/icon/icon.js.map +0 -1
  158. package/dist/components/icon-button/icon-button.js.map +0 -1
  159. package/dist/components/list/list.js.map +0 -1
  160. package/dist/components/progress/progress.js.map +0 -1
  161. package/dist/components/radio/radio.js.map +0 -1
  162. package/dist/components/snackbar/snackbar.js.map +0 -1
  163. package/dist/components/switch/switch.js.map +0 -1
  164. package/dist/components/tabs/tabs.js.map +0 -1
  165. package/dist/components/text-field/text-field.js.map +0 -1
  166. package/dist/internal/ripple/ripple.js.map +0 -1
@@ -0,0 +1,698 @@
1
+ import { t as o } from "./decorate-DXuynaiA.js";
2
+ import { t as p } from "./form-associated-Cty_ZaS9.js";
3
+ import "./icon-DrNqcNEL.js";
4
+ import { css as m, html as l, nothing as r } from "lit";
5
+ import { customElement as v, property as a, query as x, state as f } from "lit/decorators.js";
6
+ var y = m`
7
+ :host {
8
+ display: block;
9
+ box-sizing: border-box;
10
+ position: relative;
11
+ width: 100%;
12
+ max-width: var(--md-search-bar-max-width, 100%);
13
+ font-family: var(--md-sys-typescale-font-family, inherit);
14
+ color: var(--md-sys-color-on-surface, #1D1B20);
15
+ vertical-align: middle;
16
+ }
17
+
18
+ :host([disabled]) {
19
+ pointer-events: none;
20
+ opacity: 0.38;
21
+ }
22
+
23
+ .scrim {
24
+ display: none;
25
+ }
26
+
27
+ /* Scrim when active in docked mode to catch outside clicks */
28
+ :host([active]) .scrim {
29
+ display: block;
30
+ position: fixed;
31
+ top: 0;
32
+ left: 0;
33
+ right: 0;
34
+ bottom: 0;
35
+ z-index: 40;
36
+ background: transparent;
37
+ }
38
+
39
+ .search-container {
40
+ position: relative;
41
+ z-index: 1;
42
+ display: flex;
43
+ flex-direction: column;
44
+ width: 100%;
45
+ box-sizing: border-box;
46
+ background-color: var(--md-search-bar-container-color, var(--md-sys-color-surface-container-high, #ECE6F0));
47
+ border-radius: var(--md-sys-shape-corner-full, 28px);
48
+ box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0, 0, 0, 0.15));
49
+ transition: box-shadow 200ms cubic-bezier(0.2, 0, 0, 1),
50
+ border-radius 200ms cubic-bezier(0.2, 0, 0, 1),
51
+ background-color 200ms cubic-bezier(0.2, 0, 0, 1);
52
+ }
53
+
54
+ .search-bar-header {
55
+ display: flex;
56
+ align-items: center;
57
+ min-height: 56px;
58
+ height: 56px;
59
+ padding: 0 8px 0 16px;
60
+ box-sizing: border-box;
61
+ gap: 8px;
62
+ }
63
+
64
+ .leading-slot, .trailing-slot {
65
+ display: inline-flex;
66
+ align-items: center;
67
+ justify-content: center;
68
+ flex-shrink: 0;
69
+ }
70
+
71
+ .icon-btn {
72
+ display: inline-flex;
73
+ align-items: center;
74
+ justify-content: center;
75
+ width: 40px;
76
+ height: 40px;
77
+ border: none;
78
+ background: transparent;
79
+ border-radius: 50%;
80
+ color: var(--md-sys-color-on-surface-variant, #49454F);
81
+ cursor: pointer;
82
+ padding: 0;
83
+ outline: none;
84
+ position: relative;
85
+ transition: background-color 150ms ease;
86
+ }
87
+
88
+ .icon-btn:hover {
89
+ background-color: rgba(73, 69, 79, 0.08);
90
+ }
91
+
92
+ .icon-btn:focus-visible {
93
+ background-color: rgba(73, 69, 79, 0.12);
94
+ }
95
+
96
+ .input-wrapper {
97
+ display: flex;
98
+ flex: 1;
99
+ min-width: 0;
100
+ align-items: center;
101
+ position: relative;
102
+ }
103
+
104
+ input {
105
+ width: 100%;
106
+ border: none;
107
+ background: transparent;
108
+ outline: none;
109
+ font-family: inherit;
110
+ font-size: var(--md-sys-typescale-body-large-size, 16px);
111
+ line-height: var(--md-sys-typescale-body-large-line-height, 24px);
112
+ color: var(--md-sys-color-on-surface, #1D1B20);
113
+ padding: 0 4px;
114
+ margin: 0;
115
+ box-sizing: border-box;
116
+ }
117
+
118
+ input::placeholder {
119
+ color: var(--md-sys-color-on-surface-variant, #49454F);
120
+ opacity: 0.8;
121
+ }
122
+
123
+ /* Active Docked Mode */
124
+ :host([active]) .search-container {
125
+ z-index: 50;
126
+ border-radius: var(--md-sys-shape-corner-extra-large, 28px 28px 16px 16px);
127
+ box-shadow: var(--md-sys-elevation-level3, 0px 4px 8px 3px rgba(0, 0, 0, 0.15));
128
+ }
129
+
130
+ /* Divider when active */
131
+ .divider {
132
+ display: none;
133
+ height: 1px;
134
+ background-color: var(--md-sys-color-outline-variant, #CAC4D0);
135
+ margin: 0 16px;
136
+ }
137
+
138
+ :host([active]) .divider {
139
+ display: block;
140
+ }
141
+
142
+ /* Suggestions / Content Container */
143
+ .suggestions-container {
144
+ display: none;
145
+ flex-direction: column;
146
+ max-height: 360px;
147
+ overflow-y: auto;
148
+ padding: 8px 0;
149
+ box-sizing: border-box;
150
+ }
151
+
152
+ :host([active]) .suggestions-container {
153
+ display: flex;
154
+ }
155
+
156
+ .suggestion-item {
157
+ display: flex;
158
+ align-items: center;
159
+ min-height: 48px;
160
+ padding: 0 16px;
161
+ gap: 16px;
162
+ box-sizing: border-box;
163
+ cursor: pointer;
164
+ position: relative;
165
+ user-select: none;
166
+ color: var(--md-sys-color-on-surface, #1D1B20);
167
+ transition: background-color 150ms ease;
168
+ }
169
+
170
+ .suggestion-item:hover,
171
+ .suggestion-item.highlighted {
172
+ background-color: rgba(73, 69, 79, 0.08);
173
+ }
174
+
175
+ .suggestion-item.selected {
176
+ background-color: rgba(73, 69, 79, 0.12);
177
+ }
178
+
179
+ .suggestion-icon {
180
+ display: inline-flex;
181
+ align-items: center;
182
+ justify-content: center;
183
+ color: var(--md-sys-color-on-surface-variant, #49454F);
184
+ flex-shrink: 0;
185
+ }
186
+
187
+ .suggestion-text {
188
+ display: flex;
189
+ flex-direction: column;
190
+ flex: 1;
191
+ min-width: 0;
192
+ overflow: hidden;
193
+ }
194
+
195
+ .suggestion-label {
196
+ font-size: var(--md-sys-typescale-body-large-size, 16px);
197
+ line-height: 20px;
198
+ white-space: nowrap;
199
+ overflow: hidden;
200
+ text-overflow: ellipsis;
201
+ }
202
+
203
+ .suggestion-supporting {
204
+ font-size: var(--md-sys-typescale-body-medium-size, 14px);
205
+ line-height: 16px;
206
+ color: var(--md-sys-color-on-surface-variant, #49454F);
207
+ white-space: nowrap;
208
+ overflow: hidden;
209
+ text-overflow: ellipsis;
210
+ margin-top: 2px;
211
+ }
212
+
213
+ .suggestion-trailing {
214
+ font-size: var(--md-sys-typescale-body-medium-size, 14px);
215
+ color: var(--md-sys-color-on-surface-variant, #49454F);
216
+ flex-shrink: 0;
217
+ }
218
+
219
+ .search-trigger-container {
220
+ display: none;
221
+ }
222
+
223
+ /* Responsive Fullscreen / Mobile Collapsed Mode */
224
+ @media (max-width: 768px) {
225
+ :host([responsive]:not([active]):not([collapse-on-mobile="false"])),
226
+ :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile="false"])) {
227
+ display: inline-flex;
228
+ width: auto;
229
+ max-width: none;
230
+ vertical-align: middle;
231
+ }
232
+
233
+ :host([responsive]:not([active]):not([collapse-on-mobile="false"])) .search-trigger-container,
234
+ :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile="false"])) .search-trigger-container {
235
+ display: inline-flex;
236
+ align-items: center;
237
+ justify-content: center;
238
+ background-color: transparent;
239
+ border-radius: 50%;
240
+ box-shadow: none;
241
+ cursor: pointer;
242
+ user-select: none;
243
+ outline: none;
244
+ transition: background-color 200ms ease, box-shadow 200ms ease;
245
+ -webkit-tap-highlight-color: transparent;
246
+ }
247
+
248
+ :host([responsive]:not([active]):not([collapse-on-mobile="false"])) .search-trigger-container.has-trailing,
249
+ :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile="false"])) .search-trigger-container.has-trailing {
250
+ height: 48px;
251
+ padding: 0 4px;
252
+ gap: 2px;
253
+ background-color: var(--md-search-bar-container-color, var(--md-sys-color-surface-container-high, #ECE6F0));
254
+ border-radius: var(--md-sys-shape-corner-full, 28px);
255
+ box-shadow: var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0, 0, 0, 0.15));
256
+ }
257
+
258
+ :host([responsive]:not([active]):not([collapse-on-mobile="false"])) .search-trigger-container.has-trailing:hover,
259
+ :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile="false"])) .search-trigger-container.has-trailing:hover {
260
+ box-shadow: var(--md-sys-elevation-level2, 0px 2px 6px 2px rgba(0, 0, 0, 0.15));
261
+ }
262
+
263
+ :host([responsive]:not([active]):not([collapse-on-mobile="false"])) .search-trigger-container:focus-visible,
264
+ :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile="false"])) .search-trigger-container:focus-visible {
265
+ outline: 2px solid var(--md-sys-color-primary, #6750A4);
266
+ outline-offset: 2px;
267
+ }
268
+
269
+ .trigger-btn {
270
+ display: inline-flex;
271
+ align-items: center;
272
+ justify-content: center;
273
+ width: 40px;
274
+ height: 40px;
275
+ min-width: 40px;
276
+ min-height: 40px;
277
+ border-radius: 50%;
278
+ border: none;
279
+ background: transparent;
280
+ color: var(--md-sys-color-on-surface-variant, #49454F);
281
+ cursor: pointer;
282
+ padding: 0;
283
+ margin: 0;
284
+ outline: none;
285
+ position: relative;
286
+ transition: background-color 150ms ease, color 150ms ease;
287
+ -webkit-tap-highlight-color: transparent;
288
+ }
289
+
290
+ .trigger-btn:hover {
291
+ background-color: rgba(73, 69, 79, 0.08);
292
+ }
293
+
294
+ .trigger-btn:focus-visible {
295
+ background-color: rgba(73, 69, 79, 0.12);
296
+ }
297
+
298
+ .trigger-divider {
299
+ width: 1px;
300
+ height: 22px;
301
+ background-color: var(--md-sys-color-outline-variant, #CAC4D0);
302
+ margin: 0 2px;
303
+ flex-shrink: 0;
304
+ }
305
+
306
+ :host([responsive]:not([active]):not([collapse-on-mobile="false"])) .search-container,
307
+ :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile="false"])) .search-container {
308
+ display: none;
309
+ }
310
+
311
+ :host([responsive]:not([active]):not([collapse-on-mobile="false"])) .scrim,
312
+ :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile="false"])) .scrim {
313
+ display: none;
314
+ }
315
+
316
+ :host([responsive][active]),
317
+ :host([collapse-on-mobile][active]) {
318
+ display: block;
319
+ position: fixed;
320
+ top: 0;
321
+ left: 0;
322
+ right: 0;
323
+ bottom: 0;
324
+ width: 100vw;
325
+ height: 100vh;
326
+ height: 100dvh;
327
+ max-width: 100vw;
328
+ margin: 0;
329
+ padding: 0;
330
+ z-index: 99999;
331
+ }
332
+
333
+ :host([responsive][active]) .search-trigger-container,
334
+ :host([collapse-on-mobile][active]) .search-trigger-container {
335
+ display: none;
336
+ }
337
+
338
+ :host([responsive][active]) .scrim,
339
+ :host([collapse-on-mobile][active]) .scrim {
340
+ display: none;
341
+ }
342
+
343
+ :host([responsive][active]) .search-container,
344
+ :host([collapse-on-mobile][active]) .search-container {
345
+ display: flex;
346
+ position: fixed;
347
+ top: 0;
348
+ left: 0;
349
+ right: 0;
350
+ bottom: 0;
351
+ width: 100vw;
352
+ height: 100vh;
353
+ height: 100dvh;
354
+ max-width: 100vw;
355
+ border-radius: 0;
356
+ box-shadow: none;
357
+ z-index: 99999;
358
+ background-color: var(--md-search-bar-container-color, var(--md-sys-color-surface-container-high, #ECE6F0));
359
+ }
360
+
361
+ :host([responsive][active]) .suggestions-container,
362
+ :host([collapse-on-mobile][active]) .suggestions-container {
363
+ flex: 1;
364
+ max-height: calc(100vh - 57px);
365
+ max-height: calc(100dvh - 57px);
366
+ }
367
+ }
368
+
369
+ /* Forced Fullscreen attribute */
370
+ :host([fullscreen][active]) {
371
+ display: block;
372
+ position: fixed;
373
+ top: 0;
374
+ left: 0;
375
+ right: 0;
376
+ bottom: 0;
377
+ width: 100vw;
378
+ height: 100vh;
379
+ height: 100dvh;
380
+ max-width: 100vw;
381
+ z-index: 99999;
382
+ }
383
+
384
+ :host([fullscreen][active]) .search-trigger-container {
385
+ display: none;
386
+ }
387
+
388
+ :host([fullscreen][active]) .scrim {
389
+ display: none;
390
+ }
391
+
392
+ :host([fullscreen][active]) .search-container {
393
+ display: flex;
394
+ position: fixed;
395
+ top: 0;
396
+ left: 0;
397
+ right: 0;
398
+ bottom: 0;
399
+ width: 100vw;
400
+ height: 100vh;
401
+ height: 100dvh;
402
+ max-width: 100vw;
403
+ border-radius: 0;
404
+ box-shadow: none;
405
+ z-index: 99999;
406
+ background-color: var(--md-search-bar-container-color, var(--md-sys-color-surface-container-high, #ECE6F0));
407
+ }
408
+
409
+ :host([fullscreen][active]) .suggestions-container {
410
+ flex: 1;
411
+ max-height: calc(100vh - 57px);
412
+ max-height: calc(100dvh - 57px);
413
+ }
414
+ `, i = class extends p {
415
+ constructor(...t) {
416
+ super(...t), this.value = "", this.placeholder = "Search", this.active = !1, this.suggestions = [], this.leadingIcon = "search", this.activeLeadingIcon = "arrow_back", this.trailingIcon = "", this.showBackButton = !0, this.showClearButton = !0, this.responsive = !0, this.collapseOnMobile = !0, this.fullscreen = !1, this.autoDeactivateOnSelect = !0, this.highlightedIndex = -1, this.handleFocus = () => {
417
+ this.active || (this.active = !0, this.emitEvent("active-change", { active: !0 }));
418
+ }, this.handleInput = (e) => {
419
+ const s = e.target;
420
+ this.value = s.value, this.setFormValue(this.value), this.toggleAttribute("has-value", !!this.value), this.highlightedIndex = -1, this.emitEvent("input", { value: this.value });
421
+ }, this.handleChange = () => {
422
+ this.emitEvent("change", { value: this.value });
423
+ }, this.handleKeyDown = (e) => {
424
+ const s = this.suggestions.length;
425
+ if (e.key === "Escape") {
426
+ e.preventDefault(), this.close(), this.inputElement?.blur();
427
+ return;
428
+ }
429
+ if (e.key === "ArrowDown") {
430
+ if (!this.active) {
431
+ this.show();
432
+ return;
433
+ }
434
+ s > 0 && (e.preventDefault(), this.highlightedIndex = (this.highlightedIndex + 1) % s);
435
+ return;
436
+ }
437
+ if (e.key === "ArrowUp") {
438
+ s > 0 && this.active && (e.preventDefault(), this.highlightedIndex = this.highlightedIndex <= 0 ? s - 1 : this.highlightedIndex - 1);
439
+ return;
440
+ }
441
+ if (e.key === "Enter")
442
+ if (this.active && this.highlightedIndex >= 0 && this.highlightedIndex < s) {
443
+ const n = this.suggestions[this.highlightedIndex];
444
+ n !== void 0 && (e.preventDefault(), this.selectSuggestion(n, this.highlightedIndex));
445
+ } else this.emitEvent("search", { value: this.value });
446
+ }, this.handleTriggerClick = (e) => {
447
+ e.stopPropagation(), this.show();
448
+ }, this.handleTriggerKeyDown = (e) => {
449
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.show());
450
+ }, this.handleTrailingTriggerClick = (e) => {
451
+ e.stopPropagation(), this.emitEvent("trailing-icon-click", { icon: this.trailingIcon }) && this.show();
452
+ }, this.handleBackClick = (e) => {
453
+ e.stopPropagation(), this.close();
454
+ }, this.handleScrimClick = () => {
455
+ this.close();
456
+ }, this.handleClearClick = (e) => {
457
+ e.stopPropagation(), this.clear();
458
+ };
459
+ }
460
+ static {
461
+ this.styles = [p.styles, y];
462
+ }
463
+ connectedCallback() {
464
+ super.connectedCallback(), this.setFormValue(this.value), this.toggleAttribute("has-value", !!this.value), this.toggleAttribute("active", this.active), this.toggleAttribute("collapse-on-mobile", this.collapseOnMobile);
465
+ }
466
+ willUpdate(t) {
467
+ super.willUpdate(t), t.has("value") && (this.setFormValue(this.value), this.toggleAttribute("has-value", !!this.value)), t.has("active") && (this.toggleAttribute("active", this.active), this.active || (this.highlightedIndex = -1)), t.has("collapseOnMobile") && this.toggleAttribute("collapse-on-mobile", this.collapseOnMobile);
468
+ }
469
+ formResetCallback() {
470
+ this.value = "", this.setFormValue(null), this.toggleAttribute("has-value", !1), this.highlightedIndex = -1;
471
+ }
472
+ focus() {
473
+ this.inputElement?.focus();
474
+ }
475
+ show() {
476
+ this.active || (this.active = !0, this.emitEvent("active-change", { active: !0 })), this.updateComplete.then(() => {
477
+ this.inputElement?.focus();
478
+ });
479
+ }
480
+ open() {
481
+ this.show();
482
+ }
483
+ close() {
484
+ this.active && (this.active = !1, this.highlightedIndex = -1, this.emitEvent("active-change", { active: !1 }));
485
+ }
486
+ collapse() {
487
+ this.close();
488
+ }
489
+ toggle() {
490
+ this.active ? this.close() : this.show();
491
+ }
492
+ clear() {
493
+ this.value = "", this.setFormValue(""), this.toggleAttribute("has-value", !1), this.highlightedIndex = -1, this.emitEvent("input", { value: "" }), this.emitEvent("clear"), this.inputElement?.focus();
494
+ }
495
+ selectSuggestion(t, e) {
496
+ const s = typeof t == "string" ? t : t.label, n = typeof t == "string" ? t : t.value ?? t.label;
497
+ this.value = n, this.setFormValue(this.value), this.toggleAttribute("has-value", !!this.value), this.emitEvent("suggestion-select", {
498
+ suggestion: t,
499
+ label: s,
500
+ value: n,
501
+ index: e
502
+ }), this.emitEvent("search", {
503
+ value: this.value,
504
+ suggestion: t
505
+ }), this.autoDeactivateOnSelect && this.close();
506
+ }
507
+ renderSuggestionItem(t, e) {
508
+ const s = typeof t == "string", n = s ? t : t.label, c = s ? void 0 : t.supportingText, h = s ? void 0 : t.trailingSupportingText, b = !s && t.icon ? t.icon : "history", d = this.highlightedIndex === e;
509
+ return l`
510
+ <div
511
+ class="suggestion-item ${d ? "highlighted" : ""}"
512
+ role="option"
513
+ aria-selected=${d ? "true" : "false"}
514
+ @click=${() => this.selectSuggestion(t, e)}
515
+ >
516
+ <span class="suggestion-icon">
517
+ <md-icon name=${b}></md-icon>
518
+ </span>
519
+ <div class="suggestion-text">
520
+ <span class="suggestion-label">${n}</span>
521
+ ${c ? l`<span class="suggestion-supporting">${c}</span>` : r}
522
+ </div>
523
+ ${h ? l`<span class="suggestion-trailing">${h}</span>` : r}
524
+ </div>
525
+ `;
526
+ }
527
+ render() {
528
+ const t = this.active && this.showBackButton, e = !!this.trailingIcon;
529
+ return l`
530
+ <div
531
+ class="search-trigger-container ${e ? "has-trailing" : ""}"
532
+ role="button"
533
+ tabindex="0"
534
+ aria-label=${this.placeholder || "Search"}
535
+ title=${this.placeholder || "Search"}
536
+ ?disabled=${this.disabled}
537
+ @click=${this.handleTriggerClick}
538
+ @keydown=${this.handleTriggerKeyDown}
539
+ >
540
+ <button
541
+ class="trigger-btn"
542
+ type="button"
543
+ aria-label=${this.placeholder || "Search"}
544
+ title=${this.placeholder || "Search"}
545
+ ?disabled=${this.disabled}
546
+ @click=${this.handleTriggerClick}
547
+ >
548
+ <md-icon name=${this.leadingIcon || "search"}></md-icon>
549
+ </button>
550
+
551
+ ${e ? l`
552
+ <div class="trigger-divider" aria-hidden="true"></div>
553
+ <button
554
+ class="trigger-btn trigger-trailing-btn"
555
+ type="button"
556
+ aria-label=${this.trailingIcon}
557
+ title=${this.trailingIcon}
558
+ ?disabled=${this.disabled}
559
+ @click=${this.handleTrailingTriggerClick}
560
+ >
561
+ <md-icon name=${this.trailingIcon}></md-icon>
562
+ </button>
563
+ ` : r}
564
+ </div>
565
+
566
+ <div class="scrim" @click=${this.handleScrimClick}></div>
567
+
568
+ <div class="search-container" role="search">
569
+ <div class="search-bar-header">
570
+ <span class="leading-slot">
571
+ <slot name="leading-icon">
572
+ ${t ? l`
573
+ <button
574
+ class="icon-btn"
575
+ type="button"
576
+ aria-label="Back"
577
+ @click=${this.handleBackClick}
578
+ >
579
+ <md-icon name=${this.activeLeadingIcon}></md-icon>
580
+ </button>
581
+ ` : l`
582
+ <span class="icon-btn" style="cursor: default;">
583
+ <md-icon name=${this.leadingIcon}></md-icon>
584
+ </span>
585
+ `}
586
+ </slot>
587
+ </span>
588
+
589
+ <div class="input-wrapper">
590
+ <input
591
+ type="search"
592
+ role="combobox"
593
+ aria-autocomplete="list"
594
+ aria-expanded=${this.active ? "true" : "false"}
595
+ aria-label=${this.placeholder}
596
+ placeholder=${this.placeholder}
597
+ .value=${this.value}
598
+ ?disabled=${this.disabled}
599
+ @input=${this.handleInput}
600
+ @change=${this.handleChange}
601
+ @keydown=${this.handleKeyDown}
602
+ @focus=${this.handleFocus}
603
+ @click=${this.handleFocus}
604
+ />
605
+ </div>
606
+
607
+ <span class="trailing-slot">
608
+ ${this.showClearButton && this.value ? l`
609
+ <button
610
+ class="icon-btn clear-btn"
611
+ type="button"
612
+ aria-label="Clear search"
613
+ @click=${this.handleClearClick}
614
+ >
615
+ <md-icon name="close"></md-icon>
616
+ </button>
617
+ ` : r}
618
+
619
+ <slot name="trailing-icon">
620
+ ${this.trailingIcon ? l`
621
+ <span class="icon-btn" style="cursor: default;">
622
+ <md-icon name=${this.trailingIcon}></md-icon>
623
+ </span>
624
+ ` : r}
625
+ </slot>
626
+ </span>
627
+ </div>
628
+
629
+ <div class="divider"></div>
630
+
631
+ <div class="suggestions-container" role="listbox" aria-label="Suggestions">
632
+ <slot name="suggestions">
633
+ ${this.suggestions.map((s, n) => this.renderSuggestionItem(s, n))}
634
+ </slot>
635
+ <div class="extra-content">
636
+ <slot></slot>
637
+ </div>
638
+ </div>
639
+ </div>
640
+ `;
641
+ }
642
+ };
643
+ o([a({ type: String })], i.prototype, "value", void 0);
644
+ o([a({ type: String })], i.prototype, "placeholder", void 0);
645
+ o([a({
646
+ type: Boolean,
647
+ reflect: !0
648
+ })], i.prototype, "active", void 0);
649
+ o([a({ type: Array })], i.prototype, "suggestions", void 0);
650
+ o([a({
651
+ type: String,
652
+ attribute: "leading-icon"
653
+ })], i.prototype, "leadingIcon", void 0);
654
+ o([a({
655
+ type: String,
656
+ attribute: "active-leading-icon"
657
+ })], i.prototype, "activeLeadingIcon", void 0);
658
+ o([a({
659
+ type: String,
660
+ attribute: "trailing-icon"
661
+ })], i.prototype, "trailingIcon", void 0);
662
+ o([a({
663
+ type: Boolean,
664
+ attribute: "show-back-button"
665
+ })], i.prototype, "showBackButton", void 0);
666
+ o([a({
667
+ type: Boolean,
668
+ attribute: "show-clear-button"
669
+ })], i.prototype, "showClearButton", void 0);
670
+ o([a({
671
+ type: Boolean,
672
+ reflect: !0
673
+ })], i.prototype, "responsive", void 0);
674
+ o([a({
675
+ type: Boolean,
676
+ attribute: "collapse-on-mobile",
677
+ reflect: !0
678
+ })], i.prototype, "collapseOnMobile", void 0);
679
+ o([a({
680
+ type: Boolean,
681
+ reflect: !0
682
+ })], i.prototype, "fullscreen", void 0);
683
+ o([a({
684
+ type: Boolean,
685
+ attribute: "auto-deactivate-on-select"
686
+ })], i.prototype, "autoDeactivateOnSelect", void 0);
687
+ o([f()], i.prototype, "highlightedIndex", void 0);
688
+ o([x("input")], i.prototype, "inputElement", void 0);
689
+ i = o([v("md-search-bar")], i);
690
+ var g = class extends i {
691
+ };
692
+ g = o([v("md-search")], g);
693
+ export {
694
+ i as n,
695
+ g as t
696
+ };
697
+
698
+ //# sourceMappingURL=search-bar-TXnqJ-gd.js.map