@francofantomius/material-components 1.2.0 → 1.3.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 +29 -0
- package/README.md +2 -2
- package/custom-elements.json +224 -0
- package/dist/chunks/{search-bar-B6xxVT7u.js → search-bar-B4lAXza_.js} +148 -52
- package/dist/chunks/search-bar-B4lAXza_.js.map +1 -0
- package/dist/components/search-bar/search-bar.js +1 -1
- package/dist/index.js +1 -1
- package/llms.txt +22 -5
- package/package.json +5 -4
- package/dist/chunks/search-bar-B6xxVT7u.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,35 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.3.0] - 2026-09-13
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Search Bar (`md-search-bar`, `md-search`) Enhancements**:
|
|
12
|
+
- Added `search-icon-position` property (`'leading'` | `'trailing'` | `'left'` | `'right'`), enabling placement of the search icon on the right/trailing edge of the search bar.
|
|
13
|
+
- Added support for leading navigation action buttons (e.g. hamburger drawer menu trigger via `leading-icon="menu"` or custom slotted elements via `slot="leading"` / `slot="leading-icon"`).
|
|
14
|
+
- Added `leading-icon-click` and `trailing-icon-click` custom events dispatched when respective action buttons are pressed.
|
|
15
|
+
- Added interactive ripples (`md-ripple`) and focus indicators (`md-focus-ring`) to leading, trailing, and clear icon buttons.
|
|
16
|
+
- Added smart slot change detection (`@slotchange`) to suppress divider lines and suggestions container when the search bar is active with no suggestions or slotted extra content.
|
|
17
|
+
- Improved collapsed mobile search bar trigger behavior, properly routing interactions between custom leading actions and trailing search triggers.
|
|
18
|
+
- **Component Documentation & Live Examples (`docs/components/`)**:
|
|
19
|
+
- Added interactive demonstrations and copyable code snippets for right-aligned search icons and navigation menu triggers in `docs/components/search-bar.md`.
|
|
20
|
+
- Re-implemented interactive live previews and usage examples across all component documentation pages.
|
|
21
|
+
- **AI Developer Documentation (`llms.txt`)**:
|
|
22
|
+
- Documented `search-icon-position`, `leading-icon-click`, and `trailing-icon-click` in the Search Bar API reference table.
|
|
23
|
+
- Added usage examples illustrating right-aligned search icons and hamburger menu triggers.
|
|
24
|
+
- **Development Tooling**:
|
|
25
|
+
- Added `build:example` script in `package.json` for standalone IIFE bundling with `esbuild`.
|
|
26
|
+
- **Testing**:
|
|
27
|
+
- Added unit test suites in `tests/search-bar.test.ts` covering right-aligned search icon configuration, hamburger menu leading button interactions, slotted leading elements, and empty active states.
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- **Dependencies & Build Infrastructure**:
|
|
31
|
+
- Upgraded development dependencies across `package.json` and `package-lock.json`.
|
|
32
|
+
- Tuned Vite build and Vitest testing configurations.
|
|
33
|
+
- Updated documentation deployment workflow (`.github/workflows/deploy-docs.yml`).
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
8
37
|
## [1.2.0] - 2026-09-09
|
|
9
38
|
|
|
10
39
|
### Added
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<p align="left">
|
|
4
4
|
<a href="https://www.npmjs.com/package/@francofantomius/material-components"><img src="https://img.shields.io/npm/v/@francofantomius/material-components?color=6750A4&label=npm&logo=npm" alt="npm version" /></a>
|
|
5
|
-
<a href="https://github.com/FrancoFantomius/material-components/releases/tag/v1.
|
|
5
|
+
<a href="https://github.com/FrancoFantomius/material-components/releases/tag/v1.3.0"><img src="https://img.shields.io/badge/version-1.3.0-6750A4" alt="version 1.3.0" /></a>
|
|
6
6
|
<a href="https://lit.dev/"><img src="https://img.shields.io/badge/Lit-3.x-324FFF?logo=lit&logoColor=white" alt="Lit 3" /></a>
|
|
7
7
|
<a href="https://vite.dev/"><img src="https://img.shields.io/badge/Vite-8.x-646CFF?logo=vite&logoColor=white" alt="Vite 8" /></a>
|
|
8
8
|
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-Ready-3178C6?logo=typescript&logoColor=white" alt="TypeScript" /></a>
|
|
@@ -97,7 +97,7 @@ For quick prototyping or usage directly in HTML without a bundler, import from a
|
|
|
97
97
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" />
|
|
98
98
|
|
|
99
99
|
<!-- Import from CDN (esm.sh / jsdelivr / unpkg) -->
|
|
100
|
-
<script type="module" src="https://esm.sh/@francofantomius/material-components@1.
|
|
100
|
+
<script type="module" src="https://esm.sh/@francofantomius/material-components@1.3.0"></script>
|
|
101
101
|
</head>
|
|
102
102
|
<body>
|
|
103
103
|
<md-button variant="filled" icon="send">Get Started</md-button>
|
package/custom-elements.json
CHANGED
|
@@ -24527,6 +24527,16 @@
|
|
|
24527
24527
|
"default": "[]",
|
|
24528
24528
|
"attribute": "suggestions"
|
|
24529
24529
|
},
|
|
24530
|
+
{
|
|
24531
|
+
"kind": "field",
|
|
24532
|
+
"name": "searchIconPosition",
|
|
24533
|
+
"type": {
|
|
24534
|
+
"text": "SearchIconPosition"
|
|
24535
|
+
},
|
|
24536
|
+
"default": "'leading'",
|
|
24537
|
+
"attribute": "search-icon-position",
|
|
24538
|
+
"reflects": true
|
|
24539
|
+
},
|
|
24530
24540
|
{
|
|
24531
24541
|
"kind": "field",
|
|
24532
24542
|
"name": "leadingIcon",
|
|
@@ -24620,6 +24630,15 @@
|
|
|
24620
24630
|
"privacy": "private",
|
|
24621
24631
|
"default": "-1"
|
|
24622
24632
|
},
|
|
24633
|
+
{
|
|
24634
|
+
"kind": "field",
|
|
24635
|
+
"name": "hasLeadingSlotContent",
|
|
24636
|
+
"type": {
|
|
24637
|
+
"text": "boolean"
|
|
24638
|
+
},
|
|
24639
|
+
"privacy": "private",
|
|
24640
|
+
"default": "false"
|
|
24641
|
+
},
|
|
24623
24642
|
{
|
|
24624
24643
|
"kind": "field",
|
|
24625
24644
|
"name": "inputElement",
|
|
@@ -24628,6 +24647,57 @@
|
|
|
24628
24647
|
},
|
|
24629
24648
|
"privacy": "private"
|
|
24630
24649
|
},
|
|
24650
|
+
{
|
|
24651
|
+
"kind": "field",
|
|
24652
|
+
"name": "effectiveSearchIconPosition",
|
|
24653
|
+
"type": {
|
|
24654
|
+
"text": "'leading' | 'trailing'"
|
|
24655
|
+
},
|
|
24656
|
+
"readonly": true
|
|
24657
|
+
},
|
|
24658
|
+
{
|
|
24659
|
+
"kind": "field",
|
|
24660
|
+
"name": "effectiveLeadingIcon",
|
|
24661
|
+
"type": {
|
|
24662
|
+
"text": "string"
|
|
24663
|
+
},
|
|
24664
|
+
"readonly": true
|
|
24665
|
+
},
|
|
24666
|
+
{
|
|
24667
|
+
"kind": "field",
|
|
24668
|
+
"name": "effectiveTrailingIcon",
|
|
24669
|
+
"type": {
|
|
24670
|
+
"text": "string"
|
|
24671
|
+
},
|
|
24672
|
+
"readonly": true
|
|
24673
|
+
},
|
|
24674
|
+
{
|
|
24675
|
+
"kind": "field",
|
|
24676
|
+
"name": "hasCustomContent",
|
|
24677
|
+
"type": {
|
|
24678
|
+
"text": "boolean"
|
|
24679
|
+
},
|
|
24680
|
+
"privacy": "private",
|
|
24681
|
+
"default": "false"
|
|
24682
|
+
},
|
|
24683
|
+
{
|
|
24684
|
+
"kind": "field",
|
|
24685
|
+
"name": "hasContent",
|
|
24686
|
+
"type": {
|
|
24687
|
+
"text": "boolean"
|
|
24688
|
+
},
|
|
24689
|
+
"readonly": true
|
|
24690
|
+
},
|
|
24691
|
+
{
|
|
24692
|
+
"kind": "field",
|
|
24693
|
+
"name": "handleLeadingSlotChange",
|
|
24694
|
+
"privacy": "private"
|
|
24695
|
+
},
|
|
24696
|
+
{
|
|
24697
|
+
"kind": "field",
|
|
24698
|
+
"name": "handleContentSlotChange",
|
|
24699
|
+
"privacy": "private"
|
|
24700
|
+
},
|
|
24631
24701
|
{
|
|
24632
24702
|
"kind": "method",
|
|
24633
24703
|
"name": "formResetCallback",
|
|
@@ -24706,6 +24776,16 @@
|
|
|
24706
24776
|
"name": "handleTriggerKeyDown",
|
|
24707
24777
|
"privacy": "private"
|
|
24708
24778
|
},
|
|
24779
|
+
{
|
|
24780
|
+
"kind": "field",
|
|
24781
|
+
"name": "handleLeadingClick",
|
|
24782
|
+
"privacy": "private"
|
|
24783
|
+
},
|
|
24784
|
+
{
|
|
24785
|
+
"kind": "field",
|
|
24786
|
+
"name": "handleTrailingClick",
|
|
24787
|
+
"privacy": "private"
|
|
24788
|
+
},
|
|
24709
24789
|
{
|
|
24710
24790
|
"kind": "field",
|
|
24711
24791
|
"name": "handleTrailingTriggerClick",
|
|
@@ -25146,6 +25226,14 @@
|
|
|
25146
25226
|
"default": "[]",
|
|
25147
25227
|
"fieldName": "suggestions"
|
|
25148
25228
|
},
|
|
25229
|
+
{
|
|
25230
|
+
"name": "search-icon-position",
|
|
25231
|
+
"type": {
|
|
25232
|
+
"text": "SearchIconPosition"
|
|
25233
|
+
},
|
|
25234
|
+
"default": "'leading'",
|
|
25235
|
+
"fieldName": "searchIconPosition"
|
|
25236
|
+
},
|
|
25149
25237
|
{
|
|
25150
25238
|
"name": "leading-icon",
|
|
25151
25239
|
"type": {
|
|
@@ -25345,6 +25433,18 @@
|
|
|
25345
25433
|
"module": "src/components/search-bar/search-bar.ts"
|
|
25346
25434
|
}
|
|
25347
25435
|
},
|
|
25436
|
+
{
|
|
25437
|
+
"name": "search-icon-position",
|
|
25438
|
+
"type": {
|
|
25439
|
+
"text": "SearchIconPosition"
|
|
25440
|
+
},
|
|
25441
|
+
"default": "'leading'",
|
|
25442
|
+
"fieldName": "searchIconPosition",
|
|
25443
|
+
"inheritedFrom": {
|
|
25444
|
+
"name": "MdSearchBar",
|
|
25445
|
+
"module": "src/components/search-bar/search-bar.ts"
|
|
25446
|
+
}
|
|
25447
|
+
},
|
|
25348
25448
|
{
|
|
25349
25449
|
"name": "leading-icon",
|
|
25350
25450
|
"type": {
|
|
@@ -25572,6 +25672,20 @@
|
|
|
25572
25672
|
"module": "src/components/search-bar/search-bar.ts"
|
|
25573
25673
|
}
|
|
25574
25674
|
},
|
|
25675
|
+
{
|
|
25676
|
+
"kind": "field",
|
|
25677
|
+
"name": "searchIconPosition",
|
|
25678
|
+
"type": {
|
|
25679
|
+
"text": "SearchIconPosition"
|
|
25680
|
+
},
|
|
25681
|
+
"default": "'leading'",
|
|
25682
|
+
"attribute": "search-icon-position",
|
|
25683
|
+
"reflects": true,
|
|
25684
|
+
"inheritedFrom": {
|
|
25685
|
+
"name": "MdSearchBar",
|
|
25686
|
+
"module": "src/components/search-bar/search-bar.ts"
|
|
25687
|
+
}
|
|
25688
|
+
},
|
|
25575
25689
|
{
|
|
25576
25690
|
"kind": "field",
|
|
25577
25691
|
"name": "leadingIcon",
|
|
@@ -25705,6 +25819,19 @@
|
|
|
25705
25819
|
"module": "src/components/search-bar/search-bar.ts"
|
|
25706
25820
|
}
|
|
25707
25821
|
},
|
|
25822
|
+
{
|
|
25823
|
+
"kind": "field",
|
|
25824
|
+
"name": "hasLeadingSlotContent",
|
|
25825
|
+
"type": {
|
|
25826
|
+
"text": "boolean"
|
|
25827
|
+
},
|
|
25828
|
+
"privacy": "private",
|
|
25829
|
+
"default": "false",
|
|
25830
|
+
"inheritedFrom": {
|
|
25831
|
+
"name": "MdSearchBar",
|
|
25832
|
+
"module": "src/components/search-bar/search-bar.ts"
|
|
25833
|
+
}
|
|
25834
|
+
},
|
|
25708
25835
|
{
|
|
25709
25836
|
"kind": "field",
|
|
25710
25837
|
"name": "inputElement",
|
|
@@ -25717,6 +25844,85 @@
|
|
|
25717
25844
|
"module": "src/components/search-bar/search-bar.ts"
|
|
25718
25845
|
}
|
|
25719
25846
|
},
|
|
25847
|
+
{
|
|
25848
|
+
"kind": "field",
|
|
25849
|
+
"name": "effectiveSearchIconPosition",
|
|
25850
|
+
"type": {
|
|
25851
|
+
"text": "'leading' | 'trailing'"
|
|
25852
|
+
},
|
|
25853
|
+
"readonly": true,
|
|
25854
|
+
"inheritedFrom": {
|
|
25855
|
+
"name": "MdSearchBar",
|
|
25856
|
+
"module": "src/components/search-bar/search-bar.ts"
|
|
25857
|
+
}
|
|
25858
|
+
},
|
|
25859
|
+
{
|
|
25860
|
+
"kind": "field",
|
|
25861
|
+
"name": "effectiveLeadingIcon",
|
|
25862
|
+
"type": {
|
|
25863
|
+
"text": "string"
|
|
25864
|
+
},
|
|
25865
|
+
"readonly": true,
|
|
25866
|
+
"inheritedFrom": {
|
|
25867
|
+
"name": "MdSearchBar",
|
|
25868
|
+
"module": "src/components/search-bar/search-bar.ts"
|
|
25869
|
+
}
|
|
25870
|
+
},
|
|
25871
|
+
{
|
|
25872
|
+
"kind": "field",
|
|
25873
|
+
"name": "effectiveTrailingIcon",
|
|
25874
|
+
"type": {
|
|
25875
|
+
"text": "string"
|
|
25876
|
+
},
|
|
25877
|
+
"readonly": true,
|
|
25878
|
+
"inheritedFrom": {
|
|
25879
|
+
"name": "MdSearchBar",
|
|
25880
|
+
"module": "src/components/search-bar/search-bar.ts"
|
|
25881
|
+
}
|
|
25882
|
+
},
|
|
25883
|
+
{
|
|
25884
|
+
"kind": "field",
|
|
25885
|
+
"name": "hasCustomContent",
|
|
25886
|
+
"type": {
|
|
25887
|
+
"text": "boolean"
|
|
25888
|
+
},
|
|
25889
|
+
"privacy": "private",
|
|
25890
|
+
"default": "false",
|
|
25891
|
+
"inheritedFrom": {
|
|
25892
|
+
"name": "MdSearchBar",
|
|
25893
|
+
"module": "src/components/search-bar/search-bar.ts"
|
|
25894
|
+
}
|
|
25895
|
+
},
|
|
25896
|
+
{
|
|
25897
|
+
"kind": "field",
|
|
25898
|
+
"name": "hasContent",
|
|
25899
|
+
"type": {
|
|
25900
|
+
"text": "boolean"
|
|
25901
|
+
},
|
|
25902
|
+
"readonly": true,
|
|
25903
|
+
"inheritedFrom": {
|
|
25904
|
+
"name": "MdSearchBar",
|
|
25905
|
+
"module": "src/components/search-bar/search-bar.ts"
|
|
25906
|
+
}
|
|
25907
|
+
},
|
|
25908
|
+
{
|
|
25909
|
+
"kind": "field",
|
|
25910
|
+
"name": "handleLeadingSlotChange",
|
|
25911
|
+
"privacy": "private",
|
|
25912
|
+
"inheritedFrom": {
|
|
25913
|
+
"name": "MdSearchBar",
|
|
25914
|
+
"module": "src/components/search-bar/search-bar.ts"
|
|
25915
|
+
}
|
|
25916
|
+
},
|
|
25917
|
+
{
|
|
25918
|
+
"kind": "field",
|
|
25919
|
+
"name": "handleContentSlotChange",
|
|
25920
|
+
"privacy": "private",
|
|
25921
|
+
"inheritedFrom": {
|
|
25922
|
+
"name": "MdSearchBar",
|
|
25923
|
+
"module": "src/components/search-bar/search-bar.ts"
|
|
25924
|
+
}
|
|
25925
|
+
},
|
|
25720
25926
|
{
|
|
25721
25927
|
"kind": "method",
|
|
25722
25928
|
"name": "formResetCallback",
|
|
@@ -25847,6 +26053,24 @@
|
|
|
25847
26053
|
"module": "src/components/search-bar/search-bar.ts"
|
|
25848
26054
|
}
|
|
25849
26055
|
},
|
|
26056
|
+
{
|
|
26057
|
+
"kind": "field",
|
|
26058
|
+
"name": "handleLeadingClick",
|
|
26059
|
+
"privacy": "private",
|
|
26060
|
+
"inheritedFrom": {
|
|
26061
|
+
"name": "MdSearchBar",
|
|
26062
|
+
"module": "src/components/search-bar/search-bar.ts"
|
|
26063
|
+
}
|
|
26064
|
+
},
|
|
26065
|
+
{
|
|
26066
|
+
"kind": "field",
|
|
26067
|
+
"name": "handleTrailingClick",
|
|
26068
|
+
"privacy": "private",
|
|
26069
|
+
"inheritedFrom": {
|
|
26070
|
+
"name": "MdSearchBar",
|
|
26071
|
+
"module": "src/components/search-bar/search-bar.ts"
|
|
26072
|
+
}
|
|
26073
|
+
},
|
|
25850
26074
|
{
|
|
25851
26075
|
"kind": "field",
|
|
25852
26076
|
"name": "handleTrailingTriggerClick",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./decorate-DknOJ8FJ.js";
|
|
2
2
|
import { t } from "./form-associated-Do5uXckv.js";
|
|
3
|
+
import "./ripple-CBOKeVfm.js";
|
|
4
|
+
import "./focus-ring-K6SY_mIm.js";
|
|
3
5
|
import "./icon-FvKeXi61.js";
|
|
4
6
|
import { css as n, html as r, nothing as i } from "lit";
|
|
5
7
|
import { customElement as a, property as o, query as s, state as c } from "lit/decorators.js";
|
|
@@ -105,6 +107,20 @@ var l = n`
|
|
|
105
107
|
flex-shrink: 0;
|
|
106
108
|
}
|
|
107
109
|
|
|
110
|
+
.leading-slot.empty,
|
|
111
|
+
:host([has-no-leading]) .leading-slot {
|
|
112
|
+
display: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
:host([has-no-leading]) input {
|
|
116
|
+
padding-left: 8px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.leading-slot ::slotted(md-icon-button),
|
|
120
|
+
.trailing-slot ::slotted(md-icon-button) {
|
|
121
|
+
--md-icon-button-size: var(--_btn-size);
|
|
122
|
+
}
|
|
123
|
+
|
|
108
124
|
.icon-btn {
|
|
109
125
|
display: inline-flex;
|
|
110
126
|
align-items: center;
|
|
@@ -119,6 +135,9 @@ var l = n`
|
|
|
119
135
|
padding: 0;
|
|
120
136
|
outline: none;
|
|
121
137
|
position: relative;
|
|
138
|
+
overflow: hidden;
|
|
139
|
+
user-select: none;
|
|
140
|
+
-webkit-tap-highlight-color: transparent;
|
|
122
141
|
transition: background-color 150ms ease;
|
|
123
142
|
}
|
|
124
143
|
|
|
@@ -183,11 +202,15 @@ var l = n`
|
|
|
183
202
|
/* Active Docked Mode */
|
|
184
203
|
:host([active]) .search-container {
|
|
185
204
|
z-index: 50;
|
|
186
|
-
border-radius: var(--_shape
|
|
205
|
+
border-radius: var(--_shape);
|
|
187
206
|
box-shadow: var(--_elevation-active);
|
|
188
207
|
}
|
|
189
208
|
|
|
190
|
-
|
|
209
|
+
:host([active][has-suggestions]) .search-container {
|
|
210
|
+
border-radius: var(--_shape-active);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* Divider when active and has suggestions */
|
|
191
214
|
.divider {
|
|
192
215
|
display: none;
|
|
193
216
|
height: 1px;
|
|
@@ -195,7 +218,7 @@ var l = n`
|
|
|
195
218
|
margin: 0 16px;
|
|
196
219
|
}
|
|
197
220
|
|
|
198
|
-
:host([active]) .divider {
|
|
221
|
+
:host([active][has-suggestions]) .divider {
|
|
199
222
|
display: block;
|
|
200
223
|
}
|
|
201
224
|
|
|
@@ -209,7 +232,7 @@ var l = n`
|
|
|
209
232
|
box-sizing: border-box;
|
|
210
233
|
}
|
|
211
234
|
|
|
212
|
-
:host([active]) .suggestions-container {
|
|
235
|
+
:host([active][has-suggestions]) .suggestions-container {
|
|
213
236
|
display: flex;
|
|
214
237
|
}
|
|
215
238
|
|
|
@@ -348,6 +371,8 @@ var l = n`
|
|
|
348
371
|
margin: 0;
|
|
349
372
|
outline: none;
|
|
350
373
|
position: relative;
|
|
374
|
+
overflow: hidden;
|
|
375
|
+
user-select: none;
|
|
351
376
|
transition: background-color 150ms ease, color 150ms ease;
|
|
352
377
|
-webkit-tap-highlight-color: transparent;
|
|
353
378
|
}
|
|
@@ -483,7 +508,13 @@ var l = n`
|
|
|
483
508
|
}
|
|
484
509
|
`, u = class extends t {
|
|
485
510
|
constructor(...e) {
|
|
486
|
-
super(...e), this.size = "medium", this.compact = !1, 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.
|
|
511
|
+
super(...e), this.size = "medium", this.compact = !1, this.value = "", this.placeholder = "Search", this.active = !1, this.suggestions = [], this.searchIconPosition = "leading", 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.hasLeadingSlotContent = !1, this.hasCustomContent = !1, this.handleLeadingSlotChange = (e) => {
|
|
512
|
+
let t = e.target.assignedElements({ flatten: !0 });
|
|
513
|
+
this.hasLeadingSlotContent = t.length > 0, this.requestUpdate();
|
|
514
|
+
}, this.handleContentSlotChange = (e) => {
|
|
515
|
+
let t = e.target.assignedElements({ flatten: !0 });
|
|
516
|
+
this.hasCustomContent = t.length > 0, this.requestUpdate();
|
|
517
|
+
}, this.handleFocus = () => {
|
|
487
518
|
this.active || (this.active = !0, this.emitEvent("active-change", { active: !0 }));
|
|
488
519
|
}, this.handleInput = (e) => {
|
|
489
520
|
let t = e.target;
|
|
@@ -518,8 +549,18 @@ var l = n`
|
|
|
518
549
|
e.stopPropagation(), this.show();
|
|
519
550
|
}, this.handleTriggerKeyDown = (e) => {
|
|
520
551
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.show());
|
|
552
|
+
}, this.handleLeadingClick = (e) => {
|
|
553
|
+
e.stopPropagation();
|
|
554
|
+
let t = this.effectiveLeadingIcon;
|
|
555
|
+
this.emitEvent("leading-icon-click", { icon: t }) && t === "search" && this.show();
|
|
556
|
+
}, this.handleTrailingClick = (e) => {
|
|
557
|
+
e.stopPropagation();
|
|
558
|
+
let t = this.effectiveTrailingIcon;
|
|
559
|
+
this.emitEvent("trailing-icon-click", { icon: t }) && (t === "search" || this.effectiveSearchIconPosition === "trailing") && (this.active || this.show(), this.emitEvent("search", { value: this.value }));
|
|
521
560
|
}, this.handleTrailingTriggerClick = (e) => {
|
|
522
|
-
e.stopPropagation()
|
|
561
|
+
e.stopPropagation();
|
|
562
|
+
let t = this.effectiveTrailingIcon;
|
|
563
|
+
this.emitEvent("trailing-icon-click", { icon: t }) && (this.show(), (t === "search" || this.effectiveSearchIconPosition === "trailing") && this.emitEvent("search", { value: this.value }));
|
|
523
564
|
}, this.handleBackClick = (e) => {
|
|
524
565
|
e.stopPropagation(), this.close();
|
|
525
566
|
}, this.handleScrimClick = () => {
|
|
@@ -531,11 +572,23 @@ var l = n`
|
|
|
531
572
|
static {
|
|
532
573
|
this.styles = [t.styles, l];
|
|
533
574
|
}
|
|
575
|
+
get effectiveSearchIconPosition() {
|
|
576
|
+
return this.searchIconPosition === "trailing" || this.searchIconPosition === "right" || this.trailingIcon === "search" ? "trailing" : "leading";
|
|
577
|
+
}
|
|
578
|
+
get effectiveLeadingIcon() {
|
|
579
|
+
return this.effectiveSearchIconPosition === "trailing" ? this.leadingIcon && this.leadingIcon !== "search" ? this.leadingIcon : "" : this.leadingIcon || "search";
|
|
580
|
+
}
|
|
581
|
+
get effectiveTrailingIcon() {
|
|
582
|
+
return this.effectiveSearchIconPosition === "trailing" ? this.trailingIcon || "search" : this.trailingIcon;
|
|
583
|
+
}
|
|
584
|
+
get hasContent() {
|
|
585
|
+
return !!(this.suggestions && this.suggestions.length > 0 || this.hasCustomContent);
|
|
586
|
+
}
|
|
534
587
|
connectedCallback() {
|
|
535
|
-
super.connectedCallback(), this.setFormValue(this.value), this.toggleAttribute("has-value", !!this.value), this.toggleAttribute("active", this.active), this.toggleAttribute("collapse-on-mobile", this.collapseOnMobile);
|
|
588
|
+
super.connectedCallback(), this.setFormValue(this.value), this.toggleAttribute("has-value", !!this.value), this.toggleAttribute("active", this.active), this.toggleAttribute("collapse-on-mobile", this.collapseOnMobile), this.toggleAttribute("has-suggestions", this.hasContent), this.toggleAttribute("has-no-leading", !this.effectiveLeadingIcon && (!this.active || !this.showBackButton || !this.hasContent) && !this.hasLeadingSlotContent);
|
|
536
589
|
}
|
|
537
590
|
willUpdate(e) {
|
|
538
|
-
super.willUpdate(e), e.has("value") && (this.setFormValue(this.value), this.toggleAttribute("has-value", !!this.value)), e.has("active") && (this.toggleAttribute("active", this.active), this.active || (this.highlightedIndex = -1)), e.has("collapseOnMobile") && this.toggleAttribute("collapse-on-mobile", this.collapseOnMobile);
|
|
591
|
+
super.willUpdate(e), e.has("value") && (this.setFormValue(this.value), this.toggleAttribute("has-value", !!this.value)), e.has("active") && (this.toggleAttribute("active", this.active), this.active || (this.highlightedIndex = -1)), e.has("collapseOnMobile") && this.toggleAttribute("collapse-on-mobile", this.collapseOnMobile), this.toggleAttribute("has-suggestions", this.hasContent), this.toggleAttribute("has-no-leading", !this.effectiveLeadingIcon && (!this.active || !this.showBackButton || !this.hasContent) && !this.hasLeadingSlotContent);
|
|
539
592
|
}
|
|
540
593
|
formResetCallback() {
|
|
541
594
|
this.value = "", this.setFormValue(null), this.toggleAttribute("has-value", !1), this.highlightedIndex = -1;
|
|
@@ -596,10 +649,12 @@ var l = n`
|
|
|
596
649
|
`;
|
|
597
650
|
}
|
|
598
651
|
render() {
|
|
599
|
-
let e = this.active && this.showBackButton,
|
|
652
|
+
let e = this.fullscreen || this.responsive && typeof window < "u" && window.matchMedia?.("(max-width: 768px)").matches, t = this.active && this.showBackButton && (this.hasContent || e), n = this.effectiveSearchIconPosition, a = this.effectiveLeadingIcon, o = this.effectiveTrailingIcon, s = "search", c = "", l = !1;
|
|
653
|
+
n === "trailing" ? a ? (s = a, c = o || "search", l = !0) : (s = o || "search", l = !1) : (s = a || "search", o && (c = o, l = !0));
|
|
654
|
+
let u = t || !!a || this.hasLeadingSlotContent;
|
|
600
655
|
return r`
|
|
601
656
|
<div
|
|
602
|
-
class="search-trigger-container ${
|
|
657
|
+
class="search-trigger-container ${l ? "has-trailing" : ""}"
|
|
603
658
|
role="button"
|
|
604
659
|
tabindex="0"
|
|
605
660
|
aria-label=${this.placeholder || "Search"}
|
|
@@ -611,25 +666,31 @@ var l = n`
|
|
|
611
666
|
<button
|
|
612
667
|
class="trigger-btn"
|
|
613
668
|
type="button"
|
|
614
|
-
aria-label=${this.placeholder || "Search"}
|
|
615
|
-
title=${this.placeholder || "Search"}
|
|
669
|
+
aria-label=${s === "menu" ? "Menu" : this.placeholder || "Search"}
|
|
670
|
+
title=${s === "menu" ? "Menu" : this.placeholder || "Search"}
|
|
616
671
|
?disabled=${this.disabled}
|
|
617
|
-
@click=${
|
|
672
|
+
@click=${(e) => {
|
|
673
|
+
a && a !== "search" ? this.handleLeadingClick(e) : this.handleTriggerClick(e);
|
|
674
|
+
}}
|
|
618
675
|
>
|
|
619
|
-
<md-
|
|
676
|
+
<md-ripple ?disabled=${this.disabled}></md-ripple>
|
|
677
|
+
<md-focus-ring></md-focus-ring>
|
|
678
|
+
<md-icon name=${s}></md-icon>
|
|
620
679
|
</button>
|
|
621
680
|
|
|
622
|
-
${
|
|
681
|
+
${l ? r`
|
|
623
682
|
<div class="trigger-divider" aria-hidden="true"></div>
|
|
624
683
|
<button
|
|
625
684
|
class="trigger-btn trigger-trailing-btn"
|
|
626
685
|
type="button"
|
|
627
|
-
aria-label=${
|
|
628
|
-
title=${
|
|
686
|
+
aria-label=${c === "search" ? "Search" : c}
|
|
687
|
+
title=${c === "search" ? "Search" : c}
|
|
629
688
|
?disabled=${this.disabled}
|
|
630
689
|
@click=${this.handleTrailingTriggerClick}
|
|
631
690
|
>
|
|
632
|
-
<md-
|
|
691
|
+
<md-ripple ?disabled=${this.disabled}></md-ripple>
|
|
692
|
+
<md-focus-ring></md-focus-ring>
|
|
693
|
+
<md-icon name=${c}></md-icon>
|
|
633
694
|
</button>
|
|
634
695
|
` : i}
|
|
635
696
|
</div>
|
|
@@ -638,22 +699,34 @@ var l = n`
|
|
|
638
699
|
|
|
639
700
|
<div class="search-container" role="search">
|
|
640
701
|
<div class="search-bar-header">
|
|
641
|
-
<span class="leading-slot">
|
|
642
|
-
<slot name="leading
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
702
|
+
<span class="leading-slot ${u ? "" : "empty"}">
|
|
703
|
+
<slot name="leading" @slotchange=${this.handleLeadingSlotChange}>
|
|
704
|
+
<slot name="leading-icon" @slotchange=${this.handleLeadingSlotChange}>
|
|
705
|
+
${t ? r`
|
|
706
|
+
<button
|
|
707
|
+
class="icon-btn back-btn"
|
|
708
|
+
type="button"
|
|
709
|
+
aria-label="Back"
|
|
710
|
+
@click=${this.handleBackClick}
|
|
711
|
+
>
|
|
712
|
+
<md-ripple ?disabled=${this.disabled}></md-ripple>
|
|
713
|
+
<md-focus-ring></md-focus-ring>
|
|
714
|
+
<md-icon name=${this.activeLeadingIcon}></md-icon>
|
|
715
|
+
</button>
|
|
716
|
+
` : a ? r`
|
|
717
|
+
<button
|
|
718
|
+
class="icon-btn leading-btn"
|
|
719
|
+
type="button"
|
|
720
|
+
aria-label=${a === "menu" ? "Menu" : a}
|
|
721
|
+
?disabled=${this.disabled}
|
|
722
|
+
@click=${this.handleLeadingClick}
|
|
723
|
+
>
|
|
724
|
+
<md-ripple ?disabled=${this.disabled}></md-ripple>
|
|
725
|
+
<md-focus-ring></md-focus-ring>
|
|
726
|
+
<md-icon name=${a}></md-icon>
|
|
727
|
+
</button>
|
|
728
|
+
` : i}
|
|
729
|
+
</slot>
|
|
657
730
|
</slot>
|
|
658
731
|
</span>
|
|
659
732
|
|
|
@@ -683,30 +756,49 @@ var l = n`
|
|
|
683
756
|
aria-label="Clear search"
|
|
684
757
|
@click=${this.handleClearClick}
|
|
685
758
|
>
|
|
759
|
+
<md-ripple ?disabled=${this.disabled}></md-ripple>
|
|
760
|
+
<md-focus-ring></md-focus-ring>
|
|
686
761
|
<md-icon name="close"></md-icon>
|
|
687
762
|
</button>
|
|
688
763
|
` : i}
|
|
689
764
|
|
|
690
|
-
<slot name="trailing
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
<
|
|
694
|
-
|
|
695
|
-
|
|
765
|
+
<slot name="trailing">
|
|
766
|
+
<slot name="trailing-icon">
|
|
767
|
+
${o ? r`
|
|
768
|
+
<button
|
|
769
|
+
class="icon-btn trailing-btn"
|
|
770
|
+
type="button"
|
|
771
|
+
aria-label=${o === "search" ? "Search" : o}
|
|
772
|
+
?disabled=${this.disabled}
|
|
773
|
+
@click=${this.handleTrailingClick}
|
|
774
|
+
>
|
|
775
|
+
<md-ripple ?disabled=${this.disabled}></md-ripple>
|
|
776
|
+
<md-focus-ring></md-focus-ring>
|
|
777
|
+
<md-icon name=${o}></md-icon>
|
|
778
|
+
</button>
|
|
779
|
+
` : i}
|
|
780
|
+
</slot>
|
|
696
781
|
</slot>
|
|
697
782
|
</span>
|
|
698
783
|
</div>
|
|
699
784
|
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
785
|
+
${this.hasContent ? r`
|
|
786
|
+
<div class="divider"></div>
|
|
787
|
+
|
|
788
|
+
<div class="suggestions-container" role="listbox" aria-label="Suggestions">
|
|
789
|
+
<slot name="suggestions" @slotchange=${this.handleContentSlotChange}>
|
|
790
|
+
${this.suggestions.map((e, t) => this.renderSuggestionItem(e, t))}
|
|
791
|
+
</slot>
|
|
792
|
+
<div class="extra-content">
|
|
793
|
+
<slot @slotchange=${this.handleContentSlotChange}></slot>
|
|
794
|
+
</div>
|
|
795
|
+
</div>
|
|
796
|
+
` : r`
|
|
797
|
+
<div class="extra-content" style="display: none;">
|
|
798
|
+
<slot name="suggestions" @slotchange=${this.handleContentSlotChange}></slot>
|
|
799
|
+
<slot @slotchange=${this.handleContentSlotChange}></slot>
|
|
800
|
+
</div>
|
|
801
|
+
`}
|
|
710
802
|
</div>
|
|
711
803
|
`;
|
|
712
804
|
}
|
|
@@ -721,6 +813,10 @@ e([o({
|
|
|
721
813
|
type: Boolean,
|
|
722
814
|
reflect: !0
|
|
723
815
|
})], u.prototype, "active", void 0), e([o({ type: Array })], u.prototype, "suggestions", void 0), e([o({
|
|
816
|
+
type: String,
|
|
817
|
+
attribute: "search-icon-position",
|
|
818
|
+
reflect: !0
|
|
819
|
+
})], u.prototype, "searchIconPosition", void 0), e([o({
|
|
724
820
|
type: String,
|
|
725
821
|
attribute: "leading-icon"
|
|
726
822
|
})], u.prototype, "leadingIcon", void 0), e([o({
|
|
@@ -748,10 +844,10 @@ e([o({
|
|
|
748
844
|
})], u.prototype, "fullscreen", void 0), e([o({
|
|
749
845
|
type: Boolean,
|
|
750
846
|
attribute: "auto-deactivate-on-select"
|
|
751
|
-
})], u.prototype, "autoDeactivateOnSelect", void 0), e([c()], u.prototype, "highlightedIndex", void 0), e([s("input")], u.prototype, "inputElement", void 0), u = e([a("md-search-bar")], u);
|
|
847
|
+
})], u.prototype, "autoDeactivateOnSelect", void 0), e([c()], u.prototype, "highlightedIndex", void 0), e([c()], u.prototype, "hasLeadingSlotContent", void 0), e([s("input")], u.prototype, "inputElement", void 0), e([c()], u.prototype, "hasCustomContent", void 0), u = e([a("md-search-bar")], u);
|
|
752
848
|
var d = class extends u {};
|
|
753
849
|
d = e([a("md-search")], d);
|
|
754
850
|
//#endregion
|
|
755
851
|
export { u as n, d as t };
|
|
756
852
|
|
|
757
|
-
//# sourceMappingURL=search-bar-
|
|
853
|
+
//# sourceMappingURL=search-bar-B4lAXza_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-bar-B4lAXza_.js","names":[],"sources":["../../src/components/search-bar/search-bar.css.ts","../../src/components/search-bar/search-bar.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const searchBarStyles = css`\n :host {\n display: block;\n box-sizing: border-box;\n position: relative;\n width: 100%;\n max-width: var(--md-search-bar-max-width, 100%);\n font-family: var(--md-sys-typescale-font-family, inherit);\n color: var(--md-sys-color-on-surface, #1D1B20);\n vertical-align: middle;\n\n --_height: var(--md-search-bar-height, 56px);\n --_shape: var(--md-search-bar-shape, var(--md-search-bar-border-radius, var(--md-sys-shape-corner-full, 28px)));\n --_shape-active: var(--md-search-bar-shape-active, var(--md-sys-shape-corner-extra-large, 28px 28px 16px 16px));\n --_bg: var(--md-search-bar-container-color, var(--md-search-bar-bg, var(--md-sys-color-surface-container-high, #ECE6F0)));\n --_elevation: var(--md-search-bar-elevation, var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0, 0, 0, 0.15)));\n --_elevation-active: var(--md-search-bar-elevation-active, var(--md-sys-elevation-level3, 0px 4px 8px 3px rgba(0, 0, 0, 0.15)));\n --_btn-size: var(--md-search-bar-icon-button-size, 40px);\n --_icon-size: var(--md-search-bar-icon-size, 24px);\n --_font-size: var(--md-search-bar-font-size, var(--md-sys-typescale-body-large-size, 16px));\n --_line-height: var(--md-search-bar-line-height, var(--md-sys-typescale-body-large-line-height, 24px));\n --_padding: var(--md-search-bar-padding, 0 8px 0 16px);\n }\n\n :host([size=\"small\"]),\n :host([size=\"compact\"]),\n :host([compact]) {\n --_height: var(--md-search-bar-height, 40px);\n --_shape: var(--md-search-bar-shape, var(--md-search-bar-border-radius, 20px));\n --_shape-active: var(--md-search-bar-shape-active, 20px 20px 12px 12px);\n --_btn-size: var(--md-search-bar-icon-button-size, 32px);\n --_icon-size: var(--md-search-bar-icon-size, 20px);\n --_font-size: var(--md-search-bar-font-size, var(--md-sys-typescale-body-medium-size, 14px));\n --_line-height: var(--md-search-bar-line-height, 20px);\n --_padding: var(--md-search-bar-padding, 0 6px 0 12px);\n }\n\n :host([size=\"large\"]) {\n --_height: var(--md-search-bar-height, 64px);\n --_shape: var(--md-search-bar-shape, var(--md-search-bar-border-radius, 32px));\n --_shape-active: var(--md-search-bar-shape-active, 32px 32px 20px 20px);\n --_btn-size: var(--md-search-bar-icon-button-size, 48px);\n --_icon-size: var(--md-search-bar-icon-size, 24px);\n --_font-size: var(--md-search-bar-font-size, 18px);\n --_line-height: var(--md-search-bar-line-height, 26px);\n --_padding: var(--md-search-bar-padding, 0 12px 0 20px);\n }\n\n :host([disabled]) {\n pointer-events: none;\n opacity: 0.38;\n }\n\n .scrim {\n display: none;\n }\n\n /* Scrim when active in docked mode to catch outside clicks */\n :host([active]) .scrim {\n display: block;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 40;\n background: transparent;\n }\n\n .search-container {\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n width: 100%;\n box-sizing: border-box;\n background-color: var(--_bg);\n border-radius: var(--_shape);\n box-shadow: var(--_elevation);\n transition: box-shadow 200ms cubic-bezier(0.2, 0, 0, 1),\n border-radius 200ms cubic-bezier(0.2, 0, 0, 1),\n background-color 200ms cubic-bezier(0.2, 0, 0, 1);\n }\n\n .search-bar-header {\n display: flex;\n align-items: center;\n min-height: var(--_height);\n height: var(--_height);\n padding: var(--_padding);\n box-sizing: border-box;\n gap: 8px;\n }\n\n .leading-slot, .trailing-slot {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n\n .leading-slot.empty,\n :host([has-no-leading]) .leading-slot {\n display: none;\n }\n\n :host([has-no-leading]) input {\n padding-left: 8px;\n }\n\n .leading-slot ::slotted(md-icon-button),\n .trailing-slot ::slotted(md-icon-button) {\n --md-icon-button-size: var(--_btn-size);\n }\n\n .icon-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--_btn-size);\n height: var(--_btn-size);\n border: none;\n background: transparent;\n border-radius: 50%;\n color: var(--md-sys-color-on-surface-variant, #49454F);\n cursor: pointer;\n padding: 0;\n outline: none;\n position: relative;\n overflow: hidden;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n transition: background-color 150ms ease;\n }\n\n .icon-btn md-icon {\n font-size: var(--_icon-size);\n --md-icon-size: var(--_icon-size);\n }\n\n .icon-btn:hover {\n background-color: rgba(73, 69, 79, 0.08);\n }\n\n .icon-btn:focus-visible {\n background-color: rgba(73, 69, 79, 0.12);\n }\n\n .input-wrapper {\n display: flex;\n flex: 1;\n min-width: 0;\n align-items: center;\n position: relative;\n }\n\n input {\n width: 100%;\n border: none;\n background: transparent;\n outline: none;\n font-family: inherit;\n font-size: var(--_font-size);\n line-height: var(--_line-height);\n color: var(--md-sys-color-on-surface, #1D1B20);\n padding: 0 4px;\n margin: 0;\n box-sizing: border-box;\n -webkit-appearance: none;\n appearance: none;\n }\n\n input::-webkit-search-decoration,\n input::-webkit-search-cancel-button,\n input::-webkit-search-results-button,\n input::-webkit-search-results-decoration {\n -webkit-appearance: none;\n appearance: none;\n display: none;\n }\n\n input::-ms-clear,\n input::-ms-reveal {\n display: none;\n width: 0;\n height: 0;\n }\n\n input::placeholder {\n color: var(--md-sys-color-on-surface-variant, #49454F);\n opacity: 0.8;\n }\n\n /* Active Docked Mode */\n :host([active]) .search-container {\n z-index: 50;\n border-radius: var(--_shape);\n box-shadow: var(--_elevation-active);\n }\n\n :host([active][has-suggestions]) .search-container {\n border-radius: var(--_shape-active);\n }\n\n /* Divider when active and has suggestions */\n .divider {\n display: none;\n height: 1px;\n background-color: var(--md-sys-color-outline-variant, #CAC4D0);\n margin: 0 16px;\n }\n\n :host([active][has-suggestions]) .divider {\n display: block;\n }\n\n /* Suggestions / Content Container */\n .suggestions-container {\n display: none;\n flex-direction: column;\n max-height: 360px;\n overflow-y: auto;\n padding: 8px 0;\n box-sizing: border-box;\n }\n\n :host([active][has-suggestions]) .suggestions-container {\n display: flex;\n }\n\n .suggestion-item {\n display: flex;\n align-items: center;\n min-height: 48px;\n padding: 0 16px;\n gap: 16px;\n box-sizing: border-box;\n cursor: pointer;\n position: relative;\n user-select: none;\n color: var(--md-sys-color-on-surface, #1D1B20);\n transition: background-color 150ms ease;\n }\n\n .suggestion-item:hover,\n .suggestion-item.highlighted {\n background-color: rgba(73, 69, 79, 0.08);\n }\n\n .suggestion-item.selected {\n background-color: rgba(73, 69, 79, 0.12);\n }\n\n .suggestion-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n color: var(--md-sys-color-on-surface-variant, #49454F);\n flex-shrink: 0;\n }\n\n .suggestion-icon md-icon {\n font-size: var(--_icon-size);\n --md-icon-size: var(--_icon-size);\n }\n\n .suggestion-text {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-width: 0;\n overflow: hidden;\n }\n\n .suggestion-label {\n font-size: var(--_font-size);\n line-height: 20px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .suggestion-supporting {\n font-size: var(--md-sys-typescale-body-medium-size, 14px);\n line-height: 16px;\n color: var(--md-sys-color-on-surface-variant, #49454F);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-top: 2px;\n }\n\n .suggestion-trailing {\n font-size: var(--md-sys-typescale-body-medium-size, 14px);\n color: var(--md-sys-color-on-surface-variant, #49454F);\n flex-shrink: 0;\n }\n\n .search-trigger-container {\n display: none;\n }\n\n /* Responsive Fullscreen / Mobile Collapsed Mode */\n @media (max-width: 768px) {\n :host([responsive]:not([active]):not([collapse-on-mobile=\"false\"])),\n :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile=\"false\"])) {\n display: inline-flex;\n width: auto;\n max-width: none;\n vertical-align: middle;\n }\n\n :host([responsive]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container,\n :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background-color: transparent;\n border-radius: 50%;\n box-shadow: none;\n cursor: pointer;\n user-select: none;\n outline: none;\n transition: background-color 200ms ease, box-shadow 200ms ease;\n -webkit-tap-highlight-color: transparent;\n }\n\n :host([responsive]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container.has-trailing,\n :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container.has-trailing {\n height: var(--_height);\n padding: 0 4px;\n gap: 2px;\n background-color: var(--_bg);\n border-radius: var(--_shape);\n box-shadow: var(--_elevation);\n }\n\n :host([responsive]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container.has-trailing:hover,\n :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container.has-trailing:hover {\n box-shadow: var(--md-sys-elevation-level2, 0px 2px 6px 2px rgba(0, 0, 0, 0.15));\n }\n\n :host([responsive]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container:focus-visible,\n :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container:focus-visible {\n outline: 2px solid var(--md-sys-color-primary, #6750A4);\n outline-offset: 2px;\n }\n\n .trigger-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--_btn-size);\n height: var(--_btn-size);\n min-width: var(--_btn-size);\n min-height: var(--_btn-size);\n border-radius: 50%;\n border: none;\n background: transparent;\n color: var(--md-sys-color-on-surface-variant, #49454F);\n cursor: pointer;\n padding: 0;\n margin: 0;\n outline: none;\n position: relative;\n overflow: hidden;\n user-select: none;\n transition: background-color 150ms ease, color 150ms ease;\n -webkit-tap-highlight-color: transparent;\n }\n\n .trigger-btn md-icon {\n font-size: var(--_icon-size);\n --md-icon-size: var(--_icon-size);\n }\n\n .trigger-btn:hover {\n background-color: rgba(73, 69, 79, 0.08);\n }\n\n .trigger-btn:focus-visible {\n background-color: rgba(73, 69, 79, 0.12);\n }\n\n .trigger-divider {\n width: 1px;\n height: 22px;\n background-color: var(--md-sys-color-outline-variant, #CAC4D0);\n margin: 0 2px;\n flex-shrink: 0;\n }\n\n :host([responsive]:not([active]):not([collapse-on-mobile=\"false\"])) .search-container,\n :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile=\"false\"])) .search-container {\n display: none;\n }\n\n :host([responsive]:not([active]):not([collapse-on-mobile=\"false\"])) .scrim,\n :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile=\"false\"])) .scrim {\n display: none;\n }\n\n :host([responsive][active]),\n :host([collapse-on-mobile][active]) {\n display: block;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100vw;\n height: 100vh;\n height: 100dvh;\n max-width: 100vw;\n margin: 0;\n padding: 0;\n z-index: 99999;\n }\n\n :host([responsive][active]) .search-trigger-container,\n :host([collapse-on-mobile][active]) .search-trigger-container {\n display: none;\n }\n\n :host([responsive][active]) .scrim,\n :host([collapse-on-mobile][active]) .scrim {\n display: none;\n }\n\n :host([responsive][active]) .search-container,\n :host([collapse-on-mobile][active]) .search-container {\n display: flex;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100vw;\n height: 100vh;\n height: 100dvh;\n max-width: 100vw;\n border-radius: 0;\n box-shadow: none;\n z-index: 99999;\n background-color: var(--_bg);\n }\n\n :host([responsive][active]) .suggestions-container,\n :host([collapse-on-mobile][active]) .suggestions-container {\n flex: 1;\n max-height: calc(100vh - 57px);\n max-height: calc(100dvh - 57px);\n }\n }\n\n /* Forced Fullscreen attribute */\n :host([fullscreen][active]) {\n display: block;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100vw;\n height: 100vh;\n height: 100dvh;\n max-width: 100vw;\n z-index: 99999;\n }\n\n :host([fullscreen][active]) .search-trigger-container {\n display: none;\n }\n\n :host([fullscreen][active]) .scrim {\n display: none;\n }\n\n :host([fullscreen][active]) .search-container {\n display: flex;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100vw;\n height: 100vh;\n height: 100dvh;\n max-width: 100vw;\n border-radius: 0;\n box-shadow: none;\n z-index: 99999;\n background-color: var(--_bg);\n }\n\n :host([fullscreen][active]) .suggestions-container {\n flex: 1;\n max-height: calc(100vh - 57px);\n max-height: calc(100dvh - 57px);\n }\n`;\n\n","import { html, nothing } from 'lit';\nimport { customElement, property, state, query } from 'lit/decorators.js';\nimport { MdFormAssociatedElement } from '../../internal/form-associated.js';\nimport '../../internal/ripple/ripple.js';\nimport '../../internal/focus-ring/focus-ring.js';\nimport '../icon/icon.js';\nimport { searchBarStyles } from './search-bar.css.js';\n\nexport type SearchBarSize = 'small' | 'compact' | 'medium' | 'large';\nexport type SearchIconPosition = 'leading' | 'trailing' | 'left' | 'right';\n\nexport interface SearchSuggestion {\n id?: string;\n label: string;\n value?: string;\n supportingText?: string;\n trailingSupportingText?: string;\n icon?: string;\n [key: string]: unknown;\n}\n\n@customElement('md-search-bar')\nexport class MdSearchBar extends MdFormAssociatedElement {\n static override styles = [MdFormAssociatedElement.styles, searchBarStyles];\n\n @property({ type: String, reflect: true })\n size: SearchBarSize = 'medium';\n\n @property({ type: Boolean, reflect: true })\n compact = false;\n\n @property({ type: String })\n value = '';\n\n @property({ type: String })\n placeholder = 'Search';\n\n @property({ type: Boolean, reflect: true })\n active = false;\n\n @property({ type: Array })\n suggestions: Array<string | SearchSuggestion> = [];\n\n @property({ type: String, attribute: 'search-icon-position', reflect: true })\n searchIconPosition: SearchIconPosition = 'leading';\n\n @property({ type: String, attribute: 'leading-icon' })\n leadingIcon = 'search';\n\n @property({ type: String, attribute: 'active-leading-icon' })\n activeLeadingIcon = 'arrow_back';\n\n @property({ type: String, attribute: 'trailing-icon' })\n trailingIcon = '';\n\n @property({ type: Boolean, attribute: 'show-back-button' })\n showBackButton = true;\n\n @property({ type: Boolean, attribute: 'show-clear-button' })\n showClearButton = true;\n\n @property({ type: Boolean, reflect: true })\n responsive = true;\n\n @property({ type: Boolean, attribute: 'collapse-on-mobile', reflect: true })\n collapseOnMobile = true;\n\n @property({ type: Boolean, reflect: true })\n fullscreen = false;\n\n @property({ type: Boolean, attribute: 'auto-deactivate-on-select' })\n autoDeactivateOnSelect = true;\n\n @state()\n private highlightedIndex = -1;\n\n @state()\n private hasLeadingSlotContent = false;\n\n @query('input')\n private inputElement?: HTMLInputElement;\n\n get effectiveSearchIconPosition(): 'leading' | 'trailing' {\n return (this.searchIconPosition === 'trailing' || this.searchIconPosition === 'right' || this.trailingIcon === 'search')\n ? 'trailing'\n : 'leading';\n }\n\n get effectiveLeadingIcon(): string {\n if (this.effectiveSearchIconPosition === 'trailing') {\n if (this.leadingIcon && this.leadingIcon !== 'search') {\n return this.leadingIcon;\n }\n return '';\n }\n return this.leadingIcon || 'search';\n }\n\n get effectiveTrailingIcon(): string {\n if (this.effectiveSearchIconPosition === 'trailing') {\n return this.trailingIcon || 'search';\n }\n return this.trailingIcon;\n }\n\n @state()\n private hasCustomContent = false;\n\n get hasContent(): boolean {\n return Boolean((this.suggestions && this.suggestions.length > 0) || this.hasCustomContent);\n }\n\n private handleLeadingSlotChange = (event: Event) => {\n const slot = event.target as HTMLSlotElement;\n const elements = slot.assignedElements({ flatten: true });\n this.hasLeadingSlotContent = elements.length > 0;\n this.requestUpdate();\n };\n\n private handleContentSlotChange = (event: Event) => {\n const slot = event.target as HTMLSlotElement;\n const elements = slot.assignedElements({ flatten: true });\n this.hasCustomContent = elements.length > 0;\n this.requestUpdate();\n };\n\n override connectedCallback() {\n super.connectedCallback();\n this.setFormValue(this.value);\n this.toggleAttribute('has-value', Boolean(this.value));\n this.toggleAttribute('active', this.active);\n this.toggleAttribute('collapse-on-mobile', this.collapseOnMobile);\n this.toggleAttribute('has-suggestions', this.hasContent);\n this.toggleAttribute('has-no-leading', !this.effectiveLeadingIcon && (!this.active || !this.showBackButton || !this.hasContent) && !this.hasLeadingSlotContent);\n }\n\n override willUpdate(changedProperties: Map<string, unknown>) {\n super.willUpdate(changedProperties);\n if (changedProperties.has('value')) {\n this.setFormValue(this.value);\n this.toggleAttribute('has-value', Boolean(this.value));\n }\n if (changedProperties.has('active')) {\n this.toggleAttribute('active', this.active);\n if (!this.active) {\n this.highlightedIndex = -1;\n }\n }\n if (changedProperties.has('collapseOnMobile')) {\n this.toggleAttribute('collapse-on-mobile', this.collapseOnMobile);\n }\n this.toggleAttribute('has-suggestions', this.hasContent);\n this.toggleAttribute('has-no-leading', !this.effectiveLeadingIcon && (!this.active || !this.showBackButton || !this.hasContent) && !this.hasLeadingSlotContent);\n }\n\n override formResetCallback() {\n this.value = '';\n this.setFormValue(null);\n this.toggleAttribute('has-value', false);\n this.highlightedIndex = -1;\n }\n\n /**\n * Focuses the search input field.\n */\n override focus() {\n this.inputElement?.focus();\n }\n\n /**\n * Opens / activates the search view.\n */\n show() {\n if (!this.active) {\n this.active = true;\n this.emitEvent('active-change', { active: true });\n }\n this.updateComplete.then(() => {\n this.inputElement?.focus();\n });\n }\n\n /**\n * Alias for show()\n */\n open() {\n this.show();\n }\n\n /**\n * Closes / deactivates the search view.\n */\n close() {\n if (this.active) {\n this.active = false;\n this.highlightedIndex = -1;\n this.emitEvent('active-change', { active: false });\n }\n }\n\n /**\n * Alias for close()\n */\n collapse() {\n this.close();\n }\n\n /**\n * Toggles the active state of the search bar.\n */\n toggle() {\n if (this.active) {\n this.close();\n } else {\n this.show();\n }\n }\n\n /**\n * Clears the current search input.\n */\n clear() {\n this.value = '';\n this.setFormValue('');\n this.toggleAttribute('has-value', false);\n this.highlightedIndex = -1;\n this.emitEvent('input', { value: '' });\n this.emitEvent('clear');\n this.inputElement?.focus();\n }\n\n private handleFocus = () => {\n if (!this.active) {\n this.active = true;\n this.emitEvent('active-change', { active: true });\n }\n };\n\n private handleInput = (event: Event) => {\n const target = event.target as HTMLInputElement;\n this.value = target.value;\n this.setFormValue(this.value);\n this.toggleAttribute('has-value', Boolean(this.value));\n this.highlightedIndex = -1;\n this.emitEvent('input', { value: this.value });\n };\n\n private handleChange = () => {\n this.emitEvent('change', { value: this.value });\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n const count = this.suggestions.length;\n\n if (event.key === 'Escape') {\n event.preventDefault();\n this.close();\n this.inputElement?.blur();\n return;\n }\n\n if (event.key === 'ArrowDown') {\n if (!this.active) {\n this.show();\n return;\n }\n if (count > 0) {\n event.preventDefault();\n this.highlightedIndex = (this.highlightedIndex + 1) % count;\n }\n return;\n }\n\n if (event.key === 'ArrowUp') {\n if (count > 0 && this.active) {\n event.preventDefault();\n this.highlightedIndex = this.highlightedIndex <= 0 ? count - 1 : this.highlightedIndex - 1;\n }\n return;\n }\n\n if (event.key === 'Enter') {\n if (this.active && this.highlightedIndex >= 0 && this.highlightedIndex < count) {\n const item = this.suggestions[this.highlightedIndex];\n if (item !== undefined) {\n event.preventDefault();\n this.selectSuggestion(item, this.highlightedIndex);\n }\n } else {\n this.emitEvent('search', { value: this.value });\n }\n }\n };\n\n private handleTriggerClick = (event: MouseEvent) => {\n event.stopPropagation();\n this.show();\n };\n\n private handleTriggerKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.show();\n }\n };\n\n private handleLeadingClick = (event: MouseEvent) => {\n event.stopPropagation();\n const icon = this.effectiveLeadingIcon;\n const allowed = this.emitEvent('leading-icon-click', { icon });\n if (!allowed) return;\n if (icon === 'search') {\n this.show();\n }\n };\n\n private handleTrailingClick = (event: MouseEvent) => {\n event.stopPropagation();\n const icon = this.effectiveTrailingIcon;\n const allowed = this.emitEvent('trailing-icon-click', { icon });\n if (!allowed) return;\n if (icon === 'search' || this.effectiveSearchIconPosition === 'trailing') {\n if (!this.active) {\n this.show();\n }\n this.emitEvent('search', { value: this.value });\n }\n };\n\n private handleTrailingTriggerClick = (event: MouseEvent) => {\n event.stopPropagation();\n const icon = this.effectiveTrailingIcon;\n const allowed = this.emitEvent('trailing-icon-click', { icon });\n if (allowed) {\n this.show();\n if (icon === 'search' || this.effectiveSearchIconPosition === 'trailing') {\n this.emitEvent('search', { value: this.value });\n }\n }\n };\n\n private handleBackClick = (event: MouseEvent) => {\n event.stopPropagation();\n this.close();\n };\n\n private handleScrimClick = () => {\n this.close();\n };\n\n private handleClearClick = (event: MouseEvent) => {\n event.stopPropagation();\n this.clear();\n };\n\n private selectSuggestion(suggestion: string | SearchSuggestion, index: number) {\n const label = typeof suggestion === 'string' ? suggestion : suggestion.label;\n const value = typeof suggestion === 'string' ? suggestion : (suggestion.value ?? suggestion.label);\n\n this.value = value;\n this.setFormValue(this.value);\n this.toggleAttribute('has-value', Boolean(this.value));\n this.emitEvent('suggestion-select', { suggestion, label, value, index });\n this.emitEvent('search', { value: this.value, suggestion });\n\n if (this.autoDeactivateOnSelect) {\n this.close();\n }\n }\n\n private renderSuggestionItem(suggestion: string | SearchSuggestion, index: number) {\n const isString = typeof suggestion === 'string';\n const label = isString ? suggestion : suggestion.label;\n const supportingText = !isString ? suggestion.supportingText : undefined;\n const trailingSupportingText = !isString ? suggestion.trailingSupportingText : undefined;\n const iconName = !isString && suggestion.icon ? suggestion.icon : 'history';\n const isHighlighted = this.highlightedIndex === index;\n\n return html`\n <div\n class=\"suggestion-item ${isHighlighted ? 'highlighted' : ''}\"\n role=\"option\"\n aria-selected=${isHighlighted ? 'true' : 'false'}\n @click=${() => this.selectSuggestion(suggestion, index)}\n >\n <span class=\"suggestion-icon\">\n <md-icon name=${iconName}></md-icon>\n </span>\n <div class=\"suggestion-text\">\n <span class=\"suggestion-label\">${label}</span>\n ${supportingText ? html`<span class=\"suggestion-supporting\">${supportingText}</span>` : nothing}\n </div>\n ${trailingSupportingText ? html`<span class=\"suggestion-trailing\">${trailingSupportingText}</span>` : nothing}\n </div>\n `;\n }\n\n override render() {\n const isFullscreenMode = this.fullscreen || (this.responsive && typeof window !== 'undefined' && window.matchMedia?.('(max-width: 768px)').matches);\n const showBack = this.active && this.showBackButton && (this.hasContent || isFullscreenMode);\n const effSearchPos = this.effectiveSearchIconPosition;\n const effLeading = this.effectiveLeadingIcon;\n const effTrailing = this.effectiveTrailingIcon;\n\n let triggerLeadingIcon = 'search';\n let triggerTrailingIcon = '';\n let hasTrailingTrigger = false;\n\n if (effSearchPos === 'trailing') {\n if (effLeading) {\n triggerLeadingIcon = effLeading;\n triggerTrailingIcon = effTrailing || 'search';\n hasTrailingTrigger = true;\n } else {\n triggerLeadingIcon = effTrailing || 'search';\n hasTrailingTrigger = false;\n }\n } else {\n triggerLeadingIcon = effLeading || 'search';\n if (effTrailing) {\n triggerTrailingIcon = effTrailing;\n hasTrailingTrigger = true;\n }\n }\n\n const hasLeadingHeader = showBack || Boolean(effLeading) || this.hasLeadingSlotContent;\n\n return html`\n <div\n class=\"search-trigger-container ${hasTrailingTrigger ? 'has-trailing' : ''}\"\n role=\"button\"\n tabindex=\"0\"\n aria-label=${this.placeholder || 'Search'}\n title=${this.placeholder || 'Search'}\n ?disabled=${this.disabled}\n @click=${this.handleTriggerClick}\n @keydown=${this.handleTriggerKeyDown}\n >\n <button\n class=\"trigger-btn\"\n type=\"button\"\n aria-label=${triggerLeadingIcon === 'menu' ? 'Menu' : (this.placeholder || 'Search')}\n title=${triggerLeadingIcon === 'menu' ? 'Menu' : (this.placeholder || 'Search')}\n ?disabled=${this.disabled}\n @click=${(e: MouseEvent) => {\n if (effLeading && effLeading !== 'search') {\n this.handleLeadingClick(e);\n } else {\n this.handleTriggerClick(e);\n }\n }}\n >\n <md-ripple ?disabled=${this.disabled}></md-ripple>\n <md-focus-ring></md-focus-ring>\n <md-icon name=${triggerLeadingIcon}></md-icon>\n </button>\n\n ${hasTrailingTrigger\n ? html`\n <div class=\"trigger-divider\" aria-hidden=\"true\"></div>\n <button\n class=\"trigger-btn trigger-trailing-btn\"\n type=\"button\"\n aria-label=${triggerTrailingIcon === 'search' ? 'Search' : triggerTrailingIcon}\n title=${triggerTrailingIcon === 'search' ? 'Search' : triggerTrailingIcon}\n ?disabled=${this.disabled}\n @click=${this.handleTrailingTriggerClick}\n >\n <md-ripple ?disabled=${this.disabled}></md-ripple>\n <md-focus-ring></md-focus-ring>\n <md-icon name=${triggerTrailingIcon}></md-icon>\n </button>\n `\n : nothing}\n </div>\n\n <div class=\"scrim\" @click=${this.handleScrimClick}></div>\n\n <div class=\"search-container\" role=\"search\">\n <div class=\"search-bar-header\">\n <span class=\"leading-slot ${hasLeadingHeader ? '' : 'empty'}\">\n <slot name=\"leading\" @slotchange=${this.handleLeadingSlotChange}>\n <slot name=\"leading-icon\" @slotchange=${this.handleLeadingSlotChange}>\n ${showBack\n ? html`\n <button\n class=\"icon-btn back-btn\"\n type=\"button\"\n aria-label=\"Back\"\n @click=${this.handleBackClick}\n >\n <md-ripple ?disabled=${this.disabled}></md-ripple>\n <md-focus-ring></md-focus-ring>\n <md-icon name=${this.activeLeadingIcon}></md-icon>\n </button>\n `\n : (effLeading\n ? html`\n <button\n class=\"icon-btn leading-btn\"\n type=\"button\"\n aria-label=${effLeading === 'menu' ? 'Menu' : effLeading}\n ?disabled=${this.disabled}\n @click=${this.handleLeadingClick}\n >\n <md-ripple ?disabled=${this.disabled}></md-ripple>\n <md-focus-ring></md-focus-ring>\n <md-icon name=${effLeading}></md-icon>\n </button>\n `\n : nothing)}\n </slot>\n </slot>\n </span>\n\n <div class=\"input-wrapper\">\n <input\n type=\"search\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded=${this.active ? 'true' : 'false'}\n aria-label=${this.placeholder}\n placeholder=${this.placeholder}\n .value=${this.value}\n ?disabled=${this.disabled}\n @input=${this.handleInput}\n @change=${this.handleChange}\n @keydown=${this.handleKeyDown}\n @focus=${this.handleFocus}\n @click=${this.handleFocus}\n />\n </div>\n\n <span class=\"trailing-slot\">\n ${this.showClearButton && this.value\n ? html`\n <button\n class=\"icon-btn clear-btn\"\n type=\"button\"\n aria-label=\"Clear search\"\n @click=${this.handleClearClick}\n >\n <md-ripple ?disabled=${this.disabled}></md-ripple>\n <md-focus-ring></md-focus-ring>\n <md-icon name=\"close\"></md-icon>\n </button>\n `\n : nothing}\n\n <slot name=\"trailing\">\n <slot name=\"trailing-icon\">\n ${effTrailing\n ? html`\n <button\n class=\"icon-btn trailing-btn\"\n type=\"button\"\n aria-label=${effTrailing === 'search' ? 'Search' : effTrailing}\n ?disabled=${this.disabled}\n @click=${this.handleTrailingClick}\n >\n <md-ripple ?disabled=${this.disabled}></md-ripple>\n <md-focus-ring></md-focus-ring>\n <md-icon name=${effTrailing}></md-icon>\n </button>\n `\n : nothing}\n </slot>\n </slot>\n </span>\n </div>\n\n ${this.hasContent\n ? html`\n <div class=\"divider\"></div>\n\n <div class=\"suggestions-container\" role=\"listbox\" aria-label=\"Suggestions\">\n <slot name=\"suggestions\" @slotchange=${this.handleContentSlotChange}>\n ${this.suggestions.map((item, idx) => this.renderSuggestionItem(item, idx))}\n </slot>\n <div class=\"extra-content\">\n <slot @slotchange=${this.handleContentSlotChange}></slot>\n </div>\n </div>\n `\n : html`\n <div class=\"extra-content\" style=\"display: none;\">\n <slot name=\"suggestions\" @slotchange=${this.handleContentSlotChange}></slot>\n <slot @slotchange=${this.handleContentSlotChange}></slot>\n </div>\n `}\n </div>\n `;\n }\n}\n\n@customElement('md-search')\nexport class MdSearch extends MdSearchBar {}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-search-bar': MdSearchBar;\n 'md-search': MdSearch;\n }\n}\n"],"mappings":";;;;;;;;AAEA,IAAa,IAAkB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCoBrB,IAAN,cAA0B,EAAwB;;EAwU3B,aApUN,KAAA,OAAA,UAGZ,KAAA,UAAA,IAGF,KAAA,QAAA,IAGM,KAAA,cAAA,UAGL,KAAA,SAAA,IAGuC,KAAA,cA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,GA0Bb,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,oBAAA,KAAA,CAAA,GApFR,IAAA,EAAA,CAAA,EAAc,eAAe,CAAA,GAAA,CAAA;AA+jBvB,IAAM,IAAN,cAAuB,EAAY,CAAC;AAD1C,IAAA,EAAA,CAAA,EAAc,WAAW,CAAA,GAAA,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../../chunks/search-bar-
|
|
1
|
+
import { n as e, t } from "../../chunks/search-bar-B4lAXza_.js";
|
|
2
2
|
export { t as MdSearch, e as MdSearchBar };
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import { MdNavBar as ee, MdNavigationBar as te } from "./components/navigation-b
|
|
|
31
31
|
import { n as ne, t as re } from "./chunks/navigation-rail-item-CWvGjLjC.js";
|
|
32
32
|
import { MdNavRail as ie, MdNavigationRail as ae } from "./components/navigation-rail/navigation-rail.js";
|
|
33
33
|
import { a as oe, c as se, i as ce, l as le, n as ue, o as de, r as fe, s as pe, t as me, u as he } from "./chunks/table-C5rCvdFc.js";
|
|
34
|
-
import { n as ge, t as _e } from "./chunks/search-bar-
|
|
34
|
+
import { n as ge, t as _e } from "./chunks/search-bar-B4lAXza_.js";
|
|
35
35
|
import { n as ve, t as ye } from "./chunks/code-CM6hIZNx.js";
|
|
36
36
|
import { i as be, n as xe, r as Se, t as Ce } from "./chunks/player-dT08kxeG.js";
|
|
37
37
|
import { a as we, i as Te, n as Ee, o as De, r as Oe, t as ke } from "./chunks/app-drawer-DjKSuatE.js";
|
package/llms.txt
CHANGED
|
@@ -967,9 +967,10 @@ const isEnabled = ref(true);
|
|
|
967
967
|
| `compact` | `boolean` | `false` | Shorthand boolean attribute for compact / small navbar sizing |
|
|
968
968
|
| `active` | `boolean` | `false` | Controls whether search view is expanded and showing suggestions |
|
|
969
969
|
| `suggestions` | `Array<string \| SearchSuggestion>` | `[]` | List of search suggestions with labels, supporting text, and icons |
|
|
970
|
-
| `
|
|
970
|
+
| `search-icon-position` | `'leading' \| 'trailing' \| 'left' \| 'right'` | `'leading'` | Position of search icon (`'leading'` / left, or `'trailing'` / right) |
|
|
971
|
+
| `leading-icon` | `string` | `'search'` | Leading icon displayed when inactive (e.g. `'search'`, `'menu'`) |
|
|
971
972
|
| `active-leading-icon` | `string` | `'arrow_back'` | Leading icon displayed when active |
|
|
972
|
-
| `trailing-icon` | `string` | `''` | Optional trailing action icon |
|
|
973
|
+
| `trailing-icon` | `string` | `''` | Optional trailing action icon (e.g. `'mic'`, `'search'`) |
|
|
973
974
|
| `show-back-button` | `boolean` | `true` | Whether to show the back button in active mode |
|
|
974
975
|
| `responsive` | `boolean` | `true` | Automatically switches to full-screen view and collapsed search icon on mobile (<= 768px) |
|
|
975
976
|
| `collapse-on-mobile` | `boolean` | `true` | Collapses search bar into a compact search icon button on mobile screens when inactive |
|
|
@@ -977,27 +978,43 @@ const isEnabled = ref(true);
|
|
|
977
978
|
| `disabled` | `boolean` | `false` | Disables user interaction |
|
|
978
979
|
|
|
979
980
|
##### Slots
|
|
980
|
-
- `leading-icon`: Custom leading icon or button element.
|
|
981
|
-
- `trailing-icon`: Custom trailing action buttons, avatar, or mic.
|
|
981
|
+
- `leading` / `leading-icon`: Custom leading icon or navigation button element.
|
|
982
|
+
- `trailing` / `trailing-icon`: Custom trailing action buttons, avatar, or mic.
|
|
982
983
|
- `suggestions`: Custom slotted suggestions list.
|
|
983
984
|
- `(default)`: Additional content rendered inside active search surface.
|
|
984
985
|
|
|
985
986
|
##### Events
|
|
986
987
|
- `input`: Fired as user types (`detail: { value: string }`).
|
|
987
988
|
- `change`: Fired on committed input change (`detail: { value: string }`).
|
|
988
|
-
- `search`: Fired when user presses Enter or
|
|
989
|
+
- `search`: Fired when user presses Enter or clicks the search button (`detail: { value: string, suggestion?: object }`).
|
|
990
|
+
- `leading-icon-click`: Fired when custom leading button (e.g. menu) is clicked (`detail: { icon: string }`).
|
|
991
|
+
- `trailing-icon-click`: Fired when trailing icon button is clicked (`detail: { icon: string }`).
|
|
989
992
|
- `active-change`: Fired when search bar expands/collapses (`detail: { active: boolean }`).
|
|
990
993
|
- `suggestion-select`: Fired when a suggestion is selected (`detail: { suggestion: object, value: string, index: number }`).
|
|
991
994
|
- `clear`: Fired when search value is cleared.
|
|
992
995
|
|
|
993
996
|
##### Code Example
|
|
994
997
|
```html
|
|
998
|
+
<!-- Standard Search Bar -->
|
|
995
999
|
<md-search-bar
|
|
996
1000
|
id="demo-search-bar"
|
|
997
1001
|
placeholder="Search destinations, hotels, flights..."
|
|
998
1002
|
trailing-icon="mic"
|
|
999
1003
|
></md-search-bar>
|
|
1000
1004
|
|
|
1005
|
+
<!-- Search Icon on the Right -->
|
|
1006
|
+
<md-search-bar
|
|
1007
|
+
placeholder="Search products..."
|
|
1008
|
+
search-icon-position="right"
|
|
1009
|
+
></md-search-bar>
|
|
1010
|
+
|
|
1011
|
+
<!-- Hamburger Menu Button on Left and Search Icon on Right -->
|
|
1012
|
+
<md-search-bar
|
|
1013
|
+
placeholder="Search apps and files..."
|
|
1014
|
+
leading-icon="menu"
|
|
1015
|
+
search-icon-position="right"
|
|
1016
|
+
></md-search-bar>
|
|
1017
|
+
|
|
1001
1018
|
<!-- Custom Slotted Content in Active State -->
|
|
1002
1019
|
<md-search-bar placeholder="Search files & documents">
|
|
1003
1020
|
<div style="padding: 12px 16px;">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@francofantomius/material-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Reusable, accessible, and lightweight Material Design 3 Web Components built with Lit.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -297,6 +297,7 @@
|
|
|
297
297
|
"test": "vitest run",
|
|
298
298
|
"test:watch": "vitest",
|
|
299
299
|
"analyze": "cem analyze --litelement",
|
|
300
|
+
"build:example": "esbuild src/index.ts --bundle --format=iife --outfile=example.bundle.js",
|
|
300
301
|
"prepublishOnly": "npm run typecheck && npm run test && npm run build"
|
|
301
302
|
},
|
|
302
303
|
"keywords": [
|
|
@@ -314,11 +315,11 @@
|
|
|
314
315
|
"lit": "^3.3.3"
|
|
315
316
|
},
|
|
316
317
|
"devDependencies": {
|
|
317
|
-
"@custom-elements-manifest/analyzer": "^0.
|
|
318
|
+
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
318
319
|
"esbuild": "^0.28.2",
|
|
319
|
-
"happy-dom": "^20.
|
|
320
|
+
"happy-dom": "^20.14.5",
|
|
320
321
|
"typescript": "^7.0.2",
|
|
321
322
|
"vite": "^8.2.2",
|
|
322
|
-
"vitest": "^
|
|
323
|
+
"vitest": "^5.0.0"
|
|
323
324
|
}
|
|
324
325
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-bar-B6xxVT7u.js","names":[],"sources":["../../src/components/search-bar/search-bar.css.ts","../../src/components/search-bar/search-bar.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const searchBarStyles = css`\n :host {\n display: block;\n box-sizing: border-box;\n position: relative;\n width: 100%;\n max-width: var(--md-search-bar-max-width, 100%);\n font-family: var(--md-sys-typescale-font-family, inherit);\n color: var(--md-sys-color-on-surface, #1D1B20);\n vertical-align: middle;\n\n --_height: var(--md-search-bar-height, 56px);\n --_shape: var(--md-search-bar-shape, var(--md-search-bar-border-radius, var(--md-sys-shape-corner-full, 28px)));\n --_shape-active: var(--md-search-bar-shape-active, var(--md-sys-shape-corner-extra-large, 28px 28px 16px 16px));\n --_bg: var(--md-search-bar-container-color, var(--md-search-bar-bg, var(--md-sys-color-surface-container-high, #ECE6F0)));\n --_elevation: var(--md-search-bar-elevation, var(--md-sys-elevation-level1, 0px 1px 3px 1px rgba(0, 0, 0, 0.15)));\n --_elevation-active: var(--md-search-bar-elevation-active, var(--md-sys-elevation-level3, 0px 4px 8px 3px rgba(0, 0, 0, 0.15)));\n --_btn-size: var(--md-search-bar-icon-button-size, 40px);\n --_icon-size: var(--md-search-bar-icon-size, 24px);\n --_font-size: var(--md-search-bar-font-size, var(--md-sys-typescale-body-large-size, 16px));\n --_line-height: var(--md-search-bar-line-height, var(--md-sys-typescale-body-large-line-height, 24px));\n --_padding: var(--md-search-bar-padding, 0 8px 0 16px);\n }\n\n :host([size=\"small\"]),\n :host([size=\"compact\"]),\n :host([compact]) {\n --_height: var(--md-search-bar-height, 40px);\n --_shape: var(--md-search-bar-shape, var(--md-search-bar-border-radius, 20px));\n --_shape-active: var(--md-search-bar-shape-active, 20px 20px 12px 12px);\n --_btn-size: var(--md-search-bar-icon-button-size, 32px);\n --_icon-size: var(--md-search-bar-icon-size, 20px);\n --_font-size: var(--md-search-bar-font-size, var(--md-sys-typescale-body-medium-size, 14px));\n --_line-height: var(--md-search-bar-line-height, 20px);\n --_padding: var(--md-search-bar-padding, 0 6px 0 12px);\n }\n\n :host([size=\"large\"]) {\n --_height: var(--md-search-bar-height, 64px);\n --_shape: var(--md-search-bar-shape, var(--md-search-bar-border-radius, 32px));\n --_shape-active: var(--md-search-bar-shape-active, 32px 32px 20px 20px);\n --_btn-size: var(--md-search-bar-icon-button-size, 48px);\n --_icon-size: var(--md-search-bar-icon-size, 24px);\n --_font-size: var(--md-search-bar-font-size, 18px);\n --_line-height: var(--md-search-bar-line-height, 26px);\n --_padding: var(--md-search-bar-padding, 0 12px 0 20px);\n }\n\n :host([disabled]) {\n pointer-events: none;\n opacity: 0.38;\n }\n\n .scrim {\n display: none;\n }\n\n /* Scrim when active in docked mode to catch outside clicks */\n :host([active]) .scrim {\n display: block;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 40;\n background: transparent;\n }\n\n .search-container {\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n width: 100%;\n box-sizing: border-box;\n background-color: var(--_bg);\n border-radius: var(--_shape);\n box-shadow: var(--_elevation);\n transition: box-shadow 200ms cubic-bezier(0.2, 0, 0, 1),\n border-radius 200ms cubic-bezier(0.2, 0, 0, 1),\n background-color 200ms cubic-bezier(0.2, 0, 0, 1);\n }\n\n .search-bar-header {\n display: flex;\n align-items: center;\n min-height: var(--_height);\n height: var(--_height);\n padding: var(--_padding);\n box-sizing: border-box;\n gap: 8px;\n }\n\n .leading-slot, .trailing-slot {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n\n .icon-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--_btn-size);\n height: var(--_btn-size);\n border: none;\n background: transparent;\n border-radius: 50%;\n color: var(--md-sys-color-on-surface-variant, #49454F);\n cursor: pointer;\n padding: 0;\n outline: none;\n position: relative;\n transition: background-color 150ms ease;\n }\n\n .icon-btn md-icon {\n font-size: var(--_icon-size);\n --md-icon-size: var(--_icon-size);\n }\n\n .icon-btn:hover {\n background-color: rgba(73, 69, 79, 0.08);\n }\n\n .icon-btn:focus-visible {\n background-color: rgba(73, 69, 79, 0.12);\n }\n\n .input-wrapper {\n display: flex;\n flex: 1;\n min-width: 0;\n align-items: center;\n position: relative;\n }\n\n input {\n width: 100%;\n border: none;\n background: transparent;\n outline: none;\n font-family: inherit;\n font-size: var(--_font-size);\n line-height: var(--_line-height);\n color: var(--md-sys-color-on-surface, #1D1B20);\n padding: 0 4px;\n margin: 0;\n box-sizing: border-box;\n -webkit-appearance: none;\n appearance: none;\n }\n\n input::-webkit-search-decoration,\n input::-webkit-search-cancel-button,\n input::-webkit-search-results-button,\n input::-webkit-search-results-decoration {\n -webkit-appearance: none;\n appearance: none;\n display: none;\n }\n\n input::-ms-clear,\n input::-ms-reveal {\n display: none;\n width: 0;\n height: 0;\n }\n\n input::placeholder {\n color: var(--md-sys-color-on-surface-variant, #49454F);\n opacity: 0.8;\n }\n\n /* Active Docked Mode */\n :host([active]) .search-container {\n z-index: 50;\n border-radius: var(--_shape-active);\n box-shadow: var(--_elevation-active);\n }\n\n /* Divider when active */\n .divider {\n display: none;\n height: 1px;\n background-color: var(--md-sys-color-outline-variant, #CAC4D0);\n margin: 0 16px;\n }\n\n :host([active]) .divider {\n display: block;\n }\n\n /* Suggestions / Content Container */\n .suggestions-container {\n display: none;\n flex-direction: column;\n max-height: 360px;\n overflow-y: auto;\n padding: 8px 0;\n box-sizing: border-box;\n }\n\n :host([active]) .suggestions-container {\n display: flex;\n }\n\n .suggestion-item {\n display: flex;\n align-items: center;\n min-height: 48px;\n padding: 0 16px;\n gap: 16px;\n box-sizing: border-box;\n cursor: pointer;\n position: relative;\n user-select: none;\n color: var(--md-sys-color-on-surface, #1D1B20);\n transition: background-color 150ms ease;\n }\n\n .suggestion-item:hover,\n .suggestion-item.highlighted {\n background-color: rgba(73, 69, 79, 0.08);\n }\n\n .suggestion-item.selected {\n background-color: rgba(73, 69, 79, 0.12);\n }\n\n .suggestion-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n color: var(--md-sys-color-on-surface-variant, #49454F);\n flex-shrink: 0;\n }\n\n .suggestion-icon md-icon {\n font-size: var(--_icon-size);\n --md-icon-size: var(--_icon-size);\n }\n\n .suggestion-text {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-width: 0;\n overflow: hidden;\n }\n\n .suggestion-label {\n font-size: var(--_font-size);\n line-height: 20px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .suggestion-supporting {\n font-size: var(--md-sys-typescale-body-medium-size, 14px);\n line-height: 16px;\n color: var(--md-sys-color-on-surface-variant, #49454F);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-top: 2px;\n }\n\n .suggestion-trailing {\n font-size: var(--md-sys-typescale-body-medium-size, 14px);\n color: var(--md-sys-color-on-surface-variant, #49454F);\n flex-shrink: 0;\n }\n\n .search-trigger-container {\n display: none;\n }\n\n /* Responsive Fullscreen / Mobile Collapsed Mode */\n @media (max-width: 768px) {\n :host([responsive]:not([active]):not([collapse-on-mobile=\"false\"])),\n :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile=\"false\"])) {\n display: inline-flex;\n width: auto;\n max-width: none;\n vertical-align: middle;\n }\n\n :host([responsive]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container,\n :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background-color: transparent;\n border-radius: 50%;\n box-shadow: none;\n cursor: pointer;\n user-select: none;\n outline: none;\n transition: background-color 200ms ease, box-shadow 200ms ease;\n -webkit-tap-highlight-color: transparent;\n }\n\n :host([responsive]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container.has-trailing,\n :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container.has-trailing {\n height: var(--_height);\n padding: 0 4px;\n gap: 2px;\n background-color: var(--_bg);\n border-radius: var(--_shape);\n box-shadow: var(--_elevation);\n }\n\n :host([responsive]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container.has-trailing:hover,\n :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container.has-trailing:hover {\n box-shadow: var(--md-sys-elevation-level2, 0px 2px 6px 2px rgba(0, 0, 0, 0.15));\n }\n\n :host([responsive]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container:focus-visible,\n :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile=\"false\"])) .search-trigger-container:focus-visible {\n outline: 2px solid var(--md-sys-color-primary, #6750A4);\n outline-offset: 2px;\n }\n\n .trigger-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--_btn-size);\n height: var(--_btn-size);\n min-width: var(--_btn-size);\n min-height: var(--_btn-size);\n border-radius: 50%;\n border: none;\n background: transparent;\n color: var(--md-sys-color-on-surface-variant, #49454F);\n cursor: pointer;\n padding: 0;\n margin: 0;\n outline: none;\n position: relative;\n transition: background-color 150ms ease, color 150ms ease;\n -webkit-tap-highlight-color: transparent;\n }\n\n .trigger-btn md-icon {\n font-size: var(--_icon-size);\n --md-icon-size: var(--_icon-size);\n }\n\n .trigger-btn:hover {\n background-color: rgba(73, 69, 79, 0.08);\n }\n\n .trigger-btn:focus-visible {\n background-color: rgba(73, 69, 79, 0.12);\n }\n\n .trigger-divider {\n width: 1px;\n height: 22px;\n background-color: var(--md-sys-color-outline-variant, #CAC4D0);\n margin: 0 2px;\n flex-shrink: 0;\n }\n\n :host([responsive]:not([active]):not([collapse-on-mobile=\"false\"])) .search-container,\n :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile=\"false\"])) .search-container {\n display: none;\n }\n\n :host([responsive]:not([active]):not([collapse-on-mobile=\"false\"])) .scrim,\n :host([collapse-on-mobile]:not([active]):not([collapse-on-mobile=\"false\"])) .scrim {\n display: none;\n }\n\n :host([responsive][active]),\n :host([collapse-on-mobile][active]) {\n display: block;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100vw;\n height: 100vh;\n height: 100dvh;\n max-width: 100vw;\n margin: 0;\n padding: 0;\n z-index: 99999;\n }\n\n :host([responsive][active]) .search-trigger-container,\n :host([collapse-on-mobile][active]) .search-trigger-container {\n display: none;\n }\n\n :host([responsive][active]) .scrim,\n :host([collapse-on-mobile][active]) .scrim {\n display: none;\n }\n\n :host([responsive][active]) .search-container,\n :host([collapse-on-mobile][active]) .search-container {\n display: flex;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100vw;\n height: 100vh;\n height: 100dvh;\n max-width: 100vw;\n border-radius: 0;\n box-shadow: none;\n z-index: 99999;\n background-color: var(--_bg);\n }\n\n :host([responsive][active]) .suggestions-container,\n :host([collapse-on-mobile][active]) .suggestions-container {\n flex: 1;\n max-height: calc(100vh - 57px);\n max-height: calc(100dvh - 57px);\n }\n }\n\n /* Forced Fullscreen attribute */\n :host([fullscreen][active]) {\n display: block;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100vw;\n height: 100vh;\n height: 100dvh;\n max-width: 100vw;\n z-index: 99999;\n }\n\n :host([fullscreen][active]) .search-trigger-container {\n display: none;\n }\n\n :host([fullscreen][active]) .scrim {\n display: none;\n }\n\n :host([fullscreen][active]) .search-container {\n display: flex;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100vw;\n height: 100vh;\n height: 100dvh;\n max-width: 100vw;\n border-radius: 0;\n box-shadow: none;\n z-index: 99999;\n background-color: var(--_bg);\n }\n\n :host([fullscreen][active]) .suggestions-container {\n flex: 1;\n max-height: calc(100vh - 57px);\n max-height: calc(100dvh - 57px);\n }\n`;\n\n","import { html, nothing } from 'lit';\nimport { customElement, property, state, query } from 'lit/decorators.js';\nimport { MdFormAssociatedElement } from '../../internal/form-associated.js';\nimport '../icon/icon.js';\nimport { searchBarStyles } from './search-bar.css.js';\n\nexport type SearchBarSize = 'small' | 'compact' | 'medium' | 'large';\n\nexport interface SearchSuggestion {\n id?: string;\n label: string;\n value?: string;\n supportingText?: string;\n trailingSupportingText?: string;\n icon?: string;\n [key: string]: unknown;\n}\n\n@customElement('md-search-bar')\nexport class MdSearchBar extends MdFormAssociatedElement {\n static override styles = [MdFormAssociatedElement.styles, searchBarStyles];\n\n @property({ type: String, reflect: true })\n size: SearchBarSize = 'medium';\n\n @property({ type: Boolean, reflect: true })\n compact = false;\n\n @property({ type: String })\n value = '';\n\n @property({ type: String })\n placeholder = 'Search';\n\n @property({ type: Boolean, reflect: true })\n active = false;\n\n @property({ type: Array })\n suggestions: Array<string | SearchSuggestion> = [];\n\n @property({ type: String, attribute: 'leading-icon' })\n leadingIcon = 'search';\n\n @property({ type: String, attribute: 'active-leading-icon' })\n activeLeadingIcon = 'arrow_back';\n\n @property({ type: String, attribute: 'trailing-icon' })\n trailingIcon = '';\n\n @property({ type: Boolean, attribute: 'show-back-button' })\n showBackButton = true;\n\n @property({ type: Boolean, attribute: 'show-clear-button' })\n showClearButton = true;\n\n @property({ type: Boolean, reflect: true })\n responsive = true;\n\n @property({ type: Boolean, attribute: 'collapse-on-mobile', reflect: true })\n collapseOnMobile = true;\n\n @property({ type: Boolean, reflect: true })\n fullscreen = false;\n\n @property({ type: Boolean, attribute: 'auto-deactivate-on-select' })\n autoDeactivateOnSelect = true;\n\n @state()\n private highlightedIndex = -1;\n\n @query('input')\n private inputElement?: HTMLInputElement;\n\n override connectedCallback() {\n super.connectedCallback();\n this.setFormValue(this.value);\n this.toggleAttribute('has-value', Boolean(this.value));\n this.toggleAttribute('active', this.active);\n this.toggleAttribute('collapse-on-mobile', this.collapseOnMobile);\n }\n\n override willUpdate(changedProperties: Map<string, unknown>) {\n super.willUpdate(changedProperties);\n if (changedProperties.has('value')) {\n this.setFormValue(this.value);\n this.toggleAttribute('has-value', Boolean(this.value));\n }\n if (changedProperties.has('active')) {\n this.toggleAttribute('active', this.active);\n if (!this.active) {\n this.highlightedIndex = -1;\n }\n }\n if (changedProperties.has('collapseOnMobile')) {\n this.toggleAttribute('collapse-on-mobile', this.collapseOnMobile);\n }\n }\n\n override formResetCallback() {\n this.value = '';\n this.setFormValue(null);\n this.toggleAttribute('has-value', false);\n this.highlightedIndex = -1;\n }\n\n /**\n * Focuses the search input field.\n */\n override focus() {\n this.inputElement?.focus();\n }\n\n /**\n * Opens / activates the search view.\n */\n show() {\n if (!this.active) {\n this.active = true;\n this.emitEvent('active-change', { active: true });\n }\n this.updateComplete.then(() => {\n this.inputElement?.focus();\n });\n }\n\n /**\n * Alias for show()\n */\n open() {\n this.show();\n }\n\n /**\n * Closes / deactivates the search view.\n */\n close() {\n if (this.active) {\n this.active = false;\n this.highlightedIndex = -1;\n this.emitEvent('active-change', { active: false });\n }\n }\n\n /**\n * Alias for close()\n */\n collapse() {\n this.close();\n }\n\n /**\n * Toggles the active state of the search bar.\n */\n toggle() {\n if (this.active) {\n this.close();\n } else {\n this.show();\n }\n }\n\n /**\n * Clears the current search input.\n */\n clear() {\n this.value = '';\n this.setFormValue('');\n this.toggleAttribute('has-value', false);\n this.highlightedIndex = -1;\n this.emitEvent('input', { value: '' });\n this.emitEvent('clear');\n this.inputElement?.focus();\n }\n\n private handleFocus = () => {\n if (!this.active) {\n this.active = true;\n this.emitEvent('active-change', { active: true });\n }\n };\n\n private handleInput = (event: Event) => {\n const target = event.target as HTMLInputElement;\n this.value = target.value;\n this.setFormValue(this.value);\n this.toggleAttribute('has-value', Boolean(this.value));\n this.highlightedIndex = -1;\n this.emitEvent('input', { value: this.value });\n };\n\n private handleChange = () => {\n this.emitEvent('change', { value: this.value });\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n const count = this.suggestions.length;\n\n if (event.key === 'Escape') {\n event.preventDefault();\n this.close();\n this.inputElement?.blur();\n return;\n }\n\n if (event.key === 'ArrowDown') {\n if (!this.active) {\n this.show();\n return;\n }\n if (count > 0) {\n event.preventDefault();\n this.highlightedIndex = (this.highlightedIndex + 1) % count;\n }\n return;\n }\n\n if (event.key === 'ArrowUp') {\n if (count > 0 && this.active) {\n event.preventDefault();\n this.highlightedIndex = this.highlightedIndex <= 0 ? count - 1 : this.highlightedIndex - 1;\n }\n return;\n }\n\n if (event.key === 'Enter') {\n if (this.active && this.highlightedIndex >= 0 && this.highlightedIndex < count) {\n const item = this.suggestions[this.highlightedIndex];\n if (item !== undefined) {\n event.preventDefault();\n this.selectSuggestion(item, this.highlightedIndex);\n }\n } else {\n this.emitEvent('search', { value: this.value });\n }\n }\n };\n\n private handleTriggerClick = (event: MouseEvent) => {\n event.stopPropagation();\n this.show();\n };\n\n private handleTriggerKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.show();\n }\n };\n\n private handleTrailingTriggerClick = (event: MouseEvent) => {\n event.stopPropagation();\n const allowed = this.emitEvent('trailing-icon-click', { icon: this.trailingIcon });\n if (allowed) {\n this.show();\n }\n };\n\n private handleBackClick = (event: MouseEvent) => {\n event.stopPropagation();\n this.close();\n };\n\n private handleScrimClick = () => {\n this.close();\n };\n\n private handleClearClick = (event: MouseEvent) => {\n event.stopPropagation();\n this.clear();\n };\n\n private selectSuggestion(suggestion: string | SearchSuggestion, index: number) {\n const label = typeof suggestion === 'string' ? suggestion : suggestion.label;\n const value = typeof suggestion === 'string' ? suggestion : (suggestion.value ?? suggestion.label);\n\n this.value = value;\n this.setFormValue(this.value);\n this.toggleAttribute('has-value', Boolean(this.value));\n this.emitEvent('suggestion-select', { suggestion, label, value, index });\n this.emitEvent('search', { value: this.value, suggestion });\n\n if (this.autoDeactivateOnSelect) {\n this.close();\n }\n }\n\n private renderSuggestionItem(suggestion: string | SearchSuggestion, index: number) {\n const isString = typeof suggestion === 'string';\n const label = isString ? suggestion : suggestion.label;\n const supportingText = !isString ? suggestion.supportingText : undefined;\n const trailingSupportingText = !isString ? suggestion.trailingSupportingText : undefined;\n const iconName = !isString && suggestion.icon ? suggestion.icon : 'history';\n const isHighlighted = this.highlightedIndex === index;\n\n return html`\n <div\n class=\"suggestion-item ${isHighlighted ? 'highlighted' : ''}\"\n role=\"option\"\n aria-selected=${isHighlighted ? 'true' : 'false'}\n @click=${() => this.selectSuggestion(suggestion, index)}\n >\n <span class=\"suggestion-icon\">\n <md-icon name=${iconName}></md-icon>\n </span>\n <div class=\"suggestion-text\">\n <span class=\"suggestion-label\">${label}</span>\n ${supportingText ? html`<span class=\"suggestion-supporting\">${supportingText}</span>` : nothing}\n </div>\n ${trailingSupportingText ? html`<span class=\"suggestion-trailing\">${trailingSupportingText}</span>` : nothing}\n </div>\n `;\n }\n\n override render() {\n const showBack = this.active && this.showBackButton;\n const hasTrailing = Boolean(this.trailingIcon);\n\n return html`\n <div\n class=\"search-trigger-container ${hasTrailing ? 'has-trailing' : ''}\"\n role=\"button\"\n tabindex=\"0\"\n aria-label=${this.placeholder || 'Search'}\n title=${this.placeholder || 'Search'}\n ?disabled=${this.disabled}\n @click=${this.handleTriggerClick}\n @keydown=${this.handleTriggerKeyDown}\n >\n <button\n class=\"trigger-btn\"\n type=\"button\"\n aria-label=${this.placeholder || 'Search'}\n title=${this.placeholder || 'Search'}\n ?disabled=${this.disabled}\n @click=${this.handleTriggerClick}\n >\n <md-icon name=${this.leadingIcon || 'search'}></md-icon>\n </button>\n\n ${hasTrailing\n ? html`\n <div class=\"trigger-divider\" aria-hidden=\"true\"></div>\n <button\n class=\"trigger-btn trigger-trailing-btn\"\n type=\"button\"\n aria-label=${this.trailingIcon}\n title=${this.trailingIcon}\n ?disabled=${this.disabled}\n @click=${this.handleTrailingTriggerClick}\n >\n <md-icon name=${this.trailingIcon}></md-icon>\n </button>\n `\n : nothing}\n </div>\n\n <div class=\"scrim\" @click=${this.handleScrimClick}></div>\n\n <div class=\"search-container\" role=\"search\">\n <div class=\"search-bar-header\">\n <span class=\"leading-slot\">\n <slot name=\"leading-icon\">\n ${showBack\n ? html`\n <button\n class=\"icon-btn\"\n type=\"button\"\n aria-label=\"Back\"\n @click=${this.handleBackClick}\n >\n <md-icon name=${this.activeLeadingIcon}></md-icon>\n </button>\n `\n : html`\n <span class=\"icon-btn\" style=\"cursor: default;\">\n <md-icon name=${this.leadingIcon}></md-icon>\n </span>\n `}\n </slot>\n </span>\n\n <div class=\"input-wrapper\">\n <input\n type=\"search\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded=${this.active ? 'true' : 'false'}\n aria-label=${this.placeholder}\n placeholder=${this.placeholder}\n .value=${this.value}\n ?disabled=${this.disabled}\n @input=${this.handleInput}\n @change=${this.handleChange}\n @keydown=${this.handleKeyDown}\n @focus=${this.handleFocus}\n @click=${this.handleFocus}\n />\n </div>\n\n <span class=\"trailing-slot\">\n ${this.showClearButton && this.value\n ? html`\n <button\n class=\"icon-btn clear-btn\"\n type=\"button\"\n aria-label=\"Clear search\"\n @click=${this.handleClearClick}\n >\n <md-icon name=\"close\"></md-icon>\n </button>\n `\n : nothing}\n\n <slot name=\"trailing-icon\">\n ${this.trailingIcon\n ? html`\n <span class=\"icon-btn\" style=\"cursor: default;\">\n <md-icon name=${this.trailingIcon}></md-icon>\n </span>\n `\n : nothing}\n </slot>\n </span>\n </div>\n\n <div class=\"divider\"></div>\n\n <div class=\"suggestions-container\" role=\"listbox\" aria-label=\"Suggestions\">\n <slot name=\"suggestions\">\n ${this.suggestions.map((item, idx) => this.renderSuggestionItem(item, idx))}\n </slot>\n <div class=\"extra-content\">\n <slot></slot>\n </div>\n </div>\n </div>\n `;\n }\n}\n\n@customElement('md-search')\nexport class MdSearch extends MdSearchBar {}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-search-bar': MdSearchBar;\n 'md-search': MdSearch;\n }\n}\n"],"mappings":";;;;;;AAEA,IAAa,IAAkB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCiBrB,IAAN,cAA0B,EAAwB;;EAuP3B,aAnPN,KAAA,OAAA,UAGZ,KAAA,UAAA,IAGF,KAAA,QAAA,IAGM,KAAA,cAAA,UAGL,KAAA,SAAA,IAGuC,KAAA,cAAA,CAAC,GAGnC,KAAA,cAAA,UAGM,KAAA,oBAAA,cAGL,KAAA,eAAA,IAGE,KAAA,iBAAA,I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