@nldd/design-system 0.8.97 → 0.8.99

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 (175) hide show
  1. package/custom-elements.json +192 -46
  2. package/dist/components/actions/menu/menu.d.ts +39 -5
  3. package/dist/components/actions/menu/menu.d.ts.map +1 -1
  4. package/dist/components/actions/menu/menu.js +120 -7
  5. package/dist/components/actions/menu/menu.js.map +1 -1
  6. package/dist/components/actions/menu/menu.template.d.ts +4 -3
  7. package/dist/components/actions/menu/menu.template.d.ts.map +1 -1
  8. package/dist/components/actions/menu/menu.template.js +10 -5
  9. package/dist/components/actions/menu/menu.template.js.map +1 -1
  10. package/dist/components/actions/toolbar/toolbar.d.ts +14 -3
  11. package/dist/components/actions/toolbar/toolbar.d.ts.map +1 -1
  12. package/dist/components/actions/toolbar/toolbar.js +45 -7
  13. package/dist/components/actions/toolbar/toolbar.js.map +1 -1
  14. package/dist/components/actions/toolbar/toolbar.styles.d.ts.map +1 -1
  15. package/dist/components/actions/toolbar/toolbar.styles.js +15 -1
  16. package/dist/components/actions/toolbar/toolbar.styles.js.map +1 -1
  17. package/dist/components/components.js +1104 -186
  18. package/dist/components/content/code-viewer/code-viewer.d.ts +4 -1
  19. package/dist/components/content/code-viewer/code-viewer.d.ts.map +1 -1
  20. package/dist/components/content/code-viewer/code-viewer.js +43 -5
  21. package/dist/components/content/code-viewer/code-viewer.js.map +1 -1
  22. package/dist/components/content/code-viewer/code-viewer.styles.d.ts.map +1 -1
  23. package/dist/components/content/code-viewer/code-viewer.styles.js +22 -7
  24. package/dist/components/content/code-viewer/code-viewer.styles.js.map +1 -1
  25. package/dist/components/content/code-viewer/code-viewer.template.d.ts.map +1 -1
  26. package/dist/components/content/code-viewer/code-viewer.template.js +1 -0
  27. package/dist/components/content/code-viewer/code-viewer.template.js.map +1 -1
  28. package/dist/components/content/tooltip/tooltip.d.ts +7 -0
  29. package/dist/components/content/tooltip/tooltip.d.ts.map +1 -1
  30. package/dist/components/content/tooltip/tooltip.js +29 -2
  31. package/dist/components/content/tooltip/tooltip.js.map +1 -1
  32. package/dist/components/content/visually-hidden/visually-hidden.d.ts +35 -0
  33. package/dist/components/content/visually-hidden/visually-hidden.d.ts.map +1 -0
  34. package/dist/components/content/visually-hidden/visually-hidden.js +45 -0
  35. package/dist/components/content/visually-hidden/visually-hidden.js.map +1 -0
  36. package/dist/components/content/visually-hidden/visually-hidden.styles.d.ts +2 -0
  37. package/dist/components/content/visually-hidden/visually-hidden.styles.d.ts.map +1 -0
  38. package/dist/components/content/visually-hidden/visually-hidden.styles.js +27 -0
  39. package/dist/components/content/visually-hidden/visually-hidden.styles.js.map +1 -0
  40. package/dist/components/content/visually-hidden/visually-hidden.template.d.ts +3 -0
  41. package/dist/components/content/visually-hidden/visually-hidden.template.d.ts.map +1 -0
  42. package/dist/components/content/visually-hidden/visually-hidden.template.js +7 -0
  43. package/dist/components/content/visually-hidden/visually-hidden.template.js.map +1 -0
  44. package/dist/components/{dist-CH9m014O.js → dist-B2QcygzG.js} +1 -1
  45. package/dist/components/{dist-DMHTTJRJ.js → dist-BB5mlo7D.js} +2 -2
  46. package/dist/components/{dist-C3uWRipu.js → dist-Bo5Jeyfn.js} +1 -1
  47. package/dist/components/{dist-CpW8MF-L.js → dist-Bud_7w5g.js} +232 -214
  48. package/dist/components/{dist-CvL6_ezZ.js → dist-CA0yDFIt.js} +2 -2
  49. package/dist/components/{dist-DV6Mp5N1.js → dist-CaxHkqR2.js} +3 -3
  50. package/dist/components/{dist-BWRYv3Mp.js → dist-Ch3gNAuT.js} +1 -1
  51. package/dist/components/{dist-PlhQXXtE.js → dist-DbNhCpS5.js} +1 -1
  52. package/dist/components/{dist-DTOshgo1.js → dist-DkqAbJH8.js} +1 -1
  53. package/dist/components/{dist-BWEAw34D.js → dist-DnZmcpbQ.js} +1 -1
  54. package/dist/components/{dist-Bi4EHsFY.js → dist-iC2RTM0V.js} +2 -2
  55. package/dist/components/forms/validation-list/validation-list.d.ts +19 -9
  56. package/dist/components/forms/validation-list/validation-list.d.ts.map +1 -1
  57. package/dist/components/forms/validation-list/validation-list.js +38 -12
  58. package/dist/components/forms/validation-list/validation-list.js.map +1 -1
  59. package/dist/components/{icon-button-NN0SrgS3.js → icon-button-CJIikwyu.js} +15 -2
  60. package/dist/components/index.d.ts +1 -0
  61. package/dist/components/index.d.ts.map +1 -1
  62. package/dist/components/index.js +1 -0
  63. package/dist/components/index.js.map +1 -1
  64. package/dist/components/inputs/segmented-control/segmented-control.d.ts +1 -1
  65. package/dist/components/inputs/segmented-control/segmented-control.d.ts.map +1 -1
  66. package/dist/components/inputs/segmented-control/segmented-control.js +1 -4
  67. package/dist/components/inputs/segmented-control/segmented-control.js.map +1 -1
  68. package/dist/components/inputs/toggle-button/toggle-button.d.ts +1 -1
  69. package/dist/components/inputs/toggle-button/toggle-button.d.ts.map +1 -1
  70. package/dist/components/inputs/toggle-button/toggle-button.js +1 -4
  71. package/dist/components/inputs/toggle-button/toggle-button.js.map +1 -1
  72. package/dist/components/layout/card/card.d.ts +12 -1
  73. package/dist/components/layout/card/card.d.ts.map +1 -1
  74. package/dist/components/layout/card/card.js +29 -2
  75. package/dist/components/layout/card/card.js.map +1 -1
  76. package/dist/components/layout/card/card.styles.js +2 -2
  77. package/dist/components/layout/page-sections/sidebar-section/sidebar-section.styles.d.ts.map +1 -1
  78. package/dist/components/layout/page-sections/sidebar-section/sidebar-section.styles.js +3 -1
  79. package/dist/components/layout/page-sections/sidebar-section/sidebar-section.styles.js.map +1 -1
  80. package/dist/components/layout/page-sections/sidebar-section/sidebar-section.template.js +6 -6
  81. package/dist/components/layout/page-sections/sidebar-section/sidebar-section.template.js.map +1 -1
  82. package/dist/components/layout/popover/popover.styles.d.ts.map +1 -1
  83. package/dist/components/layout/popover/popover.styles.js +4 -0
  84. package/dist/components/layout/popover/popover.styles.js.map +1 -1
  85. package/dist/components/lists-and-tables/list/list.d.ts +6 -1
  86. package/dist/components/lists-and-tables/list/list.d.ts.map +1 -1
  87. package/dist/components/lists-and-tables/list/list.js +7 -2
  88. package/dist/components/lists-and-tables/list/list.js.map +1 -1
  89. package/dist/components/lists-and-tables/list-item/list-item.d.ts +16 -1
  90. package/dist/components/lists-and-tables/list-item/list-item.d.ts.map +1 -1
  91. package/dist/components/lists-and-tables/list-item/list-item.js +35 -4
  92. package/dist/components/lists-and-tables/list-item/list-item.js.map +1 -1
  93. package/dist/components/lists-and-tables/list-item/list-item.template.d.ts +1 -1
  94. package/dist/components/lists-and-tables/list-item/list-item.template.d.ts.map +1 -1
  95. package/dist/components/lists-and-tables/list-item/list-item.template.js +7 -6
  96. package/dist/components/lists-and-tables/list-item/list-item.template.js.map +1 -1
  97. package/dist/components/navigation/document-tab-bar/document-tab-bar.d.ts +44 -1
  98. package/dist/components/navigation/document-tab-bar/document-tab-bar.d.ts.map +1 -1
  99. package/dist/components/navigation/document-tab-bar/document-tab-bar.js +132 -3
  100. package/dist/components/navigation/document-tab-bar/document-tab-bar.js.map +1 -1
  101. package/dist/components/navigation/document-tab-bar/document-tab-bar.styles.d.ts.map +1 -1
  102. package/dist/components/navigation/document-tab-bar/document-tab-bar.styles.js +21 -2
  103. package/dist/components/navigation/document-tab-bar/document-tab-bar.styles.js.map +1 -1
  104. package/dist/components/navigation/document-tab-bar/document-tab-bar.template.js +1 -1
  105. package/dist/components/navigation/document-tab-bar/document-tab-bar.template.js.map +1 -1
  106. package/dist/components/navigation/menu-bar/menu-bar.d.ts.map +1 -1
  107. package/dist/components/navigation/menu-bar/menu-bar.js +19 -2
  108. package/dist/components/navigation/menu-bar/menu-bar.js.map +1 -1
  109. package/dist/components/navigation/menu-bar-item/menu-bar-item.d.ts +6 -3
  110. package/dist/components/navigation/menu-bar-item/menu-bar-item.d.ts.map +1 -1
  111. package/dist/components/navigation/menu-bar-item/menu-bar-item.js +11 -3
  112. package/dist/components/navigation/menu-bar-item/menu-bar-item.js.map +1 -1
  113. package/dist/components/navigation/menu-bar-item/menu-bar-item.template.d.ts +1 -0
  114. package/dist/components/navigation/menu-bar-item/menu-bar-item.template.d.ts.map +1 -1
  115. package/dist/components/navigation/menu-bar-item/menu-bar-item.template.js +53 -32
  116. package/dist/components/navigation/menu-bar-item/menu-bar-item.template.js.map +1 -1
  117. package/dist/components/navigation/skip-link/skip-link.d.ts +58 -5
  118. package/dist/components/navigation/skip-link/skip-link.d.ts.map +1 -1
  119. package/dist/components/navigation/skip-link/skip-link.js +148 -14
  120. package/dist/components/navigation/skip-link/skip-link.js.map +1 -1
  121. package/dist/components/navigation/skip-link/skip-link.template.d.ts.map +1 -1
  122. package/dist/components/navigation/skip-link/skip-link.template.js +1 -0
  123. package/dist/components/navigation/skip-link/skip-link.template.js.map +1 -1
  124. package/dist/components/navigation/tab-bar/tab-bar.d.ts +70 -1
  125. package/dist/components/navigation/tab-bar/tab-bar.d.ts.map +1 -1
  126. package/dist/components/navigation/tab-bar/tab-bar.i18n.d.ts +5 -0
  127. package/dist/components/navigation/tab-bar/tab-bar.i18n.d.ts.map +1 -0
  128. package/dist/components/navigation/tab-bar/tab-bar.i18n.js +4 -0
  129. package/dist/components/navigation/tab-bar/tab-bar.i18n.js.map +1 -0
  130. package/dist/components/navigation/tab-bar/tab-bar.js +213 -22
  131. package/dist/components/navigation/tab-bar/tab-bar.js.map +1 -1
  132. package/dist/components/navigation/tab-bar/tab-bar.styles.d.ts.map +1 -1
  133. package/dist/components/navigation/tab-bar/tab-bar.styles.js +68 -3
  134. package/dist/components/navigation/tab-bar/tab-bar.styles.js.map +1 -1
  135. package/dist/components/navigation/tab-bar/tab-bar.template.d.ts.map +1 -1
  136. package/dist/components/navigation/tab-bar/tab-bar.template.js +36 -5
  137. package/dist/components/navigation/tab-bar/tab-bar.template.js.map +1 -1
  138. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.d.ts +7 -0
  139. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.d.ts.map +1 -1
  140. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.js +16 -0
  141. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.js.map +1 -1
  142. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.styles.d.ts.map +1 -1
  143. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.styles.js +7 -0
  144. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.styles.js.map +1 -1
  145. package/dist/components/navigation/top-title-bar/top-title-bar.d.ts +8 -1
  146. package/dist/components/navigation/top-title-bar/top-title-bar.d.ts.map +1 -1
  147. package/dist/components/navigation/top-title-bar/top-title-bar.js +8 -1
  148. package/dist/components/navigation/top-title-bar/top-title-bar.js.map +1 -1
  149. package/dist/components/status-and-feedback/notification/notification.d.ts +62 -1
  150. package/dist/components/status-and-feedback/notification/notification.d.ts.map +1 -1
  151. package/dist/components/status-and-feedback/notification/notification.js +86 -2
  152. package/dist/components/status-and-feedback/notification/notification.js.map +1 -1
  153. package/dist/components/status-and-feedback/notification/notifications-area.d.ts +6 -0
  154. package/dist/components/status-and-feedback/notification/notifications-area.d.ts.map +1 -1
  155. package/dist/components/status-and-feedback/notification/notifications-area.js +16 -0
  156. package/dist/components/status-and-feedback/notification/notifications-area.js.map +1 -1
  157. package/dist/nldd.min.js +799 -612
  158. package/dist/translations/en-US.d.ts.map +1 -1
  159. package/dist/translations/en-US.js +1 -0
  160. package/dist/translations/en-US.js.map +1 -1
  161. package/dist/translations/fy.d.ts.map +1 -1
  162. package/dist/translations/fy.js +1 -0
  163. package/dist/translations/fy.js.map +1 -1
  164. package/dist/translations/nl.generated.d.ts +1 -0
  165. package/dist/translations/nl.generated.d.ts.map +1 -1
  166. package/dist/translations/nl.generated.js +2 -0
  167. package/dist/translations/nl.generated.js.map +1 -1
  168. package/dist/translations/pap-AW.d.ts.map +1 -1
  169. package/dist/translations/pap-AW.js +1 -0
  170. package/dist/translations/pap-AW.js.map +1 -1
  171. package/dist/translations/pap-CW.d.ts.map +1 -1
  172. package/dist/translations/pap-CW.js +1 -0
  173. package/dist/translations/pap-CW.js.map +1 -1
  174. package/dist/types/vue.d.ts +40 -26
  175. package/package.json +6 -2
@@ -3,14 +3,14 @@ import { n as slottedReset, t as inheritedTextReset } from "./shadow-resets-CPa5
3
3
  import { i as linkRel, n as setTranslations, r as translate, t as withTranslations } from "./with-translations-C8_0-9y8.js";
4
4
  import { t as __decorate } from "./decorate-CO88j7Lc.js";
5
5
  import { t as reflectNonDefault } from "./reflect-non-default-OLaK60rT.js";
6
- import { i as PopupAnchorController, n as NLDDTooltip, r as NLDDActivityIndicator, t as NLDDIconButton } from "./icon-button-NN0SrgS3.js";
6
+ import { i as PopupAnchorController, n as NLDDTooltip, r as NLDDActivityIndicator, t as NLDDIconButton } from "./icon-button-CJIikwyu.js";
7
7
  import { t as NLDDIcon } from "./icon-D_ZGezHx.js";
8
8
  import { n as isPointerMode, r as isTouchMode, t as isKeyboardMode } from "./input-modality-DhTeUxKi.js";
9
9
  import { t as breakpoints } from "./breakpoints-CkxsiRgH.js";
10
10
  import { t as VisibilityMixin } from "./visibility-mixin-Crbt8PFP.js";
11
- import { $ as layer, A as syntaxTree, B as Tree, C as indentNodeProp, Ct as countColumn, D as matchBrackets, E as languageDataProp, F as NodeProp, G as RectangleMarker, H as Decoration, I as NodeSet, J as drawSelection, K as ViewPlugin, L as NodeType, M as styleTags, N as tags, Q as keymap, S as getIndentation, St as combineConfig, T as indentUnit, U as Direction, V as parseMixed, W as EditorView, X as getDrawSelectionConfig, Y as dropCursor, _t as StateField, a as HighlightStyle, at as Annotation, b as foldService, c as Language, ct as Compartment, d as ParseContext, dt as Facet, et as lineNumbers, f as StreamLanguage, gt as StateEffect, h as defineLanguageFacet, it as tooltips, j as Tag, k as syntaxHighlighting, l as LanguageDescription, lt as EditorSelection, mt as RangeSetBuilder, nt as placeholder, o as IndentContext, ot as ChangeDesc, pt as Prec, q as WidgetType, rt as showTooltip, st as ChangeSet, u as LanguageSupport, ut as EditorState, vt as Text, w as indentString, wt as findClusterBreak, x as getIndentUnit, y as foldNodeProp, yt as Transaction, z as Parser } from "./dist-CpW8MF-L.js";
12
- import { i as completionStatus, n as autocompletion, s as startCompletion, t as CompletionContext } from "./dist-DTOshgo1.js";
13
- import { n as html$2, r as htmlCompletionSource } from "./dist-DV6Mp5N1.js";
11
+ import { $ as layer, A as syntaxTree, B as Tree, C as indentNodeProp, Ct as countColumn, D as matchBrackets, E as languageDataProp, F as NodeProp, G as RectangleMarker, H as Decoration, I as NodeSet, J as drawSelection, K as ViewPlugin, L as NodeType, M as styleTags, N as tags, Q as keymap, S as getIndentation, St as combineConfig, T as indentUnit, U as Direction, V as parseMixed, W as EditorView, X as getDrawSelectionConfig, Y as dropCursor, _t as StateField, a as HighlightStyle, at as Annotation, b as foldService, c as Language, ct as Compartment, d as ParseContext, dt as Facet, et as lineNumbers, f as StreamLanguage, gt as StateEffect, h as defineLanguageFacet, it as tooltips, j as Tag, k as syntaxHighlighting, l as LanguageDescription, lt as EditorSelection, mt as RangeSetBuilder, nt as placeholder, o as IndentContext, ot as ChangeDesc, pt as Prec, q as WidgetType, rt as showTooltip, st as ChangeSet, u as LanguageSupport, ut as EditorState, vt as Text, w as indentString, wt as findClusterBreak, x as getIndentUnit, y as foldNodeProp, yt as Transaction, z as Parser } from "./dist-Bud_7w5g.js";
12
+ import { i as completionStatus, n as autocompletion, s as startCompletion, t as CompletionContext } from "./dist-DkqAbJH8.js";
13
+ import { n as html$2, r as htmlCompletionSource } from "./dist-CaxHkqR2.js";
14
14
  import { LitElement, css, html, nothing, svg, unsafeCSS } from "lit";
15
15
  import { customElement, property, query, state } from "lit/decorators.js";
16
16
  import { unsafeHTML } from "lit/directives/unsafe-html.js";
@@ -645,7 +645,7 @@ function renderContent(component) {
645
645
  ` : nothing}
646
646
  `;
647
647
  }
