dap-design-system 0.53.2 → 0.53.4

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.
@@ -277,6 +277,8 @@ export default class DapDSButton extends GenericFormElement {
277
277
  oklchPoc: boolean;
278
278
  /** The text for the target blank link, applicable when target is _blank. PRO TIP: Use parenthesis to wrap the text */
279
279
  targetBlankText: string;
280
+ /** Overrides the ARIA role on the internal native button/anchor element. Use when the host's semantics must differ from the native element (e.g. role="link" on a button acting as a SPA navigation trigger). */
281
+ forceRole?: string;
280
282
  static readonly styles: import('lit').CSSResult;
281
283
  private loadingTimer?;
282
284
  private getSecureRel;
@@ -285,6 +287,7 @@ export default class DapDSButton extends GenericFormElement {
285
287
  private validateProperties;
286
288
  private isValidUrl;
287
289
  private handleClick;
290
+ private handleKeyDown;
288
291
  private toggleHighContrast;
289
292
  private startLoadingTimeout;
290
293
  private clearLoadingTimeout;
@@ -1,4 +1,4 @@
1
- import { FloatingStrategy, PopupPlacement } from '../../common/types';
1
+ import { FloatingStrategy, LinkTarget, PopupPlacement } from '../../common/types';
2
2
  import { DdsElement } from '../../internal/dds-hu-element';
3
3
  import { SubmenuController } from './submenu-controller';
4
4
  declare const DapDSNavigationMenuItem_base: typeof DdsElement & {
@@ -15,6 +15,7 @@ declare const DapDSNavigationMenuItem_base: typeof DdsElement & {
15
15
  * @title - Navigation Menu Item
16
16
  * @group navigation-menu
17
17
  *
18
+ * @property {string} label - The label text for the navigation item. This will be displayed in the title slot if no custom title slot content is provided.
18
19
  * @property {'xs' | 'sm' | 'lg'} size - The size of the popup. Default is 'sm'.
19
20
  * @property {boolean} disabled - The disabled state of the popup. Default is false.
20
21
  * @property {boolean} opened - The open state of the popup. Default is false.
@@ -32,6 +33,9 @@ declare const DapDSNavigationMenuItem_base: typeof DdsElement & {
32
33
  * @property {string} ariaLabelledBy - The name of the element that labels the navigation dropdown.
33
34
  * @property {string} activeHref - The href of the navigation item that is active (receives aria-current="page").
34
35
  * @property {string} baseHref - The href of the navigation item. If provided, the navigation item will be active if the href is a substring of the activeHref.
36
+ * @property {string} href - The href URL for the navigation item link. When provided, the default trigger renders as a link.
37
+ * @property {'_blank' | '_self' | '_parent' | '_top'} target - The target attribute for link navigation.
38
+ * @property {string} rel - The rel attribute for link security and behavior.
35
39
  * @property {number} level - The nesting level of this navigation item (0 = top-level, automatically set for nested items). Default is 0.
36
40
  * @property {'horizontal' | 'vertical'} orientation - The orientation of the parent navigation menu (automatically inherited). Default is 'horizontal'.
37
41
  *
@@ -41,6 +45,8 @@ declare const DapDSNavigationMenuItem_base: typeof DdsElement & {
41
45
  * @slot trigger - The trigger element (link, button, etc.) for this navigation item.
42
46
  * @slot title - The title of the navigation item.
43
47
  * @slot indicator - The expand indicator icon (defaults to arrow icon based on orientation and level).
48
+ * @slot link - A router link element (e.g. Next.js Link) used for SPA navigation.
49
+ * Rendered outside the popup so it is always accessible to programmatic clicks.
44
50
  * @slot - The dropdown content (can contain nested dap-ds-navigation-menu-item elements).
45
51
  *
46
52
  * @csspart base - The base part of the navigation item.
@@ -112,22 +118,40 @@ export default class DapDSNavigationMenuItem extends DapDSNavigationMenuItem_bas
112
118
  baseHref?: string;
113
119
  /** Whether the navigation item should use exact href matching. */
114
120
  exactHref: boolean;
121
+ /** The href URL for the navigation item link. When provided, the default trigger renders as a link. */
122
+ href?: string;
123
+ /** The target attribute for link navigation. */
124
+ target?: LinkTarget;
125
+ /** The rel attribute for link security and behavior. */
126
+ rel?: string;
127
+ /** The label text for the navigation item, displayed in the title slot when no slot content is provided. */
128
+ label?: string;
115
129
  /** The nesting level of this navigation item (0 = top-level). */
116
130
  level: number;
117
131
  /** The orientation of the parent navigation menu. */
118
132
  orientation: 'horizontal' | 'vertical';
119
133
  hasContent: boolean;
134
+ private hasLink;
135
+ private hasTitleSlot;
120
136
  private active;
121
137
  private openedByHover;
138
+ private _isRovingActive;
122
139
  /** Computed property to detect if this item contains nested navigation menu items. */
123
140
  get hasNestedItems(): boolean;
124
141
  private get _trigger();
142
+ /** Get the element slotted into the `link` slot, if any. */
143
+ private _getLinkElement;
144
+ /** Handle slot change for the `link` slot. */
145
+ private _handleLinkSlotChange;
146
+ /** Handle slot change for the `title` slot. */
147
+ private _handleTitleSlotChange;
125
148
  constructor();
126
149
  connectedCallback(): void;
127
150
  disconnectedCallback(): void;
128
151
  firstUpdated(changedProperties: Map<string, unknown>): Promise<void>;
129
152
  handleOpenedChange(): void;
130
153
  handleActiveHrefChange(): void;
154
+ handleHrefChange(): void;
131
155
  handleLayoutChange(): void;
132
156
  /** Update nested navigation menu items with current properties. */
133
157
  private _updateNestedItems;
@@ -153,6 +177,22 @@ export default class DapDSNavigationMenuItem extends DapDSNavigationMenuItem_bas
153
177
  /** Check if target is within any nested navigation menu items. */
154
178
  private _isWithinNestedItems;
155
179
  focus(): void;
180
+ /**
181
+ * Sets this item as the active (or inactive) roving tabindex target.
182
+ * Only the active item's trigger is in the sequential tab order (tabindex="0").
183
+ * All others are removed (tabindex="-1") so Tab exits the whole nav in one step.
184
+ */
185
+ setRovingTabIndex(active: boolean): void;
186
+ /** Apply tabindex to a trigger element and its shadow-root inner focusable element. */
187
+ private _applyTriggerTabIndex;
188
+ /** Focus the first focusable element in the dropdown (supports both nested nav items and mega menu content). */
189
+ focusFirstDropdownChild(): void;
190
+ /** Focus the last focusable element in the dropdown (supports both nested nav items and mega menu content). */
191
+ focusLastDropdownChild(): void;
192
+ /** Get all top-level focusable items inside the popup slot content (for mega menu arrow navigation). */
193
+ private _getFocusablePopupItems;
194
+ private _collectFocusableItems;
195
+ private _focusPopupItem;
156
196
  showDropDown(byHover?: boolean): Promise<void>;
157
197
  hideDropDown(): Promise<void>;
158
198
  /** Handle trigger slot change events. */
@@ -53,13 +53,14 @@ export default class DapDSNavigationMenu extends DdsElement {
53
53
  /** Gets all slotted menu items, ignoring disabled elements */
54
54
  getAllItems(): DapDSNavigationMenuItem[];
55
55
  /**
56
- * Gets the current menu item, which is the menu item that has `tabindex="0"` within the roving tab index.
56
+ * Gets the current menu item (the one marked with `data-nav-current`).
57
57
  * The menu item may or may not have focus, but for keyboard interaction purposes it's considered the "active" item.
58
58
  */
59
59
  getCurrentItem(): DapDSNavigationMenuItem | undefined;
60
60
  /**
61
- * Sets the current menu item to the specified element. This sets `tabindex="0"` on the target element and
62
- * `tabindex="-1"` to all other items. This method must be called prior to setting focus on a menu item.
61
+ * Sets the current menu item. Applies roving tabindex to the trigger elements so that only
62
+ * the active item's trigger is in the sequential tab order (tabindex="0"). All others get
63
+ * tabindex="-1" so a single Tab exits the entire navigation.
63
64
  */
64
65
  setCurrentItem(item: DapDSNavigationMenuItem): void;
65
66
  private _updateChildFullWidth;