@redvars/peacock 3.5.1 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/dist/{BaseButton-DuASuVth.js → BaseButton-BNFAYn-S.js} +2 -2
  2. package/dist/{BaseButton-DuASuVth.js.map → BaseButton-BNFAYn-S.js.map} +1 -1
  3. package/dist/BaseInput-14YmcfK7.js +27 -0
  4. package/dist/BaseInput-14YmcfK7.js.map +1 -0
  5. package/dist/banner.js +2 -3
  6. package/dist/banner.js.map +1 -1
  7. package/dist/{button-DouvOfEU.js → button-colors-Ccys3hvS.js} +5 -294
  8. package/dist/button-colors-Ccys3hvS.js.map +1 -0
  9. package/dist/button-group.js +226 -6
  10. package/dist/button-group.js.map +1 -1
  11. package/dist/button.js +294 -8
  12. package/dist/button.js.map +1 -1
  13. package/dist/calendar-column-view.js +634 -0
  14. package/dist/calendar-column-view.js.map +1 -0
  15. package/dist/calendar-event-BrQ_SEKD.js +199 -0
  16. package/dist/calendar-event-BrQ_SEKD.js.map +1 -0
  17. package/dist/calendar-month-view.js +376 -0
  18. package/dist/calendar-month-view.js.map +1 -0
  19. package/dist/calendar.js +339 -0
  20. package/dist/calendar.js.map +1 -0
  21. package/dist/canvas.js +361 -0
  22. package/dist/canvas.js.map +1 -0
  23. package/dist/cb-compound-expression.js +125 -0
  24. package/dist/cb-compound-expression.js.map +1 -0
  25. package/dist/cb-divider.js +150 -0
  26. package/dist/cb-divider.js.map +1 -0
  27. package/dist/cb-expression.js +75 -0
  28. package/dist/cb-expression.js.map +1 -0
  29. package/dist/cb-predicate.js +137 -0
  30. package/dist/cb-predicate.js.map +1 -0
  31. package/dist/code-editor.js +2 -1
  32. package/dist/code-editor.js.map +1 -1
  33. package/dist/code-highlighter.js +1 -1
  34. package/dist/code-highlighter.js.map +1 -1
  35. package/dist/condition-builder.js +58 -0
  36. package/dist/condition-builder.js.map +1 -0
  37. package/dist/custom-elements-jsdocs.json +8479 -3965
  38. package/dist/custom-elements.json +15228 -7544
  39. package/dist/dropdown-button.js +216 -0
  40. package/dist/dropdown-button.js.map +1 -0
  41. package/dist/event-manager-D-QCmUgR.js +113 -0
  42. package/dist/event-manager-D-QCmUgR.js.map +1 -0
  43. package/dist/fab.js +1 -1
  44. package/dist/flow-designer-DvTUrDp5.js +1656 -0
  45. package/dist/flow-designer-DvTUrDp5.js.map +1 -0
  46. package/dist/flow-designer-node-BWrPuxAR.js +548 -0
  47. package/dist/flow-designer-node-BWrPuxAR.js.map +1 -0
  48. package/dist/flow-designer-node.js +4 -0
  49. package/dist/flow-designer-node.js.map +1 -0
  50. package/dist/flow-designer.js +16 -0
  51. package/dist/flow-designer.js.map +1 -0
  52. package/dist/html-editor.js +27516 -0
  53. package/dist/html-editor.js.map +1 -0
  54. package/dist/icon-button-CK1ZuE-2.js +247 -0
  55. package/dist/icon-button-CK1ZuE-2.js.map +1 -0
  56. package/dist/index.js +29 -6
  57. package/dist/index.js.map +1 -1
  58. package/dist/{is-dark-mode-DicqGkCJ.js → is-dark-mode-DOcaw4Yq.js} +2 -27
  59. package/dist/is-dark-mode-DOcaw4Yq.js.map +1 -0
  60. package/dist/modal.js +412 -0
  61. package/dist/modal.js.map +1 -0
  62. package/dist/{navigation-rail-Lxetd5-Z.js → navigation-rail-DTTkqohi.js} +1049 -2391
  63. package/dist/navigation-rail-DTTkqohi.js.map +1 -0
  64. package/dist/notification-manager.js +268 -0
  65. package/dist/notification-manager.js.map +1 -0
  66. package/dist/peacock-loader.js +93 -8
  67. package/dist/peacock-loader.js.map +1 -1
  68. package/dist/popover-NC7b1lTq.js +1971 -0
  69. package/dist/popover-NC7b1lTq.js.map +1 -0
  70. package/dist/popover-content.js +125 -0
  71. package/dist/popover-content.js.map +1 -0
  72. package/dist/popover.js +4 -0
  73. package/dist/popover.js.map +1 -0
  74. package/dist/split-button.js +388 -0
  75. package/dist/split-button.js.map +1 -0
  76. package/dist/src/__controllers/floating-controller.d.ts +35 -0
  77. package/dist/src/calendar/base-event.d.ts +10 -0
  78. package/dist/src/calendar/calendar-column-view.d.ts +41 -0
  79. package/dist/src/calendar/calendar-event.d.ts +7 -0
  80. package/dist/src/calendar/calendar-month-view.d.ts +31 -0
  81. package/dist/src/calendar/calendar.d.ts +65 -0
  82. package/dist/src/calendar/event-manager.d.ts +17 -0
  83. package/dist/src/calendar/index.d.ts +4 -0
  84. package/dist/src/calendar/types.d.ts +13 -0
  85. package/dist/src/calendar/utils.d.ts +31 -0
  86. package/dist/src/canvas/canvas.d.ts +92 -0
  87. package/dist/src/canvas/index.d.ts +2 -0
  88. package/dist/src/condition-builder/cb-compound-expression.d.ts +31 -0
  89. package/dist/src/condition-builder/cb-divider.d.ts +26 -0
  90. package/dist/src/condition-builder/cb-expression.d.ts +31 -0
  91. package/dist/src/condition-builder/cb-predicate.d.ts +30 -0
  92. package/dist/src/condition-builder/condition-builder.d.ts +27 -0
  93. package/dist/src/condition-builder/index.d.ts +5 -0
  94. package/dist/src/dropdown-button/dropdown-button.d.ts +68 -0
  95. package/dist/src/dropdown-button/index.d.ts +1 -0
  96. package/dist/src/flow-designer/commands.d.ts +66 -0
  97. package/dist/src/flow-designer/flow-designer-node.d.ts +46 -0
  98. package/dist/src/flow-designer/flow-designer.d.ts +133 -0
  99. package/dist/src/flow-designer/index.d.ts +7 -0
  100. package/dist/src/flow-designer/layout.d.ts +30 -0
  101. package/dist/src/flow-designer/types.d.ts +142 -0
  102. package/dist/src/flow-designer/validation.d.ts +43 -0
  103. package/dist/src/flow-designer/workflow-utils.d.ts +40 -0
  104. package/dist/src/html-editor/html-editor.d.ts +89 -0
  105. package/dist/src/html-editor/index.d.ts +2 -0
  106. package/dist/src/index.d.ts +15 -0
  107. package/dist/src/list/index.d.ts +2 -0
  108. package/dist/src/list/list-item.d.ts +35 -0
  109. package/dist/src/list/list.d.ts +28 -0
  110. package/dist/src/menu/menu/menu.d.ts +5 -7
  111. package/dist/src/menu/menu-item/menu-item.d.ts +14 -13
  112. package/dist/src/modal/index.d.ts +1 -0
  113. package/dist/src/modal/modal.d.ts +57 -0
  114. package/dist/src/navigation-rail/navigation-rail.d.ts +3 -7
  115. package/dist/src/notification-manager/index.d.ts +1 -0
  116. package/dist/src/notification-manager/notification-manager.d.ts +44 -0
  117. package/dist/src/number-field/number-field.d.ts +2 -2
  118. package/dist/src/popover/index.d.ts +2 -0
  119. package/dist/src/popover/popover-content.d.ts +29 -0
  120. package/dist/src/popover/popover.d.ts +62 -0
  121. package/dist/src/split-button/index.d.ts +1 -0
  122. package/dist/src/split-button/split-button.d.ts +72 -0
  123. package/dist/src/svg/index.d.ts +1 -0
  124. package/dist/src/svg/svg.d.ts +38 -0
  125. package/dist/src/toolbar/toolbar.d.ts +3 -3
  126. package/dist/src/tooltip/tooltip.d.ts +2 -15
  127. package/dist/test/flow-designer.test.d.ts +1 -0
  128. package/dist/toolbar.js +3 -3
  129. package/dist/toolbar.js.map +1 -1
  130. package/dist/tsconfig.tsbuildinfo +1 -1
  131. package/package.json +10 -2
  132. package/readme.md +3 -3
  133. package/src/__controllers/floating-controller.ts +237 -0
  134. package/src/banner/banner.scss +2 -3
  135. package/src/button/button/button.ts +1 -0
  136. package/src/calendar/base-event.ts +49 -0
  137. package/src/calendar/calendar-column-view.scss +326 -0
  138. package/src/calendar/calendar-column-view.ts +392 -0
  139. package/src/calendar/calendar-event.ts +20 -0
  140. package/src/calendar/calendar-month-view.scss +192 -0
  141. package/src/calendar/calendar-month-view.ts +244 -0
  142. package/src/calendar/calendar.scss +71 -0
  143. package/src/calendar/calendar.ts +298 -0
  144. package/src/calendar/event-manager.ts +117 -0
  145. package/src/calendar/index.ts +4 -0
  146. package/src/calendar/types.ts +14 -0
  147. package/src/calendar/utils.ts +180 -0
  148. package/src/canvas/canvas.scss +60 -0
  149. package/src/canvas/canvas.ts +391 -0
  150. package/src/canvas/index.ts +2 -0
  151. package/src/code-highlighter/code-highlighter.ts +1 -1
  152. package/src/condition-builder/cb-compound-expression.scss +37 -0
  153. package/src/condition-builder/cb-compound-expression.ts +80 -0
  154. package/src/condition-builder/cb-divider.scss +93 -0
  155. package/src/condition-builder/cb-divider.ts +56 -0
  156. package/src/condition-builder/cb-expression.scss +14 -0
  157. package/src/condition-builder/cb-expression.ts +49 -0
  158. package/src/condition-builder/cb-predicate.scss +35 -0
  159. package/src/condition-builder/cb-predicate.ts +102 -0
  160. package/src/condition-builder/condition-builder.scss +13 -0
  161. package/src/condition-builder/condition-builder.ts +38 -0
  162. package/src/condition-builder/index.ts +5 -0
  163. package/src/dropdown-button/demo/index.html +110 -0
  164. package/src/dropdown-button/dropdown-button.scss +22 -0
  165. package/src/dropdown-button/dropdown-button.ts +206 -0
  166. package/src/dropdown-button/index.ts +1 -0
  167. package/src/flow-designer/DEMO.md +239 -0
  168. package/src/flow-designer/commands.ts +278 -0
  169. package/src/flow-designer/flow-designer-node.ts +172 -0
  170. package/src/flow-designer/flow-designer.scss +457 -0
  171. package/src/flow-designer/flow-designer.ts +611 -0
  172. package/src/flow-designer/index.ts +41 -0
  173. package/src/flow-designer/layout.ts +357 -0
  174. package/src/flow-designer/types.ts +166 -0
  175. package/src/flow-designer/validation.ts +284 -0
  176. package/src/flow-designer/workflow-utils.ts +282 -0
  177. package/src/html-editor/html-editor.scss +188 -0
  178. package/src/html-editor/html-editor.ts +491 -0
  179. package/src/html-editor/index.ts +3 -0
  180. package/src/index.ts +27 -1
  181. package/src/list/index.ts +2 -0
  182. package/src/list/list-item.scss +111 -0
  183. package/src/list/list-item.ts +175 -0
  184. package/src/list/list.scss +24 -0
  185. package/src/list/list.ts +51 -0
  186. package/src/menu/menu/menu.scss +2 -2
  187. package/src/menu/menu/menu.ts +91 -101
  188. package/src/menu/menu-item/menu-item.scss +4 -0
  189. package/src/menu/menu-item/menu-item.ts +82 -78
  190. package/src/modal/index.ts +1 -0
  191. package/src/modal/modal.scss +206 -0
  192. package/src/modal/modal.ts +195 -0
  193. package/src/navigation-rail/navigation-rail-item.scss +7 -38
  194. package/src/navigation-rail/navigation-rail-item.ts +1 -2
  195. package/src/navigation-rail/navigation-rail.scss +17 -21
  196. package/src/navigation-rail/navigation-rail.ts +6 -9
  197. package/src/notification-manager/index.ts +1 -0
  198. package/src/notification-manager/notification-manager.scss +113 -0
  199. package/src/notification-manager/notification-manager.ts +199 -0
  200. package/src/number-field/number-field.ts +2 -2
  201. package/src/peacock-loader.ts +83 -0
  202. package/src/popover/index.ts +2 -0
  203. package/src/popover/popover-content.scss +69 -0
  204. package/src/popover/popover-content.ts +51 -0
  205. package/src/popover/popover.scss +7 -0
  206. package/src/popover/popover.ts +170 -0
  207. package/src/split-button/index.ts +1 -0
  208. package/src/split-button/split-button-colors.scss +56 -0
  209. package/src/split-button/split-button-sizes.scss +28 -0
  210. package/src/split-button/split-button.scss +79 -0
  211. package/src/split-button/split-button.ts +236 -0
  212. package/src/svg/index.ts +1 -0
  213. package/src/svg/svg.scss +91 -0
  214. package/src/svg/svg.ts +160 -0
  215. package/src/table/table.ts +2 -2
  216. package/src/toolbar/toolbar.ts +3 -3
  217. package/src/tooltip/tooltip.scss +4 -3
  218. package/src/tooltip/tooltip.ts +46 -104
  219. package/dist/button-DouvOfEU.js.map +0 -1
  220. package/dist/button-group-CEdMwvJJ.js +0 -464
  221. package/dist/button-group-CEdMwvJJ.js.map +0 -1
  222. package/dist/is-dark-mode-DicqGkCJ.js.map +0 -1
  223. package/dist/navigation-rail-Lxetd5-Z.js.map +0 -1
  224. package/dist/src/menu/menu/MenuSurfaceController.d.ts +0 -18
  225. package/src/menu/menu/MenuSurfaceController.ts +0 -61
@@ -1,276 +1,26 @@
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
+ import { e as e$1 } from './class-map-YU7g0o3B.js';
3
4
  import { r } from './state-DwbEjqVk.js';
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
5
  import { o as observerSlotChangesWithCallback } from './observe-slot-change-BGJfgg2E.js';
8
- import { a as e, e as e$4 } from './query-QBcUV-L_.js';
6
+ import { a as e, e as e$2 } from './query-QBcUV-L_.js';
9
7
  import { B as BaseHyperlinkMixin, t as throttle } from './BaseHyperlinkMixin-BNuwbiEf.js';
10
- import { o as o$2 } from './style-map-DVmWOuYy.js';
8
+ import { o as o$1 } from './style-map-DVmWOuYy.js';
11
9
  import { r as redispatchEvent, i as isActivationClick, d as dispatchActivationClick } from './dispatch-event-utils-CuEqjlPT.js';
12
- import { s as spread, o as o$3 } from './BaseButton-DuASuVth.js';
13
- import { B as BaseInput, i as isDarkMode, o as observeThemeChange } from './is-dark-mode-DicqGkCJ.js';
10
+ import { s as spread, o as o$2, a as BaseButtonMixin } from './BaseButton-BNFAYn-S.js';
11
+ import { B as BaseInput } from './BaseInput-14YmcfK7.js';
12
+ import { F as FloatingController } from './popover-NC7b1lTq.js';
13
+ import { i as isDarkMode, o as observeThemeChange } from './is-dark-mode-DOcaw4Yq.js';
14
+ import { f as fetchSVG, s as sanitizeSvg, o as o$3 } from './flow-designer-DvTUrDp5.js';
15
+ import { o as o$4 } from './unsafe-html-BsGUjx94.js';
14
16
 
15
17
  /**
16
18
  * @license
17
19
  * Copyright 2021 Google LLC
18
20
  * SPDX-License-Identifier: BSD-3-Clause
19
- */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))}})}}
21
+ */function o(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))}})}}
20
22
 
21
- /**
22
- * @license
23
- * Copyright 2017 Google LLC
24
- * SPDX-License-Identifier: BSD-3-Clause
25
- */class t extends e$2{}t.directiveName="unsafeSVG",t.resultType=2;const o=e$1(t);
26
-
27
- // Basic sanitization: remove <script>, <foreignObject>, event handler attributes (on*), and iframes
28
- function sanitizeSvg(rawSvg) {
29
- try {
30
- const parser = new DOMParser();
31
- const doc = parser.parseFromString(rawSvg, 'image/svg+xml');
32
- const scripts = Array.from(doc.querySelectorAll('script'));
33
- scripts.forEach(n => n.remove());
34
- const foreigns = Array.from(doc.querySelectorAll('foreignObject, iframe'));
35
- foreigns.forEach(n => n.remove());
36
- const all = Array.from(doc.querySelectorAll('*'));
37
- all.forEach(el => {
38
- const attrs = Array.from(el.attributes).filter(a => /^on/i.test(a.name));
39
- attrs.forEach(a => el.removeAttribute(a.name));
40
- });
41
- const el = doc.documentElement;
42
- if (!el)
43
- return '';
44
- const serializer = new XMLSerializer();
45
- return serializer.serializeToString(el);
46
- }
47
- catch (e) {
48
- return '';
49
- }
50
- }
51
-
52
- async function createCacheFetch(name) {
53
- let cache = null;
54
- // This map tracks requests currently being processed
55
- const inFlightRequests = new Map();
56
- try {
57
- cache = await window.caches.open(name);
58
- }
59
- catch (e) {
60
- console.warn('window.caches access not allowed');
61
- }
62
- return async (url) => {
63
- if (inFlightRequests.has(url)) {
64
- return inFlightRequests.get(url);
65
- }
66
- const fetchPromise = (async () => {
67
- const request = new Request(url);
68
- if (cache) {
69
- const cachedResponse = await cache.match(request);
70
- if (cachedResponse) {
71
- return cachedResponse.text();
72
- }
73
- }
74
- const urlObj = new URL(request.url);
75
- const isSameOrigin = urlObj.origin === window.location.origin;
76
- const response = await fetch(request.url, {
77
- method: 'GET',
78
- mode: isSameOrigin ? 'no-cors' : 'cors',
79
- credentials: isSameOrigin ? 'same-origin' : 'omit',
80
- });
81
- if (response.status === 404) {
82
- console.error(`[Fetch Error] Resource not found (404): ${url}`);
83
- return '';
84
- }
85
- const result = await response.text();
86
- if (cache && response.status === 200) {
87
- await cache.put(request, new Response(result, {
88
- status: response.status,
89
- statusText: response.statusText,
90
- headers: response.headers,
91
- }));
92
- }
93
- return result;
94
- })();
95
- inFlightRequests.set(url, fetchPromise);
96
- try {
97
- return await fetchPromise;
98
- }
99
- finally {
100
- inFlightRequests.delete(url);
101
- }
102
- };
103
- }
104
-
105
- const PROVIDERS = {
106
- 'material-symbols': (name) => `https://cdn.jsdelivr.net/npm/@material-symbols/svg-500@0.40.1/outlined/${name}.svg`,
107
- carbon: (name) => `https://cdn.jsdelivr.net/npm/@carbon/icons@11.41.0/svg/32/${name}.svg`,
108
- };
109
- const cacheFetch = await createCacheFetch('svg-cache');
110
- async function fetchSVG(url) {
111
- if (!url)
112
- return '';
113
- return cacheFetch(url);
114
- }
115
- async function fetchIcon(name, provider = 'material-symbols') {
116
- if (!name)
117
- return '';
118
- if (!PROVIDERS[provider]) {
119
- throw new Error(`Provider '${provider}' not found`);
120
- }
121
- return fetchSVG(PROVIDERS[provider](name));
122
- }
123
-
124
- var css_248z$S = i`* {
125
- box-sizing: border-box;
126
- }
127
-
128
- .screen-reader-only {
129
- display: none !important;
130
- }
131
-
132
- :host {
133
- display: inline-flex;
134
- vertical-align: middle;
135
- --icon-size: inherit;
136
- --icon-color: inherit;
137
- }
138
-
139
- .icon {
140
- height: var(--icon-size, 1rem);
141
- width: var(--icon-size, 1rem);
142
- display: inline-flex;
143
- align-items: center;
144
- justify-content: center;
145
- }
146
- .icon svg {
147
- fill: var(--icon-color);
148
- height: 100%;
149
- width: 100%;
150
- }`;
151
-
152
- /**
153
- * @label Icon
154
- * @tag wc-icon
155
- * @rawTag icon
156
- * @summary Icons are visual symbols used to represent ideas, objects, or actions.
157
- * @overview Icons are visual symbols used to represent ideas, objects, or actions. They communicate messages at a glance, afford interactivity, and draw attention to important information.
158
- *
159
- * @cssprop --icon-color - Controls the color of the icon.
160
- * @cssprop [--icon-size=1rem] - Controls the size of the icon. Defaults to "1rem"
161
- *
162
- * @example
163
- * ```html
164
- * <wc-icon name="home" style="--icon-size: 2rem;"></wc-icon>
165
- * ```
166
- *
167
- */
168
- class Icon extends i$1 {
169
- constructor() {
170
- super(...arguments);
171
- this.provider = 'material-symbols';
172
- this.svgContent = '';
173
- // loading + error states for consumers/tests
174
- this.loading = false;
175
- this.error = null;
176
- // token to avoid race conditions when multiple fetches overlap
177
- this._fetchId = 0;
178
- }
179
- firstUpdated() {
180
- // perform initial fetch once component is connected and rendered
181
- this.__scheduleUpdate();
182
- }
183
- updated(changedProperties) {
184
- // only refetch when name or src changed
185
- if (changedProperties.has('name') || changedProperties.has('src')) {
186
- this.__scheduleUpdate();
187
- }
188
- }
189
- render() {
190
- // accessible wrapper; consumers can provide a fallback via <slot name="fallback">.
191
- return b ` <div class="icon">
192
- ${this.svgContent
193
- ? o(this.svgContent)
194
- : b `<slot name="fallback"></slot>`}
195
- </div>`;
196
- }
197
- // small debounce to coalesce rapid changes (50ms)
198
- __scheduleUpdate() {
199
- if (this._debounceTimer) {
200
- clearTimeout(this._debounceTimer);
201
- }
202
- // @ts-ignore - setTimeout in DOM returns number
203
- this._debounceTimer = window.setTimeout(() => this.__updateSvg(), 50);
204
- }
205
- /**
206
- * @internal
207
- */
208
- async __updateSvg() {
209
- this._fetchId += 1;
210
- const currentId = this._fetchId;
211
- this.loading = true;
212
- this.error = null;
213
- try {
214
- let raw;
215
- if (this.name) {
216
- raw = await fetchIcon(this.name, this.provider);
217
- }
218
- else if (this.src) {
219
- raw = await fetchSVG(this.src);
220
- }
221
- else {
222
- raw = '';
223
- }
224
- // If another fetch started after this one, ignore this result
225
- if (currentId !== this._fetchId)
226
- return;
227
- if (raw) {
228
- this.svgContent = sanitizeSvg(raw);
229
- }
230
- else {
231
- this.svgContent = '';
232
- }
233
- }
234
- catch (err) {
235
- // capture and surface error, but avoid throwing
236
- this.error = err instanceof Error ? err : new Error(String(err));
237
- this.svgContent = '';
238
- // bubble an event so consumers can react
239
- this.dispatchEvent(new CustomEvent('icon-error', {
240
- detail: { name: this.name, src: this.src, error: this.error },
241
- bubbles: true,
242
- composed: true,
243
- }));
244
- }
245
- finally {
246
- // ensure loading is cleared unless another fetch started
247
- if (currentId === this._fetchId) {
248
- this.loading = false;
249
- }
250
- }
251
- }
252
- }
253
- Icon.styles = [css_248z$S];
254
- __decorate([
255
- n({ type: String, reflect: true })
256
- ], Icon.prototype, "name", void 0);
257
- __decorate([
258
- n({ type: String, reflect: true })
259
- ], Icon.prototype, "src", void 0);
260
- __decorate([
261
- n({ type: String })
262
- ], Icon.prototype, "provider", void 0);
263
- __decorate([
264
- r()
265
- ], Icon.prototype, "svgContent", void 0);
266
- __decorate([
267
- r() // @ts-ignore
268
- ], Icon.prototype, "loading", void 0);
269
- __decorate([
270
- r()
271
- ], Icon.prototype, "error", void 0);
272
-
273
- var css_248z$R = i`* {
23
+ var css_248z$U = i`* {
274
24
  box-sizing: border-box;
275
25
  }
