@rcarls/rc-adaptive-menu 0.0.0-next-20260921045401
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/CHANGELOG.md +45 -0
- package/README.md +74 -0
- package/dist/custom-elements.json +906 -0
- package/dist/rc-adaptive-menu-BwvfkD_X.js +589 -0
- package/dist/rc-adaptive-menu-BwvfkD_X.js.map +1 -0
- package/dist/rc-adaptive-menu-define.js +6 -0
- package/dist/rc-adaptive-menu-define.js.map +1 -0
- package/dist/rc-adaptive-menu.js +5 -0
- package/dist/rc-adaptive-menu.js.map +1 -0
- package/dist/types/packages/rc-adaptive-menu/src/define.d.ts +1 -0
- package/dist/types/packages/rc-adaptive-menu/src/index.d.ts +1 -0
- package/dist/types/packages/rc-adaptive-menu/src/rc-adaptive-menu.d.ts +180 -0
- package/dist/types/packages/rc-adaptive-menu/src/rc-adaptive-menu.styles.d.ts +2 -0
- package/package.json +65 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# @rcarls/rc-adaptive-menu
|
|
2
|
+
|
|
3
|
+
## 0.0.0-next-20260921045401
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [50d5610]
|
|
8
|
+
- Updated dependencies [4341311]
|
|
9
|
+
- @rcarls/rc-common@0.0.0-next-20260921045401
|
|
10
|
+
|
|
11
|
+
## 0.6.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 7382c71: Add a priority-aware action toolbar that moves original controls into an
|
|
16
|
+
overflow menu. Which actions are promoted is a purely declarative computation
|
|
17
|
+
from `max-shown` and each action's `data-priority`/authored `slot`, with no
|
|
18
|
+
runtime measurement of the toolbar's or its children's rendered size: a
|
|
19
|
+
consumer whose promoted count needs to react to available space owns that
|
|
20
|
+
decision and writes the resulting `max-shown` value down. Include controlled
|
|
21
|
+
and uncontrolled open state, keyboard navigation, light dismissal, and a
|
|
22
|
+
non-Popover fallback.
|
|
23
|
+
|
|
24
|
+
Fix `--rc-adaptive-menu-touch-target-overlap-inline-start`/`-end`: the host's
|
|
25
|
+
own `max-inline-size: 100%` self-referenced a shrink-to-fit ancestor's
|
|
26
|
+
already-margin-reduced auto size (an app bar's own trailing group, for
|
|
27
|
+
example), quietly clamping the host back down and canceling the overlap out
|
|
28
|
+
from under it. The cap now grows by the overlap amount so it only ever bounds
|
|
29
|
+
the host's real content.
|
|
30
|
+
|
|
31
|
+
- 7382c71: Add `--rc-adaptive-menu-touch-target-overlap-inline-start` and
|
|
32
|
+
`-inline-end`, zero by default. A theme or consumer sets one to let the
|
|
33
|
+
overflow trigger's accessible touch-target inflation on that side overlap
|
|
34
|
+
into whatever sits just outside the host, such as a toolbar's own edge
|
|
35
|
+
padding, instead of also reserving layout space there (the overflow
|
|
36
|
+
trigger is conventionally the trailing-most control in a toolbar, so
|
|
37
|
+
`-inline-end` is the one commonly set). Mirrors `@rcarls/rc-button`'s and
|
|
38
|
+
`@rcarls/rc-menu-button`'s own touch-target overlap tokens.
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [6683eb9]
|
|
43
|
+
- Updated dependencies [ee7ba6c]
|
|
44
|
+
- Updated dependencies [30eb232]
|
|
45
|
+
- @rcarls/rc-common@0.6.0
|
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# `@rcarls/rc-adaptive-menu`
|
|
2
|
+
|
|
3
|
+
Priority-aware action toolbar that preserves authored controls while moving
|
|
4
|
+
lower-priority actions into an overflow menu. The same light-DOM nodes remain
|
|
5
|
+
connected, so framework handlers, form behavior, dialog invokers, and element
|
|
6
|
+
references keep working when an action moves.
|
|
7
|
+
|
|
8
|
+
Docs: [https://richardcarls.github.io/rc-webcomponents/components/rc-adaptive-menu](https://richardcarls.github.io/rc-webcomponents/components/rc-adaptive-menu).
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @rcarls/rc-adaptive-menu
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<rc-adaptive-menu label="Document actions" max-shown="3">
|
|
20
|
+
<button type="button" data-priority="30">
|
|
21
|
+
<span data-rc-menu-leading aria-hidden="true">★</span>
|
|
22
|
+
<span data-rc-menu-label>Favorite</span>
|
|
23
|
+
</button>
|
|
24
|
+
<button type="button" data-priority="20">
|
|
25
|
+
<span data-rc-menu-leading aria-hidden="true">✎</span>
|
|
26
|
+
<span data-rc-menu-label>Edit</span>
|
|
27
|
+
</button>
|
|
28
|
+
<button type="button" slot="overflow">
|
|
29
|
+
<span data-rc-menu-label>Delete</span>
|
|
30
|
+
</button>
|
|
31
|
+
</rc-adaptive-menu>
|
|
32
|
+
|
|
33
|
+
<script type="module">
|
|
34
|
+
import '@rcarls/rc-adaptive-menu/define';
|
|
35
|
+
</script>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Larger numeric `data-priority` values are promoted first, with DOM order as the
|
|
39
|
+
tie breaker, up to `max-shown` authored actions. Author `slot="overflow"` to
|
|
40
|
+
keep an action in the overflow menu regardless of `max-shown`. A negative
|
|
41
|
+
`data-priority` has the same effect: the action always overflows. The overflow
|
|
42
|
+
menu renders in authored DOM order (native slot distribution isn't
|
|
43
|
+
JS-ordered), so author negative-priority actions after normal-priority ones to
|
|
44
|
+
have them appear last. `max-shown` is a static declarative cap, re-evaluated
|
|
45
|
+
whenever it or an authored action's `data-priority` changes: the component
|
|
46
|
+
does not measure its own or its children's rendered size, so promoted actions
|
|
47
|
+
are not guaranteed to visually fit any particular container. A consumer that
|
|
48
|
+
needs the promoted count to react to available space (a breakpoint, a
|
|
49
|
+
container query, a window size class) owns that decision and writes the
|
|
50
|
+
resulting `max-shown` value down. When the authored set changes, the
|
|
51
|
+
component changes the actions' slot, `role`, and `tabindex`, then restores
|
|
52
|
+
the authored values when they return or disconnect. Demoted `rc-menu-button`
|
|
53
|
+
actions also receive vertical menu-row orientation while overflowed, with
|
|
54
|
+
their authored orientation restored when promoted or disconnected.
|
|
55
|
+
|
|
56
|
+
In horizontal mode the toolbar is a plain shrink-to-fit flex row:
|
|
57
|
+
`max-inline-size: 100%` keeps it constrained by its allocated space, but its
|
|
58
|
+
own preferred width is ordinary CSS, sized to only the actions actually
|
|
59
|
+
promoted. No JS-computed intrinsic-size hint is involved.
|
|
60
|
+
|
|
61
|
+
Use `data-rc-menu-leading`, `data-rc-menu-label`,
|
|
62
|
+
`data-rc-menu-trailing`, and `data-rc-menu-shortcut` to expose menu content
|
|
63
|
+
regions to themes shared with `rc-menu`.
|
|
64
|
+
|
|
65
|
+
The visible overflow button and its activation area can be sized independently
|
|
66
|
+
with `--rc-adaptive-menu-trigger-*` and
|
|
67
|
+
`--rc-adaptive-menu-touch-target-*`. The default activation-area floor is
|
|
68
|
+
`3rem` in both axes.
|
|
69
|
+
|
|
70
|
+
Use `default-open` for initial uncontrolled state, or write `open` and handle
|
|
71
|
+
`rc-adaptive-menu-toggle` for controlled state. The event reports the state
|
|
72
|
+
requested by user interaction; property writes and `openMenu()`, `closeMenu()`,
|
|
73
|
+
and `toggleMenu()` calls are silent. The `$actions`, `$promotedActions`, and
|
|
74
|
+
`$overflowedActions` getters expose the original nodes in current DOM order.
|