@odx/foundation 1.0.0-beta.2 → 1.0.0-beta.20

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 (85) hide show
  1. package/dist/{lib/facade → cdk/control}/checkbox-form-control.d.ts +2 -2
  2. package/dist/{lib/facade → cdk/control}/checkbox-group-form-control.d.ts +2 -2
  3. package/dist/cdk/control/listbox-form-control.d.ts +22 -0
  4. package/dist/cdk/control/option-control.d.ts +24 -0
  5. package/dist/{lib/facade → cdk/control}/radio-group-form-control.d.ts +2 -2
  6. package/dist/cdk/drag-drop/drag.controller.d.ts +1 -0
  7. package/dist/{components/button/base-button.d.ts → cdk/interactive/interactive-element.d.ts} +9 -8
  8. package/dist/cdk/interactive/interactive-link.d.ts +15 -0
  9. package/dist/cdk/main.d.ts +7 -0
  10. package/dist/cdk/popover/popover-host.d.ts +12 -6
  11. package/dist/cdk/popover/popover.models.d.ts +1 -1
  12. package/dist/cdk.js +721 -127
  13. package/dist/components/accordion/accordion-header.d.ts +1 -2
  14. package/dist/components/accordion/accordion-panel.d.ts +1 -0
  15. package/dist/components/accordion/accordion.d.ts +4 -4
  16. package/dist/components/button/button.d.ts +4 -6
  17. package/dist/components/button/button.models.d.ts +12 -0
  18. package/dist/components/button/index.d.ts +0 -1
  19. package/dist/components/button-group/button-group.d.ts +0 -8
  20. package/dist/components/checkbox/checkbox.d.ts +2 -2
  21. package/dist/components/checkbox-group/checkbox-group.d.ts +1 -1
  22. package/dist/components/chip/chip.d.ts +2 -2
  23. package/dist/components/combobox/combobox.d.ts +20 -0
  24. package/dist/components/combobox/index.d.ts +2 -0
  25. package/dist/components/dropdown/dropdown.d.ts +8 -4
  26. package/dist/components/highlight/highlight.d.ts +3 -0
  27. package/dist/components/input/input.d.ts +3 -0
  28. package/dist/components/link/base-link.d.ts +2 -2
  29. package/dist/components/list/list-item.d.ts +6 -6
  30. package/dist/components/list/list.d.ts +2 -0
  31. package/dist/components/main.d.ts +1 -0
  32. package/dist/components/menu/menu.d.ts +1 -4
  33. package/dist/components/menu-item/menu-item.d.ts +3 -4
  34. package/dist/components/navigation-item/navigation-item.d.ts +2 -2
  35. package/dist/components/option/option.d.ts +1 -2
  36. package/dist/components/radio-button/radio-button.d.ts +1 -1
  37. package/dist/components/radio-group/radio-group.d.ts +1 -1
  38. package/dist/components/select/select.d.ts +9 -5
  39. package/dist/components/stack/stack.d.ts +3 -3
  40. package/dist/components/stack/stack.models.d.ts +1 -1
  41. package/dist/components/switch/switch.d.ts +1 -1
  42. package/dist/components/table/table-header.d.ts +1 -1
  43. package/dist/components/table/table-row.d.ts +1 -1
  44. package/dist/components/text/text.models.d.ts +1 -1
  45. package/dist/components/toggle-button/toggle-button.d.ts +1 -1
  46. package/dist/components/toggle-content/toggle-content.d.ts +2 -3
  47. package/dist/components/tooltip/tooltip.d.ts +1 -4
  48. package/dist/components.js +705 -649
  49. package/dist/i18n/lib/config.d.ts +4 -3
  50. package/dist/i18n.js +14 -10
  51. package/dist/lib/controllers/active-desendants-controller.d.ts +25 -0
  52. package/dist/lib/controllers/expandable-controller.d.ts +17 -0
  53. package/dist/lib/controllers/focus-trap.controller.d.ts +1 -0
  54. package/dist/lib/custom-element.d.ts +1 -1
  55. package/dist/lib/main.d.ts +9 -12
  56. package/dist/lib/mixins/can-be-disabled.d.ts +1 -1
  57. package/dist/lib/mixins/can-be-expanded.d.ts +2 -4
  58. package/dist/lib/mixins/can-be-highlighted.d.ts +8 -0
  59. package/dist/lib/mixins/can-be-readonly.d.ts +1 -1
  60. package/dist/lib/mixins/can-be-required.d.ts +1 -1
  61. package/dist/lib/mixins/can-be-selected.d.ts +2 -2
  62. package/dist/lib/mixins/can-be-validated.d.ts +1 -1
  63. package/dist/lib/mixins/form-control.d.ts +2 -2
  64. package/dist/lib/mixins/number-control.d.ts +1 -1
  65. package/dist/lib/mixins/with-loading-state.d.ts +1 -1
  66. package/dist/lib/{utils → types}/a11y.d.ts +0 -6
  67. package/dist/lib/utils/dom.d.ts +0 -2
  68. package/dist/lib/{directives/slot-fallback.d.ts → utils/empty-slot-fallback-fix.d.ts} +1 -1
  69. package/dist/lib/utils/lit.d.ts +5 -0
  70. package/dist/lib/utils/query-assigned-element.d.ts +16 -0
  71. package/dist/lib/utils/search-text-content.d.ts +1 -0
  72. package/dist/lib/utils/transformers.d.ts +5 -0
  73. package/dist/main.js +366 -626
  74. package/dist/styles.css +1 -1
  75. package/dist/vendor-dJxQG085.js +138 -0
  76. package/package.json +8 -8
  77. package/dist/lib/decorators/request-update-on-aria-change.d.ts +0 -4
  78. package/dist/lib/directives/optional-attr.d.ts +0 -2
  79. package/dist/lib/directives/optional-slot.d.ts +0 -3
  80. package/dist/lib/facade/option-control.d.ts +0 -16
  81. package/dist/lib/facade/select-form-control.d.ts +0 -19
  82. package/dist/lib/utils/object.d.ts +0 -2
  83. package/dist/vendor-C_WVAD3D.js +0 -3680
  84. package/dist/vite.config.d.ts +0 -3
  85. /package/dist/lib/{mixins → utils}/dedupe-mixin.d.ts +0 -0
package/dist/main.js CHANGED
@@ -1,9 +1,114 @@
1
- import { r as round, t as toMerged, c as createFocusTrap, u as uniqBy, R as RovingTabindexController } from './vendor-C_WVAD3D.js';
2
- import { isServer, nothing, html, LitElement, unsafeCSS } from 'lit';
3
- import { directive, Directive } from 'lit/directive.js';
4
- import { property, queryAssignedElements } from 'lit/decorators.js';
5
- import { createContext, ContextProvider, consume } from '@lit/context';
6
1
  export { effect } from '@lit-labs/preact-signals';