276
26
 
@@ -344,7 +94,7 @@ class Avatar extends i$1 {
344
94
  render() {
345
95
  return b `<div class="avatar-container">
346
96
  <div
347
- class=${e$3({
97
+ class=${e$1({
348
98
  avatar: true,
349
99
  initials: !this.src,
350
100
  image: !!this.src,
@@ -361,7 +111,7 @@ class Avatar extends i$1 {
361
111
  return `${first.charAt(0)}${last.charAt(0)}`.toUpperCase();
362
112
  }
363
113
  }
364
- Avatar.styles = [css_248z$R];
114
+ Avatar.styles = [css_248z$U];
365
115
  __decorate([
366
116
  n({ type: String, reflect: true })
367
117
  ], Avatar.prototype, "name", void 0);
@@ -369,7 +119,7 @@ __decorate([
369
119
  n({ type: String, reflect: true })
370
120
  ], Avatar.prototype, "src", void 0);
371
121
 
372
- var css_248z$Q = i`* {
122
+ var css_248z$T = i`* {
373
123
  box-sizing: border-box;
374
124
  }
375
125
 
@@ -432,7 +182,7 @@ class Badge extends i$1 {
432
182
  }
433
183
  render() {
434
184
  return b `<div
435
- class=${e$3({
185
+ class=${e$1({
436
186
  badge: true,
437
187
  'has-value': !!this.value,
438
188
  })}
@@ -441,12 +191,12 @@ class Badge extends i$1 {
441
191
  </div>`;
442
192
  }
443
193
  }
444
- Badge.styles = [css_248z$Q];
194
+ Badge.styles = [css_248z$T];
445
195
  __decorate([
446
196
  n({ type: String })
447
197
  ], Badge.prototype, "value", void 0);
448
198
 
449
- var css_248z$P = i`* {
199
+ var css_248z$S = i`* {
450
200
  box-sizing: border-box;
451
201
  }
452
202
 
@@ -541,7 +291,7 @@ class Divider extends i$1 {
541
291
  }
542
292
  render() {
543
293
  return b `<div
544
- class=${e$3({
294
+ class=${e$1({
545
295
  divider: true,
546
296
  vertical: this.vertical,
547
297
  'slot-has-content': this.slotHasContent,
@@ -555,7 +305,7 @@ class Divider extends i$1 {
555
305
  </div>`;
556
306
  }
557
307
  }
558
- Divider.styles = [css_248z$P];
308
+ Divider.styles = [css_248z$S];
559
309
  __decorate([
560
310
  n({ type: Boolean, reflect: true })
561
311
  ], Divider.prototype, "vertical", void 0);
@@ -563,7 +313,7 @@ __decorate([
563
313
  r()
564
314
  ], Divider.prototype, "slotHasContent", void 0);
565
315
 
566
- var css_248z$O = i`* {
316
+ var css_248z$R = i`* {
567
317
  box-sizing: border-box;
568
318
  }
569
319
 
@@ -644,9 +394,9 @@ class Elevation extends i$1 {
644
394
  return b `<span class="shadow"></span>`;
645
395
  }
646
396
  }
647
- Elevation.styles = [css_248z$O];
397
+ Elevation.styles = [css_248z$R];
648
398
 
649
- var css_248z$N = i`* {
399
+ var css_248z$Q = i`* {
650
400
  box-sizing: border-box;
651
401
  }
652
402
 
@@ -874,7 +624,7 @@ class SegmentedButton extends i$1 {
874
624
  };
875
625
  return b `
876
626
  <div
877
- class=${e$3(cssClasses)}
627
+ class=${e$1(cssClasses)}
878
628
  role="button"
879
629
  tabindex=${this.disabled ? -1 : 0}
880
630
  aria-pressed=${this.selected}
@@ -899,7 +649,7 @@ class SegmentedButton extends i$1 {
899
649
  `;
900
650
  }
901
651
  }
902
- SegmentedButton.styles = [css_248z$N];
652
+ SegmentedButton.styles = [css_248z$Q];
903
653
  __decorate([
904
654
  n({ type: String, reflect: true })
905
655
  ], SegmentedButton.prototype, "value", void 0);
@@ -919,7 +669,7 @@ __decorate([
919
669
  r()
920
670
  ], SegmentedButton.prototype, "isActive", void 0);
921
671
 
922
- var css_248z$M = i`* {
672
+ var css_248z$P = i`* {
923
673
  box-sizing: border-box;
924
674
  }
925
675
 
@@ -1031,7 +781,7 @@ class SegmentedButtonGroup extends i$1 {
1031
781
  `;
1032
782
  }
1033
783
  }
1034
- SegmentedButtonGroup.styles = [css_248z$M];
784
+ SegmentedButtonGroup.styles = [css_248z$P];
1035
785
  SegmentedButtonGroup.SegmentedButton = SegmentedButton;
1036
786
  __decorate([
1037
787
  n({ type: Boolean, reflect: true, attribute: 'multi-select' })
@@ -1040,7 +790,7 @@ __decorate([
1040
790
  n({ type: Boolean, reflect: true })
1041
791
  ], SegmentedButtonGroup.prototype, "nullable", void 0);
1042
792
 
1043
- var css_248z$L = i`:host {
793
+ var css_248z$O = i`:host {
1044
794
  display: none;
1045
795
  pointer-events: none;
1046
796
  position: absolute;
@@ -1158,7 +908,7 @@ class FocusRing extends i$1 {
1158
908
  }
1159
909
  }
1160
910
  }
1161
- FocusRing.styles = [css_248z$L];
911
+ FocusRing.styles = [css_248z$O];
1162
912
  __decorate([
1163
913
  n({ type: Boolean, reflect: true })
1164
914
  ], FocusRing.prototype, "visible", void 0);
@@ -1320,7 +1070,7 @@ class Ripple extends i$1 {
1320
1070
  'hovered': this.hovered,
1321
1071
  'pressed': this.pressed,
1322
1072
  };
1323
- return b `<div class="surface ${e$3(classes)}"></div>`;
1073
+ return b `<div class="surface ${e$1(classes)}"></div>`;
1324
1074
  }
1325
1075
  update(changedProps) {
1326
1076
  if (changedProps.has('disabled') && this.disabled) {
@@ -1632,10 +1382,10 @@ __decorate([
1632
1382
  r()
1633
1383
  ], Ripple.prototype, "pressed", void 0);
1634
1384
  __decorate([
1635
- e$4('.surface')
1385
+ e$2('.surface')
1636
1386
  ], Ripple.prototype, "mdRoot", void 0);
1637
1387
 
1638
- var css_248z$K = i`* {
1388
+ var css_248z$N = i`* {
1639
1389
  box-sizing: border-box;
1640
1390
  }
1641
1391
 
@@ -1876,7 +1626,7 @@ class AccordionItem extends i$1 {
1876
1626
  render() {
1877
1627
  return b `
1878
1628
  <div
1879
- class=${e$3({
1629
+ class=${e$1({
1880
1630
  'expansion-panel': true,
1881
1631
  open: this.open,
1882
1632
  disabled: this.disabled,
@@ -1931,7 +1681,7 @@ class AccordionItem extends i$1 {
1931
1681
  }
1932
1682
  }
1933
1683
  _AccordionItem_id = new WeakMap();
1934
- AccordionItem.styles = [css_248z$K];
1684
+ AccordionItem.styles = [css_248z$N];
1935
1685
  __decorate([
1936
1686
  n({ type: Boolean, reflect: true })
1937
1687
  ], AccordionItem.prototype, "disabled", void 0);
@@ -1951,10 +1701,10 @@ __decorate([
1951
1701
  r()
1952
1702
  ], AccordionItem.prototype, "_hasHeadingSlot", void 0);
1953
1703
  __decorate([
1954
- e$4('.header-button')
1704
+ e$2('.header-button')
1955
1705
  ], AccordionItem.prototype, "buttonElement", void 0);
1956
1706
 
1957
- var css_248z$J = i`* {
1707
+ var css_248z$M = i`* {
1958
1708
  box-sizing: border-box;
1959
1709
  }
1960
1710
 
@@ -2082,7 +1832,7 @@ class Accordion extends i$1 {
2082
1832
  return b `<div class="accordion"><slot></slot></div>`;
2083
1833
  }
2084
1834
  }
2085
- Accordion.styles = [css_248z$J];
1835
+ Accordion.styles = [css_248z$M];
2086
1836
  Accordion.Item = AccordionItem;
2087
1837
  __decorate([
2088
1838
  n({ type: Boolean, reflect: true })
@@ -2091,10 +1841,10 @@ __decorate([
2091
1841
  n({ type: String, reflect: true, attribute: 'display-mode' })
2092
1842
  ], Accordion.prototype, "displayMode", void 0);
2093
1843
  __decorate([
2094
- o$1({ selector: 'wc-accordion-item' })
1844
+ o({ selector: 'wc-accordion-item' })
2095
1845
  ], Accordion.prototype, "items", void 0);
2096
1846
 
2097
- var css_248z$I = i`* {
1847
+ var css_248z$L = i`* {
2098
1848
  box-sizing: border-box;
2099
1849
  }
2100
1850
 
@@ -2147,7 +1897,7 @@ var css_248z$I = i`* {
2147
1897
  class Link extends BaseHyperlinkMixin(i$1) {
2148
1898
  render() {
2149
1899
  return b `<a
2150
- class=${e$3({
1900
+ class=${e$1({
2151
1901
  link: true,
2152
1902
  })}
2153
1903
  href=${this.href}
@@ -2158,9 +1908,9 @@ class Link extends BaseHyperlinkMixin(i$1) {
2158
1908
  </a>`;
2159
1909
  }
2160
1910
  }
2161
- Link.styles = [css_248z$I];
1911
+ Link.styles = [css_248z$L];
2162
1912
 
2163
- var css_248z$H = i`* {
1913
+ var css_248z$K = i`* {
2164
1914
  box-sizing: border-box;
2165
1915
  }
2166
1916
 
@@ -2297,7 +2047,7 @@ slot::slotted(*) {
2297
2047
  --_container-state-opacity: 0.08;
2298
2048
  }`;
2299
2049
 
2300
- var css_248z$G = i`:host([color=default]) {
2050
+ var css_248z$J = i`:host([color=default]) {
2301
2051
  --filled-tag-container-color: var(--color-surface);
2302
2052
  --filled-tag-label-text-color: var(--color-on-surface);
2303
2053
  --tonal-tag-container-color: var(--color-surface-container);
@@ -2363,7 +2113,7 @@ var css_248z$G = i`:host([color=default]) {
2363
2113
  --outlined-tag-label-text-color: var(--color-purple);
2364
2114
  }`;
2365
2115
 
2366
- var css_248z$F = i`.tag {
2116
+ var css_248z$I = i`.tag {
2367
2117
  font-family: var(--font-family-sans) !important;
2368
2118
  }
2369
2119
 
@@ -2443,7 +2193,7 @@ class Tag extends i$1 {
2443
2193
  [`size-${this.size}`]: true,
2444
2194
  };
2445
2195
  return b `
2446
- <div class="${e$3(classes)}">
2196
+ <div class="${e$1(classes)}">
2447
2197
  <wc-elevation class="elevation"></wc-elevation>
2448
2198
  <div class="background"></div>
2449
2199
  <div class="outline"></div>
@@ -2462,7 +2212,7 @@ class Tag extends i$1 {
2462
2212
  }
2463
2213
  // Define styles (Lit handles Scoping via Shadow DOM by default)
2464
2214
  // You would typically import your tag.scss.js here or use the css tag
2465
- Tag.styles = [css_248z$H, css_248z$G, css_248z$F];
2215
+ Tag.styles = [css_248z$K, css_248z$J, css_248z$I];
2466
2216
  __decorate([
2467
2217
  n({ type: Boolean })
2468
2218
  ], Tag.prototype, "dismissible", void 0);
@@ -2476,7 +2226,7 @@ __decorate([
2476
2226
  n()
2477
2227
  ], Tag.prototype, "size", void 0);
2478
2228
 
2479
- var css_248z$E = i`* {
2229
+ var css_248z$H = i`* {
2480
2230
  box-sizing: border-box;
2481
2231
  }
2482
2232
 
@@ -2588,7 +2338,7 @@ var css_248z$E = i`* {
2588
2338
  color: var(--background);
2589
2339
  }`;
2590
2340
 
2591
- var css_248z$D = i`:host([color=red]) {
2341
+ var css_248z$G = i`:host([color=red]) {
2592
2342
  --chip-container-color: var(--color-red-container);
2593
2343
  --chip-outline-color: var(--color-on-red-container);
2594
2344
  }
@@ -2617,7 +2367,7 @@ var css_248z$D = i`:host([color=red]) {
2617
2367
  --chip-outline-color: var(--color-on-purple-container);
2618
2368
  }`;
2619
2369
 
2620
- var css_248z$C = i`.tag {
2370
+ var css_248z$F = i`.tag {
2621
2371
  font-family: var(--font-family-sans) !important;
2622
2372
  }
2623
2373
 
@@ -2739,7 +2489,7 @@ class Chip extends i$1 {
2739
2489
  [`color-${this.color}`]: true,
2740
2490
  };
2741
2491
  return b `
2742
- <div class="${e$3(classes)}">
2492
+ <div class="${e$1(classes)}">
2743
2493
  <wc-elevation class="elevation"></wc-elevation>
2744
2494
  <div class="background"></div>
2745
2495
  <div class="outline"></div>
@@ -2755,7 +2505,7 @@ class Chip extends i$1 {
2755
2505
  }
2756
2506
  // Define styles (Lit handles Scoping via Shadow DOM by default)
2757
2507
  // You would typically import your tag.scss.js here or use the css tag
2758
- Chip.styles = [css_248z$E, css_248z$D, css_248z$C];
2508
+ Chip.styles = [css_248z$H, css_248z$G, css_248z$F];
2759
2509
  __decorate([
2760
2510
  n({ type: Boolean })
2761
2511
  ], Chip.prototype, "dismissible", void 0);
@@ -2772,7 +2522,7 @@ __decorate([
2772
2522
  n({ type: String })
2773
2523
  ], Chip.prototype, "imageSrc", void 0);
2774
2524
 
2775
- var css_248z$B = i`:host {
2525
+ var css_248z$E = i`:host {
2776
2526
  display: block;
2777
2527
  --progress-height: 0.25rem;
2778
2528
  --progress-container-color: var(--color-primary);
@@ -2938,7 +2688,7 @@ class LinearProgress extends BaseProgress {
2938
2688
  render() {
2939
2689
  return b `
2940
2690
  <div
2941
- class="${e$3({
2691
+ class="${e$1({
2942
2692
  'linear-progress': true,
2943
2693
  indeterminate: this.indeterminate,
2944
2694
  inline: this.inline,
@@ -2962,7 +2712,7 @@ class LinearProgress extends BaseProgress {
2962
2712
  <div class="track track-start"></div>
2963
2713
  <div
2964
2714
  class="active-indicator"
2965
- style="${o$2({
2715
+ style="${o$1({
2966
2716
  width: `${this.__getPercentageValue()}%`,
2967
2717
  })}"
2968
2718
  ></div>
@@ -2978,9 +2728,9 @@ class LinearProgress extends BaseProgress {
2978
2728
  }
2979
2729
  }
2980
2730
  // Lit components use static styles for better performance
2981
- LinearProgress.styles = [css_248z$B];
2731
+ LinearProgress.styles = [css_248z$E];
2982
2732
 
2983
- var css_248z$A = i`:host {
2733
+ var css_248z$D = i`:host {
2984
2734
  display: inline-block;
2985
2735
  --progress-height: 1.5rem;
2986
2736
  --progress-line-thickness: 4px;
@@ -3103,7 +2853,7 @@ class CircularProgress extends BaseProgress {
3103
2853
  const offset = circumference - (percentage / 100) * circumference;
3104
2854
  return b `
3105
2855
  <div
3106
- class="${e$3({
2856
+ class="${e$1({
3107
2857
  'circular-progress': true,
3108
2858
  indeterminate: this.indeterminate,
3109
2859
  inline: this.inline,
@@ -3122,7 +2872,7 @@ class CircularProgress extends BaseProgress {
3122
2872
  cx="8"
3123
2873
  cy="8"
3124
2874
  r="6"
3125
- style="${o$2({
2875
+ style="${o$1({
3126
2876
  strokeDasharray: `${circumference}`,
3127
2877
  strokeDashoffset: this.indeterminate ? undefined : `${offset}`,
3128
2878
  })}"
@@ -3143,9 +2893,9 @@ class CircularProgress extends BaseProgress {
3143
2893
  }
3144
2894
  }
3145
2895
  // Lit components use static styles for better performance
3146
- CircularProgress.styles = [css_248z$A];
2896
+ CircularProgress.styles = [css_248z$D];
3147
2897
 
3148
- var css_248z$z = i`* {
2898
+ var css_248z$C = i`* {
3149
2899
  box-sizing: border-box;
3150
2900
  }
3151
2901
 
@@ -3249,12 +2999,12 @@ class Skeleton extends i$1 {
3249
2999
  return b ` <div class="skeleton"></div>`;
3250
3000
  }
3251
3001
  }
3252
- Skeleton.styles = [css_248z$z];
3002
+ Skeleton.styles = [css_248z$C];
3253
3003
  __decorate([
3254
3004
  n({ type: Boolean, reflect: true })
3255
3005
  ], Skeleton.prototype, "visible", void 0);
3256
3006
 
3257
- var css_248z$y = i`* {
3007
+ var css_248z$B = i`* {
3258
3008
  box-sizing: border-box;
3259
3009
  }
3260
3010
 
@@ -3429,7 +3179,7 @@ class Input extends BaseInput {
3429
3179
  `;
3430
3180
  }
3431
3181
  }
3432
- Input.styles = [css_248z$y];
3182
+ Input.styles = [css_248z$B];
3433
3183
  __decorate([
3434
3184
  n({ type: String })
3435
3185
  ], Input.prototype, "value", void 0);
@@ -3485,10 +3235,10 @@ __decorate([
3485
3235
  r()
3486
3236
  ], Input.prototype, "dirty", void 0);
3487
3237
  __decorate([
3488
- e$4('.input-element')
3238
+ e$2('.input-element')
3489
3239
  ], Input.prototype, "inputElement", void 0);
3490
3240
 
3491
- var css_248z$x = i`* {
3241
+ var css_248z$A = i`* {
3492
3242
  box-sizing: border-box;
3493
3243
  }
3494
3244
 
@@ -3721,7 +3471,7 @@ class UrlField extends BaseInput {
3721
3471
  `;
3722
3472
  }
3723
3473
  }
3724
- UrlField.styles = [css_248z$x];
3474
+ UrlField.styles = [css_248z$A];
3725
3475
  __decorate([
3726
3476
  n({ type: String })
3727
3477
  ], UrlField.prototype, "value", void 0);
@@ -3768,10 +3518,10 @@ __decorate([
3768
3518
  r()
3769
3519
  ], UrlField.prototype, "isValid", void 0);
3770
3520
  __decorate([
3771
- e$4('.url-input')
3521
+ e$2('.url-input')
3772
3522
  ], UrlField.prototype, "inputElement", void 0);
3773
3523
 
3774
- var css_248z$w = i`* {
3524
+ var css_248z$z = i`* {
3775
3525
  box-sizing: border-box;
3776
3526
  }
3777
3527
 
@@ -4079,7 +3829,7 @@ class Field extends i$1 {
4079
3829
  populated: this.populated,
4080
3830
  };
4081
3831
  return b `
4082
- <div class=${e$3(classes)}>
3832
+ <div class=${e$1(classes)}>
4083
3833
  ${this.__renderFieldHeader()}
4084
3834
 
4085
3835
  <div class="field-body" @click=${this.__handleClick}>
@@ -4089,7 +3839,7 @@ class Field extends i$1 {
4089
3839
 
4090
3840
  <div class="field-content">
4091
3841
  <div
4092
- class=${e$3({
3842
+ class=${e$1({
4093
3843
  'slot-start-wrapper': true,
4094
3844
  'has-content': this.slotStartHasContent,
4095
3845
  })}
@@ -4100,7 +3850,7 @@ class Field extends i$1 {
4100
3850
  <div class="input-wrapper">${this.__renderInputSlot()}</div>
4101
3851
 
4102
3852
  <div
4103
- class=${e$3({
3853
+ class=${e$1({
4104
3854
  'slot-end-wrapper': true,
4105
3855
  'has-content': this.slotEndHasContent,
4106
3856
  })}
@@ -4139,7 +3889,7 @@ class Field extends i$1 {
4139
3889
  return b `<div class="text-count">${this.textCount}</div>`;
4140
3890
  }
4141
3891
  }
4142
- Field.styles = [css_248z$w];
3892
+ Field.styles = [css_248z$z];
4143
3893
  __decorate([
4144
3894
  n({ type: String })
4145
3895
  ], Field.prototype, "label", void 0);
@@ -4195,7 +3945,7 @@ __decorate([
4195
3945
  r()
4196
3946
  ], Field.prototype, "slotEndHasContent", void 0);
4197
3947
 
4198
- var css_248z$v = i`* {
3948
+ var css_248z$y = i`* {
4199
3949
  box-sizing: border-box;
4200
3950
  }
4201
3951
 
@@ -4243,8 +3993,8 @@ var css_248z$v = i`* {
4243
3993
  var _NumberField_id;
4244
3994
  /**
4245
3995
  * @label Number Field
4246
- * @tag number-field
4247
- * @rawTag number
3996
+ * @tag wc-number-field
3997
+ * @rawTag number-field
4248
3998
  *
4249
3999
  * @summary The Number Field component is used to capture numeric user input.
4250
4000
  *
@@ -4341,7 +4091,7 @@ class NumberField extends BaseInput {
4341
4091
  label=${this.label}
4342
4092
  ?focused=${this.focused}
4343
4093
  .host=${this}
4344
- class=${e$3(classes)}
4094
+ class=${e$1(classes)}
4345
4095
  >
4346
4096
  ${this.stepper && !this.disabled
4347
4097
  ? b `<wc-icon-button
@@ -4394,7 +4144,7 @@ class NumberField extends BaseInput {
4394
4144
  }
4395
4145
  }
4396
4146
  _NumberField_id = new WeakMap();
4397
- NumberField.styles = [css_248z$v];
4147
+ NumberField.styles = [css_248z$y];
4398
4148
  __decorate([
4399
4149
  n({ type: Number })
4400
4150
  ], NumberField.prototype, "value", void 0);
@@ -4453,10 +4203,10 @@ __decorate([
4453
4203
  r()
4454
4204
  ], NumberField.prototype, "dirty", void 0);
4455
4205
  __decorate([
4456
- e$4('.input-element')
4206
+ e$2('.input-element')
4457
4207
  ], NumberField.prototype, "inputElement", void 0);
4458
4208
 
4459
- var css_248z$u = i`* {
4209
+ var css_248z$x = i`* {
4460
4210
  box-sizing: border-box;
4461
4211
  }
4462
4212
 
@@ -4623,7 +4373,7 @@ class DatePicker extends BaseInput {
4623
4373
  `;
4624
4374
  }
4625
4375
  }
4626
- DatePicker.styles = [css_248z$u];
4376
+ DatePicker.styles = [css_248z$x];
4627
4377
  __decorate([
4628
4378
  n({ type: String })
4629
4379
  ], DatePicker.prototype, "value", void 0);
@@ -4676,10 +4426,10 @@ __decorate([
4676
4426
  r()
4677
4427
  ], DatePicker.prototype, "dirty", void 0);
4678
4428
  __decorate([
4679
- e$4('.input-element')
4429
+ e$2('.input-element')
4680
4430
  ], DatePicker.prototype, "inputElement", void 0);
4681
4431
 
4682
- var css_248z$t = i`* {
4432
+ var css_248z$w = i`* {
4683
4433
  box-sizing: border-box;
4684
4434
  }
4685
4435
 
@@ -4846,7 +4596,7 @@ class TimePicker extends BaseInput {
4846
4596
  `;
4847
4597
  }
4848
4598
  }
4849
- TimePicker.styles = [css_248z$t];
4599
+ TimePicker.styles = [css_248z$w];
4850
4600
  __decorate([
4851
4601
  n({ type: String })
4852
4602
  ], TimePicker.prototype, "value", void 0);
@@ -4899,10 +4649,10 @@ __decorate([
4899
4649
  r()
4900
4650
  ], TimePicker.prototype, "dirty", void 0);
4901
4651
  __decorate([
4902
- e$4('.input-element')
4652
+ e$2('.input-element')
4903
4653
  ], TimePicker.prototype, "inputElement", void 0);
4904
4654
 
4905
- var css_248z$s = i`* {
4655
+ var css_248z$v = i`* {
4906
4656
  box-sizing: border-box;
4907
4657
  }
4908
4658
 
@@ -5062,7 +4812,7 @@ class Textarea extends BaseInput {
5062
4812
  `;
5063
4813
  }
5064
4814
  }
5065
- Textarea.styles = [css_248z$s];
4815
+ Textarea.styles = [css_248z$v];
5066
4816
  __decorate([
5067
4817
  n({ type: String })
5068
4818
  ], Textarea.prototype, "value", void 0);
@@ -5118,10 +4868,10 @@ __decorate([
5118
4868
  r()
5119
4869
  ], Textarea.prototype, "dirty", void 0);
5120
4870
  __decorate([
5121
- e$4('.input-element')
4871
+ e$2('.input-element')
5122
4872
  ], Textarea.prototype, "inputElement", void 0);
5123
4873
 
5124
- var css_248z$r = i`* {
4874
+ var css_248z$u = i`* {
5125
4875
  box-sizing: border-box;
5126
4876
  }
5127
4877
 
@@ -5426,7 +5176,7 @@ class Switch extends BaseInput {
5426
5176
  'has-content': this.slotHasContent,
5427
5177
  };
5428
5178
  return b `
5429
- <label class=${e$3(cssClasses)}>
5179
+ <label class=${e$1(cssClasses)}>
5430
5180
  <div
5431
5181
  class="track"
5432
5182
  tabindex=${this.tabindex || 0}
@@ -5462,7 +5212,7 @@ class Switch extends BaseInput {
5462
5212
  `;
5463
5213
  }
5464
5214
  }
5465
- Switch.styles = [css_248z$r];
5215
+ Switch.styles = [css_248z$u];
5466
5216
  __decorate([
5467
5217
  n({ type: Boolean })
5468
5218
  ], Switch.prototype, "value", void 0);
@@ -5500,13 +5250,13 @@ __decorate([
5500
5250
  r()
5501
5251
  ], Switch.prototype, "slotHasContent", void 0);
5502
5252
  __decorate([
5503
- e$4('.track')
5253
+ e$2('.track')
5504
5254
  ], Switch.prototype, "trackElement", void 0);
5505
5255
  __decorate([
5506
- e$4('.input-native')
5256
+ e$2('.input-native')
5507
5257
  ], Switch.prototype, "nativeElement", void 0);
5508
5258
 
5509
- var css_248z$q = i`* {
5259
+ var css_248z$t = i`* {
5510
5260
  box-sizing: border-box;
5511
5261
  }
5512
5262
 
@@ -5901,7 +5651,7 @@ class Checkbox extends i$1 {
5901
5651
  'has-content': this.slotHasContent,
5902
5652
  };
5903
5653
  return b `
5904
- <label class=${e$3(cssClasses)}>
5654
+ <label class=${e$1(cssClasses)}>
5905
5655
  <div
5906
5656
  id="container"
5907
5657
  class="container"
@@ -5964,7 +5714,7 @@ class Checkbox extends i$1 {
5964
5714
  `;
5965
5715
  }
5966
5716
  }
5967
- Checkbox.styles = [css_248z$q];
5717
+ Checkbox.styles = [css_248z$t];
5968
5718
  __decorate([
5969
5719
  n({ type: String })
5970
5720
  ], Checkbox.prototype, "name", void 0);
@@ -6005,13 +5755,13 @@ __decorate([
6005
5755
  r()
6006
5756
  ], Checkbox.prototype, "slotHasContent", void 0);
6007
5757
  __decorate([
6008
- e$4('.container')
5758
+ e$2('.container')
6009
5759
  ], Checkbox.prototype, "containerElement", void 0);
6010
5760
  __decorate([
6011
- e$4('.input-native')
5761
+ e$2('.input-native')
6012
5762
  ], Checkbox.prototype, "nativeElement", void 0);
6013
5763
 
6014
- var css_248z$p = i`* {
5764
+ var css_248z$s = i`* {
6015
5765
  box-sizing: border-box;
6016
5766
  }
6017
5767
 
@@ -6098,9 +5848,9 @@ class Spinner extends i$1 {
6098
5848
  `;
6099
5849
  }
6100
5850
  }
6101
- Spinner.styles = [css_248z$p];
5851
+ Spinner.styles = [css_248z$s];
6102
5852
 
6103
- var css_248z$o = i`* {
5853
+ var css_248z$r = i`* {
6104
5854
  box-sizing: border-box;
6105
5855
  }
6106
5856
 
@@ -6208,7 +5958,7 @@ class Container extends i$1 {
6208
5958
  [`size-${this.size}`]: true,
6209
5959
  };
6210
5960
  return b `
6211
- <div class=${e$3(wrapperClasses)}>
5961
+ <div class=${e$1(wrapperClasses)}>
6212
5962
  <div class="container">
6213
5963
  <div class="content">
6214
5964
  <slot></slot>
@@ -6218,12 +5968,12 @@ class Container extends i$1 {
6218
5968
  `;
6219
5969
  }
6220
5970
  }
6221
- Container.styles = [css_248z$o];
5971
+ Container.styles = [css_248z$r];
6222
5972
  __decorate([
6223
5973
  n({ type: String, reflect: true })
6224
5974
  ], Container.prototype, "size", void 0);
6225
5975
 
6226
- var css_248z$n = i`* {
5976
+ var css_248z$q = i`* {
6227
5977
  box-sizing: border-box;
6228
5978
  }
6229
5979
 
@@ -6368,7 +6118,7 @@ class EmptyState extends i$1 {
6368
6118
  // Resolving asset paths in Lit typically uses import.meta.url or absolute paths
6369
6119
  const illustrationPath = new URL(`./assets/images/empty-state/${this.illustration}.svg`, import.meta.url).href;
6370
6120
  return b `
6371
- <div class="${e$3(classes)}">
6121
+ <div class="${e$1(classes)}">
6372
6122
  <div class="empty-state-container">
6373
6123
  <div class="illustration">
6374
6124
  <wc-icon class="illustration-svg" src="${illustrationPath}"></wc-icon>
@@ -6386,7 +6136,7 @@ class EmptyState extends i$1 {
6386
6136
  }
6387
6137
  }
6388
6138
  // Lit handles styles in a static property for better performance
6389
- EmptyState.styles = [css_248z$n];
6139
+ EmptyState.styles = [css_248z$q];
6390
6140
  __decorate([
6391
6141
  n({ type: String, reflect: true })
6392
6142
  ], EmptyState.prototype, "illustration", void 0);
@@ -6400,7 +6150,7 @@ __decorate([
6400
6150
  r()
6401
6151
  ], EmptyState.prototype, "vertical", void 0);
6402
6152
 
6403
- var css_248z$m = i`* {
6153
+ var css_248z$p = i`* {
6404
6154
  box-sizing: border-box;
6405
6155
  }
6406
6156
 
@@ -6408,13 +6158,15 @@ var css_248z$m = i`* {
6408
6158
  display: none !important;
6409
6159
  }
6410
6160
 
6161
+ :host(:not([preview])) {
6162
+ position: absolute;
6163
+ top: 0;
6164
+ left: 0;
6165
+ }
6411
6166
  :host(:not([preview])) .tooltip {
6412
6167
  pointer-events: none;
6413
6168
  transition: transform var(--duration-short2) ease-in-out, opacity var(--duration-short2) ease-in-out;
6414
6169
  transform: scale(0);
6415
- position: absolute;
6416
- top: 0;
6417
- left: 0;
6418
6170
  opacity: 0;
6419
6171
  }
6420
6172
  :host(:not([preview])) .tooltip.open {
@@ -6476,1682 +6228,63 @@ var css_248z$m = i`* {
6476
6228
  }`;
6477
6229
 
6478
6230
  /**
6479
- * Custom positioning reference element.
6480
- * @see https://floating-ui.com/docs/virtual-elements
6481
- */
6482
-
6483
- const min = Math.min;
6484
- const max = Math.max;
6485
- const round = Math.round;
6486
- const floor = Math.floor;
6487
- const createCoords = v => ({
6488
- x: v,
6489
- y: v
6490
- });
6491
- const oppositeSideMap = {
6492
- left: 'right',
6493
- right: 'left',
6494
- bottom: 'top',
6495
- top: 'bottom'
6496
- };
6497
- function clamp(start, value, end) {
6498
- return max(start, min(value, end));
6499
- }
6500
- function evaluate(value, param) {
6501
- return typeof value === 'function' ? value(param) : value;
6502
- }
6503
- function getSide(placement) {
6504
- return placement.split('-')[0];
6505
- }
6506
- function getAlignment(placement) {
6507
- return placement.split('-')[1];
6508
- }
6509
- function getOppositeAxis(axis) {
6510
- return axis === 'x' ? 'y' : 'x';
6511
- }
6512
- function getAxisLength(axis) {
6513
- return axis === 'y' ? 'height' : 'width';
6514
- }
6515
- function getSideAxis(placement) {
6516
- const firstChar = placement[0];
6517
- return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
6518
- }
6519
- function getAlignmentAxis(placement) {
6520
- return getOppositeAxis(getSideAxis(placement));
6521
- }
6522
- function getAlignmentSides(placement, rects, rtl) {
6523
- if (rtl === void 0) {
6524
- rtl = false;
6525
- }
6526
- const alignment = getAlignment(placement);
6527
- const alignmentAxis = getAlignmentAxis(placement);
6528
- const length = getAxisLength(alignmentAxis);
6529
- let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
6530
- if (rects.reference[length] > rects.floating[length]) {
6531
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
6532
- }
6533
- return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
6534
- }
6535
- function getExpandedPlacements(placement) {
6536
- const oppositePlacement = getOppositePlacement(placement);
6537
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
6538
- }
6539
- function getOppositeAlignmentPlacement(placement) {
6540
- return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
6541
- }
6542
- const lrPlacement = ['left', 'right'];
6543
- const rlPlacement = ['right', 'left'];
6544
- const tbPlacement = ['top', 'bottom'];
6545
- const btPlacement = ['bottom', 'top'];
6546
- function getSideList(side, isStart, rtl) {
6547
- switch (side) {
6548
- case 'top':
6549
- case 'bottom':
6550
- if (rtl) return isStart ? rlPlacement : lrPlacement;
6551
- return isStart ? lrPlacement : rlPlacement;
6552
- case 'left':
6553
- case 'right':
6554
- return isStart ? tbPlacement : btPlacement;
6555
- default:
6556
- return [];
6557
- }
6558
- }
6559
- function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
6560
- const alignment = getAlignment(placement);
6561
- let list = getSideList(getSide(placement), direction === 'start', rtl);
6562
- if (alignment) {
6563
- list = list.map(side => side + "-" + alignment);
6564
- if (flipAlignment) {
6565
- list = list.concat(list.map(getOppositeAlignmentPlacement));
6566
- }
6567
- }
6568
- return list;
6569
- }
6570
- function getOppositePlacement(placement) {
6571
- const side = getSide(placement);
6572
- return oppositeSideMap[side] + placement.slice(side.length);
6573
- }
6574
- function expandPaddingObject(padding) {
6575
- return {
6576
- top: 0,
6577
- right: 0,
6578
- bottom: 0,
6579
- left: 0,
6580
- ...padding
6581
- };
6582
- }
6583
- function getPaddingObject(padding) {
6584
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
6585
- top: padding,
6586
- right: padding,
6587
- bottom: padding,
6588
- left: padding
6589
- };
6590
- }
6591
- function rectToClientRect(rect) {
6592
- const {
6593
- x,
6594
- y,
6595
- width,
6596
- height
6597
- } = rect;
6598
- return {
6599
- width,
6600
- height,
6601
- top: y,
6602
- left: x,
6603
- right: x + width,
6604
- bottom: y + height,
6605
- x,
6606
- y
6607
- };
6608
- }
6609
-
6610
- function computeCoordsFromPlacement(_ref, placement, rtl) {
6611
- let {
6612
- reference,
6613
- floating
6614
- } = _ref;
6615
- const sideAxis = getSideAxis(placement);
6616
- const alignmentAxis = getAlignmentAxis(placement);
6617
- const alignLength = getAxisLength(alignmentAxis);
6618
- const side = getSide(placement);
6619
- const isVertical = sideAxis === 'y';
6620
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
6621
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
6622
- const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
6623
- let coords;
6624
- switch (side) {
6625
- case 'top':
6626
- coords = {
6627
- x: commonX,
6628
- y: reference.y - floating.height
6629
- };
6630
- break;
6631
- case 'bottom':
6632
- coords = {
6633
- x: commonX,
6634
- y: reference.y + reference.height
6635
- };
6636
- break;
6637
- case 'right':
6638
- coords = {
6639
- x: reference.x + reference.width,
6640
- y: commonY
6641
- };
6642
- break;
6643
- case 'left':
6644
- coords = {
6645
- x: reference.x - floating.width,
6646
- y: commonY
6647
- };
6648
- break;
6649
- default:
6650
- coords = {
6651
- x: reference.x,
6652
- y: reference.y
6653
- };
6654
- }
6655
- switch (getAlignment(placement)) {
6656
- case 'start':
6657
- coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
6658
- break;
6659
- case 'end':
6660
- coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
6661
- break;
6662
- }
6663
- return coords;
6664
- }
6665
-
6666
- /**
6667
- * Resolves with an object of overflow side offsets that determine how much the
6668
- * element is overflowing a given clipping boundary on each side.
6669
- * - positive = overflowing the boundary by that number of pixels
6670
- * - negative = how many pixels left before it will overflow
6671
- * - 0 = lies flush with the boundary
6672
- * @see https://floating-ui.com/docs/detectOverflow
6673
- */
6674
- async function detectOverflow(state, options) {
6675
- var _await$platform$isEle;
6676
- if (options === void 0) {
6677
- options = {};
6678
- }
6679
- const {
6680
- x,
6681
- y,
6682
- platform,
6683
- rects,
6684
- elements,
6685
- strategy
6686
- } = state;
6687
- const {
6688
- boundary = 'clippingAncestors',
6689
- rootBoundary = 'viewport',
6690
- elementContext = 'floating',
6691
- altBoundary = false,
6692
- padding = 0
6693
- } = evaluate(options, state);
6694
- const paddingObject = getPaddingObject(padding);
6695
- const altContext = elementContext === 'floating' ? 'reference' : 'floating';
6696
- const element = elements[altBoundary ? altContext : elementContext];
6697
- const clippingClientRect = rectToClientRect(await platform.getClippingRect({
6698
- element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
6699
- boundary,
6700
- rootBoundary,
6701
- strategy
6702
- }));
6703
- const rect = elementContext === 'floating' ? {
6704
- x,
6705
- y,
6706
- width: rects.floating.width,
6707
- height: rects.floating.height
6708
- } : rects.reference;
6709
- const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
6710
- const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
6711
- x: 1,
6712
- y: 1
6713
- } : {
6714
- x: 1,
6715
- y: 1
6716
- };
6717
- const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
6718
- elements,
6719
- rect,
6720
- offsetParent,
6721
- strategy
6722
- }) : rect);
6723
- return {
6724
- top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
6725
- bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
6726
- left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
6727
- right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
6728
- };
6729
- }
6730
-
6731
- // Maximum number of resets that can occur before bailing to avoid infinite reset loops.
6732
- const MAX_RESET_COUNT = 50;
6733
-
6734
- /**
6735
- * Computes the `x` and `y` coordinates that will place the floating element
6736
- * next to a given reference element.
6231
+ * @label Tooltip
6232
+ * @tag wc-tooltip
6233
+ * @rawTag tooltip
6234
+ * @summary Displays a tooltip for an element.
6235
+ * @tags display
6737
6236
  *
6738
- * This export does not have any `platform` interface logic. You will need to
6739
- * write one for the platform you are using Floating UI with.
6237
+ * @example
6238
+ * ```html
6239
+ * <wc-tooltip preview>Tooltip</wc-tooltip>
6240
+ * ```
6740
6241
  */
6741
- const computePosition$1 = async (reference, floating, config) => {
6742
- const {
6743
- placement = 'bottom',
6744
- strategy = 'absolute',
6745
- middleware = [],
6746
- platform
6747
- } = config;
6748
- const platformWithDetectOverflow = platform.detectOverflow ? platform : {
6749
- ...platform,
6750
- detectOverflow
6751
- };
6752
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
6753
- let rects = await platform.getElementRects({
6754
- reference,
6755
- floating,
6756
- strategy
6757
- });
6758
- let {
6759
- x,
6760
- y
6761
- } = computeCoordsFromPlacement(rects, placement, rtl);
6762
- let statefulPlacement = placement;
6763
- let resetCount = 0;
6764
- const middlewareData = {};
6765
- for (let i = 0; i < middleware.length; i++) {
6766
- const currentMiddleware = middleware[i];
6767
- if (!currentMiddleware) {
6768
- continue;
6769
- }
6770
- const {
6771
- name,
6772
- fn
6773
- } = currentMiddleware;
6774
- const {
6775
- x: nextX,
6776
- y: nextY,
6777
- data,
6778
- reset
6779
- } = await fn({
6780
- x,
6781
- y,
6782
- initialPlacement: placement,
6783
- placement: statefulPlacement,
6784
- strategy,
6785
- middlewareData,
6786
- rects,
6787
- platform: platformWithDetectOverflow,
6788
- elements: {
6789
- reference,
6790
- floating
6791
- }
6792
- });
6793
- x = nextX != null ? nextX : x;
6794
- y = nextY != null ? nextY : y;
6795
- middlewareData[name] = {
6796
- ...middlewareData[name],
6797
- ...data
6798
- };
6799
- if (reset && resetCount < MAX_RESET_COUNT) {
6800
- resetCount++;
6801
- if (typeof reset === 'object') {
6802
- if (reset.placement) {
6803
- statefulPlacement = reset.placement;
6804
- }
6805
- if (reset.rects) {
6806
- rects = reset.rects === true ? await platform.getElementRects({
6807
- reference,
6808
- floating,
6809
- strategy
6810
- }) : reset.rects;
6811
- }
6812
- ({
6813
- x,
6814
- y
6815
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
6816
- }
6817
- i = -1;
6242
+ class Tooltip extends i$1 {
6243
+ constructor() {
6244
+ super(...arguments);
6245
+ this.content = '';
6246
+ /**
6247
+ * The ID of the element the tooltip should attach to.
6248
+ * If not provided, it defaults to the parent element.
6249
+ */
6250
+ this.for = '';
6251
+ this.trigger = 'hover focus';
6252
+ this.open = false;
6253
+ this.variant = 'plain';
6254
+ this.preview = false;
6255
+ this._target = null;
6256
+ this._floating = null;
6257
+ }
6258
+ resolveTrigger() {
6259
+ if (this.preview)
6260
+ return 'manual';
6261
+ const triggerTokens = this.trigger.split(' ');
6262
+ const hasHover = triggerTokens.includes('hover');
6263
+ const hasFocus = triggerTokens.includes('focus');
6264
+ const hasClick = triggerTokens.includes('click');
6265
+ if (hasClick)
6266
+ return 'click';
6267
+ if (hasHover && hasFocus)
6268
+ return 'hover-focus';
6269
+ if (hasFocus)
6270
+ return 'focus';
6271
+ if (hasHover)
6272
+ return 'hover';
6273
+ return 'manual';
6818
6274
  }
6819
- }
6820
- return {
6821
- x,
6822
- y,
6823
- placement: statefulPlacement,
6824
- strategy,
6825
- middlewareData
6826
- };
6827
- };
6828
-
6829
- /**
6830
- * Optimizes the visibility of the floating element by flipping the `placement`
6831
- * in order to keep it in view when the preferred placement(s) will overflow the
6832
- * clipping boundary. Alternative to `autoPlacement`.
6833
- * @see https://floating-ui.com/docs/flip
6834
- */
6835
- const flip$1 = function (options) {
6836
- if (options === void 0) {
6837
- options = {};
6838
- }
6839
- return {
6840
- name: 'flip',
6841
- options,
6842
- async fn(state) {
6843
- var _middlewareData$arrow, _middlewareData$flip;
6844
- const {
6845
- placement,
6846
- middlewareData,
6847
- rects,
6848
- initialPlacement,
6849
- platform,
6850
- elements
6851
- } = state;
6852
- const {
6853
- mainAxis: checkMainAxis = true,
6854
- crossAxis: checkCrossAxis = true,
6855
- fallbackPlacements: specifiedFallbackPlacements,
6856
- fallbackStrategy = 'bestFit',
6857
- fallbackAxisSideDirection = 'none',
6858
- flipAlignment = true,
6859
- ...detectOverflowOptions
6860
- } = evaluate(options, state);
6861
-
6862
- // If a reset by the arrow was caused due to an alignment offset being
6863
- // added, we should skip any logic now since `flip()` has already done its
6864
- // work.
6865
- // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
6866
- if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
6867
- return {};
6868
- }
6869
- const side = getSide(placement);
6870
- const initialSideAxis = getSideAxis(initialPlacement);
6871
- const isBasePlacement = getSide(initialPlacement) === initialPlacement;
6872
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
6873
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
6874
- const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
6875
- if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
6876
- fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
6877
- }
6878
- const placements = [initialPlacement, ...fallbackPlacements];
6879
- const overflow = await platform.detectOverflow(state, detectOverflowOptions);
6880
- const overflows = [];
6881
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
6882
- if (checkMainAxis) {
6883
- overflows.push(overflow[side]);
6884
- }
6885
- if (checkCrossAxis) {
6886
- const sides = getAlignmentSides(placement, rects, rtl);
6887
- overflows.push(overflow[sides[0]], overflow[sides[1]]);
6888
- }
6889
- overflowsData = [...overflowsData, {
6890
- placement,
6891
- overflows
6892
- }];
6893
-
6894
- // One or more sides is overflowing.
6895
- if (!overflows.every(side => side <= 0)) {
6896
- var _middlewareData$flip2, _overflowsData$filter;
6897
- const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
6898
- const nextPlacement = placements[nextIndex];
6899
- if (nextPlacement) {
6900
- const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
6901
- if (!ignoreCrossAxisOverflow ||
6902
- // We leave the current main axis only if every placement on that axis
6903
- // overflows the main axis.
6904
- overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
6905
- // Try next placement and re-run the lifecycle.
6906
- return {
6907
- data: {
6908
- index: nextIndex,
6909
- overflows: overflowsData
6910
- },
6911
- reset: {
6912
- placement: nextPlacement
6913
- }
6914
- };
6915
- }
6916
- }
6917
-
6918
- // First, find the candidates that fit on the mainAxis side of overflow,
6919
- // then find the placement that fits the best on the main crossAxis side.
6920
- let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
6921
-
6922
- // Otherwise fallback.
6923
- if (!resetPlacement) {
6924
- switch (fallbackStrategy) {
6925
- case 'bestFit':
6926
- {
6927
- var _overflowsData$filter2;
6928
- const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
6929
- if (hasFallbackAxisSideDirection) {
6930
- const currentSideAxis = getSideAxis(d.placement);
6931
- return currentSideAxis === initialSideAxis ||
6932
- // Create a bias to the `y` side axis due to horizontal
6933
- // reading directions favoring greater width.
6934
- currentSideAxis === 'y';
6935
- }
6936
- return true;
6937
- }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
6938
- if (placement) {
6939
- resetPlacement = placement;
6940
- }
6941
- break;
6942
- }
6943
- case 'initialPlacement':
6944
- resetPlacement = initialPlacement;
6945
- break;
6946
- }
6275
+ detachListeners() {
6276
+ if (this._floating) {
6277
+ this._floating.close();
6278
+ this._floating = null;
6947
6279
  }
6948
- if (placement !== resetPlacement) {
6949
- return {
6950
- reset: {
6951
- placement: resetPlacement
6952
- }
6953
- };
6280
+ this._target = null;
6281
+ }
6282
+ set forElement(value) {
6283
+ if (value) {
6284
+ this._focusTarget = value;
6954
6285
  }
6955
- }
6956
- return {};
6957
- }
6958
- };
6959
- };
6960
-
6961
- const originSides = /*#__PURE__*/new Set(['left', 'top']);
6962
-
6963
- // For type backwards-compatibility, the `OffsetOptions` type was also
6964
- // Derivable.
6965
-
6966
- async function convertValueToCoords(state, options) {
6967
- const {
6968
- placement,
6969
- platform,
6970
- elements
6971
- } = state;
6972
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
6973
- const side = getSide(placement);
6974
- const alignment = getAlignment(placement);
6975
- const isVertical = getSideAxis(placement) === 'y';
6976
- const mainAxisMulti = originSides.has(side) ? -1 : 1;
6977
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
6978
- const rawValue = evaluate(options, state);
6979
-
6980
- // eslint-disable-next-line prefer-const
6981
- let {
6982
- mainAxis,
6983
- crossAxis,
6984
- alignmentAxis
6985
- } = typeof rawValue === 'number' ? {
6986
- mainAxis: rawValue,
6987
- crossAxis: 0,
6988
- alignmentAxis: null
6989
- } : {
6990
- mainAxis: rawValue.mainAxis || 0,
6991
- crossAxis: rawValue.crossAxis || 0,
6992
- alignmentAxis: rawValue.alignmentAxis
6993
- };
6994
- if (alignment && typeof alignmentAxis === 'number') {
6995
- crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
6996
- }
6997
- return isVertical ? {
6998
- x: crossAxis * crossAxisMulti,
6999
- y: mainAxis * mainAxisMulti
7000
- } : {
7001
- x: mainAxis * mainAxisMulti,
7002
- y: crossAxis * crossAxisMulti
7003
- };
7004
- }
7005
-
7006
- /**
7007
- * Modifies the placement by translating the floating element along the
7008
- * specified axes.
7009
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
7010
- * object may be passed.
7011
- * @see https://floating-ui.com/docs/offset
7012
- */
7013
- const offset$1 = function (options) {
7014
- if (options === void 0) {
7015
- options = 0;
7016
- }
7017
- return {
7018
- name: 'offset',
7019
- options,
7020
- async fn(state) {
7021
- var _middlewareData$offse, _middlewareData$arrow;
7022
- const {
7023
- x,
7024
- y,
7025
- placement,
7026
- middlewareData
7027
- } = state;
7028
- const diffCoords = await convertValueToCoords(state, options);
7029
-
7030
- // If the placement is the same and the arrow caused an alignment offset
7031
- // then we don't need to change the positioning coordinates.
7032
- if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
7033
- return {};
7034
- }
7035
- return {
7036
- x: x + diffCoords.x,
7037
- y: y + diffCoords.y,
7038
- data: {
7039
- ...diffCoords,
7040
- placement
7041
- }
7042
- };
7043
- }
7044
- };
7045
- };
7046
-
7047
- /**
7048
- * Optimizes the visibility of the floating element by shifting it in order to
7049
- * keep it in view when it will overflow the clipping boundary.
7050
- * @see https://floating-ui.com/docs/shift
7051
- */
7052
- const shift$1 = function (options) {
7053
- if (options === void 0) {
7054
- options = {};
7055
- }
7056
- return {
7057
- name: 'shift',
7058
- options,
7059
- async fn(state) {
7060
- const {
7061
- x,
7062
- y,
7063
- placement,
7064
- platform
7065
- } = state;
7066
- const {
7067
- mainAxis: checkMainAxis = true,
7068
- crossAxis: checkCrossAxis = false,
7069
- limiter = {
7070
- fn: _ref => {
7071
- let {
7072
- x,
7073
- y
7074
- } = _ref;
7075
- return {
7076
- x,
7077
- y
7078
- };
7079
- }
7080
- },
7081
- ...detectOverflowOptions
7082
- } = evaluate(options, state);
7083
- const coords = {
7084
- x,
7085
- y
7086
- };
7087
- const overflow = await platform.detectOverflow(state, detectOverflowOptions);
7088
- const crossAxis = getSideAxis(getSide(placement));
7089
- const mainAxis = getOppositeAxis(crossAxis);
7090
- let mainAxisCoord = coords[mainAxis];
7091
- let crossAxisCoord = coords[crossAxis];
7092
- if (checkMainAxis) {
7093
- const minSide = mainAxis === 'y' ? 'top' : 'left';
7094
- const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
7095
- const min = mainAxisCoord + overflow[minSide];
7096
- const max = mainAxisCoord - overflow[maxSide];
7097
- mainAxisCoord = clamp(min, mainAxisCoord, max);
7098
- }
7099
- if (checkCrossAxis) {
7100
- const minSide = crossAxis === 'y' ? 'top' : 'left';
7101
- const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
7102
- const min = crossAxisCoord + overflow[minSide];
7103
- const max = crossAxisCoord - overflow[maxSide];
7104
- crossAxisCoord = clamp(min, crossAxisCoord, max);
7105
- }
7106
- const limitedCoords = limiter.fn({
7107
- ...state,
7108
- [mainAxis]: mainAxisCoord,
7109
- [crossAxis]: crossAxisCoord
7110
- });
7111
- return {
7112
- ...limitedCoords,
7113
- data: {
7114
- x: limitedCoords.x - x,
7115
- y: limitedCoords.y - y,
7116
- enabled: {
7117
- [mainAxis]: checkMainAxis,
7118
- [crossAxis]: checkCrossAxis
7119
- }
7120
- }
7121
- };
7122
- }
7123
- };
7124
- };
7125
-
7126
- function hasWindow() {
7127
- return typeof window !== 'undefined';
7128
- }
7129
- function getNodeName(node) {
7130
- if (isNode(node)) {
7131
- return (node.nodeName || '').toLowerCase();
7132
- }
7133
- // Mocked nodes in testing environments may not be instances of Node. By
7134
- // returning `#document` an infinite loop won't occur.
7135
- // https://github.com/floating-ui/floating-ui/issues/2317
7136
- return '#document';
7137
- }
7138
- function getWindow(node) {
7139
- var _node$ownerDocument;
7140
- return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
7141
- }
7142
- function getDocumentElement(node) {
7143
- var _ref;
7144
- return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
7145
- }
7146
- function isNode(value) {
7147
- if (!hasWindow()) {
7148
- return false;
7149
- }
7150
- return value instanceof Node || value instanceof getWindow(value).Node;
7151
- }
7152
- function isElement(value) {
7153
- if (!hasWindow()) {
7154
- return false;
7155
- }
7156
- return value instanceof Element || value instanceof getWindow(value).Element;
7157
- }
7158
- function isHTMLElement(value) {
7159
- if (!hasWindow()) {
7160
- return false;
7161
- }
7162
- return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
7163
- }
7164
- function isShadowRoot(value) {
7165
- if (!hasWindow() || typeof ShadowRoot === 'undefined') {
7166
- return false;
7167
- }
7168
- return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
7169
- }
7170
- function isOverflowElement(element) {
7171
- const {
7172
- overflow,
7173
- overflowX,
7174
- overflowY,
7175
- display
7176
- } = getComputedStyle$1(element);
7177
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
7178
- }
7179
- function isTableElement(element) {
7180
- return /^(table|td|th)$/.test(getNodeName(element));
7181
- }
7182
- function isTopLayer(element) {
7183
- try {
7184
- if (element.matches(':popover-open')) {
7185
- return true;
7186
- }
7187
- } catch (_e) {
7188
- // no-op
7189
- }
7190
- try {
7191
- return element.matches(':modal');
7192
- } catch (_e) {
7193
- return false;
7194
- }
7195
- }
7196
- const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
7197
- const containRe = /paint|layout|strict|content/;
7198
- const isNotNone = value => !!value && value !== 'none';
7199
- let isWebKitValue;
7200
- function isContainingBlock(elementOrCss) {
7201
- const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
7202
-
7203
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
7204
- // https://drafts.csswg.org/css-transforms-2/#individual-transforms
7205
- return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
7206
- }
7207
- function getContainingBlock(element) {
7208
- let currentNode = getParentNode(element);
7209
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
7210
- if (isContainingBlock(currentNode)) {
7211
- return currentNode;
7212
- } else if (isTopLayer(currentNode)) {
7213
- return null;
7214
- }
7215
- currentNode = getParentNode(currentNode);
7216
- }
7217
- return null;
7218
- }
7219
- function isWebKit() {
7220
- if (isWebKitValue == null) {
7221
- isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
7222
- }
7223
- return isWebKitValue;
7224
- }
7225
- function isLastTraversableNode(node) {
7226
- return /^(html|body|#document)$/.test(getNodeName(node));
7227
- }
7228
- function getComputedStyle$1(element) {
7229
- return getWindow(element).getComputedStyle(element);
7230
- }
7231
- function getNodeScroll(element) {
7232
- if (isElement(element)) {
7233
- return {
7234
- scrollLeft: element.scrollLeft,
7235
- scrollTop: element.scrollTop
7236
- };
7237
- }
7238
- return {
7239
- scrollLeft: element.scrollX,
7240
- scrollTop: element.scrollY
7241
- };
7242
- }
7243
- function getParentNode(node) {
7244
- if (getNodeName(node) === 'html') {
7245
- return node;
7246
- }
7247
- const result =
7248
- // Step into the shadow DOM of the parent of a slotted node.
7249
- node.assignedSlot ||
7250
- // DOM Element detected.
7251
- node.parentNode ||
7252
- // ShadowRoot detected.
7253
- isShadowRoot(node) && node.host ||
7254
- // Fallback.
7255
- getDocumentElement(node);
7256
- return isShadowRoot(result) ? result.host : result;
7257
- }
7258
- function getNearestOverflowAncestor(node) {
7259
- const parentNode = getParentNode(node);
7260
- if (isLastTraversableNode(parentNode)) {
7261
- return node.ownerDocument ? node.ownerDocument.body : node.body;
7262
- }
7263
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
7264
- return parentNode;
7265
- }
7266
- return getNearestOverflowAncestor(parentNode);
7267
- }
7268
- function getOverflowAncestors(node, list, traverseIframes) {
7269
- var _node$ownerDocument2;
7270
- if (list === void 0) {
7271
- list = [];
7272
- }
7273
- if (traverseIframes === void 0) {
7274
- traverseIframes = true;
7275
- }
7276
- const scrollableAncestor = getNearestOverflowAncestor(node);
7277
- const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
7278
- const win = getWindow(scrollableAncestor);
7279
- if (isBody) {
7280
- const frameElement = getFrameElement(win);
7281
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
7282
- } else {
7283
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
7284
- }
7285
- }
7286
- function getFrameElement(win) {
7287
- return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
7288
- }
7289
-
7290
- function getCssDimensions(element) {
7291
- const css = getComputedStyle$1(element);
7292
- // In testing environments, the `width` and `height` properties are empty
7293
- // strings for SVG elements, returning NaN. Fallback to `0` in this case.
7294
- let width = parseFloat(css.width) || 0;
7295
- let height = parseFloat(css.height) || 0;
7296
- const hasOffset = isHTMLElement(element);
7297
- const offsetWidth = hasOffset ? element.offsetWidth : width;
7298
- const offsetHeight = hasOffset ? element.offsetHeight : height;
7299
- const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
7300
- if (shouldFallback) {
7301
- width = offsetWidth;
7302
- height = offsetHeight;
7303
- }
7304
- return {
7305
- width,
7306
- height,
7307
- $: shouldFallback
7308
- };
7309
- }
7310
-
7311
- function unwrapElement(element) {
7312
- return !isElement(element) ? element.contextElement : element;
7313
- }
7314
-
7315
- function getScale(element) {
7316
- const domElement = unwrapElement(element);
7317
- if (!isHTMLElement(domElement)) {
7318
- return createCoords(1);
7319
- }
7320
- const rect = domElement.getBoundingClientRect();
7321
- const {
7322
- width,
7323
- height,
7324
- $
7325
- } = getCssDimensions(domElement);
7326
- let x = ($ ? round(rect.width) : rect.width) / width;
7327
- let y = ($ ? round(rect.height) : rect.height) / height;
7328
-
7329
- // 0, NaN, or Infinity should always fallback to 1.
7330
-
7331
- if (!x || !Number.isFinite(x)) {
7332
- x = 1;
7333
- }
7334
- if (!y || !Number.isFinite(y)) {
7335
- y = 1;
7336
- }
7337
- return {
7338
- x,
7339
- y
7340
- };
7341
- }
7342
-
7343
- const noOffsets = /*#__PURE__*/createCoords(0);
7344
- function getVisualOffsets(element) {
7345
- const win = getWindow(element);
7346
- if (!isWebKit() || !win.visualViewport) {
7347
- return noOffsets;
7348
- }
7349
- return {
7350
- x: win.visualViewport.offsetLeft,
7351
- y: win.visualViewport.offsetTop
7352
- };
7353
- }
7354
- function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
7355
- if (isFixed === void 0) {
7356
- isFixed = false;
7357
- }
7358
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
7359
- return false;
7360
- }
7361
- return isFixed;
7362
- }
7363
-
7364
- function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
7365
- if (includeScale === void 0) {
7366
- includeScale = false;
7367
- }
7368
- if (isFixedStrategy === void 0) {
7369
- isFixedStrategy = false;
7370
- }
7371
- const clientRect = element.getBoundingClientRect();
7372
- const domElement = unwrapElement(element);
7373
- let scale = createCoords(1);
7374
- if (includeScale) {
7375
- if (offsetParent) {
7376
- if (isElement(offsetParent)) {
7377
- scale = getScale(offsetParent);
7378
- }
7379
- } else {
7380
- scale = getScale(element);
7381
- }
7382
- }
7383
- const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
7384
- let x = (clientRect.left + visualOffsets.x) / scale.x;
7385
- let y = (clientRect.top + visualOffsets.y) / scale.y;
7386
- let width = clientRect.width / scale.x;
7387
- let height = clientRect.height / scale.y;
7388
- if (domElement) {
7389
- const win = getWindow(domElement);
7390
- const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
7391
- let currentWin = win;
7392
- let currentIFrame = getFrameElement(currentWin);
7393
- while (currentIFrame && offsetParent && offsetWin !== currentWin) {
7394
- const iframeScale = getScale(currentIFrame);
7395
- const iframeRect = currentIFrame.getBoundingClientRect();
7396
- const css = getComputedStyle$1(currentIFrame);
7397
- const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
7398
- const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
7399
- x *= iframeScale.x;
7400
- y *= iframeScale.y;
7401
- width *= iframeScale.x;
7402
- height *= iframeScale.y;
7403
- x += left;
7404
- y += top;
7405
- currentWin = getWindow(currentIFrame);
7406
- currentIFrame = getFrameElement(currentWin);
7407
- }
7408
- }
7409
- return rectToClientRect({
7410
- width,
7411
- height,
7412
- x,
7413
- y
7414
- });
7415
- }
7416
-
7417
- // If <html> has a CSS width greater than the viewport, then this will be
7418
- // incorrect for RTL.
7419
- function getWindowScrollBarX(element, rect) {
7420
- const leftScroll = getNodeScroll(element).scrollLeft;
7421
- if (!rect) {
7422
- return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
7423
- }
7424
- return rect.left + leftScroll;
7425
- }
7426
-
7427
- function getHTMLOffset(documentElement, scroll) {
7428
- const htmlRect = documentElement.getBoundingClientRect();
7429
- const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
7430
- const y = htmlRect.top + scroll.scrollTop;
7431
- return {
7432
- x,
7433
- y
7434
- };
7435
- }
7436
-
7437
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
7438
- let {
7439
- elements,
7440
- rect,
7441
- offsetParent,
7442
- strategy
7443
- } = _ref;
7444
- const isFixed = strategy === 'fixed';
7445
- const documentElement = getDocumentElement(offsetParent);
7446
- const topLayer = elements ? isTopLayer(elements.floating) : false;
7447
- if (offsetParent === documentElement || topLayer && isFixed) {
7448
- return rect;
7449
- }
7450
- let scroll = {
7451
- scrollLeft: 0,
7452
- scrollTop: 0
7453
- };
7454
- let scale = createCoords(1);
7455
- const offsets = createCoords(0);
7456
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
7457
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
7458
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
7459
- scroll = getNodeScroll(offsetParent);
7460
- }
7461
- if (isOffsetParentAnElement) {
7462
- const offsetRect = getBoundingClientRect(offsetParent);
7463
- scale = getScale(offsetParent);
7464
- offsets.x = offsetRect.x + offsetParent.clientLeft;
7465
- offsets.y = offsetRect.y + offsetParent.clientTop;
7466
- }
7467
- }
7468
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
7469
- return {
7470
- width: rect.width * scale.x,
7471
- height: rect.height * scale.y,
7472
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
7473
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
7474
- };
7475
- }
7476
-
7477
- function getClientRects(element) {
7478
- return Array.from(element.getClientRects());
7479
- }
7480
-
7481
- // Gets the entire size of the scrollable document area, even extending outside
7482
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
7483
- function getDocumentRect(element) {
7484
- const html = getDocumentElement(element);
7485
- const scroll = getNodeScroll(element);
7486
- const body = element.ownerDocument.body;
7487
- const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
7488
- const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
7489
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
7490
- const y = -scroll.scrollTop;
7491
- if (getComputedStyle$1(body).direction === 'rtl') {
7492
- x += max(html.clientWidth, body.clientWidth) - width;
7493
- }
7494
- return {
7495
- width,
7496
- height,
7497
- x,
7498
- y
7499
- };
7500
- }
7501
-
7502
- // Safety check: ensure the scrollbar space is reasonable in case this
7503
- // calculation is affected by unusual styles.
7504
- // Most scrollbars leave 15-18px of space.
7505
- const SCROLLBAR_MAX = 25;
7506
- function getViewportRect(element, strategy) {
7507
- const win = getWindow(element);
7508
- const html = getDocumentElement(element);
7509
- const visualViewport = win.visualViewport;
7510
- let width = html.clientWidth;
7511
- let height = html.clientHeight;
7512
- let x = 0;
7513
- let y = 0;
7514
- if (visualViewport) {
7515
- width = visualViewport.width;
7516
- height = visualViewport.height;
7517
- const visualViewportBased = isWebKit();
7518
- if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
7519
- x = visualViewport.offsetLeft;
7520
- y = visualViewport.offsetTop;
7521
- }
7522
- }
7523
- const windowScrollbarX = getWindowScrollBarX(html);
7524
- // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
7525
- // visual width of the <html> but this is not considered in the size
7526
- // of `html.clientWidth`.
7527
- if (windowScrollbarX <= 0) {
7528
- const doc = html.ownerDocument;
7529
- const body = doc.body;
7530
- const bodyStyles = getComputedStyle(body);
7531
- const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
7532
- const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
7533
- if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
7534
- width -= clippingStableScrollbarWidth;
7535
- }
7536
- } else if (windowScrollbarX <= SCROLLBAR_MAX) {
7537
- // If the <body> scrollbar is on the left, the width needs to be extended
7538
- // by the scrollbar amount so there isn't extra space on the right.
7539
- width += windowScrollbarX;
7540
- }
7541
- return {
7542
- width,
7543
- height,
7544
- x,
7545
- y
7546
- };
7547
- }
7548
-
7549
- // Returns the inner client rect, subtracting scrollbars if present.
7550
- function getInnerBoundingClientRect(element, strategy) {
7551
- const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
7552
- const top = clientRect.top + element.clientTop;
7553
- const left = clientRect.left + element.clientLeft;
7554
- const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
7555
- const width = element.clientWidth * scale.x;
7556
- const height = element.clientHeight * scale.y;
7557
- const x = left * scale.x;
7558
- const y = top * scale.y;
7559
- return {
7560
- width,
7561
- height,
7562
- x,
7563
- y
7564
- };
7565
- }
7566
- function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
7567
- let rect;
7568
- if (clippingAncestor === 'viewport') {
7569
- rect = getViewportRect(element, strategy);
7570
- } else if (clippingAncestor === 'document') {
7571
- rect = getDocumentRect(getDocumentElement(element));
7572
- } else if (isElement(clippingAncestor)) {
7573
- rect = getInnerBoundingClientRect(clippingAncestor, strategy);
7574
- } else {
7575
- const visualOffsets = getVisualOffsets(element);
7576
- rect = {
7577
- x: clippingAncestor.x - visualOffsets.x,
7578
- y: clippingAncestor.y - visualOffsets.y,
7579
- width: clippingAncestor.width,
7580
- height: clippingAncestor.height
7581
- };
7582
- }
7583
- return rectToClientRect(rect);
7584
- }
7585
- function hasFixedPositionAncestor(element, stopNode) {
7586
- const parentNode = getParentNode(element);
7587
- if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
7588
- return false;
7589
- }
7590
- return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
7591
- }
7592
-
7593
- // A "clipping ancestor" is an `overflow` element with the characteristic of
7594
- // clipping (or hiding) child elements. This returns all clipping ancestors
7595
- // of the given element up the tree.
7596
- function getClippingElementAncestors(element, cache) {
7597
- const cachedResult = cache.get(element);
7598
- if (cachedResult) {
7599
- return cachedResult;
7600
- }
7601
- let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
7602
- let currentContainingBlockComputedStyle = null;
7603
- const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
7604
- let currentNode = elementIsFixed ? getParentNode(element) : element;
7605
-
7606
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
7607
- while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
7608
- const computedStyle = getComputedStyle$1(currentNode);
7609
- const currentNodeIsContaining = isContainingBlock(currentNode);
7610
- if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
7611
- currentContainingBlockComputedStyle = null;
7612
- }
7613
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
7614
- if (shouldDropCurrentNode) {
7615
- // Drop non-containing blocks.
7616
- result = result.filter(ancestor => ancestor !== currentNode);
7617
- } else {
7618
- // Record last containing block for next iteration.
7619
- currentContainingBlockComputedStyle = computedStyle;
7620
- }
7621
- currentNode = getParentNode(currentNode);
7622
- }
7623
- cache.set(element, result);
7624
- return result;
7625
- }
7626
-
7627
- // Gets the maximum area that the element is visible in due to any number of
7628
- // clipping ancestors.
7629
- function getClippingRect(_ref) {
7630
- let {
7631
- element,
7632
- boundary,
7633
- rootBoundary,
7634
- strategy
7635
- } = _ref;
7636
- const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
7637
- const clippingAncestors = [...elementClippingAncestors, rootBoundary];
7638
- const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
7639
- let top = firstRect.top;
7640
- let right = firstRect.right;
7641
- let bottom = firstRect.bottom;
7642
- let left = firstRect.left;
7643
- for (let i = 1; i < clippingAncestors.length; i++) {
7644
- const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
7645
- top = max(rect.top, top);
7646
- right = min(rect.right, right);
7647
- bottom = min(rect.bottom, bottom);
7648
- left = max(rect.left, left);
7649
- }
7650
- return {
7651
- width: right - left,
7652
- height: bottom - top,
7653
- x: left,
7654
- y: top
7655
- };
7656
- }
7657
-
7658
- function getDimensions(element) {
7659
- const {
7660
- width,
7661
- height
7662
- } = getCssDimensions(element);
7663
- return {
7664
- width,
7665
- height
7666
- };
7667
- }
7668
-
7669
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
7670
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
7671
- const documentElement = getDocumentElement(offsetParent);
7672
- const isFixed = strategy === 'fixed';
7673
- const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
7674
- let scroll = {
7675
- scrollLeft: 0,
7676
- scrollTop: 0
7677
- };
7678
- const offsets = createCoords(0);
7679
-
7680
- // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
7681
- // Firefox with layout.scrollbar.side = 3 in about:config to test this.
7682
- function setLeftRTLScrollbarOffset() {
7683
- offsets.x = getWindowScrollBarX(documentElement);
7684
- }
7685
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
7686
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
7687
- scroll = getNodeScroll(offsetParent);
7688
- }
7689
- if (isOffsetParentAnElement) {
7690
- const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
7691
- offsets.x = offsetRect.x + offsetParent.clientLeft;
7692
- offsets.y = offsetRect.y + offsetParent.clientTop;
7693
- } else if (documentElement) {
7694
- setLeftRTLScrollbarOffset();
7695
- }
7696
- }
7697
- if (isFixed && !isOffsetParentAnElement && documentElement) {
7698
- setLeftRTLScrollbarOffset();
7699
- }
7700
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
7701
- const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
7702
- const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
7703
- return {
7704
- x,
7705
- y,
7706
- width: rect.width,
7707
- height: rect.height
7708
- };
7709
- }
7710
-
7711
- function isStaticPositioned(element) {
7712
- return getComputedStyle$1(element).position === 'static';
7713
- }
7714
-
7715
- function getTrueOffsetParent(element, polyfill) {
7716
- if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
7717
- return null;
7718
- }
7719
- if (polyfill) {
7720
- return polyfill(element);
7721
- }
7722
- let rawOffsetParent = element.offsetParent;
7723
-
7724
- // Firefox returns the <html> element as the offsetParent if it's non-static,
7725
- // while Chrome and Safari return the <body> element. The <body> element must
7726
- // be used to perform the correct calculations even if the <html> element is
7727
- // non-static.
7728
- if (getDocumentElement(element) === rawOffsetParent) {
7729
- rawOffsetParent = rawOffsetParent.ownerDocument.body;
7730
- }
7731
- return rawOffsetParent;
7732
- }
7733
-
7734
- // Gets the closest ancestor positioned element. Handles some edge cases,
7735
- // such as table ancestors and cross browser bugs.
7736
- function getOffsetParent(element, polyfill) {
7737
- const win = getWindow(element);
7738
- if (isTopLayer(element)) {
7739
- return win;
7740
- }
7741
- if (!isHTMLElement(element)) {
7742
- let svgOffsetParent = getParentNode(element);
7743
- while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
7744
- if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
7745
- return svgOffsetParent;
7746
- }
7747
- svgOffsetParent = getParentNode(svgOffsetParent);
7748
- }
7749
- return win;
7750
- }
7751
- let offsetParent = getTrueOffsetParent(element, polyfill);
7752
- while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
7753
- offsetParent = getTrueOffsetParent(offsetParent, polyfill);
7754
- }
7755
- if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
7756
- return win;
7757
- }
7758
- return offsetParent || getContainingBlock(element) || win;
7759
- }
7760
-
7761
- const getElementRects = async function (data) {
7762
- const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
7763
- const getDimensionsFn = this.getDimensions;
7764
- const floatingDimensions = await getDimensionsFn(data.floating);
7765
- return {
7766
- reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
7767
- floating: {
7768
- x: 0,
7769
- y: 0,
7770
- width: floatingDimensions.width,
7771
- height: floatingDimensions.height
7772
- }
7773
- };
7774
- };
7775
-
7776
- function isRTL(element) {
7777
- return getComputedStyle$1(element).direction === 'rtl';
7778
- }
7779
-
7780
- const platform = {
7781
- convertOffsetParentRelativeRectToViewportRelativeRect,
7782
- getDocumentElement,
7783
- getClippingRect,
7784
- getOffsetParent,
7785
- getElementRects,
7786
- getClientRects,
7787
- getDimensions,
7788
- getScale,
7789
- isElement,
7790
- isRTL
7791
- };
7792
-
7793
- function rectsAreEqual(a, b) {
7794
- return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
7795
- }
7796
-
7797
- // https://samthor.au/2021/observing-dom/
7798
- function observeMove(element, onMove) {
7799
- let io = null;
7800
- let timeoutId;
7801
- const root = getDocumentElement(element);
7802
- function cleanup() {
7803
- var _io;
7804
- clearTimeout(timeoutId);
7805
- (_io = io) == null || _io.disconnect();
7806
- io = null;
7807
- }
7808
- function refresh(skip, threshold) {
7809
- if (skip === void 0) {
7810
- skip = false;
7811
- }
7812
- if (threshold === void 0) {
7813
- threshold = 1;
7814
- }
7815
- cleanup();
7816
- const elementRectForRootMargin = element.getBoundingClientRect();
7817
- const {
7818
- left,
7819
- top,
7820
- width,
7821
- height
7822
- } = elementRectForRootMargin;
7823
- if (!skip) {
7824
- onMove();
7825
- }
7826
- if (!width || !height) {
7827
- return;
7828
- }
7829
- const insetTop = floor(top);
7830
- const insetRight = floor(root.clientWidth - (left + width));
7831
- const insetBottom = floor(root.clientHeight - (top + height));
7832
- const insetLeft = floor(left);
7833
- const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
7834
- const options = {
7835
- rootMargin,
7836
- threshold: max(0, min(1, threshold)) || 1
7837
- };
7838
- let isFirstUpdate = true;
7839
- function handleObserve(entries) {
7840
- const ratio = entries[0].intersectionRatio;
7841
- if (ratio !== threshold) {
7842
- if (!isFirstUpdate) {
7843
- return refresh();
7844
- }
7845
- if (!ratio) {
7846
- // If the reference is clipped, the ratio is 0. Throttle the refresh
7847
- // to prevent an infinite loop of updates.
7848
- timeoutId = setTimeout(() => {
7849
- refresh(false, 1e-7);
7850
- }, 1000);
7851
- } else {
7852
- refresh(false, ratio);
7853
- }
7854
- }
7855
- if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
7856
- // It's possible that even though the ratio is reported as 1, the
7857
- // element is not actually fully within the IntersectionObserver's root
7858
- // area anymore. This can happen under performance constraints. This may
7859
- // be a bug in the browser's IntersectionObserver implementation. To
7860
- // work around this, we compare the element's bounding rect now with
7861
- // what it was at the time we created the IntersectionObserver. If they
7862
- // are not equal then the element moved, so we refresh.
7863
- refresh();
7864
- }
7865
- isFirstUpdate = false;
7866
- }
7867
-
7868
- // Older browsers don't support a `document` as the root and will throw an
7869
- // error.
7870
- try {
7871
- io = new IntersectionObserver(handleObserve, {
7872
- ...options,
7873
- // Handle <iframe>s
7874
- root: root.ownerDocument
7875
- });
7876
- } catch (_e) {
7877
- io = new IntersectionObserver(handleObserve, options);
7878
- }
7879
- io.observe(element);
7880
- }
7881
- refresh(true);
7882
- return cleanup;
7883
- }
7884
-
7885
- /**
7886
- * Automatically updates the position of the floating element when necessary.
7887
- * Should only be called when the floating element is mounted on the DOM or
7888
- * visible on the screen.
7889
- * @returns cleanup function that should be invoked when the floating element is
7890
- * removed from the DOM or hidden from the screen.
7891
- * @see https://floating-ui.com/docs/autoUpdate
7892
- */
7893
- function autoUpdate(reference, floating, update, options) {
7894
- if (options === void 0) {
7895
- options = {};
7896
- }
7897
- const {
7898
- ancestorScroll = true,
7899
- ancestorResize = true,
7900
- elementResize = typeof ResizeObserver === 'function',
7901
- layoutShift = typeof IntersectionObserver === 'function',
7902
- animationFrame = false
7903
- } = options;
7904
- const referenceEl = unwrapElement(reference);
7905
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
7906
- ancestors.forEach(ancestor => {
7907
- ancestorScroll && ancestor.addEventListener('scroll', update, {
7908
- passive: true
7909
- });
7910
- ancestorResize && ancestor.addEventListener('resize', update);
7911
- });
7912
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
7913
- let reobserveFrame = -1;
7914
- let resizeObserver = null;
7915
- if (elementResize) {
7916
- resizeObserver = new ResizeObserver(_ref => {
7917
- let [firstEntry] = _ref;
7918
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
7919
- // Prevent update loops when using the `size` middleware.
7920
- // https://github.com/floating-ui/floating-ui/issues/1740
7921
- resizeObserver.unobserve(floating);
7922
- cancelAnimationFrame(reobserveFrame);
7923
- reobserveFrame = requestAnimationFrame(() => {
7924
- var _resizeObserver;
7925
- (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
7926
- });
7927
- }
7928
- update();
7929
- });
7930
- if (referenceEl && !animationFrame) {
7931
- resizeObserver.observe(referenceEl);
7932
- }
7933
- if (floating) {
7934
- resizeObserver.observe(floating);
7935
- }
7936
- }
7937
- let frameId;
7938
- let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
7939
- if (animationFrame) {
7940
- frameLoop();
7941
- }
7942
- function frameLoop() {
7943
- const nextRefRect = getBoundingClientRect(reference);
7944
- if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
7945
- update();
7946
- }
7947
- prevRefRect = nextRefRect;
7948
- frameId = requestAnimationFrame(frameLoop);
7949
- }
7950
- update();
7951
- return () => {
7952
- var _resizeObserver2;
7953
- ancestors.forEach(ancestor => {
7954
- ancestorScroll && ancestor.removeEventListener('scroll', update);
7955
- ancestorResize && ancestor.removeEventListener('resize', update);
7956
- });
7957
- cleanupIo == null || cleanupIo();
7958
- (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
7959
- resizeObserver = null;
7960
- if (animationFrame) {
7961
- cancelAnimationFrame(frameId);
7962
- }
7963
- };
7964
- }
7965
-
7966
- /**
7967
- * Modifies the placement by translating the floating element along the
7968
- * specified axes.
7969
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
7970
- * object may be passed.
7971
- * @see https://floating-ui.com/docs/offset
7972
- */
7973
- const offset = offset$1;
7974
-
7975
- /**
7976
- * Optimizes the visibility of the floating element by shifting it in order to
7977
- * keep it in view when it will overflow the clipping boundary.
7978
- * @see https://floating-ui.com/docs/shift
7979
- */
7980
- const shift = shift$1;
7981
-
7982
- /**
7983
- * Optimizes the visibility of the floating element by flipping the `placement`
7984
- * in order to keep it in view when the preferred placement(s) will overflow the
7985
- * clipping boundary. Alternative to `autoPlacement`.
7986
- * @see https://floating-ui.com/docs/flip
7987
- */
7988
- const flip = flip$1;
7989
-
7990
- /**
7991
- * Computes the `x` and `y` coordinates that will place the floating element
7992
- * next to a given reference element.
7993
- */
7994
- const computePosition = (reference, floating, options) => {
7995
- // This caches the expensive `getClippingElementAncestors` function so that
7996
- // multiple lifecycle resets re-use the same result. It only lives for a
7997
- // single call. If other functions become expensive, we can add them as well.
7998
- const cache = new Map();
7999
- const mergedOptions = {
8000
- platform,
8001
- ...options
8002
- };
8003
- const platformWithCache = {
8004
- ...mergedOptions.platform,
8005
- _c: cache
8006
- };
8007
- return computePosition$1(reference, floating, {
8008
- ...mergedOptions,
8009
- platform: platformWithCache
8010
- });
8011
- };
8012
-
8013
- class PopoverController {
8014
- constructor(host, options = { placement: 'bottom', offset: 6 }) {
8015
- this.host = host;
8016
- this.options = options;
8017
- this.host.addController(this);
8018
- }
8019
- // Set up the floating logic
8020
- async updatePosition(reference, floating, options) {
8021
- if (!reference)
8022
- return;
8023
- this.cleanup?.();
8024
- const placement = options?.placement ?? this.options.placement;
8025
- const spacing = options?.offset ?? this.options.offset;
8026
- this.cleanup = autoUpdate(reference, floating, async () => {
8027
- const { x, y } = await computePosition(reference, floating, {
8028
- placement,
8029
- middleware: [offset(spacing), flip(), shift({ padding: 4 })],
8030
- });
8031
- Object.assign(floating.style, {
8032
- left: `${x}px`,
8033
- top: `${y}px`,
8034
- position: 'absolute',
8035
- });
8036
- });
8037
- }
8038
- hostDisconnected() {
8039
- this.cleanup?.();
8040
- }
8041
- }
8042
-
8043
- /**
8044
- * @label Tooltip
8045
- * @tag wc-tooltip
8046
- * @rawTag tooltip
8047
- * @summary Displays a tooltip for an element.
8048
- * @tags display
8049
- *
8050
- * @example
8051
- * ```html
8052
- * <wc-tooltip preview>Tooltip</wc-tooltip>
8053
- * ```
8054
- */
8055
- class Tooltip extends i$1 {
8056
- constructor() {
8057
- super(...arguments);
8058
- this.content = '';
8059
- /**
8060
- * The ID of the element the tooltip should attach to.
8061
- * If not provided, it defaults to the parent element.
8062
- */
8063
- this.for = '';
8064
- this.trigger = 'hover focus';
8065
- this.open = false;
8066
- this.variant = 'plain';
8067
- this.preview = false;
8068
- this._target = null;
8069
- this._popover = new PopoverController(this, {
8070
- placement: 'top',
8071
- offset: 8,
8072
- });
8073
- // Define listeners as arrow functions to maintain 'this' context
8074
- this._onMouseEnter = () => {
8075
- if (this.preview || !this.hasTrigger('hover'))
8076
- return;
8077
- window.clearTimeout(this._hideTimeout); // Cancel any pending close
8078
- this.show();
8079
- };
8080
- this._onMouseLeave = () => {
8081
- if (this.preview || !this.hasTrigger('hover'))
8082
- return;
8083
- // Small delay allows the mouse to move from target -> tooltip
8084
- // without the tooltip vanishing instantly.
8085
- this._hideTimeout = window.setTimeout(() => {
8086
- // Only hide if the mouse isn't currently hovering the target OR the tooltip
8087
- const isHoveringTarget = this._target?.matches(':hover');
8088
- const isHoveringTooltip = this.floatingEl?.matches(':hover');
8089
- if (!isHoveringTarget && !isHoveringTooltip) {
8090
- this.hide();
8091
- }
8092
- }, 100); // 100ms is usually enough for a smooth transition
8093
- };
8094
- this._onFocusIn = () => this.preview && this.hasTrigger('focus') && this.show();
8095
- this._onFocusOut = (e) => {
8096
- if (this.preview || !this.hasTrigger('focus'))
8097
- return;
8098
- if (this._target && !this._target.contains(e.relatedTarget)) {
8099
- this.hide();
8100
- }
8101
- };
8102
- this._onClick = (e) => {
8103
- if (this.preview || !this.hasTrigger('click'))
8104
- return;
8105
- e.stopPropagation();
8106
- this.toggle();
8107
- };
8108
- this._handleGlobalOpen = (e) => {
8109
- if (e.detail.invoker !== this)
8110
- this.hide();
8111
- };
8112
- this._handleDocumentClick = (e) => {
8113
- const path = e.composedPath();
8114
- if (this._target && !path.includes(this._target)) {
8115
- this.hide();
8116
- }
8117
- };
8118
- }
8119
- hasTrigger(type) {
8120
- return this.trigger.split(' ').includes(type);
8121
- }
8122
- show() {
8123
- if (this.open)
8124
- return;
8125
- window.dispatchEvent(new CustomEvent(Tooltip.CLOSE_OTHERS_EVENT, {
8126
- detail: { invoker: this },
8127
- }));
8128
- this.open = true;
8129
- }
8130
- hide() {
8131
- if (!this.open)
8132
- return;
8133
- this.open = false;
8134
- }
8135
- toggle() {
8136
- // eslint-disable-next-line no-unused-expressions
8137
- this.open ? this.hide() : this.show();
8138
- }
8139
- detachListeners() {
8140
- if (!this._target)
8141
- return;
8142
- this._target.removeEventListener('mouseenter', this._onMouseEnter);
8143
- this._target.removeEventListener('mouseleave', this._onMouseLeave);
8144
- this._target.removeEventListener('focusin', this._onFocusIn);
8145
- this._target.removeEventListener('focusout', this._onFocusOut);
8146
- this._target.removeEventListener('click', this._onClick);
8147
- this._target = null;
8148
- }
8149
- set forElement(value) {
8150
- if (value) {
8151
- this._focusTarget = value;
8152
- }
8153
- else {
8154
- this._focusTarget = undefined;
6286
+ else {
6287
+ this._focusTarget = undefined;
8155
6288
  }
8156
6289
  }
8157
6290
  __getFocusTarget() {
@@ -8165,7 +6298,7 @@ class Tooltip extends i$1 {
8165
6298
  return this.parentElement;
8166
6299
  }
8167
6300
  attachListeners() {
8168
- this.detachListeners(); // Cleanup old target if it exists
6301
+ this.detachListeners();
8169
6302
  // Resolve target: ID-based lookup or fallback to parent
8170
6303
  const root = this.getRootNode();
8171
6304
  this._target = this.for
@@ -8173,22 +6306,26 @@ class Tooltip extends i$1 {
8173
6306
  : this.parentElement;
8174
6307
  if (!this._target)
8175
6308
  return;
8176
- this._target.addEventListener('mouseenter', this._onMouseEnter);
8177
- this._target.addEventListener('mouseleave', this._onMouseLeave);
8178
- this._target.addEventListener('focusin', this._onFocusIn);
8179
- this._target.addEventListener('focusout', this._onFocusOut);
8180
- this._target.addEventListener('click', this._onClick);
6309
+ this._floating = new FloatingController(this, {
6310
+ placement: 'top',
6311
+ strategy: 'fixed',
6312
+ offset: 0,
6313
+ trigger: this.resolveTrigger(),
6314
+ closeOnClickOutside: true,
6315
+ onOpenChange: (isOpen) => {
6316
+ if (this.open === isOpen)
6317
+ return;
6318
+ this.open = isOpen;
6319
+ },
6320
+ });
6321
+ this._floating.setElements(this._target, this);
8181
6322
  }
8182
6323
  connectedCallback() {
8183
6324
  super.connectedCallback();
8184
6325
  this.attachListeners();
8185
- window.addEventListener(Tooltip.CLOSE_OTHERS_EVENT, this._handleGlobalOpen);
8186
- window.addEventListener('click', this._handleDocumentClick);
8187
6326
  }
8188
6327
  disconnectedCallback() {
8189
6328
  this.detachListeners();
8190
- window.removeEventListener(Tooltip.CLOSE_OTHERS_EVENT, this._handleGlobalOpen);
8191
- window.removeEventListener('click', this._handleDocumentClick);
8192
6329
  super.disconnectedCallback();
8193
6330
  }
8194
6331
  updated(changedProps) {
@@ -8196,21 +6333,28 @@ class Tooltip extends i$1 {
8196
6333
  if (changedProps.has('for')) {
8197
6334
  this.attachListeners();
8198
6335
  }
8199
- if (changedProps.has('open') && this.open && this._target) {
8200
- this._popover.updatePosition(this._target, this.floatingEl);
6336
+ if (changedProps.has('trigger') || changedProps.has('preview')) {
6337
+ this.attachListeners();
6338
+ }
6339
+ if (this._floating && this._target) {
6340
+ this._floating.setElements(this._target, this);
6341
+ if (changedProps.has('open') && this.open && !this._floating.isOpen) {
6342
+ this._floating.open();
6343
+ }
6344
+ if (changedProps.has('open') && !this.open && this._floating.isOpen) {
6345
+ this._floating.close();
6346
+ }
8201
6347
  }
8202
6348
  }
8203
6349
  render() {
8204
6350
  return b ` <div
8205
- class=${e$3({
6351
+ class=${e$1({
8206
6352
  tooltip: true,
8207
6353
  open: this.open,
8208
6354
  [`variant-${this.variant}`]: true,
8209
6355
  })}
8210
6356
  id="tooltip"
8211
6357
  role="tooltip"
8212
- @mouseenter=${this._onMouseEnter}
8213
- @mouseleave=${this._onMouseLeave}
8214
6358
  aria-hidden=${!this.open}
8215
6359
  aria-labelledby="tooltip-labelledby"
8216
6360
  >
@@ -8244,8 +6388,7 @@ class Tooltip extends i$1 {
8244
6388
  `;
8245
6389
  }
8246
6390
  }
8247
- Tooltip.styles = [css_248z$m];
8248
- Tooltip.CLOSE_OTHERS_EVENT = 'tooltip--open';
6391
+ Tooltip.styles = [css_248z$p];
8249
6392
  __decorate([
8250
6393
  n()
8251
6394
  ], Tooltip.prototype, "content", void 0);
@@ -8264,11 +6407,8 @@ __decorate([
8264
6407
  __decorate([
8265
6408
  n({ type: Boolean, reflect: true })
8266
6409
  ], Tooltip.prototype, "preview", void 0);
8267
- __decorate([
8268
- e$4('#tooltip')
8269
- ], Tooltip.prototype, "floatingEl", void 0);
8270
6410
 
8271
- var css_248z$l = i`* {
6411
+ var css_248z$o = i`* {
8272
6412
  box-sizing: border-box;
8273
6413
  }
8274
6414
 
@@ -8304,7 +6444,7 @@ ol {
8304
6444
  pointer-events: none;
8305
6445
  }`;
8306
6446
 
8307
- var css_248z$k = i`* {
6447
+ var css_248z$n = i`* {
8308
6448
  box-sizing: border-box;
8309
6449
  }
8310
6450
 
@@ -8398,7 +6538,7 @@ class BreadcrumbItem extends i$1 {
8398
6538
  render() {
8399
6539
  return b `
8400
6540
  <li
8401
- class=${e$3({ 'breadcrumb-item': true, active: this.active })}
6541
+ class=${e$1({ 'breadcrumb-item': true, active: this.active })}
8402
6542
  itemprop="itemListElement"
8403
6543
  itemscope
8404
6544
  itemtype="https://schema.org/ListItem"
@@ -8413,8 +6553,8 @@ class BreadcrumbItem extends i$1 {
8413
6553
  <a
8414
6554
  class="breadcrumb-link"
8415
6555
  itemprop="item"
8416
- href=${o$3(this.href)}
8417
- target=${o$3(this.target)}
6556
+ href=${o$2(this.href)}
6557
+ target=${o$2(this.target)}
8418
6558
  ${this.target === '_blank'
8419
6559
  ? b `rel="noopener noreferrer"`
8420
6560
  : A}
@@ -8434,7 +6574,7 @@ class BreadcrumbItem extends i$1 {
8434
6574
  `;
8435
6575
  }
8436
6576
  }
8437
- BreadcrumbItem.styles = [css_248z$k];
6577
+ BreadcrumbItem.styles = [css_248z$n];
8438
6578
  __decorate([
8439
6579
  n({ reflect: true })
8440
6580
  ], BreadcrumbItem.prototype, "href", void 0);
@@ -8488,13 +6628,13 @@ class Breadcrumb extends i$1 {
8488
6628
  </nav>`;
8489
6629
  }
8490
6630
  }
8491
- Breadcrumb.styles = [css_248z$l];
6631
+ Breadcrumb.styles = [css_248z$o];
8492
6632
  Breadcrumb.Item = BreadcrumbItem;
8493
6633
  __decorate([
8494
6634
  n({ type: String })
8495
6635
  ], Breadcrumb.prototype, "label", void 0);
8496
6636
 
8497
- var css_248z$j = i`* {
6637
+ var css_248z$m = i`* {
8498
6638
  box-sizing: border-box;
8499
6639
  }
8500
6640
 
@@ -8511,8 +6651,8 @@ var css_248z$j = i`* {
8511
6651
  min-width: 112px;
8512
6652
  padding-block: var(--spacing-050);
8513
6653
  transform-origin: top center;
8514
- --_menu-enter-duration: var(--duration-medium1, 250ms);
8515
- --_menu-exit-duration: var(--duration-short4, 200ms);
6654
+ --_menu-enter-duration: var(--duration-medium1);
6655
+ --_menu-exit-duration: var(--duration-medium2);
8516
6656
  --_menu-enter-easing: cubic-bezier(0.05, 0.7, 0.1, 1);
8517
6657
  --_menu-exit-easing: cubic-bezier(0.3, 0, 0.8, 0.15);
8518
6658
  transition-property: opacity, transform, visibility;
@@ -8602,7 +6742,7 @@ var css_248z$j = i`* {
8602
6742
  --_container-color: var(--color-tertiary-container);
8603
6743
  }`;
8604
6744
 
8605
- var css_248z$i = i`* {
6745
+ var css_248z$l = i`* {
8606
6746
  box-sizing: border-box;
8607
6747
  }
8608
6748
 
@@ -8694,6 +6834,9 @@ var css_248z$i = i`* {
8694
6834
  .menu-item:hover:not(:where(.disabled, .selected)) {
8695
6835
  --_container-state-opacity: 0.08;
8696
6836
  }
6837
+ .menu-item.pressed:not(:where(.disabled)) {
6838
+ --_container-state-opacity: 0.12;
6839
+ }
8697
6840
  .menu-item.selected {
8698
6841
  --_container-color: var(--menu-item-container-selected-color);
8699
6842
  --_label-text-color: var(--menu-item-label-selected-color);
@@ -8714,7 +6857,7 @@ var css_248z$i = i`* {
8714
6857
  display: none;
8715
6858
  }`;
8716
6859
 
8717
- var css_248z$h = i`:host-context([variant=standard]) {
6860
+ var css_248z$k = i`:host-context([variant=standard]) {
8718
6861
  --menu-item-label-color: var(--color-on-surface-variant);
8719
6862
  --menu-item-label-selected-color: var(--color-on-tertiary-container);
8720
6863
  --menu-item-container-selected-color: var(--color-tertiary-container);
@@ -8739,20 +6882,67 @@ var css_248z$h = i`:host-context([variant=standard]) {
8739
6882
  * <wc-menu-item>Menu Item</wc-menu-item>
8740
6883
  * ```
8741
6884
  */
8742
- class MenuItem extends i$1 {
6885
+ class MenuItem extends BaseButtonMixin(BaseHyperlinkMixin(i$1)) {
8743
6886
  constructor() {
8744
6887
  super(...arguments);
8745
- this.disabled = false;
8746
6888
  this.value = '';
8747
6889
  this.selected = false;
8748
6890
  this.keepOpen = false;
8749
6891
  this.hasSubmenu = false;
8750
6892
  this.submenuOpen = false;
8751
- /**
8752
- * Sets or retrieves the window or frame at which to target content.
8753
- */
8754
- this.target = '_self';
8755
6893
  this.variant = 'standard';
6894
+ /**
6895
+ * States
6896
+ */
6897
+ this.isPressed = false;
6898
+ this.__dispatchClickWithThrottle = event => {
6899
+ this.__dispatchClick(event);
6900
+ };
6901
+ this.__dispatchClick = (event) => {
6902
+ // If the button is soft-disabled or a disabled link, we need to explicitly
6903
+ // prevent the click from propagating to other event listeners as well as
6904
+ // prevent the default action.
6905
+ if (this.softDisabled || (this.disabled && this.href)) {
6906
+ event.stopImmediatePropagation();
6907
+ event.preventDefault();
6908
+ return;
6909
+ }
6910
+ if (!isActivationClick(event) || !this.itemElement) {
6911
+ return;
6912
+ }
6913
+ this.focus();
6914
+ dispatchActivationClick(this.itemElement);
6915
+ };
6916
+ this.__handleKeyDown = (event) => {
6917
+ this.__handlePress(event);
6918
+ if (this.disabled || this.softDisabled || !this.itemElement) {
6919
+ return;
6920
+ }
6921
+ if (event.key === ' ') {
6922
+ event.preventDefault();
6923
+ this.itemElement.click();
6924
+ return;
6925
+ }
6926
+ if (event.key === 'Enter' && !this.__isLink()) {
6927
+ event.preventDefault();
6928
+ this.itemElement.click();
6929
+ }
6930
+ };
6931
+ this.__handlePress = (event) => {
6932
+ if (this.disabled || this.softDisabled)
6933
+ return;
6934
+ if (event instanceof KeyboardEvent &&
6935
+ event.type === 'keydown' &&
6936
+ (event.key === 'Enter' || event.key === ' ')) {
6937
+ this.isPressed = true;
6938
+ }
6939
+ else if (event.type === 'mousedown') {
6940
+ this.isPressed = true;
6941
+ }
6942
+ else {
6943
+ this.isPressed = false;
6944
+ }
6945
+ };
8756
6946
  }
8757
6947
  connectedCallback() {
8758
6948
  // eslint-disable-next-line wc/guard-super-call
@@ -8760,73 +6950,19 @@ class MenuItem extends i$1 {
8760
6950
  if (!this.hasAttribute('role')) {
8761
6951
  this.setAttribute('role', 'menuitem');
8762
6952
  }
8763
- if (!this.hasAttribute('tabindex')) {
8764
- this.tabIndex = -1;
8765
- }
8766
- this.addEventListener('click', this._handleClick);
8767
- this.addEventListener('keydown', this._handleKeyDown);
6953
+ this.addEventListener('click', this.__dispatchClickWithThrottle);
6954
+ window.addEventListener('mouseup', this.__handlePress);
8768
6955
  }
8769
6956
  disconnectedCallback() {
8770
- this.removeEventListener('click', this._handleClick);
8771
- this.removeEventListener('keydown', this._handleKeyDown);
6957
+ window.removeEventListener('mouseup', this.__handlePress);
6958
+ this.removeEventListener('click', this.__dispatchClickWithThrottle);
8772
6959
  super.disconnectedCallback();
8773
6960
  }
8774
- emitActivate(source, key) {
8775
- this.dispatchEvent(new CustomEvent('menu-item-activate', {
8776
- bubbles: true,
8777
- composed: true,
8778
- detail: { item: this, source, key },
8779
- }));
6961
+ focus() {
6962
+ this.itemElement?.focus();
8780
6963
  }
8781
- requestClose(source, key) {
8782
- this.dispatchEvent(new CustomEvent('menu-item-request-close', {
8783
- bubbles: true,
8784
- composed: true,
8785
- detail: {
8786
- item: this,
8787
- source,
8788
- key,
8789
- reason: source === 'click' ? 'click-selection' : 'keydown',
8790
- },
8791
- }));
8792
- }
8793
- requestSubmenuKey(key) {
8794
- this.dispatchEvent(new CustomEvent('menu-item-submenu-keydown', {
8795
- bubbles: true,
8796
- composed: true,
8797
- detail: { item: this, key },
8798
- }));
8799
- }
8800
- _handleKeyDown(e) {
8801
- if (this.disabled) {
8802
- e.preventDefault();
8803
- return;
8804
- }
8805
- if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
8806
- this.requestSubmenuKey(e.key);
8807
- return;
8808
- }
8809
- if (e.key === 'Enter' || e.key === ' ') {
8810
- e.preventDefault();
8811
- this.emitActivate('keydown', e.key);
8812
- if (!this.keepOpen) {
8813
- this.requestClose('keydown', e.key);
8814
- }
8815
- }
8816
- }
8817
- _handleClick(e) {
8818
- if (this.disabled) {
8819
- e.preventDefault();
8820
- e.stopPropagation();
8821
- return;
8822
- }
8823
- this.emitActivate('click');
8824
- if (!this.keepOpen) {
8825
- this.requestClose('click');
8826
- }
8827
- }
8828
- __isLink() {
8829
- return !!this.href;
6964
+ blur() {
6965
+ this.itemElement?.blur();
8830
6966
  }
8831
6967
  render() {
8832
6968
  const isLink = this.__isLink();
@@ -8834,14 +6970,22 @@ class MenuItem extends i$1 {
8834
6970
  'menu-item': true,
8835
6971
  disabled: this.disabled,
8836
6972
  selected: this.selected,
6973
+ pressed: this.isPressed,
8837
6974
  };
8838
6975
  const controls = this.getAttribute('aria-controls');
8839
6976
  if (isLink) {
8840
6977
  return b `<a
8841
6978
  id="item"
8842
- class=${e$3(cssClasses)}
6979
+ class=${e$1(cssClasses)}
8843
6980
  href=${this.href}
8844
6981
  target=${this.target}
6982
+ tabindex=${this.disabled ? '-1' : '0'}
6983
+
6984
+ @click=${this.__dispatchClickWithThrottle}
6985
+ @mousedown=${this.__handlePress}
6986
+ @keydown=${this.__handleKeyDown}
6987
+ @keyup=${this.__handlePress}
6988
+
8845
6989
  aria-disabled=${String(this.disabled)}
8846
6990
  aria-haspopup=${this.hasSubmenu ? 'menu' : A}
8847
6991
  aria-controls=${this.hasSubmenu && controls ? controls : A}
@@ -8852,7 +6996,14 @@ class MenuItem extends i$1 {
8852
6996
  }
8853
6997
  return b `<div
8854
6998
  id="item"
8855
- class=${e$3(cssClasses)}
6999
+ class=${e$1(cssClasses)}
7000
+ tabindex=${this.disabled ? '-1' : '0'}
7001
+
7002
+ @click=${this.__dispatchClick}
7003
+ @mousedown=${this.__handlePress}
7004
+ @keydown=${this.__handleKeyDown}
7005
+ @keyup=${this.__handlePress}
7006
+
8856
7007
  aria-disabled=${String(this.disabled)}
8857
7008
  aria-haspopup=${this.hasSubmenu ? 'menu' : A}
8858
7009
  aria-controls=${this.hasSubmenu && controls ? controls : A}
@@ -8867,7 +7018,7 @@ class MenuItem extends i$1 {
8867
7018
  <div class="background"></div>
8868
7019
  <wc-ripple class="ripple"></wc-ripple>
8869
7020
 
8870
- <div class="menu-item-content">
7021
+ <div class="menu-item-content" data-variant=${this.variant}>
8871
7022
  <slot name="leading-icon"></slot>
8872
7023
  <div class="slot-container">
8873
7024
  <slot></slot>
@@ -8877,10 +7028,7 @@ class MenuItem extends i$1 {
8877
7028
  `;
8878
7029
  }
8879
7030
  }
8880
- MenuItem.styles = [css_248z$i, css_248z$h];
8881
- __decorate([
8882
- n({ type: Boolean, reflect: true })
8883
- ], MenuItem.prototype, "disabled", void 0);
7031
+ MenuItem.styles = [css_248z$l, css_248z$k];
8884
7032
  __decorate([
8885
7033
  n({ type: String })
8886
7034
  ], MenuItem.prototype, "value", void 0);
@@ -8896,49 +7044,15 @@ __decorate([
8896
7044
  __decorate([
8897
7045
  n({ type: Boolean, attribute: 'submenu-open' })
8898
7046
  ], MenuItem.prototype, "submenuOpen", void 0);
8899
- __decorate([
8900
- n({ reflect: true })
8901
- ], MenuItem.prototype, "href", void 0);
8902
- __decorate([
8903
- n()
8904
- ], MenuItem.prototype, "target", void 0);
8905
7047
  __decorate([
8906
7048
  n({ type: String, reflect: true })
8907
7049
  ], MenuItem.prototype, "variant", void 0);
8908
-
8909
- async function updateSurfacePosition(options) {
8910
- const { x, y } = await computePosition(options.reference, options.floating, {
8911
- strategy: options.strategy,
8912
- placement: options.placement,
8913
- middleware: [offset(options.offset), flip(), shift({ padding: 8 })],
8914
- });
8915
- Object.assign(options.floating.style, {
8916
- position: options.strategy,
8917
- left: `${x}px`,
8918
- top: `${y}px`,
8919
- });
8920
- }
8921
- class MenuSurfaceController {
8922
- constructor(host) {
8923
- this.host = host;
8924
- this.host.addController(this);
8925
- }
8926
- start(options) {
8927
- this.stop();
8928
- const strategy = options.strategy ?? 'fixed';
8929
- this.cleanup = autoUpdate(options.reference, options.floating, () => {
8930
- updateSurfacePosition({ ...options, strategy });
8931
- });
8932
- updateSurfacePosition({ ...options, strategy });
8933
- }
8934
- stop() {
8935
- this.cleanup?.();
8936
- this.cleanup = undefined;
8937
- }
8938
- hostDisconnected() {
8939
- this.stop();
8940
- }
8941
- }
7050
+ __decorate([
7051
+ e$2('#item')
7052
+ ], MenuItem.prototype, "itemElement", void 0);
7053
+ __decorate([
7054
+ r()
7055
+ ], MenuItem.prototype, "isPressed", void 0);
8942
7056
 
8943
7057
  /**
8944
7058
  * @label Menu
@@ -8969,44 +7083,44 @@ class Menu extends i$1 {
8969
7083
  this.offset = 6;
8970
7084
  this.activeIndex = -1;
8971
7085
  this.anchorElement = null;
8972
- this._surfaceController = new MenuSurfaceController(this);
7086
+ this._floatingController = new FloatingController(this, {
7087
+ trigger: 'manual',
7088
+ closeOnClickOutside: false,
7089
+ strategy: 'fixed',
7090
+ onOpenChange: (isOpen) => {
7091
+ if (isOpen || !this.open) {
7092
+ return;
7093
+ }
7094
+ this.close({ kind: 'outside-click' });
7095
+ },
7096
+ });
8973
7097
  this._lastFocusedElement = null;
8974
7098
  this._closeReason = { kind: 'programmatic' };
8975
- this._onItemActivate = (event) => {
8976
- const customEvent = event;
8977
- const { item } = customEvent.detail;
8978
- const ownedItems = this.items;
8979
- if (!ownedItems.includes(item)) {
8980
- return;
8981
- }
8982
- const enabledItems = this._enabledItems();
8983
- const nextIndex = enabledItems.indexOf(item);
8984
- if (nextIndex >= 0) {
8985
- this.activeIndex = nextIndex;
8986
- this._syncRovingTabIndex();
8987
- }
8988
- };
8989
- this._onItemRequestClose = (event) => {
8990
- const customEvent = event;
8991
- if (!this.items.includes(customEvent.detail.item)) {
7099
+ this._onClick = (event) => {
7100
+ if (!this.open) {
8992
7101
  return;
8993
7102
  }
8994
- if (customEvent.defaultPrevented) {
7103
+ const item = this._ownedItemFromEvent(event);
7104
+ if (!item) {
8995
7105
  return;
8996
7106
  }
8997
- if (customEvent.detail.reason === 'click-selection') {
8998
- this.close({ kind: 'click-selection' });
7107
+ this._setActiveItem(item);
7108
+ if (item.keepOpen) {
8999
7109
  return;
9000
7110
  }
9001
- this.close({ kind: 'keydown', key: customEvent.detail.key ?? 'Enter' });
7111
+ this.close({ kind: 'click-selection' });
9002
7112
  };
9003
7113
  this._onKeyDown = (event) => {
9004
7114
  if (!this.open) {
9005
7115
  return;
9006
7116
  }
9007
- if (!this._ownsKeyboardEvent(event)) {
7117
+ if (!this._isEventFromThisMenu(event)) {
9008
7118
  return;
9009
7119
  }
7120
+ const eventItem = this._ownedItemFromEvent(event);
7121
+ if (eventItem) {
7122
+ this._setActiveItem(eventItem);
7123
+ }
9010
7124
  switch (event.key) {
9011
7125
  case 'ArrowDown':
9012
7126
  event.preventDefault();
@@ -9030,33 +7144,22 @@ class Menu extends i$1 {
9030
7144
  event.preventDefault();
9031
7145
  this.close({ kind: 'keydown', key: 'Escape' });
9032
7146
  break;
7147
+ case 'Tab':
7148
+ this.close({ kind: 'keydown', key: 'Tab' });
7149
+ break;
7150
+ case 'Enter':
7151
+ case ' ': {
7152
+ event.preventDefault();
7153
+ const activeItem = this._getActiveItem() ?? this._getFirstEnabledItem();
7154
+ if (!activeItem) {
7155
+ return;
7156
+ }
7157
+ this._setActiveItem(activeItem);
7158
+ activeItem.click();
7159
+ break;
7160
+ }
9033
7161
  }
9034
7162
  };
9035
- this._onWindowClick = (event) => {
9036
- if (!this.open || this.stayOpenOnOutsideClick) {
9037
- return;
9038
- }
9039
- const path = event.composedPath();
9040
- const anchorEl = this._resolveAnchorElement();
9041
- const inMenuTree = path.some(target => target === this || (target instanceof Node && this.contains(target)));
9042
- if (inMenuTree || (anchorEl && path.includes(anchorEl))) {
9043
- return;
9044
- }
9045
- this.close({ kind: 'outside-click' });
9046
- };
9047
- this._onFocusOut = (event) => {
9048
- if (!this.open || this.stayOpenOnFocusout) {
9049
- return;
9050
- }
9051
- const next = event.relatedTarget;
9052
- if (!next) {
9053
- return;
9054
- }
9055
- if (next instanceof Node && this._isWithinMenuTree(next)) {
9056
- return;
9057
- }
9058
- this.close({ kind: 'focusout' });
9059
- };
9060
7163
  this._onSlotChange = () => {
9061
7164
  this._syncRovingTabIndex();
9062
7165
  };
@@ -9066,18 +7169,13 @@ class Menu extends i$1 {
9066
7169
  super.connectedCallback();
9067
7170
  this.setAttribute('role', 'menu');
9068
7171
  this.addEventListener('keydown', this._onKeyDown);
9069
- this.addEventListener('focusout', this._onFocusOut);
9070
- this.addEventListener('menu-item-activate', this._onItemActivate);
9071
- this.addEventListener('menu-item-request-close', this._onItemRequestClose);
9072
- window.addEventListener('click', this._onWindowClick, { capture: true });
7172
+ this.addEventListener('click', this._onClick);
9073
7173
  this._syncAnchorAria();
9074
7174
  }
9075
7175
  disconnectedCallback() {
9076
7176
  this.removeEventListener('keydown', this._onKeyDown);
9077
- this.removeEventListener('focusout', this._onFocusOut);
9078
- this.removeEventListener('menu-item-activate', this._onItemActivate);
9079
- this.removeEventListener('menu-item-request-close', this._onItemRequestClose);
9080
- window.removeEventListener('click', this._onWindowClick, { capture: true });
7177
+ this.removeEventListener('click', this._onClick);
7178
+ this._floatingController.close();
9081
7179
  super.disconnectedCallback();
9082
7180
  }
9083
7181
  get items() {
@@ -9144,7 +7242,11 @@ class Menu extends i$1 {
9144
7242
  return this.items.filter(item => !item.disabled);
9145
7243
  }
9146
7244
  _syncRovingTabIndex() {
7245
+ const ownedItems = this.items;
9147
7246
  const enabledItems = this._enabledItems();
7247
+ for (const item of ownedItems) {
7248
+ item.tabIndex = -1;
7249
+ }
9148
7250
  if (!enabledItems.length) {
9149
7251
  this.activeIndex = -1;
9150
7252
  return;
@@ -9152,10 +7254,7 @@ class Menu extends i$1 {
9152
7254
  if (this.activeIndex < 0 || this.activeIndex >= enabledItems.length) {
9153
7255
  this.activeIndex = 0;
9154
7256
  }
9155
- for (let index = 0; index < enabledItems.length; index += 1) {
9156
- const currentItem = enabledItems[index];
9157
- currentItem.tabIndex = index === this.activeIndex ? 0 : -1;
9158
- }
7257
+ enabledItems[this.activeIndex].tabIndex = 0;
9159
7258
  }
9160
7259
  _setActiveByOffset(offset) {
9161
7260
  const enabledItems = this._enabledItems();
@@ -9191,29 +7290,38 @@ class Menu extends i$1 {
9191
7290
  _getFirstEnabledItem() {
9192
7291
  return this._enabledItems()[0] ?? null;
9193
7292
  }
9194
- _ownsKeyboardEvent(event) {
7293
+ _isEventFromThisMenu(event) {
9195
7294
  const path = event.composedPath();
9196
- const ownedItems = this.items;
9197
- return path.some(target => target instanceof MenuItem && ownedItems.includes(target));
7295
+ const sourceMenu = path.find(target => target instanceof HTMLElement &&
7296
+ target.tagName.toLowerCase() === 'wc-menu');
7297
+ return sourceMenu === this;
9198
7298
  }
9199
- _isWithinMenuTree(node) {
9200
- if (!node) {
9201
- return false;
7299
+ _ownedItemFromEvent(event) {
7300
+ if (!this._isEventFromThisMenu(event)) {
7301
+ return null;
9202
7302
  }
9203
- let current = node;
9204
- while (current) {
9205
- if (current === this || this.contains(current)) {
9206
- return true;
9207
- }
9208
- const root = current.getRootNode();
9209
- if (root instanceof ShadowRoot) {
9210
- current = root.host;
9211
- }
9212
- else {
9213
- current = null;
7303
+ const path = event.composedPath();
7304
+ const ownedItems = this.items;
7305
+ for (const target of path) {
7306
+ if (target instanceof HTMLElement) {
7307
+ if (target.tagName.toLowerCase() === 'wc-menu-item') {
7308
+ const ownedItem = ownedItems.find(item => item === target);
7309
+ if (ownedItem) {
7310
+ return ownedItem;
7311
+ }
7312
+ }
9214
7313
  }
9215
7314
  }
9216
- return false;
7315
+ return null;
7316
+ }
7317
+ _setActiveItem(item) {
7318
+ const enabledItems = this._enabledItems();
7319
+ const nextIndex = enabledItems.indexOf(item);
7320
+ if (nextIndex < 0) {
7321
+ return;
7322
+ }
7323
+ this.activeIndex = nextIndex;
7324
+ this._syncRovingTabIndex();
9217
7325
  }
9218
7326
  _applyPositioning() {
9219
7327
  if (!this.open || !this.menuListElement) {
@@ -9223,13 +7331,14 @@ class Menu extends i$1 {
9223
7331
  if (!anchorEl) {
9224
7332
  return;
9225
7333
  }
9226
- this._surfaceController.start({
9227
- reference: anchorEl,
9228
- floating: this.menuListElement,
7334
+ this._floatingController.setOptions({
9229
7335
  placement: this.placement,
9230
7336
  offset: this.offset,
9231
7337
  strategy: 'fixed',
7338
+ closeOnClickOutside: !this.stayOpenOnOutsideClick,
9232
7339
  });
7340
+ this._floatingController.setElements(anchorEl, this.menuListElement);
7341
+ this._floatingController.open();
9233
7342
  }
9234
7343
  updated(changedProperties) {
9235
7344
  if (changedProperties.has('anchor') || changedProperties.has('open')) {
@@ -9246,7 +7355,7 @@ class Menu extends i$1 {
9246
7355
  this._applyPositioning();
9247
7356
  }
9248
7357
  else {
9249
- this._surfaceController.stop();
7358
+ this._floatingController.close();
9250
7359
  const reason = this._closeReason;
9251
7360
  this.dispatchEvent(new CustomEvent('close-menu', {
9252
7361
  bubbles: true,
@@ -9261,7 +7370,8 @@ class Menu extends i$1 {
9261
7370
  composed: true,
9262
7371
  detail: { reason },
9263
7372
  }));
9264
- if (!this.isSubmenu) {
7373
+ const shouldRestoreFocus = reason.kind !== 'keydown' || reason.key !== 'Tab';
7374
+ if (!this.isSubmenu && shouldRestoreFocus) {
9265
7375
  this._lastFocusedElement?.focus();
9266
7376
  }
9267
7377
  }
@@ -9276,7 +7386,7 @@ class Menu extends i$1 {
9276
7386
  }
9277
7387
  render() {
9278
7388
  return b `<div
9279
- class=${e$3({
7389
+ class=${e$1({
9280
7390
  'menu': true,
9281
7391
  open: !this.preview && this.open,
9282
7392
  closed: !this.preview && !this.open,
@@ -9294,7 +7404,7 @@ class Menu extends i$1 {
9294
7404
  </div>`;
9295
7405
  }
9296
7406
  }
9297
- Menu.styles = [css_248z$j];
7407
+ Menu.styles = [css_248z$m];
9298
7408
  Menu.Item = MenuItem;
9299
7409
  __decorate([
9300
7410
  n({ type: Boolean, reflect: true })
@@ -9327,10 +7437,10 @@ __decorate([
9327
7437
  r()
9328
7438
  ], Menu.prototype, "activeIndex", void 0);
9329
7439
  __decorate([
9330
- e$4('.menu')
7440
+ e$2('.menu')
9331
7441
  ], Menu.prototype, "menuListElement", void 0);
9332
7442
 
9333
- var css_248z$g = i`* {
7443
+ var css_248z$j = i`* {
9334
7444
  box-sizing: border-box;
9335
7445
  }
9336
7446
 
@@ -9510,42 +7620,380 @@ class SubMenu extends i$1 {
9510
7620
  }
9511
7621
  render() {
9512
7622
  return b `
9513
- <slot
9514
- name="item"
9515
- @slotchange=${this._onSlotChange}
9516
- @click=${this._onItemClick}
9517
- @keydown=${this._onItemKeyDown}
9518
- ></slot>
9519
- <slot
9520
- name="menu"
9521
- @slotchange=${this._onSlotChange}
9522
- @close-menu=${this._onCloseMenu}
9523
- @keydown=${this._onMenuKeyDown}
9524
- ></slot>
7623
+ <slot
7624
+ name="item"
7625
+ @slotchange=${this._onSlotChange}
7626
+ @click=${this._onItemClick}
7627
+ @keydown=${this._onItemKeyDown}
7628
+ ></slot>
7629
+ <slot
7630
+ name="menu"
7631
+ @slotchange=${this._onSlotChange}
7632
+ @close-menu=${this._onCloseMenu}
7633
+ @keydown=${this._onMenuKeyDown}
7634
+ ></slot>
7635
+ `;
7636
+ }
7637
+ }
7638
+ SubMenu.styles = [css_248z$j];
7639
+ __decorate([
7640
+ n({ type: Number, attribute: 'hover-open-delay' })
7641
+ ], SubMenu.prototype, "hoverOpenDelay", void 0);
7642
+ __decorate([
7643
+ n({ type: Number, attribute: 'hover-close-delay' })
7644
+ ], SubMenu.prototype, "hoverCloseDelay", void 0);
7645
+ __decorate([
7646
+ n({ type: String, attribute: 'anchor-corner' })
7647
+ ], SubMenu.prototype, "anchorCorner", void 0);
7648
+ __decorate([
7649
+ n({ type: String, attribute: 'menu-corner' })
7650
+ ], SubMenu.prototype, "menuCorner", void 0);
7651
+ __decorate([
7652
+ o({ slot: 'item' })
7653
+ ], SubMenu.prototype, "_items", void 0);
7654
+ __decorate([
7655
+ o({ slot: 'menu' })
7656
+ ], SubMenu.prototype, "_menus", void 0);
7657
+
7658
+ var css_248z$i = i`* {
7659
+ box-sizing: border-box;
7660
+ }
7661
+
7662
+ .screen-reader-only {
7663
+ display: none !important;
7664
+ }
7665
+
7666
+ :host {
7667
+ display: block;
7668
+ }
7669
+
7670
+ .list {
7671
+ display: flex;
7672
+ flex-direction: column;
7673
+ gap: var(--spacing-050);
7674
+ padding-block: var(--spacing-050);
7675
+ border-radius: var(--shape-corner-large);
7676
+ background-color: var(--_container-color);
7677
+ }
7678
+
7679
+ .list.variant-standard {
7680
+ --_container-color: var(--color-surface-container);
7681
+ }
7682
+
7683
+ .list.variant-vibrant {
7684
+ --_container-color: var(--color-tertiary-container);
7685
+ }`;
7686
+
7687
+ var css_248z$h = i`* {
7688
+ box-sizing: border-box;
7689
+ }
7690
+
7691
+ .screen-reader-only {
7692
+ display: none !important;
7693
+ }
7694
+
7695
+ :host {
7696
+ display: block;
7697
+ padding-inline: var(--spacing-050);
7698
+ }
7699
+
7700
+ .item-element {
7701
+ position: relative;
7702
+ min-height: 3.5rem;
7703
+ width: 100%;
7704
+ border: 0;
7705
+ margin: 0;
7706
+ padding: 0;
7707
+ outline: 0;
7708
+ background: transparent;
7709
+ text-align: initial;
7710
+ text-decoration: none;
7711
+ cursor: pointer;
7712
+ font-family: var(--typography-body-large-font-family) !important;
7713
+ font-size: var(--typography-body-large-font-size) !important;
7714
+ font-weight: var(--typography-body-large-font-weight) !important;
7715
+ line-height: var(--typography-body-large-line-height) !important;
7716
+ letter-spacing: var(--typography-body-large-letter-spacing) !important;
7717
+ }
7718
+ .item-element .list-item-content {
7719
+ position: relative;
7720
+ z-index: 1;
7721
+ display: flex;
7722
+ align-items: center;
7723
+ gap: var(--spacing-200);
7724
+ min-height: 3.5rem;
7725
+ padding-inline: var(--spacing-200);
7726
+ color: var(--_label-text-color);
7727
+ opacity: var(--_label-text-opacity, 1);
7728
+ }
7729
+ .item-element .leading,
7730
+ .item-element .trailing {
7731
+ display: inline-flex;
7732
+ align-items: center;
7733
+ justify-content: center;
7734
+ min-width: 1.5rem;
7735
+ color: var(--_leading-trailing-color);
7736
+ }
7737
+ .item-element .trailing {
7738
+ margin-inline-start: auto;
7739
+ }
7740
+ .item-element .content {
7741
+ display: block;
7742
+ flex: 1;
7743
+ min-inline-size: 0;
7744
+ }
7745
+ .item-element .background {
7746
+ position: absolute;
7747
+ inset: 0;
7748
+ background-color: var(--_container-color);
7749
+ opacity: var(--_container-opacity, 1);
7750
+ border-radius: var(--shape-corner-medium);
7751
+ pointer-events: none;
7752
+ }
7753
+ .item-element .focus-ring {
7754
+ --focus-ring-container-shape-start-start: var(--shape-corner-medium);
7755
+ --focus-ring-container-shape-start-end: var(--shape-corner-medium);
7756
+ --focus-ring-container-shape-end-start: var(--shape-corner-medium);
7757
+ --focus-ring-container-shape-end-end: var(--shape-corner-medium);
7758
+ z-index: 2;
7759
+ }
7760
+ .item-element .ripple {
7761
+ --ripple-state-opacity: var(--_container-state-opacity, 0);
7762
+ --ripple-pressed-color: var(--_container-state-color);
7763
+ border-radius: var(--shape-corner-medium);
7764
+ }
7765
+
7766
+ .item-element {
7767
+ --_container-color: transparent;
7768
+ --_label-text-color: var(--color-on-surface);
7769
+ --_leading-trailing-color: var(--color-on-surface-variant);
7770
+ --_container-state-color: var(--color-on-surface);
7771
+ }
7772
+ .item-element:hover:not(:where(.disabled, .selected)) {
7773
+ --_container-state-opacity: 0.08;
7774
+ }
7775
+ .item-element.pressed:not(:where(.disabled)) {
7776
+ --_container-state-opacity: 0.12;
7777
+ }
7778
+ .item-element.selected {
7779
+ --_container-color: var(--color-secondary-container);
7780
+ --_label-text-color: var(--color-on-secondary-container);
7781
+ --_leading-trailing-color: var(--color-on-secondary-container);
7782
+ --_container-state-color: var(--color-on-secondary-container);
7783
+ }
7784
+ .item-element.disabled {
7785
+ cursor: not-allowed;
7786
+ --_label-text-color: var(--color-on-surface);
7787
+ --_label-text-opacity: 0.38;
7788
+ --_leading-trailing-color: var(--color-on-surface);
7789
+ --_container-opacity: 0.12;
7790
+ }
7791
+ .item-element.disabled .ripple {
7792
+ display: none;
7793
+ }`;
7794
+
7795
+ /**
7796
+ * @label List Item
7797
+ * @tag wc-list-item
7798
+ * @rawTag list-item
7799
+ * @parentRawTag list
7800
+ *
7801
+ * @summary A Material 3 list item with leading, trailing and content slots.
7802
+ *
7803
+ * @example
7804
+ * ```html
7805
+ * <wc-list-item selected>
7806
+ * <wc-icon slot="leading" name="person"></wc-icon>
7807
+ * Profile
7808
+ * <wc-icon slot="trailing" name="chevron_right"></wc-icon>
7809
+ * </wc-list-item>
7810
+ * ```
7811
+ * @tags display
7812
+ */
7813
+ class ListItem extends BaseButtonMixin(BaseHyperlinkMixin(i$1)) {
7814
+ constructor() {
7815
+ super(...arguments);
7816
+ this.selected = false;
7817
+ this.isPressed = false;
7818
+ this.__dispatchClick = (event) => {
7819
+ if (this.softDisabled || (this.disabled && this.href)) {
7820
+ event.stopImmediatePropagation();
7821
+ event.preventDefault();
7822
+ return;
7823
+ }
7824
+ if (!isActivationClick(event) || !this.itemElement) {
7825
+ return;
7826
+ }
7827
+ this.focus();
7828
+ dispatchActivationClick(this.itemElement);
7829
+ };
7830
+ this.__handleKeyDown = (event) => {
7831
+ this.__handlePress(event);
7832
+ if (this.disabled || this.softDisabled || !this.itemElement) {
7833
+ return;
7834
+ }
7835
+ if (event.key === ' ') {
7836
+ event.preventDefault();
7837
+ this.itemElement.click();
7838
+ return;
7839
+ }
7840
+ if (event.key === 'Enter' && !this.__isLink()) {
7841
+ event.preventDefault();
7842
+ this.itemElement.click();
7843
+ }
7844
+ };
7845
+ this.__handlePress = (event) => {
7846
+ if (this.disabled || this.softDisabled)
7847
+ return;
7848
+ if (event instanceof KeyboardEvent &&
7849
+ event.type === 'keydown' &&
7850
+ (event.key === 'Enter' || event.key === ' ')) {
7851
+ this.isPressed = true;
7852
+ }
7853
+ else if (event.type === 'mousedown') {
7854
+ this.isPressed = true;
7855
+ }
7856
+ else {
7857
+ this.isPressed = false;
7858
+ }
7859
+ };
7860
+ }
7861
+ connectedCallback() {
7862
+ // eslint-disable-next-line wc/guard-super-call
7863
+ super.connectedCallback();
7864
+ if (!this.hasAttribute('role')) {
7865
+ this.setAttribute('role', 'listitem');
7866
+ }
7867
+ }
7868
+ focus() {
7869
+ this.itemElement?.focus();
7870
+ }
7871
+ blur() {
7872
+ this.itemElement?.blur();
7873
+ }
7874
+ render() {
7875
+ const isLink = this.__isLink();
7876
+ const cssClasses = {
7877
+ 'list-item': true,
7878
+ 'item-element': true,
7879
+ selected: this.selected,
7880
+ disabled: this.disabled || this.softDisabled,
7881
+ pressed: this.isPressed,
7882
+ };
7883
+ if (!isLink) {
7884
+ return b `
7885
+ <button
7886
+ id="item"
7887
+ class=${e$1(cssClasses)}
7888
+ type=${this.htmlType}
7889
+ ?disabled=${this.disabled}
7890
+ ?aria-disabled=${this.softDisabled}
7891
+ @click=${this.__dispatchClick}
7892
+ @mousedown=${this.__handlePress}
7893
+ @keydown=${this.__handleKeyDown}
7894
+ @keyup=${this.__handlePress}
7895
+ >
7896
+ ${this.renderContent()}
7897
+ </button>
7898
+ `;
7899
+ }
7900
+ return b `
7901
+ <a
7902
+ id="item"
7903
+ class=${e$1(cssClasses)}
7904
+ href=${this.href}
7905
+ target=${this.target}
7906
+ rel=${o$2(this.rel)}
7907
+ download=${o$2(this.download)}
7908
+ tabindex=${this.disabled ? '-1' : '0'}
7909
+ aria-disabled=${String(this.disabled || this.softDisabled)}
7910
+ @click=${this.__dispatchClick}
7911
+ @mousedown=${this.__handlePress}
7912
+ @keydown=${this.__handleKeyDown}
7913
+ @keyup=${this.__handlePress}
7914
+ >
7915
+ ${this.renderContent()}
7916
+ </a>
7917
+ `;
7918
+ }
7919
+ renderContent() {
7920
+ return b `
7921
+ <wc-focus-ring class="focus-ring" for="item"></wc-focus-ring>
7922
+ <div class="background"></div>
7923
+ <wc-ripple class="ripple"></wc-ripple>
7924
+
7925
+ <div class="list-item-content">
7926
+ <div class="leading">
7927
+ <slot name="leading"></slot>
7928
+ </div>
7929
+ <div class="content">
7930
+ <slot></slot>
7931
+ </div>
7932
+ <div class="trailing">
7933
+ <slot name="trailing"></slot>
7934
+ </div>
7935
+ </div>
7936
+ `;
7937
+ }
7938
+ }
7939
+ ListItem.styles = [css_248z$h];
7940
+ __decorate([
7941
+ n({ type: Boolean, reflect: true })
7942
+ ], ListItem.prototype, "selected", void 0);
7943
+ __decorate([
7944
+ e$2('#item')
7945
+ ], ListItem.prototype, "itemElement", void 0);
7946
+ __decorate([
7947
+ r()
7948
+ ], ListItem.prototype, "isPressed", void 0);
7949
+
7950
+ /**
7951
+ * @label List
7952
+ * @tag wc-list
7953
+ * @rawTag list
7954
+ *
7955
+ * @summary A Material 3 list container for one or more list items.
7956
+ *
7957
+ * @example
7958
+ * ```html
7959
+ * <wc-list>
7960
+ * <wc-list-item>
7961
+ * <wc-icon slot="leading" name="inbox"></wc-icon>
7962
+ * Inbox
7963
+ * <span slot="trailing">24</span>
7964
+ * </wc-list-item>
7965
+ * </wc-list>
7966
+ * ```
7967
+ * @tags display
7968
+ */
7969
+ class List extends i$1 {
7970
+ constructor() {
7971
+ super(...arguments);
7972
+ this.variant = 'standard';
7973
+ }
7974
+ connectedCallback() {
7975
+ super.connectedCallback();
7976
+ this.setAttribute('role', 'list');
7977
+ }
7978
+ render() {
7979
+ const cssClasses = {
7980
+ list: true,
7981
+ [`variant-${this.variant}`]: true,
7982
+ };
7983
+ return b `
7984
+ <div class=${e$1(cssClasses)}>
7985
+ <slot></slot>
7986
+ </div>
9525
7987
  `;
9526
7988
  }
9527
7989
  }
9528
- SubMenu.styles = [css_248z$g];
9529
- __decorate([
9530
- n({ type: Number, attribute: 'hover-open-delay' })
9531
- ], SubMenu.prototype, "hoverOpenDelay", void 0);
9532
- __decorate([
9533
- n({ type: Number, attribute: 'hover-close-delay' })
9534
- ], SubMenu.prototype, "hoverCloseDelay", void 0);
9535
- __decorate([
9536
- n({ type: String, attribute: 'anchor-corner' })
9537
- ], SubMenu.prototype, "anchorCorner", void 0);
7990
+ List.styles = [css_248z$i];
7991
+ List.Item = ListItem;
9538
7992
  __decorate([
9539
- n({ type: String, attribute: 'menu-corner' })
9540
- ], SubMenu.prototype, "menuCorner", void 0);
9541
- __decorate([
9542
- o$1({ slot: 'item' })
9543
- ], SubMenu.prototype, "_items", void 0);
9544
- __decorate([
9545
- o$1({ slot: 'menu' })
9546
- ], SubMenu.prototype, "_menus", void 0);
7993
+ n({ type: String, reflect: true })
7994
+ ], List.prototype, "variant", void 0);
9547
7995
 
9548
- var css_248z$f = i`@charset "UTF-8";
7996
+ var css_248z$g = i`@charset "UTF-8";
9549
7997
  :host {
9550
7998
  display: block;
9551
7999
  height: 100%;
@@ -9702,7 +8150,7 @@ class Image extends i$1 {
9702
8150
  `;
9703
8151
  }
9704
8152
  }
9705
- Image.styles = [css_248z$f];
8153
+ Image.styles = [css_248z$g];
9706
8154
  __decorate([
9707
8155
  n({ reflect: true })
9708
8156
  ], Image.prototype, "src", void 0);
@@ -9725,6 +8173,251 @@ __decorate([
9725
8173
  r()
9726
8174
  ], Image.prototype, "_previewOpen", void 0);
9727
8175
 
8176
+ var css_248z$f = i`* {
8177
+ box-sizing: border-box;
8178
+ }
8179
+
8180
+ .screen-reader-only {
8181
+ display: none !important;
8182
+ }
8183
+
8184
+ :host {
8185
+ display: inline-flex;
8186
+ vertical-align: middle;
8187
+ --svg-size: inherit;
8188
+ --svg-color: inherit;
8189
+ }
8190
+
8191
+ .svg-wrapper {
8192
+ height: var(--svg-size, 1rem);
8193
+ width: var(--svg-size, 1rem);
8194
+ display: inline-flex;
8195
+ align-items: center;
8196
+ justify-content: center;
8197
+ }
8198
+
8199
+ .svg-content {
8200
+ height: 100%;
8201
+ width: 100%;
8202
+ display: inline-flex;
8203
+ align-items: center;
8204
+ justify-content: center;
8205
+ }
8206
+ .svg-content svg {
8207
+ fill: var(--svg-color);
8208
+ height: 100%;
8209
+ width: 100%;
8210
+ }
8211
+
8212
+ .svg-content.clickable {
8213
+ cursor: zoom-in;
8214
+ }
8215
+
8216
+ .placeholder {
8217
+ display: block;
8218
+ height: 100%;
8219
+ width: 100%;
8220
+ }
8221
+
8222
+ .preview-overlay {
8223
+ display: none;
8224
+ position: fixed;
8225
+ inset: 0;
8226
+ z-index: 9999;
8227
+ background: rgba(0, 0, 0, 0.85);
8228
+ align-items: center;
8229
+ justify-content: center;
8230
+ cursor: zoom-out;
8231
+ }
8232
+
8233
+ .preview-overlay.open {
8234
+ display: flex;
8235
+ }
8236
+
8237
+ .preview-close {
8238
+ position: absolute;
8239
+ top: 1rem;
8240
+ right: 1rem;
8241
+ background: transparent;
8242
+ border: none;
8243
+ color: #fff;
8244
+ font-size: 1.5rem;
8245
+ cursor: pointer;
8246
+ line-height: 1;
8247
+ padding: 0.25rem 0.5rem;
8248
+ }
8249
+ .preview-close:focus-visible {
8250
+ outline: 2px solid #fff;
8251
+ outline-offset: 2px;
8252
+ }
8253
+
8254
+ .preview-content {
8255
+ max-width: 90vw;
8256
+ max-height: 90vh;
8257
+ display: flex;
8258
+ align-items: center;
8259
+ justify-content: center;
8260
+ cursor: default;
8261
+ }
8262
+ .preview-content svg {
8263
+ max-width: 90vw;
8264
+ max-height: 90vh;
8265
+ box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
8266
+ border-radius: 4px;
8267
+ }`;
8268
+
8269
+ /**
8270
+ * @label SVG
8271
+ * @tag wc-svg
8272
+ * @rawTag svg
8273
+ * @summary An SVG component with lazy loading and optional preview support.
8274
+ * @overview Renders an inline SVG fetched from a URL, with lazy loading via IntersectionObserver and an optional click-to-preview lightbox.
8275
+ *
8276
+ * @cssprop --svg-color - Controls the fill color of the SVG.
8277
+ * @cssprop [--svg-size=1rem] - Controls the size of the SVG. Defaults to "1rem"
8278
+ *
8279
+ * @example
8280
+ * ```html
8281
+ * <wc-svg src="/icons/my-icon.svg" image-title="My icon"></wc-svg>
8282
+ * ```
8283
+ */
8284
+ class Svg extends i$1 {
8285
+ constructor() {
8286
+ super(...arguments);
8287
+ /** URL of the SVG asset to fetch and render inline. */
8288
+ this.src = '';
8289
+ /** Accessible title / alt text for the SVG. */
8290
+ this.imageTitle = '';
8291
+ /** Enable click-to-preview lightbox. */
8292
+ this.preview = false;
8293
+ this._loaded = false;
8294
+ this._previewOpen = false;
8295
+ this._svgContent = '';
8296
+ // token to avoid stale fetch results
8297
+ this._fetchId = 0;
8298
+ this._intersectionObserver = null;
8299
+ }
8300
+ disconnectedCallback() {
8301
+ super.disconnectedCallback();
8302
+ this._intersectionObserver?.disconnect();
8303
+ }
8304
+ firstUpdated() {
8305
+ this._setupIntersectionObserver();
8306
+ }
8307
+ updated(changedProperties) {
8308
+ if (changedProperties.has('src')) {
8309
+ // Reset lazy-load state so the new src is fetched when visible
8310
+ this._loaded = false;
8311
+ this._svgContent = '';
8312
+ this._setupIntersectionObserver();
8313
+ }
8314
+ }
8315
+ _setupIntersectionObserver() {
8316
+ this._intersectionObserver?.disconnect();
8317
+ const wrapper = this.shadowRoot?.querySelector('.svg-wrapper');
8318
+ if (!wrapper)
8319
+ return;
8320
+ this._intersectionObserver = new IntersectionObserver((entries) => {
8321
+ if (entries[0].isIntersecting) {
8322
+ this._loaded = true;
8323
+ this._intersectionObserver?.disconnect();
8324
+ this._fetchSvg();
8325
+ }
8326
+ }, { rootMargin: '200px' });
8327
+ this._intersectionObserver.observe(wrapper);
8328
+ }
8329
+ async _fetchSvg() {
8330
+ if (!this.src)
8331
+ return;
8332
+ this._fetchId += 1;
8333
+ const currentId = this._fetchId;
8334
+ try {
8335
+ const raw = await fetchSVG(this.src);
8336
+ if (currentId !== this._fetchId)
8337
+ return;
8338
+ this._svgContent = raw ? sanitizeSvg(raw) : '';
8339
+ }
8340
+ catch {
8341
+ if (currentId === this._fetchId) {
8342
+ this._svgContent = '';
8343
+ }
8344
+ }
8345
+ }
8346
+ _handleClick() {
8347
+ if (this.preview) {
8348
+ this._previewOpen = true;
8349
+ // Move focus into the dialog after render
8350
+ this.updateComplete.then(() => {
8351
+ const closeBtn = this.shadowRoot?.querySelector('.preview-close');
8352
+ closeBtn?.focus();
8353
+ });
8354
+ }
8355
+ }
8356
+ _closePreview(e) {
8357
+ e.stopPropagation();
8358
+ const wasOpen = this._previewOpen;
8359
+ this._previewOpen = false;
8360
+ if (wasOpen) {
8361
+ // Return focus to the trigger
8362
+ const trigger = this.shadowRoot?.querySelector('.svg-content');
8363
+ trigger?.focus();
8364
+ }
8365
+ }
8366
+ render() {
8367
+ return b `
8368
+ <div class="svg-wrapper">
8369
+ ${this._loaded && this._svgContent
8370
+ ? b `<div
8371
+ class="svg-content ${this.preview ? 'clickable' : ''}"
8372
+ role=${this.imageTitle ? 'img' : 'presentation'}
8373
+ aria-label=${this.imageTitle || ''}
8374
+ @click=${this._handleClick}
8375
+ >
8376
+ ${o$3(this._svgContent)}
8377
+ </div>`
8378
+ : b `<span class="placeholder" aria-hidden="true"></span>`}
8379
+ </div>
8380
+
8381
+ <div
8382
+ class="preview-overlay ${this._previewOpen ? 'open' : ''}"
8383
+ role="dialog"
8384
+ aria-modal="true"
8385
+ aria-label=${this.imageTitle ? `Preview: ${this.imageTitle}` : 'SVG preview'}
8386
+ @click=${this._closePreview}
8387
+ @keydown=${(e) => e.key === 'Escape' && this._closePreview(e)}
8388
+ >
8389
+ <button
8390
+ class="preview-close"
8391
+ aria-label="Close preview"
8392
+ @click=${this._closePreview}
8393
+ >&#x2715;</button>
8394
+ <div class="preview-content" @click=${(e) => e.stopPropagation()}>
8395
+ ${o$3(this._svgContent)}
8396
+ </div>
8397
+ </div>
8398
+ `;
8399
+ }
8400
+ }
8401
+ Svg.styles = [css_248z$f];
8402
+ __decorate([
8403
+ n({ type: String, reflect: true })
8404
+ ], Svg.prototype, "src", void 0);
8405
+ __decorate([
8406
+ n({ attribute: 'image-title' })
8407
+ ], Svg.prototype, "imageTitle", void 0);
8408
+ __decorate([
8409
+ n({ type: Boolean, reflect: true })
8410
+ ], Svg.prototype, "preview", void 0);
8411
+ __decorate([
8412
+ r()
8413
+ ], Svg.prototype, "_loaded", void 0);
8414
+ __decorate([
8415
+ r()
8416
+ ], Svg.prototype, "_previewOpen", void 0);
8417
+ __decorate([
8418
+ r()
8419
+ ], Svg.prototype, "_svgContent", void 0);
8420
+
9728
8421
  var css_248z$e = i`* {
9729
8422
  box-sizing: border-box;
9730
8423
  }
@@ -10216,7 +8909,7 @@ class Tab extends i$1 {
10216
8909
  if (!isLink) {
10217
8910
  return b `<button
10218
8911
  id="button"
10219
- class=${e$3(cssClasses)}
8912
+ class=${e$1(cssClasses)}
10220
8913
  tabindex="0"
10221
8914
  @mousedown=${this.__handlePress}
10222
8915
  @keydown=${this.__handlePress}
@@ -10230,7 +8923,7 @@ class Tab extends i$1 {
10230
8923
  </button>`;
10231
8924
  }
10232
8925
  return b `<a
10233
- class=${e$3(cssClasses)}
8926
+ class=${e$1(cssClasses)}
10234
8927
  id="button"
10235
8928
  tabindex="0"
10236
8929
  href=${this.href}
@@ -10396,7 +9089,7 @@ __decorate([
10396
9089
  r()
10397
9090
  ], Tab.prototype, "isPressed", void 0);
10398
9091
  __decorate([
10399
- e$4('.tab-element')
9092
+ e$2('.tab-element')
10400
9093
  ], Tab.prototype, "tabElement", void 0);
10401
9094
 
10402
9095
  var css_248z$d = i`* {
@@ -11104,7 +9797,7 @@ class Slider extends i$1 {
11104
9797
  @touchstart=${this.onMouseDown}
11105
9798
  >
11106
9799
  <div class="track">
11107
- <div class="track-active" style=${o$2({ width: `${percentage}%` })}></div>
9800
+ <div class="track-active" style=${o$1({ width: `${percentage}%` })}></div>
11108
9801
  </div>
11109
9802
 
11110
9803
  <div
@@ -11116,7 +9809,7 @@ class Slider extends i$1 {
11116
9809
  aria-valuemax=${this.max}
11117
9810
  aria-valuenow=${this.value}
11118
9811
  aria-disabled=${this.disabled}
11119
- style=${o$2({ left: `calc(${percentage}% - var(--thumb-half))` })}
9812
+ style=${o$1({ left: `calc(${percentage}% - var(--thumb-half))` })}
11120
9813
  @keydown=${this.handleKeyDown}
11121
9814
  >
11122
9815
  ${this.labeled ? b `<div class="value-label">${this.value}</div>` : ''}
@@ -11154,10 +9847,10 @@ __decorate([
11154
9847
  r()
11155
9848
  ], Slider.prototype, "isDragging", void 0);
11156
9849
  __decorate([
11157
- e$4('.slider-container')
9850
+ e$2('.slider-container')
11158
9851
  ], Slider.prototype, "container", void 0);
11159
9852
  __decorate([
11160
- e$4('.thumb')
9853
+ e$2('.thumb')
11161
9854
  ], Slider.prototype, "thumbElement", void 0);
11162
9855
 
11163
9856
  var css_248z$9 = i`* {
@@ -11457,7 +10150,7 @@ class Table extends i$1 {
11457
10150
  return total;
11458
10151
  }
11459
10152
  getTotalItems() {
11460
- if (this.paginate && !this.managed)
10153
+ if (this.paginate && !this.managed && this.data)
11461
10154
  return this.data.length;
11462
10155
  return this.totalItems ?? 0;
11463
10156
  }
@@ -11509,7 +10202,7 @@ class Table extends i$1 {
11509
10202
  : DEFAULT_CELL_WIDTH;
11510
10203
  const colEl = b `
11511
10204
  <div
11512
- class=${e$3({ col: true, sort: this.sortBy === col.name })}
10205
+ class=${e$1({ col: true, sort: this.sortBy === col.name })}
11513
10206
  style="width: ${colWidth}rem"
11514
10207
  >
11515
10208
  <div class="col-content">
@@ -11589,7 +10282,7 @@ class Table extends i$1 {
11589
10282
  const colEl = b `
11590
10283
  <div
11591
10284
  tabindex="0"
11592
- class=${e$3({
10285
+ class=${e$1({
11593
10286
  col: true,
11594
10287
  'col-hover': this.hoveredCell.row === row &&
11595
10288
  this.hoveredCell.column === column,
@@ -11632,7 +10325,7 @@ class Table extends i$1 {
11632
10325
  });
11633
10326
  return b `
11634
10327
  <div
11635
- class=${e$3({
10328
+ class=${e$1({
11636
10329
  row: true,
11637
10330
  'row-hover': this.hoveredCell.row === row,
11638
10331
  })}
@@ -11684,10 +10377,10 @@ class Table extends i$1 {
11684
10377
  'horizontal-scrolled': this.isHorizontallyScrolled,
11685
10378
  };
11686
10379
  return b `
11687
- <div class=${e$3(tableClasses)}>
10380
+ <div class=${e$1(tableClasses)}>
11688
10381
  <div class="table-scroll-container" @scroll=${this.onScrollContainer}>
11689
10382
  ${this.renderHeader()}
11690
- ${this.data.length ? this.renderBody() : this.renderEmptyState()}
10383
+ ${this.data && this.data.length ? this.renderBody() : this.renderEmptyState()}
11691
10384
  </div>
11692
10385
  <div class="table-footer">${this.renderPagination()}</div>
11693
10386
  </div>
@@ -12164,7 +10857,7 @@ class SidebarMenuItem extends i$1 {
12164
10857
  this._nativeElement?.blur();
12165
10858
  }
12166
10859
  render() {
12167
- const classes = e$3({
10860
+ const classes = e$1({
12168
10861
  'sidebar-menu-item': true,
12169
10862
  disabled: this.disabled,
12170
10863
  selected: this.selected,
@@ -12241,7 +10934,7 @@ __decorate([
12241
10934
  n({ type: Number, reflect: true })
12242
10935
  ], SidebarMenuItem.prototype, "level", void 0);
12243
10936
  __decorate([
12244
- e$4('.sidebar-menu-item-content')
10937
+ e$2('.sidebar-menu-item-content')
12245
10938
  ], SidebarMenuItem.prototype, "_nativeElement", void 0);
12246
10939
 
12247
10940
  var css_248z$6 = i`* {
@@ -12452,15 +11145,15 @@ class SidebarSubMenu extends i$1 {
12452
11145
  }
12453
11146
  render() {
12454
11147
  const hasChildren = this._getChildNodes().length > 0;
12455
- const wrapperClasses = e$3({
11148
+ const wrapperClasses = e$1({
12456
11149
  'sidebar-sub-menu': true,
12457
11150
  });
12458
- const innerClasses = e$3({
11151
+ const innerClasses = e$1({
12459
11152
  'sidebar-sub-menu-inner': true,
12460
11153
  disabled: this.disabled,
12461
11154
  selected: this.selected,
12462
11155
  });
12463
- const inlineStyles = o$2({
11156
+ const inlineStyles = o$1({
12464
11157
  paddingLeft: `calc(var(--sidebar-menu-item-height, 2.5rem) * ${this.level})`,
12465
11158
  });
12466
11159
  return b `
@@ -12525,7 +11218,7 @@ __decorate([
12525
11218
  n({ type: Number, reflect: true })
12526
11219
  ], SidebarSubMenu.prototype, "level", void 0);
12527
11220
  __decorate([
12528
- e$4('.sidebar-sub-menu-inner')
11221
+ e$2('.sidebar-sub-menu-inner')
12529
11222
  ], SidebarSubMenu.prototype, "_nativeElement", void 0);
12530
11223
 
12531
11224
  var css_248z$5 = i`* {
@@ -12944,7 +11637,7 @@ class Snackbar extends i$1 {
12944
11637
  const liveRole = this.actionLabel || this.showCloseIcon ? 'alert' : 'status';
12945
11638
  return b `
12946
11639
  <div
12947
- class=${e$3({
11640
+ class=${e$1({
12948
11641
  snackbar: true,
12949
11642
  open: !this.preview && this.open,
12950
11643
  preview: this.preview,
@@ -13372,7 +12065,7 @@ class Radio extends i$1 {
13372
12065
  'has-content': this.slotHasContent,
13373
12066
  };
13374
12067
  return b `
13375
- <label class=${e$3(cssClasses)}>
12068
+ <label class=${e$1(cssClasses)}>
13376
12069
  <div
13377
12070
  class="container"
13378
12071
  tabindex=${this.isGroupFocusTarget
@@ -13455,10 +12148,10 @@ __decorate([
13455
12148
  r()
13456
12149
  ], Radio.prototype, "isGroupFocusTarget", void 0);
13457
12150
  __decorate([
13458
- e$4('.container')
12151
+ e$2('.container')
13459
12152
  ], Radio.prototype, "containerElement", void 0);
13460
12153
  __decorate([
13461
- e$4('.input-native')
12154
+ e$2('.input-native')
13462
12155
  ], Radio.prototype, "nativeElement", void 0);
13463
12156
 
13464
12157
  var css_248z$2 = i`@charset "UTF-8";
@@ -13708,7 +12401,7 @@ __decorate([
13708
12401
  n({ type: Boolean, reflect: true })
13709
12402
  ], SelectOptionElement.prototype, "filtered", void 0);
13710
12403
  __decorate([
13711
- e$4('wc-menu-item')
12404
+ e$2('wc-menu-item')
13712
12405
  ], SelectOptionElement.prototype, "_menuItemEl", void 0);
13713
12406
 
13714
12407
  /**
@@ -14080,7 +12773,7 @@ class Select extends BaseInput {
14080
12773
  _renderFieldEnd() {
14081
12774
  return b `
14082
12775
  <wc-icon
14083
- class=${e$3({
12776
+ class=${e$1({
14084
12777
  'dropdown-icon': true,
14085
12778
  'dropdown-icon--open': this._open,
14086
12779
  })}
@@ -14190,10 +12883,10 @@ __decorate([
14190
12883
  r()
14191
12884
  ], Select.prototype, "_noOptionsVisible", void 0);
14192
12885
  __decorate([
14193
- e$4('.select-trigger')
12886
+ e$2('.select-trigger')
14194
12887
  ], Select.prototype, "_triggerEl", void 0);
14195
12888
  __decorate([
14196
- e$4('.search-input')
12889
+ e$2('.search-input')
14197
12890
  ], Select.prototype, "_searchInputEl", void 0);
14198
12891
 
14199
12892
  var css_248z$1 = i`* {
@@ -14228,13 +12921,25 @@ var css_248z$1 = i`* {
14228
12921
  align-items: center;
14229
12922
  width: 100%;
14230
12923
  flex-shrink: 0;
12924
+ padding-block-end: 2.5rem;
14231
12925
  }
14232
12926
  .rail .header:empty {
14233
12927
  display: none;
14234
12928
  }
12929
+ .rail .footer {
12930
+ display: flex;
12931
+ flex-direction: column;
12932
+ align-items: center;
12933
+ justify-content: flex-end;
12934
+ width: 100%;
12935
+ flex-shrink: 0;
12936
+ margin-top: auto;
12937
+ }
12938
+ .rail .footer:empty {
12939
+ display: none;
12940
+ }
14235
12941
  .rail wc-divider {
14236
12942
  width: calc(100% - 1rem);
14237
- margin-block: 0.5rem;
14238
12943
  flex-shrink: 0;
14239
12944
  }
14240
12945
  .rail .items {
@@ -14243,22 +12948,11 @@ var css_248z$1 = i`* {
14243
12948
  align-items: center;
14244
12949
  width: 100%;
14245
12950
  gap: 0.75rem; /* 12dp between items */
14246
- flex: 1;
12951
+ flex: 1 1 auto;
12952
+ min-height: 0;
14247
12953
  }
14248
12954
  .rail .items ::slotted(wc-navigation-rail-item) {
14249
12955
  width: 100%;
14250
- }
14251
- .rail {
14252
- /* Alignment variants */
14253
- }
14254
- .rail.align-top .items {
14255
- justify-content: flex-start;
14256
- }
14257
- .rail.align-center .items {
14258
- justify-content: center;
14259
- }
14260
- .rail.align-bottom .items {
14261
- justify-content: flex-end;
14262
12956
  }`;
14263
12957
 
14264
12958
  var css_248z = i`* {
@@ -14331,6 +13025,12 @@ var css_248z = i`* {
14331
13025
  flex-shrink: 0;
14332
13026
  transition: background-color var(--duration-short4, 200ms) var(--easing-standard, ease);
14333
13027
  }
13028
+ .item .indicator .ripple {
13029
+ inset: 0;
13030
+ z-index: 0;
13031
+ --ripple-pressed-color: var(--_state-color);
13032
+ border-radius: inherit;
13033
+ }
14334
13034
  .item .indicator .icon-container {
14335
13035
  display: flex;
14336
13036
  align-items: center;
@@ -14345,29 +13045,6 @@ var css_248z = i`* {
14345
13045
  color: var(--_inactive-icon-color);
14346
13046
  display: flex;
14347
13047
  }
14348
- .item {
14349
- /* State layer for hover/press */
14350
- }
14351
- .item .state-layer {
14352
- position: absolute;
14353
- top: 0.25rem;
14354
- left: 50%;
14355
- transform: translateX(-50%);
14356
- width: var(--_indicator-width);
14357
- height: var(--_indicator-height);
14358
- pointer-events: none;
14359
- background-color: var(--_state-color);
14360
- opacity: 0;
14361
- z-index: 0;
14362
- border-radius: var(--_indicator-shape);
14363
- transition: opacity var(--duration-short4, 200ms) var(--easing-standard, ease);
14364
- }
14365
- .item .ripple {
14366
- z-index: 1;
14367
- --ripple-pressed-color: var(--_state-color);
14368
- --ripple-state-opacity: 0;
14369
- border-radius: var(--shape-corner-small, 4px);
14370
- }
14371
13048
  .item {
14372
13049
  /* Label */
14373
13050
  }
@@ -14429,18 +13106,6 @@ var css_248z = i`* {
14429
13106
  .item.active.has-active-icon .icon-slot {
14430
13107
  display: none;
14431
13108
  }
14432
- .item {
14433
- /* Hover state */
14434
- }
14435
- .item:hover:not(.disabled) .state-layer {
14436
- opacity: 0.08;
14437
- }
14438
- .item {
14439
- /* Pressed state */
14440
- }
14441
- .item.pressed:not(.disabled) .state-layer {
14442
- opacity: 0.12;
14443
- }
14444
13109
  .item {
14445
13110
  /* Disabled state */
14446
13111
  }
@@ -14462,7 +13127,6 @@ var css_248z = i`* {
14462
13127
 
14463
13128
  @media (prefers-reduced-motion: reduce) {
14464
13129
  .item .indicator,
14465
- .item .state-layer,
14466
13130
  .item .label {
14467
13131
  transition: none;
14468
13132
  }
@@ -14579,11 +13243,10 @@ class NavigationRailItem extends i$1 {
14579
13243
  __renderItemContent() {
14580
13244
  return b `
14581
13245
  <wc-focus-ring class="focus-ring" for='item'></wc-focus-ring>
14582
- <div class="state-layer"></div>
14583
- <wc-ripple class="ripple"></wc-ripple>
14584
13246
 
14585
13247
  <div class="item-content">
14586
13248
  <div class="indicator">
13249
+ <wc-ripple class="ripple"></wc-ripple>
14587
13250
  <div class="icon-container">
14588
13251
  <slot name="active-icon" class="active-icon-slot"></slot>
14589
13252
  <slot name="icon" class="icon-slot"></slot>
@@ -14611,7 +13274,7 @@ class NavigationRailItem extends i$1 {
14611
13274
  if (!isLink) {
14612
13275
  return b `<button
14613
13276
  id="item"
14614
- class=${e$3(cssClasses)}
13277
+ class=${e$1(cssClasses)}
14615
13278
  ?disabled=${this.disabled}
14616
13279
  aria-disabled=${`${this.disabled}`}
14617
13280
  aria-current=${this.active ? 'page' : A}
@@ -14626,7 +13289,7 @@ class NavigationRailItem extends i$1 {
14626
13289
  }
14627
13290
  return b `<a
14628
13291
  id="item"
14629
- class=${e$3(cssClasses)}
13292
+ class=${e$1(cssClasses)}
14630
13293
  href=${this.href}
14631
13294
  target=${this.target}
14632
13295
  aria-current=${this.active ? 'page' : A}
@@ -14677,7 +13340,7 @@ __decorate([
14677
13340
  r()
14678
13341
  ], NavigationRailItem.prototype, "_hasActiveIcon", void 0);
14679
13342
  __decorate([
14680
- e$4('.item-element')
13343
+ e$2('.item-element')
14681
13344
  ], NavigationRailItem.prototype, "itemElement", void 0);
14682
13345
 
14683
13346
  /**
@@ -14690,6 +13353,9 @@ __decorate([
14690
13353
  * <p>Navigation rail provides access to primary destinations in an app using icons—with or without labels—on a vertical rail.</p>
14691
13354
  * <p>Use navigation rail on medium-sized screens (tablets) with 3–7 destinations.</p>
14692
13355
  *
13356
+ * @slot header - Content displayed above the rail items.
13357
+ * @slot footer - Content pinned to the bottom of the rail.
13358
+ *
14693
13359
  * @cssprop --nav-rail-width - Width of the rail container. Defaults to 5rem (80dp).
14694
13360
  * @cssprop --nav-rail-container-color - Background color of the rail. Defaults to surface color.
14695
13361
  * @cssprop --nav-rail-indicator-color - Color of the active indicator. Defaults to secondary-container.
@@ -14723,13 +13389,6 @@ __decorate([
14723
13389
  class NavigationRail extends i$1 {
14724
13390
  constructor() {
14725
13391
  super(...arguments);
14726
- /**
14727
- * Vertical alignment of items within the rail.
14728
- * - `"top"`: Items align to the top.
14729
- * - `"center"`: Items are centered (default).
14730
- * - `"bottom"`: Items align to the bottom.
14731
- */
14732
- this.alignment = 'center';
14733
13392
  /**
14734
13393
  * Display mode of the navigation rail.
14735
13394
  * - `"expanded"`: shows labels.
@@ -14789,11 +13448,10 @@ class NavigationRail extends i$1 {
14789
13448
  render() {
14790
13449
  const cssClasses = {
14791
13450
  rail: true,
14792
- [`align-${this.alignment}`]: true,
14793
13451
  [`mode-${this.mode}`]: true,
14794
13452
  };
14795
13453
  return b `
14796
- <div class=${e$3(cssClasses)}>
13454
+ <div class=${e$1(cssClasses)}>
14797
13455
  <div class="header">
14798
13456
  <slot name="header"></slot>
14799
13457
  </div>
@@ -14801,15 +13459,15 @@ class NavigationRail extends i$1 {
14801
13459
  <nav class="items" role="presentation">
14802
13460
  <slot @slotchange=${this._syncItemMode}></slot>
14803
13461
  </nav>
13462
+ <div class="footer">
13463
+ <slot name="footer"></slot>
13464
+ </div>
14804
13465
  </div>
14805
13466
  `;
14806
13467
  }
14807
13468
  }
14808
13469
  NavigationRail.styles = [css_248z$1];
14809
13470
  NavigationRail.Item = NavigationRailItem;
14810
- __decorate([
14811
- n({ reflect: true })
14812
- ], NavigationRail.prototype, "alignment", void 0);
14813
13471
  __decorate([
14814
13472
  n({ reflect: true })
14815
13473
  ], NavigationRail.prototype, "mode", void 0);
@@ -14817,5 +13475,5 @@ __decorate([
14817
13475
  n({ type: Boolean, attribute: 'show-divider' })
14818
13476
  ], NavigationRail.prototype, "showDivider", void 0);
14819
13477
 
14820
- export { Accordion as A, Badge as B, Checkbox as C, DatePicker as D, Elevation as E, Field as F, SubMenu as G, Switch as H, Icon as I, TabGroup as J, TabPanel as K, LinearProgress as L, Menu as M, NavigationRail as N, Table as O, Pagination as P, Tabs as Q, Radio as R, SegmentedButton as S, Tab as T, Tag as U, Textarea as V, TimePicker as W, Tooltip as X, UrlField as Y, 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, NavigationRailItem as n, NumberField as o, Ripple as p, SegmentedButtonGroup as q, Select as r, SelectOptionElement as s, SidebarMenu as t, SidebarMenuItem as u, SidebarSubMenu as v, Skeleton as w, Slider as x, Snackbar as y, Spinner as z };
14821
- //# sourceMappingURL=navigation-rail-Lxetd5-Z.js.map
13478
+ export { Accordion as A, Badge as B, Checkbox as C, DatePicker as D, Elevation as E, Field as F, Spinner as G, SubMenu as H, Image as I, Svg as J, Switch as K, LinearProgress as L, Menu as M, NavigationRail as N, TabGroup as O, Pagination as P, TabPanel as Q, Radio as R, SegmentedButton as S, Tab as T, Table as U, Tabs as V, Tag as W, Textarea as X, TimePicker as Y, Tooltip as Z, UrlField as _, 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, Input as j, Link as k, List as l, ListItem as m, MenuItem as n, NavigationRailItem as o, NumberField as p, Ripple as q, SegmentedButtonGroup as r, Select as s, SelectOptionElement as t, SidebarMenu as u, SidebarMenuItem as v, SidebarSubMenu as w, Skeleton as x, Slider as y, Snackbar as z };
13479
+ //# sourceMappingURL=navigation-rail-DTTkqohi.js.map