648
- function template$23(helpers) {
648
+ function template$24(helpers) {
649
649
  const content = renderContent(this);
650
650
  const buttonClass = ["button", this.supportingText ? "has-supporting-text" : ""].filter(Boolean).join(" ");
651
651
  const ariaExpanded = this.expandable || !!this.popupType ? String(this.expanded) : this.expanded ? "true" : nothing;
@@ -937,7 +937,7 @@ var _NLDDButton = class NLDDButton extends DescribedBy(withTranslations(LitEleme
937
937
  return this.shadowRoot?.querySelector("button, a") ?? null;
938
938
  }
939
939
  render() {
940
- return template$23.call(this, { handleClick: this._handleClick.bind(this) });
940
+ return template$24.call(this, { handleClick: this._handleClick.bind(this) });
941
941
  }
942
942
  };
943
943
  var NLDDButton = (_NLDDButton.styles = buttonStyles, _NLDDButton.formAssociated = true, _NLDDButton);
@@ -1170,7 +1170,7 @@ var splitButtonStyles = css`
1170
1170
  `;
1171
1171
  //#endregion
1172
1172
  //#region src/components/actions/split-button/split-button.template.ts
1173
- function template$22() {
1173
+ function template$23() {
1174
1174
  return html`
1175
1175
  <div class="split-button">
1176
1176
  <nldd-button
@@ -1640,7 +1640,8 @@ function sanitizeUrl(url) {
1640
1640
  //#region src/components/actions/menu/menu.template.ts
1641
1641
  var menuRoleMap = {
1642
1642
  menu: "menu",
1643
- listbox: "listbox"
1643
+ listbox: "listbox",
1644
+ navigation: "list"
1644
1645
  };
1645
1646
  var itemRoleMap = {
1646
1647
  button: {
@@ -1740,7 +1741,7 @@ function menuTemplate(isEmpty, variant) {
1740
1741
  function menuItemTemplate(variant = null) {
1741
1742
  const hasCheckState = this.type !== "button" && variant === "menu";
1742
1743
  const hasCheckColumn = hasCheckState || this.checkColumn && variant === "menu";
1743
- const role = variant ? itemRoleMap[this.type][variant] : nothing;
1744
+ const role = variant && variant !== "navigation" ? itemRoleMap[this.type][variant] : nothing;
1744
1745
  const hasSubmenu = this._hasSubmenu;
1745
1746
  const safeHref = sanitizeUrl(this.href) ?? "";
1746
1747
  const asLink = !!safeHref && this.type === "button" && !hasSubmenu && !this.disabled;
@@ -1825,7 +1826,7 @@ function menuItemTemplate(variant = null) {
1825
1826
  ?disabled=${this.disabled}
1826
1827
  aria-checked=${hasCheckState ? String(this.selected) : nothing}
1827
1828
  aria-selected=${variant === "listbox" ? String(this.selected) : nothing}
1828
- aria-haspopup=${hasSubmenu ? "menu" : nothing}
1829
+ aria-haspopup=${hasSubmenu && variant !== "navigation" ? "menu" : nothing}
1829
1830
  aria-expanded=${hasSubmenu ? String(this._submenuOpen) : nothing}
1830
1831
  aria-controls=${hasSubmenu && this._submenuEl?.id ? this._submenuEl.id : nothing}
1831
1832
  .popoverTargetElement=${this._submenuEl}
@@ -1845,9 +1846,9 @@ function menuItemTemplate(variant = null) {
1845
1846
  <slot></slot>
1846
1847
  `;
1847
1848
  }
1848
- function menuDividerTemplate() {
1849
+ function menuDividerTemplate(variant = null) {
1849
1850
  return html`<div class="menu__divider"
1850
- role="separator"
1851
+ role=${variant === "navigation" ? "none" : "separator"}
1851
1852
  ></div>`;
1852
1853
  }
1853
1854
  function menuGroupTemplate(component) {
@@ -1858,7 +1859,7 @@ function menuGroupTemplate(component) {
1858
1859
  aria-hidden="true"
1859
1860
  >${component.text}</div>
1860
1861
  <div class="menu__group-items"
1861
- role="group"
1862
+ role=${component.menuVariant === "navigation" ? "list" : "group"}
1862
1863
  aria-labelledby=${component._titleId}
1863
1864
  >
1864
1865
  <slot></slot>
@@ -1991,7 +1992,7 @@ var iconCellStyles = css`
1991
1992
  `;
1992
1993
  //#endregion
1993
1994
  //#region src/components/lists-and-tables/cells/icon-cell/icon-cell.template.ts
1994
- function template$21() {
1995
+ function template$22() {
1995
1996
  return html`
1996
1997
  <span
1997
1998
  part="icon"
@@ -2030,7 +2031,7 @@ var _NLDDIconCell = class NLDDIconCell extends VisibilityMixin(LitElement, "cell
2030
2031
  this.icon = "";
2031
2032
  }
2032
2033
  render() {
2033
- return template$21.call(this);
2034
+ return template$22.call(this);
2034
2035
  }
2035
2036
  };
2036
2037
  var NLDDIconCell = (_NLDDIconCell.styles = iconCellStyles, _NLDDIconCell);
@@ -2375,7 +2376,7 @@ function renderQueryMark(text, query, mode = "predictive") {
2375
2376
  }
2376
2377
  //#endregion
2377
2378
  //#region src/components/lists-and-tables/cells/text-cell/text-cell.template.ts
2378
- function template$20() {
2379
+ function template$21() {
2379
2380
  return html`
2380
2381
  <p
2381
2382
  class="text-cell__overline"
@@ -2515,7 +2516,7 @@ var _NLDDTextCell = class NLDDTextCell extends VisibilityMixin(LitElement, "cell
2515
2516
  else this.style.removeProperty("--_text-cell-min-height");
2516
2517
  }
2517
2518
  render() {
2518
- return template$20.call(this);
2519
+ return template$21.call(this);
2519
2520
  }
2520
2521
  };
2521
2522
  var NLDDTextCell = (_NLDDTextCell.styles = [textCellStyles], _NLDDTextCell);
@@ -2725,7 +2726,7 @@ var keyboardShortcutStyles = css`
2725
2726
  `;
2726
2727
  //#endregion
2727
2728
  //#region src/components/content/keyboard-shortcut/keyboard-shortcut.template.ts
2728
- function template$19(component) {
2729
+ function template$20(component) {
2729
2730
  const keys = component._parsedKeys;
2730
2731
  if (keys.length === 0) return html`
2731
2732
  <kbd class="keyboard-shortcut">
@@ -2838,7 +2839,7 @@ var _NLDDKeyboardShortcut = class NLDDKeyboardShortcut extends LitElement {
2838
2839
  return spec.replace(/\+\+\+/g, `+${MARKER}+`).split("+").map((k) => k.trim().replace(new RegExp(MARKER, "g"), "+")).filter(Boolean);
2839
2840
  }
2840
2841
  render() {
2841
- return template$19(this);
2842
+ return template$20(this);
2842
2843
  }
2843
2844
  };
2844
2845
  var NLDDKeyboardShortcut = (_NLDDKeyboardShortcut.styles = keyboardShortcutStyles, _NLDDKeyboardShortcut);
@@ -3190,7 +3191,7 @@ var buttonGroupStyles = css`
3190
3191
  `;
3191
3192
  //#endregion
3192
3193
  //#region src/components/actions/button-group/button-group.template.ts
3193
- function template$18() {
3194
+ function template$19() {
3194
3195
  return html`
3195
3196
  <div class="button-group">
3196
3197
  <slot @slotchange=${this.handleSlotChange}></slot>
@@ -3283,7 +3284,7 @@ var _NLDDButtonGroup = class NLDDButtonGroup extends LitElement {
3283
3284
  this._collapseVerdict = 0;
3284
3285
  }
3285
3286
  render() {
3286
- return template$18.call(this);
3287
+ return template$19.call(this);
3287
3288
  }
3288
3289
  };
3289
3290
  var NLDDButtonGroup = (_NLDDButtonGroup.styles = buttonGroupStyles, _NLDDButtonGroup);
@@ -3416,18 +3417,30 @@ var _NLDDMenuDivider;
3416
3417
  var _NLDDMenuGroup;
3417
3418
  var _NLDDMenuItem;
3418
3419
  var _NLDDMenu;
3420
+ /** Makes `host` a list item while its menu is a navigation menu, and takes
3421
+ * that back when it is not. A `listitem` the consumer set by hand on an item
3422
+ * goes too when the variant changes back; nothing else uses that role here. */
3423
+ function syncListItemRole(host, variant) {
3424
+ if (variant === "navigation") host.setAttribute("role", "listitem");
3425
+ else if (host.getAttribute("role") === "listitem") host.removeAttribute("role");
3426
+ }
3419
3427
  /**
3420
3428
  * A horizontal rule between groups of items in an `nldd-menu`.
3421
3429
  *
3422
3430
  * @element nldd-menu-divider
3423
3431
  */
3424
3432
  var NLDDMenuDivider = class extends LitElement {
3433
+ constructor(..._args) {
3434
+ super(..._args);
3435
+ this.menuVariant = null;
3436
+ }
3425
3437
  render() {
3426
- return menuDividerTemplate();
3438
+ return menuDividerTemplate(this.menuVariant);
3427
3439
  }
3428
3440
  };
3429
3441
  _NLDDMenuDivider = NLDDMenuDivider;
3430
3442
  _NLDDMenuDivider.styles = menuDividerStyles;
3443
+ __decorate([state()], NLDDMenuDivider.prototype, "menuVariant", void 0);
3431
3444
  if (!customElements.get("nldd-menu-divider")) customElements.define("nldd-menu-divider", NLDDMenuDivider);
3432
3445
  /**
3433
3446
  * A labeled group of menu items inside an nldd-menu. Wraps its slotted
@@ -3452,10 +3465,14 @@ if (!customElements.get("nldd-menu-divider")) customElements.define("nldd-menu-d
3452
3465
  * @slot - nldd-menu-item children (the items belonging to this group).
3453
3466
  */
3454
3467
  var NLDDMenuGroup = class NLDDMenuGroup extends LitElement {
3455
- constructor(..._args) {
3456
- super(..._args);
3468
+ constructor(..._args2) {
3469
+ super(..._args2);
3457
3470
  this.text = "";
3458
3471
  this._titleId = `nldd-menu-group-title-${NLDDMenuGroup._idCounter++}`;
3472
+ this.menuVariant = null;
3473
+ }
3474
+ updated(changed) {
3475
+ if (changed.has("menuVariant")) syncListItemRole(this, this.menuVariant);
3459
3476
  }
3460
3477
  render() {
3461
3478
  return menuGroupTemplate(this);
@@ -3468,6 +3485,7 @@ __decorate([property({
3468
3485
  reflect: true,
3469
3486
  converter: reflectNonDefault("")
3470
3487
  })], NLDDMenuGroup.prototype, "text", void 0);
3488
+ __decorate([state()], NLDDMenuGroup.prototype, "menuVariant", void 0);
3471
3489
  if (!customElements.get("nldd-menu-group")) customElements.define("nldd-menu-group", NLDDMenuGroup);
3472
3490
  /**
3473
3491
  * A single item within an nldd-menu.
@@ -3492,8 +3510,8 @@ if (!customElements.get("nldd-menu-group")) customElements.define("nldd-menu-gro
3492
3510
  * @fires select - Fired when the item is clicked and not disabled.
3493
3511
  */
3494
3512
  var NLDDMenuItem = class NLDDMenuItem extends LitElement {
3495
- constructor(..._args2) {
3496
- super(..._args2);
3513
+ constructor(..._args3) {
3514
+ super(..._args3);
3497
3515
  this.destructive = false;
3498
3516
  this.text = "";
3499
3517
  this.details = "";
@@ -3548,6 +3566,7 @@ var NLDDMenuItem = class NLDDMenuItem extends LitElement {
3548
3566
  this._cachedSubmenuEl = this.querySelector(":scope > nldd-menu");
3549
3567
  }
3550
3568
  updated(changedProperties) {
3569
+ if (changedProperties.has("menuVariant")) syncListItemRole(this, this.menuVariant);
3551
3570
  if (changedProperties.has("type") && changedProperties.get("type") !== void 0 && this.menuVariant) this.closest("nldd-menu")?._claimItems();
3552
3571
  }
3553
3572
  firstUpdated() {
@@ -3685,6 +3704,7 @@ var defaultFilterFn = (query, item) => {
3685
3704
  *
3686
3705
  * @element nldd-menu
3687
3706
  *
3707
+ * @attr {'menu'|'listbox'|'navigation'} variant - What the menu is (default 'menu'). `menu` is a menu of actions: `role="menu"` with menu items, for things you do. `listbox` is the popup of a combobox: `role="listbox"` with options, focus stays in the field. `navigation` is a submenu in a site navigation: a list of links (`role="list"`, each item a list item around a real link), because a screen reader treats a menu as an application and reads a list of links as what it is. Every item takes an `href`. Tab reaches each link, the arrow keys, Home and End move between them, Escape closes and returns focus to the trigger, and the menu closes when focus leaves it. The trigger says `aria-expanded` and promises no menu. Checkbox and radio items, shortcuts and `filter()` belong to actions and warn in development here. A submenu of a navigation menu is a navigation menu too. The variant sets `role="listitem"` on its items and groups, and takes it off again when it changes back, also where you had set that role yourself.
3688
3708
  * @attr {string} width - Explicit width, pinned exactly. Without it the menu sizes to its content between a minimum and a viewport-aware maximum (min(100vw - inset, 640px)).
3689
3709
  * @attr {string} anchor - ID of the anchor element. Positions the menu against it AND makes it a toggle: the menu listens on document click and opens/closes itself when the click lands on the anchor. Use this for a menu hung off a button. For a menu you open yourself (a type-ahead under a text field, say), set the `anchorElement` property instead — same positioning, no toggle.
3690
3710
  * @attr {string} placement - Floating UI placement. Default: 'bottom-start'.
@@ -3700,8 +3720,8 @@ var defaultFilterFn = (query, item) => {
3700
3720
  * @slot empty - Shown when no items are visible. Defaults to `nldd-inline-dialog` driven by `empty-text` / `empty-supporting-text`. Slot content overrides the default dialog entirely.
3701
3721
  */
3702
3722
  var NLDDMenu = class NLDDMenu extends LitElement {
3703
- constructor(..._args3) {
3704
- super(..._args3);
3723
+ constructor(..._args4) {
3724
+ super(..._args4);
3705
3725
  this.variant = "menu";
3706
3726
  this.width = "";
3707
3727
  this.anchor = "";
@@ -3737,6 +3757,7 @@ var NLDDMenu = class NLDDMenu extends LitElement {
3737
3757
  this._isOpen = reallyOpen;
3738
3758
  this._syncAnchorPopupState(reallyOpen);
3739
3759
  };
3760
+ this._seededPopupType = null;
3740
3761
  this._handleDocumentClick = (event) => {
3741
3762
  if (this.anchorElement) return;
3742
3763
  const collapsedByGesture = this._collapsedByPointerGesture;
@@ -3972,6 +3993,13 @@ var NLDDMenu = class NLDDMenu extends LitElement {
3972
3993
  this._teardownOutsideTap();
3973
3994
  };
3974
3995
  this._handleKeydown = (event) => {
3996
+ if (event.key === "Tab" && this.variant === "navigation") {
3997
+ this._tabbing = true;
3998
+ clearTimeout(this._tabbingTimer);
3999
+ this._tabbingTimer = setTimeout(() => {
4000
+ this._tabbing = false;
4001
+ });
4002
+ }
3975
4003
  const items = this._getVisibleItems();
3976
4004
  if (items.length === 0) return;
3977
4005
  const focusedDescendant = this.querySelector("nldd-menu-item[data-focused]");
@@ -4025,22 +4053,39 @@ var NLDDMenu = class NLDDMenu extends LitElement {
4025
4053
  this.hidePopover();
4026
4054
  (this._isSubmenu ? this._parentItem : this._getAnchorEl())?.focus();
4027
4055
  break;
4028
- default: if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) this._handleTypeahead(event, items, index);
4056
+ default: if (this.variant !== "navigation" && event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) this._handleTypeahead(event, items, index);
4029
4057
  }
4030
4058
  };
4059
+ this._handleFocusOut = (event) => {
4060
+ if (this.variant !== "navigation") return;
4061
+ if (!this.matches(":popover-open")) return;
4062
+ const next = event.relatedTarget;
4063
+ if (next ? this.contains(next) || this._isAnchor(next) : !this._tabbing) return;
4064
+ this.hidePopover();
4065
+ };
4066
+ this._tabbing = false;
4031
4067
  this._typeaheadBuffer = "";
4032
4068
  this._typeaheadTimer = null;
4033
4069
  this._claimItems = () => {
4070
+ if (this.variant === "navigation") Array.from(this.querySelectorAll("nldd-menu")).forEach((menu) => {
4071
+ menu.variant = "navigation";
4072
+ });
4034
4073
  const items = Array.from(this.querySelectorAll("nldd-menu-item"));
4035
4074
  items.forEach((item) => {
4036
4075
  item.menuVariant = this.variant;
4037
4076
  });
4077
+ Array.from(this.querySelectorAll("nldd-menu-divider, nldd-menu-group")).forEach((part) => {
4078
+ part.menuVariant = this.variant;
4079
+ });
4080
+ this._warnOnActionsInNavigation(items);
4038
4081
  const own = items.filter((item) => item.closest("nldd-menu") === this);
4039
4082
  const checkColumn = this.variant === "menu" && own.some((item) => item.type !== "button");
4040
4083
  own.forEach((item) => {
4041
4084
  item.checkColumn = checkColumn;
4042
4085
  });
4043
4086
  };
4087
+ this._warnedActionsInNavigation = false;
4088
+ this._warnedFilterInNavigation = false;
4044
4089
  this._handleBeforeToggle = (event) => {
4045
4090
  if (event.newState === "open") this.removeAttribute("positioned");
4046
4091
  };
@@ -4142,7 +4187,10 @@ var NLDDMenu = class NLDDMenu extends LitElement {
4142
4187
  if (this.maxItems > 0) this.style.setProperty("--_menu-max-items", String(this.maxItems));
4143
4188
  else this.style.removeProperty("--_menu-max-items");
4144
4189
  }
4145
- if (changedProperties.has("variant")) this._claimItems();
4190
+ if (changedProperties.has("variant")) {
4191
+ this._claimItems();
4192
+ if (changedProperties.get("variant") !== void 0) this._syncAnchorPopupState(this._isOpen);
4193
+ }
4146
4194
  if (changedProperties.has("anchor") || changedProperties.has("anchorElement")) {
4147
4195
  this._previousAnchorForResync?.removeEventListener("pointerdown", this._resyncAnchorFromPopoverState, true);
4148
4196
  const anchor = this._getAnchorEl();
@@ -4175,7 +4223,11 @@ var NLDDMenu = class NLDDMenu extends LitElement {
4175
4223
  const anchor = this._getAnchorEl();
4176
4224
  if (!anchor) return;
4177
4225
  if ("expanded" in anchor) anchor.expanded = isOpen;
4178
- if ("popupType" in anchor && !anchor.popupType) anchor.popupType = this.variant === "listbox" ? "listbox" : "menu";
4226
+ if ("popupType" in anchor && (!anchor.popupType || anchor.popupType === this._seededPopupType)) {
4227
+ const wanted = this.variant === "navigation" ? "" : this.variant === "listbox" ? "listbox" : "menu";
4228
+ anchor.popupType = wanted;
4229
+ this._seededPopupType = wanted || null;
4230
+ }
4179
4231
  if ("popoverTargetAction" in anchor) anchor.popoverTargetAction = isOpen ? "hide" : "show";
4180
4232
  }
4181
4233
  /**
@@ -4491,6 +4543,7 @@ var NLDDMenu = class NLDDMenu extends LitElement {
4491
4543
  this.addEventListener("beforetoggle", this._handleBeforeToggle);
4492
4544
  this.addEventListener("toggle", this._handleToggle);
4493
4545
  this.addEventListener("keydown", this._handleKeydown);
4546
+ this.addEventListener("focusout", this._handleFocusOut);
4494
4547
  this.addEventListener("mouseenter", this._handleMenuItemMouseenter, true);
4495
4548
  this.addEventListener("mouseleave", this._handleMouseleave);
4496
4549
  this.addEventListener("menu-item-focused", this._handleMenuItemFocused);
@@ -4518,6 +4571,9 @@ var NLDDMenu = class NLDDMenu extends LitElement {
4518
4571
  this._previousAnchorForResync?.removeEventListener("pointerdown", this._resyncAnchorFromPopoverState, true);
4519
4572
  this._previousAnchorForResync = null;
4520
4573
  this.removeEventListener("keydown", this._handleKeydown);
4574
+ this.removeEventListener("focusout", this._handleFocusOut);
4575
+ clearTimeout(this._tabbingTimer);
4576
+ this._tabbing = false;
4521
4577
  this.removeEventListener("mouseenter", this._handleMenuItemMouseenter, true);
4522
4578
  this.removeEventListener("mouseleave", this._handleMouseleave);
4523
4579
  this.removeEventListener("menu-item-focused", this._handleMenuItemFocused);
@@ -4710,6 +4766,17 @@ var NLDDMenu = class NLDDMenu extends LitElement {
4710
4766
  });
4711
4767
  }
4712
4768
  /**
4769
+ * Whether focus went to the control that opens this menu. Closing here
4770
+ * would hand the click that follows a closed menu, and it would open it
4771
+ * again; the toggle on the anchor does the closing. The node arrives
4772
+ * retargeted, so an anchor inside a shadow root shows up as its host.
4773
+ */
4774
+ _isAnchor(node) {
4775
+ const anchor = this._getAnchorEl();
4776
+ if (!anchor) return false;
4777
+ return node === anchor || anchor.contains(node) || anchor.getRootNode().host === node;
4778
+ }
4779
+ /**
4713
4780
  * ARIA APG typeahead: characters typed within 500ms accumulate into a
4714
4781
  * buffer; the menu jumps to the first item whose text starts with the
4715
4782
  * buffer (case-insensitive).
@@ -4738,6 +4805,8 @@ var NLDDMenu = class NLDDMenu extends LitElement {
4738
4805
  }
4739
4806
  }
4740
4807
  }
4808
+ /** Checkable items and shortcuts belong to actions, not to a list of links. */
4809
+ _warnOnActionsInNavigation(items) {}
4741
4810
  render() {
4742
4811
  return menuTemplate.call(this, this._isEmpty, this.variant);
4743
4812
  }
@@ -4894,7 +4963,7 @@ var _NLDDSplitButton = class NLDDSplitButton extends LitElement {
4894
4963
  }
4895
4964
  }
4896
4965
  render() {
4897
- return template$22.call(this);
4966
+ return template$23.call(this);
4898
4967
  }
4899
4968
  };
4900
4969
  var NLDDSplitButton = (_NLDDSplitButton.styles = splitButtonStyles, _NLDDSplitButton);
@@ -5054,7 +5123,7 @@ var buttonBarStyles = css`
5054
5123
  `;
5055
5124
  //#endregion
5056
5125
  //#region src/components/actions/button-bar/button-bar.template.ts
5057
- function template$17() {
5126
+ function template$18() {
5058
5127
  return html`
5059
5128
  <div class="button-bar"
5060
5129
  part="bar"
@@ -5195,7 +5264,7 @@ var NLDDButtonBar = (_NLDDButtonBar = class NLDDButtonBar extends LitElement {
5195
5264
  }
5196
5265
  _warnToggleButton() {}
5197
5266
  render() {
5198
- return template$17.call(this);
5267
+ return template$18.call(this);
5199
5268
  }
5200
5269
  }, _NLDDButtonBar.styles = buttonBarStyles, _NLDDButtonBar);
5201
5270
  __decorate([property({
@@ -5361,6 +5430,8 @@ var toolbarItemStyles = css`
5361
5430
  --_toolbar-item-max-width: none;
5362
5431
  --_toolbar-item-min-width: 0px;
5363
5432
  --_toolbar-item-width: auto;
5433
+ --_toolbar-item-preferred-width: auto;
5434
+ --_toolbar-item-shrunk-min-width: 0px;
5364
5435
  --_toolbar-item-label-margin-top: var(--primitives-space-4);
5365
5436
 
5366
5437
  display: inline-flex;
@@ -5384,6 +5455,17 @@ var toolbarItemStyles = css`
5384
5455
  flex-basis: 0;
5385
5456
  }
5386
5457
 
5458
+ :host([shrinkable]) {
5459
+ flex-basis: var(--_toolbar-item-preferred-width);
5460
+ }
5461
+
5462
+ :host([shrunk]) {
5463
+ min-width: var(--_toolbar-item-shrunk-min-width);
5464
+ max-width: var(--_toolbar-item-preferred-width);
5465
+ flex-grow: 1;
5466
+ flex-shrink: 1;
5467
+ }
5468
+
5387
5469
  :host([hidden]) {
5388
5470
  display: none;
5389
5471
  }
@@ -5399,7 +5481,8 @@ var toolbarItemStyles = css`
5399
5481
  }
5400
5482
 
5401
5483
  :host([fluid]) .toolbar__item-content ::slotted(*),
5402
- :host([solo-fluid]) .toolbar__item-content ::slotted(*) {
5484
+ :host([solo-fluid]) .toolbar__item-content ::slotted(*),
5485
+ :host([shrinkable]) .toolbar__item-content ::slotted(*) {
5403
5486
  width: 100%;
5404
5487
  }
5405
5488
 
@@ -5615,7 +5698,7 @@ function toolbarTitleTemplate(component) {
5615
5698
  <slot name="action"></slot>
5616
5699
  `;
5617
5700
  }
5618
- function template$16(component, hasCenterChildren, leftSpacerZero, rightSpacerZero, isSoloFluidItem, hasOverflow, menuOpen, label, centerOnly, t) {
5701
+ function template$17(component, hasCenterChildren, leftSpacerZero, rightSpacerZero, isSoloFluidItem, hasOverflow, menuOpen, label, centerOnly, t) {
5619
5702
  return html`
5620
5703
  <div class="toolbar"
5621
5704
  role="toolbar"
@@ -5667,7 +5750,10 @@ var nlddToolbarTranslations = {
5667
5750
  * menu for what does not fit. The toolbar measures itself: as the row runs out
5668
5751
  * of room, items move into that menu, the lowest `priority` first, and items
5669
5752
  * that share a priority move together. So the order in the HTML says where an
5670
- * item sits, and `priority` says how long it stays.
5753
+ * item sits, and `priority` says how long it stays. An item holding a control
5754
+ * with its own overflow, such as nldd-tab-bar, first narrows down when its turn
5755
+ * comes, so that control moves what does not fit into its own menu, and only
5756
+ * then goes into the toolbar's menu.
5671
5757
  *
5672
5758
  * Every item carries its own alternative for the menu, an nldd-menu-item in its
5673
5759
  * `overflow` slot. Without one the action is simply gone once the item
@@ -5678,7 +5764,7 @@ var nlddToolbarTranslations = {
5678
5764
  * @element nldd-toolbar
5679
5765
  * @attr {string} size - Toolbar size, propagated to all child controls: 'sm' | 'md' | 'lg' (default: 'md'). At 'lg' the overflow button (and lg-capable children like nldd-icon-button) stack their label below the icon.
5680
5766
  * @attr {boolean} show-item-labels - When true, shows a text label below each toolbar item and the overflow button
5681
- * @attr {string} label - Accessible label for the toolbar. Only needed when multiple toolbars appear on the same page
5767
+ * @attr {string} accessible-label - Accessible name of the toolbar. Only needed when multiple toolbars appear on the same page.
5682
5768
  * @attr {object} translations - Override translation keys (e.g. the overflow button label); unset keys fall back to Dutch.
5683
5769
  *
5684
5770
  * @slot start - nldd-toolbar-item and nldd-toolbar-title elements placed at the start
@@ -5699,6 +5785,8 @@ var nlddToolbarTranslations = {
5699
5785
  * @attr {boolean} fluid - Set by nldd-toolbar, not a consumer attribute: marks an item that grows or shrinks to fill space. Toggled synchronously during measurement, so it can appear or disappear between layout frames — do not style against it. It is not reflected as a JS property — read it with hasAttribute('fluid').
5700
5786
  * @attr {boolean} solo-fluid - Set by nldd-toolbar, not a consumer attribute: the sole fluid item, allowed to shrink below its content. Same synchronous-toggle and property-read caveats as fluid.
5701
5787
  * @attr {boolean} hidden - Set by nldd-toolbar, not a consumer attribute, when the item moves into the overflow menu. Same synchronous-toggle caveat.
5788
+ * @attr {boolean} shrinkable - Set by nldd-toolbar, not a consumer attribute: the item holds a control that overflows by itself (nldd-tab-bar), so it gets the width that control wants with everything shown. Same synchronous-toggle caveat.
5789
+ * @attr {boolean} shrunk - Set by nldd-toolbar, not a consumer attribute: a shrinkable item narrowed down to what its control needs at least, before it would move into the overflow menu. Same synchronous-toggle caveat.
5702
5790
  *
5703
5791
  * @slot - The control shown in the toolbar (e.g. nldd-icon-button)
5704
5792
  * @slot overflow - Required: nldd-menu-item / nldd-menu-divider / nldd-menu-group children, shown in the overflow menu when this item overflows. Without them the action is gone on a narrow toolbar, and the item warns in development.
@@ -5854,7 +5942,7 @@ var NLDDToolbar = (_NLDDToolbar = class NLDDToolbar extends LitElement {
5854
5942
  super(..._args3);
5855
5943
  this.size = "md";
5856
5944
  this.showItemLabels = false;
5857
- this.label = "";
5945
+ this.accessibleLabel = "";
5858
5946
  this.translations = {};
5859
5947
  this._menuOpen = false;
5860
5948
  this._startChildren = [];
@@ -6158,6 +6246,7 @@ var NLDDToolbar = (_NLDDToolbar = class NLDDToolbar extends LitElement {
6158
6246
  itemChildren.forEach((child) => {
6159
6247
  const host = child.element;
6160
6248
  host.hidden = false;
6249
+ this._syncShrinkable(host);
6161
6250
  if (host.hasAttribute("solo-fluid")) {
6162
6251
  host.removeAttribute("solo-fluid");
6163
6252
  host.toggleAttribute("fluid", child.isFluid);
@@ -6195,9 +6284,17 @@ var NLDDToolbar = (_NLDDToolbar = class NLDDToolbar extends LitElement {
6195
6284
  return !host.hidden && !host.hasAttribute("fluid") && !host.hasAttribute("solo-fluid") && !groupIds.has(c.id);
6196
6285
  }).length === 0) break;
6197
6286
  }
6287
+ const shrinkable = group.map((c) => c.element).filter((host) => host.hasAttribute("shrinkable"));
6288
+ if (shrinkable.length > 0) {
6289
+ shrinkable.forEach((host) => host.toggleAttribute("shrunk", true));
6290
+ itemsEl.offsetWidth;
6291
+ if (!isOverflowing()) break;
6292
+ }
6198
6293
  for (const child of group) {
6199
6294
  newOverflowIds.add(child.id);
6200
- child.element.hidden = true;
6295
+ const host = child.element;
6296
+ host.hidden = true;
6297
+ host.removeAttribute("shrunk");
6201
6298
  }
6202
6299
  itemsEl.offsetWidth;
6203
6300
  }
@@ -6208,6 +6305,24 @@ var NLDDToolbar = (_NLDDToolbar = class NLDDToolbar extends LitElement {
6208
6305
  this._updateAreaVars();
6209
6306
  }
6210
6307
  /**
6308
+ * Gives an item whose control overflows by itself (nldd-tab-bar) the width
6309
+ * that control wants with everything shown, and remembers how narrow it can
6310
+ * get. Read on every measurement, because the control's content can change.
6311
+ */
6312
+ _syncShrinkable(host) {
6313
+ host.removeAttribute("shrunk");
6314
+ const control = Array.from(host.children).find((el) => el.getAttribute("slot") !== "overflow");
6315
+ const widths = typeof control?._toolbarWidths === "function" ? control._toolbarWidths() : null;
6316
+ host.toggleAttribute("shrinkable", Boolean(widths));
6317
+ if (widths) {
6318
+ host.style.setProperty("--_toolbar-item-preferred-width", `${widths.preferred}px`);
6319
+ host.style.setProperty("--_toolbar-item-shrunk-min-width", `${widths.minimum}px`);
6320
+ } else {
6321
+ host.style.removeProperty("--_toolbar-item-preferred-width");
6322
+ host.style.removeProperty("--_toolbar-item-shrunk-min-width");
6323
+ }
6324
+ }
6325
+ /**
6211
6326
  * Promotes a lone remaining fluid item — or a lone title when no items are
6212
6327
  * visible — to the solo-fluid state so it grows to fill the row. In
6213
6328
  * center-only mode the center-fill wrapper already grows the items, so item
@@ -6360,7 +6475,7 @@ var NLDDToolbar = (_NLDDToolbar = class NLDDToolbar extends LitElement {
6360
6475
  render() {
6361
6476
  const visibleNonDivider = this._allHostChildren().filter((c) => !this._overflowIds.has(c.id));
6362
6477
  const isSoloFluid = this._soloFluid || visibleNonDivider.length === 1 && (visibleNonDivider[0].type === "title" || visibleNonDivider[0].type === "item" && visibleNonDivider[0].isFluid);
6363
- return template$16(this, this._centerChildren.length > 0, this._leftSpacerZero, this._rightSpacerZero, isSoloFluid, this._pinnedOverflowItems.length > 0 || this._overflowIds.size > 0, this._menuOpen, this.label, this._centerOnly, (key) => this._t(key));
6478
+ return template$17(this, this._centerChildren.length > 0, this._leftSpacerZero, this._rightSpacerZero, isSoloFluid, this._pinnedOverflowItems.length > 0 || this._overflowIds.size > 0, this._menuOpen, this.accessibleLabel, this._centerOnly, (key) => this._t(key));
6364
6479
  }
6365
6480
  }, _NLDDToolbar.styles = toolbarStyles, _NLDDToolbar);
6366
6481
  __decorate([property({
@@ -6373,9 +6488,10 @@ __decorate([property({
6373
6488
  attribute: "show-item-labels"
6374
6489
  })], NLDDToolbar.prototype, "showItemLabels", void 0);
6375
6490
  __decorate([property({
6376
- type: String,
6377
- reflect: true
6378
- })], NLDDToolbar.prototype, "label", void 0);
6491
+ reflect: true,
6492
+ attribute: "accessible-label",
6493
+ converter: reflectNonDefault("")
6494
+ })], NLDDToolbar.prototype, "accessibleLabel", void 0);
6379
6495
  __decorate([property({ type: Object })], NLDDToolbar.prototype, "translations", void 0);
6380
6496
  __decorate([state()], NLDDToolbar.prototype, "_menuOpen", void 0);
6381
6497
  __decorate([state()], NLDDToolbar.prototype, "_startChildren", void 0);
@@ -6962,7 +7078,7 @@ var blockquoteStyles = css`
6962
7078
  `;
6963
7079
  //#endregion
6964
7080
  //#region src/components/content/blockquote/blockquote.template.ts
6965
- function template$15(component) {
7081
+ function template$16(component) {
6966
7082
  return html`
6967
7083
  <blockquote class="blockquote"
6968
7084
  cite=${component.cite || nothing}
@@ -7007,7 +7123,7 @@ var _NLDDBlockquote = class NLDDBlockquote extends LitElement {
7007
7123
  };
7008
7124
  }
7009
7125
  render() {
7010
- return template$15(this);
7126
+ return template$16(this);
7011
7127
  }
7012
7128
  };
7013
7129
  var NLDDBlockquote = (_NLDDBlockquote.styles = blockquoteStyles, _NLDDBlockquote);
@@ -7214,6 +7330,10 @@ var popoverStyles = css`
7214
7330
  overflow: auto;
7215
7331
  padding: 0;
7216
7332
  isolation: isolate;
7333
+ /* Selectable again under a trigger that switches selection off for itself
7334
+ and everything in it, as nldd-button and nldd-menu-bar-item do. */
7335
+ -webkit-user-select: text;
7336
+ user-select: text;
7217
7337
 
7218
7338
  @media (max-width: ${smMax$18}) {
7219
7339
  position: fixed;
@@ -8925,7 +9045,7 @@ var listStyles = css`
8925
9045
  `;
8926
9046
  //#endregion
8927
9047
  //#region src/components/lists-and-tables/list/list.template.ts
8928
- var template$14 = ({ itemsLabel, hasToolbar, type, isEmpty, hasItems, hasEmptyState, hasNoResultsState, listbox }) => {
9048
+ var template$15 = ({ itemsLabel, hasToolbar, type, isEmpty, hasItems, hasEmptyState, hasNoResultsState, listbox }) => {
8929
9049
  const isNavigation = type === "navigation";
8930
9050
  const isListbox = type === "listbox";
8931
9051
  const skipItemsLabel = isNavigation || isListbox;
@@ -9394,7 +9514,7 @@ var NLDDList = (_NLDDList2 = class NLDDList extends LitElement {
9394
9514
  * the branch and the next top-level row, so the last row of the list is the
9395
9515
  * deepest last child, not the last item in the list's own slot. */
9396
9516
  _getPaintedRows(rows = this._getItems()) {
9397
- return rows.filter((row) => !row.hasAttribute("hidden")).flatMap((row) => row.expanded ? [row, ...this._getPaintedRows(row.childRows)] : [row]);
9517
+ return rows.filter((row) => !row.hasAttribute("hidden")).flatMap((row) => row._childrenOpen ? [row, ...this._getPaintedRows(row.childRows)] : [row]);
9398
9518
  }
9399
9519
  _updateItems() {
9400
9520
  const items = this._getItems();
@@ -9860,7 +9980,7 @@ var NLDDList = (_NLDDList2 = class NLDDList extends LitElement {
9860
9980
  }));
9861
9981
  }
9862
9982
  render() {
9863
- return template$14({
9983
+ return template$15({
9864
9984
  itemsLabel: this.accessibleLabel || this._t("components.list.items-accessible-label"),
9865
9985
  hasToolbar: this._hasToolbar,
9866
9986
  type: this.type,
@@ -10336,11 +10456,11 @@ var listItemStyles = css`
10336
10456
  //#region src/components/lists-and-tables/list-item/list-item.template.ts
10337
10457
  var content = html`<slot></slot>`;
10338
10458
  var divider = html`<div class="list-item__divider"></div>`;
10339
- var template$13 = (button, href, target, rel, opensInNewTabLabel, actionTabindex, isHighlighted = false, checkbox = false, radio = false, checked = false, expanded, showChildren = false, hasCheckedSegment = false, disabled = false) => {
10459
+ var template$14 = (button, href, target, rel, opensInNewTabLabel, actionTabindex, isHighlighted = false, checkbox = false, radio = false, checked = false, expanded, showChildren = false, hasCheckedSegment = false, disabled = false, childrenRole = "group", childrenOpen = expanded === true) => {
10340
10460
  const ariaExpanded = expanded === void 0 ? nothing : String(expanded);
10341
10461
  const children = showChildren ? html`<div class="list-item__children"
10342
- role="group"
10343
- ?hidden=${expanded !== true}
10462
+ role=${childrenRole}
10463
+ ?hidden=${!childrenOpen}
10344
10464
  ><slot name="children"></slot></div>` : html`<slot name="children" hidden></slot>`;
10345
10465
  const blockClass = classMap({
10346
10466
  "list-item": true,
@@ -10491,6 +10611,8 @@ var NLDDListItem = (_NLDDListItem2 = class NLDDListItem extends withTranslations
10491
10611
  this._observedMarkerTargets = [];
10492
10612
  this._warnedDegenerateDivider = false;
10493
10613
  this._warnedChildrenOutsideTree = false;
10614
+ this._warnedExpandedInNavigation = false;
10615
+ this._warnedStrayExpanded = false;
10494
10616
  this._warnedStrayContent = false;
10495
10617
  this._warnedNestedControl = false;
10496
10618
  this._ownCellSize = /* @__PURE__ */ new WeakMap();
@@ -10754,11 +10876,27 @@ var NLDDListItem = (_NLDDListItem2 = class NLDDListItem extends withTranslations
10754
10876
  * attribute keeps its other meaning: this row discloses nothing, emit no
10755
10877
  * aria-expanded at all. Without this split, `?expanded=\${false}` (which
10756
10878
  * removes the attribute) would leave a branch that never collapses.
10879
+ *
10880
+ * A navigation list is the exception. Its sub-pages are always shown, so a
10881
+ * row with children discloses nothing there and emits no aria-expanded,
10882
+ * whatever `expanded` says: "collapsed" next to visible children would be
10883
+ * a contradiction.
10757
10884
  */
10758
10885
  get _resolvedExpanded() {
10886
+ if (this._showChildren && this._parentType === "navigation") return void 0;
10759
10887
  if (this._showChildren) return this.expanded === true;
10760
10888
  return this.expanded;
10761
10889
  }
10890
+ /**
10891
+ * Whether the child rows are on screen. A tree branch is closed until it
10892
+ * says `expanded`. In a navigation list the sub-pages are always there: it
10893
+ * has no branches to open, which is what sets it apart from a tree.
10894
+ *
10895
+ * @internal Read by the list, which walks the rows that paint.
10896
+ */
10897
+ get _childrenOpen() {
10898
+ return this._parentType === "navigation" || this.expanded === true;
10899
+ }
10762
10900
  /** Segments marked `disclosure` announce the row's expanded state, so the
10763
10901
  * consumer writes it once — here, where it also drives the children group. */
10764
10902
  _relayExpanded() {
@@ -11057,7 +11195,7 @@ var NLDDListItem = (_NLDDListItem2 = class NLDDListItem extends withTranslations
11057
11195
  render() {
11058
11196
  const opensInNewTabLabel = this.href && this.target === "_blank" ? this._t("components.list-item.opens-in-new-tab-label") : void 0;
11059
11197
  const actionTabindex = this._isListboxOption ? "-1" : this._arrowNavigation ? this._rovingActive ? "0" : "-1" : void 0;
11060
- return template$13(this.button, this.href, this.target, this.rel, opensInNewTabLabel, actionTabindex, this._highlighted, this.checkbox, this.radio, this.checked, this._resolvedExpanded, this._showChildren, this._hasCheckedSegment, this.disabled);
11198
+ return template$14(this.button, this.href, this.target, this.rel, opensInNewTabLabel, actionTabindex, this._highlighted, this.checkbox, this.radio, this.checked, this._resolvedExpanded, this._showChildren, this._hasCheckedSegment, this.disabled, this._parentType === "navigation" ? "list" : "group", this._childrenOpen);
11061
11199
  }
11062
11200
  }, _NLDDListItem = _NLDDListItem2, _NLDDListItem2.styles = [listItemStyles], _NLDDListItem2.SIZED_CELLS = "nldd-text-cell, nldd-drag-handle-cell", _NLDDListItem2);
11063
11201
  __decorate([property({
@@ -11216,7 +11354,7 @@ var cellStyles = css`
11216
11354
  `;
11217
11355
  //#endregion
11218
11356
  //#region src/components/lists-and-tables/cells/cell/cell.template.ts
11219
- var template$12 = () => html`<slot></slot>`;
11357
+ var template$13 = () => html`<slot></slot>`;
11220
11358
  //#endregion
11221
11359
  //#region src/components/lists-and-tables/cells/cell/cell.ts
11222
11360
  /**
@@ -11267,7 +11405,7 @@ var _NLDDCell = class NLDDCell extends VisibilityMixin(LitElement, "cells-contai
11267
11405
  else this.style.removeProperty("--_cell-min-height");
11268
11406
  }
11269
11407
  render() {
11270
- return template$12();
11408
+ return template$13();
11271
11409
  }
11272
11410
  };
11273
11411
  var NLDDCell = (_NLDDCell.styles = [cellStyles], _NLDDCell);
@@ -11920,16 +12058,16 @@ var nlddCodeMirrorTheme = [baseTheme, syntaxHighlighting(highlightStyle)];
11920
12058
  //#endregion
11921
12059
  //#region src/utilities/codemirror/languages.ts
11922
12060
  var loaders = {
11923
- json: async () => (await import("./dist-CH9m014O.js")).json(),
11924
- yaml: async () => (await import("./dist-BWRYv3Mp.js")).yaml(),
11925
- javascript: async () => (await import("./dist-DMHTTJRJ.js").then((n) => n.t)).javascript(),
11926
- typescript: async () => (await import("./dist-DMHTTJRJ.js").then((n) => n.t)).javascript({ typescript: true }),
11927
- css: async () => (await import("./dist-PlhQXXtE.js").then((n) => n.r)).css(),
11928
- html: async () => (await import("./dist-DV6Mp5N1.js").then((n) => n.t)).html(),
11929
- xml: async () => (await import("./dist-BWEAw34D.js")).xml(),
11930
- python: async () => (await import("./dist-Bi4EHsFY.js")).python(),
11931
- rust: async () => (await import("./dist-C3uWRipu.js")).rust(),
11932
- sql: async () => (await import("./dist-CvL6_ezZ.js")).sql(),
12061
+ json: async () => (await import("./dist-B2QcygzG.js")).json(),
12062
+ yaml: async () => (await import("./dist-Ch3gNAuT.js")).yaml(),
12063
+ javascript: async () => (await import("./dist-BB5mlo7D.js").then((n) => n.t)).javascript(),
12064
+ typescript: async () => (await import("./dist-BB5mlo7D.js").then((n) => n.t)).javascript({ typescript: true }),
12065
+ css: async () => (await import("./dist-DbNhCpS5.js").then((n) => n.r)).css(),
12066
+ html: async () => (await import("./dist-CaxHkqR2.js").then((n) => n.t)).html(),
12067
+ xml: async () => (await import("./dist-DnZmcpbQ.js")).xml(),
12068
+ python: async () => (await import("./dist-iC2RTM0V.js")).python(),
12069
+ rust: async () => (await import("./dist-Bo5Jeyfn.js")).rust(),
12070
+ sql: async () => (await import("./dist-CA0yDFIt.js")).sql(),
11933
12071
  markdown: async () => (await Promise.resolve().then(() => dist_exports)).markdown(),
11934
12072
  bash: async () => new LanguageSupport(StreamLanguage.define((await import("./shell-C61GCsJA.js")).shell)),
11935
12073
  toml: async () => new LanguageSupport(StreamLanguage.define((await import("./toml-C2HBbPgG.js")).toml)),
@@ -11972,6 +12110,7 @@ var codeViewerStyles = css`
11972
12110
  --_code-viewer-actions-area-padding: var(--primitives-space-8);
11973
12111
  --_code-viewer-actions-area-size: calc(var(--semantics-controls-md-min-size) + var(--_code-viewer-actions-area-padding) * 2);
11974
12112
  --_code-viewer-actions-z-index: 1;
12113
+ --_code-viewer-max-height: none;
11975
12114
 
11976
12115
  ${inheritedTextReset}
11977
12116
  display: flex;
@@ -12017,20 +12156,25 @@ var codeViewerStyles = css`
12017
12156
  box-shadow: var(--_code-viewer-border-shadow);
12018
12157
  background-color: var(--_code-viewer-background-color);
12019
12158
  min-width: 0;
12159
+ overflow: hidden;
12020
12160
  flex-grow: 1;
12021
12161
  flex-shrink: 1;
12022
12162
  flex-basis: auto;
12023
- padding: var(--_code-viewer-block-padding) var(--_code-viewer-inline-padding);
12024
12163
  color: var(--_code-viewer-content-color);
12025
12164
  font: var(--_code-viewer-font);
12026
12165
  }
12027
12166
 
12028
- /* Reserve the actions space only when the copy button actually renders: not
12029
- opted out (no-copy) and the Clipboard API is usable (copy-unavailable is
12030
- set by JS when it isn't). Both attributes suppress the button, so both drop
12031
- the reserved space. */
12167
+ /* The scroller spans the whole box, so the padding sits on the content
12168
+ inside it. Three classes deep to beat CodeMirror's own theme. */
12169
+ .code-viewer .cm-scroller .cm-content {
12170
+ padding: var(--_code-viewer-block-padding) var(--_code-viewer-inline-padding);
12171
+ }
12172
+
12032
12173
  :host(:not([no-copy]):not([copy-unavailable])) .code-viewer {
12033
12174
  min-height: var(--_code-viewer-actions-area-size);
12175
+ }
12176
+
12177
+ :host(:not([no-copy]):not([copy-unavailable])) .code-viewer .cm-scroller .cm-content {
12034
12178
  padding-right: var(--_code-viewer-actions-area-size);
12035
12179
  }
12036
12180
 
@@ -12038,8 +12182,7 @@ var codeViewerStyles = css`
12038
12182
  --_code-viewer-actions-area-padding: 0;
12039
12183
  }
12040
12184
 
12041
- :host([appearance="simple"]:not([no-copy]):not([copy-unavailable])) .code-viewer {
12042
- min-height: var(--_code-viewer-actions-area-size);
12185
+ :host([appearance="simple"]:not([no-copy]):not([copy-unavailable])) .code-viewer .cm-scroller .cm-content {
12043
12186
  padding-right: 0;
12044
12187
  }
12045
12188
 
@@ -12052,6 +12195,16 @@ var codeViewerStyles = css`
12052
12195
  box-shadow: var(--semantics-focus-ring-box-shadow), var(--_code-viewer-border-shadow);
12053
12196
  }
12054
12197
 
12198
+ :host([max-height]) .code-viewer {
12199
+ display: flex;
12200
+ max-height: var(--_code-viewer-max-height);
12201
+ flex-direction: column;
12202
+ }
12203
+
12204
+ :host([max-height]) .cm-editor {
12205
+ min-height: 0;
12206
+ }
12207
+
12055
12208
  .cm-content {
12056
12209
  tab-size: 2;
12057
12210
  }
@@ -12119,6 +12272,7 @@ function codeViewerTemplate(component) {
12119
12272
  tooltip-timing="never"
12120
12273
  size="md"
12121
12274
  @click=${component._onCopyClick}
12275
+ @focusout=${component._onCopyBlur}
12122
12276
  ></nldd-icon-button>
12123
12277
  </nldd-tooltip>
12124
12278
  </div>
@@ -12209,6 +12363,11 @@ function forceScrollLayerRepaint(el) {
12209
12363
  * Whitespace is preserved; long lines scroll horizontally by default. Set
12210
12364
  * `wrap` to break long lines onto the next visual line.
12211
12365
  *
12366
+ * The viewer grows with its content. Set `max-height` to show a long file in
12367
+ * a frame of its own: the block grows up to that height and scrolls beyond it.
12368
+ * A scroller that overflows, in either direction, is a tab stop with a role
12369
+ * and a name, so the keyboard reaches what a pointer can scroll to.
12370
+ *
12212
12371
  * ## Syntax highlighting
12213
12372
  * Set `language` to one of the supported grammars (yaml, json, javascript,
12214
12373
  * typescript, css, html, xml, bash, markdown, rust, gherkin, toml, sql,
@@ -12227,6 +12386,7 @@ function forceScrollLayerRepaint(el) {
12227
12386
  * @attr {string} language - Grammar to highlight with. Empty disables highlighting.
12228
12387
  * @attr {boolean} no-copy - Hide the copy-to-clipboard button (shown by default).
12229
12388
  * @attr {boolean} wrap - Wrap long lines instead of horizontal scroll
12389
+ * @attr {string} max-height - Tallest the block may get, as a CSS length (e.g. '400px', '50vh'). Beyond it the content scrolls vertically. Unset means no cap.
12230
12390
  * @attr {object} translations - Override translation keys (e.g. the copy button
12231
12391
  * labels and the scroll-region label); unset keys fall back to Dutch.
12232
12392
  *
@@ -12244,6 +12404,7 @@ var NLDDCodeViewer = (_NLDDCodeViewer = class NLDDCodeViewer extends NLDDCodeMir
12244
12404
  this.language = "";
12245
12405
  this.noCopy = false;
12246
12406
  this.wrap = false;
12407
+ this.maxHeight = "";
12247
12408
  this._copyUnavailable = false;
12248
12409
  this.translations = {};
12249
12410
  this._isScrollable = false;
@@ -12331,6 +12492,10 @@ var NLDDCodeViewer = (_NLDDCodeViewer = class NLDDCodeViewer extends NLDDCodeMir
12331
12492
  }
12332
12493
  updated(changed) {
12333
12494
  if (changed.has("noCopy")) this._copyUnavailable = !this.noCopy && !isClipboardAvailable();
12495
+ if (changed.has("maxHeight")) {
12496
+ if (this.maxHeight && CSS.supports("max-height", this.maxHeight)) this.style.setProperty("--_code-viewer-max-height", this.maxHeight);
12497
+ else this.style.removeProperty("--_code-viewer-max-height");
12498
+ }
12334
12499
  if (!this.view) return;
12335
12500
  if (this._isScrollable) this.view.scrollDOM.setAttribute("aria-label", this._t("components.code-viewer.region-label"));
12336
12501
  if (changed.has("language")) this._applyLanguage();
@@ -12338,7 +12503,7 @@ var NLDDCodeViewer = (_NLDDCodeViewer = class NLDDCodeViewer extends NLDDCodeMir
12338
12503
  this.reconfigure(this._wrapCompartment, this.wrap ? EditorView.lineWrapping : []);
12339
12504
  this._updateScrollable();
12340
12505
  }
12341
- if (changed.has("appearance") || changed.has("noCopy") || changed.has("_copyUnavailable")) this._updateScrollable();
12506
+ if (changed.has("appearance") || changed.has("maxHeight") || changed.has("noCopy") || changed.has("_copyUnavailable")) this._updateScrollable();
12342
12507
  }
12343
12508
  _onSlotChange() {
12344
12509
  this.setDoc(this._getRawText());
@@ -12387,7 +12552,7 @@ var NLDDCodeViewer = (_NLDDCodeViewer = class NLDDCodeViewer extends NLDDCodeMir
12387
12552
  const scroller = this.view?.scrollDOM;
12388
12553
  if (!scroller) return;
12389
12554
  if (scroller.clientWidth === 0) return;
12390
- const scrollable = !this.wrap && scroller.scrollWidth > scroller.clientWidth;
12555
+ const scrollable = scroller.scrollHeight > scroller.clientHeight || !this.wrap && scroller.scrollWidth > scroller.clientWidth;
12391
12556
  this._isScrollable = scrollable;
12392
12557
  if (scrollable) {
12393
12558
  scroller.setAttribute("tabindex", "0");
@@ -12404,7 +12569,8 @@ var NLDDCodeViewer = (_NLDDCodeViewer = class NLDDCodeViewer extends NLDDCodeMir
12404
12569
  if (!slot) return "";
12405
12570
  return slot.assignedNodes({ flatten: true }).map((n) => n.textContent ?? "").join("");
12406
12571
  }
12407
- async _onCopyClick() {
12572
+ async _onCopyClick(event) {
12573
+ (event?.currentTarget)?.focus?.();
12408
12574
  try {
12409
12575
  if (!isClipboardAvailable()) throw new Error("Clipboard API unavailable");
12410
12576
  await navigator.clipboard.writeText(this._getRawText());
@@ -12413,10 +12579,15 @@ var NLDDCodeViewer = (_NLDDCodeViewer = class NLDDCodeViewer extends NLDDCodeMir
12413
12579
  this._copyState = "failure";
12414
12580
  }
12415
12581
  clearTimeout(this._copyResetTimer);
12582
+ if (this._copyState === "failure") return;
12416
12583
  this._copyResetTimer = setTimeout(() => {
12417
12584
  this._copyState = "idle";
12418
12585
  }, COPY_FEEDBACK_DURATION_MS);
12419
12586
  }
12587
+ /** Leaving the button clears a failure, which no timer does. */
12588
+ _onCopyBlur() {
12589
+ if (this._copyState === "failure") this._copyState = "idle";
12590
+ }
12420
12591
  /** Escape on the open feedback tooltip dismisses it early (WCAG 1.4.13). */
12421
12592
  _onCopyDismiss() {
12422
12593
  clearTimeout(this._copyResetTimer);
@@ -12444,6 +12615,11 @@ __decorate([property({
12444
12615
  type: Boolean,
12445
12616
  reflect: true
12446
12617
  })], NLDDCodeViewer.prototype, "wrap", void 0);
12618
+ __decorate([property({
12619
+ reflect: true,
12620
+ attribute: "max-height",
12621
+ converter: reflectNonDefault("")
12622
+ })], NLDDCodeViewer.prototype, "maxHeight", void 0);
12447
12623
  __decorate([property({
12448
12624
  type: Boolean,
12449
12625
  reflect: true,
@@ -13643,7 +13819,7 @@ var tagStyles = css`
13643
13819
  `;
13644
13820
  //#endregion
13645
13821
  //#region src/components/content/tag/tag.template.ts
13646
- function template$11(component) {
13822
+ function template$12(component) {
13647
13823
  const variant = component._effectiveVariant;
13648
13824
  const showIcon = variant === "icon" || variant === "icon-and-text" && component._hasIcon;
13649
13825
  const showText = (variant === "text" || variant === "icon-and-text") && component._hasText;
@@ -13740,7 +13916,7 @@ var _NLDDTag = class NLDDTag extends LitElement {
13740
13916
  }
13741
13917
  updated() {}
13742
13918
  render() {
13743
- return template$11(this);
13919
+ return template$12(this);
13744
13920
  }
13745
13921
  };
13746
13922
  var NLDDTag = (_NLDDTag.styles = tagStyles, _NLDDTag);
@@ -13889,7 +14065,7 @@ var textStyles = css`
13889
14065
  `;
13890
14066
  //#endregion
13891
14067
  //#region src/components/content/text/text.template.ts
13892
- function template$10() {
14068
+ function template$11() {
13893
14069
  return html`
13894
14070
  <slot></slot>
13895
14071
  `;
@@ -13940,7 +14116,7 @@ var _NLDDText = class NLDDText extends LitElement {
13940
14116
  this.horizontalAlignment = "left";
13941
14117
  }
13942
14118
  render() {
13943
- return template$10();
14119
+ return template$11();
13944
14120
  }
13945
14121
  };
13946
14122
  var NLDDText = (_NLDDText.styles = textStyles, _NLDDText);
@@ -14731,6 +14907,73 @@ __decorate([state()], NLDDToken.prototype, "_slotText", void 0);
14731
14907
  __decorate([query(".token__menu-action nldd-icon-button")], NLDDToken.prototype, "_menuButton", void 0);
14732
14908
  NLDDToken = __decorate([customElement("nldd-token")], NLDDToken);
14733
14909
  //#endregion
14910
+ //#region src/components/content/visually-hidden/visually-hidden.styles.ts
14911
+ var visuallyHiddenStyles = css`
14912
+ :host {
14913
+ box-sizing: border-box;
14914
+ }
14915
+
14916
+
14917
+ /* # Host */
14918
+
14919
+ :host {
14920
+ display: block;
14921
+ position: absolute;
14922
+ /* !important: a reset on * would beat it on the host. The 1px offset keeps
14923
+ the box from adding a pixel to the scroll area of a container. */
14924
+ margin: -1px !important;
14925
+ width: 1px;
14926
+ height: 1px;
14927
+ overflow: hidden;
14928
+ white-space: nowrap;
14929
+ clip-path: inset(50%);
14930
+ }
14931
+
14932
+ :host([hidden]) {
14933
+ display: none;
14934
+ }
14935
+ `;
14936
+ //#endregion
14937
+ //#region src/components/content/visually-hidden/visually-hidden.template.ts
14938
+ function template$10() {
14939
+ return html`
14940
+ <slot></slot>
14941
+ `;
14942
+ }
14943
+ //#endregion
14944
+ //#region src/components/content/visually-hidden/visually-hidden.ts
14945
+ /**
14946
+ * Nederlandse Digitale Dienst Visually Hidden Component (Lit + TypeScript)
14947
+ *
14948
+ * Text a screen reader reads and the screen does not show. It stays in the
14949
+ * accessibility tree and in the reading order, and takes no room on the page.
14950
+ *
14951
+ * For a name that is visually redundant: the header of a column of checkboxes,
14952
+ * where the checkboxes say enough to anyone who can see them, or the "(opent in
14953
+ * een nieuw venster)" after a link whose icon already says it.
14954
+ *
14955
+ * Not for repairing structure that is missing. Hidden text that describes how
14956
+ * something is laid out ("subpagina van Aanvragen") stands in for semantics the
14957
+ * markup should carry, and only a screen reader gets the stand-in. Not for a
14958
+ * status either: a status that matters to a screen reader matters to anyone,
14959
+ * so show it, as text with `role="status"` or as an `nldd-notification`. And
14960
+ * not for the name of a component that takes `accessible-label`: give it that.
14961
+ *
14962
+ * Nothing in it should take focus. A control inside would be reached with Tab
14963
+ * and be nowhere on the screen.
14964
+ *
14965
+ * @element nldd-visually-hidden
14966
+ *
14967
+ * @slot - The text, read by a screen reader and not shown.
14968
+ */
14969
+ var _NLDDVisuallyHidden = class NLDDVisuallyHidden extends LitElement {
14970
+ render() {
14971
+ return template$10();
14972
+ }
14973
+ };
14974
+ var NLDDVisuallyHidden = (_NLDDVisuallyHidden.styles = visuallyHiddenStyles, _NLDDVisuallyHidden);
14975
+ NLDDVisuallyHidden = __decorate([customElement("nldd-visually-hidden")], NLDDVisuallyHidden);
14976
+ //#endregion
14734
14977
  //#region src/components/forms/form/form.ts
14735
14978
  /**
14736
14979
  * Nederlandse Digitale Dienst Form Component
@@ -15766,10 +16009,10 @@ function validationItemTemplate(_component) {
15766
16009
  * the command ("Gebruik minimaal 8 tekens"): before a verdict it stands there as
15767
16010
  * what the field wants, after one as what the value does not meet.
15768
16011
  *
15769
- * @attr {string} match - Regular expression the value has to contain. Not anchored, unlike the native `pattern`: `[A-Z]` means "has a capital in it".
15770
- * @attr {number} minlength - Fewest characters the value may have.
16012
+ * @attr {string} match - Regular expression the value has to contain. Not anchored, unlike the native `pattern`: `[A-Z]` means "has a capital in it". Not held against an empty value unless the field is required.
16013
+ * @attr {number} minlength - Fewest characters the value may have. Not held against an empty value unless the field is required.
15771
16014
  * @attr {number} maxlength - Most characters the value may have.
15772
- * @attr {boolean} required - The value may not be empty. Use it on a field whose other rules would pass an empty value.
16015
+ * @attr {boolean} required - The value may not be empty. Without it, and without `required` on the control, an empty value passes every rule in the list, as it does for the native `pattern` and `minlength`. The control is read by its `required` property or attribute; one that only says `aria-required` needs this item.
15773
16016
  * @attr {boolean} hint - Show this item before there is a verdict, whatever the list says.
15774
16017
  * @attr {boolean} unmet - Whether the value fails this item. Managed by the list; do not set it yourself.
15775
16018
  * @attr {boolean} visible - Whether the item is on screen. Managed by the list.
@@ -15805,11 +16048,9 @@ var _NLDDValidationItem = class NLDDValidationItem extends LitElement {
15805
16048
  * Whether `value` satisfies this item, or null when there is nothing to
15806
16049
  * satisfy because the item carries no rule.
15807
16050
  *
15808
- * An empty value is held against the rules like any other, so "minimaal 8
15809
- * tekens" fails on it, because it does. What keeps a fresh field from
15810
- * lighting up all of its requirements is not this method but the verdict: an
15811
- * item only turns critical once the control says `invalid`, and an untouched
15812
- * field has not been judged yet.
16051
+ * An empty value is held against the rules like any other here, so "minimaal
16052
+ * 8 tekens" fails on it. Whether an empty value is judged at all is not this
16053
+ * item's call but the list's, which knows if the field needs a value.
15813
16054
  */
15814
16055
  test(value) {
15815
16056
  if (!this.hasRule) return null;
@@ -15823,6 +16064,21 @@ var _NLDDValidationItem = class NLDDValidationItem extends LitElement {
15823
16064
  super.connectedCallback();
15824
16065
  this.setAttribute("role", "listitem");
15825
16066
  }
16067
+ /**
16068
+ * A rule that changes after the fact changes the verdict, and `required`
16069
+ * changes it for every item in the list. The list only re-checks on input
16070
+ * and on its control's attributes, so the item tells it.
16071
+ */
16072
+ updated(changed) {
16073
+ if (![
16074
+ "match",
16075
+ "minlength",
16076
+ "maxlength",
16077
+ "required"
16078
+ ].some((key) => changed.has(key))) return;
16079
+ const list = this.parentElement;
16080
+ if (list instanceof NLDDValidationList) list.requestUpdate();
16081
+ }
15826
16082
  render() {
15827
16083
  return validationItemTemplate(this);
15828
16084
  }
@@ -15919,7 +16175,11 @@ var NLDDValidationList = (_NLDDValidationList = class NLDDValidationList extends
15919
16175
  });
15920
16176
  this._observer.observe(next, {
15921
16177
  attributes: true,
15922
- attributeFilter: ["invalid", "unmet"]
16178
+ attributeFilter: [
16179
+ "invalid",
16180
+ "unmet",
16181
+ "required"
16182
+ ]
15923
16183
  });
15924
16184
  }
15925
16185
  _detach() {
@@ -15939,17 +16199,27 @@ var NLDDValidationList = (_NLDDValidationList = class NLDDValidationList extends
15939
16199
  * `unmet` on the control. Never both: a rule is held against the value as it
15940
16200
  * is now, while `unmet` is a snapshot of the last check and therefore older,
15941
16201
  * so letting the snapshot win would show a mistake that has been fixed.
16202
+ *
16203
+ * An empty value in a field that does not need one passes every rule, the
16204
+ * way the native `pattern` and `minlength` leave an empty input alone. A
16205
+ * field needs a value when an item says `required` or the control does.
16206
+ * Without this a `match` under an optional field blocked every submit that
16207
+ * left it empty, and nothing on screen said why.
15942
16208
  */
15943
16209
  _evaluate() {
15944
16210
  const control = this._resolved;
15945
16211
  const invalid = control?.hasAttribute("invalid") ?? false;
15946
16212
  const named = (control?.getAttribute("unmet") ?? "").split(" ").filter(Boolean);
15947
16213
  const value = this._currentValue();
16214
+ const items = this._items;
16215
+ const needsValue = items.some((item) => item.required) || Boolean(control?.required) || (control?.hasAttribute("required") ?? false);
16216
+ const skipRules = value === "" && !needsValue;
15948
16217
  let anyVisible = false;
15949
16218
  let anyRuleFails = false;
15950
16219
  const messages = [];
15951
- for (const item of this._items) {
15952
- const rule = item.test(value);
16220
+ for (const item of items) {
16221
+ const tested = item.test(value);
16222
+ const rule = tested !== null && skipRules ? true : tested;
15953
16223
  const failing = rule === null ? named.includes(item.id) : !rule;
15954
16224
  item.unmet = invalid && failing;
15955
16225
  item.visible = item.unmet || !this.judging && (item.hint || this.hint);
@@ -20397,9 +20667,16 @@ function topTitleBarTemplate(component) {
20397
20667
  * everyone. Anchor at the heading, then, and not at some other element that
20398
20668
  * happens to sit at the right height: the bar hands its title over to it.
20399
20669
  *
20670
+ * The title stays on one line and is cut off with an ellipsis when it does not
20671
+ * fit, which on a narrow screen or at 400% zoom is soon. The bar is therefore
20672
+ * not the place for the full title: put that in an `nldd-title` at the top of
20673
+ * the content, which wraps and always fits, and point `collapse-anchor` at it.
20674
+ * A bar without an anchor holds the only copy of its title, so keep that one to
20675
+ * a word or two.
20676
+ *
20400
20677
  * @element nldd-top-title-bar
20401
20678
  *
20402
- * @attr {string} text - Title of the bar, rendered as the heading in the title group.
20679
+ * @attr {string} text - Title of the bar, rendered as the heading in the title group. One line, cut off with an ellipsis when it does not fit; see above for a title that can run long.
20403
20680
  * @attr {string} supporting-text - Text under the title.
20404
20681
  * @attr {1|2|3|4|5|6} heading-level - Heading level of the title: 1–6 (default: 1). Lower it where the bar is not the top of the page, such as a pane beside content that already has its h1.
20405
20682
  * @attr {string} collapse-anchor - Id of the element whose top edge triggers the compact state on scroll. Without it the state is static (see above).
@@ -26396,7 +26673,6 @@ var NLDDSegmentedControlItem = (_NLDDSegmentedControlItem = class NLDDSegmentedC
26396
26673
  this._select();
26397
26674
  return;
26398
26675
  }
26399
- if (e.key === "Escape") this._tooltip?._handleTriggerLeave();
26400
26676
  };
26401
26677
  }
26402
26678
  connectedCallback() {
@@ -26416,7 +26692,7 @@ var NLDDSegmentedControlItem = (_NLDDSegmentedControlItem = class NLDDSegmentedC
26416
26692
  /**
26417
26693
  * The tooltip of the icon variant, which shows itself when focus moves into
26418
26694
  * it. In radio mode the focus is on this element, outside it, so it hears
26419
- * about focus and Escape from here.
26695
+ * about focus from here. Escape it hears by itself, from the document.
26420
26696
  */
26421
26697
  get _tooltip() {
26422
26698
  return this.inputType === "radio" ? this.shadowRoot?.querySelector("nldd-tooltip") ?? null : null;
@@ -36704,7 +36980,6 @@ var _NLDDToggleButton = class NLDDToggleButton extends DescribedBy(FormAssociate
36704
36980
  submitOnEnter(this, e);
36705
36981
  return;
36706
36982
  }
36707
- if (e.key === "Escape") this._tooltip?._handleTriggerLeave();
36708
36983
  };
36709
36984
  this._onRadioFocus = () => {
36710
36985
  this._tooltip?._handleFocusIn();
@@ -36792,7 +37067,7 @@ var _NLDDToggleButton = class NLDDToggleButton extends DescribedBy(FormAssociate
36792
37067
  /**
36793
37068
  * The tooltip of an icon-only button, which shows itself when focus moves
36794
37069
  * into it. In radio mode the focus is on this element, outside it, so it
36795
- * hears about focus and Escape from here.
37070
+ * hears about focus from here. Escape it hears by itself, from the document.
36796
37071
  */
36797
37072
  get _tooltip() {
36798
37073
  return this.type === "radio" ? this.shadowRoot?.querySelector("nldd-tooltip") ?? null : null;
@@ -43222,9 +43497,11 @@ var sidebarSectionStyles = css`
43222
43497
  /* # Box — the surface around it, edged by a divider. Sticky + scrollable only
43223
43498
  beside the main (wide); when stacked it's a plain full-width box above the
43224
43499
  main, so no sticky (which would scroll over the main) and no viewport
43225
- height cap. */
43500
+ height cap. The box is the aside itself: Firefox puts a tab stop on
43501
+ whatever scrolls, and that stop needs the landmark's role and name. */
43226
43502
 
43227
43503
  .sidebar-section__sidebar-box {
43504
+ display: block;
43228
43505
  box-sizing: border-box;
43229
43506
  border-radius: var(--semantics-surfaces-corner-radius);
43230
43507
  background-color: var(--_sidebar-section-sidebar-box-background-color);
@@ -43259,13 +43536,13 @@ function sidebarSectionTemplate(component) {
43259
43536
  </header>
43260
43537
  <div class="sidebar-section__columns">
43261
43538
  ${!collapsed ? html`
43262
- <aside class="sidebar-section__sidebar"
43263
- aria-label=${sidebarLabel}
43264
- >
43265
- <div class="sidebar-section__sidebar-box">
43539
+ <div class="sidebar-section__sidebar">
43540
+ <aside class="sidebar-section__sidebar-box"
43541
+ aria-label=${sidebarLabel}
43542
+ >
43266
43543
  <slot name="sidebar"></slot>
43267
- </div>
43268
- </aside>
43544
+ </aside>
43545
+ </div>
43269
43546
  ` : nothing}
43270
43547
  <div class="sidebar-section__main">
43271
43548
  <slot></slot>
@@ -44239,7 +44516,7 @@ var cardStyles = css`
44239
44516
  }
44240
44517
  }
44241
44518
 
44242
- .card:has(> .card__action:active) {
44519
+ :host([data-action-pressed]) .card {
44243
44520
  --_card-border-color: var(--_card-is-active-border-color);
44244
44521
  background-color: var(--_card-is-active-background-color);
44245
44522
  }
@@ -44300,7 +44577,7 @@ var cardStyles = css`
44300
44577
  pointer-events: none;
44301
44578
  }
44302
44579
 
44303
- :host(.is-action-focused) .card__focus-ring {
44580
+ :host([data-action-focused]) .card__focus-ring {
44304
44581
  display: block;
44305
44582
  }
44306
44583
 
@@ -44395,7 +44672,8 @@ var nlddCardTranslations = { "components.card.opens-in-new-tab-label": "Opent in
44395
44672
  * above it with `position: relative; z-index: 1` to stay clickable.
44396
44673
  * A card that is a link or button steps its surface and border one shade up
44397
44674
  * on hover and one more while pressed, as a neutral-base button does; content
44398
- * lifted above the overlay does not set it off.
44675
+ * lifted above the overlay does not set it off. On a touch screen there is no
44676
+ * hover, and a touch that turns into a scroll lets go of the pressed shade.
44399
44677
  *
44400
44678
  * @element nldd-card
44401
44679
  *
@@ -44428,6 +44706,18 @@ var _NLDDCard = class NLDDCard extends withTranslations(LitElement, nlddCardTran
44428
44706
  this._onFocusOut = () => {
44429
44707
  this._actionFocused = false;
44430
44708
  };
44709
+ this._onPointerDown = (e) => {
44710
+ if (e.button > 0) return;
44711
+ if (!e.composedPath()[0]?.matches?.(".card__action")) return;
44712
+ this.toggleAttribute("data-action-pressed", true);
44713
+ window.addEventListener("pointerup", this._clearPressed);
44714
+ window.addEventListener("pointercancel", this._clearPressed);
44715
+ };
44716
+ this._clearPressed = () => {
44717
+ window.removeEventListener("pointerup", this._clearPressed);
44718
+ window.removeEventListener("pointercancel", this._clearPressed);
44719
+ this.removeAttribute("data-action-pressed");
44720
+ };
44431
44721
  this._onSlotChange = (e) => {
44432
44722
  const slot = e.target;
44433
44723
  const wrapper = slot.parentElement;
@@ -44438,15 +44728,18 @@ var _NLDDCard = class NLDDCard extends withTranslations(LitElement, nlddCardTran
44438
44728
  super.connectedCallback();
44439
44729
  this.addEventListener("focusin", this._onFocusIn);
44440
44730
  this.addEventListener("focusout", this._onFocusOut);
44731
+ this.addEventListener("pointerdown", this._onPointerDown);
44441
44732
  this.style.containerType = "inline-size";
44442
44733
  this.style.containerName = "layout-container";
44443
44734
  }
44444
44735
  updated() {
44445
- this.classList.toggle("is-action-focused", this._actionFocused);
44736
+ this.toggleAttribute("data-action-focused", this._actionFocused);
44446
44737
  }
44447
44738
  disconnectedCallback() {
44448
44739
  this.removeEventListener("focusin", this._onFocusIn);
44449
44740
  this.removeEventListener("focusout", this._onFocusOut);
44741
+ this.removeEventListener("pointerdown", this._onPointerDown);
44742
+ this._clearPressed();
44450
44743
  super.disconnectedCallback();
44451
44744
  }
44452
44745
  render() {
@@ -48261,10 +48554,13 @@ var menuBarItemStyles = css`
48261
48554
  function template$4(component) {
48262
48555
  const safeHref = sanitizeUrl(component.href);
48263
48556
  const isLink = Boolean(safeHref);
48264
- const isIconOnly = Boolean((component.iconOnly || component.contentPriority === "icon" && component.compact) && component.text);
48265
- const ariaLabel = component.accessibleLabel || (isIconOnly ? component.text : nothing);
48557
+ const hasIcon = Boolean(component.icon) || component._hasSlottedIcon;
48558
+ const showsIconOnly = Boolean(component.text) && (component.iconOnly || component.contentPriority === "icon" && component.compact && hasIcon);
48559
+ const ariaLabel = component.accessibleLabel || (showsIconOnly ? component.text : nothing);
48560
+ const tooltipText = showsIconOnly ? component.accessibleLabel || component.text : "";
48266
48561
  const ariaCurrent = component.current ? component.currentType : nothing;
48267
- const ariaHaspopup = component.expandable ? "menu" : component.haspopup || nothing;
48562
+ const opensNavigation = component.querySelector(":scope > nldd-menu")?.getAttribute("variant") === "navigation";
48563
+ const ariaHaspopup = component.expandable ? opensNavigation ? nothing : "menu" : component.haspopup || nothing;
48268
48564
  const ariaExpanded = component.expandable || component.haspopup ? String(component.expanded) : nothing;
48269
48565
  const icon = html`
48270
48566
  <span class="menu-bar-item__icon" ?hidden=${!component.icon && !component._hasSlottedIcon}>
@@ -48274,14 +48570,40 @@ function template$4(component) {
48274
48570
  </span>
48275
48571
  `;
48276
48572
  if (isLink) return html`
48277
- <a class="menu-bar-item"
48278
- href=${safeHref}
48279
- aria-disabled=${component.disabled || nothing}
48280
- tabindex=${component.disabled ? "-1" : nothing}
48573
+ <nldd-tooltip text=${tooltipText}>
48574
+ <a class="menu-bar-item"
48575
+ href=${safeHref}
48576
+ aria-disabled=${component.disabled || nothing}
48577
+ tabindex=${component.disabled ? "-1" : nothing}
48578
+ aria-current=${ariaCurrent}
48579
+ aria-label=${ariaLabel}
48580
+ aria-haspopup=${ariaHaspopup}
48581
+ aria-expanded=${ariaExpanded}
48582
+ >
48583
+ ${icon}
48584
+ <span class="menu-bar-item__text">
48585
+ ${component.text}
48586
+ </span>
48587
+ ${component.expandable ? html`
48588
+ <span class="menu-bar-item__disclosure-icon">
48589
+ <nldd-icon icon="chevron-down-small"></nldd-icon>
48590
+ </span>
48591
+ ` : nothing}
48592
+ </a>
48593
+ </nldd-tooltip>
48594
+ <slot @slotchange=${component._onSlotChange}></slot>
48595
+ `;
48596
+ return html`
48597
+ <nldd-tooltip text=${tooltipText}>
48598
+ <button class="menu-bar-item"
48599
+ type="button"
48600
+ ?disabled=${component.disabled}
48281
48601
  aria-current=${ariaCurrent}
48282
48602
  aria-label=${ariaLabel}
48283
48603
  aria-haspopup=${ariaHaspopup}
48284
48604
  aria-expanded=${ariaExpanded}
48605
+ .popoverTargetElement=${component.popoverTargetElement}
48606
+ .popoverTargetAction=${component.popoverTargetAction}
48285
48607
  >
48286
48608
  ${icon}
48287
48609
  <span class="menu-bar-item__text">
@@ -48292,30 +48614,8 @@ function template$4(component) {
48292
48614
  <nldd-icon icon="chevron-down-small"></nldd-icon>
48293
48615
  </span>
48294
48616
  ` : nothing}
48295
- </a>
48296
- <slot @slotchange=${component._onSlotChange}></slot>
48297
- `;
48298
- return html`
48299
- <button class="menu-bar-item"
48300
- type="button"
48301
- ?disabled=${component.disabled}
48302
- aria-current=${ariaCurrent}
48303
- aria-label=${ariaLabel}
48304
- aria-haspopup=${ariaHaspopup}
48305
- aria-expanded=${ariaExpanded}
48306
- .popoverTargetElement=${component.popoverTargetElement}
48307
- .popoverTargetAction=${component.popoverTargetAction}
48308
- >
48309
- ${icon}
48310
- <span class="menu-bar-item__text">
48311
- ${component.text}
48312
- </span>
48313
- ${component.expandable ? html`
48314
- <span class="menu-bar-item__disclosure-icon">
48315
- <nldd-icon icon="chevron-down-small"></nldd-icon>
48316
- </span>
48317
- ` : nothing}
48318
- </button>
48617
+ </button>
48618
+ </nldd-tooltip>
48319
48619
  <slot @slotchange=${component._onSlotChange}></slot>
48320
48620
  `;
48321
48621
  }
@@ -48335,9 +48635,9 @@ function template$4(component) {
48335
48635
  * @attr {string} current-type - aria-current value when current is true ('page', 'step', 'location', 'true'). Default: 'page'
48336
48636
  * @attr {string} href - Optional link URL. Without href it renders as a button.
48337
48637
  * @attr {string} icon - Optional icon name (nldd-icon)
48338
- * @attr {boolean} expandable - Show the disclosure icon and open the slotted `<nldd-menu>` on click
48339
- * @attr {boolean} icon-only - Hide the text visually (always)
48340
- * @attr {'icon'|'text'} content-priority - Decides what stays visible in compact mode: 'icon' hides the text, 'text' hides the icon
48638
+ * @attr {boolean} expandable - Show the disclosure icon and open the slotted `<nldd-menu>` on click. The control then says `aria-haspopup="menu"`, except for a menu with `variant="navigation"`: that is a list of links, so the control only says `aria-expanded`.
48639
+ * @attr {boolean} icon-only - Hide the text visually (always). The text then shows as a tooltip on hover and focus.
48640
+ * @attr {'icon'|'text'} content-priority - Decides what stays visible in compact mode: 'icon' hides the text, 'text' hides the icon. A bar is compact on a narrow screen and also at 200% zoom on a desktop, so with 'icon' the text is gone there too and shows as a tooltip instead.
48341
48641
  * @attr {boolean} compact - Activates content-priority behavior (set by the parent nldd-menu-bar)
48342
48642
  * @attr {boolean} disabled - Turn interaction off
48343
48643
  * @attr {string} accessible-label - Override aria-label
@@ -48375,6 +48675,7 @@ var _NLDDMenuBarItem = class NLDDMenuBarItem extends LitElement {
48375
48675
  this._menuOpen = false;
48376
48676
  this._pointerdownWhileMenuOpen = false;
48377
48677
  this._menuToggleHandler = null;
48678
+ this._menuVariantObserver = null;
48378
48679
  this._hasSlottedIcon = false;
48379
48680
  this._onIconSlotChange = (e) => {
48380
48681
  this._hasSlottedIcon = e.target.assignedElements().length > 0;
@@ -48440,9 +48741,17 @@ var _NLDDMenuBarItem = class NLDDMenuBarItem extends LitElement {
48440
48741
  this.expanded = isOpen;
48441
48742
  };
48442
48743
  menu.addEventListener("toggle", this._menuToggleHandler);
48744
+ this._menuVariantObserver = new MutationObserver(() => this.requestUpdate());
48745
+ this._menuVariantObserver.observe(menu, {
48746
+ attributes: true,
48747
+ attributeFilter: ["variant"]
48748
+ });
48749
+ this.requestUpdate();
48443
48750
  }
48444
48751
  _unwireMenu() {
48445
48752
  if (this._menu && this._menuToggleHandler) this._menu.removeEventListener("toggle", this._menuToggleHandler);
48753
+ this._menuVariantObserver?.disconnect();
48754
+ this._menuVariantObserver = null;
48446
48755
  this._menu = null;
48447
48756
  this._menuToggleHandler = null;
48448
48757
  this._menuOpen = false;
@@ -48708,6 +49017,7 @@ var _NLDDMenuBar = class NLDDMenuBar extends withTranslations(LitElement, nlddMe
48708
49017
  const menuItem = document.createElement("nldd-menu-item");
48709
49018
  menuItem.setAttribute("text", item.text);
48710
49019
  if (item.icon) menuItem.setAttribute("icon", item.icon);
49020
+ if (item.href) menuItem.setAttribute("href", item.href);
48711
49021
  if (item.current) menuItem.setAttribute("selected", "");
48712
49022
  if (item.disabled) menuItem.setAttribute("disabled", "");
48713
49023
  if (item.expandable) {
@@ -48725,8 +49035,24 @@ var _NLDDMenuBar = class NLDDMenuBar extends withTranslations(LitElement, nlddMe
48725
49035
  continue;
48726
49036
  }
48727
49037
  }
48728
- menuItem.addEventListener("click", () => {
48729
- item.click();
49038
+ menuItem.addEventListener("click", (event) => {
49039
+ if (!item.href) {
49040
+ item.click();
49041
+ return;
49042
+ }
49043
+ const { button, ctrlKey, metaKey, shiftKey, altKey } = event;
49044
+ const forwarded = new MouseEvent("click", {
49045
+ bubbles: true,
49046
+ cancelable: true,
49047
+ composed: true,
49048
+ button,
49049
+ ctrlKey,
49050
+ metaKey,
49051
+ shiftKey,
49052
+ altKey
49053
+ });
49054
+ item.dispatchEvent(forwarded);
49055
+ if (forwarded.defaultPrevented) event.preventDefault();
48730
49056
  });
48731
49057
  this._overflowMenu.appendChild(menuItem);
48732
49058
  }
@@ -49130,6 +49456,7 @@ function template$2(component) {
49130
49456
  ${safeHref ? html`
49131
49457
  <a class="skip-link__control"
49132
49458
  href=${safeHref}
49459
+ @click=${component._handleLinkClick}
49133
49460
  >
49134
49461
  ${component._text}
49135
49462
  </a>
@@ -49154,13 +49481,29 @@ var nlddSkipLinkTranslations = { "components.skip-link.action": "Sla over" };
49154
49481
  * Nederlandse Digitale Dienst Skip Link Component (Lit + TypeScript)
49155
49482
  *
49156
49483
  * Accessibility pattern that lets keyboard users skip past content. Wraps
49157
- * content in a default slot. Without href it focuses the first element after
49158
- * the skip link in the DOM (nextElementSibling). Make sure a focusable element
49159
- * follows the component, otherwise the skip link has no effect.
49484
+ * content in a default slot.
49485
+ *
49486
+ * Not only for the header of a page. Any block with many stops that someone
49487
+ * on a keyboard often wants to get past can have one: a set of filters, a long
49488
+ * toolbar, a table of contents. Keep it to blocks like that; a skip link before
49489
+ * every section is one more stop on the way, not one less.
49490
+ *
49491
+ * Without href it moves focus to the first rendered element after the skip
49492
+ * link, so the next Tab lands on the first link or button in it. An element
49493
+ * that is not rendered, such as a `<noscript>`, a `<script>` or anything
49494
+ * hidden, is passed over. Make sure a rendered element follows the component,
49495
+ * otherwise the skip link has no effect.
49496
+ *
49497
+ * With an `href` that points at an id on the same page, the link scrolls to
49498
+ * that element and moves focus to it too. The target needs no `tabindex` of
49499
+ * its own. An href to another page is left to the browser.
49500
+ *
49501
+ * The component cannot know what it skips, so its default text only says
49502
+ * "Sla over". Name it with `text`: "Sla navigatie over", "Sla filters over".
49160
49503
  *
49161
49504
  * @element nldd-skip-link
49162
- * @attr {string} text - Text of the skip link. Falls back to the i18n default.
49163
- * @attr {string} href - Optional external target id. Without href it jumps to the end of its own content.
49505
+ * @attr {string} text - Text of the skip link. Name what is skipped. Falls back to the i18n default.
49506
+ * @attr {string} href - Optional external target id. Without href it jumps to the first rendered element after the skip link.
49164
49507
  *
49165
49508
  * @slot - Content that can be skipped
49166
49509
  */
@@ -49170,21 +49513,97 @@ var _NLDDSkipLink = class NLDDSkipLink extends withTranslations(LitElement, nldd
49170
49513
  this.text = "";
49171
49514
  this.href = "";
49172
49515
  this._handleClick = () => {
49173
- const next = this.nextElementSibling;
49174
- if (next) {
49175
- if (!next.hasAttribute("tabindex")) {
49176
- next.setAttribute("tabindex", "-1");
49177
- next.addEventListener("blur", () => {
49178
- next.removeAttribute("tabindex");
49179
- }, { once: true });
49180
- }
49181
- next.focus();
49182
- }
49516
+ const next = this._target();
49517
+ if (!next) return;
49518
+ this._focus(next);
49519
+ };
49520
+ this._handleLinkClick = (event) => {
49521
+ const hash = this._samePageHash();
49522
+ if (!hash) return;
49523
+ if (event && (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)) return;
49524
+ let id = hash.slice(1);
49525
+ try {
49526
+ id = decodeURIComponent(id);
49527
+ } catch {}
49528
+ const target = this.getRootNode().getElementById?.(id) ?? document.getElementById(id);
49529
+ if (!target) return;
49530
+ clearTimeout(this._focusTimer);
49531
+ this._focusTimer = setTimeout(() => this._focus(target));
49183
49532
  };
49184
49533
  }
49185
49534
  get _text() {
49186
49535
  return this.text || this._t("components.skip-link.action");
49187
49536
  }
49537
+ /**
49538
+ * The fragment of an href that stays on this page, or an empty string. An
49539
+ * absolute URL to the page you are on counts too: a router or a CMS writes
49540
+ * `/pagina#inhoud` as readily as `#inhoud`.
49541
+ */
49542
+ _samePageHash() {
49543
+ try {
49544
+ const url = new URL(this.href, location.href);
49545
+ return url.origin === location.origin && url.pathname === location.pathname && url.search === location.search ? url.hash : "";
49546
+ } catch {
49547
+ return "";
49548
+ }
49549
+ }
49550
+ disconnectedCallback() {
49551
+ super.disconnectedCallback();
49552
+ clearTimeout(this._focusTimer);
49553
+ }
49554
+ /**
49555
+ * Focuses the target and leaves it as it was once focus moves on.
49556
+ *
49557
+ * The tabindex is 0 and not -1, also when the target came with a -1 of its
49558
+ * own. WebKit skips everything inside a shadow host that has a negative
49559
+ * tabindex, slotted content included, so with -1 on an nldd-* section the
49560
+ * next Tab left the page instead of reaching the first link in it.
49561
+ */
49562
+ _focus(target) {
49563
+ this._restoreTarget?.();
49564
+ const previous = target.getAttribute("tabindex");
49565
+ const restore = () => {
49566
+ target.removeEventListener("blur", restore);
49567
+ if (this._restoreTarget === restore) this._restoreTarget = void 0;
49568
+ if (previous === null) target.removeAttribute("tabindex");
49569
+ else target.setAttribute("tabindex", previous);
49570
+ };
49571
+ this._restoreTarget = restore;
49572
+ target.setAttribute("tabindex", "0");
49573
+ target.addEventListener("blur", restore);
49574
+ target.focus();
49575
+ if (target.getRootNode().activeElement !== target) restore();
49576
+ }
49577
+ /**
49578
+ * The first following sibling that is rendered. `focus()` does nothing on
49579
+ * an element without a box, and a `<noscript>` or a hidden element sitting
49580
+ * between the skip link and the content left the button dead.
49581
+ */
49582
+ _target() {
49583
+ let next = this.nextElementSibling;
49584
+ while (next) {
49585
+ const rendered = this._rendered(next);
49586
+ if (rendered) return rendered;
49587
+ next = next.nextElementSibling;
49588
+ }
49589
+ return null;
49590
+ }
49591
+ /**
49592
+ * The element itself when it has a box and can take focus. A `display:
49593
+ * contents` wrapper has no box, yet its children are on screen, so the
49594
+ * first rendered one of those stands in for it. An element that is
49595
+ * `visibility: hidden` or inert does have a box and still refuses focus.
49596
+ */
49597
+ _rendered(el) {
49598
+ if (!(el instanceof HTMLElement)) return null;
49599
+ if (el.getClientRects().length > 0) return getComputedStyle(el).visibility !== "hidden" && !el.closest("[inert]") ? el : null;
49600
+ if (getComputedStyle(el).display !== "contents") return null;
49601
+ for (const child of el.children) {
49602
+ const rendered = this._rendered(child);
49603
+ if (rendered) return rendered;
49604
+ }
49605
+ return null;
49606
+ }
49188
49607
  render() {
49189
49608
  return template$2(this);
49190
49609
  }
@@ -49345,7 +49764,14 @@ var topNavigationBarStyles = css`
49345
49764
  }
49346
49765
  }
49347
49766
 
49767
+ .top-navigation-bar__logo > span {
49768
+ display: block;
49769
+ width: 100%;
49770
+ height: 100%;
49771
+ }
49772
+
49348
49773
  .top-navigation-bar__logo svg {
49774
+ display: block;
49349
49775
  width: 100%;
49350
49776
  height: 100%;
49351
49777
  }
@@ -49801,6 +50227,13 @@ var nlddTopNavigationBarTranslations = {
49801
50227
  * the global navigation and the utility navigation. On narrow widths the global
49802
50228
  * navigation moves into a menu sheet behind the menu button.
49803
50229
  *
50230
+ * The top bar of a website, and of nothing else: put it in the `header` slot
50231
+ * of an `nldd-page`. Do not combine it with a split view. A split view is the
50232
+ * layout of an application, whose panes carry a bar of their own, usually an
50233
+ * `nldd-toolbar`, and a site header above it gives a second layer of
50234
+ * navigation and a second thing that scrolls. Does a page need a sidebar under
50235
+ * this bar, use an `nldd-sidebar-section` inside that `nldd-page`.
50236
+ *
49804
50237
  * @element nldd-top-navigation-bar
49805
50238
  *
49806
50239
  * @attr {boolean} no-logo - Hides the whole logo bar, wordmark included.
@@ -50084,6 +50517,8 @@ var _NLDDTopNavigationBar = class NLDDTopNavigationBar extends withTranslations(
50084
50517
  page.appendChild(titleBar);
50085
50518
  const section = document.createElement("nldd-simple-section");
50086
50519
  this._globalMenuSheetList = document.createElement("nldd-list");
50520
+ this._globalMenuSheetList.setAttribute("type", "navigation");
50521
+ this._globalMenuSheetList.setAttribute("aria-label", this._getSlottedMenuBar(this._globalSlot)?.getAttribute("accessible-label") || this._t("components.top-navigation-bar.global-menu-bar-label"));
50087
50522
  this._globalMenuSheetList.setAttribute("appearance", "simple");
50088
50523
  this._globalMenuSheetList.setAttribute("dividers", "never");
50089
50524
  section.appendChild(this._globalMenuSheetList);
@@ -50110,6 +50545,7 @@ var _NLDDTopNavigationBar = class NLDDTopNavigationBar extends withTranslations(
50110
50545
  text: item.text,
50111
50546
  href: sanitizeUrl(item.href) ?? "",
50112
50547
  selected: item.current,
50548
+ currentType: item.currentType,
50113
50549
  submenu: item.querySelector(":scope > nldd-menu"),
50114
50550
  activate: () => item.click()
50115
50551
  }));
@@ -50168,6 +50604,7 @@ var _NLDDTopNavigationBar = class NLDDTopNavigationBar extends withTranslations(
50168
50604
  });
50169
50605
  }
50170
50606
  if (entry.selected) listItem.setAttribute("selected", "");
50607
+ if (entry.currentType) listItem.setAttribute("current-type", entry.currentType);
50171
50608
  if (focusOpenerText !== void 0 && entry.text === focusOpenerText) openerItem = listItem;
50172
50609
  list.appendChild(listItem);
50173
50610
  }
@@ -50292,19 +50729,83 @@ var tabBarStyles = css`
50292
50729
  justify-content: center;
50293
50730
  }
50294
50731
 
50295
- .tab-bar__items {
50296
- display: grid;
50732
+ .tab-bar__box {
50733
+ display: flex;
50297
50734
  position: relative;
50298
50735
  border-radius: var(--_tab-bar-corner-radius);
50299
50736
  background-color: var(--semantics-buttons-neutral-tinted-background-color);
50300
50737
  min-width: 0;
50738
+ align-items: center;
50739
+ gap: var(--_tab-bar-gap);
50740
+ }
50741
+
50742
+ .tab-bar__items {
50743
+ display: grid;
50744
+ min-width: 0;
50301
50745
  grid-auto-flow: column;
50302
50746
  grid-auto-columns: auto;
50303
50747
  align-items: center;
50304
50748
  gap: var(--_tab-bar-gap);
50305
50749
  }
50306
50750
 
50307
- .tab-bar__items::after {
50751
+ .tab-bar__overflow-button {
50752
+ flex-shrink: 0;
50753
+ }
50754
+
50755
+ .tab-bar__overflow-button[hidden] {
50756
+ display: none;
50757
+ }
50758
+
50759
+ ::slotted(nldd-tab-bar-item[data-overflow]) {
50760
+ display: none;
50761
+ }
50762
+
50763
+ :host([data-overflowing]) {
50764
+ display: block;
50765
+ width: 100%;
50766
+ }
50767
+
50768
+ :host([data-overflowing]) .tab-bar__box {
50769
+ flex-grow: 1;
50770
+ }
50771
+
50772
+ :host([data-overflowing]) .tab-bar__items {
50773
+ display: flex;
50774
+ flex-grow: 1;
50775
+ }
50776
+
50777
+ :host([data-overflowing]) ::slotted(nldd-tab-bar-item) {
50778
+ min-width: 0;
50779
+ flex-grow: var(--_tab-bar-item-natural-width);
50780
+ flex-shrink: 1;
50781
+ flex-basis: calc(var(--_tab-bar-item-natural-width) * 1px);
50782
+ }
50783
+
50784
+ /* Measuring: the bar at the full width it may take, every tab at the width
50785
+ its content wants, the overflow button present. Never painted. */
50786
+ :host([data-measuring]) {
50787
+ display: block;
50788
+ width: 100%;
50789
+ }
50790
+
50791
+ :host([hidden]) {
50792
+ display: none;
50793
+ }
50794
+
50795
+ :host([data-measuring]) .tab-bar__items {
50796
+ display: grid;
50797
+ grid-auto-columns: max-content;
50798
+ }
50799
+
50800
+ :host([data-measuring]) ::slotted(nldd-tab-bar-item[data-overflow]) {
50801
+ display: inline-block;
50802
+ }
50803
+
50804
+ :host([data-measuring]) .tab-bar__overflow-button[hidden] {
50805
+ display: block;
50806
+ }
50807
+
50808
+ .tab-bar__box::after {
50308
50809
  content: '';
50309
50810
  position: absolute;
50310
50811
  inset: 0;
@@ -50341,6 +50842,7 @@ var tabBarItemStyles = css`
50341
50842
  --_tab-bar-item-icon-size: var(--semantics-buttons-md-icon-size);
50342
50843
  --_tab-bar-item-highlight-border-color: transparent;
50343
50844
  --_tab-bar-item-content-z-index: 1;
50845
+ --_tab-bar-item-natural-width: 0;
50344
50846
 
50345
50847
  ${inheritedTextReset}
50346
50848
  display: inline-block;
@@ -50523,11 +51025,40 @@ function tabBarTemplate(component) {
50523
51025
  const label = component.accessibleLabel || "Tabs";
50524
51026
  const isNavigation = component.navigation;
50525
51027
  const itemsContainer = html`
50526
- <div class="tab-bar__items"
50527
- role=${isNavigation ? nothing : "tablist"}
50528
- aria-label=${isNavigation ? nothing : label}
50529
- >
50530
- <slot @slotchange=${component._onSlotChange}></slot>
51028
+ <div class="tab-bar__box">
51029
+ <div class="tab-bar__items"
51030
+ role=${isNavigation ? nothing : "tablist"}
51031
+ aria-label=${isNavigation ? nothing : label}
51032
+ >
51033
+ <slot @slotchange=${component._onSlotChange}></slot>
51034
+ </div>
51035
+ <div class="tab-bar__overflow-button"
51036
+ ?hidden=${component._overflowItems.length === 0}
51037
+ >
51038
+ <nldd-icon-button
51039
+ appearance="neutral-tinted"
51040
+ no-highlight-border
51041
+ icon="ellipsis"
51042
+ text=${component._t("components.tab-bar.overflow-action")}
51043
+ size=${component.size}
51044
+ ?hide-lg-text=${component.variant !== "icon-and-text"}
51045
+ ?disabled=${component.disabled}
51046
+ >
51047
+ <nldd-menu
51048
+ slot="popup"
51049
+ placement="bottom-end"
51050
+ >
51051
+ ${component._overflowItems.map((item) => html`
51052
+ <nldd-menu-item
51053
+ text=${item.text}
51054
+ icon=${item.icon || nothing}
51055
+ href=${sanitizeUrl(item.href) || nothing}
51056
+ @select=${(event) => component._selectFromOverflow(event, item)}
51057
+ ></nldd-menu-item>
51058
+ `)}
51059
+ </nldd-menu>
51060
+ </nldd-icon-button>
51061
+ </div>
50531
51062
  </div>
50532
51063
  `;
50533
51064
  if (isNavigation) return html`
@@ -50590,6 +51121,9 @@ function tabBarItemTemplate(component) {
50590
51121
  return result;
50591
51122
  }
50592
51123
  //#endregion
51124
+ //#region src/components/navigation/tab-bar/tab-bar.i18n.ts
51125
+ var nlddTabBarTranslations = { "components.tab-bar.overflow-action": "Meer tabs" };
51126
+ //#endregion
50593
51127
  //#region src/components/navigation/tab-bar/tab-bar.ts
50594
51128
  /**
50595
51129
  * Nederlandse Digitale Dienst Tab Bar Component (Lit + TypeScript)
@@ -50597,6 +51131,19 @@ function tabBarItemTemplate(component) {
50597
51131
  * A horizontal navigation bar with mutually exclusive tabs.
50598
51132
  * Exports both NLDDTabBar and NLDDTabBarItem.
50599
51133
  *
51134
+ * When the tabs do not fit, the ones that do not fit go behind a "Meer tabs"
51135
+ * button at the end, in a menu. The current tab always stays in the bar: if it
51136
+ * would fall in the part that does not fit, another tab goes to the menu in its
51137
+ * place. While tabs are in the menu, the bar fills its container and the tabs in
51138
+ * it share the width in proportion to their own. Choosing a tab in the bar
51139
+ * changes nothing about what is shown; choosing one from the menu swaps it with
51140
+ * the last tab in the bar, so the bar does not jump. `centered` has no effect
51141
+ * then. In an nldd-toolbar the other items go to the toolbar's menu first, by
51142
+ * their priority; when it is the bar's turn, it narrows down to the current tab
51143
+ * beside its button, and only then moves into the toolbar's menu as a whole.
51144
+ * Tabs are hidden, never moved, so a framework that renders them finds
51145
+ * them where it put them. Only a tab that does not fit on its own is cut off.
51146
+ *
50600
51147
  * @element nldd-tab-bar
50601
51148
  * @attr {string} variant - Visual mode: 'icon-and-text' | 'text' | 'icon'. When unset, the variant is inferred from each item's content. Drives the layout at every size.
50602
51149
  * @attr {string} size - Size: 'md' | 'lg' (default: 'md'). 'lg' enlarges the touch target; the per-variant layout is preserved (icon-and-text stacks the icon over the text, text renders large text, icon renders a larger icon-only control).
@@ -50604,6 +51151,7 @@ function tabBarItemTemplate(component) {
50604
51151
  * @attr {boolean} disabled - Disables the whole bar: dims it, blocks pointer interaction, and takes the tabs out of the tab order
50605
51152
  * @attr {boolean} centered - Centers the tabs in the container (host fills the row, tabs group in the middle)
50606
51153
  * @attr {string} accessible-label - Accessible name for the navigation region; defaults to 'Tabs'
51154
+ * @attr {object} translations - Override translation keys (e.g. the overflow button label); unset keys fall back to Dutch.
50607
51155
  *
50608
51156
  * @slot - nldd-tab-bar-item elements
50609
51157
  *
@@ -50702,7 +51250,7 @@ __decorate([state()], NLDDTabBarItem.prototype, "_navigation", void 0);
50702
51250
  __decorate([state()], NLDDTabBarItem.prototype, "_isFallbackFocusable", void 0);
50703
51251
  __decorate([state()], NLDDTabBarItem.prototype, "_groupDisabled", void 0);
50704
51252
  NLDDTabBarItem = __decorate([customElement("nldd-tab-bar-item")], NLDDTabBarItem);
50705
- var NLDDTabBar = (_NLDDTabBar = class NLDDTabBar extends LitElement {
51253
+ var NLDDTabBar = (_NLDDTabBar = class NLDDTabBar extends withTranslations(LitElement, nlddTabBarTranslations) {
50706
51254
  constructor(..._args2) {
50707
51255
  super(..._args2);
50708
51256
  this.centered = false;
@@ -50712,21 +51260,31 @@ var NLDDTabBar = (_NLDDTabBar = class NLDDTabBar extends LitElement {
50712
51260
  this.disabled = false;
50713
51261
  this.accessibleLabel = "";
50714
51262
  this._hasCustomLabel = false;
51263
+ this._overflowItems = [];
51264
+ this._resizeObserver = null;
51265
+ this._itemObserver = null;
51266
+ this._overflowFrame = null;
51267
+ this._onlyCurrentChanged = true;
51268
+ this._scheduleOverflow = (full = true) => {
51269
+ if (full) this._onlyCurrentChanged = false;
51270
+ if (this._overflowFrame) return;
51271
+ this._overflowFrame = requestAnimationFrame(() => {
51272
+ this._overflowFrame = null;
51273
+ const swapOnly = this._onlyCurrentChanged;
51274
+ this._onlyCurrentChanged = true;
51275
+ this._updateOverflow(swapOnly);
51276
+ });
51277
+ };
51278
+ this._onItemsMutated = (records) => {
51279
+ this._scheduleOverflow(records.some((record) => record.attributeName !== "current"));
51280
+ };
50715
51281
  this._handleItemSelect = (event) => {
50716
51282
  event.stopPropagation();
50717
- if (this.disabled) return;
50718
- if (!this.navigation) this._getItems().forEach((item) => {
50719
- item.current = item === event.detail.item;
50720
- });
50721
- this.dispatchEvent(new CustomEvent("tabchange", {
50722
- bubbles: true,
50723
- composed: true,
50724
- detail: event.detail
50725
- }));
51283
+ this._activate(event.detail.item);
50726
51284
  };
50727
51285
  this._handleKeyDown = (event) => {
50728
51286
  if (this.disabled) return;
50729
- const items = this._getItems();
51287
+ const items = this._getItems().filter((item) => !item.hasAttribute("data-overflow"));
50730
51288
  if (items.length === 0) return;
50731
51289
  const currentIndex = items.findIndex((item) => item === event.target || item.contains(event.target));
50732
51290
  let newIndex = -1;
@@ -50768,18 +51326,162 @@ var NLDDTabBar = (_NLDDTabBar = class NLDDTabBar extends LitElement {
50768
51326
  super.connectedCallback();
50769
51327
  this.addEventListener("select", this._handleItemSelect);
50770
51328
  this.addEventListener("keydown", this._handleKeyDown);
51329
+ this._resizeObserver = new ResizeObserver(() => this._scheduleOverflow());
51330
+ this._resizeObserver.observe(this);
51331
+ if (this.parentElement) this._resizeObserver.observe(this.parentElement);
51332
+ this._itemObserver = new MutationObserver(this._onItemsMutated);
51333
+ this._itemObserver.observe(this, {
51334
+ subtree: true,
51335
+ attributes: true,
51336
+ attributeFilter: [
51337
+ "text",
51338
+ "icon",
51339
+ "current",
51340
+ "variant",
51341
+ "size"
51342
+ ]
51343
+ });
51344
+ document.fonts?.ready.then(() => this._scheduleOverflow());
50771
51345
  }
50772
51346
  disconnectedCallback() {
50773
51347
  super.disconnectedCallback();
50774
51348
  this.removeEventListener("select", this._handleItemSelect);
50775
51349
  this.removeEventListener("keydown", this._handleKeyDown);
51350
+ this._resizeObserver?.disconnect();
51351
+ this._resizeObserver = null;
51352
+ this._itemObserver?.disconnect();
51353
+ this._itemObserver = null;
51354
+ if (this._overflowFrame) cancelAnimationFrame(this._overflowFrame);
51355
+ this._overflowFrame = null;
51356
+ }
51357
+ /** Widths as the content wants them, and the room there is for them. */
51358
+ _measure() {
51359
+ const items = this._getItems();
51360
+ const row = this.shadowRoot?.querySelector(".tab-bar");
51361
+ const list = this.shadowRoot?.querySelector(".tab-bar__items");
51362
+ const button = this.shadowRoot?.querySelector(".tab-bar__overflow-button");
51363
+ if (!row || !list || !button || items.length === 0) return null;
51364
+ this.toggleAttribute("data-measuring", true);
51365
+ const available = row.clientWidth;
51366
+ const widths = items.map((item) => item.getBoundingClientRect().width);
51367
+ const gap = parseFloat(getComputedStyle(list).columnGap) || 0;
51368
+ const buttonWidth = button.getBoundingClientRect().width;
51369
+ this.removeAttribute("data-measuring");
51370
+ return {
51371
+ items,
51372
+ available,
51373
+ widths,
51374
+ gap,
51375
+ budget: available - buttonWidth - gap
51376
+ };
51377
+ }
51378
+ /**
51379
+ * @internal Read by nldd-toolbar, which gives an item holding this bar the
51380
+ * room to show every tab, and lets it narrow down to the current tab beside
51381
+ * the overflow button before the whole bar goes into the toolbar's menu.
51382
+ */
51383
+ _toolbarWidths() {
51384
+ const measured = this._measure();
51385
+ if (!measured) return null;
51386
+ const { items, available, widths, gap, budget } = measured;
51387
+ const preferred = widths.reduce((sum, w) => sum + w, 0) + gap * (items.length - 1);
51388
+ if (items.length < 2) return {
51389
+ preferred,
51390
+ minimum: preferred
51391
+ };
51392
+ const current = Math.max(items.findIndex((item) => item.current), 0);
51393
+ const buttonWidth = available - budget - gap;
51394
+ return {
51395
+ preferred,
51396
+ minimum: Math.min(preferred, widths[current] + gap + buttonWidth)
51397
+ };
51398
+ }
51399
+ /**
51400
+ * Decides which tabs stay in the bar and which go to the menu.
51401
+ *
51402
+ * Measured with the bar at the full width of its container and every tab at
51403
+ * the width its content wants, all before the next paint.
51404
+ *
51405
+ * The set only changes when it has to. A different current tab that is
51406
+ * already in the bar changes nothing; one picked from the menu swaps places
51407
+ * with the last tab in the bar, so a single slot changes. Only a change in
51408
+ * the room or the content chooses the whole set again: the current tab
51409
+ * first, then the others in order, for as long as they fit next to the
51410
+ * overflow button. Tabs stay where they are in the DOM and are only hidden.
51411
+ */
51412
+ _updateOverflow(swapOnly = false) {
51413
+ const measured = this._measure();
51414
+ if (!measured) {
51415
+ this._applyOverflow(this._getItems(), /* @__PURE__ */ new Set(), []);
51416
+ return;
51417
+ }
51418
+ const { items, available, widths, gap, budget } = measured;
51419
+ const width = (shown) => [...shown].reduce((sum, i) => sum + widths[i], 0) + gap * Math.max(shown.size - 1, 0);
51420
+ if (widths.reduce((sum, w) => sum + w, 0) + gap * (items.length - 1) <= available) {
51421
+ this._applyOverflow(items, /* @__PURE__ */ new Set(), widths);
51422
+ return;
51423
+ }
51424
+ const current = items.findIndex((item) => item.current);
51425
+ const previous = new Set(items.map((item, i) => item.hasAttribute("data-overflow") ? -1 : i).filter((i) => i >= 0));
51426
+ let shown;
51427
+ if (swapOnly && this._overflowItems.length > 0 && previous.size > 0) {
51428
+ shown = new Set(previous);
51429
+ if (current >= 0 && !shown.has(current)) {
51430
+ const last = [...shown].filter((i) => i !== current).pop();
51431
+ if (last !== void 0) shown.delete(last);
51432
+ shown.add(current);
51433
+ }
51434
+ while (shown.size > 1 && width(shown) > budget) {
51435
+ const last = [...shown].sort((x, y) => x - y).filter((i) => i !== current).pop();
51436
+ if (last === void 0) break;
51437
+ shown.delete(last);
51438
+ }
51439
+ } else {
51440
+ shown = /* @__PURE__ */ new Set();
51441
+ if (current >= 0) shown.add(current);
51442
+ for (let i = 0; i < items.length; i++) {
51443
+ if (i === current) continue;
51444
+ const next = new Set(shown).add(i);
51445
+ if (width(next) > budget) break;
51446
+ shown = next;
51447
+ }
51448
+ if (shown.size === 0) shown.add(0);
51449
+ }
51450
+ this._applyOverflow(items, new Set(items.map((_, i) => i).filter((i) => !shown.has(i))), widths);
51451
+ }
51452
+ /**
51453
+ * Hides the tabs that go to the menu. With an overflow the bar fills its
51454
+ * container and the tabs left in it share the room in proportion to the
51455
+ * width they want, so the bar's edge and the overflow button stay put.
51456
+ */
51457
+ _applyOverflow(items, overflowed, widths) {
51458
+ const overflowing = overflowed.size > 0;
51459
+ this.toggleAttribute("data-overflowing", overflowing);
51460
+ items.forEach((item, i) => {
51461
+ item.toggleAttribute("data-overflow", overflowed.has(i));
51462
+ if (overflowing && widths[i]) item.style.setProperty("--_tab-bar-item-natural-width", String(widths[i]));
51463
+ else item.style.removeProperty("--_tab-bar-item-natural-width");
51464
+ });
51465
+ const next = items.filter((_, i) => overflowed.has(i));
51466
+ if (next.length !== this._overflowItems.length || next.some((item, i) => item !== this._overflowItems[i])) {
51467
+ this._overflowItems = next;
51468
+ this._syncItems();
51469
+ }
51470
+ }
51471
+ /** @internal A tab picked from the overflow menu. */
51472
+ _selectFromOverflow(event, item) {
51473
+ event.stopPropagation();
51474
+ this._activate(item);
50776
51475
  }
50777
51476
  firstUpdated() {
50778
51477
  this._hasCustomLabel = Boolean(this.accessibleLabel);
50779
51478
  this._syncItems();
50780
51479
  }
50781
51480
  updated(changedProperties) {
50782
- if (changedProperties.has("variant") || changedProperties.has("size") || changedProperties.has("navigation") || changedProperties.has("disabled")) this._syncItems();
51481
+ if (changedProperties.has("variant") || changedProperties.has("size") || changedProperties.has("navigation") || changedProperties.has("disabled")) {
51482
+ this._syncItems();
51483
+ this._scheduleOverflow();
51484
+ }
50783
51485
  }
50784
51486
  _getItems() {
50785
51487
  const slot = this.shadowRoot?.querySelector("slot");
@@ -50795,13 +51497,26 @@ var NLDDTabBar = (_NLDDTabBar = class NLDDTabBar extends LitElement {
50795
51497
  item._groupDisabled = this.disabled;
50796
51498
  });
50797
51499
  const hasCurrent = items.some((item) => item.current);
50798
- const firstItem = items[0] ?? null;
51500
+ const firstItem = items.find((item) => !item.hasAttribute("data-overflow")) ?? null;
50799
51501
  items.forEach((item) => {
50800
51502
  item._isFallbackFocusable = !hasCurrent && item === firstItem;
50801
51503
  });
50802
51504
  }
50803
51505
  _onSlotChange() {
50804
51506
  this._syncItems();
51507
+ this._scheduleOverflow();
51508
+ }
51509
+ /** Makes a tab current (unless the bar navigates) and fires `tabchange`. */
51510
+ _activate(item) {
51511
+ if (this.disabled) return;
51512
+ if (!this.navigation) this._getItems().forEach((other) => {
51513
+ other.current = other === item;
51514
+ });
51515
+ this.dispatchEvent(new CustomEvent("tabchange", {
51516
+ bubbles: true,
51517
+ composed: true,
51518
+ detail: { item }
51519
+ }));
50805
51520
  }
50806
51521
  render() {
50807
51522
  return tabBarTemplate(this);
@@ -50831,6 +51546,7 @@ __decorate([property({
50831
51546
  type: String,
50832
51547
  attribute: "accessible-label"
50833
51548
  })], NLDDTabBar.prototype, "accessibleLabel", void 0);
51549
+ __decorate([state()], NLDDTabBar.prototype, "_overflowItems", void 0);
50834
51550
  NLDDTabBar = __decorate([customElement("nldd-tab-bar")], NLDDTabBar);
50835
51551
  //#endregion
50836
51552
  //#region src/components/navigation/document-tab-bar/document-tab-bar.styles.ts
@@ -50851,6 +51567,9 @@ var documentTabBarStyles = css`
50851
51567
  --_document-tab-bar-drag-clone-z-index: 100;
50852
51568
  --_document-tab-bar-short-text-threshold: 200px;
50853
51569
  --_document-tab-bar-item-min-width: 100px;
51570
+ --_document-tab-bar-held-item-width: auto;
51571
+ --_document-tab-bar-release-duration: var(--primitives-transition-duration-medium);
51572
+ --_document-tab-bar-release-easing: var(--primitives-transition-easing-default);
50854
51573
  --_document-tab-bar-overflow-button-reserve: 52px; /* Used for overflowButtonReserve. Overflow button width + spacing */
50855
51574
  --_document-tab-bar-dismiss-button-is-hovered-background-color: light-dark(var(--primitives-color-neutral-150), var(--primitives-color-neutral-250));
50856
51575
  --_document-tab-bar-dismiss-button-is-active-background-color: light-dark(var(--primitives-color-neutral-200), var(--primitives-color-neutral-300));
@@ -50900,6 +51619,22 @@ var documentTabBarStyles = css`
50900
51619
  flex-basis: 0;
50901
51620
  }
50902
51621
 
51622
+ :host([data-holding-widths]) ::slotted(nldd-document-tab-bar-item) {
51623
+ flex-grow: 0;
51624
+ flex-shrink: 0;
51625
+ flex-basis: var(--_document-tab-bar-held-item-width);
51626
+ }
51627
+
51628
+ :host([data-releasing-widths]) ::slotted(nldd-document-tab-bar-item) {
51629
+ transition: flex-basis var(--_document-tab-bar-release-duration) var(--_document-tab-bar-release-easing);
51630
+ }
51631
+
51632
+ @media (prefers-reduced-motion: reduce) {
51633
+ :host([data-releasing-widths]) ::slotted(nldd-document-tab-bar-item) {
51634
+ transition: none;
51635
+ }
51636
+ }
51637
+
50903
51638
  ::slotted(nldd-document-tab-bar-item[hidden]) {
50904
51639
  display: none;
50905
51640
  }
@@ -50908,12 +51643,12 @@ var documentTabBarStyles = css`
50908
51643
  flex-grow: 0;
50909
51644
  }
50910
51645
 
50911
- .document-tab-bar__overflow {
51646
+ .document-tab-bar__overflow-button {
50912
51647
  flex-grow: 0;
50913
51648
  flex-shrink: 0;
50914
51649
  }
50915
51650
 
50916
- .document-tab-bar__overflow.is-hidden {
51651
+ .document-tab-bar__overflow-button.is-hidden {
50917
51652
  display: none;
50918
51653
  }
50919
51654
 
@@ -51300,7 +52035,7 @@ function documentTabBarTemplate(component) {
51300
52035
  <slot @slotchange=${component._onSlotChange}></slot>
51301
52036
  </div>
51302
52037
  <div class=${classMap({
51303
- "document-tab-bar__overflow": true,
52038
+ "document-tab-bar__overflow-button": true,
51304
52039
  "is-hidden": !hasOverflow
51305
52040
  })}>
51306
52041
  <nldd-icon-button
@@ -51419,13 +52154,27 @@ var nlddDocumentTabBarTranslations = {
51419
52154
  * Use `translations` property instead: `.translations=${{ 'components.document-tab-bar.overflow-action': 'Tabs' }}`
51420
52155
  * @attr {boolean} navigation - Renders a nav landmark instead of tablist; use when items have hrefs
51421
52156
  *
52157
+ * The tabs can always be put in another order: drag one, or move the focused
52158
+ * tab with Shift+Arrow left or right. The bar moves the element itself and
52159
+ * fires `nldd-reorder` with where it came from and where it went.
52160
+ *
52161
+ * Closing a tab with the pointer leaves the other tabs at the width they had,
52162
+ * so the close button of the next one slides in under the pointer and a row
52163
+ * of tabs closes with one click after another. A tab that comes back out of
52164
+ * the overflow takes the same width, and when the overflow button goes away
52165
+ * it leaves room at the end. Once the pointer leaves the bar the tabs grow
52166
+ * into the space again, at once for anyone who asks for reduced motion.
52167
+ * Closing the last tab of the row, with none left in the overflow, lets them
52168
+ * grow into the space at once, since no next close button needs to stay in
52169
+ * place. Closing from the keyboard spreads them at once, without the motion.
52170
+ *
51422
52171
  * @slot - nldd-document-tab-bar-item elements
51423
52172
  * @slot end - Action buttons (e.g. new tab)
51424
52173
  *
51425
52174
  * @fires tabchange - Fired when a tab is selected; detail: { item }
51426
52175
  * @fires tabdismiss - Fired when a tab is dismissed; detail: { item, nextItem }
51427
52176
  * @fires tabempty - Fired when the last tab is dismissed
51428
- * @fires nldd-reorder - Fired when tabs are reordered via drag; detail: { fromIndex, toIndex }
52177
+ * @fires nldd-reorder - Fired when a tab is moved, by dragging or with Shift+Arrow; detail: { fromIndex, toIndex }
51429
52178
  *
51430
52179
  * ---
51431
52180
  *
@@ -51539,6 +52288,10 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
51539
52288
  this._menu = null;
51540
52289
  this._resizeObserver = null;
51541
52290
  this._hasCustomLabel = false;
52291
+ this._holding = false;
52292
+ this._releaseOnRemoval = null;
52293
+ this._rowWidth = 0;
52294
+ this._itemsAtHold = /* @__PURE__ */ new Set();
51542
52295
  this._draggingEl = null;
51543
52296
  this._placeholder = null;
51544
52297
  this._currentDropIndex = -1;
@@ -51654,6 +52407,12 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
51654
52407
  dismissedItem.selected = false;
51655
52408
  }
51656
52409
  const isLastItem = items.length === 1;
52410
+ const visible = items.filter((item) => !item.hidden);
52411
+ const closesTheRow = visible[visible.length - 1] === dismissedItem && visible.length === items.length;
52412
+ if (!isLastItem && isPointerMode()) {
52413
+ this._holdWidths(items.filter((item) => item !== dismissedItem));
52414
+ if (closesTheRow) this._releaseOnRemoval = dismissedItem;
52415
+ }
51657
52416
  this.dispatchEvent(new CustomEvent("tabdismiss", {
51658
52417
  bubbles: true,
51659
52418
  composed: true,
@@ -51662,12 +52421,43 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
51662
52421
  nextItem
51663
52422
  }
51664
52423
  }));
52424
+ if (this._releaseOnRemoval && !this._getItems().includes(this._releaseOnRemoval)) {
52425
+ this._releaseOnRemoval = null;
52426
+ this._releaseWidths();
52427
+ }
51665
52428
  if (isLastItem) this.dispatchEvent(new CustomEvent("tabempty", {
51666
52429
  bubbles: true,
51667
52430
  composed: true
51668
52431
  }));
51669
52432
  this._syncFallbackFocusable();
51670
52433
  };
52434
+ this._releaseWidths = () => {
52435
+ this.removeEventListener("pointerleave", this._releaseWidths);
52436
+ this._holding = false;
52437
+ this._itemsAtHold.clear();
52438
+ this._releaseOnRemoval = null;
52439
+ clearTimeout(this._releasingTimer);
52440
+ const from = this.style.getPropertyValue("--_document-tab-bar-held-item-width");
52441
+ const finish = () => {
52442
+ this.removeAttribute("data-holding-widths");
52443
+ this.removeAttribute("data-releasing-widths");
52444
+ this.style.removeProperty("--_document-tab-bar-held-item-width");
52445
+ this._calculateOverflow();
52446
+ };
52447
+ const row = this.shadowRoot?.querySelector(".document-tab-bar__items");
52448
+ const count = this._getVisibleItems().length;
52449
+ const gap = row ? parseFloat(getComputedStyle(row).columnGap) || 0 : 0;
52450
+ const to = row && count ? (row.clientWidth - gap * (count - 1)) / count : 0;
52451
+ const duration = parseFloat(getComputedStyle(this).getPropertyValue("--_document-tab-bar-release-duration")) || 0;
52452
+ const reduced = matchMedia("(prefers-reduced-motion: reduce)").matches;
52453
+ if (!from || !to || !duration || reduced) {
52454
+ finish();
52455
+ return;
52456
+ }
52457
+ this.toggleAttribute("data-releasing-widths", true);
52458
+ this.style.setProperty("--_document-tab-bar-held-item-width", `${to}px`);
52459
+ this._releasingTimer = setTimeout(finish, duration + 50);
52460
+ };
51671
52461
  this._handleKeyDown = (event) => {
51672
52462
  const path = event.composedPath();
51673
52463
  const item = path.find((el) => el instanceof Element && el.tagName.toLowerCase() === "nldd-document-tab-bar-item");
@@ -51752,6 +52542,14 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
51752
52542
  this.removeEventListener("dismiss", this._handleItemDismiss);
51753
52543
  this.removeEventListener("keydown", this._handleKeyDown);
51754
52544
  this.removeEventListener("pointerdown", this._onPointerDown);
52545
+ this.removeEventListener("pointerleave", this._releaseWidths);
52546
+ this._itemsAtHold.clear();
52547
+ this._releaseOnRemoval = null;
52548
+ clearTimeout(this._releasingTimer);
52549
+ this.removeAttribute("data-holding-widths");
52550
+ this.removeAttribute("data-releasing-widths");
52551
+ this.style.removeProperty("--_document-tab-bar-held-item-width");
52552
+ this._holding = false;
51755
52553
  this._menu?.remove();
51756
52554
  this._menu = null;
51757
52555
  this._resizeObserver?.disconnect();
@@ -51763,7 +52561,13 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
51763
52561
  if (!this._hasCustomLabel) {}
51764
52562
  const container = this.shadowRoot?.querySelector(".document-tab-bar__items");
51765
52563
  if (container) {
51766
- this._resizeObserver = new ResizeObserver(() => this._calculateOverflow());
52564
+ this._rowWidth = this.clientWidth;
52565
+ this._resizeObserver = new ResizeObserver(() => {
52566
+ const width = this.clientWidth;
52567
+ if (this._holding && width !== this._rowWidth) this._releaseWidths();
52568
+ this._rowWidth = width;
52569
+ this._calculateOverflow();
52570
+ });
51767
52571
  this._resizeObserver.observe(container);
51768
52572
  }
51769
52573
  this._syncMenuAnchor();
@@ -51810,6 +52614,11 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
51810
52614
  wrapper.hidden = slot.assignedElements().length === 0;
51811
52615
  }
51812
52616
  _onSlotChange() {
52617
+ if (this._releaseOnRemoval && !this._getItems().includes(this._releaseOnRemoval)) {
52618
+ this._releaseOnRemoval = null;
52619
+ this._releaseWidths();
52620
+ }
52621
+ if (this._holding && this._getItems().some((item) => !this._itemsAtHold.has(item))) this._releaseWidths();
51813
52622
  this._calculateOverflow();
51814
52623
  this._propagateDismissLabel();
51815
52624
  this._syncFallbackFocusable();
@@ -52031,7 +52840,7 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
52031
52840
  }
52032
52841
  _syncMenuAnchor() {
52033
52842
  if (!this._menu) return;
52034
- const button = this.shadowRoot?.querySelector(".document-tab-bar__overflow nldd-icon-button");
52843
+ const button = this.shadowRoot?.querySelector(".document-tab-bar__overflow-button nldd-icon-button");
52035
52844
  if (button) {
52036
52845
  this._menu.anchorElement = button;
52037
52846
  if ("popoverTargetElement" in button) button.popoverTargetElement = this._menu;
@@ -52041,6 +52850,24 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
52041
52850
  _closeMenu() {
52042
52851
  this._menu?.hidePopover();
52043
52852
  }
52853
+ /**
52854
+ * Pins the tabs at the width they have now, so removing one moves the rest
52855
+ * along instead of growing them. One width for the whole bar and not one
52856
+ * per tab: a tab that comes back out of the overflow takes it too, and the
52857
+ * overflow button that disappears leaves room at the end instead of
52858
+ * spreading the tabs. Measured before the consumer removes the closed tab,
52859
+ * which it does in its `tabdismiss` handler.
52860
+ */
52861
+ _holdWidths(items) {
52862
+ if (this._holding) return;
52863
+ const sample = items.find((item) => !item.hidden);
52864
+ if (!sample) return;
52865
+ this.style.setProperty("--_document-tab-bar-held-item-width", `${sample.getBoundingClientRect().width}px`);
52866
+ this.toggleAttribute("data-holding-widths", true);
52867
+ this._holding = true;
52868
+ this._itemsAtHold = new Set(this._getItems());
52869
+ this.addEventListener("pointerleave", this._releaseWidths);
52870
+ }
52044
52871
  render() {
52045
52872
  return documentTabBarTemplate(this);
52046
52873
  }
@@ -53741,6 +54568,21 @@ function joinArea(notification, label) {
53741
54568
  area.prepend(notification);
53742
54569
  syncStack(area);
53743
54570
  }
54571
+ /**
54572
+ * Puts a notification that is already in the deck back in front, as if it had
54573
+ * just arrived. For one that was updated: the change is what just happened, and
54574
+ * behind a newer notification nobody would see it.
54575
+ */
54576
+ function bringToFront(notification) {
54577
+ const area = document.getElementById(AREA_ID);
54578
+ if (!area || notification.parentElement !== area) return;
54579
+ if (notifications(area)[0] !== notification) {
54580
+ notification._setMoving?.(true);
54581
+ area.prepend(notification);
54582
+ notification._setMoving?.(false);
54583
+ }
54584
+ syncStack(area);
54585
+ }
53744
54586
  function leaveArea(notification) {
53745
54587
  const area = document.getElementById(AREA_ID);
53746
54588
  if (!area) return;
@@ -53911,6 +54753,21 @@ var nlddNotificationTranslations = {
53911
54753
  * role="status". Focus never moves on its own. Escape dismisses the
53912
54754
  * notification that focus is in.
53913
54755
  *
54756
+ * ## From code
54757
+ * `NLDDNotification.show({ text, supportingText, variant, icon, duration,
54758
+ * actions })` raises a notification without an element to manage: it creates
54759
+ * one, shows it, and removes it once it is dismissed. An action is `{ text,
54760
+ * onClick }`, at most 2, and a click on one also takes the notification away.
54761
+ * It returns a handle with `dismiss()` and `update(options)`. An update changes
54762
+ * the message, puts the notification in front and starts its clock over, so a
54763
+ * status that changes often is one notification that keeps up instead of a new
54764
+ * one sliding in each time; one that has already left arrives again.
54765
+ *
54766
+ * Use `show()` from a framework. Because a notification places itself, an
54767
+ * element that a framework rendered is no longer where that framework left it:
54768
+ * a keyed list (`v-for` with a `:key`) then fails on its next render, and a
54769
+ * removed row leaves its notification on screen.
54770
+ *
53914
54771
  * @element nldd-notification
53915
54772
  *
53916
54773
  * @attr {'neutral'|'accent'|'success'|'warning'|'critical'} variant - What kind of message this is; sets the icon color and the ARIA role (default: 'neutral')
@@ -53922,7 +54779,9 @@ var nlddNotificationTranslations = {
53922
54779
  *
53923
54780
  * @slot actions - At most 2 nldd-button elements, under the text. More than 2 is refused with a DEV warning: a message that needs three choices is a dialog.
53924
54781
  *
53925
- * @fires dismiss - Fired when the notification is dismissed, by the button, by Escape, or by its own clock. The consumer removes it.
54782
+ * @fires dismiss - Fired when the notification is dismissed, by the button, by Escape, or by its own clock. The consumer removes it, unless it was raised with `show()`, which removes it itself.
54783
+ *
54784
+ * @method NLDDNotification.show(options) - Static. Raises a notification from code and returns a handle with `dismiss()` and `update(options)`. See "From code" above.
53926
54785
  */
53927
54786
  var _NLDDNotification;
53928
54787
  var DEFAULT_ICONS = {
@@ -54001,6 +54860,65 @@ var NLDDNotification = (_NLDDNotification = class NLDDNotification extends withT
54001
54860
  get _leavesOnItsOwn() {
54002
54861
  return this.variant !== "critical" && this.duration > 0;
54003
54862
  }
54863
+ /**
54864
+ * Raises a notification from code, and takes it away again when it is
54865
+ * dismissed.
54866
+ *
54867
+ * The way to raise one from a framework. A notification places itself, so
54868
+ * an element a framework rendered is no longer where that framework left
54869
+ * it, and the next render of that list fails. Here nothing owns the
54870
+ * element but the notification itself.
54871
+ */
54872
+ static show(options) {
54873
+ const element = document.createElement("nldd-notification");
54874
+ const dismiss = () => element.remove();
54875
+ element._apply(options, dismiss);
54876
+ element.addEventListener("dismiss", dismiss);
54877
+ document.body.append(element);
54878
+ return {
54879
+ element,
54880
+ dismiss,
54881
+ update: (next) => {
54882
+ element._apply(next, dismiss);
54883
+ if (!element.isConnected) {
54884
+ document.body.append(element);
54885
+ return;
54886
+ }
54887
+ element._restart();
54888
+ bringToFront(element);
54889
+ }
54890
+ };
54891
+ }
54892
+ /** Writes the given options onto the element. Actions replace the ones
54893
+ * that were there; a field that is left out stays as it was. */
54894
+ _apply(options, dismiss) {
54895
+ if (options.text !== void 0) this.text = options.text;
54896
+ if (options.supportingText !== void 0) this.supportingText = options.supportingText;
54897
+ if (options.variant !== void 0) this.variant = options.variant;
54898
+ if (options.icon !== void 0) this.icon = options.icon;
54899
+ if (options.duration !== void 0) this.duration = options.duration;
54900
+ if (options.actions === void 0) return;
54901
+ this.querySelectorAll(":scope > [slot=\"actions\"]").forEach((button) => button.remove());
54902
+ for (const action of options.actions) {
54903
+ const button = document.createElement("nldd-button");
54904
+ button.slot = "actions";
54905
+ button.setAttribute("size", "sm");
54906
+ button.setAttribute("text", action.text);
54907
+ button.addEventListener("click", () => {
54908
+ action.onClick?.();
54909
+ dismiss();
54910
+ });
54911
+ this.append(button);
54912
+ }
54913
+ }
54914
+ /** Starts the clock over with the full duration, for a notification whose
54915
+ * message just changed. */
54916
+ _restart() {
54917
+ if (this._timer !== null) window.clearTimeout(this._timer);
54918
+ this._timer = null;
54919
+ this._remainingDuration = this.duration;
54920
+ this._resumeTimer();
54921
+ }
54004
54922
  connectedCallback() {
54005
54923
  super.connectedCallback();
54006
54924
  this.setAttribute("role", this.variant === "critical" ? "alert" : "status");
@@ -57946,4 +58864,4 @@ __decorate([property({
57946
58864
  })], NLDDJustInTimeEducation.prototype, "noArrow", void 0);
57947
58865
  NLDDJustInTimeEducation = _NLDDJustInTimeEducation = __decorate([customElement("nldd-just-in-time-education")], NLDDJustInTimeEducation);
57948
58866
  //#endregion
57949
- export { NLDDActivityIndicator, NLDDAvatar, NLDDAvatarGroup, NLDDBadge, NLDDBanner, NLDDBarSplitView, NLDDBlockquote, NLDDBox, NLDDBreadcrumbs, NLDDBreadcrumbsItem, NLDDButton, NLDDButtonBar, NLDDButtonGroup, NLDDCard, NLDDCell, NLDDCheckbox, NLDDCheckboxField, NLDDCodeEditor, NLDDCodeViewer, NLDDCollection, NLDDComboBox, NLDDContainer, NLDDDateField, NLDDDatePicker, NLDDDescriptionCell, NLDDDivider, NLDDDocumentTabBar, NLDDDragHandleCell, NLDDDropdown, NLDDFileField, NLDDForm, NLDDFormActions, NLDDFormField, NLDDFormSection, NLDDFullBleedSection, NLDDHero, NLDDIcon, NLDDIconButton, NLDDIconCell, NLDDIdentity, NLDDImage, NLDDInlineDialog, NLDDJustInTimeEducation, NLDDKeyboardShortcut, NLDDLink, NLDDList, NLDDListItem, NLDDListItemSegment, NLDDMenu, NLDDMenuBar, NLDDMenuBarItem, NLDDModalDialog, NLDDMultiLineTextField, NLDDNavigationSplitView, NLDDNotification, NLDDNumberField, NLDDOneHalfOneHalfSection, NLDDOneThirdTwoThirdsSection, NLDDPage, NLDDPageFooter, NLDDPageFooterLegalBar, NLDDPageFooterLegalBarItem, NLDDPagination, NLDDPasswordField, NLDDPopover, NLDDProgressBar, NLDDProgressBarSegmentIndicator, NLDDProgressCircle, NLDDProgressCircleSegmentIndicator, NLDDRadioButton, NLDDRadioButtonField, NLDDRadioButtonGroup, NLDDRichText, NLDDSearchField, NLDDSegmentedControl, NLDDSheet, NLDDShell, NLDDSideBySideSplitView, NLDDSidebarSection, NLDDSimpleSection, NLDDSkipLink, NLDDSpacer, NLDDSpacerCell, NLDDSplitButton, NLDDSplitViewDivider, NLDDSplitViewPane, NLDDStackedSplitView, NLDDStatusBar, NLDDStepBar, NLDDStepBarItem, NLDDStepCell, NLDDStepper, NLDDSwitch, NLDDSwitchField, NLDDTabBar, NLDDTable, NLDDTableRow, NLDDTag, NLDDText, NLDDTextCell, NLDDTextEditor, NLDDTextField, NLDDTimeField, NLDDTimePicker, NLDDTitle, NLDDTitleCell, NLDDToggleButton, NLDDToggleButtonGroup, NLDDToken, NLDDTokenField, NLDDToolbar, NLDDTooltip, NLDDTopNavigationBar, NLDDTopTitleBar, NLDDTwoThirdsOneThirdSection, NLDDValidationList, NLDDWindow, setTranslations };
58867
+ export { NLDDActivityIndicator, NLDDAvatar, NLDDAvatarGroup, NLDDBadge, NLDDBanner, NLDDBarSplitView, NLDDBlockquote, NLDDBox, NLDDBreadcrumbs, NLDDBreadcrumbsItem, NLDDButton, NLDDButtonBar, NLDDButtonGroup, NLDDCard, NLDDCell, NLDDCheckbox, NLDDCheckboxField, NLDDCodeEditor, NLDDCodeViewer, NLDDCollection, NLDDComboBox, NLDDContainer, NLDDDateField, NLDDDatePicker, NLDDDescriptionCell, NLDDDivider, NLDDDocumentTabBar, NLDDDragHandleCell, NLDDDropdown, NLDDFileField, NLDDForm, NLDDFormActions, NLDDFormField, NLDDFormSection, NLDDFullBleedSection, NLDDHero, NLDDIcon, NLDDIconButton, NLDDIconCell, NLDDIdentity, NLDDImage, NLDDInlineDialog, NLDDJustInTimeEducation, NLDDKeyboardShortcut, NLDDLink, NLDDList, NLDDListItem, NLDDListItemSegment, NLDDMenu, NLDDMenuBar, NLDDMenuBarItem, NLDDModalDialog, NLDDMultiLineTextField, NLDDNavigationSplitView, NLDDNotification, NLDDNumberField, NLDDOneHalfOneHalfSection, NLDDOneThirdTwoThirdsSection, NLDDPage, NLDDPageFooter, NLDDPageFooterLegalBar, NLDDPageFooterLegalBarItem, NLDDPagination, NLDDPasswordField, NLDDPopover, NLDDProgressBar, NLDDProgressBarSegmentIndicator, NLDDProgressCircle, NLDDProgressCircleSegmentIndicator, NLDDRadioButton, NLDDRadioButtonField, NLDDRadioButtonGroup, NLDDRichText, NLDDSearchField, NLDDSegmentedControl, NLDDSheet, NLDDShell, NLDDSideBySideSplitView, NLDDSidebarSection, NLDDSimpleSection, NLDDSkipLink, NLDDSpacer, NLDDSpacerCell, NLDDSplitButton, NLDDSplitViewDivider, NLDDSplitViewPane, NLDDStackedSplitView, NLDDStatusBar, NLDDStepBar, NLDDStepBarItem, NLDDStepCell, NLDDStepper, NLDDSwitch, NLDDSwitchField, NLDDTabBar, NLDDTable, NLDDTableRow, NLDDTag, NLDDText, NLDDTextCell, NLDDTextEditor, NLDDTextField, NLDDTimeField, NLDDTimePicker, NLDDTitle, NLDDTitleCell, NLDDToggleButton, NLDDToggleButtonGroup, NLDDToken, NLDDTokenField, NLDDToolbar, NLDDTooltip, NLDDTopNavigationBar, NLDDTopTitleBar, NLDDTwoThirdsOneThirdSection, NLDDValidationList, NLDDVisuallyHidden, NLDDWindow, setTranslations };