@glasshome/ui 1.42.0 → 1.43.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.
- package/dist/index.js +2 -2
- package/dist/lib/anchor-placement.d.ts +4 -0
- package/dist/lib/balance-rows.d.ts +10 -4
- package/dist/lib/behavior/anchored.d.ts +16 -2
- package/dist/lib/behavior/button-root.d.ts +7 -0
- package/dist/lib/behavior/collection.d.ts +8 -0
- package/dist/lib/behavior/dismiss.d.ts +6 -4
- package/dist/lib/behavior/focus-scope.d.ts +7 -1
- package/dist/lib/behavior/hide-outside.d.ts +1 -1
- package/dist/lib/behavior/layer-stack.d.ts +3 -2
- package/dist/lib/behavior/menu.d.ts +59 -0
- package/dist/lib/behavior/modal-root.d.ts +2 -0
- package/dist/lib/behavior/range.d.ts +44 -0
- package/dist/lib/color/color.d.ts +41 -0
- package/dist/lib/color/index.d.ts +2 -0
- package/dist/lib/color/intl.d.ts +40 -0
- package/dist/lib/dock-slot-classes.d.ts +2 -0
- package/dist/lib/hold.d.ts +1 -1
- package/dist/lib/locale.d.ts +3 -0
- package/dist/lib/menu-classes.d.ts +2 -0
- package/dist/lib/motion-classes.d.ts +1 -1
- package/dist/lib/overlay-classes.d.ts +1 -0
- package/dist/lib/scroll-track.d.ts +3 -2
- package/dist/lib/section-tokens.d.ts +1 -1
- package/dist/lib/segment-classes.d.ts +2 -0
- package/dist/lib/shadow-layer.d.ts +0 -45
- package/dist/lib/toggle-set.d.ts +44 -0
- package/dist/lib/visually-hidden.d.ts +3 -0
- package/dist/solid/accordion.d.ts +35 -11
- package/dist/solid/avatar.d.ts +8 -4
- package/dist/solid/bottom-sheet/bottom-sheet.d.ts +1 -1
- package/dist/solid/button.d.ts +5 -4
- package/dist/solid/charts.d.ts +1 -1
- package/dist/solid/checkbox.d.ts +14 -4
- package/dist/solid/collapsible.d.ts +33 -5
- package/dist/solid/color-disc.d.ts +1 -1
- package/dist/solid/color-slider.d.ts +1 -1
- package/dist/solid/color-wheel.d.ts +1 -1
- package/dist/solid/context-menu.d.ts +58 -24
- package/dist/solid/dialog-parts.d.ts +8 -8
- package/dist/solid/dropdown-menu.d.ts +55 -24
- package/dist/solid/empty.d.ts +1 -1
- package/dist/solid/form.d.ts +5 -6
- package/dist/solid/hover-card.d.ts +65 -9
- package/dist/solid/index.d.ts +1 -1
- package/dist/solid/index.js +7725 -13458
- package/dist/solid/input-group.d.ts +6 -6
- package/dist/solid/item.d.ts +1 -1
- package/dist/solid/menu-parts.d.ts +175 -24
- package/dist/solid/option-card.d.ts +1 -4
- package/dist/solid/picker-row.d.ts +2 -0
- package/dist/solid/popover.d.ts +77 -12
- package/dist/solid/progress.d.ts +11 -3
- package/dist/solid/radio-group.d.ts +31 -6
- package/dist/solid/responsive-dialog.d.ts +1 -1
- package/dist/solid/scroll-area.d.ts +1 -1
- package/dist/solid/section-card.d.ts +2 -3
- package/dist/solid/select.d.ts +107 -10
- package/dist/solid/selection.d.ts +10 -1
- package/dist/solid/sheet.d.ts +1 -1
- package/dist/solid/sliding-indicator.d.ts +1 -1
- package/dist/solid/sonner.d.ts +1 -1
- package/dist/solid/toggle.d.ts +11 -3
- package/dist/solid/tooltip.d.ts +22 -22
- package/dist/tokens/index.js +54 -51
- package/dist/{utils-CxAii-e9.js → utils-3Codx-NZ.js} +527 -489
- package/package.json +3 -6
- package/src/lib/anchor-placement.ts +10 -3
- package/src/lib/balance-rows.ts +115 -40
- package/src/lib/behavior/anchored.ts +26 -8
- package/src/lib/behavior/button-root.tsx +103 -0
- package/src/lib/behavior/collection.ts +66 -29
- package/src/lib/behavior/dismiss.ts +61 -21
- package/src/lib/behavior/focus-scope.ts +31 -6
- package/src/lib/behavior/hide-outside.ts +2 -2
- package/src/lib/behavior/layer-stack.ts +33 -8
- package/src/lib/behavior/menu.ts +470 -0
- package/src/lib/behavior/modal-root.tsx +24 -18
- package/src/lib/behavior/polymorphic.tsx +1 -1
- package/src/lib/behavior/presence.ts +1 -1
- package/src/lib/behavior/range.ts +212 -0
- package/src/lib/clipboard.ts +2 -3
- package/src/lib/color/color.ts +746 -0
- package/src/lib/color/index.ts +2 -0
- package/src/lib/color/intl.ts +60 -0
- package/src/lib/dock-slot-classes.ts +3 -0
- package/src/lib/hold.ts +1 -1
- package/src/lib/locale.ts +62 -0
- package/src/lib/menu-classes.ts +3 -0
- package/src/lib/motion-classes.ts +7 -7
- package/src/lib/overlay-classes.ts +1 -3
- package/src/lib/scroll-track.ts +11 -6
- package/src/lib/section-tokens.ts +1 -1
- package/src/lib/segment-classes.ts +3 -0
- package/src/lib/shadow-layer.ts +0 -118
- package/src/lib/toggle-set.ts +133 -0
- package/src/lib/visually-hidden.ts +15 -0
- package/src/solid/accordion.tsx +294 -20
- package/src/solid/area-picker.tsx +3 -2
- package/src/solid/avatar.tsx +98 -24
- package/src/solid/bottom-sheet/bottom-sheet.tsx +1 -1
- package/src/solid/button.tsx +12 -6
- package/src/solid/charts.tsx +1 -1
- package/src/solid/checkbox.tsx +167 -44
- package/src/solid/collapsible.tsx +260 -12
- package/src/solid/color-disc.tsx +11 -12
- package/src/solid/color-slider.tsx +114 -47
- package/src/solid/color-wheel.tsx +137 -39
- package/src/solid/context-menu.tsx +285 -94
- package/src/solid/dialog-parts.tsx +9 -9
- package/src/solid/dock.tsx +3 -2
- package/src/solid/dropdown-menu.tsx +252 -115
- package/src/solid/empty.tsx +1 -1
- package/src/solid/entity-selector.tsx +3 -2
- package/src/solid/face-toggle.tsx +43 -18
- package/src/solid/form.tsx +5 -6
- package/src/solid/glyph-tile.tsx +48 -21
- package/src/solid/hover-card.tsx +287 -25
- package/src/solid/image-picker.tsx +2 -2
- package/src/solid/index.ts +1 -3
- package/src/solid/input-group.tsx +2 -2
- package/src/solid/item.tsx +1 -1
- package/src/solid/menu-parts.tsx +619 -145
- package/src/solid/option-card.tsx +6 -10
- package/src/solid/picker-row.tsx +5 -1
- package/src/solid/popover.tsx +424 -79
- package/src/solid/preview-tile.tsx +1 -1
- package/src/solid/progress.tsx +84 -15
- package/src/solid/radio-group.tsx +271 -34
- package/src/solid/responsive-dialog.tsx +1 -1
- package/src/solid/schema-form.tsx +1 -6
- package/src/solid/scroll-area.tsx +1 -1
- package/src/solid/section-card.tsx +3 -4
- package/src/solid/select.tsx +950 -95
- package/src/solid/selection.tsx +142 -66
- package/src/solid/sheet.tsx +1 -1
- package/src/solid/slider.tsx +115 -65
- package/src/solid/sliding-indicator.tsx +1 -1
- package/src/solid/sonner.tsx +1 -1
- package/src/solid/tabs.tsx +12 -6
- package/src/solid/term.tsx +3 -4
- package/src/solid/toggle-group.tsx +29 -99
- package/src/solid/toggle.tsx +43 -9
- package/src/solid/tooltip.tsx +24 -24
- package/src/styles/globals.css +61 -7
- package/src/styles/theme.css +7 -4
- package/src/tokens/material.ts +11 -2
|
@@ -1,132 +1,297 @@
|
|
|
1
|
-
import { ContextMenu as ContextMenuPrimitive } from "@kobalte/core/context-menu";
|
|
2
|
-
import { usePortalMount } from "./portal-mount.js";
|
|
3
|
-
import { useMenuContext } from "@kobalte/core/menu";
|
|
4
1
|
import {
|
|
5
2
|
type Component,
|
|
6
3
|
type ComponentProps,
|
|
4
|
+
createContext,
|
|
7
5
|
createSignal,
|
|
8
|
-
|
|
6
|
+
createUniqueId,
|
|
7
|
+
type JSX,
|
|
8
|
+
onCleanup,
|
|
9
9
|
splitProps,
|
|
10
|
+
untrack,
|
|
11
|
+
useContext,
|
|
12
|
+
type ValidComponent,
|
|
10
13
|
} from "solid-js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
ReportCovered,
|
|
16
|
-
shadowLayer,
|
|
17
|
-
} from "../lib/shadow-layer.js";
|
|
14
|
+
import { Polymorphic } from "../lib/behavior/polymorphic.js";
|
|
15
|
+
import { callEventHandler, effect, merge } from "../lib/behavior/solid.js";
|
|
16
|
+
import { createHold } from "../lib/hold.js";
|
|
17
|
+
import { MOTION_EXIT_MS, OVERLAY_MOTION } from "../lib/motion-classes.js";
|
|
18
18
|
import { cn } from "../lib/utils.js";
|
|
19
19
|
import {
|
|
20
|
-
|
|
20
|
+
createMenuLevel,
|
|
21
|
+
type DeprecatedMenuRootProps,
|
|
22
|
+
MenuArrow,
|
|
23
|
+
type MenuCheckboxItemProps,
|
|
21
24
|
MenuCheckboxItemPart,
|
|
22
|
-
|
|
25
|
+
MenuContentPart,
|
|
26
|
+
type MenuContentProps,
|
|
27
|
+
MenuGroup,
|
|
28
|
+
MenuItemIndicator,
|
|
29
|
+
type MenuItemProps,
|
|
23
30
|
MenuItemPart,
|
|
31
|
+
type MenuLabelProps,
|
|
24
32
|
MenuLabelPart,
|
|
33
|
+
MenuLevelProvider,
|
|
34
|
+
type MenuPlacement,
|
|
35
|
+
MenuPortal,
|
|
36
|
+
MenuRadioGroup,
|
|
37
|
+
type MenuRadioItemProps,
|
|
25
38
|
MenuRadioItemPart,
|
|
26
39
|
MenuSeparatorPart,
|
|
40
|
+
MenuSub,
|
|
27
41
|
MenuSubContentPart,
|
|
42
|
+
type MenuSubTriggerProps,
|
|
28
43
|
MenuSubTriggerPart,
|
|
44
|
+
MenuTextPart,
|
|
45
|
+
parsePlacement,
|
|
46
|
+
useMenuLevel,
|
|
29
47
|
} from "./menu-parts.js";
|
|
30
48
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
49
|
+
interface ContextMenuRootProps extends DeprecatedMenuRootProps {
|
|
50
|
+
onOpenChange?: (open: boolean) => void;
|
|
51
|
+
placement?: MenuPlacement;
|
|
52
|
+
gutter?: number;
|
|
53
|
+
children?: JSX.Element;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
type Point = { x: number; y: number };
|
|
57
|
+
|
|
58
|
+
const PointContext = createContext<(point: Point) => void>();
|
|
59
|
+
|
|
60
|
+
const usePoint = (): ((point: Point) => void) => {
|
|
61
|
+
const setPoint = useContext(PointContext);
|
|
62
|
+
if (!setPoint) throw new Error("ContextMenuTrigger renders inside a ContextMenu");
|
|
63
|
+
return setPoint;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const ContextMenuRoot: Component<ContextMenuRootProps> = (props) => {
|
|
67
|
+
const [isOpen, setIsOpen] = createSignal(false);
|
|
68
|
+
const setOpen = (next: boolean) => {
|
|
69
|
+
if (next === untrack(isOpen)) return;
|
|
70
|
+
setIsOpen(next);
|
|
71
|
+
props.onOpenChange?.(next);
|
|
72
|
+
};
|
|
73
|
+
const [point, setPoint] = createSignal<Point>({ x: 0, y: 0 });
|
|
74
|
+
const placement = () => parsePlacement(props.placement ?? "right-start");
|
|
75
|
+
const level = createMenuLevel({
|
|
76
|
+
open: isOpen,
|
|
77
|
+
onOpenChange: setOpen,
|
|
78
|
+
anchor: (trigger) => {
|
|
79
|
+
const at = point();
|
|
80
|
+
return {
|
|
81
|
+
getBoundingClientRect: () => ({ left: at.x, top: at.y, width: 0, height: 0 }),
|
|
82
|
+
getRootNode: () => trigger?.getRootNode() ?? document,
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
side: () => placement()[0],
|
|
86
|
+
align: () => placement()[1],
|
|
87
|
+
offset: untrack(() => props.gutter ?? 2),
|
|
88
|
+
triggerIsArea: true,
|
|
89
|
+
});
|
|
35
90
|
return (
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
</
|
|
91
|
+
<PointContext.Provider value={setPoint}>
|
|
92
|
+
<MenuLevelProvider value={level}>{props.children}</MenuLevelProvider>
|
|
93
|
+
</PointContext.Provider>
|
|
39
94
|
);
|
|
40
95
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return <ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />;
|
|
96
|
+
|
|
97
|
+
type TriggerOwnProps = {
|
|
98
|
+
disabled?: boolean;
|
|
99
|
+
id?: string;
|
|
100
|
+
ref?: unknown;
|
|
101
|
+
style?: JSX.CSSProperties | string;
|
|
102
|
+
onContextMenu?: JSX.EventHandlerUnion<HTMLElement, MouseEvent>;
|
|
103
|
+
onPointerDown?: JSX.EventHandlerUnion<HTMLElement, PointerEvent>;
|
|
104
|
+
onPointerMove?: JSX.EventHandlerUnion<HTMLElement, PointerEvent>;
|
|
105
|
+
onPointerUp?: JSX.EventHandlerUnion<HTMLElement, PointerEvent>;
|
|
106
|
+
onPointerCancel?: JSX.EventHandlerUnion<HTMLElement, PointerEvent>;
|
|
53
107
|
};
|
|
54
108
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
109
|
+
type ContextMenuTriggerProps<T extends ValidComponent = "div"> = TriggerOwnProps & {
|
|
110
|
+
as?: T;
|
|
111
|
+
} & Omit<ComponentProps<T>, "as" | keyof TriggerOwnProps>;
|
|
112
|
+
|
|
113
|
+
type Bound<E extends Event> = E & { currentTarget: HTMLElement; target: Element };
|
|
58
114
|
|
|
59
|
-
const
|
|
60
|
-
props,
|
|
61
|
-
) => <MenuSubContentPart slotName="context-menu-sub-content" {...props} />;
|
|
115
|
+
const NO_CALLOUT = "-webkit-touch-callout: none";
|
|
62
116
|
|
|
63
|
-
|
|
64
|
-
props
|
|
65
|
-
)
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
117
|
+
function ContextMenuTrigger<T extends ValidComponent = "div">(
|
|
118
|
+
props: ContextMenuTriggerProps<T>,
|
|
119
|
+
): JSX.Element {
|
|
120
|
+
const level = useMenuLevel();
|
|
121
|
+
const menu = level.menu;
|
|
122
|
+
const setPoint = usePoint();
|
|
123
|
+
const [local, rest] = splitProps(props as ContextMenuTriggerProps<ValidComponent>, [
|
|
124
|
+
"as",
|
|
125
|
+
"id",
|
|
69
126
|
"ref",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
127
|
+
"disabled",
|
|
128
|
+
"style",
|
|
129
|
+
"onContextMenu",
|
|
130
|
+
"onPointerDown",
|
|
131
|
+
"onPointerMove",
|
|
132
|
+
"onPointerUp",
|
|
133
|
+
"onPointerCancel",
|
|
72
134
|
]);
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
dismiss: () => menu.close(true),
|
|
79
|
-
tree: true,
|
|
80
|
-
consumer: local,
|
|
135
|
+
const fallback = createUniqueId();
|
|
136
|
+
const id = (): string => local.id ?? fallback;
|
|
137
|
+
effect(id, (value) => {
|
|
138
|
+
level.setTriggerId(value);
|
|
139
|
+
return () => level.setTriggerId(undefined);
|
|
81
140
|
});
|
|
141
|
+
const disabled = () => local.disabled ?? false;
|
|
142
|
+
const openAt = (point: Point) => {
|
|
143
|
+
setPoint(point);
|
|
144
|
+
menu.show("content");
|
|
145
|
+
};
|
|
146
|
+
let pressedAt: Point = { x: 0, y: 0 };
|
|
147
|
+
const hold = createHold({ onHold: () => openAt(pressedAt) });
|
|
148
|
+
onCleanup(hold.cancel);
|
|
149
|
+
const [el, setEl] = createSignal<HTMLElement>();
|
|
150
|
+
|
|
151
|
+
// Bound on the element, since Solid's delegated handlers never reach inside a closed shadow root.
|
|
152
|
+
effect(el, (node) => {
|
|
153
|
+
if (!node) return;
|
|
154
|
+
const onMenu = (event: MouseEvent) => {
|
|
155
|
+
callEventHandler(event as Bound<MouseEvent>, local.onContextMenu);
|
|
156
|
+
// A fired hold already opened the menu and spent this press.
|
|
157
|
+
if (disabled() || event.defaultPrevented) return;
|
|
158
|
+
event.preventDefault();
|
|
159
|
+
event.stopPropagation();
|
|
160
|
+
openAt({ x: event.clientX, y: event.clientY });
|
|
161
|
+
};
|
|
162
|
+
const onDown = (event: PointerEvent) => {
|
|
163
|
+
callEventHandler(event as Bound<PointerEvent>, local.onPointerDown);
|
|
164
|
+
if (disabled() || event.pointerType === "mouse") return;
|
|
165
|
+
pressedAt = { x: event.clientX, y: event.clientY };
|
|
166
|
+
hold.down(event);
|
|
167
|
+
};
|
|
168
|
+
const onMove = (event: PointerEvent) => {
|
|
169
|
+
callEventHandler(event as Bound<PointerEvent>, local.onPointerMove);
|
|
170
|
+
hold.move(event);
|
|
171
|
+
};
|
|
172
|
+
const onUp = (event: PointerEvent) => {
|
|
173
|
+
callEventHandler(event as Bound<PointerEvent>, local.onPointerUp);
|
|
174
|
+
hold.up();
|
|
175
|
+
};
|
|
176
|
+
const onCancel = (event: PointerEvent) => {
|
|
177
|
+
callEventHandler(event as Bound<PointerEvent>, local.onPointerCancel);
|
|
178
|
+
hold.cancel();
|
|
179
|
+
};
|
|
180
|
+
node.addEventListener("contextmenu", onMenu);
|
|
181
|
+
node.addEventListener("pointerdown", onDown);
|
|
182
|
+
node.addEventListener("pointermove", onMove);
|
|
183
|
+
node.addEventListener("pointerup", onUp);
|
|
184
|
+
node.addEventListener("pointercancel", onCancel);
|
|
185
|
+
return () => {
|
|
186
|
+
node.removeEventListener("contextmenu", onMenu);
|
|
187
|
+
node.removeEventListener("pointerdown", onDown);
|
|
188
|
+
node.removeEventListener("pointermove", onMove);
|
|
189
|
+
node.removeEventListener("pointerup", onUp);
|
|
190
|
+
node.removeEventListener("pointercancel", onCancel);
|
|
191
|
+
if (untrack(menu.trigger) === node) menu.setTrigger(undefined);
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
|
|
82
195
|
return (
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
local.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
196
|
+
<Polymorphic
|
|
197
|
+
{...merge({ "data-slot": "context-menu-trigger" }, rest, {
|
|
198
|
+
as: local.as,
|
|
199
|
+
defaultAs: "div" as ValidComponent,
|
|
200
|
+
get id() {
|
|
201
|
+
return id();
|
|
202
|
+
},
|
|
203
|
+
ref: (node: HTMLElement) => {
|
|
204
|
+
setEl(node);
|
|
205
|
+
menu.setTrigger(node);
|
|
206
|
+
if (typeof local.ref === "function") local.ref(node);
|
|
207
|
+
},
|
|
208
|
+
get style() {
|
|
209
|
+
const own = local.style;
|
|
210
|
+
return typeof own === "string"
|
|
211
|
+
? `${NO_CALLOUT}; ${own}`
|
|
212
|
+
: { "-webkit-touch-callout": "none", ...own };
|
|
213
|
+
},
|
|
214
|
+
get "data-disabled"() {
|
|
215
|
+
return disabled() ? "" : undefined;
|
|
216
|
+
},
|
|
217
|
+
get "data-expanded"() {
|
|
218
|
+
return menu.open() ? "" : undefined;
|
|
219
|
+
},
|
|
220
|
+
get "data-closed"() {
|
|
221
|
+
return menu.open() ? undefined : "";
|
|
222
|
+
},
|
|
223
|
+
})}
|
|
224
|
+
/>
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// The panel opens at the pointer with its start corner there, so it unfolds from that corner.
|
|
229
|
+
const ORIGIN_AT_POINTER =
|
|
230
|
+
"data-[side=right]:origin-top-left data-[side=left]:origin-top-right data-[side=bottom]:origin-top-left data-[side=top]:origin-bottom-left";
|
|
231
|
+
|
|
232
|
+
const ContextMenuContent: Component<MenuContentProps> = (props) => {
|
|
233
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
234
|
+
return (
|
|
235
|
+
<MenuContentPart
|
|
236
|
+
slotName="context-menu-content"
|
|
237
|
+
motionClass={cn(OVERLAY_MOTION, ORIGIN_AT_POINTER, "overflow-x-hidden overflow-y-auto")}
|
|
238
|
+
exitMs={MOTION_EXIT_MS.overlay}
|
|
239
|
+
class={local.class}
|
|
240
|
+
{...rest}
|
|
241
|
+
/>
|
|
103
242
|
);
|
|
104
243
|
};
|
|
105
244
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
variant?: "default" | "destructive";
|
|
112
|
-
}
|
|
113
|
-
> = (props) => <MenuItemPart slotName="context-menu-item" {...props} />;
|
|
245
|
+
function ContextMenuItem<T extends ValidComponent = "div">(props: MenuItemProps<T>): JSX.Element {
|
|
246
|
+
return (
|
|
247
|
+
<MenuItemPart slotName="context-menu-item" {...(props as MenuItemProps<ValidComponent>)} />
|
|
248
|
+
);
|
|
249
|
+
}
|
|
114
250
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
251
|
+
function ContextMenuSubTrigger<T extends ValidComponent = "div">(
|
|
252
|
+
props: MenuSubTriggerProps<T>,
|
|
253
|
+
): JSX.Element {
|
|
254
|
+
return (
|
|
255
|
+
<MenuSubTriggerPart
|
|
256
|
+
slotName="context-menu-sub-trigger"
|
|
257
|
+
{...(props as MenuSubTriggerProps<ValidComponent>)}
|
|
258
|
+
/>
|
|
259
|
+
);
|
|
260
|
+
}
|
|
118
261
|
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
262
|
+
const ContextMenuSubContent: Component<MenuContentProps> = (props) => (
|
|
263
|
+
<MenuSubContentPart slotName="context-menu-sub-content" {...props} />
|
|
264
|
+
);
|
|
122
265
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
266
|
+
function ContextMenuCheckboxItem<T extends ValidComponent = "div">(
|
|
267
|
+
props: MenuCheckboxItemProps<T>,
|
|
268
|
+
): JSX.Element {
|
|
269
|
+
return (
|
|
270
|
+
<MenuCheckboxItemPart
|
|
271
|
+
slotName="context-menu-checkbox-item"
|
|
272
|
+
{...(props as MenuCheckboxItemProps<ValidComponent>)}
|
|
273
|
+
/>
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function ContextMenuRadioItem<T extends ValidComponent = "div">(
|
|
278
|
+
props: MenuRadioItemProps<T>,
|
|
279
|
+
): JSX.Element {
|
|
280
|
+
return (
|
|
281
|
+
<MenuRadioItemPart
|
|
282
|
+
slotName="context-menu-radio-item"
|
|
283
|
+
{...(props as MenuRadioItemProps<ValidComponent>)}
|
|
284
|
+
/>
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const ContextMenuLabel: Component<MenuLabelProps> = (props) => (
|
|
289
|
+
<MenuLabelPart slotName="context-menu-label" {...props} />
|
|
290
|
+
);
|
|
126
291
|
|
|
127
|
-
const ContextMenuSeparator: Component<ComponentProps<
|
|
128
|
-
props
|
|
129
|
-
)
|
|
292
|
+
const ContextMenuSeparator: Component<ComponentProps<"hr">> = (props) => (
|
|
293
|
+
<MenuSeparatorPart slotName="context-menu-separator" {...props} />
|
|
294
|
+
);
|
|
130
295
|
|
|
131
296
|
const ContextMenuShortcut: Component<ComponentProps<"span">> = (props) => {
|
|
132
297
|
const [local, rest] = splitProps(props, ["class"]);
|
|
@@ -139,6 +304,32 @@ const ContextMenuShortcut: Component<ComponentProps<"span">> = (props) => {
|
|
|
139
304
|
);
|
|
140
305
|
};
|
|
141
306
|
|
|
307
|
+
const ContextMenuGroup = MenuGroup;
|
|
308
|
+
const ContextMenuSub = MenuSub;
|
|
309
|
+
const ContextMenuRadioGroup = MenuRadioGroup;
|
|
310
|
+
|
|
311
|
+
const ContextMenu = Object.assign(ContextMenuRoot, {
|
|
312
|
+
Root: ContextMenuRoot,
|
|
313
|
+
Trigger: ContextMenuTrigger,
|
|
314
|
+
Portal: MenuPortal,
|
|
315
|
+
Content: ContextMenuContent,
|
|
316
|
+
Arrow: MenuArrow,
|
|
317
|
+
Item: ContextMenuItem,
|
|
318
|
+
CheckboxItem: ContextMenuCheckboxItem,
|
|
319
|
+
RadioGroup: ContextMenuRadioGroup,
|
|
320
|
+
RadioItem: ContextMenuRadioItem,
|
|
321
|
+
Group: ContextMenuGroup,
|
|
322
|
+
GroupLabel: ContextMenuLabel,
|
|
323
|
+
Separator: ContextMenuSeparator,
|
|
324
|
+
Sub: ContextMenuSub,
|
|
325
|
+
SubTrigger: ContextMenuSubTrigger,
|
|
326
|
+
SubContent: ContextMenuSubContent,
|
|
327
|
+
ItemIndicator: MenuItemIndicator,
|
|
328
|
+
Icon: MenuTextPart,
|
|
329
|
+
ItemLabel: MenuTextPart,
|
|
330
|
+
ItemDescription: MenuTextPart,
|
|
331
|
+
});
|
|
332
|
+
|
|
142
333
|
export {
|
|
143
334
|
ContextMenu,
|
|
144
335
|
ContextMenuCheckboxItem,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ButtonRoot, type ButtonRootProps } from "../lib/behavior/button-root.js";
|
|
2
2
|
import {
|
|
3
3
|
type Accessor,
|
|
4
4
|
children,
|
|
@@ -53,13 +53,13 @@ export interface ModalRootSkinProps {
|
|
|
53
53
|
modal?: boolean;
|
|
54
54
|
/** Stays mounted and dormant after it closes, so the next open shows the same nodes instead of building them. */
|
|
55
55
|
keep?: boolean;
|
|
56
|
-
/** @deprecated
|
|
56
|
+
/** @deprecated Ignored; removed in 2.0.0. */
|
|
57
57
|
id?: string;
|
|
58
|
-
/** @deprecated
|
|
58
|
+
/** @deprecated Ignored; removed in 2.0.0. */
|
|
59
59
|
forceMount?: boolean;
|
|
60
|
-
/** @deprecated
|
|
60
|
+
/** @deprecated Ignored; removed in 2.0.0. */
|
|
61
61
|
preventScroll?: boolean;
|
|
62
|
-
/** @deprecated
|
|
62
|
+
/** @deprecated Ignored; removed in 2.0.0. */
|
|
63
63
|
translations?: Record<string, string>;
|
|
64
64
|
children?: JSX.Element;
|
|
65
65
|
}
|
|
@@ -90,9 +90,9 @@ export type ModalContentProps = Omit<ComponentProps<"div">, "style" | "role"> &
|
|
|
90
90
|
onInteractOutside?: (event: InteractOutsideEvent) => void;
|
|
91
91
|
onOpenAutoFocus?: (event: Event) => void;
|
|
92
92
|
onCloseAutoFocus?: (event: Event) => void;
|
|
93
|
-
/** @deprecated
|
|
93
|
+
/** @deprecated Ignored; removed in 2.0.0. */
|
|
94
94
|
onFocusOutside?: (event: FocusOutsideEvent) => void;
|
|
95
|
-
/** @deprecated
|
|
95
|
+
/** @deprecated Ignored; removed in 2.0.0. */
|
|
96
96
|
forceMount?: boolean;
|
|
97
97
|
};
|
|
98
98
|
|
|
@@ -321,7 +321,7 @@ export function createModalHead<P extends ModalHeadProps = ModalHeadProps>(
|
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
export type ModalDismissProps =
|
|
324
|
+
export type ModalDismissProps = ButtonRootProps<ValidComponent> & {
|
|
325
325
|
/** Presses do nothing, the dialog stays open and focus stays put; see Button. */
|
|
326
326
|
busy?: boolean;
|
|
327
327
|
};
|
|
@@ -337,7 +337,7 @@ export function createModalDismiss(
|
|
|
337
337
|
const [local, rest] = splitProps(props, ["onClick", "busy"]);
|
|
338
338
|
const context = useCloser();
|
|
339
339
|
return (
|
|
340
|
-
<
|
|
340
|
+
<ButtonRoot
|
|
341
341
|
data-slot={slot}
|
|
342
342
|
onClick={(event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element }) => {
|
|
343
343
|
callEventHandler(event, local.onClick);
|
package/src/solid/dock.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "solid-js";
|
|
16
16
|
import { Polymorphic } from "../lib/behavior/polymorphic.js";
|
|
17
17
|
import { CARD_SURFACE } from "../lib/card-classes.js";
|
|
18
|
-
import { DOCK_SLOT_SHAPE } from "../lib/dock-slot-classes.js";
|
|
18
|
+
import { DOCK_SLOT_RADIUS, DOCK_SLOT_SHAPE } from "../lib/dock-slot-classes.js";
|
|
19
19
|
import {
|
|
20
20
|
DOCK_ARRIVE_MOTION,
|
|
21
21
|
DOCK_EDIT_MOTION,
|
|
@@ -119,7 +119,7 @@ const DockIconButton: Component<DockIconButtonProps> = (props) => {
|
|
|
119
119
|
data-arrived={local.arrived ? "" : undefined}
|
|
120
120
|
{...rest}
|
|
121
121
|
>
|
|
122
|
-
<SelectionHighlight />
|
|
122
|
+
<SelectionHighlight active={local.lit ?? false} />
|
|
123
123
|
<Show when={local.arrived}>
|
|
124
124
|
<span data-slot="dock-item-arrival" aria-hidden="true" class={DOCK_ARRIVE_MOTION} />
|
|
125
125
|
</Show>
|
|
@@ -511,6 +511,7 @@ const Dock: Component<DockProps> = (props) => {
|
|
|
511
511
|
>
|
|
512
512
|
<SelectionScope
|
|
513
513
|
marker="lit"
|
|
514
|
+
radius={DOCK_SLOT_RADIUS}
|
|
514
515
|
class={cn("flex items-center gap-0.5 sm:gap-1", vertical() && "flex-col")}
|
|
515
516
|
>
|
|
516
517
|
<Index each={local.items}>
|