menhir 0.1.3 → 0.1.5
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/LICENSE +6 -0
- package/README.md +9 -2
- package/dist/context-menu/index.js +2 -0
- package/dist/context-menu/index.parts.js +13 -0
- package/dist/context-menu/popup/ContextMenuPopup.js +30 -0
- package/dist/context-menu/root/ContextMenuContext.js +11 -0
- package/dist/context-menu/root/ContextMenuRoot.js +23 -0
- package/dist/context-menu/trigger/ContextMenuTrigger.js +47 -0
- package/dist/core/createControllableSignal.js +11 -2
- package/dist/core/listValue.js +2 -7
- package/dist/core/mergeElementProps.js +7 -1
- package/dist/floating/dismissal/escape.js +2 -1
- package/dist/floating/list-navigation/activeDescendant.js +29 -0
- package/dist/floating/list-navigation/listNavigation.js +108 -0
- package/dist/floating/list-navigation/roving.js +27 -0
- package/dist/floating/typeahead/match.js +24 -0
- package/dist/floating/typeahead/typeahead.js +56 -0
- package/dist/menu/checkbox-item/MenuCheckboxItem.js +28 -0
- package/dist/menu/group/MenuGroup.js +40 -0
- package/dist/menu/group/MenuGroupContext.js +10 -0
- package/dist/menu/group-label/MenuGroupLabel.js +27 -0
- package/dist/menu/index.js +2 -0
- package/dist/menu/index.parts.js +13 -0
- package/dist/menu/item/MenuItem.js +30 -0
- package/dist/menu/item/menuItemProps.js +77 -0
- package/dist/menu/item/renderCheckedItem.js +52 -0
- package/dist/menu/item-indicator/MenuItemIndicator.js +23 -0
- package/dist/menu/item-indicator/MenuItemIndicatorContext.js +10 -0
- package/dist/menu/popup/MenuPopup.js +123 -0
- package/dist/menu/radio-group/MenuRadioGroup.js +39 -0
- package/dist/menu/radio-item/MenuRadioItem.js +21 -0
- package/dist/menu/root/MenuContext.js +114 -0
- package/dist/menu/root/MenuRoot.js +19 -0
- package/dist/menu/submenu/MenuSubmenu.js +18 -0
- package/dist/menu/submenu-trigger/MenuSubmenuTrigger.js +114 -0
- package/dist/menu/trigger/MenuTrigger.js +67 -0
- package/dist/menubar/index.js +2 -0
- package/dist/menubar/index.parts.js +14 -0
- package/dist/menubar/menu/MenubarMenu.js +30 -0
- package/dist/menubar/root/MenubarContext.js +10 -0
- package/dist/menubar/root/MenubarRoot.js +68 -0
- package/dist/menubar/trigger/MenubarTrigger.js +73 -0
- package/dist/navigation-menu/index.js +2 -0
- package/dist/navigation-menu/index.parts.js +6 -0
- package/dist/navigation-menu/item/NavigationMenuItem.js +83 -0
- package/dist/navigation-menu/item/NavigationMenuItemContext.js +10 -0
- package/dist/navigation-menu/link/NavigationMenuLink.js +26 -0
- package/dist/navigation-menu/panel/NavigationMenuPanel.js +31 -0
- package/dist/navigation-menu/root/NavigationMenuRoot.js +100 -0
- package/dist/navigation-menu/root/NavigationMenuRootContext.js +10 -0
- package/dist/navigation-menu/trigger/NavigationMenuTrigger.js +36 -0
- package/dist/source/context-menu/index.d.ts +1 -0
- package/dist/source/context-menu/index.js +1 -0
- package/dist/source/context-menu/index.parts.d.ts +12 -0
- package/dist/source/context-menu/index.parts.js +13 -0
- package/dist/source/context-menu/popup/ContextMenuPopup.d.ts +12 -0
- package/dist/source/context-menu/popup/ContextMenuPopup.jsx +36 -0
- package/dist/source/context-menu/root/ContextMenuContext.d.ts +18 -0
- package/dist/source/context-menu/root/ContextMenuContext.js +12 -0
- package/dist/source/context-menu/root/ContextMenuRoot.d.ts +12 -0
- package/dist/source/context-menu/root/ContextMenuRoot.jsx +16 -0
- package/dist/source/context-menu/trigger/ContextMenuTrigger.d.ts +15 -0
- package/dist/source/context-menu/trigger/ContextMenuTrigger.jsx +46 -0
- package/dist/source/core/createControllableSignal.d.ts +9 -1
- package/dist/source/core/createControllableSignal.js +7 -2
- package/dist/source/core/listValue.js +4 -10
- package/dist/source/core/mergeElementProps.d.ts +8 -0
- package/dist/source/core/mergeElementProps.js +7 -1
- package/dist/source/floating/dismissal/escape.d.ts +2 -1
- package/dist/source/floating/dismissal/escape.js +2 -1
- package/dist/source/floating/dismissal/reason.d.ts +11 -2
- package/dist/source/floating/list-navigation/activeDescendant.d.ts +30 -0
- package/dist/source/floating/list-navigation/activeDescendant.js +24 -0
- package/dist/source/floating/list-navigation/listNavigation.d.ts +68 -0
- package/dist/source/floating/list-navigation/listNavigation.js +148 -0
- package/dist/source/floating/list-navigation/roving.d.ts +23 -0
- package/dist/source/floating/list-navigation/roving.js +25 -0
- package/dist/source/floating/typeahead/match.d.ts +14 -0
- package/dist/source/floating/typeahead/match.js +32 -0
- package/dist/source/floating/typeahead/typeahead.d.ts +41 -0
- package/dist/source/floating/typeahead/typeahead.js +81 -0
- package/dist/source/menu/checkbox-item/MenuCheckboxItem.d.ts +20 -0
- package/dist/source/menu/checkbox-item/MenuCheckboxItem.jsx +26 -0
- package/dist/source/menu/group/MenuGroup.d.ts +16 -0
- package/dist/source/menu/group/MenuGroup.jsx +31 -0
- package/dist/source/menu/group/MenuGroupContext.d.ts +10 -0
- package/dist/source/menu/group/MenuGroupContext.js +12 -0
- package/dist/source/menu/group-label/MenuGroupLabel.d.ts +11 -0
- package/dist/source/menu/group-label/MenuGroupLabel.jsx +25 -0
- package/dist/source/menu/index.d.ts +1 -0
- package/dist/source/menu/index.js +1 -0
- package/dist/source/menu/index.parts.d.ts +12 -0
- package/dist/source/menu/index.parts.js +12 -0
- package/dist/source/menu/item/MenuItem.d.ts +11 -0
- package/dist/source/menu/item/MenuItem.jsx +21 -0
- package/dist/source/menu/item/menuItemProps.d.ts +35 -0
- package/dist/source/menu/item/menuItemProps.js +78 -0
- package/dist/source/menu/item/renderCheckedItem.d.ts +22 -0
- package/dist/source/menu/item/renderCheckedItem.jsx +41 -0
- package/dist/source/menu/item-indicator/MenuItemIndicator.d.ts +12 -0
- package/dist/source/menu/item-indicator/MenuItemIndicator.jsx +17 -0
- package/dist/source/menu/item-indicator/MenuItemIndicatorContext.d.ts +11 -0
- package/dist/source/menu/item-indicator/MenuItemIndicatorContext.js +12 -0
- package/dist/source/menu/popup/MenuPopup.d.ts +41 -0
- package/dist/source/menu/popup/MenuPopup.jsx +156 -0
- package/dist/source/menu/radio-group/MenuRadioGroup.d.ts +27 -0
- package/dist/source/menu/radio-group/MenuRadioGroup.jsx +36 -0
- package/dist/source/menu/radio-item/MenuRadioItem.d.ts +14 -0
- package/dist/source/menu/radio-item/MenuRadioItem.jsx +19 -0
- package/dist/source/menu/root/MenuContext.d.ts +114 -0
- package/dist/source/menu/root/MenuContext.js +123 -0
- package/dist/source/menu/root/MenuRoot.d.ts +11 -0
- package/dist/source/menu/root/MenuRoot.jsx +9 -0
- package/dist/source/menu/submenu/MenuSubmenu.d.ts +22 -0
- package/dist/source/menu/submenu/MenuSubmenu.jsx +10 -0
- package/dist/source/menu/submenu-trigger/MenuSubmenuTrigger.d.ts +14 -0
- package/dist/source/menu/submenu-trigger/MenuSubmenuTrigger.jsx +121 -0
- package/dist/source/menu/trigger/MenuTrigger.d.ts +13 -0
- package/dist/source/menu/trigger/MenuTrigger.jsx +73 -0
- package/dist/source/menubar/index.d.ts +1 -0
- package/dist/source/menubar/index.js +1 -0
- package/dist/source/menubar/index.parts.d.ts +13 -0
- package/dist/source/menubar/index.parts.js +14 -0
- package/dist/source/menubar/menu/MenubarMenu.d.ts +11 -0
- package/dist/source/menubar/menu/MenubarMenu.jsx +24 -0
- package/dist/source/menubar/root/MenubarContext.d.ts +30 -0
- package/dist/source/menubar/root/MenubarContext.js +12 -0
- package/dist/source/menubar/root/MenubarRoot.d.ts +11 -0
- package/dist/source/menubar/root/MenubarRoot.jsx +77 -0
- package/dist/source/menubar/trigger/MenubarTrigger.d.ts +11 -0
- package/dist/source/menubar/trigger/MenubarTrigger.jsx +78 -0
- package/dist/source/navigation-menu/index.d.ts +1 -0
- package/dist/source/navigation-menu/index.js +1 -0
- package/dist/source/navigation-menu/index.parts.d.ts +5 -0
- package/dist/source/navigation-menu/index.parts.js +5 -0
- package/dist/source/navigation-menu/item/NavigationMenuItem.d.ts +16 -0
- package/dist/source/navigation-menu/item/NavigationMenuItem.jsx +85 -0
- package/dist/source/navigation-menu/item/NavigationMenuItemContext.d.ts +27 -0
- package/dist/source/navigation-menu/item/NavigationMenuItemContext.js +12 -0
- package/dist/source/navigation-menu/link/NavigationMenuLink.d.ts +12 -0
- package/dist/source/navigation-menu/link/NavigationMenuLink.jsx +18 -0
- package/dist/source/navigation-menu/panel/NavigationMenuPanel.d.ts +11 -0
- package/dist/source/navigation-menu/panel/NavigationMenuPanel.jsx +26 -0
- package/dist/source/navigation-menu/root/NavigationMenuRoot.d.ts +37 -0
- package/dist/source/navigation-menu/root/NavigationMenuRoot.jsx +103 -0
- package/dist/source/navigation-menu/root/NavigationMenuRootContext.d.ts +33 -0
- package/dist/source/navigation-menu/root/NavigationMenuRootContext.js +13 -0
- package/dist/source/navigation-menu/trigger/NavigationMenuTrigger.d.ts +12 -0
- package/dist/source/navigation-menu/trigger/NavigationMenuTrigger.jsx +32 -0
- package/package.json +23 -2
- package/skills/menhir-styling/SKILL.md +35 -0
- package/skills/menhir-styling/looks/shadcn/LICENSE +24 -0
- package/skills/menhir-styling/looks/shadcn/LOOK.md +106 -0
- package/skills/menhir-styling/looks/shadcn/dialog.md +63 -0
- package/skills/menhir-styling/looks/shadcn/popover.md +39 -0
- package/skills/menhir-styling/looks/shadcn/switch.md +26 -0
- package/skills/menhir-styling/looks/shadcn/tabs.md +62 -0
- package/skills/menhir-styling/looks/shadcn/tokens.css +80 -0
package/LICENSE
CHANGED
|
@@ -19,3 +19,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
The shadcn look of the styling skill, skills/menhir-styling/looks/shadcn/,
|
|
26
|
+
reproduces class strings and token values from shadcn/ui, under the licence in
|
|
27
|
+
that folder's LICENSE file.
|
package/README.md
CHANGED
|
@@ -45,17 +45,24 @@ Nothing is styled. Every part exposes its state as data attributes, such as `dat
|
|
|
45
45
|
}
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
## Styling with a coding agent
|
|
49
|
+
|
|
50
|
+
The package ships a skill for coding agents, [`skills/menhir-styling`](skills/menhir-styling/SKILL.md), that styles Menhir components in one consistent look, such as the shadcn look in Tailwind CSS. Point your agent at it with a line in your project's `AGENTS.md`, "To style Menhir components, follow `node_modules/menhir/skills/menhir-styling/SKILL.md`", or copy the folder into your agent's skills folder. What to ask for, and how a look of your own works: [Styling](https://menhir-ui.com/docs/styling).
|
|
51
|
+
|
|
52
|
+
## Docs
|
|
53
|
+
|
|
48
54
|
For everything else, go to the docs:
|
|
49
55
|
|
|
50
56
|
- [Getting started](https://menhir-ui.com/docs/getting-started)
|
|
57
|
+
- [Styling](https://menhir-ui.com/docs/styling)
|
|
51
58
|
- [Components](https://menhir-ui.com/docs/components)
|
|
52
59
|
- [Bundle size](https://menhir-ui.com/docs/bundle-size) of every entry point
|
|
53
60
|
|
|
54
61
|
## Status
|
|
55
62
|
|
|
56
|
-
Early 0.x versions: the API may change between minor versions.
|
|
63
|
+
Early 0.x versions: the API may change between minor versions. Select and the other list popups come next; the plan and roadmap are in the [repository](https://github.com/j13n/menhir). Built so far:
|
|
57
64
|
|
|
58
|
-
- Components: Accordion, Alert Dialog, Checkbox, Collapsible, Dialog, Meter, Popover, Progress, Separator, Switch, Tabs, Toggle, Toggle Group and Tooltip.
|
|
65
|
+
- Components: Accordion, Alert Dialog, Checkbox, Collapsible, Context Menu, Dialog, Menu, Menubar, Meter, Navigation Menu, Popover, Progress, Separator, Switch, Tabs, Toggle, Toggle Group and Tooltip.
|
|
59
66
|
- Utilities: color scheme and theme, each with local-storage and cookie storage.
|
|
60
67
|
|
|
61
68
|
## Licence
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ContextMenuRoot } from "./root/ContextMenuRoot.js";
|
|
2
|
+
import { ContextMenuTrigger } from "./trigger/ContextMenuTrigger.js";
|
|
3
|
+
import { ContextMenuPopup } from "./popup/ContextMenuPopup.js";
|
|
4
|
+
import { MenuItem } from "../menu/item/MenuItem.js";
|
|
5
|
+
import { MenuCheckboxItem } from "../menu/checkbox-item/MenuCheckboxItem.js";
|
|
6
|
+
import { MenuItemIndicator } from "../menu/item-indicator/MenuItemIndicator.js";
|
|
7
|
+
import { MenuGroup } from "../menu/group/MenuGroup.js";
|
|
8
|
+
import { MenuGroupLabel } from "../menu/group-label/MenuGroupLabel.js";
|
|
9
|
+
import { MenuRadioGroup } from "../menu/radio-group/MenuRadioGroup.js";
|
|
10
|
+
import { MenuRadioItem } from "../menu/radio-item/MenuRadioItem.js";
|
|
11
|
+
import { MenuSubmenu } from "../menu/submenu/MenuSubmenu.js";
|
|
12
|
+
import { MenuSubmenuTrigger } from "../menu/submenu-trigger/MenuSubmenuTrigger.js";
|
|
13
|
+
export { MenuCheckboxItem as CheckboxItem, MenuGroup as Group, MenuGroupLabel as GroupLabel, MenuItem as Item, MenuItemIndicator as ItemIndicator, ContextMenuPopup as Popup, MenuRadioGroup as RadioGroup, MenuRadioItem as RadioItem, ContextMenuRoot as Root, MenuSubmenu as Submenu, MenuSubmenuTrigger as SubmenuTrigger, ContextMenuTrigger as Trigger };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { callHandler } from "../../core/mergeElementProps.js";
|
|
2
|
+
import { MenuPopup } from "../../menu/popup/MenuPopup.js";
|
|
3
|
+
import { useMenuContext } from "../../menu/root/MenuContext.js";
|
|
4
|
+
import { useContextMenu } from "../root/ContextMenuContext.js";
|
|
5
|
+
import { isDev } from "@solidjs/web";
|
|
6
|
+
import { merge } from "solid-js";
|
|
7
|
+
// src/context-menu/popup/ContextMenuPopup.tsx
|
|
8
|
+
/**
|
|
9
|
+
* The menu itself: Menu's `<div popover="auto" role="menu">` in the top
|
|
10
|
+
* layer, placed at the pointer, or below the element a key opened it from,
|
|
11
|
+
* or the area before the first `contextmenu`. Name it with `aria-label`.
|
|
12
|
+
* A `contextmenu` inside it is cancelled, so the browser's own menu does not
|
|
13
|
+
* show over it. Place it inside `ContextMenu.Root`, right after
|
|
14
|
+
* `ContextMenu.Trigger`, or inside `ContextMenu.Submenu`, right after
|
|
15
|
+
* `ContextMenu.SubmenuTrigger`, where it is placed as in Menu.
|
|
16
|
+
*/
|
|
17
|
+
function ContextMenuPopup(props) {
|
|
18
|
+
const menu = useMenuContext();
|
|
19
|
+
if (isDev && !menu.parent) useContextMenu();
|
|
20
|
+
return MenuPopup(merge(props, {
|
|
21
|
+
get anchor() {
|
|
22
|
+
return props.anchor ?? (menu.parent ? void 0 : () => menu.anchor() ?? menu.area);
|
|
23
|
+
},
|
|
24
|
+
onContextMenu: (event) => {
|
|
25
|
+
event.preventDefault();
|
|
26
|
+
callHandler(props.onContextMenu, event);
|
|
27
|
+
}
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
export { ContextMenuPopup };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MenuContext } from "../../menu/root/MenuContext.js";
|
|
2
|
+
import { isDev } from "@solidjs/web";
|
|
3
|
+
import { useContext } from "solid-js";
|
|
4
|
+
// src/context-menu/root/ContextMenuContext.ts
|
|
5
|
+
/** The Root's context menu, for its Trigger and its Popup. */
|
|
6
|
+
function useContextMenu() {
|
|
7
|
+
const context = useContext(MenuContext);
|
|
8
|
+
if (isDev && !context?.setAnchor) throw new Error("[menhir] Context Menu parts must be placed within <ContextMenu.Root>.");
|
|
9
|
+
return context;
|
|
10
|
+
}
|
|
11
|
+
export { useContextMenu };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MenuContext, createMenu } from "../../menu/root/MenuContext.js";
|
|
2
|
+
import { createComponent } from "@solidjs/web";
|
|
3
|
+
import { createSignal } from "solid-js";
|
|
4
|
+
// src/context-menu/root/ContextMenuRoot.tsx
|
|
5
|
+
/**
|
|
6
|
+
* A menu that an area opens with the `contextmenu` event: holds whether it
|
|
7
|
+
* is open, and where it was asked for, and shares them with
|
|
8
|
+
* `ContextMenu.Trigger`, `ContextMenu.Popup` and the items inside it.
|
|
9
|
+
* Renders no element of its own.
|
|
10
|
+
*/
|
|
11
|
+
function ContextMenuRoot(props) {
|
|
12
|
+
const [anchor, setAnchor] = createSignal();
|
|
13
|
+
const menu = createMenu(props);
|
|
14
|
+
menu.anchor = anchor;
|
|
15
|
+
menu.setAnchor = (value) => setAnchor(() => value);
|
|
16
|
+
return createComponent(MenuContext, {
|
|
17
|
+
value: menu,
|
|
18
|
+
get children() {
|
|
19
|
+
return props.children;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export { ContextMenuRoot };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { mergeElementProps } from "../../core/mergeElementProps.js";
|
|
2
|
+
import { renderElement } from "../../core/renderElement.js";
|
|
3
|
+
import { useContextMenu } from "../root/ContextMenuContext.js";
|
|
4
|
+
import { spread, template } from "@solidjs/web";
|
|
5
|
+
import { merge, omit } from "solid-js";
|
|
6
|
+
// src/context-menu/trigger/ContextMenuTrigger.tsx
|
|
7
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
8
|
+
/**
|
|
9
|
+
* The area that opens the menu: a `<div>` whose `contextmenu` event, from a
|
|
10
|
+
* secondary-button press, a long press, Shift+F10 or the Menu key, opens
|
|
11
|
+
* the menu at the pointer, or below the focused element for a key, with
|
|
12
|
+
* focus on its first item. Place it inside `ContextMenu.Root`, right before
|
|
13
|
+
* `ContextMenu.Popup`.
|
|
14
|
+
*/
|
|
15
|
+
function ContextMenuTrigger(props) {
|
|
16
|
+
const menu = useContextMenu();
|
|
17
|
+
const ownProps = merge(menu.attributes, {
|
|
18
|
+
get "data-disabled"() {
|
|
19
|
+
return props.disabled ? "" : void 0;
|
|
20
|
+
},
|
|
21
|
+
onContextMenu: (event) => {
|
|
22
|
+
if (props.disabled) return;
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
const { pointerType } = event;
|
|
25
|
+
const { clientX, clientY } = event;
|
|
26
|
+
menu.setAnchor(pointerType === "" || event.button < 0 && pointerType === "mouse" ? event.target : { getBoundingClientRect: () => new DOMRect(clientX, clientY) });
|
|
27
|
+
const focused = document.activeElement;
|
|
28
|
+
menu.trigger = focused === document.body ? void 0 : focused;
|
|
29
|
+
const details = {
|
|
30
|
+
reason: "trigger-press",
|
|
31
|
+
event
|
|
32
|
+
};
|
|
33
|
+
menu.closeSubmenus(details);
|
|
34
|
+
menu.openFromKey(details);
|
|
35
|
+
},
|
|
36
|
+
ref: (element) => {
|
|
37
|
+
menu.area = element;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const elementProps = mergeElementProps(ownProps, omit(props, "render", "disabled"));
|
|
41
|
+
return renderElement(props, elementProps, (p) => (() => {
|
|
42
|
+
var _el$ = _tmpl$();
|
|
43
|
+
spread(_el$, p, false);
|
|
44
|
+
return _el$;
|
|
45
|
+
})());
|
|
46
|
+
}
|
|
47
|
+
export { ContextMenuTrigger };
|
|
@@ -22,6 +22,10 @@ import { createSignal, onFlush, untrack } from "solid-js";
|
|
|
22
22
|
* does nothing. Set from event handlers, not from a component body or a
|
|
23
23
|
* memo. A set may pass `details`, such as why a popup closed, which
|
|
24
24
|
* `onChange` receives after the value.
|
|
25
|
+
*
|
|
26
|
+
* The third item, `requested`, reads untracked the value set last in this
|
|
27
|
+
* turn, or `value` if nothing was: for a handler that builds on a set made
|
|
28
|
+
* earlier in the same turn, which `value` shows only after the flush.
|
|
25
29
|
*/
|
|
26
30
|
function createControllableSignal(options) {
|
|
27
31
|
const [internal, setInternal] = createSignal(() => untrack(() => options.defaultValue));
|
|
@@ -36,8 +40,9 @@ function createControllableSignal(options) {
|
|
|
36
40
|
};
|
|
37
41
|
const value = () => isControlled() ? options.value : internal();
|
|
38
42
|
let pending;
|
|
43
|
+
const requested = () => pending ? pending[0] : untrack(value);
|
|
39
44
|
const setValue = (next, details) => {
|
|
40
|
-
if (Object.is(next,
|
|
45
|
+
if (Object.is(next, requested())) return;
|
|
41
46
|
if (!untrack(isControlled)) onFlush(() => setInternal(() => next));
|
|
42
47
|
options.onChange?.(next, details);
|
|
43
48
|
const set = [next];
|
|
@@ -46,6 +51,10 @@ function createControllableSignal(options) {
|
|
|
46
51
|
if (pending === set) pending = void 0;
|
|
47
52
|
});
|
|
48
53
|
};
|
|
49
|
-
return [
|
|
54
|
+
return [
|
|
55
|
+
value,
|
|
56
|
+
setValue,
|
|
57
|
+
requested
|
|
58
|
+
];
|
|
50
59
|
}
|
|
51
60
|
export { createControllableSignal };
|
package/dist/core/listValue.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createControllableSignal } from "./createControllableSignal.js";
|
|
2
|
-
import { onFlush } from "solid-js";
|
|
3
2
|
// src/core/listValue.ts
|
|
4
3
|
/**
|
|
5
4
|
* A part's value that lists items and that the consumer may control, as an
|
|
@@ -21,7 +20,7 @@ import { onFlush } from "solid-js";
|
|
|
21
20
|
* Sets in one turn build on each other, before the flush.
|
|
22
21
|
*/
|
|
23
22
|
function createListValue(options) {
|
|
24
|
-
const [value, setValue] = createControllableSignal({
|
|
23
|
+
const [value, setValue, requested] = createControllableSignal({
|
|
25
24
|
get value() {
|
|
26
25
|
return options.value;
|
|
27
26
|
},
|
|
@@ -30,18 +29,14 @@ function createListValue(options) {
|
|
|
30
29
|
},
|
|
31
30
|
onChange: (value) => options.onChange?.(value)
|
|
32
31
|
});
|
|
33
|
-
let pending;
|
|
34
32
|
return {
|
|
35
33
|
has: (item) => value().includes(item),
|
|
36
34
|
set: (item, included) => {
|
|
37
|
-
const current = pending ?? value();
|
|
38
35
|
let next = included ? [item] : [];
|
|
39
36
|
if (options.multiple) {
|
|
40
|
-
next =
|
|
37
|
+
next = requested().filter((other) => other !== item);
|
|
41
38
|
if (included) next.push(item);
|
|
42
39
|
}
|
|
43
|
-
if (!pending) onFlush(() => pending = void 0);
|
|
44
|
-
pending = next;
|
|
45
40
|
setValue(next);
|
|
46
41
|
}
|
|
47
42
|
};
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { merge } from "solid-js";
|
|
2
2
|
// src/core/mergeElementProps.ts
|
|
3
|
+
/**
|
|
4
|
+
* Calls a JSX event handler in either of Solid's forms, a function or a
|
|
5
|
+
* `[handler, data]` pair, for a part that calls the consumer's handler
|
|
6
|
+
* itself instead of through the merge, such as a menu item that skips it
|
|
7
|
+
* while disabled.
|
|
8
|
+
*/
|
|
3
9
|
function callHandler(handler, event) {
|
|
4
10
|
if (typeof handler === "function") handler(event);
|
|
5
11
|
else if (handler) handler[0](handler[1], event);
|
|
@@ -64,4 +70,4 @@ function mergeElementProps(own, props) {
|
|
|
64
70
|
}
|
|
65
71
|
return merge(own, props, overrides);
|
|
66
72
|
}
|
|
67
|
-
export { mergeElementProps };
|
|
73
|
+
export { callHandler, mergeElementProps };
|
|
@@ -2,7 +2,8 @@ import { createEffect } from "solid-js";
|
|
|
2
2
|
// src/floating/dismissal/escape.ts
|
|
3
3
|
/**
|
|
4
4
|
* Escape for a popup the browser does not close on Escape, a `manual`
|
|
5
|
-
* popover such as Tooltip's
|
|
5
|
+
* popover such as Tooltip's, or for content in the page's flow, such as
|
|
6
|
+
* Navigation Menu's Panels. While `open`, an Escape key calls `onDismiss`
|
|
6
7
|
* with the reason `escape-key`:
|
|
7
8
|
*
|
|
8
9
|
* ```ts
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createListNavigation } from "./listNavigation.js";
|
|
2
|
+
// src/floating/list-navigation/activeDescendant.ts
|
|
3
|
+
/**
|
|
4
|
+
* List navigation where focus stays on another element, such as a
|
|
5
|
+
* combobox's input, which names the active item in `aria-activedescendant`.
|
|
6
|
+
* The item part takes `props.id ?? createUniqueId()` and registers once
|
|
7
|
+
* mounted, so the server HTML names no item:
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* const list = createActiveDescendantList<Entry>({
|
|
11
|
+
* get open() { return open(); },
|
|
12
|
+
* });
|
|
13
|
+
* // On the input:
|
|
14
|
+
* const inputProps = {
|
|
15
|
+
* get "aria-activedescendant"() { return list.activeId(); },
|
|
16
|
+
* onKeyDown: (event) => list.onKeyDown(event),
|
|
17
|
+
* };
|
|
18
|
+
* // In the item part:
|
|
19
|
+
* onSettled(() => list.register(item));
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function createActiveDescendantList(options) {
|
|
23
|
+
const list = createListNavigation(options);
|
|
24
|
+
return {
|
|
25
|
+
...list,
|
|
26
|
+
activeId: () => list.active()?.id
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export { createActiveDescendantList };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { createEffect, createMemo, createSignal } from "solid-js";
|
|
2
|
+
// src/floating/list-navigation/listNavigation.ts
|
|
3
|
+
var byPosition = (a, b) => a.element.compareDocumentPosition(b.element) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
4
|
+
/**
|
|
5
|
+
* The items of a list in document order, the active item, the keys and the
|
|
6
|
+
* pointer: what both ways of holding focus share. `focusItem` is the way's
|
|
7
|
+
* own: the roving form focuses the item. Nothing runs at import time, nor,
|
|
8
|
+
* until a key or the pointer, on the server.
|
|
9
|
+
*/
|
|
10
|
+
function createListNavigation(options, focusItem) {
|
|
11
|
+
const [registered, setRegistered] = createSignal([]);
|
|
12
|
+
const ordered = createMemo(() => [...registered()].sort(byPosition));
|
|
13
|
+
const reachable = (item) => options.reachable?.(item) ?? true;
|
|
14
|
+
const [active, setActive] = createSignal();
|
|
15
|
+
const activeSignals = /* @__PURE__ */ new WeakMap();
|
|
16
|
+
const activeSignal = (item) => {
|
|
17
|
+
let signal = activeSignals.get(item);
|
|
18
|
+
if (!signal) {
|
|
19
|
+
const [read, write] = createSignal(false);
|
|
20
|
+
activeSignals.set(item, signal = [read, write]);
|
|
21
|
+
}
|
|
22
|
+
return signal;
|
|
23
|
+
};
|
|
24
|
+
let activeItem;
|
|
25
|
+
const activate = (item) => {
|
|
26
|
+
if (activeItem) activeSignal(activeItem)[1](false);
|
|
27
|
+
if (item) activeSignal(item)[1](true);
|
|
28
|
+
activeItem = item;
|
|
29
|
+
setActive(() => item);
|
|
30
|
+
};
|
|
31
|
+
const focusAndScroll = (item) => {
|
|
32
|
+
focusItem?.(item);
|
|
33
|
+
item.element.scrollIntoView({
|
|
34
|
+
block: "nearest",
|
|
35
|
+
inline: "nearest"
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const list = {
|
|
39
|
+
register: (item) => {
|
|
40
|
+
setRegistered((items) => [...items, item]);
|
|
41
|
+
return () => {
|
|
42
|
+
setRegistered((items) => items.filter((other) => other !== item));
|
|
43
|
+
if (activeItem === item) activate(void 0);
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
items: () => ordered().filter(reachable),
|
|
47
|
+
active,
|
|
48
|
+
isActive: (item) => activeSignal(item)[0](),
|
|
49
|
+
move: (item) => {
|
|
50
|
+
if (item && !reachable(item)) return;
|
|
51
|
+
activate(item);
|
|
52
|
+
if (item && options.open !== false) focusAndScroll(item);
|
|
53
|
+
},
|
|
54
|
+
onKeyDown: (event) => {
|
|
55
|
+
const { target } = event;
|
|
56
|
+
if (target !== event.currentTarget && !registered().some((item) => item.element === target)) return false;
|
|
57
|
+
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return false;
|
|
58
|
+
const items = list.items();
|
|
59
|
+
const itemCount = items.length;
|
|
60
|
+
const activeIndex = items.indexOf(activeItem);
|
|
61
|
+
const directionSource = (activeItem ?? items[0])?.element;
|
|
62
|
+
const [leftKey, rightKey] = directionSource && getComputedStyle(directionSource).direction === "rtl" ? ["ArrowRight", "ArrowLeft"] : ["ArrowLeft", "ArrowRight"];
|
|
63
|
+
const [backKey, forwardKey, outKey, intoKey] = options.orientation === "horizontal" ? [
|
|
64
|
+
leftKey,
|
|
65
|
+
rightKey,
|
|
66
|
+
"ArrowUp",
|
|
67
|
+
"ArrowDown"
|
|
68
|
+
] : [
|
|
69
|
+
"ArrowUp",
|
|
70
|
+
"ArrowDown",
|
|
71
|
+
leftKey,
|
|
72
|
+
rightKey
|
|
73
|
+
];
|
|
74
|
+
const { onArrowIn, onArrowOut } = options;
|
|
75
|
+
if (event.key === intoKey && activeItem && onArrowIn) {
|
|
76
|
+
onArrowIn(activeItem, event);
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
if (event.key === outKey && onArrowOut) {
|
|
80
|
+
onArrowOut(activeItem, event);
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
const toIndex = event.key === backKey ? (activeIndex < 0 ? itemCount : activeIndex) - 1 : event.key === forwardKey ? activeIndex + 1 : event.key === "Home" ? 0 : event.key === "End" ? itemCount - 1 : void 0;
|
|
84
|
+
if (toIndex === void 0 || !itemCount) return false;
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
list.move(items[options.wrap ? (toIndex + itemCount) % itemCount : Math.min(Math.max(toIndex, 0), itemCount - 1)]);
|
|
87
|
+
return true;
|
|
88
|
+
},
|
|
89
|
+
onPointerMove: (item, event) => {
|
|
90
|
+
if (options.open === false || event.pointerType === "touch") return;
|
|
91
|
+
if (activeItem === item) return;
|
|
92
|
+
if (!reachable(item)) return;
|
|
93
|
+
activate(item);
|
|
94
|
+
focusItem?.(item);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
createEffect(() => options.open, (open) => {
|
|
98
|
+
if (open === false) {
|
|
99
|
+
activate(void 0);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
queueMicrotask(() => {
|
|
103
|
+
if (activeItem) focusAndScroll(activeItem);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
return list;
|
|
107
|
+
}
|
|
108
|
+
export { createListNavigation };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createListNavigation } from "./listNavigation.js";
|
|
2
|
+
// src/floating/list-navigation/roving.ts
|
|
3
|
+
/**
|
|
4
|
+
* List navigation where focus moves to the active item (roving `tabindex`),
|
|
5
|
+
* as in a menu. The item part registers once mounted, sets `tabindex` to 0
|
|
6
|
+
* on the active item and -1 on the others, and hands its key and pointer
|
|
7
|
+
* events over:
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* const list = createRovingList<Entry>({
|
|
11
|
+
* get open() { return open(); },
|
|
12
|
+
* reachable: (item) => true,
|
|
13
|
+
* });
|
|
14
|
+
* // In the item part:
|
|
15
|
+
* onSettled(() => list.register(item));
|
|
16
|
+
* const ownProps = {
|
|
17
|
+
* get tabindex() { return list.isActive(item) ? 0 : -1; },
|
|
18
|
+
* get "data-active"() { return list.isActive(item) ? "" : undefined; },
|
|
19
|
+
* onKeyDown: (event) => list.onKeyDown(event),
|
|
20
|
+
* onPointerMove: (event) => list.onPointerMove(item, event),
|
|
21
|
+
* };
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
function createRovingList(options) {
|
|
25
|
+
return createListNavigation(options, (item) => item.element.focus({ preventScroll: true }));
|
|
26
|
+
}
|
|
27
|
+
export { createRovingList };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/floating/typeahead/match.ts
|
|
2
|
+
var collator;
|
|
3
|
+
/**
|
|
4
|
+
* The item that `typed` moves to, from `active`, or `undefined`:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* const item = findMatch(list.items(), list.active(), "ba");
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
function findMatch(items, active, typed) {
|
|
11
|
+
const characters = [...typed];
|
|
12
|
+
const cycles = characters.every((character) => character === characters[0]);
|
|
13
|
+
const search = cycles ? characters[0] : typed;
|
|
14
|
+
const count = items.length;
|
|
15
|
+
const index = items.indexOf(active);
|
|
16
|
+
const start = index < 0 ? 0 : index + (cycles ? 1 : 0);
|
|
17
|
+
for (let offset = 0; offset < count; offset++) {
|
|
18
|
+
const item = items[(start + offset) % count];
|
|
19
|
+
const text = (item.text ?? item.element.textContent ?? "").trimStart();
|
|
20
|
+
collator ??= new Intl.Collator(void 0, { sensitivity: "base" });
|
|
21
|
+
if (!collator.compare(text.slice(0, search.length), search)) return item;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export { findMatch };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { findMatch } from "./match.js";
|
|
2
|
+
import { createEffect, onCleanup } from "solid-js";
|
|
3
|
+
// src/floating/typeahead/typeahead.ts
|
|
4
|
+
var resetDelay = 1e3;
|
|
5
|
+
/**
|
|
6
|
+
* Typing characters moves to the item whose text starts with them
|
|
7
|
+
* (`findMatch`). Characters typed less than a second apart make one string;
|
|
8
|
+
* Space joins a string being typed. The component hands over list
|
|
9
|
+
* navigation's items, active item and move, and calls the handler from its
|
|
10
|
+
* items' key events, before its own Space activation:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* const typeahead = createTypeahead<Entry>({
|
|
14
|
+
* get open() { return open(); },
|
|
15
|
+
* get items() { return list.items(); },
|
|
16
|
+
* get active() { return list.active(); },
|
|
17
|
+
* move: (item) => list.move(item),
|
|
18
|
+
* });
|
|
19
|
+
* // In the item part:
|
|
20
|
+
* onKeyDown: (event) => {
|
|
21
|
+
* if (typeahead.onKeyDown(event) || list.onKeyDown(event)) return;
|
|
22
|
+
* if (event.key === " " || event.key === "Enter") activate(event);
|
|
23
|
+
* },
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* The handler cancels each key it uses. Closing the popup (`open` turning
|
|
27
|
+
* false) and disposal clear the string and its timer; opening does not, so
|
|
28
|
+
* a closed Select's trigger may open on the first key and the string goes
|
|
29
|
+
* on. Nothing runs at import time, nor, until a key, on the server.
|
|
30
|
+
*/
|
|
31
|
+
function createTypeahead(options) {
|
|
32
|
+
let typed = "";
|
|
33
|
+
let timer;
|
|
34
|
+
const reset = () => {
|
|
35
|
+
clearTimeout(timer);
|
|
36
|
+
typed = "";
|
|
37
|
+
};
|
|
38
|
+
createEffect(() => options.open, (open) => {
|
|
39
|
+
if (open === false) reset();
|
|
40
|
+
});
|
|
41
|
+
onCleanup(reset);
|
|
42
|
+
return { onKeyDown: (event) => {
|
|
43
|
+
const { key, target } = event;
|
|
44
|
+
const items = options.items;
|
|
45
|
+
if (target !== event.currentTarget && !items.some((item) => item.element === target) || event.isComposing || event.ctrlKey || event.altKey || event.metaKey || !/^.$/u.test(key) || key === " " && !typed) return false;
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
typed += key;
|
|
48
|
+
clearTimeout(timer);
|
|
49
|
+
timer = setTimeout(reset, resetDelay);
|
|
50
|
+
const active = options.active;
|
|
51
|
+
const match = findMatch(items, active, typed);
|
|
52
|
+
if (match && match !== active) options.move(match);
|
|
53
|
+
return true;
|
|
54
|
+
} };
|
|
55
|
+
}
|
|
56
|
+
export { createTypeahead };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createControllableSignal } from "../../core/createControllableSignal.js";
|
|
2
|
+
import { renderCheckedItem } from "../item/renderCheckedItem.js";
|
|
3
|
+
import { omit } from "solid-js";
|
|
4
|
+
// src/menu/checkbox-item/MenuCheckboxItem.tsx
|
|
5
|
+
/**
|
|
6
|
+
* An option that is on or off: a `<div role="menuitemcheckbox">` with
|
|
7
|
+
* `aria-checked`. A click and Enter change it and close every open menu;
|
|
8
|
+
* Space changes it and keeps the menu open. Place it inside `Menu.Popup`.
|
|
9
|
+
*/
|
|
10
|
+
function MenuCheckboxItem(props) {
|
|
11
|
+
const [checked, setChecked] = createControllableSignal({
|
|
12
|
+
get value() {
|
|
13
|
+
return props.checked;
|
|
14
|
+
},
|
|
15
|
+
get defaultValue() {
|
|
16
|
+
return props.defaultChecked ?? false;
|
|
17
|
+
},
|
|
18
|
+
onChange: (value) => props.onCheckedChange?.(value)
|
|
19
|
+
});
|
|
20
|
+
return renderCheckedItem(props, omit(props, "render", "disabled", "label", "onClick", "checked", "defaultChecked", "onCheckedChange"), {
|
|
21
|
+
role: "menuitemcheckbox",
|
|
22
|
+
get checked() {
|
|
23
|
+
return checked();
|
|
24
|
+
},
|
|
25
|
+
onCheck: () => setChecked(!checked())
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export { MenuCheckboxItem };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { mergeElementProps } from "../../core/mergeElementProps.js";
|
|
2
|
+
import { renderElement } from "../../core/renderElement.js";
|
|
3
|
+
import { createIdSlot } from "../../core/slot.js";
|
|
4
|
+
import { MenuGroupContext } from "./MenuGroupContext.js";
|
|
5
|
+
import { createComponent, spread, template } from "@solidjs/web";
|
|
6
|
+
import { omit } from "solid-js";
|
|
7
|
+
// src/menu/group/MenuGroup.tsx
|
|
8
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
9
|
+
/**
|
|
10
|
+
* Renders a group of items, `<div role="group">`, named by the GroupLabel
|
|
11
|
+
* inside it, for both `Menu.Group` and `Menu.RadioGroup`. `props` are the
|
|
12
|
+
* consumer's, less the group's own.
|
|
13
|
+
*/
|
|
14
|
+
function renderGroup(props, rest) {
|
|
15
|
+
const [labelId, registerLabelId] = createIdSlot();
|
|
16
|
+
const elementProps = mergeElementProps({
|
|
17
|
+
role: "group",
|
|
18
|
+
get "aria-labelledby"() {
|
|
19
|
+
return props["aria-labelledby"] ?? labelId();
|
|
20
|
+
}
|
|
21
|
+
}, omit(rest, "aria-labelledby"));
|
|
22
|
+
return createComponent(MenuGroupContext, {
|
|
23
|
+
value: { registerLabelId },
|
|
24
|
+
get children() {
|
|
25
|
+
return renderElement(props, elementProps, (p) => (() => {
|
|
26
|
+
var _el$ = _tmpl$();
|
|
27
|
+
spread(_el$, p, false);
|
|
28
|
+
return _el$;
|
|
29
|
+
})());
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Items that belong together: a `<div role="group">` named by its
|
|
35
|
+
* `Menu.GroupLabel`. Place it inside `Menu.Popup`.
|
|
36
|
+
*/
|
|
37
|
+
function MenuGroup(props) {
|
|
38
|
+
return renderGroup(props, omit(props, "render"));
|
|
39
|
+
}
|
|
40
|
+
export { MenuGroup, renderGroup };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isDev } from "@solidjs/web";
|
|
2
|
+
import { createContext, useContext } from "solid-js";
|
|
3
|
+
// src/menu/group/MenuGroupContext.ts
|
|
4
|
+
var MenuGroupContext = createContext(null);
|
|
5
|
+
function useMenuGroupContext() {
|
|
6
|
+
const context = useContext(MenuGroupContext);
|
|
7
|
+
if (isDev && !context) throw new Error("[menhir] Menu.GroupLabel must be placed within <Menu.Group> or <Menu.RadioGroup>.");
|
|
8
|
+
return context;
|
|
9
|
+
}
|
|
10
|
+
export { MenuGroupContext, useMenuGroupContext };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { mergeElementProps } from "../../core/mergeElementProps.js";
|
|
2
|
+
import { renderElement } from "../../core/renderElement.js";
|
|
3
|
+
import { useMenuGroupContext } from "../group/MenuGroupContext.js";
|
|
4
|
+
import { spread, template } from "@solidjs/web";
|
|
5
|
+
import { createUniqueId, omit, onSettled } from "solid-js";
|
|
6
|
+
// src/menu/group-label/MenuGroupLabel.tsx
|
|
7
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
8
|
+
/**
|
|
9
|
+
* The label of a group, which names it in `aria-labelledby`: a `<div>`,
|
|
10
|
+
* not reached by the keys. Place it inside `Menu.Group` or
|
|
11
|
+
* `Menu.RadioGroup`.
|
|
12
|
+
*/
|
|
13
|
+
function MenuGroupLabel(props) {
|
|
14
|
+
const group = useMenuGroupContext();
|
|
15
|
+
const generated = createUniqueId();
|
|
16
|
+
const id = () => props.id ?? generated;
|
|
17
|
+
onSettled(() => group.registerLabelId(id));
|
|
18
|
+
const elementProps = mergeElementProps({ get id() {
|
|
19
|
+
return id();
|
|
20
|
+
} }, omit(props, "render", "id"));
|
|
21
|
+
return renderElement(props, elementProps, (p) => (() => {
|
|
22
|
+
var _el$ = _tmpl$();
|
|
23
|
+
spread(_el$, p, false);
|
|
24
|
+
return _el$;
|
|
25
|
+
})());
|
|
26
|
+
}
|
|
27
|
+
export { MenuGroupLabel };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MenuRoot } from "./root/MenuRoot.js";
|
|
2
|
+
import { MenuTrigger } from "./trigger/MenuTrigger.js";
|
|
3
|
+
import { MenuPopup } from "./popup/MenuPopup.js";
|
|
4
|
+
import { MenuItem } from "./item/MenuItem.js";
|
|
5
|
+
import { MenuCheckboxItem } from "./checkbox-item/MenuCheckboxItem.js";
|
|
6
|
+
import { MenuItemIndicator } from "./item-indicator/MenuItemIndicator.js";
|
|
7
|
+
import { MenuGroup } from "./group/MenuGroup.js";
|
|
8
|
+
import { MenuGroupLabel } from "./group-label/MenuGroupLabel.js";
|
|
9
|
+
import { MenuRadioGroup } from "./radio-group/MenuRadioGroup.js";
|
|
10
|
+
import { MenuRadioItem } from "./radio-item/MenuRadioItem.js";
|
|
11
|
+
import { MenuSubmenu } from "./submenu/MenuSubmenu.js";
|
|
12
|
+
import { MenuSubmenuTrigger } from "./submenu-trigger/MenuSubmenuTrigger.js";
|
|
13
|
+
export { MenuCheckboxItem as CheckboxItem, MenuGroup as Group, MenuGroupLabel as GroupLabel, MenuItem as Item, MenuItemIndicator as ItemIndicator, MenuPopup as Popup, MenuRadioGroup as RadioGroup, MenuRadioItem as RadioItem, MenuRoot as Root, MenuSubmenu as Submenu, MenuSubmenuTrigger as SubmenuTrigger, MenuTrigger as Trigger };
|