menhir 0.1.2 → 0.1.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.
- package/LICENSE +6 -0
- package/README.md +9 -2
- package/dist/alert-dialog/index.js +2 -0
- package/dist/alert-dialog/index.parts.js +7 -0
- package/dist/alert-dialog/popup/AlertDialogPopup.js +13 -0
- package/dist/core/createControllableSignal.js +15 -5
- package/dist/core/listValue.js +2 -7
- package/dist/core/slot.js +30 -0
- package/dist/dialog/close/DialogClose.js +33 -0
- package/dist/dialog/description/DialogDescription.js +27 -0
- package/dist/dialog/index.js +2 -0
- package/dist/dialog/index.parts.js +7 -0
- package/dist/dialog/popup/DialogPopup.js +13 -0
- package/dist/dialog/popup/renderDialogPopup.js +71 -0
- package/dist/dialog/root/DialogRoot.js +46 -0
- package/dist/dialog/root/DialogRootContext.js +10 -0
- package/dist/dialog/title/DialogTitle.js +27 -0
- package/dist/dialog/trigger/DialogTrigger.js +33 -0
- package/dist/floating/dismissal/dialogClose.js +67 -0
- package/dist/floating/dismissal/escape.js +44 -0
- package/dist/floating/dismissal/outsidePress.js +52 -0
- package/dist/floating/dismissal/popoverClose.js +74 -0
- package/dist/floating/dismissal/reason.js +0 -0
- package/dist/floating/focus/initialFocus.js +33 -0
- package/dist/floating/focus/returnFocus.js +65 -0
- package/dist/floating/focus/tabWrap.js +55 -0
- package/dist/floating/focus/tabbable.js +50 -0
- package/dist/floating/focus/target.js +0 -0
- package/dist/floating/hover/group.js +36 -0
- package/dist/floating/hover/hover.js +105 -0
- package/dist/floating/hover/safeArea.js +64 -0
- 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/presence/presence.js +57 -0
- package/dist/floating/scroll-lock/scrollLock.js +125 -0
- package/dist/floating/typeahead/match.js +24 -0
- package/dist/floating/typeahead/typeahead.js +56 -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/popover/arrow/PopoverArrow.js +39 -0
- package/dist/popover/close/PopoverClose.js +33 -0
- package/dist/popover/description/PopoverDescription.js +27 -0
- package/dist/popover/index.js +2 -0
- package/dist/popover/index.parts.js +8 -0
- package/dist/popover/popup/PopoverPopup.js +116 -0
- package/dist/popover/popup/PopoverPopupContext.js +10 -0
- package/dist/popover/root/PopoverRoot.js +50 -0
- package/dist/popover/root/PopoverRootContext.js +10 -0
- package/dist/popover/title/PopoverTitle.js +27 -0
- package/dist/popover/trigger/PopoverTrigger.js +44 -0
- package/dist/source/alert-dialog/index.d.ts +1 -0
- package/dist/source/alert-dialog/index.js +1 -0
- package/dist/source/alert-dialog/index.parts.d.ts +6 -0
- package/dist/source/alert-dialog/index.parts.js +7 -0
- package/dist/source/alert-dialog/popup/AlertDialogPopup.d.ts +10 -0
- package/dist/source/alert-dialog/popup/AlertDialogPopup.jsx +11 -0
- package/dist/source/core/createControllableSignal.d.ts +13 -4
- package/dist/source/core/createControllableSignal.js +11 -5
- package/dist/source/core/listValue.js +4 -10
- package/dist/source/core/slot.d.ts +21 -0
- package/dist/source/core/slot.js +28 -0
- package/dist/source/dialog/close/DialogClose.d.ts +11 -0
- package/dist/source/dialog/close/DialogClose.jsx +25 -0
- package/dist/source/dialog/description/DialogDescription.d.ts +10 -0
- package/dist/source/dialog/description/DialogDescription.jsx +26 -0
- package/dist/source/dialog/index.d.ts +1 -0
- package/dist/source/dialog/index.js +1 -0
- package/dist/source/dialog/index.parts.d.ts +6 -0
- package/dist/source/dialog/index.parts.js +6 -0
- package/dist/source/dialog/popup/DialogPopup.d.ts +9 -0
- package/dist/source/dialog/popup/DialogPopup.jsx +11 -0
- package/dist/source/dialog/popup/renderDialogPopup.d.ts +40 -0
- package/dist/source/dialog/popup/renderDialogPopup.jsx +73 -0
- package/dist/source/dialog/root/DialogRoot.d.ts +20 -0
- package/dist/source/dialog/root/DialogRoot.jsx +39 -0
- package/dist/source/dialog/root/DialogRootContext.d.ts +32 -0
- package/dist/source/dialog/root/DialogRootContext.js +14 -0
- package/dist/source/dialog/title/DialogTitle.d.ts +10 -0
- package/dist/source/dialog/title/DialogTitle.jsx +26 -0
- package/dist/source/dialog/trigger/DialogTrigger.d.ts +10 -0
- package/dist/source/dialog/trigger/DialogTrigger.jsx +27 -0
- package/dist/source/floating/dismissal/dialogClose.d.ts +26 -0
- package/dist/source/floating/dismissal/dialogClose.js +69 -0
- package/dist/source/floating/dismissal/escape.d.ts +24 -0
- package/dist/source/floating/dismissal/escape.js +48 -0
- package/dist/source/floating/dismissal/outsidePress.d.ts +26 -0
- package/dist/source/floating/dismissal/outsidePress.js +50 -0
- package/dist/source/floating/dismissal/popoverClose.d.ts +28 -0
- package/dist/source/floating/dismissal/popoverClose.js +82 -0
- package/dist/source/floating/dismissal/reason.d.ts +34 -0
- package/dist/source/floating/dismissal/reason.js +1 -0
- package/dist/source/floating/focus/initialFocus.d.ts +24 -0
- package/dist/source/floating/focus/initialFocus.js +38 -0
- package/dist/source/floating/focus/returnFocus.d.ts +27 -0
- package/dist/source/floating/focus/returnFocus.js +81 -0
- package/dist/source/floating/focus/tabWrap.d.ts +21 -0
- package/dist/source/floating/focus/tabWrap.js +69 -0
- package/dist/source/floating/focus/tabbable.d.ts +16 -0
- package/dist/source/floating/focus/tabbable.js +69 -0
- package/dist/source/floating/focus/target.d.ts +8 -0
- package/dist/source/floating/focus/target.js +1 -0
- package/dist/source/floating/hover/group.d.ts +39 -0
- package/dist/source/floating/hover/group.js +38 -0
- package/dist/source/floating/hover/hover.d.ts +35 -0
- package/dist/source/floating/hover/hover.js +130 -0
- package/dist/source/floating/hover/safeArea.d.ts +23 -0
- package/dist/source/floating/hover/safeArea.js +67 -0
- 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/presence/presence.d.ts +24 -0
- package/dist/source/floating/presence/presence.js +73 -0
- package/dist/source/floating/scroll-lock/scrollLock.d.ts +27 -0
- package/dist/source/floating/scroll-lock/scrollLock.js +151 -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/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/dist/source/popover/arrow/PopoverArrow.d.ts +11 -0
- package/dist/source/popover/arrow/PopoverArrow.jsx +32 -0
- package/dist/source/popover/close/PopoverClose.d.ts +11 -0
- package/dist/source/popover/close/PopoverClose.jsx +25 -0
- package/dist/source/popover/description/PopoverDescription.d.ts +10 -0
- package/dist/source/popover/description/PopoverDescription.jsx +26 -0
- package/dist/source/popover/index.d.ts +1 -0
- package/dist/source/popover/index.js +1 -0
- package/dist/source/popover/index.parts.d.ts +7 -0
- package/dist/source/popover/index.parts.js +7 -0
- package/dist/source/popover/popup/PopoverPopup.d.ts +47 -0
- package/dist/source/popover/popup/PopoverPopup.jsx +120 -0
- package/dist/source/popover/popup/PopoverPopupContext.d.ts +14 -0
- package/dist/source/popover/popup/PopoverPopupContext.js +11 -0
- package/dist/source/popover/root/PopoverRoot.d.ts +20 -0
- package/dist/source/popover/root/PopoverRoot.jsx +42 -0
- package/dist/source/popover/root/PopoverRootContext.d.ts +39 -0
- package/dist/source/popover/root/PopoverRootContext.js +13 -0
- package/dist/source/popover/title/PopoverTitle.d.ts +10 -0
- package/dist/source/popover/title/PopoverTitle.jsx +26 -0
- package/dist/source/popover/trigger/PopoverTrigger.d.ts +12 -0
- package/dist/source/popover/trigger/PopoverTrigger.jsx +40 -0
- package/dist/source/tooltip/arrow/TooltipArrow.d.ts +11 -0
- package/dist/source/tooltip/arrow/TooltipArrow.jsx +32 -0
- package/dist/source/tooltip/group/TooltipGroup.d.ts +20 -0
- package/dist/source/tooltip/group/TooltipGroup.jsx +18 -0
- package/dist/source/tooltip/group/TooltipGroupContext.d.ts +2 -0
- package/dist/source/tooltip/group/TooltipGroupContext.js +5 -0
- package/dist/source/tooltip/index.d.ts +1 -0
- package/dist/source/tooltip/index.js +1 -0
- package/dist/source/tooltip/index.parts.d.ts +5 -0
- package/dist/source/tooltip/index.parts.js +5 -0
- package/dist/source/tooltip/popup/TooltipPopup.d.ts +31 -0
- package/dist/source/tooltip/popup/TooltipPopup.jsx +77 -0
- package/dist/source/tooltip/popup/TooltipPopupContext.d.ts +14 -0
- package/dist/source/tooltip/popup/TooltipPopupContext.js +11 -0
- package/dist/source/tooltip/root/TooltipRoot.d.ts +31 -0
- package/dist/source/tooltip/root/TooltipRoot.jsx +80 -0
- package/dist/source/tooltip/root/TooltipRootContext.d.ts +35 -0
- package/dist/source/tooltip/root/TooltipRootContext.js +13 -0
- package/dist/source/tooltip/trigger/TooltipTrigger.d.ts +12 -0
- package/dist/source/tooltip/trigger/TooltipTrigger.jsx +52 -0
- package/dist/tooltip/arrow/TooltipArrow.js +39 -0
- package/dist/tooltip/group/TooltipGroup.js +26 -0
- package/dist/tooltip/group/TooltipGroupContext.js +4 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/tooltip/index.parts.js +6 -0
- package/dist/tooltip/popup/TooltipPopup.js +86 -0
- package/dist/tooltip/popup/TooltipPopupContext.js +10 -0
- package/dist/tooltip/root/TooltipRoot.js +79 -0
- package/dist/tooltip/root/TooltipRootContext.js +10 -0
- package/dist/tooltip/trigger/TooltipTrigger.js +54 -0
- package/package.json +28 -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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { mergeElementProps } from "../../core/mergeElementProps.js";
|
|
2
|
+
import { renderElement } from "../../core/renderElement.js";
|
|
3
|
+
import { usePopoverRootContext } from "../root/PopoverRootContext.js";
|
|
4
|
+
import { spread, template } from "@solidjs/web";
|
|
5
|
+
import { createUniqueId, merge, omit, onSettled } from "solid-js";
|
|
6
|
+
// src/popover/description/PopoverDescription.tsx
|
|
7
|
+
var _tmpl$ = /* @__PURE__ */ template(`<p>`);
|
|
8
|
+
/**
|
|
9
|
+
* What the popover is for, which describes the Popup in
|
|
10
|
+
* `aria-describedby`: a `<p>`. Place it inside `Popover.Popup`.
|
|
11
|
+
*/
|
|
12
|
+
function PopoverDescription(props) {
|
|
13
|
+
const root = usePopoverRootContext();
|
|
14
|
+
const generated = createUniqueId();
|
|
15
|
+
const id = () => props.id ?? generated;
|
|
16
|
+
onSettled(() => root.registerDescriptionId(id));
|
|
17
|
+
const ownProps = merge(root.attributes, { get id() {
|
|
18
|
+
return id();
|
|
19
|
+
} });
|
|
20
|
+
const elementProps = mergeElementProps(ownProps, 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 { PopoverDescription };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PopoverRoot } from "./root/PopoverRoot.js";
|
|
2
|
+
import { PopoverTrigger } from "./trigger/PopoverTrigger.js";
|
|
3
|
+
import { PopoverPopup } from "./popup/PopoverPopup.js";
|
|
4
|
+
import { PopoverArrow } from "./arrow/PopoverArrow.js";
|
|
5
|
+
import { PopoverTitle } from "./title/PopoverTitle.js";
|
|
6
|
+
import { PopoverDescription } from "./description/PopoverDescription.js";
|
|
7
|
+
import { PopoverClose } from "./close/PopoverClose.js";
|
|
8
|
+
export { PopoverArrow as Arrow, PopoverClose as Close, PopoverDescription as Description, PopoverPopup as Popup, PopoverRoot as Root, PopoverTitle as Title, PopoverTrigger as Trigger };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { mergeElementProps } from "../../core/mergeElementProps.js";
|
|
2
|
+
import { renderElement } from "../../core/renderElement.js";
|
|
3
|
+
import { createSlot } from "../../core/slot.js";
|
|
4
|
+
import { createPopoverClose } from "../../floating/dismissal/popoverClose.js";
|
|
5
|
+
import { createInitialFocus } from "../../floating/focus/initialFocus.js";
|
|
6
|
+
import { createReturnFocus } from "../../floating/focus/returnFocus.js";
|
|
7
|
+
import { createPosition } from "../../floating/positioning/createPosition.js";
|
|
8
|
+
import { flip } from "../../floating/positioning/flip.js";
|
|
9
|
+
import { offset } from "../../floating/positioning/offset.js";
|
|
10
|
+
import { shift } from "../../floating/positioning/shift.js";
|
|
11
|
+
import { createPresence } from "../../floating/presence/presence.js";
|
|
12
|
+
import { usePopoverRootContext } from "../root/PopoverRootContext.js";
|
|
13
|
+
import { PopoverPopupContext } from "./PopoverPopupContext.js";
|
|
14
|
+
import { createComponent, spread, template } from "@solidjs/web";
|
|
15
|
+
import { merge, omit } from "solid-js";
|
|
16
|
+
// src/popover/popup/PopoverPopup.tsx
|
|
17
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
18
|
+
/**
|
|
19
|
+
* The popover itself: a `<div popover="auto" role="dialog">` in the top
|
|
20
|
+
* layer, placed against the Trigger. A press outside, Escape and the
|
|
21
|
+
* Trigger close it; the page stays usable. Named by `Popover.Title` and
|
|
22
|
+
* described by `Popover.Description` when they are rendered inside it.
|
|
23
|
+
* Place it inside `Popover.Root`, right after `Popover.Trigger`, so that
|
|
24
|
+
* Tab moves from the Trigger into it.
|
|
25
|
+
*/
|
|
26
|
+
function PopoverPopup(props) {
|
|
27
|
+
const root = usePopoverRootContext();
|
|
28
|
+
let popup;
|
|
29
|
+
let focusInside = false;
|
|
30
|
+
const [arrow, registerArrow] = createSlot();
|
|
31
|
+
const options = {
|
|
32
|
+
get popup() {
|
|
33
|
+
return popup;
|
|
34
|
+
},
|
|
35
|
+
get trigger() {
|
|
36
|
+
return root.trigger;
|
|
37
|
+
},
|
|
38
|
+
get open() {
|
|
39
|
+
return root.open();
|
|
40
|
+
},
|
|
41
|
+
onDismiss: (details) => root.setOpen(false, details),
|
|
42
|
+
get initialFocus() {
|
|
43
|
+
return props.initialFocus;
|
|
44
|
+
},
|
|
45
|
+
get returnFocus() {
|
|
46
|
+
return props.returnFocus ?? ((focused) => focused ?? (focusInside ? root.trigger : void 0));
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
createPresence(options);
|
|
50
|
+
createPopoverClose(options);
|
|
51
|
+
createInitialFocus(options);
|
|
52
|
+
createReturnFocus(options);
|
|
53
|
+
const position = createPosition({
|
|
54
|
+
get anchor() {
|
|
55
|
+
const anchor = props.anchor;
|
|
56
|
+
return (typeof anchor === "function" ? anchor() : anchor) ?? root.trigger;
|
|
57
|
+
},
|
|
58
|
+
get popup() {
|
|
59
|
+
return popup;
|
|
60
|
+
},
|
|
61
|
+
get open() {
|
|
62
|
+
return root.open();
|
|
63
|
+
},
|
|
64
|
+
get side() {
|
|
65
|
+
return props.side;
|
|
66
|
+
},
|
|
67
|
+
get align() {
|
|
68
|
+
return props.align;
|
|
69
|
+
},
|
|
70
|
+
get middleware() {
|
|
71
|
+
const padding = props.collisionPadding ?? 5;
|
|
72
|
+
const middleware = [
|
|
73
|
+
offset({
|
|
74
|
+
mainAxis: props.sideOffset ?? 0,
|
|
75
|
+
alignmentAxis: props.alignOffset ?? 0
|
|
76
|
+
}),
|
|
77
|
+
flip({ padding }),
|
|
78
|
+
shift({ padding })
|
|
79
|
+
];
|
|
80
|
+
const arrowMiddleware = arrow();
|
|
81
|
+
return arrowMiddleware ? [...middleware, arrowMiddleware] : middleware;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const ownProps = merge(root.attributes, {
|
|
85
|
+
id: root.popupId,
|
|
86
|
+
popover: "auto",
|
|
87
|
+
role: "dialog",
|
|
88
|
+
get "aria-labelledby"() {
|
|
89
|
+
return props["aria-labelledby"] ?? root.titleId();
|
|
90
|
+
},
|
|
91
|
+
get "aria-describedby"() {
|
|
92
|
+
return props["aria-describedby"] ?? root.descriptionId();
|
|
93
|
+
},
|
|
94
|
+
onBeforeToggle: (event) => {
|
|
95
|
+
focusInside = event.newState === "closed" && popup.contains(document.activeElement);
|
|
96
|
+
},
|
|
97
|
+
ref: (element) => {
|
|
98
|
+
popup = element;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const elementProps = mergeElementProps(ownProps, omit(props, "render", "side", "align", "sideOffset", "alignOffset", "collisionPadding", "anchor", "initialFocus", "returnFocus", "aria-labelledby", "aria-describedby", "id"));
|
|
102
|
+
return createComponent(PopoverPopupContext, {
|
|
103
|
+
value: {
|
|
104
|
+
position,
|
|
105
|
+
registerArrow
|
|
106
|
+
},
|
|
107
|
+
get children() {
|
|
108
|
+
return renderElement(props, elementProps, (p) => (() => {
|
|
109
|
+
var _el$ = _tmpl$();
|
|
110
|
+
spread(_el$, p, false);
|
|
111
|
+
return _el$;
|
|
112
|
+
})());
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
export { PopoverPopup };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isDev } from "@solidjs/web";
|
|
2
|
+
import { createContext, useContext } from "solid-js";
|
|
3
|
+
// src/popover/popup/PopoverPopupContext.ts
|
|
4
|
+
var PopoverPopupContext = createContext(null);
|
|
5
|
+
function usePopoverPopupContext() {
|
|
6
|
+
const context = useContext(PopoverPopupContext);
|
|
7
|
+
if (isDev && !context) throw new Error("[menhir] Popover.Arrow must be placed within <Popover.Popup>.");
|
|
8
|
+
return context;
|
|
9
|
+
}
|
|
10
|
+
export { PopoverPopupContext, usePopoverPopupContext };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createControllableSignal } from "../../core/createControllableSignal.js";
|
|
2
|
+
import { createIdSlot } from "../../core/slot.js";
|
|
3
|
+
import { PopoverRootContext } from "./PopoverRootContext.js";
|
|
4
|
+
import { createComponent } from "@solidjs/web";
|
|
5
|
+
import { createUniqueId } from "solid-js";
|
|
6
|
+
// src/popover/root/PopoverRoot.tsx
|
|
7
|
+
/**
|
|
8
|
+
* A non-modal popup placed against its trigger: holds whether it is open
|
|
9
|
+
* and shares it with `Popover.Trigger`, `Popover.Popup` and the parts
|
|
10
|
+
* inside it. Renders no element of its own.
|
|
11
|
+
*/
|
|
12
|
+
function PopoverRoot(props) {
|
|
13
|
+
const [open, setOpen] = createControllableSignal({
|
|
14
|
+
get value() {
|
|
15
|
+
return props.open;
|
|
16
|
+
},
|
|
17
|
+
get defaultValue() {
|
|
18
|
+
return props.defaultOpen ?? false;
|
|
19
|
+
},
|
|
20
|
+
onChange: (value, details) => props.onOpenChange?.(value, details)
|
|
21
|
+
});
|
|
22
|
+
const attributes = {
|
|
23
|
+
get "data-open"() {
|
|
24
|
+
return open() ? "" : void 0;
|
|
25
|
+
},
|
|
26
|
+
get "data-closed"() {
|
|
27
|
+
return open() ? void 0 : "";
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const [titleId, registerTitleId] = createIdSlot();
|
|
31
|
+
const [descriptionId, registerDescriptionId] = createIdSlot();
|
|
32
|
+
const context = {
|
|
33
|
+
open,
|
|
34
|
+
setOpen,
|
|
35
|
+
popupId: createUniqueId(),
|
|
36
|
+
trigger: void 0,
|
|
37
|
+
titleId,
|
|
38
|
+
registerTitleId,
|
|
39
|
+
descriptionId,
|
|
40
|
+
registerDescriptionId,
|
|
41
|
+
attributes
|
|
42
|
+
};
|
|
43
|
+
return createComponent(PopoverRootContext, {
|
|
44
|
+
value: context,
|
|
45
|
+
get children() {
|
|
46
|
+
return props.children;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export { PopoverRoot };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isDev } from "@solidjs/web";
|
|
2
|
+
import { createContext, useContext } from "solid-js";
|
|
3
|
+
// src/popover/root/PopoverRootContext.ts
|
|
4
|
+
var PopoverRootContext = createContext(null);
|
|
5
|
+
function usePopoverRootContext() {
|
|
6
|
+
const context = useContext(PopoverRootContext);
|
|
7
|
+
if (isDev && !context) throw new Error("[menhir] Popover parts must be placed within <Popover.Root>.");
|
|
8
|
+
return context;
|
|
9
|
+
}
|
|
10
|
+
export { PopoverRootContext, usePopoverRootContext };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { mergeElementProps } from "../../core/mergeElementProps.js";
|
|
2
|
+
import { renderElement } from "../../core/renderElement.js";
|
|
3
|
+
import { usePopoverRootContext } from "../root/PopoverRootContext.js";
|
|
4
|
+
import { spread, template } from "@solidjs/web";
|
|
5
|
+
import { createUniqueId, merge, omit, onSettled } from "solid-js";
|
|
6
|
+
// src/popover/title/PopoverTitle.tsx
|
|
7
|
+
var _tmpl$ = /* @__PURE__ */ template(`<h2>`);
|
|
8
|
+
/**
|
|
9
|
+
* The popover's title, which names the Popup in `aria-labelledby`: an
|
|
10
|
+
* `<h2>`. Place it inside `Popover.Popup`.
|
|
11
|
+
*/
|
|
12
|
+
function PopoverTitle(props) {
|
|
13
|
+
const root = usePopoverRootContext();
|
|
14
|
+
const generated = createUniqueId();
|
|
15
|
+
const id = () => props.id ?? generated;
|
|
16
|
+
onSettled(() => root.registerTitleId(id));
|
|
17
|
+
const ownProps = merge(root.attributes, { get id() {
|
|
18
|
+
return id();
|
|
19
|
+
} });
|
|
20
|
+
const elementProps = mergeElementProps(ownProps, 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 { PopoverTitle };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { warnUnlessButton } from "../../core/button.js";
|
|
2
|
+
import { mergeElementProps } from "../../core/mergeElementProps.js";
|
|
3
|
+
import { renderElement } from "../../core/renderElement.js";
|
|
4
|
+
import { usePopoverRootContext } from "../root/PopoverRootContext.js";
|
|
5
|
+
import { isDev, spread, template } from "@solidjs/web";
|
|
6
|
+
import { merge, omit } from "solid-js";
|
|
7
|
+
// src/popover/trigger/PopoverTrigger.tsx
|
|
8
|
+
var _tmpl$ = /* @__PURE__ */ template(`<button>`);
|
|
9
|
+
/**
|
|
10
|
+
* The button that opens and closes the popover: a `<button type="button"
|
|
11
|
+
* aria-haspopup="dialog">` with `aria-expanded`, naming the Popup in
|
|
12
|
+
* `popovertarget` and `aria-controls`. Place it inside `Popover.Root`,
|
|
13
|
+
* right before `Popover.Popup`.
|
|
14
|
+
*/
|
|
15
|
+
function PopoverTrigger(props) {
|
|
16
|
+
const root = usePopoverRootContext();
|
|
17
|
+
const ownProps = merge(root.attributes, {
|
|
18
|
+
type: "button",
|
|
19
|
+
popovertarget: root.popupId,
|
|
20
|
+
"aria-haspopup": "dialog",
|
|
21
|
+
get "aria-expanded"() {
|
|
22
|
+
return root.open() ? "true" : "false";
|
|
23
|
+
},
|
|
24
|
+
"aria-controls": root.popupId,
|
|
25
|
+
onClick: (event) => {
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
root.setOpen(!root.open(), {
|
|
28
|
+
reason: "trigger-press",
|
|
29
|
+
event
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
ref: (element) => {
|
|
33
|
+
root.trigger = element;
|
|
34
|
+
if (isDev) warnUnlessButton(element, "Popover.Trigger");
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const elementProps = mergeElementProps(ownProps, omit(props, "render"));
|
|
38
|
+
return renderElement(props, elementProps, (p) => (() => {
|
|
39
|
+
var _el$ = _tmpl$();
|
|
40
|
+
spread(_el$, p, false);
|
|
41
|
+
return _el$;
|
|
42
|
+
})());
|
|
43
|
+
}
|
|
44
|
+
export { PopoverTrigger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as AlertDialog from "./index.parts.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as AlertDialog from "./index.parts.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { DialogRoot as Root } from "../dialog/root/DialogRoot.tsx";
|
|
2
|
+
export { DialogTrigger as Trigger } from "../dialog/trigger/DialogTrigger.tsx";
|
|
3
|
+
export { AlertDialogPopup as Popup } from "./popup/AlertDialogPopup.tsx";
|
|
4
|
+
export { DialogTitle as Title } from "../dialog/title/DialogTitle.tsx";
|
|
5
|
+
export { DialogDescription as Description } from "../dialog/description/DialogDescription.tsx";
|
|
6
|
+
export { DialogClose as Close } from "../dialog/close/DialogClose.tsx";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Dialog's parts, but the Popup (README, "Decisions"; #32).
|
|
2
|
+
export { DialogRoot as Root } from "../dialog/root/DialogRoot.jsx";
|
|
3
|
+
export { DialogTrigger as Trigger } from "../dialog/trigger/DialogTrigger.jsx";
|
|
4
|
+
export { AlertDialogPopup as Popup } from "./popup/AlertDialogPopup.jsx";
|
|
5
|
+
export { DialogTitle as Title } from "../dialog/title/DialogTitle.jsx";
|
|
6
|
+
export { DialogDescription as Description } from "../dialog/description/DialogDescription.jsx";
|
|
7
|
+
export { DialogClose as Close } from "../dialog/close/DialogClose.jsx";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DialogPopupProps } from "../../dialog/popup/renderDialogPopup.tsx";
|
|
2
|
+
export type AlertDialogPopupProps = DialogPopupProps;
|
|
3
|
+
/**
|
|
4
|
+
* The alert dialog itself: a `<dialog role="alertdialog">`, opened with
|
|
5
|
+
* `showModal()`, so it is modal, in the top layer, over an inert page.
|
|
6
|
+
* Named by `AlertDialog.Title` and described by `AlertDialog.Description`,
|
|
7
|
+
* the message, when they are rendered inside it. Escape closes it; a press
|
|
8
|
+
* on the backdrop does not. Place it inside `AlertDialog.Root`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function AlertDialogPopup(props: AlertDialogPopupProps): import("@solidjs/web").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { renderDialogPopup } from "../../dialog/popup/renderDialogPopup.jsx";
|
|
2
|
+
/**
|
|
3
|
+
* The alert dialog itself: a `<dialog role="alertdialog">`, opened with
|
|
4
|
+
* `showModal()`, so it is modal, in the top layer, over an inert page.
|
|
5
|
+
* Named by `AlertDialog.Title` and described by `AlertDialog.Description`,
|
|
6
|
+
* the message, when they are rendered inside it. Escape closes it; a press
|
|
7
|
+
* on the backdrop does not. Place it inside `AlertDialog.Root`.
|
|
8
|
+
*/
|
|
9
|
+
export function AlertDialogPopup(props) {
|
|
10
|
+
return renderDialogPopup(props, undefined, "alertdialog");
|
|
11
|
+
}
|
|
@@ -18,10 +18,19 @@ import type { Accessor } from "solid-js";
|
|
|
18
18
|
* (`onFlush`), so async work that `onChange` starts does not hold it back.
|
|
19
19
|
* Setting the value it already has, counting earlier sets in the same turn,
|
|
20
20
|
* does nothing. Set from event handlers, not from a component body or a
|
|
21
|
-
* memo.
|
|
21
|
+
* memo. A set may pass `details`, such as why a popup closed, which
|
|
22
|
+
* `onChange` receives after the value.
|
|
23
|
+
*
|
|
24
|
+
* The third item, `requested`, reads untracked the value set last in this
|
|
25
|
+
* turn, or `value` if nothing was: for a handler that builds on a set made
|
|
26
|
+
* earlier in the same turn, which `value` shows only after the flush.
|
|
22
27
|
*/
|
|
23
|
-
export declare function createControllableSignal<T>(options: {
|
|
28
|
+
export declare function createControllableSignal<T, Details = void>(options: {
|
|
24
29
|
readonly value?: T;
|
|
25
30
|
readonly defaultValue: T;
|
|
26
|
-
onChange?: (value: T) => void;
|
|
27
|
-
}): [
|
|
31
|
+
onChange?: (value: T, details: Details) => void;
|
|
32
|
+
}): [
|
|
33
|
+
value: Accessor<T>,
|
|
34
|
+
setValue: (next: T, details: Details) => void,
|
|
35
|
+
requested: () => T
|
|
36
|
+
];
|
|
@@ -19,7 +19,12 @@ import { createSignal, onFlush, untrack } from "solid-js";
|
|
|
19
19
|
* (`onFlush`), so async work that `onChange` starts does not hold it back.
|
|
20
20
|
* Setting the value it already has, counting earlier sets in the same turn,
|
|
21
21
|
* does nothing. Set from event handlers, not from a component body or a
|
|
22
|
-
* memo.
|
|
22
|
+
* memo. A set may pass `details`, such as why a popup closed, which
|
|
23
|
+
* `onChange` receives after the value.
|
|
24
|
+
*
|
|
25
|
+
* The third item, `requested`, reads untracked the value set last in this
|
|
26
|
+
* turn, or `value` if nothing was: for a handler that builds on a set made
|
|
27
|
+
* earlier in the same turn, which `value` shows only after the flush.
|
|
23
28
|
*/
|
|
24
29
|
export function createControllableSignal(options) {
|
|
25
30
|
// A writable derived signal that reads the default once, untracked, so a
|
|
@@ -51,8 +56,9 @@ export function createControllableSignal(options) {
|
|
|
51
56
|
// Reads lag writes, so a set is compared with the last value set in this
|
|
52
57
|
// turn, if any, not with what `value` still reads.
|
|
53
58
|
let pending;
|
|
54
|
-
const
|
|
55
|
-
|
|
59
|
+
const requested = () => (pending ? pending[0] : untrack(value));
|
|
60
|
+
const setValue = (next, details) => {
|
|
61
|
+
if (Object.is(next, requested()))
|
|
56
62
|
return;
|
|
57
63
|
// The part's own write is an update of its own, after the pending
|
|
58
64
|
// flush: written inline, it would be held with any async work that
|
|
@@ -60,7 +66,7 @@ export function createControllableSignal(options) {
|
|
|
60
66
|
// until that work settled.
|
|
61
67
|
if (!untrack(isControlled))
|
|
62
68
|
onFlush(() => setInternal(() => next));
|
|
63
|
-
options.onChange?.(next);
|
|
69
|
+
options.onChange?.(next, details);
|
|
64
70
|
const set = [next];
|
|
65
71
|
pending = set;
|
|
66
72
|
// `onFlush` callbacks run in call order, each flushed before the next,
|
|
@@ -70,5 +76,5 @@ export function createControllableSignal(options) {
|
|
|
70
76
|
pending = undefined;
|
|
71
77
|
});
|
|
72
78
|
};
|
|
73
|
-
return [value, setValue];
|
|
79
|
+
return [value, setValue, requested];
|
|
74
80
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { onFlush } from "solid-js";
|
|
2
1
|
import { createControllableSignal } from "./createControllableSignal.js";
|
|
3
2
|
/**
|
|
4
3
|
* A part's value that lists items and that the consumer may control, as an
|
|
@@ -20,7 +19,7 @@ import { createControllableSignal } from "./createControllableSignal.js";
|
|
|
20
19
|
* Sets in one turn build on each other, before the flush.
|
|
21
20
|
*/
|
|
22
21
|
export function createListValue(options) {
|
|
23
|
-
const [value, setValue] = createControllableSignal({
|
|
22
|
+
const [value, setValue, requested] = createControllableSignal({
|
|
24
23
|
get value() {
|
|
25
24
|
return options.value;
|
|
26
25
|
},
|
|
@@ -29,22 +28,17 @@ export function createListValue(options) {
|
|
|
29
28
|
},
|
|
30
29
|
onChange: (value) => options.onChange?.(value),
|
|
31
30
|
});
|
|
32
|
-
// The value asked for in this turn, if any: reads lag writes, so a second
|
|
33
|
-
// set before the flush builds on this, not on what `value` still reads.
|
|
34
|
-
let pending;
|
|
35
31
|
return {
|
|
36
32
|
has: (item) => value().includes(item),
|
|
37
33
|
set: (item, included) => {
|
|
38
|
-
const current = pending ?? value();
|
|
39
34
|
let next = included ? [item] : [];
|
|
40
35
|
if (options.multiple) {
|
|
41
|
-
|
|
36
|
+
// Reads lag writes, so a second set before the flush builds on the
|
|
37
|
+
// first, not on what `value` still reads.
|
|
38
|
+
next = requested().filter((other) => other !== item);
|
|
42
39
|
if (included)
|
|
43
40
|
next.push(item);
|
|
44
41
|
}
|
|
45
|
-
if (!pending)
|
|
46
|
-
onFlush(() => (pending = undefined));
|
|
47
|
-
pending = next;
|
|
48
42
|
setValue(next);
|
|
49
43
|
},
|
|
50
44
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A value that one part registers once mounted, for another part to read,
|
|
3
|
+
* such as the Arrow's middleware, which a popup's Popup uses to place it.
|
|
4
|
+
* Returns the value, `undefined` while none is registered, and `register`,
|
|
5
|
+
* which takes the value as a getter and returns what unregisters it, for
|
|
6
|
+
* the part's disposal. Unregistering removes only the part's own value, so
|
|
7
|
+
* one that another part registered after it stays.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createSlot<T>(): [
|
|
10
|
+
value: () => T | undefined,
|
|
11
|
+
register: (value: () => T) => () => void
|
|
12
|
+
];
|
|
13
|
+
/**
|
|
14
|
+
* A slot for the `id` of a part that another part names, such as a popup's
|
|
15
|
+
* Title, which the Popup names in `aria-labelledby`. `false`, a consumer's
|
|
16
|
+
* way to remove the part's `id`, names nothing.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createIdSlot(): [
|
|
19
|
+
id: () => string | undefined,
|
|
20
|
+
register: (id: () => string | false) => () => void
|
|
21
|
+
];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createSignal } from "solid-js";
|
|
2
|
+
/**
|
|
3
|
+
* A value that one part registers once mounted, for another part to read,
|
|
4
|
+
* such as the Arrow's middleware, which a popup's Popup uses to place it.
|
|
5
|
+
* Returns the value, `undefined` while none is registered, and `register`,
|
|
6
|
+
* which takes the value as a getter and returns what unregisters it, for
|
|
7
|
+
* the part's disposal. Unregistering removes only the part's own value, so
|
|
8
|
+
* one that another part registered after it stays.
|
|
9
|
+
*/
|
|
10
|
+
export function createSlot() {
|
|
11
|
+
const [slot, setSlot] = createSignal();
|
|
12
|
+
const value = () => slot()?.();
|
|
13
|
+
const register = (next) => {
|
|
14
|
+
setSlot(() => next);
|
|
15
|
+
return () => setSlot((current) => (current === next ? undefined : current));
|
|
16
|
+
};
|
|
17
|
+
return [value, register];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A slot for the `id` of a part that another part names, such as a popup's
|
|
21
|
+
* Title, which the Popup names in `aria-labelledby`. `false`, a consumer's
|
|
22
|
+
* way to remove the part's `id`, names nothing.
|
|
23
|
+
*/
|
|
24
|
+
export function createIdSlot() {
|
|
25
|
+
const [slot, register] = createSlot();
|
|
26
|
+
const id = () => slot() || undefined;
|
|
27
|
+
return [id, register];
|
|
28
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { JSX } from "@solidjs/web";
|
|
2
|
+
import type { RenderProp } from "../../core/renderElement.tsx";
|
|
3
|
+
export interface DialogCloseProps extends JSX.HTMLAttributes<HTMLElement> {
|
|
4
|
+
render?: RenderProp;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A button that closes the dialog: a `<button type="button">`, such as
|
|
8
|
+
* "Cancel" or a close icon with an `aria-label`. Place it inside
|
|
9
|
+
* `Dialog.Popup`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function DialogClose(props: DialogCloseProps): JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { isDev } from "@solidjs/web";
|
|
2
|
+
import { merge, omit } from "solid-js";
|
|
3
|
+
import { warnUnlessButton } from "../../core/button.js";
|
|
4
|
+
import { mergeElementProps } from "../../core/mergeElementProps.js";
|
|
5
|
+
import { renderElement } from "../../core/renderElement.jsx";
|
|
6
|
+
import { useDialogRootContext } from "../root/DialogRootContext.js";
|
|
7
|
+
/**
|
|
8
|
+
* A button that closes the dialog: a `<button type="button">`, such as
|
|
9
|
+
* "Cancel" or a close icon with an `aria-label`. Place it inside
|
|
10
|
+
* `Dialog.Popup`.
|
|
11
|
+
*/
|
|
12
|
+
export function DialogClose(props) {
|
|
13
|
+
const root = useDialogRootContext();
|
|
14
|
+
const ownProps = merge(root.attributes, {
|
|
15
|
+
type: "button",
|
|
16
|
+
onClick: (event) => root.setOpen(false, { reason: "close-press", event }),
|
|
17
|
+
ref: (element) => {
|
|
18
|
+
// Production builds drop the check with `isDev`.
|
|
19
|
+
if (isDev)
|
|
20
|
+
warnUnlessButton(element, "Dialog.Close");
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
const elementProps = mergeElementProps(ownProps, omit(props, "render"));
|
|
24
|
+
return renderElement(props, elementProps, (p) => <button {...p}/>);
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JSX } from "@solidjs/web";
|
|
2
|
+
import type { RenderProp } from "../../core/renderElement.tsx";
|
|
3
|
+
export interface DialogDescriptionProps extends JSX.HTMLAttributes<HTMLElement> {
|
|
4
|
+
render?: RenderProp;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* What the dialog is for, which describes the Popup in
|
|
8
|
+
* `aria-describedby`: a `<p>`. Place it inside `Dialog.Popup`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function DialogDescription(props: DialogDescriptionProps): JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createUniqueId, merge, omit, onSettled } from "solid-js";
|
|
2
|
+
import { mergeElementProps } from "../../core/mergeElementProps.js";
|
|
3
|
+
import { renderElement } from "../../core/renderElement.jsx";
|
|
4
|
+
import { useDialogRootContext } from "../root/DialogRootContext.js";
|
|
5
|
+
/**
|
|
6
|
+
* What the dialog is for, which describes the Popup in
|
|
7
|
+
* `aria-describedby`: a `<p>`. Place it inside `Dialog.Popup`.
|
|
8
|
+
*/
|
|
9
|
+
export function DialogDescription(props) {
|
|
10
|
+
const root = useDialogRootContext();
|
|
11
|
+
const generated = createUniqueId();
|
|
12
|
+
// The consumer's `id`, else the generated one. Kept out of the merge,
|
|
13
|
+
// where a wrapper's `id={undefined}` would remove it ("`undefined` is a
|
|
14
|
+
// value", PLAN.md section 8).
|
|
15
|
+
const id = () => props.id ?? generated;
|
|
16
|
+
// Named once mounted, so the Popup names only a Description that is
|
|
17
|
+
// rendered, and none in the server HTML (README, "Decisions").
|
|
18
|
+
onSettled(() => root.registerDescriptionId(id));
|
|
19
|
+
const ownProps = merge(root.attributes, {
|
|
20
|
+
get id() {
|
|
21
|
+
return id();
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
const elementProps = mergeElementProps(ownProps, omit(props, "render", "id"));
|
|
25
|
+
return renderElement(props, elementProps, (p) => <p {...p}/>);
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as Dialog from "./index.parts.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as Dialog from "./index.parts.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { DialogRoot as Root } from "./root/DialogRoot.tsx";
|
|
2
|
+
export { DialogTrigger as Trigger } from "./trigger/DialogTrigger.tsx";
|
|
3
|
+
export { DialogPopup as Popup } from "./popup/DialogPopup.tsx";
|
|
4
|
+
export { DialogTitle as Title } from "./title/DialogTitle.tsx";
|
|
5
|
+
export { DialogDescription as Description } from "./description/DialogDescription.tsx";
|
|
6
|
+
export { DialogClose as Close } from "./close/DialogClose.tsx";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { DialogRoot as Root } from "./root/DialogRoot.jsx";
|
|
2
|
+
export { DialogTrigger as Trigger } from "./trigger/DialogTrigger.jsx";
|
|
3
|
+
export { DialogPopup as Popup } from "./popup/DialogPopup.jsx";
|
|
4
|
+
export { DialogTitle as Title } from "./title/DialogTitle.jsx";
|
|
5
|
+
export { DialogDescription as Description } from "./description/DialogDescription.jsx";
|
|
6
|
+
export { DialogClose as Close } from "./close/DialogClose.jsx";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DialogPopupProps } from "./renderDialogPopup.tsx";
|
|
2
|
+
export type { DialogPopupProps } from "./renderDialogPopup.tsx";
|
|
3
|
+
/**
|
|
4
|
+
* The dialog itself: a `<dialog>`, opened with `showModal()`, so it is
|
|
5
|
+
* modal, in the top layer, over an inert page. Named by `Dialog.Title` and
|
|
6
|
+
* described by `Dialog.Description` when they are rendered inside it. A
|
|
7
|
+
* press on the backdrop closes it. Place it inside `Dialog.Root`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function DialogPopup(props: DialogPopupProps): import("@solidjs/web").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createOutsidePress } from "../../floating/dismissal/outsidePress.js";
|
|
2
|
+
import { renderDialogPopup } from "./renderDialogPopup.jsx";
|
|
3
|
+
/**
|
|
4
|
+
* The dialog itself: a `<dialog>`, opened with `showModal()`, so it is
|
|
5
|
+
* modal, in the top layer, over an inert page. Named by `Dialog.Title` and
|
|
6
|
+
* described by `Dialog.Description` when they are rendered inside it. A
|
|
7
|
+
* press on the backdrop closes it. Place it inside `Dialog.Root`.
|
|
8
|
+
*/
|
|
9
|
+
export function DialogPopup(props) {
|
|
10
|
+
return renderDialogPopup(props, createOutsidePress);
|
|
11
|
+
}
|