@odx/foundation 1.0.0-beta.13 → 1.0.0-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cdk.js CHANGED
@@ -1,4 +1,4 @@
1
- import { FormControl, CustomElement, getKeyboardEventInfo, toAriaBooleanAttribute, CanBeHighlighted, CanBeDisabled, toggleAttribute, getUniqueId, getElementFromEvent, ActiveDescendantsController, dedupeMixin, optionalAttr, requestUpdateOnAriaChange, WithLoadingState, getAssignedElements, toPx, waitForAnimations, findClosestDocument, createMutationObserver, customElement } from '@odx/foundation';
1
+ import { FormControl, CustomElement, getKeyboardEventInfo, toAriaBooleanAttribute, CanBeHighlighted, CanBeDisabled, getUniqueId, getElementFromEvent, ActiveDescendantsController, dedupeMixin, optionalAttr, requestUpdateOnAriaChange, WithLoadingState, getAssignedElements, toPx, waitForAnimations, findClosestDocument, createMutationObserver, customElement } from '@odx/foundation';
2
2
  import { isServer, html, unsafeCSS } from 'lit';
3
3
  import { property, queryAssignedElements, query, state } from 'lit/decorators.js';
4
4
  import { R as RovingTabindexController, m as minBy } from './vendor-dJxQG085.js';
@@ -207,7 +207,7 @@ class OptionControl extends CanBeHighlighted(CanBeDisabled(CustomElement)) {
207
207
  return this.textContent?.trim() ?? "";
208
208
  }
209
209
  toggle(force) {
210
- toggleAttribute(this, "odx-active", force ?? !this.hasAttribute("odx-active"));
210
+ this.toggleAttribute("odx-active", force ?? !this.hasAttribute("odx-active"));
211
211
  }
212
212
  connectedCallback() {
213
213
  super.connectedCallback();
@@ -6,7 +6,6 @@ declare global {
6
6
  'odx-button': OdxButton;
7
7
  }
8
8
  }
9
- declare const OdxButton_base: import('../../lib/main.js').Constructor<import('../../lib/main.js').HasLoadingState> & typeof InteractiveElement;
10
9
  /**
11
10
  * A button is clickable text or an icon that triggers an action on the page or in the background.
12
11
  * Depending on the action, content, and hierarchy, a button can be used on its own or grouped with
@@ -19,7 +18,7 @@ declare const OdxButton_base: import('../../lib/main.js').Constructor<import('..
19
18
  * @slot suffix - Contains the button's icon or state indicator, e.g. a spinner.
20
19
  * @slot - Contains button text
21
20
  */
