dap-design-system 0.53.16 → 0.53.18

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.
@@ -88,3 +88,5 @@ export interface TimePreset {
88
88
  value: string;
89
89
  }
90
90
  export type CloseSource = 'cancel-button' | 'close-button' | 'esc' | 'ok-button' | 'overlay';
91
+ export type AccordionVariant = 'default' | 'collapsed' | 'clean' | 'clean-collapsed';
92
+ export type TabNavigationMode = 'group' | 'items';
@@ -1,7 +1,7 @@
1
1
  import { PropertyValueMap, TemplateResult } from 'lit';
2
+ import { AccordionVariant } from '../../common/types';
2
3
  import { HeadingLevel, LabelPlacement } from '../../dap-design-system';
3
4
  import { DdsElement } from '../../internal/dds-hu-element';
4
- export type AccordionVariant = 'default' | 'collapsed' | 'clean' | 'clean-collapsed';
5
5
  export interface AccordionEventDetail {
6
6
  open: boolean;
7
7
  item: AccordionBaseElement;
@@ -1,6 +1,6 @@
1
1
  import { PropertyValueMap } from 'lit';
2
+ import { AccordionVariant } from '../../dap-design-system';
2
3
  import { DdsElement } from '../../internal/dds-hu-element';
3
- import { AccordionVariant } from '../accordion/accordion-base-element';
4
4
  /**
5
5
  * `dap-ds-accordion-group` is a custom accordion group component.
6
6
  * @element dap-ds-accordion-group
@@ -9,6 +9,8 @@ import { DdsElement } from '../../internal/dds-hu-element';
9
9
  * @event {{ event: Event }} dds-click - Emitted when the link is clicked.
10
10
  *
11
11
  * @slot - The text of the link.
12
+ * @slot link - A router link element (e.g. Next.js Link) used for SPA navigation.
13
+ * Rendered outside the visible link so it is always accessible to programmatic clicks.
12
14
  *
13
15
  * @csspart base - The main link container.
14
16
  * @csspart text - The text of the link.
@@ -89,6 +91,9 @@ export default class DapDSLink extends DdsElement {
89
91
  /** The text for the target blank link, applicable when target is _blank. PRO TIP: Use parenthesis to wrap the text */
90
92
  targetBlankText: string;
91
93
  static readonly styles: import('lit').CSSResult;
94
+ private hasLink;
95
+ private _getLinkElement;
96
+ private _handleLinkSlotChange;
92
97
  private handleClick;
93
98
  focus(): void;
94
99
  render(): import('lit-html').TemplateResult;
@@ -1,4 +1,4 @@
1
- import { FloatingStrategy, LinkTarget, PopupPlacement } from '../../common/types';
1
+ import { FloatingStrategy, LinkTarget, PopupPlacement, TabNavigationMode } 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 & {
@@ -38,6 +38,7 @@ declare const DapDSNavigationMenuItem_base: typeof DdsElement & {
38
38
  * @property {string} rel - The rel attribute for link security and behavior.
39
39
  * @property {number} level - The nesting level of this navigation item (0 = top-level, automatically set for nested items). Default is 0.
40
40
  * @property {'horizontal' | 'vertical'} orientation - The orientation of the parent navigation menu (automatically inherited). Default is 'horizontal'.
41
+ * @property {'group' | 'items'} tabMode - Controls how Tab key navigates through top-level items. Default is 'group'.
41
42
  *
42
43
  * @event {{ href: string, event: Event }} dds-navigation-item-click - Fired when a navigation item is clicked.
43
44
  * @event {{ item: DapDSNavigationMenuItem }} dds-navigation-dropdown-open - Fired when a navigation dropdown is opened.
@@ -130,9 +131,12 @@ export default class DapDSNavigationMenuItem extends DapDSNavigationMenuItem_bas
130
131
  level: number;
131
132
  /** The orientation of the parent navigation menu. */
132
133
  orientation: 'horizontal' | 'vertical';
134
+ /** Controls tab key behavior (propagated from parent navigation menu). */
135
+ tabMode: TabNavigationMode;
133
136
  hasContent: boolean;
134
137
  private hasLink;
135
138
  private hasTitleSlot;
139
+ private _titleText;
136
140
  private active;
137
141
  private openedByHover;
138
142
  private _isRovingActive;
@@ -192,6 +196,7 @@ export default class DapDSNavigationMenuItem extends DapDSNavigationMenuItem_bas
192
196
  /** Get all top-level focusable items inside the popup slot content (for mega menu arrow navigation). */
193
197
  private _getFocusablePopupItems;
194
198
  private _collectFocusableItems;
199
+ private _activateFocusableItem;
195
200
  private _focusPopupItem;
196
201
  showDropDown(byHover?: boolean): Promise<void>;
197
202
  hideDropDown(): Promise<void>;
@@ -1,3 +1,4 @@
1
+ import { TabNavigationMode } from '../../common/types';
1
2
  import { DdsElement } from '../../internal/dds-hu-element';
2
3
  import { default as DapDSNavigationMenuItem } from './navigation-menu-item.component';
3
4
  /**
@@ -13,6 +14,7 @@ import { default as DapDSNavigationMenuItem } from './navigation-menu-item.compo
13
14
  * @property {'horizontal' | 'vertical'} orientation - The orientation of the navigation menu. Default is 'horizontal'.
14
15
  * @property {boolean} fullWidth - Whether the navigation menu should take full width of the screen. Default is false.
15
16
  * @property {boolean} allowMultipleOpen - Whether multiple dropdown branches can stay open simultaneously (accordion mode). Default is true.
17
+ * @property {'group' | 'items'} tabMode - Controls how Tab key navigates through top-level items. Default is 'group'. Group mode will have the first item in the tab order, and items mode will have all items in the tab order.
16
18
  *
17
19
  * @event {{ href: string, event: Event }} dds-navigation-item-click - Fired when a navigation item is clicked.
18
20
  *
@@ -42,6 +44,13 @@ export default class DapDSNavigationMenu extends DdsElement {
42
44
  fullWidth: boolean;
43
45
  /** Whether multiple dropdown branches can stay open simultaneously (accordion mode). */
44
46
  allowMultipleOpen: boolean;
47
+ /**
48
+ * Controls how Tab key navigates through top-level items.
49
+ * - 'group' (default): Roving tab index — only one item in the tab order, arrow keys move between items.
50
+ * - 'items': All top-level items have tabindex="0" — Tab moves through each item individually.
51
+ * @type {'group' | 'items'}
52
+ */
53
+ tabMode: TabNavigationMode;
45
54
  connectedCallback(): void;
46
55
  updated(changedProperties: Map<string, unknown>): void;
47
56
  firstUpdated(changedProperties: Map<string, unknown>): Promise<void>;
@@ -58,9 +67,9 @@ export default class DapDSNavigationMenu extends DdsElement {
58
67
  */
59
68
  getCurrentItem(): DapDSNavigationMenuItem | undefined;
60
69
  /**
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.
70
+ * Sets the current menu item. In 'group' mode (default), applies roving tabindex so only the
71
+ * active item's trigger is in the sequential tab order (tabindex="0"). In 'items' mode, all
72
+ * top-level items remain in the tab order — only the data-nav-current marker is updated.
64
73
  */
65
74
  setCurrentItem(item: DapDSNavigationMenuItem): void;
66
75
  private _updateChildFullWidth;
@@ -68,10 +77,23 @@ export default class DapDSNavigationMenu extends DdsElement {
68
77
  private _updateActiveHref;
69
78
  /** Recursively update orientation property for all navigation items. */
70
79
  private _updateOrientation;
80
+ /** Update tabMode property for all top-level navigation items. */
81
+ private _updateTabMode;
82
+ /**
83
+ * Applies tab behavior based on the current tabMode:
84
+ * - 'items': All top-level item triggers get tabindex="0".
85
+ * - 'group': Restore roving tabindex — only the current/first item gets tabindex="0".
86
+ */
87
+ private _applyTabMode;
71
88
  /** Helper method to recursively update properties on nested items. */
72
89
  private _updatePropertyRecursive;
73
90
  private _handleNavigationItemClick;
74
91
  private _handleDropdownOpen;
75
92
  private _handleSlotChange;
93
+ /**
94
+ * In `tabMode="items"`, keep `data-nav-current` in sync with the element that
95
+ * received focus so that arrow-key navigation always targets the right item.
96
+ */
97
+ private _handleFocusIn;
76
98
  render(): import('lit-html').TemplateResult;
77
99
  }