@rcarls/rc-adaptive-menu 0.5.0 → 0.7.0

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.
@@ -1,4 +1,5 @@
1
1
  import { LitElement } from 'lit';
2
+ import { FlowController } from '@rcarls/rc-common';
2
3
  /** Detail payload for the `rc-adaptive-menu-toggle` event. */
3
4
  export interface RCAdaptiveMenuToggleEvent {
4
5
  /** The open state requested by the user. */
@@ -12,6 +13,19 @@ declare global {
12
13
  'rc-adaptive-menu-toggle': CustomEvent<RCAdaptiveMenuToggleEvent>;
13
14
  }
14
15
  }
16
+ /** Built-in text of `rc-adaptive-menu`. */
17
+ export interface RCAdaptiveMenuMessages {
18
+ /** Default accessible name of the toolbar, when `label` is unset. */
19
+ label: string;
20
+ /** Accessible name of the overflow trigger and popup. */
21
+ overflow: string;
22
+ }
23
+ export declare const DEFAULT_ADAPTIVE_MENU_MESSAGES: Readonly<RCAdaptiveMenuMessages>;
24
+ declare module '@rcarls/rc-common' {
25
+ interface RcMessageCatalog {
26
+ 'rc-adaptive-menu': RCAdaptiveMenuMessages;
27
+ }
28
+ }
15
29
  /**
16
30
  * Priority-aware action toolbar that preserves authored light-DOM controls while moving
17
31
  * lower-priority actions into an overflow menu.
@@ -39,6 +53,10 @@ declare global {
39
53
  * space — a responsive breakpoint, a container query, a window size class —
40
54
  * owns that decision itself and writes the resulting `max-shown` value down.
41
55
  *
56
+ * Built-in text (the toolbar and overflow names) follows the element's own `lang`, else
57
+ * `<html lang>`: per element through `messages`, or for every instance
58
+ * through `registerMessages()` from `@rcarls/rc-common` under `rc-adaptive-menu`.
59
+ *
42
60
  * @see {@link https://richardcarls.github.io/rc-webcomponents/components/rc-adaptive-menu rc-adaptive-menu docs}
43
61
  * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/ WAI-ARIA Toolbar pattern}
44
62
  * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/ WAI-ARIA Menu Button pattern}
@@ -49,14 +67,15 @@ declare global {
49
67
  *
50
68
  * @fires rc-adaptive-menu-toggle - Fired when user interaction requests a change to `open`.
51
69
  *
52
- * @attr label - Accessible label for the toolbar. Defaults to `Actions`.
70
+ * @attr label - Accessible label for the toolbar. Defaults to the `label` message, `Actions`.
53
71
  * @attr max-shown - Maximum number of authored actions promoted ahead of the overflow trigger.
54
72
  * A static declarative cap, not a measurement of available space — actions beyond it move to
55
73
  * the overflow menu regardless of whether they'd visually fit. Defaults to 3.
56
74
  * @attr open - Whether the overflow menu is visible. Host writes are silent.
57
75
  * @attr default-open - Initial open state for uncontrolled usage.
58
- * @attr orientation - Toolbar layout and arrow-key axis: `horizontal` or `vertical`.
59
- * @attr overflow-label - Accessible label for the overflow trigger and popup. Defaults to `More actions`.
76
+ * @attr orientation - Toolbar layout along the inline (`horizontal`) or block (`vertical`) axis.
77
+ * `aria-orientation` and the arrow keys follow the orientation actually rendered, which turns
78
+ * over in vertical writing modes.
60
79
  *
61
80
  * @csspart root - Toolbar container.
62
81
  * @csspart overflow-trigger - Button that opens the overflow menu.
@@ -79,16 +98,25 @@ declare global {
79
98
  * @cssprop [--rc-adaptive-menu-trigger-radius=var(--rc-control-radius)] - Overflow trigger radius.
80
99
  * @cssprop [--rc-adaptive-menu-trigger-background=ButtonFace] - Overflow trigger background.
81
100
  * @cssprop [--rc-adaptive-menu-trigger-color=ButtonText] - Overflow trigger color.
101
+ * @cssprop [--rc-adaptive-menu-trigger-hover-background=var(--rc-adaptive-menu-trigger-background)] - Overflow trigger background under the pointer.
102
+ * @cssprop [--rc-adaptive-menu-trigger-shadow=none] - Overflow trigger box shadow.
103
+ * @cssprop [--rc-adaptive-menu-trigger-active-shadow=var(--rc-adaptive-menu-trigger-shadow)] - Overflow trigger box shadow while pressed.
104
+ * @cssprop [--rc-item-font-family=inherit] - Overflow action label font family; shared with menu and listbox items.
105
+ * @cssprop [--rc-item-font-size=inherit] - Overflow action label font size; shared with menu and listbox items.
106
+ * @cssprop [--rc-item-font-weight=inherit] - Overflow action label font weight; shared with menu and listbox items.
107
+ * @cssprop [--rc-item-line-height=inherit] - Overflow action label line height; shared with menu and listbox items.
108
+ * @cssprop [--rc-item-letter-spacing=inherit] - Overflow action label letter spacing; shared with menu and listbox items.
109
+ * @cssprop [--rc-item-icon-size=inherit] - Overflow action leading icon size; shared with menu items.
82
110
  * @cssprop [--rc-adaptive-menu-icon-size=1.5em] - Default overflow icon size.
83
111
  * @cssprop [--rc-adaptive-menu-popup-min-inline-size=10em] - Overflow popup minimum inline size.
84
112
  * @cssprop [--rc-adaptive-menu-popup-max-inline-size=calc(100dvi - 0.5rem)] - Overflow popup viewport-aware inline limit.
85
113
  * @cssprop [--rc-adaptive-menu-popup-max-block-size=calc(100dvb - 0.5rem)] - Overflow popup viewport-aware block limit.
86
- * @cssprop [--rc-adaptive-menu-popup-padding-block=0.25em] - Overflow popup block padding.
87
- * @cssprop [--rc-adaptive-menu-popup-border=var(--rc-border)] - Overflow popup border.
88
- * @cssprop [--rc-adaptive-menu-popup-radius=var(--rc-control-radius)] - Overflow popup radius.
89
- * @cssprop [--rc-adaptive-menu-popup-background=var(--rc-surface)] - Overflow popup background.
90
- * @cssprop [--rc-adaptive-menu-popup-shadow=var(--rc-shadow)] - Overflow popup shadow.
91
- * @cssprop [--rc-adaptive-menu-popup-color=var(--rc-field-text)] - Overflow popup foreground.
114
+ * @cssprop [--rc-adaptive-menu-popup-padding-block=var(--rc-popup-padding-block)] - Overflow popup block padding.
115
+ * @cssprop [--rc-adaptive-menu-popup-border=var(--rc-popup-border)] - Overflow popup border.
116
+ * @cssprop [--rc-adaptive-menu-popup-radius=var(--rc-popup-radius)] - Overflow popup radius.
117
+ * @cssprop [--rc-adaptive-menu-popup-background=var(--rc-popup-background)] - Overflow popup background.
118
+ * @cssprop [--rc-adaptive-menu-popup-shadow=var(--rc-popup-shadow)] - Overflow popup shadow.
119
+ * @cssprop [--rc-adaptive-menu-popup-color=var(--rc-popup-color)] - Overflow popup foreground.
92
120
  * @cssprop [--rc-adaptive-menu-item-min-block-size=2.5em] - Overflow action minimum block size.
93
121
  * @cssprop [--rc-adaptive-menu-item-padding-block=var(--rc-item-padding-block)] - Overflow action block padding.
94
122
  * @cssprop [--rc-adaptive-menu-item-padding-inline=var(--rc-item-padding-inline)] - Overflow action inline padding.
@@ -96,9 +124,12 @@ declare global {
96
124
  */