22
- export declare class OdxButton extends OdxButton_base {
21
+ export declare class OdxButton extends InteractiveElement {
23
22
  #private;
24
23
  static readonly formAssociated = true;
25
24
  alignBadge?: ButtonBadgeAlign;
@@ -39,5 +38,4 @@ export declare class OdxButton extends OdxButton_base {
39
38
  constructor();
40
39
  protected render(): TemplateResult;
41
40
  }
42
- export {};
43
41
  //# sourceMappingURL=button.d.ts.map
@@ -1,4 +1,4 @@
1
- import { CanBeExpanded, CustomElement, fromToggleEventState, getUniqueId, toAriaBooleanAttribute, customElement, requestUpdateOnAriaChange, ExpandableItemManager, CanBeDisabled, SharedResizeObserver, optionalAttr, createIntersectionObserver, createMutationObserver, getElementFromEvent, WithLoadingState, optionalSlot, toggleAttribute, getKeyboardEventInfo, queryAssignedElement, parseDate, searchTextContent, waitForAnimations, FormControl, forwardEvent, CanBeSelected, FocusTrapController, toPx, getAssignedElements, emptySlotFallbackFix, NumberControl } from '@odx/foundation';
1
+ import { CanBeExpanded, CustomElement, fromToggleEventState, getUniqueId, toAriaBooleanAttribute, customElement, requestUpdateOnAriaChange, ExpandableItemManager, CanBeDisabled, SharedResizeObserver, optionalAttr, createIntersectionObserver, createMutationObserver, getElementFromEvent, optionalSlot, toggleAttribute, getKeyboardEventInfo, queryAssignedElement, parseDate, searchTextContent, waitForAnimations, FormControl, forwardEvent, CanBeSelected, WithLoadingState, FocusTrapController, toPx, getAssignedElements, emptySlotFallbackFix, NumberControl } from '@odx/foundation';
2
2
  import { html, isServer, css, nothing } from 'lit';
3
3
  import { property, queryAssignedElements, query, queryAll, state } from 'lit/decorators.js';
4
4
  import { signal, computed, effect, SignalWatcher } from '@lit-labs/preact-signals';
@@ -832,7 +832,7 @@ var __privateGet$o = (obj, member, getter) => (__accessCheck$s(obj, member, "rea
832
832
  var __privateAdd$s = (obj, member, value) => member.has(obj) ? __typeError$s("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
833
833
  var __privateMethod$d = (obj, member, method) => (__accessCheck$s(obj, member, "access private method"), method);
834
834
  var _internals, _OdxButton_instances, handleClick_fn;
835
- let OdxButton = class extends WithLoadingState(InteractiveElement) {
835
+ let OdxButton = class extends InteractiveElement {
836
836
  constructor() {
837
837
  super();
838
838
  __privateAdd$s(this, _OdxButton_instances);
@@ -12,7 +12,7 @@ export * from './mixins/can-be-validated.js';
12
12
  export * from './mixins/form-control.js';
13
13
  export * from './mixins/number-control.js';
14
14
  export * from './mixins/with-loading-state.js';
15
- export * from './utils/a11y.js';
15
+ export * from './types/a11y.js';
16
16
  export * from './utils/date.js';
17
17
  export * from './utils/dedupe-mixin.js';
18
18
  export * from './utils/dom.js';
@@ -1,5 +1,5 @@
1
1
  import { CustomElement } from '../custom-element.js';
2
- import { ARIAMixinStrict } from '../utils/a11y.js';
2
+ import { ARIAMixinStrict } from '../types/a11y.js';
3
3
  import { Constructor } from '../utils/dedupe-mixin.js';
4
4
  export interface CanBeSelected {
5
5
  selected: boolean;
@@ -1,7 +1,3 @@
1
- export type ARIAProperty = keyof ARIAMixin;
2
- /**
3
- * Valid values for `role`.
4
- */
5
1
  export type ARIARole = 'alert' | 'alertdialog' | 'button' | 'checkbox' | 'dialog' | 'gridcell' | 'link' | 'log' | 'marquee' | 'menuitem' | 'menuitemcheckbox' | 'menuitemradio' | 'option' | 'progressbar' | 'radio' | 'scrollbar' | 'searchbox' | 'slider' | 'spinbutton' | 'status' | 'switch' | 'tab' | 'tabpanel' | 'textbox' | 'timer' | 'tooltip' | 'treeitem' | 'combobox' | 'grid' | 'listbox' | 'menu' | 'menubar' | 'radiogroup' | 'tablist' | 'tree' | 'treegrid' | 'application' | 'article' | 'cell' | 'columnheader' | 'definition' | 'directory' | 'document' | 'feed' | 'figure' | 'group' | 'heading' | 'img' | 'list' | 'listitem' | 'math' | 'none' | 'note' | 'presentation' | 'region' | 'row' | 'rowgroup' | 'rowheader' | 'separator' | 'table' | 'term' | 'text' | 'toolbar' | 'banner' | 'complementary' | 'contentinfo' | 'form' | 'main' | 'navigation' | 'region' | 'search' | 'doc-abstract' | 'doc-acknowledgments' | 'doc-afterword' | 'doc-appendix' | 'doc-backlink' | 'doc-biblioentry' | 'doc-bibliography' | 'doc-biblioref' | 'doc-chapter' | 'doc-colophon' | 'doc-conclusion' | 'doc-cover' | 'doc-credit' | 'doc-credits' | 'doc-dedication' | 'doc-endnote' | 'doc-endnotes' | 'doc-epigraph' | 'doc-epilogue' | 'doc-errata' | 'doc-example' | 'doc-footnote' | 'doc-foreword' | 'doc-glossary' | 'doc-glossref' | 'doc-index' | 'doc-introduction' | 'doc-noteref' | 'doc-notice' | 'doc-pagebreak' | 'doc-pagelist' | 'doc-part' | 'doc-preface' | 'doc-prologue' | 'doc-pullquote' | 'doc-qna' | 'doc-subtitle' | 'doc-tip' | 'doc-toc';
6
2
  /**
7
3
  * An extension of `ARIAMixin` that enforces strict value types for aria
@@ -59,5 +55,4 @@ export interface ARIAMixinStrict extends ARIAMixin {
59
55
  ariaValueText: string | null;
60
56
  role: ARIARole | null;
61
57
  }
62
- export declare function ariaPropertyToAttribute<K extends ARIAProperty>(property: K): string;
63
58
  //# sourceMappingURL=a11y.d.ts.map
@@ -1,5 +1,3 @@
1
- export type CSSDimensionUnit = 'px' | 'em' | 'rem' | 'vh' | 'vw' | 'vmin' | 'vmax' | '%' | 'fr' | 'auto' | 'inherit' | 'initial' | 'unset';
2
- export type CSSDimensionValue = `${number}${CSSDimensionUnit}`;
3
1
  /**
4
2
  * Creates a new MutationObserver instance.
5
3
  *
@@ -1,6 +1,5 @@
1
1
  import { ReactiveElement, TemplateResult, nothing } from 'lit';
2
- import { ARIAProperty } from './a11y.js';
3
- export declare function requestUpdateOnAriaChange(ariaProperties: ARIAProperty[]): (ctor: typeof ReactiveElement) => void;
2
+ export declare function requestUpdateOnAriaChange(ariaProperties: Array<keyof ARIAMixin>): (ctor: typeof ReactiveElement) => void;
4
3
  export declare const optionalAttr: <T>(value: T) => NonNullable<T>;
5
4
  export declare function optionalSlot(host: ReactiveElement, slotName: string): TemplateResult | typeof nothing;
6
5
  //# sourceMappingURL=lit.d.ts.map
package/dist/main.js CHANGED
@@ -646,10 +646,6 @@ const WithLoadingState = dedupeMixin((superClass) => {
646
646
  return WithLoadingStateElement;
647
647
  });
648
648
 
649
- function ariaPropertyToAttribute(property) {
650
- return property.replace("aria", "aria-").replace(/Elements?/g, "").toLowerCase();
651
- }
652
-
653
649
  function parseDate(value) {
654
650
  const date = new Date(value);
655
651
  if (Number.isNaN(date.getTime()) && typeof value === "string") {
@@ -664,7 +660,7 @@ class SlotFallbackDirective extends Directive {
664
660
  const host = options?.host;
665
661
  if (!host || !(element instanceof HTMLSlotElement)) return;
666
662
  const attributeName = ["empty-slot", element.name].filter(Boolean).join("-");
667
- toggleAttribute(host, attributeName, !host.textContent?.trim() && element.assignedElements().length === 0);
663
+ host.toggleAttribute(attributeName, !host.textContent?.trim() && element.assignedElements().length === 0);
668
664
  }
669
665
  render() {
670
666
  }
@@ -729,10 +725,8 @@ function getKeyboardEventInfo(event) {
729
725
  function requestUpdateOnAriaChange(ariaProperties) {
730
726
  return (ctor) => {
731
727
  for (const ariaProperty of ariaProperties) {
732
- ctor.createProperty(ariaProperty, {
733
- attribute: ariaPropertyToAttribute(ariaProperty),
734
- reflect: true
735
- });
728
+ const attribute = ariaProperty.replace("aria", "aria-").replace(/Elements?/g, "").toLowerCase();
729
+ ctor.createProperty(ariaProperty, { attribute, reflect: true });
736
730
  }
737
731
  };
738
732
  }
@@ -876,4 +870,4 @@ class SharedResizeObserverInstance {
876
870
  }
877
871
  const SharedResizeObserver = new SharedResizeObserverInstance();
878
872
 
879
- export { ActiveDescendantsController, ActiveDescendantsControllerOptions, CanBeDisabled, CanBeExpanded, CanBeHighlighted, CanBeReadonly, CanBeRequired, CanBeSelected, CanBeValidated, CustomElement, DisabledContext, DisabledContextProvider, ExpandableItemManager, ExpandableItemManagerOptions, FocusTrapController, FocusTrapControllerOptions, FormControl, KeyboardKey, NumberControl, SharedIntersectionObserver, SharedResizeObserver, WithLoadingState, ariaPropertyToAttribute, 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 };
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 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@odx/foundation",
3
3
  "description": "A library of Web Component building blocks for ODX",
4
- "version": "1.0.0-beta.13",
4
+ "version": "1.0.0-beta.14",
5
5
  "author": "Drägerwerk AG & Co.KGaA",
6
6
  "license": "SEE LICENSE IN LICENSE",
7
7
  "homepage": "https://odx.draeger.com",