@glasshome/ui 1.40.0 → 1.42.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/SPEC.md +25 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/lib/anchor-placement.d.ts +30 -0
- package/dist/lib/behavior/anchored.d.ts +12 -0
- package/dist/lib/behavior/collection.d.ts +24 -0
- package/dist/lib/behavior/controllable.d.ts +8 -0
- package/dist/lib/behavior/dismiss.d.ts +11 -0
- package/dist/lib/behavior/focus-scope.d.ts +18 -0
- package/dist/lib/behavior/hide-outside.d.ts +7 -0
- package/dist/lib/behavior/layer-stack.d.ts +33 -0
- package/dist/lib/behavior/modal-root.d.ts +66 -0
- package/dist/lib/behavior/polymorphic.d.ts +6 -0
- package/dist/lib/behavior/presence.d.ts +18 -0
- package/dist/lib/behavior/solid.d.ts +13 -0
- package/dist/lib/motion-classes.d.ts +5 -2
- package/dist/lib/overlay-classes.d.ts +4 -1
- package/dist/lib/page-cover.d.ts +8 -0
- package/dist/lib/shadow-layer.d.ts +8 -6
- package/dist/solid/alert-dialog.d.ts +13 -15
- package/dist/solid/bottom-sheet/bottom-sheet.d.ts +2 -6
- package/dist/solid/bottom-sheet/constants.d.ts +1 -1
- package/dist/solid/confirm-dialog.d.ts +22 -0
- package/dist/solid/dialog-parts.d.ts +78 -15
- package/dist/solid/dialog.d.ts +9 -15
- package/dist/solid/docked-panel.d.ts +1 -5
- package/dist/solid/icon-nodes.d.ts +13 -0
- package/dist/solid/index.d.ts +9 -5
- package/dist/solid/index.js +8211 -7974
- package/dist/solid/responsive-dialog.d.ts +5 -6
- package/dist/solid/sheet.d.ts +6 -13
- package/dist/solid/stale-veil.d.ts +7 -0
- package/dist/solid/tabs.d.ts +29 -8
- package/dist/solid/toggle-group.d.ts +30 -5
- package/dist/solid/tooltip.d.ts +71 -9
- package/dist/{utils-DXEj_oXa.js → utils-CxAii-e9.js} +606 -414
- package/package.json +4 -2
- package/src/index.ts +1 -0
- package/src/lib/anchor-placement.ts +68 -2
- package/src/lib/behavior/anchored.ts +88 -0
- package/src/lib/behavior/collection.ts +181 -0
- package/src/lib/behavior/controllable.ts +22 -0
- package/src/lib/behavior/dismiss.ts +145 -0
- package/src/lib/behavior/focus-scope.ts +202 -0
- package/src/lib/behavior/hide-outside.ts +85 -0
- package/src/lib/behavior/layer-stack.ts +125 -0
- package/src/lib/behavior/modal-root.tsx +446 -0
- package/src/lib/behavior/polymorphic.tsx +30 -0
- package/src/lib/behavior/presence.ts +89 -0
- package/src/lib/behavior/solid.ts +30 -0
- package/src/lib/clipboard.ts +3 -2
- package/src/lib/motion-classes.ts +27 -2
- package/src/lib/overlay-classes.ts +9 -4
- package/src/lib/page-cover.ts +47 -0
- package/src/lib/shadow-layer.ts +48 -66
- package/src/solid/alert-dialog.tsx +45 -81
- package/src/solid/alert.tsx +1 -1
- package/src/solid/area-picker.tsx +2 -1
- package/src/solid/badge.tsx +5 -5
- package/src/solid/bottom-sheet/bottom-sheet.tsx +72 -128
- package/src/solid/bottom-sheet/constants.ts +3 -1
- package/src/solid/bottom-sheet/drag-controller.ts +11 -0
- package/src/solid/breadcrumb.tsx +4 -4
- package/src/solid/button-group.tsx +4 -4
- package/src/solid/card.tsx +5 -4
- package/src/solid/confirm-dialog.tsx +62 -0
- package/src/solid/context-menu.tsx +12 -2
- package/src/solid/dialog-parts.tsx +181 -42
- package/src/solid/dialog.tsx +46 -74
- package/src/solid/dock-edit.tsx +5 -4
- package/src/solid/dock.tsx +3 -3
- package/src/solid/dropdown-menu.tsx +15 -7
- package/src/solid/entity-selector.tsx +2 -1
- package/src/solid/form.tsx +4 -3
- package/src/solid/hover-card.tsx +7 -2
- package/src/solid/icon-nodes.ts +71 -0
- package/src/solid/icon-picker.tsx +2 -1
- package/src/solid/icon.tsx +42 -39
- package/src/solid/image-picker.tsx +14 -13
- package/src/solid/index.ts +9 -2
- package/src/solid/input-group.tsx +5 -3
- package/src/solid/input-otp.tsx +2 -1
- package/src/solid/item.tsx +4 -4
- package/src/solid/logo.tsx +5 -4
- package/src/solid/picker-row.tsx +5 -4
- package/src/solid/picker-search.tsx +2 -1
- package/src/solid/popover.tsx +18 -10
- package/src/solid/responsive-dialog.tsx +17 -10
- package/src/solid/sheet.tsx +47 -79
- package/src/solid/spotlight.tsx +23 -11
- package/src/solid/stale-veil.tsx +20 -0
- package/src/solid/switch.tsx +8 -6
- package/src/solid/tabs.tsx +373 -53
- package/src/solid/toggle-group.tsx +305 -93
- package/src/solid/tooltip.tsx +285 -26
- package/src/styles/globals.css +6 -2
- package/src/styles/theme.css +10 -5
- package/dist/lib/when-animations-settle.d.ts +0 -4
- package/dist/solid/bottom-sheet/focus-trap.d.ts +0 -6
- package/dist/solid/bottom-sheet/scroll-lock.d.ts +0 -2
- package/dist/solid/bottom-sheet/sheet-motion.d.ts +0 -1
- package/src/lib/when-animations-settle.ts +0 -12
- package/src/solid/bottom-sheet/focus-trap.ts +0 -63
- package/src/solid/bottom-sheet/scroll-lock.ts +0 -66
- package/src/solid/bottom-sheet/sheet-motion.ts +0 -4
package/src/solid/sheet.tsx
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { Dialog as DialogPrimitive, useDialogContext } from "@kobalte/core/dialog";
|
|
2
1
|
import { usePortalMount } from "./portal-mount.js";
|
|
3
2
|
import type { VariantProps } from "cva";
|
|
4
3
|
import {
|
|
5
4
|
children,
|
|
6
5
|
type Component,
|
|
7
|
-
type ComponentProps,
|
|
8
6
|
type JSX,
|
|
9
7
|
type ParentComponent,
|
|
10
8
|
Show,
|
|
11
|
-
createSignal,
|
|
12
9
|
splitProps,
|
|
13
10
|
} from "solid-js";
|
|
11
|
+
import { ModalFrame, useDialogContext } from "../lib/behavior/modal-root.js";
|
|
14
12
|
import { buttonVariants } from "../lib/button-variants.js";
|
|
15
|
-
import { inShadowRoot, shadowLayer } from "../lib/shadow-layer.js";
|
|
16
13
|
import { Z_CLASS } from "../lib/layers.js";
|
|
17
14
|
import { SCRIM_MOTION } from "../lib/motion-classes.js";
|
|
18
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
OVERLAY_SURFACE,
|
|
17
|
+
SCRIM_CLASS,
|
|
18
|
+
SCRIM_CONTAIN,
|
|
19
|
+
SCROLL_CONTAIN,
|
|
20
|
+
} from "../lib/overlay-classes.js";
|
|
19
21
|
import { cn } from "../lib/utils.js";
|
|
20
22
|
import {
|
|
21
23
|
createModalDismiss,
|
|
22
24
|
createModalParts,
|
|
23
|
-
|
|
25
|
+
createModalRootSkin,
|
|
26
|
+
createModalTextParts,
|
|
24
27
|
MODAL_MAX_H,
|
|
25
|
-
|
|
28
|
+
type ModalContentProps,
|
|
26
29
|
type ModalDismissProps,
|
|
27
|
-
|
|
30
|
+
ModalCover,
|
|
28
31
|
} from "./dialog-parts.js";
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
* refcounted page lock every modal family shares. */
|
|
32
|
-
const Sheet: ParentComponent<ComponentProps<typeof DialogPrimitive>> = (props) => {
|
|
33
|
-
const mount = usePortalMount();
|
|
34
|
-
return <DialogPrimitive modal={!inShadowRoot(mount)} {...props} preventScroll={false} />;
|
|
35
|
-
};
|
|
33
|
+
const Sheet = createModalRootSkin("dialog");
|
|
36
34
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
const {
|
|
36
|
+
Trigger: SheetTrigger,
|
|
37
|
+
Title: SheetTitle,
|
|
38
|
+
Description: SheetDescription,
|
|
39
|
+
} = createModalTextParts("sheet");
|
|
40
40
|
|
|
41
41
|
type SheetCloseProps = ModalDismissProps &
|
|
42
42
|
Partial<Pick<VariantProps<typeof buttonVariants>, "variant" | "size">>;
|
|
43
43
|
|
|
44
|
-
const SheetDismiss = createModalDismiss("sheet-close");
|
|
44
|
+
const SheetDismiss = createModalDismiss("sheet-close", useDialogContext);
|
|
45
45
|
|
|
46
46
|
/** Already the outline button; see DialogClose on why `as={Button}` is wrong. */
|
|
47
47
|
const SheetClose: ParentComponent<SheetCloseProps> = (props) => {
|
|
@@ -59,25 +59,16 @@ const SheetClose: ParentComponent<SheetCloseProps> = (props) => {
|
|
|
59
59
|
);
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
const
|
|
63
|
-
const [local, rest] = splitProps(props, ["class"]);
|
|
64
|
-
return (
|
|
65
|
-
<DialogPrimitive.Overlay
|
|
66
|
-
data-slot="sheet-overlay"
|
|
67
|
-
class={cn(
|
|
68
|
-
`${SCRIM_MOTION} pointer-events-auto fixed inset-0 select-none ${Z_CLASS.overlay} ${SCRIM_CLASS}`,
|
|
69
|
-
local.class,
|
|
70
|
-
)}
|
|
71
|
-
{...rest}
|
|
72
|
-
/>
|
|
73
|
-
);
|
|
74
|
-
};
|
|
62
|
+
const SHEET_SCRIM = `${SCRIM_MOTION} pointer-events-auto fixed inset-0 select-none ${Z_CLASS.overlay} ${SCRIM_CLASS} ${SCRIM_CONTAIN}`;
|
|
75
63
|
|
|
76
64
|
/* A viewport-tall panel would stretch the percentage-sized sheen into a small
|
|
77
65
|
* blob over a flat field; pinned lengths match the ellipse a dialog gets. */
|
|
78
66
|
const SHEET_SURFACE = `${OVERLAY_SURFACE} [--glass-sheen:600px_300px]`;
|
|
79
67
|
|
|
80
|
-
const SHEET_PANEL = `fixed ${Z_CLASS.overlay} flex flex-col overflow-hidden rounded-lg ${SHEET_SURFACE} transition ease-in-out focus:outline-none focus-visible:outline-none data-[closed]:animate-out data-[expanded]:animate-in data-[closed]:duration-300 data-[expanded]:duration-500`;
|
|
68
|
+
const SHEET_PANEL = `fixed ${Z_CLASS.overlay} flex flex-col overflow-hidden ${SCROLL_CONTAIN} rounded-lg ${SHEET_SURFACE} transition ease-in-out focus:outline-none focus-visible:outline-none data-[closed]:animate-out data-[expanded]:animate-in data-[closed]:duration-300 data-[expanded]:duration-500`;
|
|
69
|
+
|
|
70
|
+
/* The data-[closed] duration in SHEET_PANEL. */
|
|
71
|
+
const SHEET_EXIT_MS = 300;
|
|
81
72
|
|
|
82
73
|
const SHEET_SIDE = {
|
|
83
74
|
right:
|
|
@@ -90,7 +81,7 @@ const SHEET_SIDE = {
|
|
|
90
81
|
|
|
91
82
|
type SheetSide = keyof typeof SHEET_SIDE;
|
|
92
83
|
|
|
93
|
-
type SheetContentProps =
|
|
84
|
+
type SheetContentProps = ModalContentProps & {
|
|
94
85
|
/** A modal belongs in `ResponsiveDialog`; this family slides from an edge. */
|
|
95
86
|
side?: SheetSide;
|
|
96
87
|
above?: JSX.Element;
|
|
@@ -116,66 +107,43 @@ const SheetContent: ParentComponent<SheetContentProps> = (props) => {
|
|
|
116
107
|
"side",
|
|
117
108
|
"above",
|
|
118
109
|
"ariaLabel",
|
|
110
|
+
"style",
|
|
119
111
|
"ref",
|
|
120
|
-
"
|
|
121
|
-
"
|
|
112
|
+
"onOpenAutoFocus",
|
|
113
|
+
"onFocusOutside",
|
|
114
|
+
"forceMount",
|
|
122
115
|
]);
|
|
123
|
-
const
|
|
124
|
-
const [panel, setPanel] = createSignal<HTMLElement>();
|
|
125
|
-
const layer = shadowLayer({
|
|
126
|
-
content: panel,
|
|
127
|
-
open: () => context.isOpen(),
|
|
128
|
-
dismiss: () => context.close(),
|
|
129
|
-
trapsFocus: true,
|
|
130
|
-
initialFocus: "container",
|
|
131
|
-
consumer: local,
|
|
132
|
-
});
|
|
133
|
-
|
|
116
|
+
const ctx = useDialogContext();
|
|
134
117
|
return (
|
|
135
|
-
|
|
136
|
-
<
|
|
137
|
-
<
|
|
138
|
-
|
|
118
|
+
<>
|
|
119
|
+
<ModalCover panel={ctx.panel} open={ctx.isOpen} dormant={ctx.dormant} />
|
|
120
|
+
<ModalFrame
|
|
121
|
+
slot="sheet"
|
|
122
|
+
mount={usePortalMount()}
|
|
123
|
+
exitMs={SHEET_EXIT_MS}
|
|
124
|
+
scrimClass={SHEET_SCRIM}
|
|
125
|
+
panelClass={cn(SHEET_PANEL, SHEET_SIDE[local.side ?? "right"], local.class)}
|
|
126
|
+
panelStyle={typeof local.style === "object" ? local.style : undefined}
|
|
127
|
+
ariaLabel={local.ariaLabel}
|
|
139
128
|
ref={(el: HTMLElement) => {
|
|
140
|
-
|
|
141
|
-
|
|
129
|
+
if (typeof local.ref === "function") local.ref(el as HTMLDivElement);
|
|
130
|
+
}}
|
|
131
|
+
onOpenAutoFocus={(event: Event) => {
|
|
132
|
+
// The panel takes focus itself, not its first control.
|
|
133
|
+
if (local.onOpenAutoFocus) local.onOpenAutoFocus(event);
|
|
134
|
+
else event.preventDefault();
|
|
142
135
|
}}
|
|
143
|
-
onInteractOutside={layer.onInteractOutside}
|
|
144
|
-
onCloseAutoFocus={layer.onCloseAutoFocus}
|
|
145
|
-
data-slot="sheet-content"
|
|
146
|
-
role="dialog"
|
|
147
|
-
aria-label={context.titleId() ? undefined : local.ariaLabel}
|
|
148
|
-
class={cn(SHEET_PANEL, SHEET_SIDE[local.side ?? "right"], local.class)}
|
|
149
|
-
onOpenAutoFocus={(e: Event) => e.preventDefault()}
|
|
150
136
|
{...rest}
|
|
151
137
|
>
|
|
152
138
|
<SheetAbove above={local.above} />
|
|
153
139
|
{local.children}
|
|
154
|
-
</
|
|
155
|
-
|
|
140
|
+
</ModalFrame>
|
|
141
|
+
</>
|
|
156
142
|
);
|
|
157
143
|
};
|
|
158
144
|
|
|
159
145
|
const { Header: SheetHeader, Body: SheetBody, Footer: SheetFooter } = createModalParts("sheet");
|
|
160
146
|
|
|
161
|
-
const SheetTitle: Component<ComponentProps<typeof DialogPrimitive.Title>> = (props) => {
|
|
162
|
-
const [local, rest] = splitProps(props, ["class"]);
|
|
163
|
-
return (
|
|
164
|
-
<DialogPrimitive.Title data-slot="sheet-title" class={cn(MODAL_TITLE, local.class)} {...rest} />
|
|
165
|
-
);
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
const SheetDescription: Component<ComponentProps<typeof DialogPrimitive.Description>> = (props) => {
|
|
169
|
-
const [local, rest] = splitProps(props, ["class"]);
|
|
170
|
-
return (
|
|
171
|
-
<DialogPrimitive.Description
|
|
172
|
-
data-slot="sheet-description"
|
|
173
|
-
class={cn(MODAL_DESCRIPTION, local.class)}
|
|
174
|
-
{...rest}
|
|
175
|
-
/>
|
|
176
|
-
);
|
|
177
|
-
};
|
|
178
|
-
|
|
179
147
|
export {
|
|
180
148
|
Sheet,
|
|
181
149
|
SheetBody,
|
package/src/solid/spotlight.tsx
CHANGED
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
} from "solid-js";
|
|
10
10
|
import { Portal } from "solid-js/web";
|
|
11
11
|
import { usePortalMount } from "./portal-mount.js";
|
|
12
|
+
import { createDismiss } from "../lib/behavior/dismiss.js";
|
|
13
|
+
import { registerLayer } from "../lib/behavior/layer-stack.js";
|
|
12
14
|
import { Z_CLASS } from "../lib/layers.js";
|
|
13
15
|
import { SCRIM_MOTION, TRAVEL_MOTION } from "../lib/motion-classes.js";
|
|
14
16
|
import { OVERLAY_SURFACE_OPAQUE, PANEL_TAIL, SCRIM_CLASS } from "../lib/overlay-classes.js";
|
|
@@ -54,7 +56,20 @@ const Spotlight: Component<SpotlightProps> = (props) => {
|
|
|
54
56
|
{ width: BUBBLE_DEFAULT_WIDTH, height: 96 },
|
|
55
57
|
{ equals: sameFields },
|
|
56
58
|
);
|
|
57
|
-
|
|
59
|
+
const [bubble, setBubble] = createSignal<HTMLDivElement>();
|
|
60
|
+
const handle = registerLayer({
|
|
61
|
+
element: bubble,
|
|
62
|
+
open: () => true,
|
|
63
|
+
kind: "tour",
|
|
64
|
+
escape: () => props.onSkip !== undefined,
|
|
65
|
+
dismiss: () => props.onSkip?.(),
|
|
66
|
+
});
|
|
67
|
+
createDismiss({
|
|
68
|
+
layer: handle,
|
|
69
|
+
outsidePress: () => false,
|
|
70
|
+
escapeFrom: "document",
|
|
71
|
+
onDismiss: () => props.onSkip?.(),
|
|
72
|
+
});
|
|
58
73
|
|
|
59
74
|
const anchorEl = () => props.anchor ?? props.target;
|
|
60
75
|
|
|
@@ -70,10 +85,11 @@ const Spotlight: Component<SpotlightProps> = (props) => {
|
|
|
70
85
|
const anchor = anchorEl();
|
|
71
86
|
/* Same element as target: reuse its box instead of measuring it twice a tick. */
|
|
72
87
|
setAnchorBox(anchor === props.target ? targetBox : rectToBox(anchor));
|
|
73
|
-
|
|
88
|
+
const node = bubble();
|
|
89
|
+
if (node)
|
|
74
90
|
setBubbleSize({
|
|
75
|
-
width:
|
|
76
|
-
height:
|
|
91
|
+
width: node.offsetWidth || BUBBLE_DEFAULT_WIDTH,
|
|
92
|
+
height: node.offsetHeight || 96,
|
|
77
93
|
});
|
|
78
94
|
};
|
|
79
95
|
|
|
@@ -97,7 +113,8 @@ const Spotlight: Component<SpotlightProps> = (props) => {
|
|
|
97
113
|
const observer = new ResizeObserver(measure);
|
|
98
114
|
if (target) observer.observe(target);
|
|
99
115
|
if (anchor && anchor !== target) observer.observe(anchor);
|
|
100
|
-
|
|
116
|
+
const node = bubble();
|
|
117
|
+
if (node) observer.observe(node);
|
|
101
118
|
onCleanup(() => {
|
|
102
119
|
cancelAnimationFrame(raf);
|
|
103
120
|
observer.disconnect();
|
|
@@ -105,16 +122,11 @@ const Spotlight: Component<SpotlightProps> = (props) => {
|
|
|
105
122
|
});
|
|
106
123
|
|
|
107
124
|
onMount(() => {
|
|
108
|
-
const onKey = (e: KeyboardEvent) => {
|
|
109
|
-
if (e.key === "Escape") props.onSkip?.();
|
|
110
|
-
};
|
|
111
125
|
window.addEventListener("resize", measure);
|
|
112
126
|
window.addEventListener("scroll", measure, { capture: true, passive: true });
|
|
113
|
-
document.addEventListener("keydown", onKey);
|
|
114
127
|
onCleanup(() => {
|
|
115
128
|
window.removeEventListener("resize", measure);
|
|
116
129
|
window.removeEventListener("scroll", measure, { capture: true });
|
|
117
|
-
document.removeEventListener("keydown", onKey);
|
|
118
130
|
});
|
|
119
131
|
});
|
|
120
132
|
|
|
@@ -142,7 +154,7 @@ const Spotlight: Component<SpotlightProps> = (props) => {
|
|
|
142
154
|
/>
|
|
143
155
|
</Show>
|
|
144
156
|
<div
|
|
145
|
-
ref={
|
|
157
|
+
ref={setBubble}
|
|
146
158
|
data-slot="spotlight-bubble"
|
|
147
159
|
data-side={place().side}
|
|
148
160
|
class={cn(TRAVEL_MOTION, Z_CLASS.overlay, "fixed top-0 left-0 w-96", props.class)}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Component, Show } from "solid-js";
|
|
2
|
+
import { VEIL_MOTION } from "../lib/motion-classes.js";
|
|
3
|
+
import { cn } from "../lib/utils.js";
|
|
4
|
+
|
|
5
|
+
/** Fills its positioned parent; no z-index, so it paints over earlier siblings: render it last. */
|
|
6
|
+
const StaleVeil: Component<{ shown: boolean; class?: string }> = (props) => (
|
|
7
|
+
<Show when={props.shown}>
|
|
8
|
+
<div
|
|
9
|
+
data-slot="stale-veil"
|
|
10
|
+
aria-hidden="true"
|
|
11
|
+
class={cn(
|
|
12
|
+
"bg-background/40 pointer-events-none absolute inset-0 rounded-[inherit]",
|
|
13
|
+
VEIL_MOTION,
|
|
14
|
+
props.class,
|
|
15
|
+
)}
|
|
16
|
+
/>
|
|
17
|
+
</Show>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export { StaleVeil };
|
package/src/solid/switch.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Component, type ComponentProps,
|
|
1
|
+
import { type Component, type ComponentProps, splitProps } from "solid-js";
|
|
2
|
+
import { createControllableSignal } from "../lib/behavior/controllable.js";
|
|
2
3
|
import { CONTROL_ON, FIELD_CHROME, FOCUS_RING } from "../lib/input-classes.js";
|
|
3
4
|
import { THUMB_CLASS } from "../lib/thumb-classes.js";
|
|
4
5
|
import { cn } from "../lib/utils.js";
|
|
@@ -20,8 +21,11 @@ const Switch: Component<SwitchProps> = (props) => {
|
|
|
20
21
|
"name",
|
|
21
22
|
"busy",
|
|
22
23
|
]);
|
|
23
|
-
const [
|
|
24
|
-
|
|
24
|
+
const [checked, setChecked] = createControllableSignal<boolean>({
|
|
25
|
+
value: () => local.checked,
|
|
26
|
+
defaultValue: () => props.defaultChecked ?? false,
|
|
27
|
+
onChange: (next) => local.onChange?.(next),
|
|
28
|
+
});
|
|
25
29
|
|
|
26
30
|
return (
|
|
27
31
|
<button
|
|
@@ -44,9 +48,7 @@ const Switch: Component<SwitchProps> = (props) => {
|
|
|
44
48
|
)}
|
|
45
49
|
onClick={() => {
|
|
46
50
|
if (local.busy) return;
|
|
47
|
-
|
|
48
|
-
setUncontrolled(next);
|
|
49
|
-
local.onChange?.(next);
|
|
51
|
+
setChecked(!checked());
|
|
50
52
|
}}
|
|
51
53
|
>
|
|
52
54
|
<span
|