@octanejs/radix 0.1.32 → 0.1.33
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/cjs/AccessibleIcon.cjs +56 -0
- package/dist/cjs/Accordion.cjs +272 -0
- package/dist/cjs/AlertDialog.cjs +144 -0
- package/dist/cjs/Arrow.cjs +43 -0
- package/dist/cjs/AspectRatio.cjs +56 -0
- package/dist/cjs/Avatar.cjs +150 -0
- package/dist/cjs/Checkbox.cjs +281 -0
- package/dist/cjs/Collapsible.cjs +176 -0
- package/dist/cjs/ContextMenu.cjs +315 -0
- package/dist/cjs/Dialog.cjs +291 -0
- package/dist/cjs/DismissableLayer.cjs +382 -0
- package/dist/cjs/DropdownMenu.cjs +296 -0
- package/dist/cjs/FocusScope.cjs +257 -0
- package/dist/cjs/Form.cjs +537 -0
- package/dist/cjs/HoverCard.cjs +309 -0
- package/dist/cjs/Label.cjs +42 -0
- package/dist/cjs/Menu.cjs +925 -0
- package/dist/cjs/Menubar.cjs +475 -0
- package/dist/cjs/NavigationMenu.cjs +942 -0
- package/dist/cjs/OneTimePasswordField.cjs +729 -0
- package/dist/cjs/PasswordToggleField.cjs +377 -0
- package/dist/cjs/Popover.cjs +340 -0
- package/dist/cjs/Popper.cjs +368 -0
- package/dist/cjs/Portal.cjs +40 -0
- package/dist/cjs/Presence.cjs +183 -0
- package/dist/cjs/Primitive.cjs +63 -0
- package/dist/cjs/Progress.cjs +111 -0
- package/dist/cjs/Radio.cjs +240 -0
- package/dist/cjs/RadioGroup.cjs +216 -0
- package/dist/cjs/RovingFocusGroup.cjs +253 -0
- package/dist/cjs/ScrollArea.cjs +828 -0
- package/dist/cjs/Select.cjs +1429 -0
- package/dist/cjs/Separator.cjs +51 -0
- package/dist/cjs/Slider.cjs +634 -0
- package/dist/cjs/Slot.cjs +97 -0
- package/dist/cjs/Switch.cjs +253 -0
- package/dist/cjs/Tabs.cjs +195 -0
- package/dist/cjs/Toast.cjs +733 -0
- package/dist/cjs/Toggle.cjs +54 -0
- package/dist/cjs/ToggleGroup.cjs +174 -0
- package/dist/cjs/Toolbar.cjs +165 -0
- package/dist/cjs/Tooltip.cjs +628 -0
- package/dist/cjs/VisuallyHidden.cjs +52 -0
- package/dist/cjs/collection.cjs +95 -0
- package/dist/cjs/compose-event-handlers.cjs +35 -0
- package/dist/cjs/compose-refs.cjs +68 -0
- package/dist/cjs/context.cjs +96 -0
- package/dist/cjs/direction.cjs +41 -0
- package/dist/cjs/focus-guards.cjs +76 -0
- package/dist/cjs/index.cjs +174 -0
- package/dist/cjs/internal.cjs +51 -0
- package/dist/cjs/scroll-lock.cjs +67 -0
- package/dist/cjs/use-callback-ref.cjs +47 -0
- package/dist/cjs/use-effect-event.cjs +52 -0
- package/dist/cjs/use-is-hydrated.cjs +43 -0
- package/dist/cjs/use-previous.cjs +47 -0
- package/dist/cjs/use-size.cjs +69 -0
- package/dist/cjs/useControllableState.cjs +80 -0
- package/dist/cjs/useId.cjs +36 -0
- package/package.json +14 -7
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var HoverCard_exports = {};
|
|
30
|
+
__export(HoverCard_exports, {
|
|
31
|
+
Arrow: () => Arrow,
|
|
32
|
+
Content: () => Content,
|
|
33
|
+
HoverCard: () => Root,
|
|
34
|
+
HoverCardContent: () => Content,
|
|
35
|
+
HoverCardTrigger: () => Trigger,
|
|
36
|
+
Portal: () => Portal,
|
|
37
|
+
Root: () => Root,
|
|
38
|
+
Trigger: () => Trigger,
|
|
39
|
+
createHoverCardScope: () => createHoverCardScope
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(HoverCard_exports);
|
|
42
|
+
var import_octane = require("octane");
|
|
43
|
+
var import_compose_event_handlers = require("./compose-event-handlers.cjs");
|
|
44
|
+
var import_compose_refs = require("./compose-refs.cjs");
|
|
45
|
+
var import_context = require("./context.cjs");
|
|
46
|
+
var import_DismissableLayer = require("./DismissableLayer.cjs");
|
|
47
|
+
var import_internal = require("./internal.cjs");
|
|
48
|
+
var PopperPrimitive = __toESM(require("./Popper.cjs"), 1);
|
|
49
|
+
var import_Popper = require("./Popper.cjs");
|
|
50
|
+
var import_Portal = require("./Portal.cjs");
|
|
51
|
+
var import_Presence = require("./Presence.cjs");
|
|
52
|
+
var import_Primitive = require("./Primitive.cjs");
|
|
53
|
+
var import_useControllableState = require("./useControllableState.cjs");
|
|
54
|
+
let originalBodyUserSelect;
|
|
55
|
+
const HOVERCARD_NAME = "HoverCard";
|
|
56
|
+
const [createHoverCardContext, createHoverCardScope] = (0, import_context.createContextScope)(HOVERCARD_NAME, [
|
|
57
|
+
import_Popper.createPopperScope
|
|
58
|
+
]);
|
|
59
|
+
const usePopperScope = (0, import_Popper.createPopperScope)();
|
|
60
|
+
const [HoverCardProvider, useHoverCardContext] = createHoverCardContext(HOVERCARD_NAME);
|
|
61
|
+
function Root(props) {
|
|
62
|
+
const slot = (0, import_internal.S)("HoverCard.Root");
|
|
63
|
+
const {
|
|
64
|
+
__scopeHoverCard,
|
|
65
|
+
children,
|
|
66
|
+
open: openProp,
|
|
67
|
+
defaultOpen,
|
|
68
|
+
onOpenChange,
|
|
69
|
+
openDelay = 700,
|
|
70
|
+
closeDelay = 300
|
|
71
|
+
} = props ?? {};
|
|
72
|
+
const popperScope = usePopperScope(__scopeHoverCard, (0, import_internal.subSlot)(slot, "popper"));
|
|
73
|
+
const openTimerRef = (0, import_octane.useRef)(0, (0, import_internal.subSlot)(slot, "openTimer"));
|
|
74
|
+
const closeTimerRef = (0, import_octane.useRef)(0, (0, import_internal.subSlot)(slot, "closeTimer"));
|
|
75
|
+
const hasSelectionRef = (0, import_octane.useRef)(false, (0, import_internal.subSlot)(slot, "selection"));
|
|
76
|
+
const isPointerDownOnContentRef = (0, import_octane.useRef)(false, (0, import_internal.subSlot)(slot, "pointerDown"));
|
|
77
|
+
const [open, setOpen] = (0, import_useControllableState.useControllableState)(
|
|
78
|
+
{ prop: openProp, defaultProp: defaultOpen ?? false, onChange: onOpenChange },
|
|
79
|
+
(0, import_internal.subSlot)(slot, "open")
|
|
80
|
+
);
|
|
81
|
+
const handleOpen = (0, import_octane.useCallback)(
|
|
82
|
+
() => {
|
|
83
|
+
clearTimeout(closeTimerRef.current);
|
|
84
|
+
openTimerRef.current = window.setTimeout(() => setOpen(true), openDelay);
|
|
85
|
+
},
|
|
86
|
+
[openDelay, setOpen],
|
|
87
|
+
(0, import_internal.subSlot)(slot, "handleOpen")
|
|
88
|
+
);
|
|
89
|
+
const handleClose = (0, import_octane.useCallback)(
|
|
90
|
+
() => {
|
|
91
|
+
clearTimeout(openTimerRef.current);
|
|
92
|
+
if (!hasSelectionRef.current && !isPointerDownOnContentRef.current) {
|
|
93
|
+
closeTimerRef.current = window.setTimeout(() => setOpen(false), closeDelay);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
[closeDelay, setOpen],
|
|
97
|
+
(0, import_internal.subSlot)(slot, "handleClose")
|
|
98
|
+
);
|
|
99
|
+
const handleDismiss = (0, import_octane.useCallback)(() => setOpen(false), [setOpen], (0, import_internal.subSlot)(slot, "dismiss"));
|
|
100
|
+
(0, import_octane.useEffect)(
|
|
101
|
+
() => {
|
|
102
|
+
return () => {
|
|
103
|
+
clearTimeout(openTimerRef.current);
|
|
104
|
+
clearTimeout(closeTimerRef.current);
|
|
105
|
+
};
|
|
106
|
+
},
|
|
107
|
+
[],
|
|
108
|
+
(0, import_internal.subSlot)(slot, "e:cleanup")
|
|
109
|
+
);
|
|
110
|
+
return (0, import_octane.createElement)(HoverCardProvider, {
|
|
111
|
+
scope: __scopeHoverCard,
|
|
112
|
+
open,
|
|
113
|
+
onOpenChange: setOpen,
|
|
114
|
+
onOpen: handleOpen,
|
|
115
|
+
onClose: handleClose,
|
|
116
|
+
onDismiss: handleDismiss,
|
|
117
|
+
hasSelectionRef,
|
|
118
|
+
isPointerDownOnContentRef,
|
|
119
|
+
children: (0, import_octane.createElement)(PopperPrimitive.Root, { ...popperScope, children })
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function Trigger(props) {
|
|
123
|
+
const slot = (0, import_internal.S)("HoverCard.Trigger");
|
|
124
|
+
const { __scopeHoverCard, ...triggerProps } = props ?? {};
|
|
125
|
+
const context = useHoverCardContext("HoverCardTrigger", __scopeHoverCard);
|
|
126
|
+
const popperScope = usePopperScope(__scopeHoverCard, (0, import_internal.subSlot)(slot, "popper"));
|
|
127
|
+
return (0, import_octane.createElement)(PopperPrimitive.Anchor, {
|
|
128
|
+
asChild: true,
|
|
129
|
+
...popperScope,
|
|
130
|
+
children: (0, import_octane.createElement)(import_Primitive.Primitive.a, {
|
|
131
|
+
"data-state": context.open ? "open" : "closed",
|
|
132
|
+
...triggerProps,
|
|
133
|
+
onPointerEnter: (0, import_compose_event_handlers.composeEventHandlers)(props?.onPointerEnter, excludeTouch(context.onOpen)),
|
|
134
|
+
onPointerLeave: (0, import_compose_event_handlers.composeEventHandlers)(props?.onPointerLeave, excludeTouch(context.onClose)),
|
|
135
|
+
onFocus: (0, import_compose_event_handlers.composeEventHandlers)(props?.onFocus, context.onOpen),
|
|
136
|
+
onBlur: (0, import_compose_event_handlers.composeEventHandlers)(props?.onBlur, context.onClose),
|
|
137
|
+
// prevent focus event on touch devices
|
|
138
|
+
onTouchStart: (0, import_compose_event_handlers.composeEventHandlers)(
|
|
139
|
+
props?.onTouchStart,
|
|
140
|
+
(event) => event.preventDefault()
|
|
141
|
+
)
|
|
142
|
+
})
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
const [PortalProvider, usePortalContext] = createHoverCardContext(
|
|
146
|
+
"HoverCardPortal",
|
|
147
|
+
{ forceMount: void 0 }
|
|
148
|
+
);
|
|
149
|
+
function Portal(props) {
|
|
150
|
+
const { __scopeHoverCard, forceMount, children, container } = props ?? {};
|
|
151
|
+
const context = useHoverCardContext("HoverCardPortal", __scopeHoverCard);
|
|
152
|
+
return (0, import_octane.createElement)(PortalProvider, {
|
|
153
|
+
scope: __scopeHoverCard,
|
|
154
|
+
forceMount,
|
|
155
|
+
children: (0, import_octane.createElement)(import_Presence.Presence, {
|
|
156
|
+
present: forceMount || context.open,
|
|
157
|
+
children: (0, import_octane.createElement)(import_Portal.Portal, {
|
|
158
|
+
asChild: typeof children !== "function",
|
|
159
|
+
container,
|
|
160
|
+
children
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function Content(props) {
|
|
166
|
+
const portalContext = usePortalContext("HoverCardContent", props?.__scopeHoverCard);
|
|
167
|
+
const { forceMount = portalContext.forceMount, ...contentProps } = props ?? {};
|
|
168
|
+
const context = useHoverCardContext("HoverCardContent", props?.__scopeHoverCard);
|
|
169
|
+
return (0, import_octane.createElement)(import_Presence.Presence, {
|
|
170
|
+
present: forceMount || context.open,
|
|
171
|
+
children: (0, import_octane.createElement)(ContentImpl, {
|
|
172
|
+
"data-state": context.open ? "open" : "closed",
|
|
173
|
+
...contentProps,
|
|
174
|
+
onPointerEnter: (0, import_compose_event_handlers.composeEventHandlers)(props?.onPointerEnter, excludeTouch(context.onOpen)),
|
|
175
|
+
onPointerLeave: (0, import_compose_event_handlers.composeEventHandlers)(props?.onPointerLeave, excludeTouch(context.onClose))
|
|
176
|
+
})
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
function ContentImpl(props) {
|
|
180
|
+
const slot = (0, import_internal.S)("HoverCard.ContentImpl");
|
|
181
|
+
const {
|
|
182
|
+
__scopeHoverCard,
|
|
183
|
+
ref: forwardedRef,
|
|
184
|
+
onEscapeKeyDown,
|
|
185
|
+
onPointerDownOutside,
|
|
186
|
+
onFocusOutside,
|
|
187
|
+
onInteractOutside,
|
|
188
|
+
...contentProps
|
|
189
|
+
} = props;
|
|
190
|
+
const context = useHoverCardContext("HoverCardContent", __scopeHoverCard);
|
|
191
|
+
const popperScope = usePopperScope(__scopeHoverCard, (0, import_internal.subSlot)(slot, "popper"));
|
|
192
|
+
const ref = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "ref"));
|
|
193
|
+
const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref, (0, import_internal.subSlot)(slot, "refs"));
|
|
194
|
+
const [containSelection, setContainSelection] = (0, import_octane.useState)(false, (0, import_internal.subSlot)(slot, "contain"));
|
|
195
|
+
(0, import_octane.useEffect)(
|
|
196
|
+
() => {
|
|
197
|
+
if (containSelection) {
|
|
198
|
+
const body = document.body;
|
|
199
|
+
originalBodyUserSelect = body.style.userSelect || body.style.webkitUserSelect;
|
|
200
|
+
body.style.userSelect = "none";
|
|
201
|
+
body.style.webkitUserSelect = "none";
|
|
202
|
+
return () => {
|
|
203
|
+
body.style.userSelect = originalBodyUserSelect;
|
|
204
|
+
body.style.webkitUserSelect = originalBodyUserSelect;
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
[containSelection],
|
|
209
|
+
(0, import_internal.subSlot)(slot, "e:selection")
|
|
210
|
+
);
|
|
211
|
+
(0, import_octane.useEffect)(
|
|
212
|
+
() => {
|
|
213
|
+
if (ref.current) {
|
|
214
|
+
const handlePointerUp = () => {
|
|
215
|
+
setContainSelection(false);
|
|
216
|
+
context.isPointerDownOnContentRef.current = false;
|
|
217
|
+
setTimeout(() => {
|
|
218
|
+
const hasSelection = document.getSelection()?.toString() !== "";
|
|
219
|
+
if (hasSelection) context.hasSelectionRef.current = true;
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
document.addEventListener("pointerup", handlePointerUp);
|
|
223
|
+
return () => {
|
|
224
|
+
document.removeEventListener("pointerup", handlePointerUp);
|
|
225
|
+
context.hasSelectionRef.current = false;
|
|
226
|
+
context.isPointerDownOnContentRef.current = false;
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
[context.isPointerDownOnContentRef, context.hasSelectionRef],
|
|
231
|
+
(0, import_internal.subSlot)(slot, "e:pointerup")
|
|
232
|
+
);
|
|
233
|
+
(0, import_octane.useEffect)(
|
|
234
|
+
() => {
|
|
235
|
+
if (ref.current) {
|
|
236
|
+
const tabbables = getTabbableNodes(ref.current);
|
|
237
|
+
tabbables.forEach((tabbable) => tabbable.setAttribute("tabindex", "-1"));
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
void 0,
|
|
241
|
+
(0, import_internal.subSlot)(slot, "e:tabbables")
|
|
242
|
+
);
|
|
243
|
+
return (0, import_octane.createElement)(import_DismissableLayer.DismissableLayer, {
|
|
244
|
+
asChild: true,
|
|
245
|
+
disableOutsidePointerEvents: false,
|
|
246
|
+
onInteractOutside,
|
|
247
|
+
onEscapeKeyDown,
|
|
248
|
+
onPointerDownOutside,
|
|
249
|
+
onFocusOutside: (0, import_compose_event_handlers.composeEventHandlers)(onFocusOutside, (event) => {
|
|
250
|
+
event.preventDefault();
|
|
251
|
+
}),
|
|
252
|
+
onDismiss: context.onDismiss,
|
|
253
|
+
children: (0, import_octane.createElement)(PopperPrimitive.Content, {
|
|
254
|
+
...popperScope,
|
|
255
|
+
...contentProps,
|
|
256
|
+
onPointerDown: (0, import_compose_event_handlers.composeEventHandlers)(contentProps.onPointerDown, (event) => {
|
|
257
|
+
if (event.currentTarget.contains(event.target)) {
|
|
258
|
+
setContainSelection(true);
|
|
259
|
+
}
|
|
260
|
+
context.hasSelectionRef.current = false;
|
|
261
|
+
context.isPointerDownOnContentRef.current = true;
|
|
262
|
+
}),
|
|
263
|
+
ref: composedRefs,
|
|
264
|
+
style: {
|
|
265
|
+
...contentProps.style,
|
|
266
|
+
userSelect: containSelection ? "text" : void 0,
|
|
267
|
+
// Safari requires prefix
|
|
268
|
+
WebkitUserSelect: containSelection ? "text" : void 0,
|
|
269
|
+
// re-namespace exposed content custom properties
|
|
270
|
+
"--radix-hover-card-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
271
|
+
"--radix-hover-card-content-available-width": "var(--radix-popper-available-width)",
|
|
272
|
+
"--radix-hover-card-content-available-height": "var(--radix-popper-available-height)",
|
|
273
|
+
"--radix-hover-card-trigger-width": "var(--radix-popper-anchor-width)",
|
|
274
|
+
"--radix-hover-card-trigger-height": "var(--radix-popper-anchor-height)"
|
|
275
|
+
}
|
|
276
|
+
})
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
function Arrow(props) {
|
|
280
|
+
const slot = (0, import_internal.S)("HoverCard.Arrow");
|
|
281
|
+
const { __scopeHoverCard, ...arrowProps } = props ?? {};
|
|
282
|
+
const popperScope = usePopperScope(__scopeHoverCard, (0, import_internal.subSlot)(slot, "popper"));
|
|
283
|
+
return (0, import_octane.createElement)(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps });
|
|
284
|
+
}
|
|
285
|
+
function excludeTouch(eventHandler) {
|
|
286
|
+
return (event) => event.pointerType === "touch" ? void 0 : eventHandler();
|
|
287
|
+
}
|
|
288
|
+
function getTabbableNodes(container) {
|
|
289
|
+
const nodes = [];
|
|
290
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
291
|
+
acceptNode: (node) => {
|
|
292
|
+
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
296
|
+
return nodes;
|
|
297
|
+
}
|
|
298
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
299
|
+
0 && (module.exports = {
|
|
300
|
+
Arrow,
|
|
301
|
+
Content,
|
|
302
|
+
HoverCard,
|
|
303
|
+
HoverCardContent,
|
|
304
|
+
HoverCardTrigger,
|
|
305
|
+
Portal,
|
|
306
|
+
Root,
|
|
307
|
+
Trigger,
|
|
308
|
+
createHoverCardScope
|
|
309
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Label_exports = {};
|
|
20
|
+
__export(Label_exports, {
|
|
21
|
+
Label: () => Label,
|
|
22
|
+
Root: () => Label
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(Label_exports);
|
|
25
|
+
var import_octane = require("octane");
|
|
26
|
+
var import_Primitive = require("./Primitive.cjs");
|
|
27
|
+
function Label(props) {
|
|
28
|
+
return (0, import_octane.createElement)(import_Primitive.Primitive.label, {
|
|
29
|
+
...props,
|
|
30
|
+
onMouseDown: (event) => {
|
|
31
|
+
const target = event.target;
|
|
32
|
+
if (target.closest("button, input, select, textarea")) return;
|
|
33
|
+
props?.onMouseDown?.(event);
|
|
34
|
+
if (!event.defaultPrevented && event.detail > 1) event.preventDefault();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
Label,
|
|
41
|
+
Root
|
|
42
|
+
});
|