@nldd/design-system 0.8.98 → 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.
- package/custom-elements.json +159 -32
- package/dist/components/actions/menu/menu.d.ts +39 -5
- package/dist/components/actions/menu/menu.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.js +120 -7
- package/dist/components/actions/menu/menu.js.map +1 -1
- package/dist/components/actions/menu/menu.template.d.ts +4 -3
- package/dist/components/actions/menu/menu.template.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.template.js +10 -5
- package/dist/components/actions/menu/menu.template.js.map +1 -1
- package/dist/components/actions/toolbar/toolbar.d.ts +14 -3
- package/dist/components/actions/toolbar/toolbar.d.ts.map +1 -1
- package/dist/components/actions/toolbar/toolbar.js +45 -7
- package/dist/components/actions/toolbar/toolbar.js.map +1 -1
- package/dist/components/actions/toolbar/toolbar.styles.d.ts.map +1 -1
- package/dist/components/actions/toolbar/toolbar.styles.js +15 -1
- package/dist/components/actions/toolbar/toolbar.styles.js.map +1 -1
- package/dist/components/components.js +822 -99
- package/dist/components/content/code-viewer/code-viewer.styles.d.ts.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.styles.js +11 -7
- package/dist/components/content/code-viewer/code-viewer.styles.js.map +1 -1
- package/dist/components/content/visually-hidden/visually-hidden.d.ts +35 -0
- package/dist/components/content/visually-hidden/visually-hidden.d.ts.map +1 -0
- package/dist/components/content/visually-hidden/visually-hidden.js +45 -0
- package/dist/components/content/visually-hidden/visually-hidden.js.map +1 -0
- package/dist/components/content/visually-hidden/visually-hidden.styles.d.ts +2 -0
- package/dist/components/content/visually-hidden/visually-hidden.styles.d.ts.map +1 -0
- package/dist/components/content/visually-hidden/visually-hidden.styles.js +27 -0
- package/dist/components/content/visually-hidden/visually-hidden.styles.js.map +1 -0
- package/dist/components/content/visually-hidden/visually-hidden.template.d.ts +3 -0
- package/dist/components/content/visually-hidden/visually-hidden.template.d.ts.map +1 -0
- package/dist/components/content/visually-hidden/visually-hidden.template.js +7 -0
- package/dist/components/content/visually-hidden/visually-hidden.template.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/layout/card/card.d.ts +12 -1
- package/dist/components/layout/card/card.d.ts.map +1 -1
- package/dist/components/layout/card/card.js +29 -2
- package/dist/components/layout/card/card.js.map +1 -1
- package/dist/components/layout/card/card.styles.js +2 -2
- package/dist/components/layout/popover/popover.styles.d.ts.map +1 -1
- package/dist/components/layout/popover/popover.styles.js +4 -0
- package/dist/components/layout/popover/popover.styles.js.map +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.d.ts +44 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.d.ts.map +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.js +132 -3
- package/dist/components/navigation/document-tab-bar/document-tab-bar.js.map +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.styles.d.ts.map +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.styles.js +21 -2
- package/dist/components/navigation/document-tab-bar/document-tab-bar.styles.js.map +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.template.js +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.template.js.map +1 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.d.ts +4 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.d.ts.map +1 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.js +9 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.js.map +1 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.template.d.ts.map +1 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.template.js +8 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.template.js.map +1 -1
- package/dist/components/navigation/skip-link/skip-link.d.ts +12 -5
- package/dist/components/navigation/skip-link/skip-link.d.ts.map +1 -1
- package/dist/components/navigation/skip-link/skip-link.js +12 -5
- package/dist/components/navigation/skip-link/skip-link.js.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.d.ts +70 -1
- package/dist/components/navigation/tab-bar/tab-bar.d.ts.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.i18n.d.ts +5 -0
- package/dist/components/navigation/tab-bar/tab-bar.i18n.d.ts.map +1 -0
- package/dist/components/navigation/tab-bar/tab-bar.i18n.js +4 -0
- package/dist/components/navigation/tab-bar/tab-bar.i18n.js.map +1 -0
- package/dist/components/navigation/tab-bar/tab-bar.js +213 -22
- package/dist/components/navigation/tab-bar/tab-bar.js.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.styles.d.ts.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.styles.js +68 -3
- package/dist/components/navigation/tab-bar/tab-bar.styles.js.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.template.d.ts.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.template.js +36 -5
- package/dist/components/navigation/tab-bar/tab-bar.template.js.map +1 -1
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.d.ts +7 -0
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.d.ts.map +1 -1
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.js +16 -0
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.js.map +1 -1
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.styles.d.ts.map +1 -1
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.styles.js +7 -0
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.styles.js.map +1 -1
- package/dist/components/status-and-feedback/notification/notification.d.ts +62 -1
- package/dist/components/status-and-feedback/notification/notification.d.ts.map +1 -1
- package/dist/components/status-and-feedback/notification/notification.js +86 -2
- package/dist/components/status-and-feedback/notification/notification.js.map +1 -1
- package/dist/components/status-and-feedback/notification/notifications-area.d.ts +6 -0
- package/dist/components/status-and-feedback/notification/notifications-area.d.ts.map +1 -1
- package/dist/components/status-and-feedback/notification/notifications-area.js +16 -0
- package/dist/components/status-and-feedback/notification/notifications-area.js.map +1 -1
- package/dist/nldd.min.js +749 -581
- package/dist/translations/en-US.d.ts.map +1 -1
- package/dist/translations/en-US.js +1 -0
- package/dist/translations/en-US.js.map +1 -1
- package/dist/translations/fy.d.ts.map +1 -1
- package/dist/translations/fy.js +1 -0
- package/dist/translations/fy.js.map +1 -1
- package/dist/translations/nl.generated.d.ts +1 -0
- package/dist/translations/nl.generated.d.ts.map +1 -1
- package/dist/translations/nl.generated.js +2 -0
- package/dist/translations/nl.generated.js.map +1 -1
- package/dist/translations/pap-AW.d.ts.map +1 -1
- package/dist/translations/pap-AW.js +1 -0
- package/dist/translations/pap-AW.js.map +1 -1
- package/dist/translations/pap-CW.d.ts.map +1 -1
- package/dist/translations/pap-CW.js +1 -0
- package/dist/translations/pap-CW.js.map +1 -1
- package/dist/types/vue.d.ts +23 -13
- package/package.json +5 -1
|
@@ -645,7 +645,7 @@ function renderContent(component) {
|
|
|
645
645
|
` : nothing}
|
|
646
646
|
`;
|
|
647
647
|
}
|
|
648
|
-
function template$
|
|
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$
|
|
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$
|
|
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
|
|
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
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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(...
|
|
3456
|
-
super(...
|
|
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(...
|
|
3496
|
-
super(...
|
|
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(...
|
|
3704
|
-
super(...
|
|
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"))
|
|
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
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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
|
|
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.
|
|
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
|
|
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$
|
|
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
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
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$
|
|
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$
|
|
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$
|
|
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;
|
|
@@ -9860,7 +9980,7 @@ var NLDDList = (_NLDDList2 = class NLDDList extends LitElement {
|
|
|
9860
9980
|
}));
|
|
9861
9981
|
}
|
|
9862
9982
|
render() {
|
|
9863
|
-
return template$
|
|
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,7 +10456,7 @@ 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$
|
|
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
10462
|
role=${childrenRole}
|
|
@@ -11075,7 +11195,7 @@ var NLDDListItem = (_NLDDListItem2 = class NLDDListItem extends withTranslations
|
|
|
11075
11195
|
render() {
|
|
11076
11196
|
const opensInNewTabLabel = this.href && this.target === "_blank" ? this._t("components.list-item.opens-in-new-tab-label") : void 0;
|
|
11077
11197
|
const actionTabindex = this._isListboxOption ? "-1" : this._arrowNavigation ? this._rovingActive ? "0" : "-1" : void 0;
|
|
11078
|
-
return template$
|
|
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);
|
|
11079
11199
|
}
|
|
11080
11200
|
}, _NLDDListItem = _NLDDListItem2, _NLDDListItem2.styles = [listItemStyles], _NLDDListItem2.SIZED_CELLS = "nldd-text-cell, nldd-drag-handle-cell", _NLDDListItem2);
|
|
11081
11201
|
__decorate([property({
|
|
@@ -11234,7 +11354,7 @@ var cellStyles = css`
|
|
|
11234
11354
|
`;
|
|
11235
11355
|
//#endregion
|
|
11236
11356
|
//#region src/components/lists-and-tables/cells/cell/cell.template.ts
|
|
11237
|
-
var template$
|
|
11357
|
+
var template$13 = () => html`<slot></slot>`;
|
|
11238
11358
|
//#endregion
|
|
11239
11359
|
//#region src/components/lists-and-tables/cells/cell/cell.ts
|
|
11240
11360
|
/**
|
|
@@ -11285,7 +11405,7 @@ var _NLDDCell = class NLDDCell extends VisibilityMixin(LitElement, "cells-contai
|
|
|
11285
11405
|
else this.style.removeProperty("--_cell-min-height");
|
|
11286
11406
|
}
|
|
11287
11407
|
render() {
|
|
11288
|
-
return template$
|
|
11408
|
+
return template$13();
|
|
11289
11409
|
}
|
|
11290
11410
|
};
|
|
11291
11411
|
var NLDDCell = (_NLDDCell.styles = [cellStyles], _NLDDCell);
|
|
@@ -12036,20 +12156,25 @@ var codeViewerStyles = css`
|
|
|
12036
12156
|
box-shadow: var(--_code-viewer-border-shadow);
|
|
12037
12157
|
background-color: var(--_code-viewer-background-color);
|
|
12038
12158
|
min-width: 0;
|
|
12159
|
+
overflow: hidden;
|
|
12039
12160
|
flex-grow: 1;
|
|
12040
12161
|
flex-shrink: 1;
|
|
12041
12162
|
flex-basis: auto;
|
|
12042
|
-
padding: var(--_code-viewer-block-padding) var(--_code-viewer-inline-padding);
|
|
12043
12163
|
color: var(--_code-viewer-content-color);
|
|
12044
12164
|
font: var(--_code-viewer-font);
|
|
12045
12165
|
}
|
|
12046
12166
|
|
|
12047
|
-
/*
|
|
12048
|
-
|
|
12049
|
-
|
|
12050
|
-
|
|
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
|
+
|
|
12051
12173
|
:host(:not([no-copy]):not([copy-unavailable])) .code-viewer {
|
|
12052
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 {
|
|
12053
12178
|
padding-right: var(--_code-viewer-actions-area-size);
|
|
12054
12179
|
}
|
|
12055
12180
|
|
|
@@ -12057,8 +12182,7 @@ var codeViewerStyles = css`
|
|
|
12057
12182
|
--_code-viewer-actions-area-padding: 0;
|
|
12058
12183
|
}
|
|
12059
12184
|
|
|
12060
|
-
:host([appearance="simple"]:not([no-copy]):not([copy-unavailable])) .code-viewer {
|
|
12061
|
-
min-height: var(--_code-viewer-actions-area-size);
|
|
12185
|
+
:host([appearance="simple"]:not([no-copy]):not([copy-unavailable])) .code-viewer .cm-scroller .cm-content {
|
|
12062
12186
|
padding-right: 0;
|
|
12063
12187
|
}
|
|
12064
12188
|
|
|
@@ -13695,7 +13819,7 @@ var tagStyles = css`
|
|
|
13695
13819
|
`;
|
|
13696
13820
|
//#endregion
|
|
13697
13821
|
//#region src/components/content/tag/tag.template.ts
|
|
13698
|
-
function template$
|
|
13822
|
+
function template$12(component) {
|
|
13699
13823
|
const variant = component._effectiveVariant;
|
|
13700
13824
|
const showIcon = variant === "icon" || variant === "icon-and-text" && component._hasIcon;
|
|
13701
13825
|
const showText = (variant === "text" || variant === "icon-and-text") && component._hasText;
|
|
@@ -13792,7 +13916,7 @@ var _NLDDTag = class NLDDTag extends LitElement {
|
|
|
13792
13916
|
}
|
|
13793
13917
|
updated() {}
|
|
13794
13918
|
render() {
|
|
13795
|
-
return template$
|
|
13919
|
+
return template$12(this);
|
|
13796
13920
|
}
|
|
13797
13921
|
};
|
|
13798
13922
|
var NLDDTag = (_NLDDTag.styles = tagStyles, _NLDDTag);
|
|
@@ -13941,7 +14065,7 @@ var textStyles = css`
|
|
|
13941
14065
|
`;
|
|
13942
14066
|
//#endregion
|
|
13943
14067
|
//#region src/components/content/text/text.template.ts
|
|
13944
|
-
function template$
|
|
14068
|
+
function template$11() {
|
|
13945
14069
|
return html`
|
|
13946
14070
|
<slot></slot>
|
|
13947
14071
|
`;
|
|
@@ -13992,7 +14116,7 @@ var _NLDDText = class NLDDText extends LitElement {
|
|
|
13992
14116
|
this.horizontalAlignment = "left";
|
|
13993
14117
|
}
|
|
13994
14118
|
render() {
|
|
13995
|
-
return template$
|
|
14119
|
+
return template$11();
|
|
13996
14120
|
}
|
|
13997
14121
|
};
|
|
13998
14122
|
var NLDDText = (_NLDDText.styles = textStyles, _NLDDText);
|
|
@@ -14783,6 +14907,73 @@ __decorate([state()], NLDDToken.prototype, "_slotText", void 0);
|
|
|
14783
14907
|
__decorate([query(".token__menu-action nldd-icon-button")], NLDDToken.prototype, "_menuButton", void 0);
|
|
14784
14908
|
NLDDToken = __decorate([customElement("nldd-token")], NLDDToken);
|
|
14785
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
|
|
14786
14977
|
//#region src/components/forms/form/form.ts
|
|
14787
14978
|
/**
|
|
14788
14979
|
* Nederlandse Digitale Dienst Form Component
|
|
@@ -44325,7 +44516,7 @@ var cardStyles = css`
|
|
|
44325
44516
|
}
|
|
44326
44517
|
}
|
|
44327
44518
|
|
|
44328
|
-
|
|
44519
|
+
:host([data-action-pressed]) .card {
|
|
44329
44520
|
--_card-border-color: var(--_card-is-active-border-color);
|
|
44330
44521
|
background-color: var(--_card-is-active-background-color);
|
|
44331
44522
|
}
|
|
@@ -44386,7 +44577,7 @@ var cardStyles = css`
|
|
|
44386
44577
|
pointer-events: none;
|
|
44387
44578
|
}
|
|
44388
44579
|
|
|
44389
|
-
:host(
|
|
44580
|
+
:host([data-action-focused]) .card__focus-ring {
|
|
44390
44581
|
display: block;
|
|
44391
44582
|
}
|
|
44392
44583
|
|
|
@@ -44481,7 +44672,8 @@ var nlddCardTranslations = { "components.card.opens-in-new-tab-label": "Opent in
|
|
|
44481
44672
|
* above it with `position: relative; z-index: 1` to stay clickable.
|
|
44482
44673
|
* A card that is a link or button steps its surface and border one shade up
|
|
44483
44674
|
* on hover and one more while pressed, as a neutral-base button does; content
|
|
44484
|
-
* 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.
|
|
44485
44677
|
*
|
|
44486
44678
|
* @element nldd-card
|
|
44487
44679
|
*
|
|
@@ -44514,6 +44706,18 @@ var _NLDDCard = class NLDDCard extends withTranslations(LitElement, nlddCardTran
|
|
|
44514
44706
|
this._onFocusOut = () => {
|
|
44515
44707
|
this._actionFocused = false;
|
|
44516
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
|
+
};
|
|
44517
44721
|
this._onSlotChange = (e) => {
|
|
44518
44722
|
const slot = e.target;
|
|
44519
44723
|
const wrapper = slot.parentElement;
|
|
@@ -44524,15 +44728,18 @@ var _NLDDCard = class NLDDCard extends withTranslations(LitElement, nlddCardTran
|
|
|
44524
44728
|
super.connectedCallback();
|
|
44525
44729
|
this.addEventListener("focusin", this._onFocusIn);
|
|
44526
44730
|
this.addEventListener("focusout", this._onFocusOut);
|
|
44731
|
+
this.addEventListener("pointerdown", this._onPointerDown);
|
|
44527
44732
|
this.style.containerType = "inline-size";
|
|
44528
44733
|
this.style.containerName = "layout-container";
|
|
44529
44734
|
}
|
|
44530
44735
|
updated() {
|
|
44531
|
-
this.
|
|
44736
|
+
this.toggleAttribute("data-action-focused", this._actionFocused);
|
|
44532
44737
|
}
|
|
44533
44738
|
disconnectedCallback() {
|
|
44534
44739
|
this.removeEventListener("focusin", this._onFocusIn);
|
|
44535
44740
|
this.removeEventListener("focusout", this._onFocusOut);
|
|
44741
|
+
this.removeEventListener("pointerdown", this._onPointerDown);
|
|
44742
|
+
this._clearPressed();
|
|
44536
44743
|
super.disconnectedCallback();
|
|
44537
44744
|
}
|
|
44538
44745
|
render() {
|
|
@@ -48352,7 +48559,8 @@ function template$4(component) {
|
|
|
48352
48559
|
const ariaLabel = component.accessibleLabel || (showsIconOnly ? component.text : nothing);
|
|
48353
48560
|
const tooltipText = showsIconOnly ? component.accessibleLabel || component.text : "";
|
|
48354
48561
|
const ariaCurrent = component.current ? component.currentType : nothing;
|
|
48355
|
-
const
|
|
48562
|
+
const opensNavigation = component.querySelector(":scope > nldd-menu")?.getAttribute("variant") === "navigation";
|
|
48563
|
+
const ariaHaspopup = component.expandable ? opensNavigation ? nothing : "menu" : component.haspopup || nothing;
|
|
48356
48564
|
const ariaExpanded = component.expandable || component.haspopup ? String(component.expanded) : nothing;
|
|
48357
48565
|
const icon = html`
|
|
48358
48566
|
<span class="menu-bar-item__icon" ?hidden=${!component.icon && !component._hasSlottedIcon}>
|
|
@@ -48427,7 +48635,7 @@ function template$4(component) {
|
|
|
48427
48635
|
* @attr {string} current-type - aria-current value when current is true ('page', 'step', 'location', 'true'). Default: 'page'
|
|
48428
48636
|
* @attr {string} href - Optional link URL. Without href it renders as a button.
|
|
48429
48637
|
* @attr {string} icon - Optional icon name (nldd-icon)
|
|
48430
|
-
* @attr {boolean} expandable - Show the disclosure icon and open the slotted `<nldd-menu>` on click
|
|
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`.
|
|
48431
48639
|
* @attr {boolean} icon-only - Hide the text visually (always). The text then shows as a tooltip on hover and focus.
|
|
48432
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.
|
|
48433
48641
|
* @attr {boolean} compact - Activates content-priority behavior (set by the parent nldd-menu-bar)
|
|
@@ -48467,6 +48675,7 @@ var _NLDDMenuBarItem = class NLDDMenuBarItem extends LitElement {
|
|
|
48467
48675
|
this._menuOpen = false;
|
|
48468
48676
|
this._pointerdownWhileMenuOpen = false;
|
|
48469
48677
|
this._menuToggleHandler = null;
|
|
48678
|
+
this._menuVariantObserver = null;
|
|
48470
48679
|
this._hasSlottedIcon = false;
|
|
48471
48680
|
this._onIconSlotChange = (e) => {
|
|
48472
48681
|
this._hasSlottedIcon = e.target.assignedElements().length > 0;
|
|
@@ -48532,9 +48741,17 @@ var _NLDDMenuBarItem = class NLDDMenuBarItem extends LitElement {
|
|
|
48532
48741
|
this.expanded = isOpen;
|
|
48533
48742
|
};
|
|
48534
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();
|
|
48535
48750
|
}
|
|
48536
48751
|
_unwireMenu() {
|
|
48537
48752
|
if (this._menu && this._menuToggleHandler) this._menu.removeEventListener("toggle", this._menuToggleHandler);
|
|
48753
|
+
this._menuVariantObserver?.disconnect();
|
|
48754
|
+
this._menuVariantObserver = null;
|
|
48538
48755
|
this._menu = null;
|
|
48539
48756
|
this._menuToggleHandler = null;
|
|
48540
48757
|
this._menuOpen = false;
|
|
@@ -49264,11 +49481,18 @@ var nlddSkipLinkTranslations = { "components.skip-link.action": "Sla over" };
|
|
|
49264
49481
|
* Nederlandse Digitale Dienst Skip Link Component (Lit + TypeScript)
|
|
49265
49482
|
*
|
|
49266
49483
|
* Accessibility pattern that lets keyboard users skip past content. Wraps
|
|
49267
|
-
* content in a default slot.
|
|
49268
|
-
*
|
|
49269
|
-
*
|
|
49270
|
-
*
|
|
49271
|
-
*
|
|
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.
|
|
49272
49496
|
*
|
|
49273
49497
|
* With an `href` that points at an id on the same page, the link scrolls to
|
|
49274
49498
|
* that element and moves focus to it too. The target needs no `tabindex` of
|
|
@@ -49540,7 +49764,14 @@ var topNavigationBarStyles = css`
|
|
|
49540
49764
|
}
|
|
49541
49765
|
}
|
|
49542
49766
|
|
|
49767
|
+
.top-navigation-bar__logo > span {
|
|
49768
|
+
display: block;
|
|
49769
|
+
width: 100%;
|
|
49770
|
+
height: 100%;
|
|
49771
|
+
}
|
|
49772
|
+
|
|
49543
49773
|
.top-navigation-bar__logo svg {
|
|
49774
|
+
display: block;
|
|
49544
49775
|
width: 100%;
|
|
49545
49776
|
height: 100%;
|
|
49546
49777
|
}
|
|
@@ -49996,6 +50227,13 @@ var nlddTopNavigationBarTranslations = {
|
|
|
49996
50227
|
* the global navigation and the utility navigation. On narrow widths the global
|
|
49997
50228
|
* navigation moves into a menu sheet behind the menu button.
|
|
49998
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
|
+
*
|
|
49999
50237
|
* @element nldd-top-navigation-bar
|
|
50000
50238
|
*
|
|
50001
50239
|
* @attr {boolean} no-logo - Hides the whole logo bar, wordmark included.
|
|
@@ -50279,6 +50517,8 @@ var _NLDDTopNavigationBar = class NLDDTopNavigationBar extends withTranslations(
|
|
|
50279
50517
|
page.appendChild(titleBar);
|
|
50280
50518
|
const section = document.createElement("nldd-simple-section");
|
|
50281
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"));
|
|
50282
50522
|
this._globalMenuSheetList.setAttribute("appearance", "simple");
|
|
50283
50523
|
this._globalMenuSheetList.setAttribute("dividers", "never");
|
|
50284
50524
|
section.appendChild(this._globalMenuSheetList);
|
|
@@ -50305,6 +50545,7 @@ var _NLDDTopNavigationBar = class NLDDTopNavigationBar extends withTranslations(
|
|
|
50305
50545
|
text: item.text,
|
|
50306
50546
|
href: sanitizeUrl(item.href) ?? "",
|
|
50307
50547
|
selected: item.current,
|
|
50548
|
+
currentType: item.currentType,
|
|
50308
50549
|
submenu: item.querySelector(":scope > nldd-menu"),
|
|
50309
50550
|
activate: () => item.click()
|
|
50310
50551
|
}));
|
|
@@ -50363,6 +50604,7 @@ var _NLDDTopNavigationBar = class NLDDTopNavigationBar extends withTranslations(
|
|
|
50363
50604
|
});
|
|
50364
50605
|
}
|
|
50365
50606
|
if (entry.selected) listItem.setAttribute("selected", "");
|
|
50607
|
+
if (entry.currentType) listItem.setAttribute("current-type", entry.currentType);
|
|
50366
50608
|
if (focusOpenerText !== void 0 && entry.text === focusOpenerText) openerItem = listItem;
|
|
50367
50609
|
list.appendChild(listItem);
|
|
50368
50610
|
}
|
|
@@ -50487,19 +50729,83 @@ var tabBarStyles = css`
|
|
|
50487
50729
|
justify-content: center;
|
|
50488
50730
|
}
|
|
50489
50731
|
|
|
50490
|
-
.tab-
|
|
50491
|
-
display:
|
|
50732
|
+
.tab-bar__box {
|
|
50733
|
+
display: flex;
|
|
50492
50734
|
position: relative;
|
|
50493
50735
|
border-radius: var(--_tab-bar-corner-radius);
|
|
50494
50736
|
background-color: var(--semantics-buttons-neutral-tinted-background-color);
|
|
50495
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;
|
|
50496
50745
|
grid-auto-flow: column;
|
|
50497
50746
|
grid-auto-columns: auto;
|
|
50498
50747
|
align-items: center;
|
|
50499
50748
|
gap: var(--_tab-bar-gap);
|
|
50500
50749
|
}
|
|
50501
50750
|
|
|
50502
|
-
.tab-
|
|
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 {
|
|
50503
50809
|
content: '';
|
|
50504
50810
|
position: absolute;
|
|
50505
50811
|
inset: 0;
|
|
@@ -50536,6 +50842,7 @@ var tabBarItemStyles = css`
|
|
|
50536
50842
|
--_tab-bar-item-icon-size: var(--semantics-buttons-md-icon-size);
|
|
50537
50843
|
--_tab-bar-item-highlight-border-color: transparent;
|
|
50538
50844
|
--_tab-bar-item-content-z-index: 1;
|
|
50845
|
+
--_tab-bar-item-natural-width: 0;
|
|
50539
50846
|
|
|
50540
50847
|
${inheritedTextReset}
|
|
50541
50848
|
display: inline-block;
|
|
@@ -50718,11 +51025,40 @@ function tabBarTemplate(component) {
|
|
|
50718
51025
|
const label = component.accessibleLabel || "Tabs";
|
|
50719
51026
|
const isNavigation = component.navigation;
|
|
50720
51027
|
const itemsContainer = html`
|
|
50721
|
-
<div class="tab-
|
|
50722
|
-
|
|
50723
|
-
|
|
50724
|
-
|
|
50725
|
-
|
|
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>
|
|
50726
51062
|
</div>
|
|
50727
51063
|
`;
|
|
50728
51064
|
if (isNavigation) return html`
|
|
@@ -50785,6 +51121,9 @@ function tabBarItemTemplate(component) {
|
|
|
50785
51121
|
return result;
|
|
50786
51122
|
}
|
|
50787
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
|
|
50788
51127
|
//#region src/components/navigation/tab-bar/tab-bar.ts
|
|
50789
51128
|
/**
|
|
50790
51129
|
* Nederlandse Digitale Dienst Tab Bar Component (Lit + TypeScript)
|
|
@@ -50792,6 +51131,19 @@ function tabBarItemTemplate(component) {
|
|
|
50792
51131
|
* A horizontal navigation bar with mutually exclusive tabs.
|
|
50793
51132
|
* Exports both NLDDTabBar and NLDDTabBarItem.
|
|
50794
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
|
+
*
|
|
50795
51147
|
* @element nldd-tab-bar
|
|
50796
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.
|
|
50797
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).
|
|
@@ -50799,6 +51151,7 @@ function tabBarItemTemplate(component) {
|
|
|
50799
51151
|
* @attr {boolean} disabled - Disables the whole bar: dims it, blocks pointer interaction, and takes the tabs out of the tab order
|
|
50800
51152
|
* @attr {boolean} centered - Centers the tabs in the container (host fills the row, tabs group in the middle)
|
|
50801
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.
|
|
50802
51155
|
*
|
|
50803
51156
|
* @slot - nldd-tab-bar-item elements
|
|
50804
51157
|
*
|
|
@@ -50897,7 +51250,7 @@ __decorate([state()], NLDDTabBarItem.prototype, "_navigation", void 0);
|
|
|
50897
51250
|
__decorate([state()], NLDDTabBarItem.prototype, "_isFallbackFocusable", void 0);
|
|
50898
51251
|
__decorate([state()], NLDDTabBarItem.prototype, "_groupDisabled", void 0);
|
|
50899
51252
|
NLDDTabBarItem = __decorate([customElement("nldd-tab-bar-item")], NLDDTabBarItem);
|
|
50900
|
-
var NLDDTabBar = (_NLDDTabBar = class NLDDTabBar extends LitElement {
|
|
51253
|
+
var NLDDTabBar = (_NLDDTabBar = class NLDDTabBar extends withTranslations(LitElement, nlddTabBarTranslations) {
|
|
50901
51254
|
constructor(..._args2) {
|
|
50902
51255
|
super(..._args2);
|
|
50903
51256
|
this.centered = false;
|
|
@@ -50907,21 +51260,31 @@ var NLDDTabBar = (_NLDDTabBar = class NLDDTabBar extends LitElement {
|
|
|
50907
51260
|
this.disabled = false;
|
|
50908
51261
|
this.accessibleLabel = "";
|
|
50909
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
|
+
};
|
|
50910
51281
|
this._handleItemSelect = (event) => {
|
|
50911
51282
|
event.stopPropagation();
|
|
50912
|
-
|
|
50913
|
-
if (!this.navigation) this._getItems().forEach((item) => {
|
|
50914
|
-
item.current = item === event.detail.item;
|
|
50915
|
-
});
|
|
50916
|
-
this.dispatchEvent(new CustomEvent("tabchange", {
|
|
50917
|
-
bubbles: true,
|
|
50918
|
-
composed: true,
|
|
50919
|
-
detail: event.detail
|
|
50920
|
-
}));
|
|
51283
|
+
this._activate(event.detail.item);
|
|
50921
51284
|
};
|
|
50922
51285
|
this._handleKeyDown = (event) => {
|
|
50923
51286
|
if (this.disabled) return;
|
|
50924
|
-
const items = this._getItems();
|
|
51287
|
+
const items = this._getItems().filter((item) => !item.hasAttribute("data-overflow"));
|
|
50925
51288
|
if (items.length === 0) return;
|
|
50926
51289
|
const currentIndex = items.findIndex((item) => item === event.target || item.contains(event.target));
|
|
50927
51290
|
let newIndex = -1;
|
|
@@ -50963,18 +51326,162 @@ var NLDDTabBar = (_NLDDTabBar = class NLDDTabBar extends LitElement {
|
|
|
50963
51326
|
super.connectedCallback();
|
|
50964
51327
|
this.addEventListener("select", this._handleItemSelect);
|
|
50965
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());
|
|
50966
51345
|
}
|
|
50967
51346
|
disconnectedCallback() {
|
|
50968
51347
|
super.disconnectedCallback();
|
|
50969
51348
|
this.removeEventListener("select", this._handleItemSelect);
|
|
50970
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);
|
|
50971
51475
|
}
|
|
50972
51476
|
firstUpdated() {
|
|
50973
51477
|
this._hasCustomLabel = Boolean(this.accessibleLabel);
|
|
50974
51478
|
this._syncItems();
|
|
50975
51479
|
}
|
|
50976
51480
|
updated(changedProperties) {
|
|
50977
|
-
if (changedProperties.has("variant") || changedProperties.has("size") || changedProperties.has("navigation") || changedProperties.has("disabled"))
|
|
51481
|
+
if (changedProperties.has("variant") || changedProperties.has("size") || changedProperties.has("navigation") || changedProperties.has("disabled")) {
|
|
51482
|
+
this._syncItems();
|
|
51483
|
+
this._scheduleOverflow();
|
|
51484
|
+
}
|
|
50978
51485
|
}
|
|
50979
51486
|
_getItems() {
|
|
50980
51487
|
const slot = this.shadowRoot?.querySelector("slot");
|
|
@@ -50990,13 +51497,26 @@ var NLDDTabBar = (_NLDDTabBar = class NLDDTabBar extends LitElement {
|
|
|
50990
51497
|
item._groupDisabled = this.disabled;
|
|
50991
51498
|
});
|
|
50992
51499
|
const hasCurrent = items.some((item) => item.current);
|
|
50993
|
-
const firstItem = items
|
|
51500
|
+
const firstItem = items.find((item) => !item.hasAttribute("data-overflow")) ?? null;
|
|
50994
51501
|
items.forEach((item) => {
|
|
50995
51502
|
item._isFallbackFocusable = !hasCurrent && item === firstItem;
|
|
50996
51503
|
});
|
|
50997
51504
|
}
|
|
50998
51505
|
_onSlotChange() {
|
|
50999
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
|
+
}));
|
|
51000
51520
|
}
|
|
51001
51521
|
render() {
|
|
51002
51522
|
return tabBarTemplate(this);
|
|
@@ -51026,6 +51546,7 @@ __decorate([property({
|
|
|
51026
51546
|
type: String,
|
|
51027
51547
|
attribute: "accessible-label"
|
|
51028
51548
|
})], NLDDTabBar.prototype, "accessibleLabel", void 0);
|
|
51549
|
+
__decorate([state()], NLDDTabBar.prototype, "_overflowItems", void 0);
|
|
51029
51550
|
NLDDTabBar = __decorate([customElement("nldd-tab-bar")], NLDDTabBar);
|
|
51030
51551
|
//#endregion
|
|
51031
51552
|
//#region src/components/navigation/document-tab-bar/document-tab-bar.styles.ts
|
|
@@ -51046,6 +51567,9 @@ var documentTabBarStyles = css`
|
|
|
51046
51567
|
--_document-tab-bar-drag-clone-z-index: 100;
|
|
51047
51568
|
--_document-tab-bar-short-text-threshold: 200px;
|
|
51048
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);
|
|
51049
51573
|
--_document-tab-bar-overflow-button-reserve: 52px; /* Used for overflowButtonReserve. Overflow button width + spacing */
|
|
51050
51574
|
--_document-tab-bar-dismiss-button-is-hovered-background-color: light-dark(var(--primitives-color-neutral-150), var(--primitives-color-neutral-250));
|
|
51051
51575
|
--_document-tab-bar-dismiss-button-is-active-background-color: light-dark(var(--primitives-color-neutral-200), var(--primitives-color-neutral-300));
|
|
@@ -51095,6 +51619,22 @@ var documentTabBarStyles = css`
|
|
|
51095
51619
|
flex-basis: 0;
|
|
51096
51620
|
}
|
|
51097
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
|
+
|
|
51098
51638
|
::slotted(nldd-document-tab-bar-item[hidden]) {
|
|
51099
51639
|
display: none;
|
|
51100
51640
|
}
|
|
@@ -51103,12 +51643,12 @@ var documentTabBarStyles = css`
|
|
|
51103
51643
|
flex-grow: 0;
|
|
51104
51644
|
}
|
|
51105
51645
|
|
|
51106
|
-
.document-tab-bar__overflow {
|
|
51646
|
+
.document-tab-bar__overflow-button {
|
|
51107
51647
|
flex-grow: 0;
|
|
51108
51648
|
flex-shrink: 0;
|
|
51109
51649
|
}
|
|
51110
51650
|
|
|
51111
|
-
.document-tab-bar__overflow.is-hidden {
|
|
51651
|
+
.document-tab-bar__overflow-button.is-hidden {
|
|
51112
51652
|
display: none;
|
|
51113
51653
|
}
|
|
51114
51654
|
|
|
@@ -51495,7 +52035,7 @@ function documentTabBarTemplate(component) {
|
|
|
51495
52035
|
<slot @slotchange=${component._onSlotChange}></slot>
|
|
51496
52036
|
</div>
|
|
51497
52037
|
<div class=${classMap({
|
|
51498
|
-
"document-tab-bar__overflow": true,
|
|
52038
|
+
"document-tab-bar__overflow-button": true,
|
|
51499
52039
|
"is-hidden": !hasOverflow
|
|
51500
52040
|
})}>
|
|
51501
52041
|
<nldd-icon-button
|
|
@@ -51614,13 +52154,27 @@ var nlddDocumentTabBarTranslations = {
|
|
|
51614
52154
|
* Use `translations` property instead: `.translations=${{ 'components.document-tab-bar.overflow-action': 'Tabs' }}`
|
|
51615
52155
|
* @attr {boolean} navigation - Renders a nav landmark instead of tablist; use when items have hrefs
|
|
51616
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
|
+
*
|
|
51617
52171
|
* @slot - nldd-document-tab-bar-item elements
|
|
51618
52172
|
* @slot end - Action buttons (e.g. new tab)
|
|
51619
52173
|
*
|
|
51620
52174
|
* @fires tabchange - Fired when a tab is selected; detail: { item }
|
|
51621
52175
|
* @fires tabdismiss - Fired when a tab is dismissed; detail: { item, nextItem }
|
|
51622
52176
|
* @fires tabempty - Fired when the last tab is dismissed
|
|
51623
|
-
* @fires nldd-reorder - Fired when
|
|
52177
|
+
* @fires nldd-reorder - Fired when a tab is moved, by dragging or with Shift+Arrow; detail: { fromIndex, toIndex }
|
|
51624
52178
|
*
|
|
51625
52179
|
* ---
|
|
51626
52180
|
*
|
|
@@ -51734,6 +52288,10 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
|
|
|
51734
52288
|
this._menu = null;
|
|
51735
52289
|
this._resizeObserver = null;
|
|
51736
52290
|
this._hasCustomLabel = false;
|
|
52291
|
+
this._holding = false;
|
|
52292
|
+
this._releaseOnRemoval = null;
|
|
52293
|
+
this._rowWidth = 0;
|
|
52294
|
+
this._itemsAtHold = /* @__PURE__ */ new Set();
|
|
51737
52295
|
this._draggingEl = null;
|
|
51738
52296
|
this._placeholder = null;
|
|
51739
52297
|
this._currentDropIndex = -1;
|
|
@@ -51849,6 +52407,12 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
|
|
|
51849
52407
|
dismissedItem.selected = false;
|
|
51850
52408
|
}
|
|
51851
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
|
+
}
|
|
51852
52416
|
this.dispatchEvent(new CustomEvent("tabdismiss", {
|
|
51853
52417
|
bubbles: true,
|
|
51854
52418
|
composed: true,
|
|
@@ -51857,12 +52421,43 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
|
|
|
51857
52421
|
nextItem
|
|
51858
52422
|
}
|
|
51859
52423
|
}));
|
|
52424
|
+
if (this._releaseOnRemoval && !this._getItems().includes(this._releaseOnRemoval)) {
|
|
52425
|
+
this._releaseOnRemoval = null;
|
|
52426
|
+
this._releaseWidths();
|
|
52427
|
+
}
|
|
51860
52428
|
if (isLastItem) this.dispatchEvent(new CustomEvent("tabempty", {
|
|
51861
52429
|
bubbles: true,
|
|
51862
52430
|
composed: true
|
|
51863
52431
|
}));
|
|
51864
52432
|
this._syncFallbackFocusable();
|
|
51865
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
|
+
};
|
|
51866
52461
|
this._handleKeyDown = (event) => {
|
|
51867
52462
|
const path = event.composedPath();
|
|
51868
52463
|
const item = path.find((el) => el instanceof Element && el.tagName.toLowerCase() === "nldd-document-tab-bar-item");
|
|
@@ -51947,6 +52542,14 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
|
|
|
51947
52542
|
this.removeEventListener("dismiss", this._handleItemDismiss);
|
|
51948
52543
|
this.removeEventListener("keydown", this._handleKeyDown);
|
|
51949
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;
|
|
51950
52553
|
this._menu?.remove();
|
|
51951
52554
|
this._menu = null;
|
|
51952
52555
|
this._resizeObserver?.disconnect();
|
|
@@ -51958,7 +52561,13 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
|
|
|
51958
52561
|
if (!this._hasCustomLabel) {}
|
|
51959
52562
|
const container = this.shadowRoot?.querySelector(".document-tab-bar__items");
|
|
51960
52563
|
if (container) {
|
|
51961
|
-
this.
|
|
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
|
+
});
|
|
51962
52571
|
this._resizeObserver.observe(container);
|
|
51963
52572
|
}
|
|
51964
52573
|
this._syncMenuAnchor();
|
|
@@ -52005,6 +52614,11 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
|
|
|
52005
52614
|
wrapper.hidden = slot.assignedElements().length === 0;
|
|
52006
52615
|
}
|
|
52007
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();
|
|
52008
52622
|
this._calculateOverflow();
|
|
52009
52623
|
this._propagateDismissLabel();
|
|
52010
52624
|
this._syncFallbackFocusable();
|
|
@@ -52226,7 +52840,7 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
|
|
|
52226
52840
|
}
|
|
52227
52841
|
_syncMenuAnchor() {
|
|
52228
52842
|
if (!this._menu) return;
|
|
52229
|
-
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");
|
|
52230
52844
|
if (button) {
|
|
52231
52845
|
this._menu.anchorElement = button;
|
|
52232
52846
|
if ("popoverTargetElement" in button) button.popoverTargetElement = this._menu;
|
|
@@ -52236,6 +52850,24 @@ var NLDDDocumentTabBar = (_NLDDDocumentTabBar2 = class NLDDDocumentTabBar extend
|
|
|
52236
52850
|
_closeMenu() {
|
|
52237
52851
|
this._menu?.hidePopover();
|
|
52238
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
|
+
}
|
|
52239
52871
|
render() {
|
|
52240
52872
|
return documentTabBarTemplate(this);
|
|
52241
52873
|
}
|
|
@@ -53936,6 +54568,21 @@ function joinArea(notification, label) {
|
|
|
53936
54568
|
area.prepend(notification);
|
|
53937
54569
|
syncStack(area);
|
|
53938
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
|
+
}
|
|
53939
54586
|
function leaveArea(notification) {
|
|
53940
54587
|
const area = document.getElementById(AREA_ID);
|
|
53941
54588
|
if (!area) return;
|
|
@@ -54106,6 +54753,21 @@ var nlddNotificationTranslations = {
|
|
|
54106
54753
|
* role="status". Focus never moves on its own. Escape dismisses the
|
|
54107
54754
|
* notification that focus is in.
|
|
54108
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
|
+
*
|
|
54109
54771
|
* @element nldd-notification
|
|
54110
54772
|
*
|
|
54111
54773
|
* @attr {'neutral'|'accent'|'success'|'warning'|'critical'} variant - What kind of message this is; sets the icon color and the ARIA role (default: 'neutral')
|
|
@@ -54117,7 +54779,9 @@ var nlddNotificationTranslations = {
|
|
|
54117
54779
|
*
|
|
54118
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.
|
|
54119
54781
|
*
|
|
54120
|
-
* @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.
|
|
54121
54785
|
*/
|
|
54122
54786
|
var _NLDDNotification;
|
|
54123
54787
|
var DEFAULT_ICONS = {
|
|
@@ -54196,6 +54860,65 @@ var NLDDNotification = (_NLDDNotification = class NLDDNotification extends withT
|
|
|
54196
54860
|
get _leavesOnItsOwn() {
|
|
54197
54861
|
return this.variant !== "critical" && this.duration > 0;
|
|
54198
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
|
+
}
|
|
54199
54922
|
connectedCallback() {
|
|
54200
54923
|
super.connectedCallback();
|
|
54201
54924
|
this.setAttribute("role", this.variant === "critical" ? "alert" : "status");
|
|
@@ -58141,4 +58864,4 @@ __decorate([property({
|
|
|
58141
58864
|
})], NLDDJustInTimeEducation.prototype, "noArrow", void 0);
|
|
58142
58865
|
NLDDJustInTimeEducation = _NLDDJustInTimeEducation = __decorate([customElement("nldd-just-in-time-education")], NLDDJustInTimeEducation);
|
|
58143
58866
|
//#endregion
|
|
58144
|
-
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 };
|