97
125
  export declare class RCAdaptiveMenu extends LitElement {
98
126
  static styles: import('lit').CSSResult;
127
+ /** Built-in text overrides; unset keys fall back to registered text, then English. */
128
+ messages: Partial<RCAdaptiveMenuMessages> | undefined;
129
+ private readonly _messages;
99
130
  private static readonly _styledRoots;
100
- /** Accessible label for the toolbar. */
101
- label: string;
131
+ /** Accessible label for the toolbar. Defaults to the `label` message. */
132
+ label: string | undefined;
102
133
  /**
103
134
  * Maximum authored actions promoted ahead of the overflow trigger. A
104
135
  * static declarative cap, re-evaluated whenever it changes — not a
@@ -117,8 +148,8 @@ export declare class RCAdaptiveMenu extends LitElement {
117
148
  set defaultOpen(value: boolean);
118
149
  /** Toolbar layout and arrow-key navigation axis. */
119
150
  orientation: 'horizontal' | 'vertical';
120
- /** Accessible name for the overflow trigger and popup. */
121
- overflowLabel: string;
151
+ /** Keeps the exposed aria-orientation on the orientation actually rendered. */
152
+ protected readonly _flow: FlowController;
122
153
  private _$trigger;
123
154
  private _$popup;
124
155
  private readonly _authored;
@@ -127,6 +158,7 @@ export declare class RCAdaptiveMenu extends LitElement {
127
158
  private _restoreFocusWhenClosed;
128
159
  private _focusWhenOpened;
129
160
  private readonly _anchor;
161
+ private readonly _popover;
130
162
  connectedCallback(): void;
131
163
  disconnectedCallback(): void;
132
164
  protected firstUpdated(): void;
@@ -143,7 +175,7 @@ export declare class RCAdaptiveMenu extends LitElement {
143
175
  closeMenu(returnFocus?: boolean): void;
144
176
  /** Toggles the overflow popup silently. */
145
177
  toggleMenu(focus?: 'first' | 'last' | 'none'): void;
146
- protected render(): import('lit').TemplateResult<1>;
178
+ protected render(): import('lit-html').TemplateResult<1>;
147
179
  private static _ensureBaseStyles;
148
180
  private _onSlotChange;
149
181
  private _onMutation;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.5.0",
6
+ "version": "0.7.0",
7
7
  "description": "Priority-aware action toolbar that preserves authored controls while moving lower-priority actions into an overflow menu.",
8
8
  "repository": {
9
9
  "type": "git",
@@ -45,7 +45,7 @@
45
45
  "test:browser:firefox": "vitest --run --project=firefox"
46
46
  },
47
47
  "dependencies": {
48
- "@rcarls/rc-common": "0.5.0"
48
+ "@rcarls/rc-common": "0.7.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@custom-elements-manifest/analyzer": "0.11.0",