@odx/foundation 1.0.0-beta.198 → 1.0.0-beta.199

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.
@@ -10,6 +10,7 @@ declare global {
10
10
  }
11
11
  }
12
12
  export declare class OdxBreadcrumbs extends CustomElement {
13
+ #private;
13
14
  max: number;
14
15
  connectedCallback(): void;
15
16
  protected render(): TemplateResult;
@@ -1,6 +1,6 @@
1
1
  import { _ as __decorateClass } from './_virtual_class-decorator-runtime.js';
2
2
  import { CustomElement, customElement, CanBeExpanded, InteractiveControlElement, Alignment, ControlSize, ExpandableItemManager, Variant, LinkControlElement, activeDirective, Size, CanBeDisabled, Placement, FormAssociated, ActiveDescendantsController, Shape, CheckboxControl, CheckboxControlGroup, DialogElement, OptionControlElement, ProgressVariant, RadioGroupControlElement, CanBeCollapsed, ListboxControlElement, IsDraggable, NumberFormControl, dragActiveDirective, DragController } from '@odx/foundation';
3
- import { getUniqueId, toAriaBooleanAttribute, getAssignedElements, booleanAttributeDirective, optionalAttr, interactionResponse, getElementFromEvent, toPx, findClosestDocument, commandDirective, addGlobalEventListener, waitForAnimations, removeGlobalEventListener, getKeyInfo, clickedOutside, setFocusable, insertChildrenBetween, optionalSlot, parseDate, supportsHover, forwardEvent, observeElementResize, unobserveElementResize, isToggleOpen } from '@odx/foundation/utils';
3
+ import { getUniqueId, toAriaBooleanAttribute, getAssignedElements, booleanAttributeDirective, optionalAttr, interactionResponse, getElementFromEvent, toPx, findClosestDocument, commandDirective, addGlobalEventListener, waitForAnimations, removeGlobalEventListener, getKeyInfo, clickedOutside, setFocusable, optionalSlot, parseDate, supportsHover, forwardEvent, observeElementResize, unobserveElementResize, isToggleOpen } from '@odx/foundation/utils';
4
4
  import { html, isServer, unsafeCSS, css, nothing } from 'lit';
5
5
  import { property, query, state } from 'lit/decorators.js';
6
6
  import { p as pick, R as RovingTabindexController, e, c as computePosition, o as offset, s as shift, f as flip, a as size, b as arrow, h as hide, d as autoUpdate, t as throttle, r as round, g as debounce } from './vendor.js';
@@ -1494,45 +1494,67 @@ __decorateClass([
1494
1494
  ], _OdxLink.prototype, "subtle", 2);
1495
1495
  let OdxLink = _OdxLink;
1496
1496
 
1497
- const styles$12 = ":host{min-height:var(--odx-size-225);flex-wrap:wrap;place-items:center;display:flex}::slotted(odx-link){gap:var(--odx-spacing-sm);padding-inline:var(--odx-control-spacing-inline-md);align-items:center;display:inline-flex}::slotted(odx-link:last-of-type){color:var(--odx-color-foreground-rest)}::slotted(odx-link[hidden]){display:none}::slotted([odx-breadcrumbs-separator]){margin-inline:var(--odx-spacing-negative-25);color:var(--odx-color-foreground-rest-subtle);pointer-events:none}";
1497
+ const styles$12 = ":host{min-height:var(--odx-size-225);flex-wrap:wrap;place-items:center;display:flex}::slotted(odx-link){gap:var(--odx-spacing-sm);padding-inline:var(--odx-control-spacing-inline-md);align-items:center;display:inline-flex}::slotted(odx-link:last-of-type){color:var(--odx-color-foreground-rest)}::slotted([hidden]){display:none}::slotted([odx-breadcrumbs-separator]){margin-inline:var(--odx-spacing-negative-25);color:var(--odx-color-foreground-rest-subtle);pointer-events:none}";
1498
1498
 
1499
+ const breadcrumbsSeparatorDirective = booleanAttributeDirective({ name: "odx-breadcrumbs-separator" });
1499
1500
  const breadcrumbsItemSeparator = (() => {
1500
1501
  const element = new OdxIconElement();
1501
- element.toggleAttribute("odx-breadcrumbs-separator", true);
1502
+ breadcrumbsSeparatorDirective.toggle(element, true);
1502
1503
  element.name = "core::chevron-right";
1503
1504
  element.setAttribute("size", "sm");
1504
- element.slot = "items";
1505
1505
  return element;
1506
1506
  })();
1507
1507
  const _OdxBreadcrumbs = class _OdxBreadcrumbs extends CustomElement {
1508
1508
  constructor() {
1509
1509
  super(...arguments);
1510
+ this.#slotUpdateLock = false;
1510
1511
  this.max = 4;
1512
+ this.#handleSlotChange = async () => {
1513
+ if (this.#slotUpdateLock) return;
1514
+ this.#slotUpdateLock = true;
1515
+ const separators = getAssignedElements(this.renderRoot, { selector: breadcrumbsSeparatorDirective.applied });
1516
+ for (const separator of separators) {
1517
+ separator.remove();
1518
+ }
1519
+ for (const link of this.#getLinks()) {
1520
+ const nextLink = link.nextElementSibling;
1521
+ link.ariaCurrent = nextLink ? null : "page";
1522
+ link.subtle = !nextLink;
1523
+ if (!nextLink) continue;
1524
+ const separator = breadcrumbsItemSeparator.cloneNode(true);
1525
+ separator.hidden = link.hidden;
1526
+ this.insertBefore(separator, nextLink);
1527
+ }
1528
+ await 0;
1529
+ this.#slotUpdateLock = false;
1530
+ };
1511
1531
  }
1512
1532
  static {
1513
1533
  customElement("odx-breadcrumbs", styles$12)(_OdxBreadcrumbs);
1514
1534
  }
1535
+ #slotUpdateLock;
1515
1536
  connectedCallback() {
1516
1537
  super.connectedCallback();
1517
1538
  this.role ||= "navigation";
1518
1539
  }
1519
1540
  render() {
1520
- return html`<slot @slotchange="${() => this.requestUpdate()}"></slot><slot name="items"></slot>`;
1541
+ return html`<slot @slotchange="${this.#handleSlotChange}"></slot>`;
1521
1542
  }
1522
1543
  updated(props) {
1523
1544
  super.updated(props);
1524
- const links = getAssignedElements(this.renderRoot, { selector: OdxLink.tagName });
1525
- for (const link of links) {
1526
- link.slot = "items";
1527
- }
1528
- const items = getAssignedElements(this.renderRoot, { selector: OdxLink.tagName, slot: "items" });
1529
- for (const [index, item] of items.entries()) {
1530
- item.hidden = index > 0 && index <= items.length - this.max;
1531
- item.ariaCurrent = item.nextElementSibling ? null : "page";
1532
- item.subtle = !item.nextElementSibling;
1545
+ if (props.has("max")) {
1546
+ const links = this.#getLinks();
1547
+ for (const [index, link] of links.entries()) {
1548
+ link.hidden = index > 0 && index <= links.length - this.max;
1549
+ if (!(link.nextElementSibling instanceof OdxIconElement)) continue;
1550
+ link.nextElementSibling.hidden = link.hidden;
1551
+ }
1533
1552
  }
1534
- insertChildrenBetween(items, breadcrumbsItemSeparator, (element) => !element.hidden);
1535
1553
  }
1554
+ #getLinks() {
1555
+ return getAssignedElements(this.renderRoot, { selector: (element) => element instanceof OdxLink });
1556
+ }
1557
+ #handleSlotChange;
1536
1558
  };
1537
1559
  __decorateClass([
1538
1560
  property({ type: Number })
package/dist/main.js CHANGED
@@ -7,7 +7,7 @@ import { when } from 'lit/directives/when.js';
7
7
 
8
8
  const name = "@odx/foundation";
9
9
  const displayName = "ODX Design System Foundation";
10
- const version = "1.0.0-beta.198";
10
+ const version = "1.0.0-beta.199";
11
11
  const pkg = {
12
12
  name,
13
13
  displayName,
@@ -919,7 +919,7 @@ __decorateClass([
919
919
  ], _DialogElement.prototype, "size", 2);
920
920
  let DialogElement = _DialogElement;
921
921
 
922
- const styles$1 = "@layer base{:host,.base{touch-action:manipulation;cursor:pointer}.label{margin-block:calc(-1*var(--_spacing));margin-inline:calc(-1*var(--_spacing-inline));padding-block:var(--_spacing);padding-inline:var(--_spacing-inline);text-align:inherit;pointer-events:none;flex:1}:host(:not([loading])) .base{&:hover{--_color-background:var(--_color-background-hover);--_color-stroke:var(--_color-stroke-hover);--_color-foreground:var(--_color-foreground-hover)}&:active{--_color-background:var(--_color-background-pressed);--_color-foreground:var(--_color-foreground-pressed);--_color-stroke:var(--_color-stroke-pressed)}}}";
922
+ const styles$1 = "@layer base{:host{flex:none}:host,.base{touch-action:manipulation;cursor:pointer}.label{margin-block:calc(-1*var(--_spacing));margin-inline:calc(-1*var(--_spacing-inline));padding-block:var(--_spacing);padding-inline:var(--_spacing-inline);text-align:inherit;pointer-events:none;flex:1}:host(:not([loading])) .base{&:hover{--_color-background:var(--_color-background-hover);--_color-stroke:var(--_color-stroke-hover);--_color-foreground:var(--_color-foreground-hover)}&:active{--_color-background:var(--_color-background-pressed);--_color-foreground:var(--_color-foreground-pressed);--_color-stroke:var(--_color-stroke-pressed)}}}";
923
923
 
924
924
  class InteractiveControlElement extends ControlElement {
925
925
  constructor() {
@@ -10,7 +10,6 @@ export interface GetAssignedElementOptions<T extends HTMLElement = HTMLElement>
10
10
  flatten?: boolean;
11
11
  }
12
12
  export declare function getAssignedElements<T extends HTMLElement = HTMLElement>(root: DocumentFragment | HTMLElement, options?: GetAssignedElementOptions<T>): T[];
13
- export declare function insertChildrenBetween<T extends Element>(elements: T[], newChild: Element, shouldInsert?: (element: T) => boolean): void;
14
13
  export declare function setFocusable(target: HTMLElement, interactive: boolean, fallback?: number): void;
15
14
  export declare function waitForAnimations(element?: Element | null, subtree?: boolean): Promise<Animation[]>;
16
15
  export declare function interactionResponse(): Promise<unknown>;
package/dist/utils.js CHANGED
@@ -81,14 +81,6 @@ function getAssignedElements(root, options) {
81
81
  const selectorFn = typeof selector === "string" ? (element) => element.matches(selector) : selector;
82
82
  return elements.filter(selectorFn);
83
83
  }
84
- function insertChildrenBetween(elements, newChild, shouldInsert) {
85
- for (const element of elements) {
86
- const nextElement = element.nextElementSibling;
87
- nextElement?.isEqualNode(newChild) && nextElement.remove();
88
- if (!(element.nextElementSibling && (shouldInsert?.(element) ?? true))) continue;
89
- element.parentElement?.insertBefore(newChild.cloneNode(true), element.nextElementSibling);
90
- }
91
- }
92
84
  function setFocusable(target, interactive, fallback) {
93
85
  if (interactive) {
94
86
  target.tabIndex = 0;
@@ -306,4 +298,4 @@ function resetUniqueId(key) {
306
298
  }
307
299
  }
308
300
 
309
- export { InvokerCommandEvent, addGlobalEventListener, booleanAttributeDirective, clickedOutside, commandDirective, createCustomEvent, createToggleEvent, findClosestDocument, forwardEvent, getAssignedElements, getElementFromEvent, getKeyInfo, getUniqueId, insertChildrenBetween, interactionResponse, isToggleOpen, observeElementResize, optionalAttr, optionalSlot, parseDate, querySlotSelector, removeGlobalEventListener, resetUniqueId, setFocusable, stringAttributeDirective, supportsHover, toAriaBooleanAttribute, toPx, unobserveElementResize, waitForAnimations };
301
+ export { InvokerCommandEvent, addGlobalEventListener, booleanAttributeDirective, clickedOutside, commandDirective, createCustomEvent, createToggleEvent, findClosestDocument, forwardEvent, getAssignedElements, getElementFromEvent, getKeyInfo, getUniqueId, interactionResponse, isToggleOpen, observeElementResize, optionalAttr, optionalSlot, parseDate, querySlotSelector, removeGlobalEventListener, resetUniqueId, setFocusable, stringAttributeDirective, supportsHover, toAriaBooleanAttribute, toPx, unobserveElementResize, waitForAnimations };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@odx/foundation",
3
3
  "displayName": "ODX Design System Foundation",
4
4
  "description": "A library of Web Component building blocks for ODX",
5
- "version": "1.0.0-beta.198",
5
+ "version": "1.0.0-beta.199",
6
6
  "author": "Drägerwerk AG & Co.KGaA",
7
7
  "license": "SEE LICENSE IN LICENSE",
8
8
  "homepage": "https://odx.draeger.com",
@@ -27,16 +27,16 @@
27
27
  "@floating-ui/dom": "1.7.4",
28
28
  "@lit-labs/preact-signals": "1.0.3",
29
29
  "@lit-labs/rollup-plugin-minify-html-literals": "0.1.0",
30
- "@odx/icons": "4.0.0-rc.41",
30
+ "@odx/icons": "4.0.0-rc.42",
31
31
  "@spectrum-web-components/reactive-controllers": "1.7.0",
32
32
  "es-toolkit": "1.39.10",
33
- "sass-embedded": "1.90.0",
33
+ "sass-embedded": "1.91.0",
34
34
  "stylelint": "16.23.1",
35
35
  "stylelint-config-concentric-order": "5.2.1",
36
36
  "stylelint-config-standard": "39.0.0",
37
+ "@odx-internal/config-typescript": "0.0.0",
37
38
  "@odx-internal/config-vite": "0.0.0",
38
39
  "@odx-internal/utils-storybook": "0.0.0",
39
- "@odx-internal/config-typescript": "0.0.0",
40
40
  "@odx/design-tokens": "1.1.0-rc.7"
41
41
  },
42
42
  "sideEffects": [