2
+ import { isServer, LitElement, html, unsafeCSS, nothing } from 'lit';
3
+ import { createFocusTrap } from 'focus-trap';
4
+ import { r as round, u as uniqBy } from './vendor-dJxQG085.js';
5
+ import { createContext, ContextProvider, consume } from '@lit/context';
6
+ import { property } from 'lit/decorators.js';
7
+ import { directive, Directive } from 'lit/directive.js';
8
+
9
+ const ActiveDescendantsControllerOptions = (options) => ({
10
+ getItems: () => [],
11
+ ...options
12
+ });
13
+ class ActiveDescendantsController {
14
+ #host;
15
+ #options;
16
+ #activeIndex = -1;
17
+ get activeItem() {
18
+ return this.items[this.#activeIndex];
19
+ }
20
+ get items() {
21
+ return this.#options.getItems().filter((item) => item.isConnected);
22
+ }
23
+ constructor(host, options) {
24
+ this.#host = host;
25
+ this.#options = ActiveDescendantsControllerOptions(options);
26
+ host.addController(this);
27
+ }
28
+ activate(initialActiveIndex) {
29
+ if (initialActiveIndex === void 0) {
30
+ this.first();
31
+ } else {
32
+ this.update(initialActiveIndex);
33
+ }
34
+ this.#host.addEventListener("keydown", this.#handleKeyboardEvent);
35
+ }
36
+ deactivate() {
37
+ this.#host.removeEventListener("keydown", this.#handleKeyboardEvent);
38
+ this.#host.removeAttribute("aria-activedescendant");
39
+ this.update(-1);
40
+ }
41
+ previous() {
42
+ const previousIndex = this.items.findLastIndex((item, index) => !item.disabled && this.#activeIndex > index);
43
+ this.update(previousIndex === -1 ? void 0 : previousIndex);
44
+ }
45
+ next() {
46
+ const nextIndex = this.items.findIndex((item, index) => !item.disabled && this.#activeIndex < index);
47
+ if (nextIndex < 0) return;
48
+ this.update(nextIndex);
49
+ }
50
+ first() {
51
+ this.update(this.items.findIndex((item) => !item.disabled));
52
+ }
53
+ last() {
54
+ this.update(this.items.findLastIndex((item) => !item.disabled));
55
+ }
56
+ select(item) {
57
+ const index = this.items.indexOf(item);
58
+ if (index === -1 || item.disabled) return;
59
+ this.update(index);
60
+ }
61
+ update(index, forceUpdate = false) {
62
+ const previousActiveItem = this.items[this.#activeIndex];
63
+ const activeItem = this.items[index ?? this.#activeIndex];
64
+ if (forceUpdate !== false && previousActiveItem === activeItem || activeItem?.disabled) return;
65
+ this.#activeIndex = index ?? this.#activeIndex;
66
+ this.#host.setAttribute("aria-activedescendant", activeItem?.id ?? "");
67
+ previousActiveItem?.highlight(false);
68
+ activeItem?.highlight(true);
69
+ this.#options.onChange?.(previousActiveItem, activeItem, previousActiveItem === void 0 && !!activeItem);
70
+ }
71
+ #handleKeyboardEvent = (event) => {
72
+ const { actions, direction } = getKeyboardEventInfo(event);
73
+ if (direction.down) {
74
+ this.next();
75
+ } else if (direction.up) {
76
+ this.previous();
77
+ } else if (actions.start) {
78
+ this.first();
79
+ } else if (actions.end) {
80
+ this.last();
81
+ }
82
+ };
83
+ }
84
+
85
+ const ExpandableItemManagerOptions = (options) => ({
86
+ ...options
87
+ });
88
+ class ExpandableItemManager {
89
+ #host;
90
+ #config;
91
+ get expandableItems() {
92
+ return this.#config.getItems?.() ?? [];
93
+ }
94
+ constructor(host, options) {
95
+ this.#host = host;
96
+ this.#config = ExpandableItemManagerOptions(options);
97
+ this.#host.addController(this);
98
+ if (!isServer) {
99
+ this.#host.addEventListener("toggle", this.#handleToggle);
100
+ }
101
+ }
102
+ #handleToggle = (event) => {
103
+ if (!event.target) return;
104
+ event.stopPropagation();
105
+ if (!fromToggleEventState(event.newState) || this.#host.multiple) return;
106
+ for (const item of this.expandableItems) {
107
+ if (event.target === item) continue;
108
+ item.toggle(false);
109
+ }
110
+ };
111
+ }
7
112
 
8
113
  function createMutationObserver(callback) {
9
114
  try {
@@ -60,13 +165,10 @@ function forwardEvent(target, eventInit) {
60
165
  };
61
166
  }
62
167
 
63
- function createOptions(defaultOptions) {
64
- return (options) => toMerged(defaultOptions, options ?? {});
65
- }
66
-
67
- const FocusTrapControllerOptions = createOptions({
168
+ const FocusTrapControllerOptions = (options) => ({
68
169
  escapeDeactivates: false,
69
- tabbableOptions: { getShadowRoot: true }
170
+ tabbableOptions: { getShadowRoot: true },
171
+ ...options
70
172
  });
71
173
  class FocusTrapController {
72
174
  #host;
@@ -113,86 +215,6 @@ class FocusTrapController {
113
215
  }
114
216
  }
115
217
 
116
- function ariaPropertyToAttribute(property) {
117
- return property.replace("aria", "aria-").replace(/Elements?/g, "").toLowerCase();
118
- }
119
- function requestUpdateOnAriaChange(ariaProperties) {
120
- return (ctor) => {
121
- for (const ariaProperty of ariaProperties) {
122
- ctor.createProperty(ariaProperty, {
123
- attribute: ariaPropertyToAttribute(ariaProperty),
124
- reflect: true
125
- });
126
- }
127
- };
128
- }
129
-
130
- const optionalAttr = (value) => {
131
- if (value === void 0 || value === null || value === "") return nothing;
132
- return value;
133
- };
134
-
135
- function optionalSlot(host, slotName) {
136
- if (host.querySelector(`[slot="${slotName}"]`)) {
137
- return html`
138
- <div class="${slotName}" part="${slotName}-container">
139
- <slot name="${slotName}" @slotchange="${() => host.requestUpdate()}"></slot>
140
- </div>
141
- `;
142
- }
143
- return nothing;
144
- }
145
-
146
- class SlotFallbackDirective extends Directive {
147
- update({ options, element }) {
148
- const host = options?.host;
149
- if (!host || !(element instanceof HTMLSlotElement)) return;
150
- const attributeName = ["empty-slot", element.name].filter(Boolean).join("-");
151
- toggleAttribute(host, attributeName, !host.textContent?.trim() && element.assignedElements().length === 0);
152
- }
153
- render() {
154
- }
155
- }
156
- const emptySlotFallbackFix = directive(SlotFallbackDirective);
157
-
158
- const customElementStyles = "@layer reset,base,variant,state;@layer reset{:is(*){box-sizing:border-box;scrollbar-width:thin}:before,:after{box-sizing:border-box}[popover]{border:none;outline:none}img,picture,video,canvas,svg{display:block;max-width:100%;margin:0}input,button,textarea,select{font:inherit;margin:0}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word;margin:0}p{text-wrap:pretty}h1,h2,h3,h4,h5,h6{text-wrap:balance}#root,#__next{isolation:isolate;margin:0}}@layer base{h1,h2,h3,h4,h5,h6{display:block;font-family:var(--odx-typography-font-family-brand);font-size:var(--_font-size);font-weight:var(--odx-typography-font-weight-semibold);line-height:var(--_line-height)}h6{--_font-size: var(--odx-breakpoint-font-size-heading-6);--_line-height: var(--odx-breakpoint-line-height-heading-6)}h5{--_font-size: var(--odx-breakpoint-font-size-heading-5);--_line-height: var(--odx-breakpoint-line-height-heading-5)}h4{--_font-size: var(--odx-breakpoint-font-size-heading-4);--_line-height: var(--odx-breakpoint-line-height-heading-4)}h3{--_font-size: var(--odx-breakpoint-font-size-heading-3);--_line-height: var(--odx-breakpoint-line-height-heading-3)}h2{--_font-size: var(--odx-breakpoint-font-size-heading-2);--_line-height: var(--odx-breakpoint-line-height-heading-2)}h1{--_font-size: var(--odx-breakpoint-font-size-heading-1);--_line-height: var(--odx-breakpoint-line-height-heading-1)}[odxPreventTextOverflow]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}@layer reset{:host{border:none;border-color:transparent;outline:none}}";
159
-
160
- function mergeStyleSheets(...stylesheets) {
161
- const mergedStyles = [];
162
- for (const styles of stylesheets) {
163
- if (!styles) continue;
164
- mergedStyles.push(typeof styles === "string" ? unsafeCSS(styles) : styles);
165
- }
166
- return uniqBy(mergedStyles, String).flat(10);
167
- }
168
- function customElement(selector, styles = []) {
169
- return (target) => {
170
- if (!selector) return;
171
- target.selector = selector;
172
- target.styles = mergeStyleSheets(customElementStyles, target.styles, ...styles);
173
- target.define = () => {
174
- if (customElements.get(selector)) return;
175
- customElements.define(selector, target);
176
- };
177
- };
178
- }
179
- class CustomElement extends LitElement {
180
- render() {
181
- return html`<slot></slot>`;
182
- }
183
- emit(event, eventInit) {
184
- return !this.dispatchEvent(new CustomEvent(event, { bubbles: false, composed: false, cancelable: true, ...eventInit }));
185
- }
186
- }
187
-
188
- function toAriaBooleanAttribute(value, removeOnFalse = true) {
189
- if (removeOnFalse && value === false) return null;
190
- return String(value);
191
- }
192
- function fromAriaBooleanAttribute(value) {
193
- return value === "true";
194
- }
195
-
196
218
  const appliedClassMixins = /* @__PURE__ */ new WeakMap();
197
219
  function wasMixinPreviouslyApplied(mixin, superClass) {
198
220
  let klass = superClass;
@@ -215,14 +237,28 @@ function dedupeMixin(mixin) {
215
237
  };
216
238
  }
217
239
 
218
- var __defProp$c = Object.defineProperty;
219
- var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
220
- var __decorateClass$c = (decorators, target, key, kind) => {
221
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
240
+ function toAriaBooleanAttribute(value, removeOnFalse = true) {
241
+ if (removeOnFalse && value === false) return null;
242
+ return String(value);
243
+ }
244
+ function fromAriaBooleanAttribute(value) {
245
+ return value === "true";
246
+ }
247
+ function fromToggleEventState(state) {
248
+ return state === "open";
249
+ }
250
+ function toToggleEventState$1(state) {
251
+ return state ? "open" : "closed";
252
+ }
253
+
254
+ var __defProp$7 = Object.defineProperty;
255
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
256
+ var __decorateClass$7 = (decorators, target, key, kind) => {
257
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
222
258
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
223
259
  if (decorator = decorators[i])
224
260
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
225
- if (kind && result) __defProp$c(target, key, result);
261
+ if (kind && result) __defProp$7(target, key, result);
226
262
  return result;
227
263
  };
228
264
  const DisabledContext = createContext(Symbol("odx-disabled-context"));
@@ -264,21 +300,67 @@ const CanBeDisabled = dedupeMixin((superClass) => {
264
300
  }
265
301
  }
266
302
  }
267
- __decorateClass$c([
303
+ __decorateClass$7([
268
304
  consume({ context: DisabledContext, subscribe: true }),
269
305
  property({ type: Boolean })
270
306
  ], CanBeDisabledMixin.prototype, "disabled", 2);
271
307
  return CanBeDisabledMixin;
272
308
  });
273
309
 
274
- var __defProp$b = Object.defineProperty;
275
- var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
276
- var __decorateClass$b = (decorators, target, key, kind) => {
277
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
310
+ var __defProp$6 = Object.defineProperty;
311
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
312
+ var __decorateClass$6 = (decorators, target, key, kind) => {
313
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
314
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
315
+ if (decorator = decorators[i])
316
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
317
+ if (kind && result) __defProp$6(target, key, result);
318
+ return result;
319
+ };
320
+ function toToggleEventState(value) {
321
+ return value ? "open" : "closed";
322
+ }
323
+ const CanBeExpanded = dedupeMixin((superClass) => {
324
+ class CanBeExpandedMixin extends CanBeDisabled(superClass) {
325
+ constructor() {
326
+ super(...arguments);
327
+ this.expanded = false;
328
+ }
329
+ toggle(force, emitEvent = true) {
330
+ const newState = force ?? !this.expanded;
331
+ if (this.disabled || this.expanded === newState) return;
332
+ const currentState = this.expanded;
333
+ this.expanded = newState;
334
+ if (!emitEvent || !this.emit(
335
+ new ToggleEvent("toggle", { composed: true, bubbles: true, oldState: toToggleEventState(currentState), newState: toToggleEventState(newState) })
336
+ ))
337
+ return;
338
+ this.expanded = currentState;
339
+ }
340
+ }
341
+ __decorateClass$6([
342
+ property({ type: Boolean, reflect: true })
343
+ ], CanBeExpandedMixin.prototype, "expanded", 2);
344
+ return CanBeExpandedMixin;
345
+ });
346
+
347
+ const CanBeHighlighted = dedupeMixin((superClass) => {
348
+ class CanBeHighlightedMixin extends superClass {
349
+ highlight(active) {
350
+ this.toggleAttribute("odx-active", active);
351
+ }
352
+ }
353
+ return CanBeHighlightedMixin;
354
+ });
355
+
356
+ var __defProp$5 = Object.defineProperty;
357
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
358
+ var __decorateClass$5 = (decorators, target, key, kind) => {
359
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
278
360
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
279
361
  if (decorator = decorators[i])
280
362
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
281
- if (kind && result) __defProp$b(target, key, result);
363
+ if (kind && result) __defProp$5(target, key, result);
282
364
  return result;
283
365
  };
284
366
  const CanBeReadonly = dedupeMixin((superClass) => {
@@ -294,20 +376,20 @@ const CanBeReadonly = dedupeMixin((superClass) => {
294
376
  }
295
377
  }
296
378
  }
297
- __decorateClass$b([
379
+ __decorateClass$5([
298
380
  property({ type: Boolean, reflect: true })
299
381
  ], CanBeReadonlyElement.prototype, "readonly", 2);
300
382
  return CanBeReadonlyElement;
301
383
  });
302
384
 
303
- var __defProp$a = Object.defineProperty;
304
- var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
305
- var __decorateClass$a = (decorators, target, key, kind) => {
306
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
385
+ var __defProp$4 = Object.defineProperty;
386
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
387
+ var __decorateClass$4 = (decorators, target, key, kind) => {
388
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
307
389
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
308
390
  if (decorator = decorators[i])
309
391
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
310
- if (kind && result) __defProp$a(target, key, result);
392
+ if (kind && result) __defProp$4(target, key, result);
311
393
  return result;
312
394
  };
313
395
  const CanBeRequired = dedupeMixin((superClass) => {
@@ -323,12 +405,45 @@ const CanBeRequired = dedupeMixin((superClass) => {
323
405
  }
324
406
  }
325
407
  }
326
- __decorateClass$a([
408
+ __decorateClass$4([
327
409
  property({ type: Boolean, reflect: true })
328
410
  ], CanBeRequiredElement.prototype, "required", 2);
329
411
  return CanBeRequiredElement;
330
412
  });
331
413
 
414
+ var __defProp$3 = Object.defineProperty;
415
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
416
+ var __decorateClass$3 = (decorators, target, key, kind) => {
417
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
418
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
419
+ if (decorator = decorators[i])
420
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
421
+ if (kind && result) __defProp$3(target, key, result);
422
+ return result;
423
+ };
424
+ const CanBeSelected = dedupeMixin((superClass) => {
425
+ class CanBeSelectedElement extends superClass {
426
+ constructor() {
427
+ super(...arguments);
428
+ this.selected = false;
429
+ this.ariaSelectedValue = "page";
430
+ }
431
+ willUpdate(props) {
432
+ super.willUpdate(props);
433
+ if (props.has("selected") || props.has("ariaSelectedValue")) {
434
+ this.ariaCurrent = this.selected ? this.ariaSelectedValue : null;
435
+ }
436
+ }
437
+ }
438
+ __decorateClass$3([
439
+ property({ type: Boolean })
440
+ ], CanBeSelectedElement.prototype, "selected", 2);
441
+ __decorateClass$3([
442
+ property()
443
+ ], CanBeSelectedElement.prototype, "ariaSelectedValue", 2);
444
+ return CanBeSelectedElement;
445
+ });
446
+
332
447
  const CanBeValidated = dedupeMixin((superClass) => {
333
448
  class CanBeValidatedElement extends superClass {
334
449
  constructor() {
@@ -358,14 +473,47 @@ const CanBeValidated = dedupeMixin((superClass) => {
358
473
  return CanBeValidatedElement;
359
474
  });
360
475
 
361
- var __defProp$9 = Object.defineProperty;
362
- var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
363
- var __decorateClass$9 = (decorators, target, key, kind) => {
364
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
476
+ const customElementStyles = "@layer reset,base,variant,state;@layer reset{:is(*){box-sizing:border-box;scrollbar-width:thin}:not(:defined){display:none}:before,:after{box-sizing:border-box}[popover]{border:none;outline:none}img,picture,video,canvas,svg{display:block;max-width:100%;margin:0}input,button,textarea,select{font:inherit;margin:0}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word;margin:0}p{text-wrap:pretty}h1,h2,h3,h4,h5,h6{text-wrap:balance}#root,#__next{isolation:isolate;margin:0}}@layer base{odx-stack{display:block}.odx-stack{&.odx-stack-horizontal{flex-flow:row}&.odx-stack-wrap{flex-flow:column wrap}&.odx-stack-horizontal.odx-stack-wrap{flex-flow:row wrap}--flow: column;display:flex;flex-flow:var(--flow);max-inline-size:100%;align-items:stretch;justify-content:flex-start;gap:var(--odx-size-75);text-align:start}}@layer base{.odx-align-start{align-items:flex-start}.odx-align-center{align-items:center}.odx-align-end{align-items:end}.odx-justify-start{justify-content:flex-start}.odx-justify-end{justify-content:flex-end}.odx-justify-center{justify-content:center}.odx-justify-space-between{justify-content:space-between}.odx-justify-space-around{justify-content:space-around}.odx-justify-space-evenly{justify-content:space-evenly}}@layer base{.odx-gap-none{gap:0}.odx-gap-xs{gap:var(--odx-size-25)}.odx-gap-sm{gap:var(--odx-size-50)}.odx-gap-md{gap:var(--odx-size-75)}.odx-gap-lg{gap:var(--odx-size-150)}.odx-gap-xl{gap:var(--odx-size-225)}}@layer base{h1,h2,h3,h4,h5,h6{display:block;font-family:var(--odx-typography-font-family-brand);font-size:var(--_font-size);font-weight:var(--odx-typography-font-weight-semibold);line-height:var(--_line-height)}h6{--_font-size: var(--odx-breakpoint-font-size-heading-6);--_line-height: var(--odx-breakpoint-line-height-heading-6)}h5{--_font-size: var(--odx-breakpoint-font-size-heading-5);--_line-height: var(--odx-breakpoint-line-height-heading-5)}h4{--_font-size: var(--odx-breakpoint-font-size-heading-4);--_line-height: var(--odx-breakpoint-line-height-heading-4)}h3{--_font-size: var(--odx-breakpoint-font-size-heading-3);--_line-height: var(--odx-breakpoint-line-height-heading-3)}h2{--_font-size: var(--odx-breakpoint-font-size-heading-2);--_line-height: var(--odx-breakpoint-line-height-heading-2)}h1{--_font-size: var(--odx-breakpoint-font-size-heading-1);--_line-height: var(--odx-breakpoint-line-height-heading-1)}odx-icon{--rotate: 0deg;transition:var(--odx-transition-default);transition-property:transform;transform:rotate(var(--rotate))}[odxPreventTextOverflow]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}odx-list-item:has(:is(odx-button,odx-icon-button,odx-list-item::part(control)):not([aria-disabled=true]):active){--_color-background-pressed: var(--_color-background-hover)}odx-button:has(odx-icon:only-child),odx-button:has(odx-avatar){--_min-inline-size: 0}odx-accordion[control-position=start] odx-accordion-header::part(expand-control){--icon-rotation: -90deg;order:-1}odx-accordion[control-position=start] odx-accordion-header[expanded]::part(expand-control){--icon-rotation: 0}odx-input:has([slot=suffix])::part(base){padding-inline-end:var(--odx-size-px)}}@layer reset{:host{border:none;border-color:transparent;outline:none}}";
477
+
478
+ function mergeStyleSheets(...stylesheets) {
479
+ const mergedStyles = [];
480
+ for (const styles of stylesheets) {
481
+ if (!styles) continue;
482
+ mergedStyles.push(typeof styles === "string" ? unsafeCSS(styles) : styles);
483
+ }
484
+ return uniqBy(mergedStyles, String).flat(10);
485
+ }
486
+ function customElement(selector, styles = []) {
487
+ return (target) => {
488
+ if (!selector) return;
489
+ target.selector = selector;
490
+ target.styles = mergeStyleSheets(customElementStyles, target.styles, ...styles);
491
+ target.define = () => {
492
+ if (customElements.get(selector)) return;
493
+ customElements.define(selector, target);
494
+ };
495
+ };
496
+ }
497
+ class CustomElement extends LitElement {
498
+ render() {
499
+ return html`<slot></slot>`;
500
+ }
501
+ emit(event, eventInit) {
502
+ if (typeof event === "string") {
503
+ return !this.dispatchEvent(new CustomEvent(event, { bubbles: false, composed: false, cancelable: true, ...eventInit }));
504
+ }
505
+ return !this.dispatchEvent(event);
506
+ }
507
+ }
508
+
509
+ var __defProp$2 = Object.defineProperty;
510
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
511
+ var __decorateClass$2 = (decorators, target, key, kind) => {
512
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
365
513
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
366
514
  if (decorator = decorators[i])
367
515
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
368
- if (kind && result) __defProp$9(target, key, result);
516
+ if (kind && result) __defProp$2(target, key, result);
369
517
  return result;
370
518
  };
371
519
  const FormControl = dedupeMixin((superClass) => {
@@ -402,524 +550,15 @@ const FormControl = dedupeMixin((superClass) => {
402
550
  }
403
551
  }
404
552
  }
405
- __decorateClass$9([
553
+ __decorateClass$2([
406
554
  property()
407
555
  ], FormControlElement.prototype, "name", 2);
408
- __decorateClass$9([
556
+ __decorateClass$2([
409
557
  property()
410
558
  ], FormControlElement.prototype, "value", 2);
411
559
  return FormControlElement;
412
560
  });
413
561
 
414
- const KeyboardKey = {
415
- ARROW_UP: "ArrowUp",
416
- ARROW_DOWN: "ArrowDown",
417
- ARROW_LEFT: "ArrowLeft",
418
- ARROW_RIGHT: "ArrowRight",
419
- ENTER: "Enter",
420
- ESCAPE: "Escape",
421
- SPACE: " ",
422
- TAB: "Tab",
423
- BACKSPACE: "Backspace",
424
- DELETE: "Delete",
425
- END: "End",
426
- HOME: "Home",
427
- PAGE_UP: "PageUp",
428
- PAGE_DOWN: "PageDown",
429
- SHIFT: "Shift",
430
- CONTROL: "Control",
431
- ALT: "Alt",
432
- META: "Meta"
433
- };
434
- function getKeyboardEventInfo(event) {
435
- const { key } = event;
436
- const up = key === KeyboardKey.ARROW_UP;
437
- const right = key === KeyboardKey.ARROW_RIGHT;
438
- const down = key === KeyboardKey.ARROW_DOWN;
439
- const left = key === KeyboardKey.ARROW_LEFT;
440
- return {
441
- axis: { x: left || right, y: up || down },
442
- direction: { up, right, down, left },
443
- actions: {
444
- enter: key === KeyboardKey.ENTER,
445
- escape: key === KeyboardKey.ESCAPE,
446
- space: key === KeyboardKey.SPACE,
447
- tab: key === KeyboardKey.TAB && !event.shiftKey,
448
- backTab: key === KeyboardKey.TAB && event.shiftKey,
449
- start: key === KeyboardKey.HOME,
450
- end: key === KeyboardKey.END
451
- }
452
- };
453
- }
454
-
455
- var __defProp$8 = Object.defineProperty;
456
- var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
457
- var __decorateClass$8 = (decorators, target, key, kind) => {
458
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
459
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
460
- if (decorator = decorators[i])
461
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
462
- if (kind && result) __defProp$8(target, key, result);
463
- return result;
464
- };
465
- const LINK_SELECTORS = /* @__PURE__ */ new Set(["a", "button", "odx-link"]);
466
- class CheckboxFormControl extends FormControl(CustomElement) {
467
- constructor() {
468
- super();
469
- this.role = null;
470
- this.checked = false;
471
- this.#handleClick = ({ target }) => {
472
- const { localName } = target;
473
- if (LINK_SELECTORS.has(localName)) return;
474
- this.toggle(void 0, true);
475
- };
476
- this.#handleKeyboardEvent = (event) => {
477
- const { actions } = getKeyboardEventInfo(event);
478
- if (!actions.enter && !actions.space) return;
479
- const { localName } = event.target;
480
- event.preventDefault();
481
- if (event.type === "keydown" || LINK_SELECTORS.has(localName)) return;
482
- this.toggle(void 0, true);
483
- };
484
- if (!isServer) {
485
- this.addEventListener("click", this.#handleClick);
486
- this.addEventListener("keydown", this.#handleKeyboardEvent);
487
- this.addEventListener("keyup", this.#handleKeyboardEvent);
488
- }
489
- }
490
- static {
491
- this.shadowRootOptions = {
492
- ...CustomElement.shadowRootOptions,
493
- delegatesFocus: false
494
- };
495
- }
496
- toFormValue() {
497
- if (this.value) {
498
- return this.checked ? this.value : null;
499
- }
500
- return this.checked ? "on" : null;
501
- }
502
- toggle(state, emitEvent = false) {
503
- const currentState = this.checked;
504
- const newState = state ?? !currentState;
505
- if (this.disabled || this.readonly || newState === currentState) return;
506
- this.checked = newState;
507
- if (!emitEvent || !this.emit("change")) return;
508
- this.checked = currentState;
509
- }
510
- connectedCallback() {
511
- this.tabIndex = 0;
512
- super.connectedCallback();
513
- this.role ||= "checkbox";
514
- }
515
- updateAriaAttributes() {
516
- super.updateAriaAttributes?.();
517
- this.ariaChecked = toAriaBooleanAttribute(this.checked, false);
518
- }
519
- #handleClick;
520
- #handleKeyboardEvent;
521
- }
522
- __decorateClass$8([
523
- property({ type: Boolean, reflect: true })
524
- ], CheckboxFormControl.prototype, "checked", 2);
525
-
526
- var __defProp$7 = Object.defineProperty;
527
- var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
528
- var __decorateClass$7 = (decorators, target, key, kind) => {
529
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
530
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
531
- if (decorator = decorators[i])
532
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
533
- if (kind && result) __defProp$7(target, key, result);
534
- return result;
535
- };
536
- const GROUP_CONTROL_SELECTOR = "odx-checkbox-group-control";
537
- const _CheckboxGroupFormControl = class _CheckboxGroupFormControl extends FormControl(CustomElement) {
538
- constructor() {
539
- super();
540
- this.value = [];
541
- this.#handleChangeEvent = (event) => {
542
- const { target } = event;
543
- if (!this.isControl(target)) return;
544
- if (target.checked) {
545
- this.updateValue([...this.value, target.value], true);
546
- return;
547
- }
548
- this.updateValue(
549
- this.value.filter((value) => value !== target.value),
550
- true
551
- );
552
- };
553
- if (!isServer) {
554
- this.addEventListener("change", this.#handleChangeEvent);
555
- }
556
- }
557
- get childGroups() {
558
- return this.elements.filter((element) => element instanceof _CheckboxGroupFormControl);
559
- }
560
- get controls() {
561
- return this.#findCheckboxControls((element) => !element.hasAttribute(GROUP_CONTROL_SELECTOR)).concat(this.childGroups.flatMap((group) => group.controls));
562
- }
563
- get groupControls() {
564
- return this.#findCheckboxControls((element) => element.hasAttribute(GROUP_CONTROL_SELECTOR));
565
- }
566
- toFormValue() {
567
- const formData = new FormData();
568
- this.value.forEach((value, index) => {
569
- formData.append(`${this.name}[${index}]`, value);
570
- });
571
- return formData;
572
- }
573
- isIndeterminate() {
574
- return this.value.length > 0 && this.value.length < this.controls.length;
575
- }
576
- isControl(element) {
577
- return element instanceof CheckboxFormControl;
578
- }
579
- updated(props) {
580
- super.updated(props);
581
- if (props.has("value")) {
582
- this.updateCheckboxControls((control) => {
583
- control.checked = this.value.includes(control.value);
584
- });
585
- for (const groupControl of this.groupControls) {
586
- if (groupControl instanceof CheckboxFormControl && "indeterminate" in groupControl) {
587
- groupControl.indeterminate = this.isIndeterminate();
588
- groupControl.checked = this.controls.length > 0 && this.value.length === this.controls.length;
589
- }
590
- }
591
- }
592
- if (props.has("name")) {
593
- this.updateCheckboxControls((control) => {
594
- control.name = this.name;
595
- });
596
- }
597
- if (props.has("disabled")) {
598
- this.updateCheckboxControls((control) => {
599
- control.disabled = this.disabled;
600
- });
601
- }
602
- if (props.has("readonly")) {
603
- this.updateCheckboxControls((control) => {
604
- control.readonly = this.readonly;
605
- });
606
- }
607
- }
608
- updateCheckboxControls(updateFn) {
609
- this.controls.forEach(updateFn);
610
- }
611
- updateValue(value, dispatchEvent) {
612
- this.value = value;
613
- if (!dispatchEvent) return;
614
- this.emit("change");
615
- }
616
- #handleChangeEvent;
617
- #findCheckboxControls(predicate) {
618
- return this.elements.filter((element) => this.isControl(element) && predicate(element));
619
- }
620
- };
621
- __decorateClass$7([
622
- queryAssignedElements({ flatten: true })
623
- ], _CheckboxGroupFormControl.prototype, "elements", 2);
624
- __decorateClass$7([
625
- property({ type: Array })
626
- ], _CheckboxGroupFormControl.prototype, "value", 2);
627
- let CheckboxGroupFormControl = _CheckboxGroupFormControl;
628
-
629
- var __defProp$6 = Object.defineProperty;
630
- var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
631
- var __decorateClass$6 = (decorators, target, key, kind) => {
632
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
633
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
634
- if (decorator = decorators[i])
635
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
636
- if (kind && result) __defProp$6(target, key, result);
637
- return result;
638
- };
639
- class OptionControl extends CanBeDisabled(CustomElement) {
640
- constructor() {
641
- super(...arguments);
642
- this.role = null;
643
- this.selected = false;
644
- this.value = "";
645
- }
646
- getTextLabel() {
647
- return this.textContent?.trim() ?? "";
648
- }
649
- setActive() {
650
- this.setAttribute("odx-active", "true");
651
- }
652
- setInactive() {
653
- this.removeAttribute("odx-active");
654
- }
655
- connectedCallback() {
656
- super.connectedCallback();
657
- this.role ||= "option";
658
- }
659
- willUpdate(changes) {
660
- super.willUpdate?.(changes);
661
- if (changes.has("selected")) {
662
- this.ariaSelected = toAriaBooleanAttribute(this.selected, false);
663
- }
664
- }
665
- }
666
- __decorateClass$6([
667
- property({ type: Boolean })
668
- ], OptionControl.prototype, "selected", 2);
669
- __decorateClass$6([
670
- property()
671
- ], OptionControl.prototype, "value", 2);
672
-
673
- var __defProp$5 = Object.defineProperty;
674
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
675
- var __decorateClass$5 = (decorators, target, key, kind) => {
676
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
677
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
678
- if (decorator = decorators[i])
679
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
680
- if (kind && result) __defProp$5(target, key, result);
681
- return result;
682
- };
683
- class RadioGroupFormControl extends FormControl(CustomElement) {
684
- static {
685
- this.shadowRootOptions = {
686
- ...CustomElement.shadowRootOptions,
687
- delegatesFocus: true
688
- };
689
- }
690
- constructor() {
691
- super();
692
- if (!isServer) {
693
- this.addEventListener("change", this.#handleChange, { capture: true });
694
- new RovingTabindexController(this, {
695
- direction: "both",
696
- elements: () => this.getControls(),
697
- elementEnterAction: (element) => element.click(),
698
- focusInIndex: (elements) => elements.findIndex((element) => element.checked)
699
- });
700
- }
701
- }
702
- getControls() {
703
- return this.elements.filter((element) => this.isControl(element));
704
- }
705
- connectedCallback() {
706
- super.connectedCallback();
707
- this.role ||= "radiogroup";
708
- }
709
- isControl(element) {
710
- return element instanceof CheckboxFormControl;
711
- }
712
- update(changes) {
713
- super.update?.(changes);
714
- if (changes.has("value")) {
715
- this.updateCheckboxControls((control) => {
716
- control.checked = this.value.includes(control.value);
717
- });
718
- }
719
- if (changes.has("name")) {
720
- this.updateCheckboxControls((control) => {
721
- control.name = this.name;
722
- });
723
- }
724
- if (changes.has("disabled")) {
725
- this.updateCheckboxControls((control) => {
726
- control.disabled = this.disabled;
727
- });
728
- }
729
- if (changes.has("readonly")) {
730
- this.updateCheckboxControls((control) => {
731
- control.readonly = this.readonly;
732
- });
733
- }
734
- if (changes.has("required") || changes.has("value")) {
735
- const [firstControl] = this.getControls();
736
- if (!firstControl) return;
737
- this.setValidity({ valueMissing: this.required && this.value.length === 0 }, firstControl);
738
- }
739
- }
740
- async updateCheckboxControls(updateFn) {
741
- await 0;
742
- this.getControls().forEach(updateFn);
743
- }
744
- #handleChange = ({ target }) => {
745
- if (!this.isControl(target) || this.value === target.value) return;
746
- this.value = target.value;
747
- };
748
- }
749
- __decorateClass$5([
750
- queryAssignedElements({ flatten: true })
751
- ], RadioGroupFormControl.prototype, "elements", 2);
752
-
753
- var __defProp$4 = Object.defineProperty;
754
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
755
- var __decorateClass$4 = (decorators, target, key, kind) => {
756
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
757
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
758
- if (decorator = decorators[i])
759
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
760
- if (kind && result) __defProp$4(target, key, result);
761
- return result;
762
- };
763
- class SelectFormControl extends FormControl(
764
- CustomElement
765
- ) {
766
- constructor() {
767
- super();
768
- this.#selectedOptions = /* @__PURE__ */ new Map();
769
- this.multiple = false;
770
- this.value = "";
771
- this.handleKeyboardEvent = (event) => {
772
- const { actions } = getKeyboardEventInfo(event);
773
- const option = getElementFromEvent(event, (node) => node instanceof OptionControl);
774
- if (!option || !actions.enter && !actions.space) return;
775
- event.preventDefault();
776
- if (event.type === "keydown") return;
777
- this.toggle(option, void 0, true);
778
- };
779
- this.#handleClick = (event) => {
780
- const option = getElementFromEvent(event, (node) => node instanceof OptionControl);
781
- if (!option) return;
782
- this.toggle(option, void 0, true);
783
- };
784
- if (!isServer) {
785
- this.addEventListener("click", this.#handleClick);
786
- this.addEventListener("keydown", this.handleKeyboardEvent);
787
- this.addEventListener("keyup", this.handleKeyboardEvent);
788
- }
789
- }
790
- #selectedOptions;
791
- get selectedOptions() {
792
- return this.#selectedOptions.values();
793
- }
794
- toggle(option, state, emitEvent = false) {
795
- const currentState = option.selected;
796
- const newState = state ?? !option.selected;
797
- if (this.disabled || newState === option.selected) return;
798
- option.selected = newState;
799
- this.updateValue(option);
800
- if (!emitEvent || !this.emit("change")) return;
801
- option.selected = currentState;
802
- this.updateValue(option);
803
- }
804
- updateValue(option) {
805
- if (this.multiple) {
806
- const value = typeof this.value === "string" ? [this.value].filter(Boolean) : this.value;
807
- this.value = option.selected ? [...value, option.value] : value.filter((value2) => value2 !== option.value);
808
- } else {
809
- this.value = option.value;
810
- }
811
- }
812
- willUpdate(changes) {
813
- super.willUpdate?.(changes);
814
- if (changes.has("multiple")) {
815
- const [selectedOption] = Array.from(this.#selectedOptions.entries());
816
- if (selectedOption) {
817
- this.updateValue(selectedOption[1]);
818
- }
819
- }
820
- if (changes.has("value")) {
821
- this.updateSelection();
822
- }
823
- if (changes.has("required") || changes.has("value")) {
824
- const [selectedOption] = this.#selectedOptions.values();
825
- if (!selectedOption?.selected) return;
826
- this.setValidity({ valueMissing: this.required && this.value.length === 0 }, selectedOption);
827
- }
828
- }
829
- async updateSelection() {
830
- if (this.disabled) return;
831
- await 0;
832
- for (const option of this.options ?? []) {
833
- if (option.disabled) continue;
834
- option.selected = this.multiple ? this.value.includes(option.value) : this.value === option.value;
835
- option.setInactive();
836
- if (option.selected) {
837
- this.#selectedOptions.set(option.value, option);
838
- } else {
839
- this.#selectedOptions.delete(option.value);
840
- }
841
- }
842
- this.requestUpdate();
843
- }
844
- #handleClick;
845
- }
846
- __decorateClass$4([
847
- property({ type: Boolean, reflect: true })
848
- ], SelectFormControl.prototype, "multiple", 2);
849
- __decorateClass$4([
850
- property()
851
- ], SelectFormControl.prototype, "value", 2);
852
-
853
- var __defProp$3 = Object.defineProperty;
854
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
855
- var __decorateClass$3 = (decorators, target, key, kind) => {
856
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
857
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
858
- if (decorator = decorators[i])
859
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
860
- if (kind && result) __defProp$3(target, key, result);
861
- return result;
862
- };
863
- const CanBeExpanded = dedupeMixin((superClass) => {
864
- class CanBeExpandedMixin extends CanBeDisabled(superClass) {
865
- constructor() {
866
- super(...arguments);
867
- this.expanded = false;
868
- }
869
- collapse(emitEvent = false) {
870
- this.toggle(false, emitEvent);
871
- }
872
- expand(emitEvent = false) {
873
- this.toggle(true, emitEvent);
874
- }
875
- toggle(force, emitEvent = false) {
876
- const newState = force ?? !this.expanded;
877
- if (this.disabled || this.expanded === newState) return;
878
- const currentState = this.expanded;
879
- this.expanded = newState;
880
- if (!emitEvent || !this.emit(newState ? "expand" : "collapse", { composed: true, bubbles: true })) return;
881
- this.expanded = currentState;
882
- }
883
- }
884
- __decorateClass$3([
885
- property({ type: Boolean })
886
- ], CanBeExpandedMixin.prototype, "expanded", 2);
887
- return CanBeExpandedMixin;
888
- });
889
-
890
- var __defProp$2 = Object.defineProperty;
891
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
892
- var __decorateClass$2 = (decorators, target, key, kind) => {
893
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
894
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
895
- if (decorator = decorators[i])
896
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
897
- if (kind && result) __defProp$2(target, key, result);
898
- return result;
899
- };
900
- const CanBeSelected = dedupeMixin((superClass) => {
901
- class CanBeSelectedElement extends superClass {
902
- constructor() {
903
- super(...arguments);
904
- this.selected = false;
905
- this.ariaSelectedValue = "page";
906
- }
907
- willUpdate(props) {
908
- super.willUpdate(props);
909
- if (props.has("selected") || props.has("ariaSelectedValue")) {
910
- this.ariaCurrent = this.selected ? this.ariaSelectedValue : null;
911
- }
912
- }
913
- }
914
- __decorateClass$2([
915
- property({ type: Boolean })
916
- ], CanBeSelectedElement.prototype, "selected", 2);
917
- __decorateClass$2([
918
- property()
919
- ], CanBeSelectedElement.prototype, "ariaSelectedValue", 2);
920
- return CanBeSelectedElement;
921
- });
922
-
923
562
  var __defProp$1 = Object.defineProperty;
924
563
  var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
925
564
  var __decorateClass$1 = (decorators, target, key, kind) => {
@@ -1016,6 +655,18 @@ function parseDate(value) {
1016
655
  return Number.isNaN(date.getTime()) ? null : date;
1017
656
  }
1018
657
 
658
+ class SlotFallbackDirective extends Directive {
659
+ update({ options, element }) {
660
+ const host = options?.host;
661
+ if (!host || !(element instanceof HTMLSlotElement)) return;
662
+ const attributeName = ["empty-slot", element.name].filter(Boolean).join("-");
663
+ host.toggleAttribute(attributeName, !host.textContent?.trim() && element.assignedElements().length === 0);
664
+ }
665
+ render() {
666
+ }
667
+ }
668
+ const emptySlotFallbackFix = directive(SlotFallbackDirective);
669
+
1019
670
  const uniqueIdCache = /* @__PURE__ */ new Map();
1020
671
  function getUniqueId(key) {
1021
672
  const nextIndex = (uniqueIdCache.get(key) ?? 0) + 1;
@@ -1030,6 +681,93 @@ function clearUniqueIdCache(key) {
1030
681
  }
1031
682
  }
1032
683
 
684
+ const KeyboardKey = {
685
+ ARROW_UP: "ArrowUp",
686
+ ARROW_DOWN: "ArrowDown",
687
+ ARROW_LEFT: "ArrowLeft",
688
+ ARROW_RIGHT: "ArrowRight",
689
+ ENTER: "Enter",
690
+ ESCAPE: "Escape",
691
+ SPACE: " ",
692
+ TAB: "Tab",
693
+ BACKSPACE: "Backspace",
694
+ DELETE: "Delete",
695
+ END: "End",
696
+ HOME: "Home",
697
+ PAGE_UP: "PageUp",
698
+ PAGE_DOWN: "PageDown",
699
+ SHIFT: "Shift",
700
+ CONTROL: "Control",
701
+ ALT: "Alt",
702
+ META: "Meta"
703
+ };
704
+ function getKeyboardEventInfo(event) {
705
+ const { key } = event;
706
+ const up = key === KeyboardKey.ARROW_UP;
707
+ const right = key === KeyboardKey.ARROW_RIGHT;
708
+ const down = key === KeyboardKey.ARROW_DOWN;
709
+ const left = key === KeyboardKey.ARROW_LEFT;
710
+ return {
711
+ axis: { x: left || right, y: up || down },
712
+ direction: { up, right, down, left },
713
+ actions: {
714
+ enter: key === KeyboardKey.ENTER,
715
+ escape: key === KeyboardKey.ESCAPE,
716
+ space: key === KeyboardKey.SPACE,
717
+ tab: key === KeyboardKey.TAB && !event.shiftKey,
718
+ backTab: key === KeyboardKey.TAB && event.shiftKey,
719
+ start: key === KeyboardKey.HOME,
720
+ end: key === KeyboardKey.END
721
+ }
722
+ };
723
+ }
724
+
725
+ function requestUpdateOnAriaChange(ariaProperties) {
726
+ return (ctor) => {
727
+ for (const ariaProperty of ariaProperties) {
728
+ const attribute = ariaProperty.replace("aria", "aria-").replace(/Elements?/g, "").toLowerCase();
729
+ ctor.createProperty(ariaProperty, { attribute, reflect: true });
730
+ }
731
+ };
732
+ }
733
+ const optionalAttr = (value) => {
734
+ if (value === void 0 || value === null || value === "") return nothing;
735
+ return value;
736
+ };
737
+ function optionalSlot(host, slotName) {
738
+ if (host.querySelector(`[slot="${slotName}"]`)) {
739
+ return html`
740
+ <div class="${slotName}" part="${slotName}-container">
741
+ <slot name="${slotName}" @slotchange="${() => host.requestUpdate()}"></slot>
742
+ </div>
743
+ `;
744
+ }
745
+ return nothing;
746
+ }
747
+
748
+ function queryAssignedElement(options) {
749
+ return (obj, name) => {
750
+ const { slot, selector } = options ?? {};
751
+ const slotSelector = `slot${slot ? `[name=${slot}]` : ":not([name])"}`;
752
+ const descriptor = {
753
+ configurable: true,
754
+ enumerable: true,
755
+ get() {
756
+ const slotEl = this.renderRoot?.querySelector(slotSelector);
757
+ const elements = slotEl?.assignedElements(options) ?? [];
758
+ if (selector == null) {
759
+ return elements[0];
760
+ }
761
+ return elements.find((node) => node.matches(selector));
762
+ }
763
+ };
764
+ if (Reflect.decorate && typeof name !== "object") {
765
+ Object.defineProperty(obj, name, descriptor);
766
+ }
767
+ return descriptor;
768
+ };
769
+ }
770
+
1033
771
  function search(value, searchString, callback) {
1034
772
  let index = 0;
1035
773
  while (index < value.length) {
@@ -1047,6 +785,8 @@ function searchTextContent(options) {
1047
785
  while (walker.nextNode()) {
1048
786
  const content = walker.currentNode.textContent?.toLowerCase();
1049
787
  if (!content?.includes(query)) continue;
788
+ const parentElement = walker.currentNode.parentElement;
789
+ if (options.selector && !parentElement?.closest(options.selector)) continue;
1050
790
  search(content, query, (index) => {
1051
791
  const range = new Range();
1052
792
  range.setStart(walker.currentNode, index);
@@ -1130,4 +870,4 @@ class SharedResizeObserverInstance {
1130
870
  }
1131
871
  const SharedResizeObserver = new SharedResizeObserverInstance();
1132
872
 
1133
- export { CanBeDisabled, CanBeExpanded, CanBeReadonly, CanBeRequired, CanBeSelected, CanBeValidated, CheckboxFormControl, CheckboxGroupFormControl, CustomElement, DisabledContext, DisabledContextProvider, FocusTrapController, FormControl, KeyboardKey, NumberControl, OptionControl, RadioGroupFormControl, SelectFormControl, SharedIntersectionObserver, SharedResizeObserver, WithLoadingState, clearUniqueIdCache, createIntersectionObserver, createMutationObserver, createOptions, createResizeObserver, customElement, dedupeMixin, emptySlotFallbackFix, findClosestDocument, forwardEvent, fromAriaBooleanAttribute, getAssignedElements, getElementFromEvent, getKeyboardEventInfo, getUniqueId, optionalAttr, optionalSlot, parseDate, requestUpdateOnAriaChange, searchTextContent, toAriaBooleanAttribute, toPx, toggleAttribute, waitForAnimations };
873
+ export { ActiveDescendantsController, ActiveDescendantsControllerOptions, CanBeDisabled, CanBeExpanded, CanBeHighlighted, CanBeReadonly, CanBeRequired, CanBeSelected, CanBeValidated, CustomElement, DisabledContext, DisabledContextProvider, ExpandableItemManager, ExpandableItemManagerOptions, FocusTrapController, FocusTrapControllerOptions, FormControl, KeyboardKey, NumberControl, SharedIntersectionObserver, SharedResizeObserver, WithLoadingState, clearUniqueIdCache, createIntersectionObserver, createMutationObserver, createResizeObserver, customElement, dedupeMixin, emptySlotFallbackFix, findClosestDocument, forwardEvent, fromAriaBooleanAttribute, fromToggleEventState, getAssignedElements, getElementFromEvent, getKeyboardEventInfo, getUniqueId, optionalAttr, optionalSlot, parseDate, queryAssignedElement, requestUpdateOnAriaChange, searchTextContent, toAriaBooleanAttribute, toPx, toToggleEventState$1 as toToggleEventState, toggleAttribute, waitForAnimations };