@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.172 → 2.0.0-next.174

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 (33) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +182 -35
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +45 -5
  4. package/dist/components/accordion-card/accordion-card.css.js +61 -19
  5. package/dist/components/accordion-card/accordion-card.css.js.map +1 -1
  6. package/dist/components/accordion-card/accordion-card.d.ts +12 -3
  7. package/dist/components/accordion-card/accordion-card.d.ts.map +1 -1
  8. package/dist/components/accordion-card/accordion-card.js +23 -5
  9. package/dist/components/accordion-card/accordion-card.js.map +1 -1
  10. package/dist/components/accordion-item/accordion-item.css.js +40 -9
  11. package/dist/components/accordion-item/accordion-item.css.js.map +1 -1
  12. package/dist/components/accordion-item/accordion-item.d.ts +14 -5
  13. package/dist/components/accordion-item/accordion-item.d.ts.map +1 -1
  14. package/dist/components/accordion-item/accordion-item.js +23 -3
  15. package/dist/components/accordion-item/accordion-item.js.map +1 -1
  16. package/dist/internal/focus.d.ts +23 -0
  17. package/dist/internal/focus.d.ts.map +1 -1
  18. package/dist/internal/focus.js +38 -1
  19. package/dist/internal/focus.js.map +1 -1
  20. package/docs/GettingStarted.mdx +8 -3
  21. package/docs/MigrationGuide.mdx +18 -4
  22. package/docs/migration-guide/api-ar.md +9 -7
  23. package/docs/migration-guide/api-automation.md +0 -1
  24. package/docs/migration-guide/deprecated-members.md +9 -8
  25. package/package.json +1 -1
  26. package/src/components/accordion-card/accordion-card.css +57 -15
  27. package/src/components/accordion-card/accordion-card.spec.ts +171 -0
  28. package/src/components/accordion-card/accordion-card.ts +32 -12
  29. package/src/components/accordion-item/accordion-item.css +40 -9
  30. package/src/components/accordion-item/accordion-item.spec.ts +161 -0
  31. package/src/components/accordion-item/accordion-item.ts +34 -9
  32. package/src/internal/_test-utils.ts +3 -12
  33. package/src/internal/focus.ts +45 -0
@@ -19,6 +19,51 @@ export function deepActiveElement(): Element | null {
19
19
  return active;
20
20
  }
21
21
 
22
+ /**
23
+ * Whether `node` sits inside `root` in the composed tree.
24
+ *
25
+ * `Node.contains()` walks the DOM tree, where slotted light-DOM content is a
26
+ * child of the host and not of the slot — so it answers no for exactly the
27
+ * content a component projects into itself. This follows `assignedSlot` and
28
+ * shadow hosts as well.
29
+ */
30
+ export function composedContains(root: Node, node: Node | null): boolean {
31
+ let current: Node | null = node;
32
+ while (current) {
33
+ if (current === root) return true;
34
+ current =
35
+ (current as Element).assignedSlot ??
36
+ current.parentNode ??
37
+ (current instanceof ShadowRoot ? current.host : null);
38
+ }
39
+ return false;
40
+ }
41
+
42
+ /**
43
+ * Moves focus out of `hidden`, to the first fallback that will take it.
44
+ *
45
+ * Call it just before a region becomes `inert` or is taken out of the page.
46
+ * The browser blurs whatever it hides, and focus lands on `<body>` a frame or
47
+ * two later, so the next Tab press starts from the top of the document instead
48
+ * of where the user was.
49
+ *
50
+ * Each candidate is tried and then checked, rather than inspected first: a
51
+ * `disabled` button, a hidden one and an element with no tabindex all refuse
52
+ * focus for different reasons, and the only reliable question is whether focus
53
+ * actually left.
54
+ */
55
+ export function releaseFocusBefore(
56
+ hidden: Node,
57
+ ...fallbacks: (HTMLElement | null | undefined)[]
58
+ ): void {
59
+ if (!composedContains(hidden, deepActiveElement())) return;
60
+ for (const candidate of fallbacks) {
61
+ if (!candidate) continue;
62
+ candidate.focus();
63
+ if (!composedContains(hidden, deepActiveElement())) return;
64
+ }
65
+ }
66
+
22
67
  function isTabbable(element: Element): element is HTMLElement {
23
68
  if (!element.matches(TABBABLE_SELECTOR)) return false;
24
69
  if ((element as HTMLElement).tabIndex < 0) return false;