@redvars/peacock 3.4.0 → 3.5.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/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/banner.js +202 -0
- package/dist/banner.js.map +1 -0
- package/dist/bottom-sheet.js +2 -2
- package/dist/{button-COYCtuA8.js → button-DMN1dPAg.js} +58 -75
- package/dist/button-DMN1dPAg.js.map +1 -0
- package/dist/{button-group-DsXquZQn.js → button-group-CX9CUUXk.js} +9 -14
- package/dist/button-group-CX9CUUXk.js.map +1 -0
- package/dist/button-group.js +8 -5
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +7 -4
- package/dist/button.js.map +1 -1
- package/dist/card.js +15 -5
- package/dist/card.js.map +1 -1
- package/dist/chart-bar.js +2 -2
- package/dist/chart-bar.js.map +1 -1
- package/dist/chart-doughnut.js.map +1 -1
- package/dist/chart-pie.js.map +1 -1
- package/dist/chart-stacked-bar.js +2 -2
- package/dist/chart-stacked-bar.js.map +1 -1
- package/dist/{class-map-3TAnCMAX.js → class-map-YU7g0o3B.js} +2 -2
- package/dist/{class-map-3TAnCMAX.js.map → class-map-YU7g0o3B.js.map} +1 -1
- package/dist/clock.js.map +1 -1
- package/dist/code-editor.js +4 -4
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +3 -3
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +2918 -1379
- package/dist/custom-elements.json +2783 -1054
- package/dist/directive-ZPhl09Yt.js +9 -0
- package/dist/directive-ZPhl09Yt.js.map +1 -0
- package/dist/dispatch-event-utils-CuEqjlPT.js +127 -0
- package/dist/dispatch-event-utils-CuEqjlPT.js.map +1 -0
- package/dist/fab-C5Nzxk0E.js +497 -0
- package/dist/fab-C5Nzxk0E.js.map +1 -0
- package/dist/fab.js +11 -0
- package/dist/fab.js.map +1 -0
- package/dist/index.js +17 -9
- package/dist/index.js.map +1 -1
- package/dist/{observe-theme-change-DKAIv5BB.js → is-dark-mode-DicqGkCJ.js} +6 -2
- package/dist/is-dark-mode-DicqGkCJ.js.map +1 -0
- package/dist/notification.js +417 -0
- package/dist/notification.js.map +1 -0
- package/dist/number-counter.js +2 -2
- package/dist/number-counter.js.map +1 -1
- package/dist/observe-slot-change-BGJfgg2E.js +31 -0
- package/dist/observe-slot-change-BGJfgg2E.js.map +1 -0
- package/dist/peacock-loader.js +32 -9
- package/dist/peacock-loader.js.map +1 -1
- package/dist/search.js +452 -0
- package/dist/search.js.map +1 -0
- package/dist/{select-C3XAzenC.js → select-4pl4XBj7.js} +778 -374
- package/dist/select-4pl4XBj7.js.map +1 -0
- package/dist/side-sheet.js +2 -2
- package/dist/spread-B5cgadZl.js +32 -0
- package/dist/spread-B5cgadZl.js.map +1 -0
- package/dist/src/__base_element/BaseHyperlink.d.ts +20 -0
- package/dist/src/__utils/cache-fetch.d.ts +1 -0
- package/dist/src/__utils/is-dark-mode.d.ts +1 -0
- package/dist/src/__utils/is-in-viewport.d.ts +1 -0
- package/dist/src/__utils/observe-slot-change.d.ts +1 -0
- package/dist/src/__utils/sanitize-svg.d.ts +1 -0
- package/dist/src/__utils/throttle.d.ts +4 -0
- package/dist/src/accordion/accordion-item.d.ts +33 -9
- package/dist/src/accordion/accordion.d.ts +21 -5
- package/dist/src/banner/banner.d.ts +47 -0
- package/dist/src/banner/index.d.ts +1 -0
- package/dist/src/button/BaseButton.d.ts +6 -13
- package/dist/src/button/button-group/button-group.d.ts +2 -2
- package/dist/src/empty-state/empty-state.d.ts +1 -1
- package/dist/src/fab/fab.d.ts +111 -0
- package/dist/src/fab/index.d.ts +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/link/link.d.ts +3 -10
- package/dist/src/menu/menu/menu.d.ts +3 -2
- package/dist/src/menu/sub-menu/sub-menu.d.ts +1 -0
- package/dist/src/notification/index.d.ts +1 -0
- package/dist/src/notification/notification.d.ts +69 -0
- package/dist/src/pagination/pagination.d.ts +8 -1
- package/dist/src/search/index.d.ts +1 -0
- package/dist/src/search/search.d.ts +76 -0
- package/dist/src/select/select.d.ts +3 -5
- package/dist/src/slider/slider.d.ts +4 -0
- package/dist/src/snackbar/snackbar.d.ts +14 -1
- package/dist/src/toolbar/index.d.ts +1 -0
- package/dist/src/toolbar/toolbar.d.ts +86 -0
- package/dist/{style-map-CRFEoCEg.js → style-map-DVmWOuYy.js} +2 -2
- package/dist/{style-map-CRFEoCEg.js.map → style-map-DVmWOuYy.js.map} +1 -1
- package/dist/test/banner.test.d.ts +1 -0
- package/dist/test/search.test.d.ts +1 -0
- package/dist/test/toolbar.test.d.ts +1 -0
- package/dist/throttle-C7ZAPqtu.js +24 -0
- package/dist/throttle-C7ZAPqtu.js.map +1 -0
- package/dist/toolbar.js +306 -0
- package/dist/toolbar.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{unsafe-html-D3GHRaGQ.js → unsafe-html-BsGUjx94.js} +2 -2
- package/dist/{unsafe-html-D3GHRaGQ.js.map → unsafe-html-BsGUjx94.js.map} +1 -1
- package/package.json +1 -1
- package/readme.md +2 -2
- package/scss/styles.scss +4 -0
- package/src/__base_element/BaseHyperlink.ts +42 -0
- package/src/__base_element/README.md +19 -0
- package/src/__utils/cache-fetch.ts +65 -0
- package/src/__utils/is-dark-mode.ts +3 -0
- package/src/__utils/is-in-viewport.ts +6 -0
- package/src/__utils/observe-slot-change.ts +38 -0
- package/src/__utils/sanitize-svg.ts +27 -0
- package/src/__utils/throttle.ts +27 -0
- package/src/accordion/accordion-item.scss +136 -65
- package/src/accordion/accordion-item.ts +117 -44
- package/src/accordion/accordion.scss +24 -5
- package/src/accordion/accordion.ts +29 -23
- package/src/accordion/demo/index.html +74 -35
- package/src/banner/banner.scss +87 -0
- package/src/banner/banner.ts +107 -0
- package/src/banner/index.ts +1 -0
- package/src/button/BaseButton.ts +14 -27
- package/src/button/button/button-colors.scss +14 -14
- package/src/button/button/button.ts +6 -5
- package/src/button/button-group/button-group.ts +3 -3
- package/src/button/icon-button/icon-button.ts +4 -11
- package/src/card/card.ts +41 -31
- package/src/chart-bar/chart-bar.ts +1 -1
- package/src/chart-bar/chart-stacked-bar.ts +3 -1
- package/src/chart-doughnut/chart-doughnut.ts +1 -1
- package/src/chart-pie/chart-pie.ts +1 -1
- package/src/checkbox/checkbox.ts +1 -1
- package/src/clock/clock.ts +1 -1
- package/src/code-editor/code-editor.ts +4 -4
- package/src/code-highlighter/code-highlighter.ts +2 -2
- package/src/date-picker/date-picker.ts +5 -2
- package/src/divider/divider.ts +3 -1
- package/src/empty-state/empty-state.scss +7 -9
- package/src/empty-state/empty-state.ts +1 -1
- package/src/fab/fab-colors.scss +49 -0
- package/src/fab/fab-sizes.scss +47 -0
- package/src/fab/fab.scss +137 -0
- package/src/fab/fab.ts +285 -0
- package/src/fab/index.ts +1 -0
- package/src/field/field.ts +3 -1
- package/src/icon/datasource.ts +1 -1
- package/src/icon/icon.ts +3 -1
- package/src/image/image.ts +3 -2
- package/src/index.ts +5 -0
- package/src/input/input.ts +5 -2
- package/src/link/link.ts +2 -15
- package/src/menu/menu/menu.scss +7 -0
- package/src/menu/menu/menu.ts +7 -4
- package/src/menu/sub-menu/sub-menu.ts +1 -0
- package/src/notification/index.ts +1 -0
- package/src/notification/notification.scss +201 -0
- package/src/notification/notification.ts +206 -0
- package/src/number-counter/number-counter.ts +3 -1
- package/src/number-field/number-field.ts +4 -2
- package/src/pagination/pagination.scss +33 -24
- package/src/pagination/pagination.ts +113 -60
- package/src/peacock-loader.ts +20 -0
- package/src/radio/radio.ts +3 -1
- package/src/search/index.ts +1 -0
- package/src/search/search-colors.scss +14 -0
- package/src/search/search.scss +204 -0
- package/src/search/search.ts +240 -0
- package/src/select/option.ts +1 -1
- package/src/select/select.scss +5 -0
- package/src/select/select.ts +71 -37
- package/src/slider/slider.scss +19 -0
- package/src/slider/slider.ts +30 -19
- package/src/snackbar/snackbar.scss +62 -31
- package/src/snackbar/snackbar.ts +92 -12
- package/src/switch/switch.ts +3 -1
- package/src/table/table.ts +3 -1
- package/src/tabs/tab.ts +6 -3
- package/src/textarea/textarea.ts +4 -2
- package/src/time-picker/time-picker.ts +4 -2
- package/src/toolbar/index.ts +1 -0
- package/src/toolbar/toolbar-colors.scss +16 -0
- package/src/toolbar/toolbar.scss +165 -0
- package/src/toolbar/toolbar.ts +137 -0
- package/dist/button-COYCtuA8.js.map +0 -1
- package/dist/button-group-DsXquZQn.js.map +0 -1
- package/dist/directive-Cuw6h7YA.js +0 -9
- package/dist/directive-Cuw6h7YA.js.map +0 -1
- package/dist/dispatch-event-utils-B4odODQf.js +0 -277
- package/dist/dispatch-event-utils-B4odODQf.js.map +0 -1
- package/dist/observe-theme-change-DKAIv5BB.js.map +0 -1
- package/dist/select-C3XAzenC.js.map +0 -1
- package/dist/src/styleMixins.css.d.ts +0 -9
- package/dist/src/utils.d.ts +0 -9
- package/src/styleMixins.css.ts +0 -55
- package/src/utils.ts +0 -193
- /package/dist/src/{spread.d.ts → __directive/spread.d.ts} +0 -0
- /package/dist/src/{utils → __utils}/copy-to-clipboard.d.ts +0 -0
- /package/dist/src/{utils → __utils}/dispatch-event-utils.d.ts +0 -0
- /package/dist/src/{utils → __utils}/observe-theme-change.d.ts +0 -0
- /package/src/{spread.ts → __directive/spread.ts} +0 -0
- /package/src/{utils → __utils}/copy-to-clipboard.ts +0 -0
- /package/src/{utils → __utils}/dispatch-event-utils.ts +0 -0
- /package/src/{utils → __utils}/observe-theme-change.ts +0 -0
|
@@ -1,26 +1,108 @@
|
|
|
1
1
|
import { a as i, _ as __decorate, i as i$1, b, A, c as __classPrivateFieldGet, w } from './IndividualComponent-DUINtMGK.js';
|
|
2
2
|
import { n } from './property-1psGvXOq.js';
|
|
3
3
|
import { r } from './state-DwbEjqVk.js';
|
|
4
|
-
import { e as e$1 } from './directive-
|
|
5
|
-
import { e as e$2, o as o$4 } from './unsafe-html-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { e as e$1 } from './directive-ZPhl09Yt.js';
|
|
5
|
+
import { e as e$2, o as o$4 } from './unsafe-html-BsGUjx94.js';
|
|
6
|
+
import { e as e$3 } from './class-map-YU7g0o3B.js';
|
|
7
|
+
import { o as observerSlotChangesWithCallback } from './observe-slot-change-BGJfgg2E.js';
|
|
8
8
|
import { a as e, e as e$4 } from './query-QBcUV-L_.js';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { d as BaseHyperlink } from './button-DMN1dPAg.js';
|
|
10
|
+
import { o as o$2 } from './style-map-DVmWOuYy.js';
|
|
11
|
+
import { r as redispatchEvent, i as isActivationClick, d as dispatchActivationClick } from './dispatch-event-utils-CuEqjlPT.js';
|
|
12
|
+
import { s as spread } from './spread-B5cgadZl.js';
|
|
13
|
+
import { B as BaseInput, i as isDarkMode, o as observeThemeChange } from './is-dark-mode-DicqGkCJ.js';
|
|
14
|
+
import { o as o$3 } from './fab-C5Nzxk0E.js';
|
|
15
|
+
import { t as throttle } from './throttle-C7ZAPqtu.js';
|
|
12
16
|
|
|
13
17
|
/**
|
|
14
18
|
* @license
|
|
15
19
|
* Copyright 2021 Google LLC
|
|
16
20
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
-
*/function o$
|
|
21
|
+
*/function o$1(o){return (e$1,n)=>{const{slot:r,selector:s}=o??{},c="slot"+(r?`[name=${r}]`:":not([name])");return e(e$1,n,{get(){const t=this.renderRoot?.querySelector(c),e=t?.assignedElements(o)??[];return void 0===s?e:e.filter(t=>t.matches(s))}})}}
|
|
18
22
|
|
|
19
23
|
/**
|
|
20
24
|
* @license
|
|
21
25
|
* Copyright 2017 Google LLC
|
|
22
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/class t extends e$2{}t.directiveName="unsafeSVG",t.resultType=2;const o
|
|
27
|
+
*/class t extends e$2{}t.directiveName="unsafeSVG",t.resultType=2;const o=e$1(t);
|
|
28
|
+
|
|
29
|
+
// Basic sanitization: remove <script>, <foreignObject>, event handler attributes (on*), and iframes
|
|
30
|
+
function sanitizeSvg(rawSvg) {
|
|
31
|
+
try {
|
|
32
|
+
const parser = new DOMParser();
|
|
33
|
+
const doc = parser.parseFromString(rawSvg, 'image/svg+xml');
|
|
34
|
+
const scripts = Array.from(doc.querySelectorAll('script'));
|
|
35
|
+
scripts.forEach(n => n.remove());
|
|
36
|
+
const foreigns = Array.from(doc.querySelectorAll('foreignObject, iframe'));
|
|
37
|
+
foreigns.forEach(n => n.remove());
|
|
38
|
+
const all = Array.from(doc.querySelectorAll('*'));
|
|
39
|
+
all.forEach(el => {
|
|
40
|
+
const attrs = Array.from(el.attributes).filter(a => /^on/i.test(a.name));
|
|
41
|
+
attrs.forEach(a => el.removeAttribute(a.name));
|
|
42
|
+
});
|
|
43
|
+
const el = doc.documentElement;
|
|
44
|
+
if (!el)
|
|
45
|
+
return '';
|
|
46
|
+
const serializer = new XMLSerializer();
|
|
47
|
+
return serializer.serializeToString(el);
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
return '';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function createCacheFetch(name) {
|
|
55
|
+
let cache = null;
|
|
56
|
+
// This map tracks requests currently being processed
|
|
57
|
+
const inFlightRequests = new Map();
|
|
58
|
+
try {
|
|
59
|
+
cache = await window.caches.open(name);
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
console.warn('window.caches access not allowed');
|
|
63
|
+
}
|
|
64
|
+
return async (url) => {
|
|
65
|
+
if (inFlightRequests.has(url)) {
|
|
66
|
+
return inFlightRequests.get(url);
|
|
67
|
+
}
|
|
68
|
+
const fetchPromise = (async () => {
|
|
69
|
+
const request = new Request(url);
|
|
70
|
+
if (cache) {
|
|
71
|
+
const cachedResponse = await cache.match(request);
|
|
72
|
+
if (cachedResponse) {
|
|
73
|
+
return cachedResponse.text();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const urlObj = new URL(request.url);
|
|
77
|
+
const isSameOrigin = urlObj.origin === window.location.origin;
|
|
78
|
+
const response = await fetch(request.url, {
|
|
79
|
+
method: 'GET',
|
|
80
|
+
mode: isSameOrigin ? 'no-cors' : 'cors',
|
|
81
|
+
credentials: isSameOrigin ? 'same-origin' : 'omit',
|
|
82
|
+
});
|
|
83
|
+
if (response.status === 404) {
|
|
84
|
+
console.error(`[Fetch Error] Resource not found (404): ${url}`);
|
|
85
|
+
return '';
|
|
86
|
+
}
|
|
87
|
+
const result = await response.text();
|
|
88
|
+
if (cache && response.status === 200) {
|
|
89
|
+
await cache.put(request, new Response(result, {
|
|
90
|
+
status: response.status,
|
|
91
|
+
statusText: response.statusText,
|
|
92
|
+
headers: response.headers,
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
return result;
|
|
96
|
+
})();
|
|
97
|
+
inFlightRequests.set(url, fetchPromise);
|
|
98
|
+
try {
|
|
99
|
+
return await fetchPromise;
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
inFlightRequests.delete(url);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
24
106
|
|
|
25
107
|
const PROVIDERS = {
|
|
26
108
|
'material-symbols': (name) => `https://cdn.jsdelivr.net/npm/@material-symbols/svg-500@0.40.1/outlined/${name}.svg`,
|
|
@@ -110,7 +192,7 @@ class Icon extends i$1 {
|
|
|
110
192
|
// accessible wrapper; consumers can provide a fallback via <slot name="fallback">.
|
|
111
193
|
return b ` <div class="icon">
|
|
112
194
|
${this.svgContent
|
|
113
|
-
? o
|
|
195
|
+
? o(this.svgContent)
|
|
114
196
|
: b `<slot name="fallback"></slot>`}
|
|
115
197
|
</div>`;
|
|
116
198
|
}
|
|
@@ -1547,81 +1629,145 @@ var css_248z$G = i`* {
|
|
|
1547
1629
|
|
|
1548
1630
|
:host {
|
|
1549
1631
|
display: block;
|
|
1550
|
-
--accordion-item-title-align: start;
|
|
1551
1632
|
}
|
|
1552
1633
|
|
|
1553
|
-
.
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1634
|
+
.expansion-panel {
|
|
1635
|
+
border: var(--_accordion-item-border, 1px solid var(--color-outline-variant));
|
|
1636
|
+
border-radius: var(--shape-corner-medium);
|
|
1637
|
+
background-color: var(--_accordion-item-background, var(--color-surface-container-low));
|
|
1638
|
+
overflow: hidden;
|
|
1639
|
+
transition: background-color var(--duration-medium1) var(--easing-standard), border-color var(--duration-medium1) var(--easing-standard);
|
|
1640
|
+
}
|
|
1641
|
+
.expansion-panel .header-button {
|
|
1642
|
+
position: relative;
|
|
1560
1643
|
display: flex;
|
|
1561
|
-
flex-direction: row-reverse;
|
|
1562
1644
|
align-items: center;
|
|
1645
|
+
width: 100%;
|
|
1646
|
+
min-height: 3rem;
|
|
1647
|
+
padding: 0 var(--spacing-300);
|
|
1648
|
+
gap: var(--spacing-200);
|
|
1649
|
+
border: none;
|
|
1650
|
+
border-radius: 0;
|
|
1651
|
+
background: transparent;
|
|
1652
|
+
cursor: pointer;
|
|
1653
|
+
text-align: start;
|
|
1563
1654
|
color: var(--color-on-surface);
|
|
1564
|
-
|
|
1565
|
-
gap: 0.5rem;
|
|
1566
|
-
font-family: var(--typography-title-medium-font-family) !important;
|
|
1567
|
-
font-size: var(--typography-title-medium-font-size) !important;
|
|
1568
|
-
font-weight: var(--typography-title-medium-font-weight) !important;
|
|
1569
|
-
line-height: var(--typography-title-medium-line-height) !important;
|
|
1570
|
-
letter-spacing: var(--typography-title-medium-letter-spacing) !important;
|
|
1655
|
+
overflow: hidden;
|
|
1571
1656
|
}
|
|
1572
|
-
.
|
|
1573
|
-
|
|
1574
|
-
|
|
1657
|
+
.expansion-panel .header-button::before {
|
|
1658
|
+
content: "";
|
|
1659
|
+
position: absolute;
|
|
1660
|
+
inset: 0;
|
|
1661
|
+
background-color: var(--color-on-surface);
|
|
1662
|
+
opacity: 0;
|
|
1663
|
+
pointer-events: none;
|
|
1664
|
+
transition: opacity var(--duration-short4) var(--easing-standard);
|
|
1575
1665
|
}
|
|
1576
|
-
.
|
|
1666
|
+
.expansion-panel .header-button:not(:disabled):hover::before {
|
|
1667
|
+
opacity: 0.08;
|
|
1668
|
+
}
|
|
1669
|
+
.expansion-panel .header-button:focus-visible {
|
|
1670
|
+
outline: none;
|
|
1577
1671
|
outline: 2px solid var(--color-black);
|
|
1578
1672
|
}
|
|
1579
|
-
.
|
|
1673
|
+
.expansion-panel .header-button:focus-visible::before {
|
|
1674
|
+
opacity: 0.12;
|
|
1675
|
+
}
|
|
1676
|
+
.expansion-panel .header-label {
|
|
1677
|
+
flex: 1;
|
|
1678
|
+
display: flex;
|
|
1679
|
+
flex-direction: column;
|
|
1680
|
+
justify-content: center;
|
|
1681
|
+
gap: 2px;
|
|
1682
|
+
padding: var(--spacing-150) 0;
|
|
1683
|
+
min-width: 0;
|
|
1684
|
+
}
|
|
1685
|
+
.expansion-panel .panel-title {
|
|
1686
|
+
font-family: var(--typography-body-large-font-family) !important;
|
|
1687
|
+
font-size: var(--typography-body-large-font-size) !important;
|
|
1688
|
+
font-weight: var(--typography-body-large-font-weight) !important;
|
|
1689
|
+
line-height: var(--typography-body-large-line-height) !important;
|
|
1690
|
+
letter-spacing: var(--typography-body-large-letter-spacing) !important;
|
|
1691
|
+
color: var(--color-on-surface);
|
|
1692
|
+
white-space: nowrap;
|
|
1693
|
+
overflow: hidden;
|
|
1694
|
+
text-overflow: ellipsis;
|
|
1695
|
+
}
|
|
1696
|
+
.expansion-panel .panel-description {
|
|
1697
|
+
font-family: var(--typography-body-small-font-family) !important;
|
|
1698
|
+
font-size: var(--typography-body-small-font-size) !important;
|
|
1699
|
+
font-weight: var(--typography-body-small-font-weight) !important;
|
|
1700
|
+
line-height: var(--typography-body-small-line-height) !important;
|
|
1701
|
+
letter-spacing: var(--typography-body-small-letter-spacing) !important;
|
|
1702
|
+
color: var(--color-on-surface-variant);
|
|
1703
|
+
white-space: nowrap;
|
|
1704
|
+
overflow: hidden;
|
|
1705
|
+
text-overflow: ellipsis;
|
|
1706
|
+
}
|
|
1707
|
+
.expansion-panel .panel-description[hidden] {
|
|
1708
|
+
display: none;
|
|
1709
|
+
}
|
|
1710
|
+
.expansion-panel ::slotted([slot=header-actions]) {
|
|
1711
|
+
display: flex;
|
|
1712
|
+
align-items: center;
|
|
1713
|
+
flex-shrink: 0;
|
|
1714
|
+
gap: var(--spacing-100);
|
|
1715
|
+
}
|
|
1716
|
+
.expansion-panel .toggle-icon {
|
|
1580
1717
|
--icon-size: 1.5rem;
|
|
1581
|
-
--icon-color:
|
|
1582
|
-
|
|
1718
|
+
--icon-color: var(--color-on-surface-variant);
|
|
1719
|
+
flex-shrink: 0;
|
|
1720
|
+
transition: transform var(--duration-medium1) var(--easing-standard);
|
|
1583
1721
|
}
|
|
1584
|
-
.
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1722
|
+
.expansion-panel .panel-content {
|
|
1723
|
+
display: grid;
|
|
1724
|
+
grid-template-rows: 0fr;
|
|
1725
|
+
transition: grid-template-rows var(--duration-medium1) var(--easing-standard);
|
|
1726
|
+
}
|
|
1727
|
+
.expansion-panel .content-inner {
|
|
1728
|
+
overflow: hidden;
|
|
1729
|
+
min-height: 0;
|
|
1730
|
+
font-family: var(--typography-body-medium-font-family) !important;
|
|
1731
|
+
font-size: var(--typography-body-medium-font-size) !important;
|
|
1732
|
+
font-weight: var(--typography-body-medium-font-weight) !important;
|
|
1733
|
+
line-height: var(--typography-body-medium-line-height) !important;
|
|
1734
|
+
letter-spacing: var(--typography-body-medium-letter-spacing) !important;
|
|
1735
|
+
color: var(--color-on-surface-variant);
|
|
1590
1736
|
}
|
|
1591
|
-
.
|
|
1592
|
-
|
|
1737
|
+
.expansion-panel.disabled {
|
|
1738
|
+
background-color: color-mix(in srgb, var(--color-surface-container-low) 38%, transparent);
|
|
1739
|
+
border-color: color-mix(in srgb, var(--color-outline-variant) 38%, transparent);
|
|
1593
1740
|
}
|
|
1594
|
-
.
|
|
1741
|
+
.expansion-panel.disabled .header-button {
|
|
1595
1742
|
cursor: not-allowed;
|
|
1743
|
+
pointer-events: none;
|
|
1596
1744
|
opacity: 0.38;
|
|
1597
1745
|
}
|
|
1598
|
-
.
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
opacity: 1;
|
|
1602
|
-
padding: var(--spacing-100) var(--spacing-800) var(--spacing-300) var(--spacing-200);
|
|
1746
|
+
.expansion-panel.open {
|
|
1747
|
+
background-color: var(--color-surface-container);
|
|
1748
|
+
border-color: transparent;
|
|
1603
1749
|
}
|
|
1604
|
-
.
|
|
1605
|
-
|
|
1750
|
+
.expansion-panel.open .panel-content {
|
|
1751
|
+
grid-template-rows: 1fr;
|
|
1752
|
+
border-block-start: 1px solid var(--color-outline-variant);
|
|
1606
1753
|
}
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
* Sizes
|
|
1610
|
-
*/
|
|
1611
|
-
.accordion-item .accordion-heading {
|
|
1612
|
-
height: 2.5rem;
|
|
1754
|
+
.expansion-panel.open .content-inner {
|
|
1755
|
+
padding: 0 var(--spacing-300) var(--spacing-200);
|
|
1613
1756
|
}
|
|
1614
|
-
|
|
1615
|
-
:
|
|
1616
|
-
height: 2rem;
|
|
1757
|
+
.expansion-panel.open .toggle-icon {
|
|
1758
|
+
transform: rotate(180deg);
|
|
1617
1759
|
}
|
|
1618
|
-
|
|
1619
|
-
:
|
|
1620
|
-
|
|
1760
|
+
.expansion-panel.disabled {
|
|
1761
|
+
background-color: color-mix(in srgb, var(--color-surface-container-low) 38%, transparent);
|
|
1762
|
+
border-color: color-mix(in srgb, var(--color-outline-variant) 38%, transparent);
|
|
1621
1763
|
}
|
|
1622
1764
|
|
|
1623
|
-
:host
|
|
1624
|
-
flex-direction: row;
|
|
1765
|
+
:host([toggle-position=before]) .header-button {
|
|
1766
|
+
flex-direction: row-reverse;
|
|
1767
|
+
justify-content: flex-end;
|
|
1768
|
+
}
|
|
1769
|
+
:host([toggle-position=before]) .header-label {
|
|
1770
|
+
flex: 1;
|
|
1625
1771
|
}`;
|
|
1626
1772
|
|
|
1627
1773
|
var _AccordionItem_id;
|
|
@@ -1629,13 +1775,27 @@ var _AccordionItem_id;
|
|
|
1629
1775
|
* @label Accordion Item
|
|
1630
1776
|
* @tag wc-accordion-item
|
|
1631
1777
|
* @rawTag accordion-item
|
|
1632
|
-
* @summary An
|
|
1778
|
+
* @summary An expansion panel with a header that reveals or hides associated content. Follows Material Design 3 expansion panel guidelines.
|
|
1633
1779
|
* @parentRawTag accordion
|
|
1634
1780
|
*
|
|
1781
|
+
* @slot - The body content revealed when the panel is expanded.
|
|
1782
|
+
* @slot heading - The panel title. Renders as `body-large` text.
|
|
1783
|
+
* @slot description - Optional subtitle rendered below the title. Renders as `body-small` text.
|
|
1784
|
+
* @slot header-actions - Actions (e.g. icon buttons) placed at the trailing end of the header, before the toggle icon.
|
|
1785
|
+
*
|
|
1786
|
+
* @part header - The header `<button>` element.
|
|
1787
|
+
* @part title - The title text container.
|
|
1788
|
+
* @part description - The description text container.
|
|
1789
|
+
* @part content - The expandable content region wrapper.
|
|
1790
|
+
*
|
|
1791
|
+
* @fires {CustomEvent<{ open: boolean }>} accordion-item:toggle - Fired when the panel is expanded or collapsed.
|
|
1792
|
+
*
|
|
1635
1793
|
* @example
|
|
1636
1794
|
* ```html
|
|
1637
1795
|
* <wc-accordion-item>
|
|
1638
|
-
*
|
|
1796
|
+
* <span slot="heading">Personal information</span>
|
|
1797
|
+
* <span slot="description">Fill in your details</span>
|
|
1798
|
+
* <p>Content goes here.</p>
|
|
1639
1799
|
* </wc-accordion-item>
|
|
1640
1800
|
* ```
|
|
1641
1801
|
* @tags display
|
|
@@ -1645,17 +1805,25 @@ class AccordionItem extends i$1 {
|
|
|
1645
1805
|
super(...arguments);
|
|
1646
1806
|
_AccordionItem_id.set(this, crypto.randomUUID());
|
|
1647
1807
|
/**
|
|
1648
|
-
*
|
|
1649
|
-
*/
|
|
1650
|
-
this.heading = '';
|
|
1651
|
-
/**
|
|
1652
|
-
* If true, the user cannot interact with the button. Defaults to `false`.
|
|
1808
|
+
* Whether the user cannot interact with the panel.
|
|
1653
1809
|
*/
|
|
1654
1810
|
this.disabled = false;
|
|
1655
1811
|
/**
|
|
1656
|
-
*
|
|
1812
|
+
* Whether the panel is expanded.
|
|
1657
1813
|
*/
|
|
1658
1814
|
this.open = false;
|
|
1815
|
+
/**
|
|
1816
|
+
* Whether to hide the expand/collapse toggle indicator icon.
|
|
1817
|
+
*/
|
|
1818
|
+
this.hideToggle = false;
|
|
1819
|
+
/**
|
|
1820
|
+
* Position of the toggle icon relative to the panel title.
|
|
1821
|
+
* `'after'` places it at the trailing end (default, matches M3).
|
|
1822
|
+
* `'before'` places it at the leading start.
|
|
1823
|
+
*/
|
|
1824
|
+
this.togglePosition = 'after';
|
|
1825
|
+
this._hasDescriptionSlot = false;
|
|
1826
|
+
this._hasHeadingSlot = false;
|
|
1659
1827
|
}
|
|
1660
1828
|
focus() {
|
|
1661
1829
|
this.buttonElement?.focus();
|
|
@@ -1663,54 +1831,91 @@ class AccordionItem extends i$1 {
|
|
|
1663
1831
|
blur() {
|
|
1664
1832
|
this.buttonElement?.blur();
|
|
1665
1833
|
}
|
|
1666
|
-
|
|
1834
|
+
_handleToggle() {
|
|
1667
1835
|
if (this.disabled)
|
|
1668
1836
|
return;
|
|
1669
1837
|
this.open = !this.open;
|
|
1670
|
-
this.dispatchEvent(new CustomEvent('accordion-item
|
|
1838
|
+
this.dispatchEvent(new CustomEvent('accordion-item:toggle', {
|
|
1671
1839
|
bubbles: true,
|
|
1672
1840
|
composed: true,
|
|
1673
|
-
detail: { open: this.open
|
|
1841
|
+
detail: { open: this.open },
|
|
1674
1842
|
}));
|
|
1675
1843
|
}
|
|
1844
|
+
static _onSlotChange(e, setter) {
|
|
1845
|
+
const slot = e.target;
|
|
1846
|
+
const nodes = slot.assignedNodes({ flatten: true });
|
|
1847
|
+
setter(nodes.some(n => n.nodeType === Node.TEXT_NODE
|
|
1848
|
+
? (n.textContent?.trim() ?? '') !== ''
|
|
1849
|
+
: true));
|
|
1850
|
+
}
|
|
1851
|
+
_renderToggleIcon() {
|
|
1852
|
+
if (this.hideToggle)
|
|
1853
|
+
return A;
|
|
1854
|
+
return b `<wc-icon
|
|
1855
|
+
class="toggle-icon"
|
|
1856
|
+
name="keyboard_arrow_down"
|
|
1857
|
+
aria-hidden="true"
|
|
1858
|
+
></wc-icon>`;
|
|
1859
|
+
}
|
|
1676
1860
|
render() {
|
|
1677
|
-
return b
|
|
1678
|
-
|
|
1679
|
-
|
|
1861
|
+
return b `
|
|
1862
|
+
<div
|
|
1863
|
+
class=${e$3({
|
|
1864
|
+
'expansion-panel': true,
|
|
1680
1865
|
open: this.open,
|
|
1681
1866
|
disabled: this.disabled,
|
|
1682
1867
|
})}
|
|
1683
|
-
>
|
|
1684
|
-
<button
|
|
1685
|
-
id=${`accordion-heading-${__classPrivateFieldGet(this, _AccordionItem_id, "f")}`}
|
|
1686
|
-
tabindex="0"
|
|
1687
|
-
aria-controls=${`accordion-control-${__classPrivateFieldGet(this, _AccordionItem_id, "f")}`}
|
|
1688
|
-
class="accordion-heading"
|
|
1689
|
-
aria-disabled=${this.disabled}
|
|
1690
|
-
@click=${this.__handleToggle}
|
|
1691
|
-
aria-expanded=${this.open}
|
|
1692
1868
|
>
|
|
1693
|
-
<
|
|
1694
|
-
|
|
1695
|
-
|
|
1869
|
+
<button
|
|
1870
|
+
id=${`panel-header-${__classPrivateFieldGet(this, _AccordionItem_id, "f")}`}
|
|
1871
|
+
part="header"
|
|
1872
|
+
class="header-button"
|
|
1873
|
+
tabindex=${this.disabled ? '-1' : '0'}
|
|
1874
|
+
aria-controls=${`panel-content-${__classPrivateFieldGet(this, _AccordionItem_id, "f")}`}
|
|
1875
|
+
aria-disabled=${this.disabled}
|
|
1876
|
+
aria-expanded=${this.open}
|
|
1877
|
+
?disabled=${this.disabled}
|
|
1878
|
+
@click=${this._handleToggle}
|
|
1879
|
+
>
|
|
1880
|
+
${this.togglePosition === 'before' ? this._renderToggleIcon() : A}
|
|
1881
|
+
<span class="header-label">
|
|
1882
|
+
<span part="title" class="panel-title">
|
|
1883
|
+
<slot
|
|
1884
|
+
name="heading"
|
|
1885
|
+
@slotchange=${(e) => AccordionItem._onSlotChange(e, v => { this._hasHeadingSlot = v; })}
|
|
1886
|
+
></slot>
|
|
1887
|
+
</span>
|
|
1888
|
+
<span
|
|
1889
|
+
part="description"
|
|
1890
|
+
class="panel-description"
|
|
1891
|
+
?hidden=${!this._hasDescriptionSlot}
|
|
1892
|
+
>
|
|
1893
|
+
<slot
|
|
1894
|
+
name="description"
|
|
1895
|
+
@slotchange=${(e) => AccordionItem._onSlotChange(e, v => { this._hasDescriptionSlot = v; })}
|
|
1896
|
+
></slot>
|
|
1897
|
+
</span>
|
|
1898
|
+
</span>
|
|
1899
|
+
<slot name="header-actions" class="header-actions"></slot>
|
|
1900
|
+
${this.togglePosition === 'after' ? this._renderToggleIcon() : A}
|
|
1901
|
+
</button>
|
|
1902
|
+
<div
|
|
1903
|
+
id=${`panel-content-${__classPrivateFieldGet(this, _AccordionItem_id, "f")}`}
|
|
1904
|
+
part="content"
|
|
1905
|
+
class="panel-content"
|
|
1906
|
+
role="region"
|
|
1907
|
+
aria-labelledby=${`panel-header-${__classPrivateFieldGet(this, _AccordionItem_id, "f")}`}
|
|
1908
|
+
>
|
|
1909
|
+
<div class="content-inner">
|
|
1910
|
+
<slot></slot>
|
|
1911
|
+
</div>
|
|
1696
1912
|
</div>
|
|
1697
|
-
</button>
|
|
1698
|
-
<div
|
|
1699
|
-
class="item-section slot-main"
|
|
1700
|
-
id=${`accordion-control-${__classPrivateFieldGet(this, _AccordionItem_id, "f")}`}
|
|
1701
|
-
aria-labelledby=${`accordion-heading-${__classPrivateFieldGet(this, _AccordionItem_id, "f")}`}
|
|
1702
|
-
role="region"
|
|
1703
|
-
>
|
|
1704
|
-
<slot></slot>
|
|
1705
1913
|
</div>
|
|
1706
|
-
|
|
1914
|
+
`;
|
|
1707
1915
|
}
|
|
1708
1916
|
}
|
|
1709
1917
|
_AccordionItem_id = new WeakMap();
|
|
1710
1918
|
AccordionItem.styles = [css_248z$G];
|
|
1711
|
-
__decorate([
|
|
1712
|
-
n({ type: String, reflect: true })
|
|
1713
|
-
], AccordionItem.prototype, "heading", void 0);
|
|
1714
1919
|
__decorate([
|
|
1715
1920
|
n({ type: Boolean, reflect: true })
|
|
1716
1921
|
], AccordionItem.prototype, "disabled", void 0);
|
|
@@ -1718,7 +1923,19 @@ __decorate([
|
|
|
1718
1923
|
n({ type: Boolean, reflect: true })
|
|
1719
1924
|
], AccordionItem.prototype, "open", void 0);
|
|
1720
1925
|
__decorate([
|
|
1721
|
-
|
|
1926
|
+
n({ type: Boolean, reflect: true, attribute: 'hide-toggle' })
|
|
1927
|
+
], AccordionItem.prototype, "hideToggle", void 0);
|
|
1928
|
+
__decorate([
|
|
1929
|
+
n({ type: String, reflect: true, attribute: 'toggle-position' })
|
|
1930
|
+
], AccordionItem.prototype, "togglePosition", void 0);
|
|
1931
|
+
__decorate([
|
|
1932
|
+
r()
|
|
1933
|
+
], AccordionItem.prototype, "_hasDescriptionSlot", void 0);
|
|
1934
|
+
__decorate([
|
|
1935
|
+
r()
|
|
1936
|
+
], AccordionItem.prototype, "_hasHeadingSlot", void 0);
|
|
1937
|
+
__decorate([
|
|
1938
|
+
e$4('.header-button')
|
|
1722
1939
|
], AccordionItem.prototype, "buttonElement", void 0);
|
|
1723
1940
|
|
|
1724
1941
|
var css_248z$F = i`* {
|
|
@@ -1733,27 +1950,38 @@ var css_248z$F = i`* {
|
|
|
1733
1950
|
display: block;
|
|
1734
1951
|
}
|
|
1735
1952
|
|
|
1736
|
-
|
|
1737
|
-
|
|
1953
|
+
.accordion {
|
|
1954
|
+
display: flex;
|
|
1955
|
+
flex-direction: column;
|
|
1956
|
+
gap: var(--spacing-100);
|
|
1738
1957
|
}
|
|
1739
1958
|
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1959
|
+
:host([display-mode=flat]) .accordion {
|
|
1960
|
+
gap: 0;
|
|
1961
|
+
}
|
|
1962
|
+
:host([display-mode=flat]) slot::slotted(wc-accordion-item) {
|
|
1963
|
+
--_accordion-item-border: none;
|
|
1964
|
+
--_accordion-item-background: transparent;
|
|
1743
1965
|
}`;
|
|
1744
1966
|
|
|
1745
1967
|
/**
|
|
1746
1968
|
* @label Accordion
|
|
1747
1969
|
* @tag wc-accordion
|
|
1748
1970
|
* @rawTag accordion
|
|
1749
|
-
* @summary
|
|
1971
|
+
* @summary A vertically stacked set of expansion panels. Follows Material Design 3 expansion panel guidelines.
|
|
1750
1972
|
*
|
|
1751
1973
|
* @example
|
|
1752
1974
|
* ```html
|
|
1753
1975
|
* <wc-accordion>
|
|
1754
|
-
*
|
|
1755
|
-
*
|
|
1756
|
-
* </
|
|
1976
|
+
* <wc-accordion-item>
|
|
1977
|
+
* <span slot="heading">Panel 1</span>
|
|
1978
|
+
* <span slot="description">Summary text</span>
|
|
1979
|
+
* Content
|
|
1980
|
+
* </wc-accordion-item>
|
|
1981
|
+
* <wc-accordion-item>
|
|
1982
|
+
* <span slot="heading">Panel 2</span>
|
|
1983
|
+
* Content
|
|
1984
|
+
* </wc-accordion-item>
|
|
1757
1985
|
* </wc-accordion>
|
|
1758
1986
|
* ```
|
|
1759
1987
|
* @tags display
|
|
@@ -1761,7 +1989,17 @@ slot::slotted(:last-child) {
|
|
|
1761
1989
|
class Accordion extends i$1 {
|
|
1762
1990
|
constructor() {
|
|
1763
1991
|
super(...arguments);
|
|
1764
|
-
|
|
1992
|
+
/**
|
|
1993
|
+
* Whether multiple panels can be expanded simultaneously.
|
|
1994
|
+
* When `false` (default), expanding one panel collapses all others.
|
|
1995
|
+
*/
|
|
1996
|
+
this.multi = false;
|
|
1997
|
+
/**
|
|
1998
|
+
* Display mode for the accordion.
|
|
1999
|
+
* `'default'` renders panels with a subtle background on expand and dividers between items.
|
|
2000
|
+
* `'flat'` renders panels without borders or background changes — suitable for use inside cards.
|
|
2001
|
+
*/
|
|
2002
|
+
this.displayMode = 'default';
|
|
1765
2003
|
}
|
|
1766
2004
|
connectedCallback() {
|
|
1767
2005
|
super.connectedCallback();
|
|
@@ -1773,17 +2011,15 @@ class Accordion extends i$1 {
|
|
|
1773
2011
|
disconnectedCallback() {
|
|
1774
2012
|
super.disconnectedCallback();
|
|
1775
2013
|
// @ts-ignore
|
|
1776
|
-
// eslint-disable-next-line no-undef
|
|
1777
2014
|
this.removeEventListener('accordion-item:toggle', this._onItemToggle);
|
|
1778
2015
|
this.removeEventListener('keydown', this._onKeyDown);
|
|
1779
2016
|
}
|
|
1780
2017
|
_onItemToggle(e) {
|
|
1781
2018
|
const targetItem = e.target;
|
|
1782
|
-
//
|
|
1783
|
-
// We check if the target item is a direct child of *this* accordion
|
|
2019
|
+
// Ignore events from nested accordions — only handle direct children
|
|
1784
2020
|
if (targetItem.parentElement !== this)
|
|
1785
2021
|
return;
|
|
1786
|
-
if (!this.
|
|
2022
|
+
if (!this.multi && targetItem.open) {
|
|
1787
2023
|
this.items.forEach(item => {
|
|
1788
2024
|
if (item !== targetItem && item.open) {
|
|
1789
2025
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -1793,16 +2029,10 @@ class Accordion extends i$1 {
|
|
|
1793
2029
|
}
|
|
1794
2030
|
}
|
|
1795
2031
|
_onKeyDown(e) {
|
|
1796
|
-
// 1. Find which item currently has its HEADER focused.
|
|
1797
|
-
// We check the shadowRoot of each item to see if the internal <button> is the active element.
|
|
1798
2032
|
const focusedItemIndex = this.items.findIndex(item => {
|
|
1799
|
-
// Access the Shadow DOM of the item
|
|
1800
2033
|
const root = item.shadowRoot;
|
|
1801
|
-
|
|
1802
|
-
return root?.activeElement?.classList.contains('accordion-heading');
|
|
2034
|
+
return root?.activeElement?.classList.contains('header-button');
|
|
1803
2035
|
});
|
|
1804
|
-
// 2. If no header is focused (e.g., focus is on body content or outside), do nothing.
|
|
1805
|
-
// This prevents stealing focus when the user is typing in a form inside the accordion.
|
|
1806
2036
|
if (focusedItemIndex === -1)
|
|
1807
2037
|
return;
|
|
1808
2038
|
let nextIndex = -1;
|
|
@@ -1810,12 +2040,10 @@ class Accordion extends i$1 {
|
|
|
1810
2040
|
switch (e.key) {
|
|
1811
2041
|
case 'ArrowDown':
|
|
1812
2042
|
e.preventDefault();
|
|
1813
|
-
// Cycle next
|
|
1814
2043
|
nextIndex = (focusedItemIndex + 1) % this.items.length;
|
|
1815
2044
|
break;
|
|
1816
2045
|
case 'ArrowUp':
|
|
1817
2046
|
e.preventDefault();
|
|
1818
|
-
// Cycle previous
|
|
1819
2047
|
nextIndex =
|
|
1820
2048
|
(focusedItemIndex - 1 + this.items.length) % this.items.length;
|
|
1821
2049
|
break;
|
|
@@ -1828,11 +2056,9 @@ class Accordion extends i$1 {
|
|
|
1828
2056
|
nextIndex = this.items.length - 1;
|
|
1829
2057
|
break;
|
|
1830
2058
|
}
|
|
1831
|
-
// 3. Apply Focus
|
|
1832
2059
|
if (nextIndex !== -1) {
|
|
1833
2060
|
const itemToFocus = this.items[nextIndex];
|
|
1834
|
-
|
|
1835
|
-
const button = itemToFocus.shadowRoot?.querySelector('.accordion-heading');
|
|
2061
|
+
const button = itemToFocus.shadowRoot?.querySelector('.header-button');
|
|
1836
2062
|
button?.focus();
|
|
1837
2063
|
}
|
|
1838
2064
|
}
|
|
@@ -1843,10 +2069,13 @@ class Accordion extends i$1 {
|
|
|
1843
2069
|
Accordion.styles = [css_248z$F];
|
|
1844
2070
|
Accordion.Item = AccordionItem;
|
|
1845
2071
|
__decorate([
|
|
1846
|
-
n({ type: Boolean,
|
|
1847
|
-
], Accordion.prototype, "
|
|
2072
|
+
n({ type: Boolean, reflect: true })
|
|
2073
|
+
], Accordion.prototype, "multi", void 0);
|
|
2074
|
+
__decorate([
|
|
2075
|
+
n({ type: String, reflect: true, attribute: 'display-mode' })
|
|
2076
|
+
], Accordion.prototype, "displayMode", void 0);
|
|
1848
2077
|
__decorate([
|
|
1849
|
-
o$
|
|
2078
|
+
o$1({ selector: 'wc-accordion-item' })
|
|
1850
2079
|
], Accordion.prototype, "items", void 0);
|
|
1851
2080
|
|
|
1852
2081
|
var css_248z$E = i`* {
|
|
@@ -1899,14 +2128,7 @@ var css_248z$E = i`* {
|
|
|
1899
2128
|
* <wc-link href="#">Link</wc-link>
|
|
1900
2129
|
* ```
|
|
1901
2130
|
*/
|
|
1902
|
-
class Link extends i$1 {
|
|
1903
|
-
constructor() {
|
|
1904
|
-
super(...arguments);
|
|
1905
|
-
/**
|
|
1906
|
-
* Sets or retrieves the window or frame at which to target content.
|
|
1907
|
-
*/
|
|
1908
|
-
this.target = '_self';
|
|
1909
|
-
}
|
|
2131
|
+
class Link extends BaseHyperlink(i$1) {
|
|
1910
2132
|
render() {
|
|
1911
2133
|
return b `<a
|
|
1912
2134
|
class=${e$3({
|
|
@@ -1921,15 +2143,6 @@ class Link extends i$1 {
|
|
|
1921
2143
|
}
|
|
1922
2144
|
}
|
|
1923
2145
|
Link.styles = [css_248z$E];
|
|
1924
|
-
__decorate([
|
|
1925
|
-
n({ reflect: true })
|
|
1926
|
-
], Link.prototype, "href", void 0);
|
|
1927
|
-
__decorate([
|
|
1928
|
-
n()
|
|
1929
|
-
], Link.prototype, "target", void 0);
|
|
1930
|
-
__decorate([
|
|
1931
|
-
r()
|
|
1932
|
-
], Link.prototype, "tabIndexValue", void 0);
|
|
1933
2146
|
|
|
1934
2147
|
var css_248z$D = i`* {
|
|
1935
2148
|
box-sizing: border-box;
|
|
@@ -2733,7 +2946,7 @@ class LinearProgress extends BaseProgress {
|
|
|
2733
2946
|
<div class="track track-start"></div>
|
|
2734
2947
|
<div
|
|
2735
2948
|
class="active-indicator"
|
|
2736
|
-
style="${o$
|
|
2949
|
+
style="${o$2({
|
|
2737
2950
|
width: `${this.__getPercentageValue()}%`,
|
|
2738
2951
|
})}"
|
|
2739
2952
|
></div>
|
|
@@ -2893,7 +3106,7 @@ class CircularProgress extends BaseProgress {
|
|
|
2893
3106
|
cx="8"
|
|
2894
3107
|
cy="8"
|
|
2895
3108
|
r="6"
|
|
2896
|
-
style="${o$
|
|
3109
|
+
style="${o$2({
|
|
2897
3110
|
strokeDasharray: `${circumference}`,
|
|
2898
3111
|
strokeDashoffset: this.indeterminate ? undefined : `${offset}`,
|
|
2899
3112
|
})}"
|
|
@@ -5760,12 +5973,12 @@ var css_248z$k = i`* {
|
|
|
5760
5973
|
flex-direction: column;
|
|
5761
5974
|
justify-content: center;
|
|
5762
5975
|
}
|
|
5763
|
-
.content .
|
|
5764
|
-
font-family: var(--typography-headline-medium-
|
|
5765
|
-
font-size: var(--typography-headline-medium-
|
|
5766
|
-
font-weight: var(--typography-headline-medium-
|
|
5767
|
-
line-height: var(--typography-headline-medium-
|
|
5768
|
-
letter-spacing: var(--typography-headline-medium-
|
|
5976
|
+
.content .headline {
|
|
5977
|
+
font-family: var(--typography-headline-medium-font-family) !important;
|
|
5978
|
+
font-size: var(--typography-headline-medium-font-size) !important;
|
|
5979
|
+
font-weight: var(--typography-headline-medium-font-weight) !important;
|
|
5980
|
+
line-height: var(--typography-headline-medium-line-height) !important;
|
|
5981
|
+
letter-spacing: var(--typography-headline-medium-letter-spacing) !important;
|
|
5769
5982
|
margin-bottom: var(--spacing-200);
|
|
5770
5983
|
color: var(--color-on-surface);
|
|
5771
5984
|
}
|
|
@@ -5790,30 +6003,23 @@ var css_248z$k = i`* {
|
|
|
5790
6003
|
.empty-state .content {
|
|
5791
6004
|
width: 50%;
|
|
5792
6005
|
}
|
|
5793
|
-
.empty-state .headline {
|
|
5794
|
-
font-family: var(--typography-title-medium-font-family) !important;
|
|
5795
|
-
font-size: var(--typography-title-medium-font-size) !important;
|
|
5796
|
-
font-weight: var(--typography-title-medium-font-weight) !important;
|
|
5797
|
-
line-height: var(--typography-title-medium-line-height) !important;
|
|
5798
|
-
letter-spacing: var(--typography-title-medium-letter-spacing) !important;
|
|
5799
|
-
}
|
|
5800
6006
|
}
|
|
5801
6007
|
@container emptystate (max-width: 671px) {
|
|
5802
6008
|
.empty-state .empty-state-container {
|
|
5803
6009
|
flex-direction: column;
|
|
5804
|
-
gap: var(--spacing-
|
|
6010
|
+
gap: var(--spacing-150);
|
|
5805
6011
|
}
|
|
5806
6012
|
.empty-state .empty-state-container .illustration {
|
|
5807
6013
|
height: auto;
|
|
5808
6014
|
width: 100%;
|
|
5809
6015
|
justify-content: center;
|
|
5810
6016
|
}
|
|
5811
|
-
.empty-state .headline {
|
|
5812
|
-
font-family: var(--typography-
|
|
5813
|
-
font-size: var(--typography-
|
|
5814
|
-
font-weight: var(--typography-
|
|
5815
|
-
line-height: var(--typography-
|
|
5816
|
-
letter-spacing: var(--typography-
|
|
6017
|
+
.empty-state .content .headline {
|
|
6018
|
+
font-family: var(--typography-headline-small-font-family) !important;
|
|
6019
|
+
font-size: var(--typography-headline-small-font-size) !important;
|
|
6020
|
+
font-weight: var(--typography-headline-small-font-weight) !important;
|
|
6021
|
+
line-height: var(--typography-headline-small-line-height) !important;
|
|
6022
|
+
letter-spacing: var(--typography-headline-small-letter-spacing) !important;
|
|
5817
6023
|
}
|
|
5818
6024
|
}`;
|
|
5819
6025
|
|
|
@@ -5826,7 +6032,7 @@ var css_248z$k = i`* {
|
|
|
5826
6032
|
*
|
|
5827
6033
|
* @example
|
|
5828
6034
|
* ```html
|
|
5829
|
-
* <wc-empty-state
|
|
6035
|
+
* <wc-empty-state style="width:100%" headline="No items found"></wc-empty-state>
|
|
5830
6036
|
* ```
|
|
5831
6037
|
*/
|
|
5832
6038
|
class EmptyState extends i$1 {
|
|
@@ -7789,12 +7995,6 @@ ol {
|
|
|
7789
7995
|
pointer-events: none;
|
|
7790
7996
|
}`;
|
|
7791
7997
|
|
|
7792
|
-
/**
|
|
7793
|
-
* @license
|
|
7794
|
-
* Copyright 2018 Google LLC
|
|
7795
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
7796
|
-
*/const o=o=>o??A;
|
|
7797
|
-
|
|
7798
7998
|
var css_248z$h = i`* {
|
|
7799
7999
|
box-sizing: border-box;
|
|
7800
8000
|
}
|
|
@@ -7904,8 +8104,8 @@ class BreadcrumbItem extends i$1 {
|
|
|
7904
8104
|
<a
|
|
7905
8105
|
class="breadcrumb-link"
|
|
7906
8106
|
itemprop="item"
|
|
7907
|
-
href=${o(this.href)}
|
|
7908
|
-
target=${o(this.target)}
|
|
8107
|
+
href=${o$3(this.href)}
|
|
8108
|
+
target=${o$3(this.target)}
|
|
7909
8109
|
${this.target === '_blank'
|
|
7910
8110
|
? b `rel="noopener noreferrer"`
|
|
7911
8111
|
: A}
|
|
@@ -7997,6 +8197,8 @@ var css_248z$g = i`* {
|
|
|
7997
8197
|
display: flex;
|
|
7998
8198
|
position: fixed;
|
|
7999
8199
|
z-index: var(--menu-z-index, 1000);
|
|
8200
|
+
width: var(--menu-width, max-content);
|
|
8201
|
+
max-width: 100vw;
|
|
8000
8202
|
min-width: 112px;
|
|
8001
8203
|
padding-block: var(--spacing-050);
|
|
8002
8204
|
transform-origin: top center;
|
|
@@ -8024,6 +8226,10 @@ var css_248z$g = i`* {
|
|
|
8024
8226
|
transition-delay: 0ms, 0ms, 0ms;
|
|
8025
8227
|
transition-timing-function: var(--_menu-enter-easing), var(--_menu-enter-easing), linear;
|
|
8026
8228
|
}
|
|
8229
|
+
.menu.preview {
|
|
8230
|
+
position: relative;
|
|
8231
|
+
pointer-events: auto;
|
|
8232
|
+
}
|
|
8027
8233
|
.menu .menu-content {
|
|
8028
8234
|
display: flex;
|
|
8029
8235
|
flex-direction: column;
|
|
@@ -8432,9 +8638,9 @@ class MenuSurfaceController {
|
|
|
8432
8638
|
*
|
|
8433
8639
|
* @example
|
|
8434
8640
|
* ```html
|
|
8435
|
-
* <wc-menu>
|
|
8641
|
+
* <wc-menu preview>
|
|
8436
8642
|
* <wc-menu-item>Item 1</wc-menu-item>
|
|
8437
|
-
* <wc-menu-item>Item 2</wc-menu-item>
|
|
8643
|
+
* <wc-menu-item selected>Item 2</wc-menu-item>
|
|
8438
8644
|
* </wc-menu>
|
|
8439
8645
|
* ```
|
|
8440
8646
|
*/
|
|
@@ -8444,6 +8650,7 @@ class Menu extends i$1 {
|
|
|
8444
8650
|
this.open = false;
|
|
8445
8651
|
this.variant = 'standard';
|
|
8446
8652
|
this.anchor = '';
|
|
8653
|
+
this.preview = false;
|
|
8447
8654
|
this.stayOpenOnOutsideClick = false;
|
|
8448
8655
|
this.stayOpenOnFocusout = false;
|
|
8449
8656
|
this.isSubmenu = false;
|
|
@@ -8760,8 +8967,9 @@ class Menu extends i$1 {
|
|
|
8760
8967
|
return b `<div
|
|
8761
8968
|
class=${e$3({
|
|
8762
8969
|
'menu': true,
|
|
8763
|
-
open: this.open,
|
|
8764
|
-
closed: !this.open,
|
|
8970
|
+
open: !this.preview && this.open,
|
|
8971
|
+
closed: !this.preview && !this.open,
|
|
8972
|
+
preview: this.preview,
|
|
8765
8973
|
[`variant-${this.variant}`]: true,
|
|
8766
8974
|
})}
|
|
8767
8975
|
aria-hidden=${String(!this.open)}
|
|
@@ -8786,6 +8994,9 @@ __decorate([
|
|
|
8786
8994
|
__decorate([
|
|
8787
8995
|
n({ type: String })
|
|
8788
8996
|
], Menu.prototype, "anchor", void 0);
|
|
8997
|
+
__decorate([
|
|
8998
|
+
n({ type: Boolean, reflect: true })
|
|
8999
|
+
], Menu.prototype, "preview", void 0);
|
|
8789
9000
|
__decorate([
|
|
8790
9001
|
n({ type: Boolean, attribute: 'stay-open-on-outside-click' })
|
|
8791
9002
|
], Menu.prototype, "stayOpenOnOutsideClick", void 0);
|
|
@@ -8825,6 +9036,7 @@ let subMenuIdCounter = 0;
|
|
|
8825
9036
|
* @label Sub Menu
|
|
8826
9037
|
* @tag wc-sub-menu
|
|
8827
9038
|
* @rawTag sub-menu
|
|
9039
|
+
* @parentRawTag menu
|
|
8828
9040
|
* @summary Connects a menu item to a nested menu.
|
|
8829
9041
|
*/
|
|
8830
9042
|
class SubMenu extends i$1 {
|
|
@@ -9016,10 +9228,10 @@ __decorate([
|
|
|
9016
9228
|
n({ type: String, attribute: 'menu-corner' })
|
|
9017
9229
|
], SubMenu.prototype, "menuCorner", void 0);
|
|
9018
9230
|
__decorate([
|
|
9019
|
-
o$
|
|
9231
|
+
o$1({ slot: 'item' })
|
|
9020
9232
|
], SubMenu.prototype, "_items", void 0);
|
|
9021
9233
|
__decorate([
|
|
9022
|
-
o$
|
|
9234
|
+
o$1({ slot: 'menu' })
|
|
9023
9235
|
], SubMenu.prototype, "_menus", void 0);
|
|
9024
9236
|
|
|
9025
9237
|
var css_248z$c = i`@charset "UTF-8";
|
|
@@ -10320,6 +10532,17 @@ var css_248z$7 = i`:host {
|
|
|
10320
10532
|
touch-action: none;
|
|
10321
10533
|
}
|
|
10322
10534
|
|
|
10535
|
+
.slider {
|
|
10536
|
+
display: flex;
|
|
10537
|
+
align-items: center;
|
|
10538
|
+
gap: var(--spacing-100, 0.5rem);
|
|
10539
|
+
width: 100%;
|
|
10540
|
+
}
|
|
10541
|
+
|
|
10542
|
+
.slider.with-value .slider-container {
|
|
10543
|
+
flex: 1;
|
|
10544
|
+
}
|
|
10545
|
+
|
|
10323
10546
|
.slider-container {
|
|
10324
10547
|
position: relative;
|
|
10325
10548
|
display: flex;
|
|
@@ -10333,6 +10556,14 @@ var css_248z$7 = i`:host {
|
|
|
10333
10556
|
opacity: 0.38;
|
|
10334
10557
|
}
|
|
10335
10558
|
|
|
10559
|
+
.value-display {
|
|
10560
|
+
min-width: 2.25rem;
|
|
10561
|
+
text-align: end;
|
|
10562
|
+
color: var(--color-on-surface-variant);
|
|
10563
|
+
font-size: 0.875rem;
|
|
10564
|
+
font-weight: 500;
|
|
10565
|
+
}
|
|
10566
|
+
|
|
10336
10567
|
.track {
|
|
10337
10568
|
position: absolute;
|
|
10338
10569
|
width: 100%;
|
|
@@ -10468,6 +10699,10 @@ class Slider extends i$1 {
|
|
|
10468
10699
|
* Whether to show labels on the slider.
|
|
10469
10700
|
*/
|
|
10470
10701
|
this.labeled = true;
|
|
10702
|
+
/**
|
|
10703
|
+
* Whether to show the current value beside the slider.
|
|
10704
|
+
*/
|
|
10705
|
+
this.showValue = false;
|
|
10471
10706
|
this.isDragging = false;
|
|
10472
10707
|
this.onMouseMove = (e) => {
|
|
10473
10708
|
if (this.isDragging) {
|
|
@@ -10550,28 +10785,33 @@ class Slider extends i$1 {
|
|
|
10550
10785
|
render() {
|
|
10551
10786
|
const percentage = ((this.value - this.min) / (this.max - this.min)) * 100;
|
|
10552
10787
|
return b `
|
|
10553
|
-
<div
|
|
10554
|
-
class="slider-container ${this.disabled ? 'disabled' : ''}"
|
|
10555
|
-
@mousedown=${this.onMouseDown}
|
|
10556
|
-
@touchstart=${this.onMouseDown}
|
|
10557
|
-
>
|
|
10558
|
-
<div class="track">
|
|
10559
|
-
<div class="track-active" style=${o$3({ width: `${percentage}%` })}></div>
|
|
10560
|
-
</div>
|
|
10561
|
-
|
|
10788
|
+
<div class="slider ${this.showValue ? 'with-value' : ''}">
|
|
10562
10789
|
<div
|
|
10563
|
-
class="
|
|
10564
|
-
|
|
10565
|
-
|
|
10566
|
-
aria-valuemin=${this.min}
|
|
10567
|
-
aria-valuemax=${this.max}
|
|
10568
|
-
aria-valuenow=${this.value}
|
|
10569
|
-
aria-disabled=${this.disabled}
|
|
10570
|
-
style=${o$3({ left: `calc(${percentage}% - var(--thumb-half))` })}
|
|
10571
|
-
@keydown=${this.handleKeyDown}
|
|
10790
|
+
class="slider-container ${this.disabled ? 'disabled' : ''}"
|
|
10791
|
+
@mousedown=${this.onMouseDown}
|
|
10792
|
+
@touchstart=${this.onMouseDown}
|
|
10572
10793
|
>
|
|
10573
|
-
|
|
10794
|
+
<div class="track">
|
|
10795
|
+
<div class="track-active" style=${o$2({ width: `${percentage}%` })}></div>
|
|
10796
|
+
</div>
|
|
10797
|
+
|
|
10798
|
+
<div
|
|
10799
|
+
class="thumb"
|
|
10800
|
+
role="slider"
|
|
10801
|
+
aria-label="Slider"
|
|
10802
|
+
tabindex="${this.disabled ? -1 : 0}"
|
|
10803
|
+
aria-valuemin=${this.min}
|
|
10804
|
+
aria-valuemax=${this.max}
|
|
10805
|
+
aria-valuenow=${this.value}
|
|
10806
|
+
aria-disabled=${this.disabled}
|
|
10807
|
+
style=${o$2({ left: `calc(${percentage}% - var(--thumb-half))` })}
|
|
10808
|
+
@keydown=${this.handleKeyDown}
|
|
10809
|
+
>
|
|
10810
|
+
${this.labeled ? b `<div class="value-label">${this.value}</div>` : ''}
|
|
10811
|
+
</div>
|
|
10574
10812
|
</div>
|
|
10813
|
+
|
|
10814
|
+
${this.showValue ? b `<output class="value-display" aria-live="polite">${this.value}</output>` : ''}
|
|
10575
10815
|
</div>
|
|
10576
10816
|
`;
|
|
10577
10817
|
}
|
|
@@ -10595,6 +10835,9 @@ __decorate([
|
|
|
10595
10835
|
__decorate([
|
|
10596
10836
|
n({ type: Boolean })
|
|
10597
10837
|
], Slider.prototype, "labeled", void 0);
|
|
10838
|
+
__decorate([
|
|
10839
|
+
n({ type: Boolean, attribute: 'show-value' })
|
|
10840
|
+
], Slider.prototype, "showValue", void 0);
|
|
10598
10841
|
__decorate([
|
|
10599
10842
|
r()
|
|
10600
10843
|
], Slider.prototype, "isDragging", void 0);
|
|
@@ -11211,48 +11454,52 @@ var css_248z$5 = i`* {
|
|
|
11211
11454
|
}
|
|
11212
11455
|
|
|
11213
11456
|
.pagination {
|
|
11214
|
-
background: var(--color-surface, #fff);
|
|
11215
11457
|
display: flex;
|
|
11216
11458
|
align-items: center;
|
|
11459
|
+
justify-content: flex-end;
|
|
11460
|
+
gap: var(--spacing-200, 1rem);
|
|
11461
|
+
background: var(--color-surface, #fff);
|
|
11462
|
+
padding: var(--spacing-150, 0.75rem) var(--spacing-200, 1rem);
|
|
11217
11463
|
}
|
|
11218
|
-
|
|
11219
|
-
|
|
11464
|
+
@media (max-width: 48rem) {
|
|
11465
|
+
.pagination {
|
|
11466
|
+
flex-wrap: wrap;
|
|
11467
|
+
justify-content: space-between;
|
|
11468
|
+
row-gap: var(--spacing-100, 0.5rem);
|
|
11469
|
+
}
|
|
11220
11470
|
}
|
|
11221
|
-
.pagination .page-size
|
|
11222
|
-
display: flex;
|
|
11471
|
+
.pagination .page-size {
|
|
11472
|
+
display: inline-flex;
|
|
11223
11473
|
align-items: center;
|
|
11224
11474
|
gap: var(--spacing-100, 0.5rem);
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
|
|
11228
|
-
|
|
11229
|
-
|
|
11475
|
+
min-inline-size: max-content;
|
|
11476
|
+
}
|
|
11477
|
+
.pagination .page-size-label {
|
|
11478
|
+
font-family: var(--typography-body-small-font-family);
|
|
11479
|
+
font-size: var(--typography-body-small-font-size);
|
|
11480
|
+
font-weight: var(--typography-body-small-font-weight);
|
|
11481
|
+
line-height: var(--typography-body-small-line-height);
|
|
11482
|
+
letter-spacing: var(--typography-body-small-letter-spacing);
|
|
11230
11483
|
color: var(--color-on-surface-variant);
|
|
11231
11484
|
white-space: nowrap;
|
|
11232
11485
|
}
|
|
11233
11486
|
.pagination .page-size-select {
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11237
|
-
padding: var(--spacing-050, 0.25rem) var(--spacing-100, 0.5rem);
|
|
11238
|
-
cursor: pointer;
|
|
11239
|
-
outline: none;
|
|
11240
|
-
height: 2.5rem;
|
|
11241
|
-
font-family: var(--typography-body-medium-font-family);
|
|
11242
|
-
font-size: var(--typography-body-medium-font-size);
|
|
11243
|
-
font-weight: var(--typography-body-medium-font-weight);
|
|
11244
|
-
line-height: var(--typography-body-medium-line-height);
|
|
11245
|
-
letter-spacing: var(--typography-body-medium-letter-spacing);
|
|
11246
|
-
}
|
|
11247
|
-
.pagination .page-size-select:focus {
|
|
11248
|
-
outline: 2px solid var(--color-primary);
|
|
11487
|
+
inline-size: 5.5rem;
|
|
11488
|
+
min-inline-size: 5.5rem;
|
|
11489
|
+
--field-container-height: 2.5rem;
|
|
11249
11490
|
}
|
|
11250
11491
|
.pagination .pagination-item-count {
|
|
11251
|
-
margin-inline-start:
|
|
11252
|
-
flex: 1;
|
|
11492
|
+
margin-inline-start: auto;
|
|
11253
11493
|
display: flex;
|
|
11254
11494
|
align-items: center;
|
|
11255
11495
|
}
|
|
11496
|
+
@media (max-width: 48rem) {
|
|
11497
|
+
.pagination .pagination-item-count {
|
|
11498
|
+
order: 3;
|
|
11499
|
+
margin-inline-start: 0;
|
|
11500
|
+
inline-size: 100%;
|
|
11501
|
+
}
|
|
11502
|
+
}
|
|
11256
11503
|
.pagination .pagination-text {
|
|
11257
11504
|
font-family: var(--typography-body-medium-font-family);
|
|
11258
11505
|
font-size: var(--typography-body-medium-font-size);
|
|
@@ -11261,9 +11508,13 @@ var css_248z$5 = i`* {
|
|
|
11261
11508
|
letter-spacing: var(--typography-body-medium-letter-spacing);
|
|
11262
11509
|
color: var(--color-on-surface-variant);
|
|
11263
11510
|
}
|
|
11264
|
-
.pagination .
|
|
11265
|
-
|
|
11266
|
-
|
|
11511
|
+
.pagination .pagination-actions {
|
|
11512
|
+
display: inline-flex;
|
|
11513
|
+
align-items: center;
|
|
11514
|
+
gap: var(--spacing-025, 0.125rem);
|
|
11515
|
+
}
|
|
11516
|
+
.pagination .nav-button {
|
|
11517
|
+
--button-container-shape: 999px;
|
|
11267
11518
|
}`;
|
|
11268
11519
|
|
|
11269
11520
|
const DEFAULT_PAGE_SIZES = [10, 25, 50, 100];
|
|
@@ -11279,7 +11530,7 @@ const DEFAULT_PAGE_SIZES = [10, 25, 50, 100];
|
|
|
11279
11530
|
*
|
|
11280
11531
|
* @example
|
|
11281
11532
|
* ```html
|
|
11282
|
-
* <wc-pagination page="1" page-size="10" total-items="100"></wc-pagination>
|
|
11533
|
+
* <wc-pagination style="width: 100%;" page="1" page-size="10" total-items="100"></wc-pagination>
|
|
11283
11534
|
* ```
|
|
11284
11535
|
* @tags navigation, data
|
|
11285
11536
|
*/
|
|
@@ -11302,6 +11553,62 @@ class Pagination extends i$1 {
|
|
|
11302
11553
|
* Supported page size options.
|
|
11303
11554
|
*/
|
|
11304
11555
|
this.pageSizes = DEFAULT_PAGE_SIZES;
|
|
11556
|
+
this.handlePreviousPage = () => {
|
|
11557
|
+
this.setPage(this.page - 1);
|
|
11558
|
+
};
|
|
11559
|
+
this.handleNextPage = () => {
|
|
11560
|
+
this.setPage(this.page + 1);
|
|
11561
|
+
};
|
|
11562
|
+
}
|
|
11563
|
+
willUpdate(changedProperties) {
|
|
11564
|
+
// Normalize page-size options so the select always has valid numeric values.
|
|
11565
|
+
const normalizedPageSizes = [...new Set(this.pageSizes
|
|
11566
|
+
.map(size => Number(size))
|
|
11567
|
+
.filter(size => Number.isFinite(size) && size > 0)
|
|
11568
|
+
.map(size => Math.trunc(size)))];
|
|
11569
|
+
if (!normalizedPageSizes.length) {
|
|
11570
|
+
normalizedPageSizes.push(...DEFAULT_PAGE_SIZES);
|
|
11571
|
+
}
|
|
11572
|
+
if (changedProperties.has('pageSizes') &&
|
|
11573
|
+
(this.pageSizes.length !== normalizedPageSizes.length ||
|
|
11574
|
+
this.pageSizes.some((size, index) => size !== normalizedPageSizes[index]))) {
|
|
11575
|
+
this.pageSizes = normalizedPageSizes;
|
|
11576
|
+
}
|
|
11577
|
+
if (!this.pageSizes.includes(this.pageSize)) {
|
|
11578
|
+
this.pageSize = this.pageSizes[0] ?? DEFAULT_PAGE_SIZES[0];
|
|
11579
|
+
}
|
|
11580
|
+
if (!Number.isFinite(this.totalItems) || this.totalItems < 0) {
|
|
11581
|
+
this.totalItems = 0;
|
|
11582
|
+
}
|
|
11583
|
+
if (!Number.isFinite(this.page) || this.page < 1) {
|
|
11584
|
+
this.page = 1;
|
|
11585
|
+
}
|
|
11586
|
+
const maxPage = this.getTotalPages();
|
|
11587
|
+
if (this.page > maxPage) {
|
|
11588
|
+
this.page = maxPage;
|
|
11589
|
+
}
|
|
11590
|
+
}
|
|
11591
|
+
getTotalPages() {
|
|
11592
|
+
if (this.totalItems <= 0)
|
|
11593
|
+
return 1;
|
|
11594
|
+
return Math.max(1, Math.ceil(this.totalItems / this.pageSize));
|
|
11595
|
+
}
|
|
11596
|
+
setPage(nextPage) {
|
|
11597
|
+
const clampedPage = Math.min(Math.max(1, nextPage), this.getTotalPages());
|
|
11598
|
+
if (clampedPage === this.page)
|
|
11599
|
+
return;
|
|
11600
|
+
this.page = clampedPage;
|
|
11601
|
+
this.dispatchPageEvent();
|
|
11602
|
+
}
|
|
11603
|
+
handlePageSizeChange(event) {
|
|
11604
|
+
const rawValue = event.detail?.value;
|
|
11605
|
+
const parsedPageSize = Number.parseInt(rawValue ?? '', 10);
|
|
11606
|
+
if (!Number.isFinite(parsedPageSize) || parsedPageSize <= 0) {
|
|
11607
|
+
return;
|
|
11608
|
+
}
|
|
11609
|
+
this.pageSize = parsedPageSize;
|
|
11610
|
+
this.page = 1;
|
|
11611
|
+
this.dispatchPageEvent();
|
|
11305
11612
|
}
|
|
11306
11613
|
dispatchPageEvent() {
|
|
11307
11614
|
this.dispatchEvent(new CustomEvent('page', {
|
|
@@ -11311,70 +11618,51 @@ class Pagination extends i$1 {
|
|
|
11311
11618
|
}));
|
|
11312
11619
|
}
|
|
11313
11620
|
render() {
|
|
11314
|
-
const startItem = this.pageSize * (this.page - 1);
|
|
11621
|
+
const startItem = this.totalItems === 0 ? 0 : this.pageSize * (this.page - 1) + 1;
|
|
11315
11622
|
const endItem = Math.min(this.pageSize * this.page, this.totalItems);
|
|
11316
11623
|
const isFirstPage = this.page === 1;
|
|
11317
11624
|
const isLastPage = this.pageSize * this.page >= this.totalItems;
|
|
11318
11625
|
return b `
|
|
11319
11626
|
<div class="pagination">
|
|
11320
|
-
<div class="page-
|
|
11321
|
-
<
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
|
|
11328
|
-
this.
|
|
11329
|
-
|
|
11330
|
-
}}
|
|
11331
|
-
>
|
|
11332
|
-
${this.pageSizes.map(size => b `
|
|
11333
|
-
<option value=${size} ?selected=${this.pageSize === size}>
|
|
11334
|
-
${size}
|
|
11335
|
-
</option>
|
|
11336
|
-
`)}
|
|
11337
|
-
</select>
|
|
11338
|
-
</label>
|
|
11627
|
+
<div class="page-size">
|
|
11628
|
+
<span class="page-size-label">Items per page:</span>
|
|
11629
|
+
<wc-select
|
|
11630
|
+
class="page-size-select"
|
|
11631
|
+
.value=${String(this.pageSize)}
|
|
11632
|
+
aria-label="Items per page"
|
|
11633
|
+
@change=${this.handlePageSizeChange}
|
|
11634
|
+
>
|
|
11635
|
+
${this.pageSizes.map(size => b `<wc-option value=${String(size)}>${size}</wc-option>`)}
|
|
11636
|
+
</wc-select>
|
|
11339
11637
|
</div>
|
|
11638
|
+
|
|
11340
11639
|
<div class="pagination-item-count">
|
|
11341
11640
|
<span class="pagination-text">
|
|
11342
|
-
${startItem} - ${endItem} of ${this.totalItems}
|
|
11641
|
+
${startItem} - ${endItem} of ${this.totalItems}
|
|
11343
11642
|
</span>
|
|
11344
11643
|
</div>
|
|
11345
|
-
|
|
11346
|
-
|
|
11347
|
-
|
|
11348
|
-
|
|
11349
|
-
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
|
|
11362
|
-
|
|
11363
|
-
|
|
11364
|
-
|
|
11365
|
-
|
|
11366
|
-
|
|
11367
|
-
@click=${() => {
|
|
11368
|
-
if (!isLastPage) {
|
|
11369
|
-
this.page += 1;
|
|
11370
|
-
this.dispatchPageEvent();
|
|
11371
|
-
}
|
|
11372
|
-
}}
|
|
11373
|
-
>
|
|
11374
|
-
<wc-icon slot="icon" name="arrow--right"></wc-icon>
|
|
11375
|
-
</wc-button>
|
|
11376
|
-
</div>
|
|
11377
|
-
</div>
|
|
11644
|
+
|
|
11645
|
+
<div class="pagination-actions">
|
|
11646
|
+
<wc-icon-button
|
|
11647
|
+
class="nav-button"
|
|
11648
|
+
color="secondary"
|
|
11649
|
+
variant="text"
|
|
11650
|
+
size="sm"
|
|
11651
|
+
name="keyboard_arrow_left"
|
|
11652
|
+
title="Previous page"
|
|
11653
|
+
?disabled=${isFirstPage}
|
|
11654
|
+
@click=${this.handlePreviousPage}
|
|
11655
|
+
></wc-icon-button>
|
|
11656
|
+
<wc-icon-button
|
|
11657
|
+
class="nav-button"
|
|
11658
|
+
color="secondary"
|
|
11659
|
+
variant="text"
|
|
11660
|
+
size="sm"
|
|
11661
|
+
name="keyboard_arrow_right"
|
|
11662
|
+
title="Next page"
|
|
11663
|
+
?disabled=${isLastPage}
|
|
11664
|
+
@click=${this.handleNextPage}
|
|
11665
|
+
></wc-icon-button>
|
|
11378
11666
|
</div>
|
|
11379
11667
|
</div>
|
|
11380
11668
|
`;
|
|
@@ -11656,7 +11944,7 @@ class TreeNode extends i$1 {
|
|
|
11656
11944
|
}
|
|
11657
11945
|
_renderContent(hasChildren) {
|
|
11658
11946
|
// 0.125rem offset aligns text visually with the expand/icon space
|
|
11659
|
-
const indentStyle = o$
|
|
11947
|
+
const indentStyle = o$2({
|
|
11660
11948
|
paddingInlineStart: `calc(${this.level + 1}rem - 0.125rem)`,
|
|
11661
11949
|
});
|
|
11662
11950
|
const contentClasses = e$3({
|
|
@@ -11918,10 +12206,34 @@ var css_248z$2 = i`* {
|
|
|
11918
12206
|
display: none !important;
|
|
11919
12207
|
}
|
|
11920
12208
|
|
|
12209
|
+
@keyframes snackbar-enter {
|
|
12210
|
+
from {
|
|
12211
|
+
opacity: 0;
|
|
12212
|
+
transform: translateY(0.5rem);
|
|
12213
|
+
}
|
|
12214
|
+
to {
|
|
12215
|
+
opacity: 1;
|
|
12216
|
+
transform: translateY(0);
|
|
12217
|
+
}
|
|
12218
|
+
}
|
|
12219
|
+
@keyframes snackbar-exit {
|
|
12220
|
+
from {
|
|
12221
|
+
opacity: 1;
|
|
12222
|
+
transform: translateY(0);
|
|
12223
|
+
}
|
|
12224
|
+
to {
|
|
12225
|
+
opacity: 0;
|
|
12226
|
+
transform: translateY(0.5rem);
|
|
12227
|
+
}
|
|
12228
|
+
}
|
|
11921
12229
|
:host {
|
|
11922
|
-
display:
|
|
11923
|
-
|
|
11924
|
-
|
|
12230
|
+
display: flex;
|
|
12231
|
+
inset-block-end: calc(var(--snackbar-offset-bottom, 1rem) + env(safe-area-inset-bottom, 0px));
|
|
12232
|
+
inset-inline: var(--snackbar-offset-inline, 1rem);
|
|
12233
|
+
justify-content: center;
|
|
12234
|
+
pointer-events: none;
|
|
12235
|
+
position: fixed;
|
|
12236
|
+
z-index: var(--snackbar-z-index, 1000);
|
|
11925
12237
|
--snackbar-container-color: var(--color-inverse-surface);
|
|
11926
12238
|
--snackbar-label-text-color: var(--color-inverse-on-surface);
|
|
11927
12239
|
--snackbar-action-text-color: var(--color-inverse-primary);
|
|
@@ -11939,59 +12251,57 @@ var css_248z$2 = i`* {
|
|
|
11939
12251
|
background-color: var(--snackbar-container-color);
|
|
11940
12252
|
border-radius: var(--snackbar-border-radius);
|
|
11941
12253
|
color: var(--snackbar-label-text-color);
|
|
11942
|
-
display:
|
|
12254
|
+
display: none;
|
|
11943
12255
|
gap: var(--spacing-100);
|
|
12256
|
+
max-width: min(42rem, 100%);
|
|
12257
|
+
min-width: min(21.5rem, 100%);
|
|
11944
12258
|
min-height: 3rem;
|
|
11945
|
-
opacity: 0;
|
|
11946
12259
|
padding: var(--spacing-100) var(--spacing-200);
|
|
11947
12260
|
pointer-events: none;
|
|
11948
|
-
transform: translateY(0.5rem);
|
|
11949
|
-
transition: opacity var(--duration-short2) var(--easing-standard), transform var(--duration-short2) var(--easing-standard);
|
|
11950
12261
|
}
|
|
11951
12262
|
|
|
11952
12263
|
.snackbar.open {
|
|
11953
|
-
|
|
12264
|
+
animation: snackbar-enter var(--duration-medium1, 300ms) var(--easing-standard, cubic-bezier(0.2, 0, 0, 1)) both;
|
|
12265
|
+
display: inline-flex;
|
|
11954
12266
|
pointer-events: auto;
|
|
11955
|
-
|
|
12267
|
+
}
|
|
12268
|
+
|
|
12269
|
+
.snackbar.open.dismissing {
|
|
12270
|
+
animation: snackbar-exit var(--duration-short2, 150ms) var(--easing-standard, cubic-bezier(0.2, 0, 0, 1)) forwards;
|
|
12271
|
+
pointer-events: none;
|
|
11956
12272
|
}
|
|
11957
12273
|
|
|
11958
12274
|
.label {
|
|
11959
12275
|
flex: 1 1 auto;
|
|
11960
12276
|
color: inherit;
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
.action,
|
|
11964
|
-
.close {
|
|
11965
|
-
font-family: var(--typography-label-large-font-family) !important;
|
|
11966
|
-
font-size: var(--typography-label-large-font-size) !important;
|
|
11967
|
-
font-weight: var(--typography-label-large-font-weight) !important;
|
|
11968
|
-
line-height: var(--typography-label-large-line-height) !important;
|
|
11969
|
-
letter-spacing: var(--typography-label-large-letter-spacing) !important;
|
|
12277
|
+
min-height: 32px;
|
|
11970
12278
|
align-items: center;
|
|
11971
|
-
|
|
11972
|
-
border: none;
|
|
11973
|
-
color: var(--snackbar-action-text-color);
|
|
11974
|
-
cursor: pointer;
|
|
11975
|
-
display: inline-flex;
|
|
11976
|
-
justify-content: center;
|
|
11977
|
-
margin: 0;
|
|
11978
|
-
min-height: 2rem;
|
|
11979
|
-
min-width: 2rem;
|
|
11980
|
-
padding: 0 var(--spacing-100);
|
|
12279
|
+
display: flex;
|
|
11981
12280
|
}
|
|
11982
12281
|
|
|
11983
|
-
.
|
|
11984
|
-
color: var(--snackbar-
|
|
11985
|
-
padding: 0;
|
|
12282
|
+
.action {
|
|
12283
|
+
--text-button-label-text-color: var(--snackbar-action-text-color);
|
|
11986
12284
|
}
|
|
11987
12285
|
|
|
11988
|
-
.close
|
|
11989
|
-
--
|
|
11990
|
-
color: inherit;
|
|
12286
|
+
.close {
|
|
12287
|
+
--text-button-label-text-color: var(--snackbar-close-icon-color);
|
|
11991
12288
|
}
|
|
11992
12289
|
|
|
11993
12290
|
.snackbar.multiline {
|
|
11994
12291
|
align-items: flex-start;
|
|
12292
|
+
}
|
|
12293
|
+
.snackbar.multiline .label {
|
|
12294
|
+
height: 100%;
|
|
12295
|
+
}
|
|
12296
|
+
|
|
12297
|
+
:host([preview]) {
|
|
12298
|
+
position: relative;
|
|
12299
|
+
inset-inline: unset;
|
|
12300
|
+
inset-block-end: unset;
|
|
12301
|
+
}
|
|
12302
|
+
:host([preview]) .snackbar {
|
|
12303
|
+
display: inline-flex;
|
|
12304
|
+
pointer-events: auto;
|
|
11995
12305
|
}`;
|
|
11996
12306
|
|
|
11997
12307
|
/**
|
|
@@ -12005,10 +12315,13 @@ var css_248z$2 = i`* {
|
|
|
12005
12315
|
* @cssprop --snackbar-action-text-color - Action text color.
|
|
12006
12316
|
* @cssprop --snackbar-close-icon-color - Close icon color.
|
|
12007
12317
|
* @cssprop --snackbar-border-radius - Border radius of the snackbar surface.
|
|
12318
|
+
* @cssprop --snackbar-offset-inline - Inline offset from viewport edges.
|
|
12319
|
+
* @cssprop --snackbar-offset-bottom - Bottom offset from viewport edge.
|
|
12320
|
+
* @cssprop --snackbar-z-index - Stacking order for the snackbar.
|
|
12008
12321
|
*
|
|
12009
12322
|
* @example
|
|
12010
12323
|
* ```html
|
|
12011
|
-
* <wc-snackbar
|
|
12324
|
+
* <wc-snackbar preview message="Message archived" action-label="Undo"></wc-snackbar>
|
|
12012
12325
|
* ```
|
|
12013
12326
|
* @tags display, feedback
|
|
12014
12327
|
*/
|
|
@@ -12021,25 +12334,54 @@ class Snackbar extends i$1 {
|
|
|
12021
12334
|
this.showCloseIcon = false;
|
|
12022
12335
|
this.duration = 4000;
|
|
12023
12336
|
this.multiline = false;
|
|
12337
|
+
this.preview = false;
|
|
12338
|
+
this.dismissing = false;
|
|
12024
12339
|
this.hideTimer = null;
|
|
12340
|
+
this.exitTimer = null;
|
|
12341
|
+
this.handleGlobalSnackbarOpen = (event) => {
|
|
12342
|
+
const { source } = event.detail;
|
|
12343
|
+
if (source && source !== this) {
|
|
12344
|
+
this.hide();
|
|
12345
|
+
}
|
|
12346
|
+
};
|
|
12347
|
+
}
|
|
12348
|
+
connectedCallback() {
|
|
12349
|
+
super.connectedCallback();
|
|
12350
|
+
document.addEventListener(Snackbar.GLOBAL_OPEN_EVENT, this.handleGlobalSnackbarOpen);
|
|
12025
12351
|
}
|
|
12026
12352
|
show() {
|
|
12027
|
-
this.
|
|
12353
|
+
this.dismissing = false;
|
|
12354
|
+
this.clearExitTimer();
|
|
12355
|
+
if (!this.open) {
|
|
12356
|
+
this.open = true;
|
|
12357
|
+
return;
|
|
12358
|
+
}
|
|
12359
|
+
this.scheduleAutoHide();
|
|
12028
12360
|
}
|
|
12029
12361
|
hide() {
|
|
12030
12362
|
this.close('programmatic');
|
|
12031
12363
|
}
|
|
12032
12364
|
close(reason) {
|
|
12033
|
-
if (!this.open) {
|
|
12365
|
+
if (!this.open || this.dismissing) {
|
|
12034
12366
|
return;
|
|
12035
12367
|
}
|
|
12036
|
-
this.
|
|
12368
|
+
this.clearTimer();
|
|
12369
|
+
this.dismissing = true;
|
|
12370
|
+
this.clearExitTimer();
|
|
12371
|
+
this.exitTimer = setTimeout(() => {
|
|
12372
|
+
this.completeDismiss();
|
|
12373
|
+
}, Snackbar.EXIT_ANIMATION_MS);
|
|
12037
12374
|
this.dispatchEvent(new CustomEvent('snackbar-close', {
|
|
12038
12375
|
detail: { reason },
|
|
12039
12376
|
bubbles: true,
|
|
12040
12377
|
composed: true,
|
|
12041
12378
|
}));
|
|
12042
12379
|
}
|
|
12380
|
+
completeDismiss() {
|
|
12381
|
+
this.clearExitTimer();
|
|
12382
|
+
this.dismissing = false;
|
|
12383
|
+
this.open = false;
|
|
12384
|
+
}
|
|
12043
12385
|
dispatchActionEvent() {
|
|
12044
12386
|
this.dispatchEvent(new CustomEvent('snackbar-action', {
|
|
12045
12387
|
bubbles: true,
|
|
@@ -12059,6 +12401,17 @@ class Snackbar extends i$1 {
|
|
|
12059
12401
|
this.hideTimer = null;
|
|
12060
12402
|
}
|
|
12061
12403
|
}
|
|
12404
|
+
clearExitTimer() {
|
|
12405
|
+
if (this.exitTimer !== null) {
|
|
12406
|
+
clearTimeout(this.exitTimer);
|
|
12407
|
+
this.exitTimer = null;
|
|
12408
|
+
}
|
|
12409
|
+
}
|
|
12410
|
+
handleAnimationEnd(event) {
|
|
12411
|
+
if (event.animationName === 'snackbar-exit' && this.dismissing) {
|
|
12412
|
+
this.completeDismiss();
|
|
12413
|
+
}
|
|
12414
|
+
}
|
|
12062
12415
|
scheduleAutoHide() {
|
|
12063
12416
|
this.clearTimer();
|
|
12064
12417
|
if (!this.open || this.duration <= 0) {
|
|
@@ -12070,10 +12423,17 @@ class Snackbar extends i$1 {
|
|
|
12070
12423
|
}
|
|
12071
12424
|
updated(changedProperties) {
|
|
12072
12425
|
if (changedProperties.has('open')) {
|
|
12426
|
+
if (this.open) {
|
|
12427
|
+
document.dispatchEvent(new CustomEvent(Snackbar.GLOBAL_OPEN_EVENT, {
|
|
12428
|
+
detail: { source: this },
|
|
12429
|
+
}));
|
|
12430
|
+
}
|
|
12073
12431
|
this.scheduleAutoHide();
|
|
12074
12432
|
}
|
|
12075
12433
|
}
|
|
12076
12434
|
disconnectedCallback() {
|
|
12435
|
+
document.removeEventListener(Snackbar.GLOBAL_OPEN_EVENT, this.handleGlobalSnackbarOpen);
|
|
12436
|
+
this.clearExitTimer();
|
|
12077
12437
|
this.clearTimer();
|
|
12078
12438
|
super.disconnectedCallback();
|
|
12079
12439
|
}
|
|
@@ -12083,37 +12443,43 @@ class Snackbar extends i$1 {
|
|
|
12083
12443
|
<div
|
|
12084
12444
|
class=${e$3({
|
|
12085
12445
|
snackbar: true,
|
|
12086
|
-
open: this.open,
|
|
12446
|
+
open: !this.preview && this.open,
|
|
12447
|
+
preview: this.preview,
|
|
12448
|
+
dismissing: this.dismissing,
|
|
12087
12449
|
multiline: this.multiline,
|
|
12088
12450
|
})}
|
|
12089
12451
|
role=${liveRole}
|
|
12090
12452
|
aria-live="polite"
|
|
12453
|
+
@animationend=${this.handleAnimationEnd}
|
|
12091
12454
|
>
|
|
12092
12455
|
<div class="label">
|
|
12093
12456
|
<slot>${this.message}</slot>
|
|
12094
12457
|
</div>
|
|
12095
12458
|
|
|
12096
12459
|
${this.actionLabel
|
|
12097
|
-
? b `<button class="action"
|
|
12460
|
+
? b `<wc-button class="action" variant='text' size='small' @click=${this.handleActionClick}>
|
|
12098
12461
|
${this.actionLabel}
|
|
12099
|
-
</button>`
|
|
12462
|
+
</wc-button>`
|
|
12100
12463
|
: A}
|
|
12101
12464
|
|
|
12102
12465
|
${this.showCloseIcon
|
|
12103
|
-
? b `<button
|
|
12466
|
+
? b `<wc-icon-button
|
|
12104
12467
|
class="close"
|
|
12105
|
-
|
|
12468
|
+
variant='text'
|
|
12469
|
+
size='small'
|
|
12106
12470
|
aria-label="Dismiss notification"
|
|
12107
12471
|
@click=${this.handleCloseClick}
|
|
12472
|
+
name="close"
|
|
12108
12473
|
>
|
|
12109
|
-
|
|
12110
|
-
</button>`
|
|
12474
|
+
</wc-icon-button>`
|
|
12111
12475
|
: A}
|
|
12112
12476
|
</div>
|
|
12113
12477
|
`;
|
|
12114
12478
|
}
|
|
12115
12479
|
}
|
|
12116
12480
|
Snackbar.styles = [css_248z$2];
|
|
12481
|
+
Snackbar.GLOBAL_OPEN_EVENT = 'wc-snackbar-will-open';
|
|
12482
|
+
Snackbar.EXIT_ANIMATION_MS = 180;
|
|
12117
12483
|
__decorate([
|
|
12118
12484
|
n({ type: Boolean, reflect: true })
|
|
12119
12485
|
], Snackbar.prototype, "open", void 0);
|
|
@@ -12132,6 +12498,12 @@ __decorate([
|
|
|
12132
12498
|
__decorate([
|
|
12133
12499
|
n({ type: Boolean, reflect: true })
|
|
12134
12500
|
], Snackbar.prototype, "multiline", void 0);
|
|
12501
|
+
__decorate([
|
|
12502
|
+
n({ type: Boolean, reflect: true })
|
|
12503
|
+
], Snackbar.prototype, "preview", void 0);
|
|
12504
|
+
__decorate([
|
|
12505
|
+
r()
|
|
12506
|
+
], Snackbar.prototype, "dismissing", void 0);
|
|
12135
12507
|
|
|
12136
12508
|
var css_248z$1 = i`* {
|
|
12137
12509
|
box-sizing: border-box;
|
|
@@ -12675,6 +13047,11 @@ var css_248z = i`@charset "UTF-8";
|
|
|
12675
13047
|
gap: var(--spacing-050);
|
|
12676
13048
|
}
|
|
12677
13049
|
|
|
13050
|
+
.select-empty-state {
|
|
13051
|
+
display: block;
|
|
13052
|
+
inline-size: min(22rem, 100%);
|
|
13053
|
+
}
|
|
13054
|
+
|
|
12678
13055
|
/* Dropdown chevron icon */
|
|
12679
13056
|
.dropdown-icon {
|
|
12680
13057
|
--icon-size: 1.5rem;
|
|
@@ -12788,7 +13165,7 @@ class SelectOptionElement extends i$1 {
|
|
|
12788
13165
|
${this.icon
|
|
12789
13166
|
? b `<wc-icon name=${this.icon} slot="leading-icon"></wc-icon>`
|
|
12790
13167
|
: A}
|
|
12791
|
-
<slot
|
|
13168
|
+
<slot>${this.value === '' ? 'None' : ''}</slot>
|
|
12792
13169
|
${this.selected && this.keepOpen
|
|
12793
13170
|
? b `<wc-icon
|
|
12794
13171
|
name="check"
|
|
@@ -12857,6 +13234,7 @@ __decorate([
|
|
|
12857
13234
|
class Select extends BaseInput {
|
|
12858
13235
|
constructor() {
|
|
12859
13236
|
super(...arguments);
|
|
13237
|
+
this._menuId = `wc-select-menu-${Math.random().toString(36).slice(2, 9)}`;
|
|
12860
13238
|
/**
|
|
12861
13239
|
* Array of options to display in the dropdown.
|
|
12862
13240
|
* Setting this property creates matching `<wc-option>` children automatically.
|
|
@@ -12884,10 +13262,6 @@ class Select extends BaseInput {
|
|
|
12884
13262
|
* Label displayed above the field.
|
|
12885
13263
|
*/
|
|
12886
13264
|
this.label = '';
|
|
12887
|
-
/**
|
|
12888
|
-
* Show a clear button in single-select mode when a value is selected.
|
|
12889
|
-
*/
|
|
12890
|
-
this.clearable = false;
|
|
12891
13265
|
/**
|
|
12892
13266
|
* Visual variant of the field.
|
|
12893
13267
|
*/
|
|
@@ -12935,7 +13309,7 @@ class Select extends BaseInput {
|
|
|
12935
13309
|
el.value = opt.value;
|
|
12936
13310
|
if (opt.icon)
|
|
12937
13311
|
el.icon = opt.icon;
|
|
12938
|
-
el.textContent = opt.label;
|
|
13312
|
+
el.textContent = opt.label || (opt.value === '' ? 'None' : '');
|
|
12939
13313
|
el.dataset.generated = '';
|
|
12940
13314
|
this.appendChild(el);
|
|
12941
13315
|
}
|
|
@@ -12956,14 +13330,14 @@ class Select extends BaseInput {
|
|
|
12956
13330
|
const label = opt.textContent?.trim() ?? '';
|
|
12957
13331
|
opt.filtered = !label.toLowerCase().includes(q);
|
|
12958
13332
|
if (!opt.filtered)
|
|
12959
|
-
visibleCount
|
|
13333
|
+
visibleCount += 1;
|
|
12960
13334
|
}
|
|
12961
13335
|
else {
|
|
12962
13336
|
opt.filtered = false;
|
|
12963
|
-
visibleCount
|
|
13337
|
+
visibleCount += 1;
|
|
12964
13338
|
}
|
|
12965
13339
|
}
|
|
12966
|
-
this._noOptionsVisible =
|
|
13340
|
+
this._noOptionsVisible = visibleCount === 0;
|
|
12967
13341
|
}
|
|
12968
13342
|
// ── Helpers ────────────────────────────────────────────────────────────────
|
|
12969
13343
|
get _selectedValues() {
|
|
@@ -12975,16 +13349,26 @@ class Select extends BaseInput {
|
|
|
12975
13349
|
.filter(Boolean);
|
|
12976
13350
|
}
|
|
12977
13351
|
_isSelected(value) {
|
|
13352
|
+
if (!this.multiple) {
|
|
13353
|
+
return this.value === value;
|
|
13354
|
+
}
|
|
12978
13355
|
return this._selectedValues.includes(value);
|
|
12979
13356
|
}
|
|
12980
13357
|
/** Returns the display label for a given option value. */
|
|
12981
13358
|
_getLabelForValue(val) {
|
|
12982
13359
|
for (const opt of this.querySelectorAll('wc-option')) {
|
|
12983
|
-
if (opt.value === val)
|
|
12984
|
-
|
|
13360
|
+
if (opt.value === val) {
|
|
13361
|
+
const label = opt.textContent?.trim();
|
|
13362
|
+
if (label)
|
|
13363
|
+
return label;
|
|
13364
|
+
return val === '' ? 'None' : val;
|
|
13365
|
+
}
|
|
12985
13366
|
}
|
|
12986
13367
|
// Fallback to options array (before wc-option children are created)
|
|
12987
|
-
|
|
13368
|
+
const programmaticLabel = this.options.find(o => o.value === val)?.label;
|
|
13369
|
+
if (programmaticLabel)
|
|
13370
|
+
return programmaticLabel;
|
|
13371
|
+
return val === '' ? 'None' : val;
|
|
12988
13372
|
}
|
|
12989
13373
|
get _displayLabel() {
|
|
12990
13374
|
if (!this.value)
|
|
@@ -13003,9 +13387,17 @@ class Select extends BaseInput {
|
|
|
13003
13387
|
return;
|
|
13004
13388
|
this._open = true;
|
|
13005
13389
|
this._focused = true;
|
|
13390
|
+
this._triggerEl?.focus();
|
|
13006
13391
|
const menu = this._menu;
|
|
13007
13392
|
if (menu && this._triggerEl) {
|
|
13008
13393
|
menu.anchorElement = this._triggerEl;
|
|
13394
|
+
const triggerWidth = this._triggerEl.getBoundingClientRect().width;
|
|
13395
|
+
if (triggerWidth < 240) {
|
|
13396
|
+
menu.style.setProperty('--menu-width', '240px');
|
|
13397
|
+
}
|
|
13398
|
+
else {
|
|
13399
|
+
menu.style.setProperty('--menu-width', `${Math.ceil(triggerWidth)}px`);
|
|
13400
|
+
}
|
|
13009
13401
|
menu.show();
|
|
13010
13402
|
}
|
|
13011
13403
|
if (this.search) {
|
|
@@ -13029,6 +13421,7 @@ class Select extends BaseInput {
|
|
|
13029
13421
|
}
|
|
13030
13422
|
// ── Event handlers ─────────────────────────────────────────────────────────
|
|
13031
13423
|
_handleTriggerClick(event) {
|
|
13424
|
+
event.stopPropagation();
|
|
13032
13425
|
// Ignore clicks that originated inside the search input — those should not
|
|
13033
13426
|
// toggle the menu (the input needs to stay open so the user can type).
|
|
13034
13427
|
if (event.target instanceof HTMLInputElement) {
|
|
@@ -13041,6 +13434,22 @@ class Select extends BaseInput {
|
|
|
13041
13434
|
this._openMenu();
|
|
13042
13435
|
}
|
|
13043
13436
|
}
|
|
13437
|
+
_handleFieldClick(event) {
|
|
13438
|
+
const eventPath = event.composedPath();
|
|
13439
|
+
if (eventPath.includes(this._triggerEl) ||
|
|
13440
|
+
eventPath.some(target => target instanceof HTMLInputElement ||
|
|
13441
|
+
(target instanceof HTMLElement &&
|
|
13442
|
+
(target.closest('.clear-btn') != null ||
|
|
13443
|
+
target.matches('wc-icon-button'))))) {
|
|
13444
|
+
return;
|
|
13445
|
+
}
|
|
13446
|
+
if (this._open) {
|
|
13447
|
+
this._closeMenu();
|
|
13448
|
+
}
|
|
13449
|
+
else {
|
|
13450
|
+
this._openMenu();
|
|
13451
|
+
}
|
|
13452
|
+
}
|
|
13044
13453
|
_handleTriggerKeyDown(event) {
|
|
13045
13454
|
// When the typeahead search input is active, let the input handle its own
|
|
13046
13455
|
// keys (Space, Enter, etc.). Only intercept Escape to close the menu.
|
|
@@ -13077,9 +13486,11 @@ class Select extends BaseInput {
|
|
|
13077
13486
|
if (!item)
|
|
13078
13487
|
return;
|
|
13079
13488
|
const val = item.value;
|
|
13080
|
-
if (
|
|
13489
|
+
if (val === undefined)
|
|
13081
13490
|
return;
|
|
13082
13491
|
if (this.multiple) {
|
|
13492
|
+
if (val === '')
|
|
13493
|
+
return;
|
|
13083
13494
|
const values = this._selectedValues;
|
|
13084
13495
|
const idx = values.indexOf(val);
|
|
13085
13496
|
if (idx >= 0) {
|
|
@@ -13113,17 +13524,25 @@ class Select extends BaseInput {
|
|
|
13113
13524
|
}));
|
|
13114
13525
|
}
|
|
13115
13526
|
}
|
|
13116
|
-
_handleClear(event) {
|
|
13117
|
-
event.stopPropagation();
|
|
13118
|
-
this.value = '';
|
|
13119
|
-
this._dispatchChange();
|
|
13120
|
-
}
|
|
13121
13527
|
_handleChipDismiss(event, chipValue) {
|
|
13122
13528
|
event.stopPropagation();
|
|
13123
13529
|
const values = this._selectedValues.filter(v => v !== chipValue);
|
|
13124
13530
|
this.value = values.join(',');
|
|
13125
13531
|
this._dispatchChange();
|
|
13126
13532
|
}
|
|
13533
|
+
_renderEmptyState() {
|
|
13534
|
+
const hasSearchQuery = this._searchQuery.trim().length > 0;
|
|
13535
|
+
return b `
|
|
13536
|
+
<wc-empty-state
|
|
13537
|
+
class="select-empty-state content-center"
|
|
13538
|
+
illustration="no-document"
|
|
13539
|
+
headline=${hasSearchQuery ? 'No results found' : 'No options available'}
|
|
13540
|
+
description=${hasSearchQuery
|
|
13541
|
+
? 'Try a different search term.'
|
|
13542
|
+
: 'There is nothing to select right now.'}
|
|
13543
|
+
></wc-empty-state>
|
|
13544
|
+
`;
|
|
13545
|
+
}
|
|
13127
13546
|
// ── Render helpers ─────────────────────────────────────────────────────────
|
|
13128
13547
|
_renderTriggerContent() {
|
|
13129
13548
|
// Typeahead: when open, show a text input for filtering
|
|
@@ -13156,21 +13575,7 @@ class Select extends BaseInput {
|
|
|
13156
13575
|
return b `<span class="display-value">${label}</span>`;
|
|
13157
13576
|
}
|
|
13158
13577
|
_renderFieldEnd() {
|
|
13159
|
-
const showClear = this.clearable &&
|
|
13160
|
-
!this.multiple &&
|
|
13161
|
-
!!this.value &&
|
|
13162
|
-
!this.disabled &&
|
|
13163
|
-
!this.readonly;
|
|
13164
13578
|
return b `
|
|
13165
|
-
${showClear
|
|
13166
|
-
? b `<wc-icon-button
|
|
13167
|
-
class="clear-btn"
|
|
13168
|
-
variant="text"
|
|
13169
|
-
size="sm"
|
|
13170
|
-
name="close"
|
|
13171
|
-
@click=${this._handleClear}
|
|
13172
|
-
></wc-icon-button>`
|
|
13173
|
-
: A}
|
|
13174
13579
|
<wc-icon
|
|
13175
13580
|
class=${e$3({
|
|
13176
13581
|
'dropdown-icon': true,
|
|
@@ -13198,11 +13603,14 @@ class Select extends BaseInput {
|
|
|
13198
13603
|
?focused=${this._focused}
|
|
13199
13604
|
.host=${this}
|
|
13200
13605
|
class="select-field"
|
|
13606
|
+
@click=${this._handleFieldClick}
|
|
13201
13607
|
>
|
|
13202
13608
|
<div
|
|
13203
13609
|
class="select-trigger"
|
|
13204
13610
|
tabindex=${this.disabled ? -1 : 0}
|
|
13205
13611
|
role="combobox"
|
|
13612
|
+
aria-label=${this.label || this.placeholder || 'Select option'}
|
|
13613
|
+
aria-controls=${this._menuId}
|
|
13206
13614
|
aria-expanded=${String(this._open)}
|
|
13207
13615
|
aria-haspopup="listbox"
|
|
13208
13616
|
@click=${this._handleTriggerClick}
|
|
@@ -13217,15 +13625,14 @@ class Select extends BaseInput {
|
|
|
13217
13625
|
</wc-field>
|
|
13218
13626
|
|
|
13219
13627
|
<wc-menu
|
|
13628
|
+
id=${this._menuId}
|
|
13220
13629
|
placement="bottom-start"
|
|
13221
13630
|
aria-label=${this.label || 'Options'}
|
|
13222
13631
|
@closed=${this._handleMenuClosed}
|
|
13223
13632
|
@menu-item-activate=${(e) => this._handleMenuItemActivate(e)}
|
|
13224
13633
|
>
|
|
13225
13634
|
<slot></slot>
|
|
13226
|
-
${this._noOptionsVisible
|
|
13227
|
-
? b `<wc-menu-item disabled>No options</wc-menu-item>`
|
|
13228
|
-
: A}
|
|
13635
|
+
${this._noOptionsVisible ? this._renderEmptyState() : A}
|
|
13229
13636
|
</wc-menu>
|
|
13230
13637
|
`;
|
|
13231
13638
|
}
|
|
@@ -13249,9 +13656,6 @@ __decorate([
|
|
|
13249
13656
|
__decorate([
|
|
13250
13657
|
n({ type: String })
|
|
13251
13658
|
], Select.prototype, "label", void 0);
|
|
13252
|
-
__decorate([
|
|
13253
|
-
n({ type: Boolean })
|
|
13254
|
-
], Select.prototype, "clearable", void 0);
|
|
13255
13659
|
__decorate([
|
|
13256
13660
|
n({ type: String })
|
|
13257
13661
|
], Select.prototype, "variant", void 0);
|
|
@@ -13290,4 +13694,4 @@ __decorate([
|
|
|
13290
13694
|
], Select.prototype, "_searchInputEl", void 0);
|
|
13291
13695
|
|
|
13292
13696
|
export { Accordion as A, Badge as B, Checkbox as C, DatePicker as D, Elevation as E, Field as F, Tabs as G, Tag as H, Icon as I, Textarea as J, TimePicker as K, LinearProgress as L, Menu as M, NumberField as N, Tooltip as O, Pagination as P, TreeNode as Q, Radio as R, SegmentedButton as S, Tab as T, TreeView as U, Avatar as a, Breadcrumb as b, BreadcrumbItem as c, Chip as d, CircularProgress as e, Container as f, Divider as g, EmptyState as h, FocusRing as i, Image as j, Input as k, Link as l, MenuItem as m, Ripple as n, SegmentedButtonGroup as o, Select as p, SelectOptionElement as q, Skeleton as r, Slider as s, Snackbar as t, Spinner as u, SubMenu as v, Switch as w, TabGroup as x, TabPanel as y, Table as z };
|
|
13293
|
-
//# sourceMappingURL=select-
|
|
13697
|
+
//# sourceMappingURL=select-4pl4XBj7.js.map
|