@octanejs/radix 0.1.32 → 0.1.34
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,95 @@
|
|
|
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 collection_exports = {};
|
|
20
|
+
__export(collection_exports, {
|
|
21
|
+
createCollection: () => createCollection
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(collection_exports);
|
|
24
|
+
var import_octane = require("octane");
|
|
25
|
+
var import_compose_refs = require("./compose-refs.cjs");
|
|
26
|
+
var import_context = require("./context.cjs");
|
|
27
|
+
var import_internal = require("./internal.cjs");
|
|
28
|
+
var import_Slot = require("./Slot.cjs");
|
|
29
|
+
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
30
|
+
function createCollection(name) {
|
|
31
|
+
const PROVIDER_NAME = name + "CollectionProvider";
|
|
32
|
+
const [createCollectionContext, createCollectionScope] = (0, import_context.createContextScope)(PROVIDER_NAME);
|
|
33
|
+
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
|
|
34
|
+
collectionRef: { current: null },
|
|
35
|
+
itemMap: /* @__PURE__ */ new Map()
|
|
36
|
+
});
|
|
37
|
+
function CollectionProvider(props) {
|
|
38
|
+
const slot = (0, import_internal.S)(PROVIDER_NAME);
|
|
39
|
+
const { scope, children } = props;
|
|
40
|
+
const ref = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "ref"));
|
|
41
|
+
const itemMap = (0, import_octane.useRef)(/* @__PURE__ */ new Map(), (0, import_internal.subSlot)(slot, "map")).current;
|
|
42
|
+
return (0, import_octane.createElement)(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
43
|
+
}
|
|
44
|
+
function CollectionSlot(props) {
|
|
45
|
+
const slot = (0, import_internal.S)(name + "CollectionSlot");
|
|
46
|
+
const { scope, children, ref: forwardedRef } = props;
|
|
47
|
+
const context = useCollectionContext(name + "CollectionSlot", scope);
|
|
48
|
+
const composedRefs = (0, import_compose_refs.useComposedRefs)(
|
|
49
|
+
forwardedRef,
|
|
50
|
+
context.collectionRef,
|
|
51
|
+
(0, import_internal.subSlot)(slot, "refs")
|
|
52
|
+
);
|
|
53
|
+
return (0, import_octane.createElement)(import_Slot.Slot, { ref: composedRefs, children });
|
|
54
|
+
}
|
|
55
|
+
function CollectionItemSlot(props) {
|
|
56
|
+
const slot = (0, import_internal.S)(name + "CollectionItemSlot");
|
|
57
|
+
const { scope, children, ref: forwardedRef, ...itemData } = props;
|
|
58
|
+
const ref = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "ref"));
|
|
59
|
+
const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref, (0, import_internal.subSlot)(slot, "refs"));
|
|
60
|
+
const context = useCollectionContext(name + "CollectionItemSlot", scope);
|
|
61
|
+
(0, import_octane.useEffect)(
|
|
62
|
+
() => {
|
|
63
|
+
context.itemMap.set(ref, { ref, ...itemData });
|
|
64
|
+
return () => void context.itemMap.delete(ref);
|
|
65
|
+
},
|
|
66
|
+
void 0,
|
|
67
|
+
(0, import_internal.subSlot)(slot, "e:reg")
|
|
68
|
+
);
|
|
69
|
+
return (0, import_octane.createElement)(import_Slot.Slot, { [ITEM_DATA_ATTR]: "", ref: composedRefs, children });
|
|
70
|
+
}
|
|
71
|
+
function useCollection(...args) {
|
|
72
|
+
const [user, slotArg] = (0, import_internal.splitSlot)(args);
|
|
73
|
+
const scope = user[0];
|
|
74
|
+
void slotArg;
|
|
75
|
+
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
76
|
+
return () => {
|
|
77
|
+
const collectionNode = context.collectionRef.current;
|
|
78
|
+
if (!collectionNode) return [];
|
|
79
|
+
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
80
|
+
const items = Array.from(context.itemMap.values());
|
|
81
|
+
return items.sort(
|
|
82
|
+
(a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return [
|
|
87
|
+
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
|
88
|
+
useCollection,
|
|
89
|
+
createCollectionScope
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
93
|
+
0 && (module.exports = {
|
|
94
|
+
createCollection
|
|
95
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
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 compose_event_handlers_exports = {};
|
|
20
|
+
__export(compose_event_handlers_exports, {
|
|
21
|
+
composeEventHandlers: () => composeEventHandlers
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(compose_event_handlers_exports);
|
|
24
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
25
|
+
return function handleEvent(event) {
|
|
26
|
+
originalEventHandler?.(event);
|
|
27
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
28
|
+
return ourEventHandler?.(event);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
composeEventHandlers
|
|
35
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
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 compose_refs_exports = {};
|
|
20
|
+
__export(compose_refs_exports, {
|
|
21
|
+
composeRefs: () => composeRefs,
|
|
22
|
+
useComposedRefs: () => useComposedRefs
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(compose_refs_exports);
|
|
25
|
+
var import_octane = require("octane");
|
|
26
|
+
var import_internal = require("./internal.cjs");
|
|
27
|
+
function setRef(ref, value) {
|
|
28
|
+
if (typeof ref === "function") {
|
|
29
|
+
return ref(value);
|
|
30
|
+
} else if (ref !== null && ref !== void 0) {
|
|
31
|
+
ref.current = value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function composeRefs(...refs) {
|
|
35
|
+
return (node) => {
|
|
36
|
+
let hasCleanup = false;
|
|
37
|
+
const cleanups = refs.map((ref) => {
|
|
38
|
+
const cleanup = setRef(ref, node);
|
|
39
|
+
if (!hasCleanup && typeof cleanup === "function") {
|
|
40
|
+
hasCleanup = true;
|
|
41
|
+
}
|
|
42
|
+
return cleanup;
|
|
43
|
+
});
|
|
44
|
+
if (hasCleanup) {
|
|
45
|
+
return () => {
|
|
46
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
47
|
+
const cleanup = cleanups[i];
|
|
48
|
+
if (typeof cleanup === "function") {
|
|
49
|
+
cleanup();
|
|
50
|
+
} else {
|
|
51
|
+
setRef(refs[i], null);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function useComposedRefs(...args) {
|
|
59
|
+
const [user, slotArg] = (0, import_internal.splitSlot)(args);
|
|
60
|
+
const slot = slotArg ?? (0, import_internal.S)("useComposedRefs");
|
|
61
|
+
const refs = user;
|
|
62
|
+
return (0, import_octane.useCallback)(composeRefs(...refs), refs, (0, import_internal.subSlot)(slot, "cb"));
|
|
63
|
+
}
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
composeRefs,
|
|
67
|
+
useComposedRefs
|
|
68
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
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 context_exports = {};
|
|
20
|
+
__export(context_exports, {
|
|
21
|
+
createContextScope: () => createContextScope
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(context_exports);
|
|
24
|
+
var import_octane = require("octane");
|
|
25
|
+
var import_internal = require("./internal.cjs");
|
|
26
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
27
|
+
let defaultContexts = [];
|
|
28
|
+
function createContext(rootComponentName, defaultContext) {
|
|
29
|
+
const BaseContext = (0, import_octane.createContext)(defaultContext);
|
|
30
|
+
const index = defaultContexts.length;
|
|
31
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
32
|
+
function Provider(props) {
|
|
33
|
+
const { scope, children, ...context } = props;
|
|
34
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
35
|
+
const value = (0, import_octane.useMemo)(() => context, Object.values(context), (0, import_internal.S)(scopeName + ":P" + index));
|
|
36
|
+
return (0, import_octane.createElement)(Context.Provider, { value, children });
|
|
37
|
+
}
|
|
38
|
+
function useContext(consumerName, scope) {
|
|
39
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
40
|
+
const context = (0, import_octane.useContext)(Context);
|
|
41
|
+
if (context) return context;
|
|
42
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
43
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
44
|
+
}
|
|
45
|
+
return [Provider, useContext];
|
|
46
|
+
}
|
|
47
|
+
const createScope = (() => {
|
|
48
|
+
const scopeContexts = defaultContexts.map(
|
|
49
|
+
(defaultContext) => (0, import_octane.createContext)(defaultContext)
|
|
50
|
+
);
|
|
51
|
+
return function useScope(...args) {
|
|
52
|
+
const [user, slotArg] = (0, import_internal.splitSlot)(args);
|
|
53
|
+
const slot = slotArg ?? (0, import_internal.S)(scopeName + ":useScope");
|
|
54
|
+
const scope = user[0];
|
|
55
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
56
|
+
return (0, import_octane.useMemo)(
|
|
57
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
58
|
+
[scope, contexts],
|
|
59
|
+
(0, import_internal.subSlot)(slot, "m")
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
createScope.scopeName = scopeName;
|
|
64
|
+
return [createContext, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
65
|
+
}
|
|
66
|
+
function composeContextScopes(...scopes) {
|
|
67
|
+
const baseScope = scopes[0];
|
|
68
|
+
if (scopes.length === 1) return baseScope;
|
|
69
|
+
const createScope = (() => {
|
|
70
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
71
|
+
useScope: createScope2(),
|
|
72
|
+
scopeName: createScope2.scopeName
|
|
73
|
+
}));
|
|
74
|
+
return function useComposedScopes(...args) {
|
|
75
|
+
const [user, slotArg] = (0, import_internal.splitSlot)(args);
|
|
76
|
+
const slot = slotArg ?? (0, import_internal.S)("composed:" + baseScope.scopeName);
|
|
77
|
+
const overrideScopes = user[0];
|
|
78
|
+
const nextScopes = scopeHooks.reduce((acc, { useScope, scopeName }, i) => {
|
|
79
|
+
const scopeProps = useScope(overrideScopes, (0, import_internal.subSlot)(slot, "s" + i));
|
|
80
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
81
|
+
return { ...acc, ...currentScope };
|
|
82
|
+
}, {});
|
|
83
|
+
return (0, import_octane.useMemo)(
|
|
84
|
+
() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }),
|
|
85
|
+
[nextScopes],
|
|
86
|
+
(0, import_internal.subSlot)(slot, "m")
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
createScope.scopeName = baseScope.scopeName;
|
|
91
|
+
return createScope;
|
|
92
|
+
}
|
|
93
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
94
|
+
0 && (module.exports = {
|
|
95
|
+
createContextScope
|
|
96
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
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 direction_exports = {};
|
|
20
|
+
__export(direction_exports, {
|
|
21
|
+
DirectionProvider: () => DirectionProvider,
|
|
22
|
+
Provider: () => DirectionProvider,
|
|
23
|
+
useDirection: () => useDirection
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(direction_exports);
|
|
26
|
+
var import_octane = require("octane");
|
|
27
|
+
const DirectionContext = (0, import_octane.createContext)(void 0);
|
|
28
|
+
function DirectionProvider(props) {
|
|
29
|
+
const { dir, children } = props;
|
|
30
|
+
return (0, import_octane.createElement)(DirectionContext.Provider, { value: dir, children });
|
|
31
|
+
}
|
|
32
|
+
function useDirection(localDir) {
|
|
33
|
+
const globalDir = (0, import_octane.useContext)(DirectionContext);
|
|
34
|
+
return localDir || globalDir || "ltr";
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
DirectionProvider,
|
|
39
|
+
Provider,
|
|
40
|
+
useDirection
|
|
41
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
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 focus_guards_exports = {};
|
|
20
|
+
__export(focus_guards_exports, {
|
|
21
|
+
FocusGuards: () => FocusGuards,
|
|
22
|
+
useFocusGuards: () => useFocusGuards
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(focus_guards_exports);
|
|
25
|
+
var import_octane = require("octane");
|
|
26
|
+
var import_internal = require("./internal.cjs");
|
|
27
|
+
let count = 0;
|
|
28
|
+
let guards = null;
|
|
29
|
+
function useFocusGuards(...args) {
|
|
30
|
+
const [, slotArg] = (0, import_internal.splitSlot)(args);
|
|
31
|
+
const slot = slotArg ?? (0, import_internal.S)("useFocusGuards");
|
|
32
|
+
(0, import_octane.useEffect)(
|
|
33
|
+
() => {
|
|
34
|
+
if (!guards) {
|
|
35
|
+
guards = { start: createFocusGuard(), end: createFocusGuard() };
|
|
36
|
+
}
|
|
37
|
+
const { start, end } = guards;
|
|
38
|
+
if (document.body.firstElementChild !== start) {
|
|
39
|
+
document.body.insertAdjacentElement("afterbegin", start);
|
|
40
|
+
}
|
|
41
|
+
if (document.body.lastElementChild !== end) {
|
|
42
|
+
document.body.insertAdjacentElement("beforeend", end);
|
|
43
|
+
}
|
|
44
|
+
count++;
|
|
45
|
+
return () => {
|
|
46
|
+
if (count === 1) {
|
|
47
|
+
guards?.start.remove();
|
|
48
|
+
guards?.end.remove();
|
|
49
|
+
guards = null;
|
|
50
|
+
}
|
|
51
|
+
count = Math.max(0, count - 1);
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
[],
|
|
55
|
+
(0, import_internal.subSlot)(slot, "e")
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function FocusGuards(props) {
|
|
59
|
+
useFocusGuards((0, import_internal.S)("FocusGuards"));
|
|
60
|
+
return props.children;
|
|
61
|
+
}
|
|
62
|
+
function createFocusGuard() {
|
|
63
|
+
const element = document.createElement("span");
|
|
64
|
+
element.setAttribute("data-radix-focus-guard", "");
|
|
65
|
+
element.tabIndex = 0;
|
|
66
|
+
element.style.outline = "none";
|
|
67
|
+
element.style.opacity = "0";
|
|
68
|
+
element.style.position = "fixed";
|
|
69
|
+
element.style.pointerEvents = "none";
|
|
70
|
+
return element;
|
|
71
|
+
}
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
74
|
+
FocusGuards,
|
|
75
|
+
useFocusGuards
|
|
76
|
+
});
|
|
@@ -0,0 +1,174 @@
|
|
|
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 index_exports = {};
|
|
30
|
+
__export(index_exports, {
|
|
31
|
+
AccessibleIcon: () => AccessibleIcon,
|
|
32
|
+
Accordion: () => Accordion,
|
|
33
|
+
AlertDialog: () => AlertDialog,
|
|
34
|
+
Arrow: () => Arrow,
|
|
35
|
+
AspectRatio: () => AspectRatio,
|
|
36
|
+
Avatar: () => Avatar,
|
|
37
|
+
Checkbox: () => Checkbox,
|
|
38
|
+
Collapsible: () => Collapsible,
|
|
39
|
+
ContextMenu: () => ContextMenu,
|
|
40
|
+
Dialog: () => Dialog,
|
|
41
|
+
Direction: () => Direction,
|
|
42
|
+
DropdownMenu: () => DropdownMenu,
|
|
43
|
+
Form: () => Form,
|
|
44
|
+
HoverCard: () => HoverCard,
|
|
45
|
+
Label: () => Label,
|
|
46
|
+
Menu: () => Menu,
|
|
47
|
+
Menubar: () => Menubar,
|
|
48
|
+
NavigationMenu: () => NavigationMenu,
|
|
49
|
+
OneTimePasswordField: () => OneTimePasswordField,
|
|
50
|
+
PasswordToggleField: () => PasswordToggleField,
|
|
51
|
+
Popover: () => Popover,
|
|
52
|
+
Popper: () => Popper,
|
|
53
|
+
Portal: () => Portal,
|
|
54
|
+
Presence: () => import_Presence.Presence,
|
|
55
|
+
Primitive: () => import_Primitive.Primitive,
|
|
56
|
+
Progress: () => Progress,
|
|
57
|
+
RadioGroup: () => RadioGroup,
|
|
58
|
+
RovingFocus: () => RovingFocus,
|
|
59
|
+
ScrollArea: () => ScrollArea,
|
|
60
|
+
Select: () => Select,
|
|
61
|
+
Separator: () => Separator,
|
|
62
|
+
Slider: () => Slider,
|
|
63
|
+
Slot: () => import_Slot.Slot,
|
|
64
|
+
Slottable: () => import_Slot.Slottable,
|
|
65
|
+
Switch: () => Switch,
|
|
66
|
+
Tabs: () => Tabs,
|
|
67
|
+
Toast: () => Toast,
|
|
68
|
+
Toggle: () => Toggle,
|
|
69
|
+
ToggleGroup: () => ToggleGroup,
|
|
70
|
+
Toolbar: () => Toolbar,
|
|
71
|
+
Tooltip: () => Tooltip,
|
|
72
|
+
VisuallyHidden: () => VisuallyHidden,
|
|
73
|
+
composeEventHandlers: () => import_compose_event_handlers.composeEventHandlers,
|
|
74
|
+
composeRefs: () => import_compose_refs.composeRefs,
|
|
75
|
+
createContextScope: () => import_context.createContextScope,
|
|
76
|
+
useComposedRefs: () => import_compose_refs.useComposedRefs,
|
|
77
|
+
useControllableState: () => import_useControllableState.useControllableState
|
|
78
|
+
});
|
|
79
|
+
module.exports = __toCommonJS(index_exports);
|
|
80
|
+
var import_Slot = require("./Slot.cjs");
|
|
81
|
+
var import_Primitive = require("./Primitive.cjs");
|
|
82
|
+
var import_compose_refs = require("./compose-refs.cjs");
|
|
83
|
+
var import_compose_event_handlers = require("./compose-event-handlers.cjs");
|
|
84
|
+
var import_context = require("./context.cjs");
|
|
85
|
+
var import_useControllableState = require("./useControllableState.cjs");
|
|
86
|
+
var import_Presence = require("./Presence.cjs");
|
|
87
|
+
var Separator = __toESM(require("./Separator.cjs"), 1);
|
|
88
|
+
var Label = __toESM(require("./Label.cjs"), 1);
|
|
89
|
+
var Collapsible = __toESM(require("./Collapsible.cjs"), 1);
|
|
90
|
+
var Accordion = __toESM(require("./Accordion.cjs"), 1);
|
|
91
|
+
var Portal = __toESM(require("./Portal.cjs"), 1);
|
|
92
|
+
var Dialog = __toESM(require("./Dialog.cjs"), 1);
|
|
93
|
+
var AlertDialog = __toESM(require("./AlertDialog.cjs"), 1);
|
|
94
|
+
var Toggle = __toESM(require("./Toggle.cjs"), 1);
|
|
95
|
+
var ToggleGroup = __toESM(require("./ToggleGroup.cjs"), 1);
|
|
96
|
+
var Tabs = __toESM(require("./Tabs.cjs"), 1);
|
|
97
|
+
var RovingFocus = __toESM(require("./RovingFocusGroup.cjs"), 1);
|
|
98
|
+
var AspectRatio = __toESM(require("./AspectRatio.cjs"), 1);
|
|
99
|
+
var VisuallyHidden = __toESM(require("./VisuallyHidden.cjs"), 1);
|
|
100
|
+
var Avatar = __toESM(require("./Avatar.cjs"), 1);
|
|
101
|
+
var Progress = __toESM(require("./Progress.cjs"), 1);
|
|
102
|
+
var Toolbar = __toESM(require("./Toolbar.cjs"), 1);
|
|
103
|
+
var Arrow = __toESM(require("./Arrow.cjs"), 1);
|
|
104
|
+
var Popper = __toESM(require("./Popper.cjs"), 1);
|
|
105
|
+
var Tooltip = __toESM(require("./Tooltip.cjs"), 1);
|
|
106
|
+
var Popover = __toESM(require("./Popover.cjs"), 1);
|
|
107
|
+
var HoverCard = __toESM(require("./HoverCard.cjs"), 1);
|
|
108
|
+
var Menu = __toESM(require("./Menu.cjs"), 1);
|
|
109
|
+
var DropdownMenu = __toESM(require("./DropdownMenu.cjs"), 1);
|
|
110
|
+
var ContextMenu = __toESM(require("./ContextMenu.cjs"), 1);
|
|
111
|
+
var ScrollArea = __toESM(require("./ScrollArea.cjs"), 1);
|
|
112
|
+
var Checkbox = __toESM(require("./Checkbox.cjs"), 1);
|
|
113
|
+
var Switch = __toESM(require("./Switch.cjs"), 1);
|
|
114
|
+
var RadioGroup = __toESM(require("./RadioGroup.cjs"), 1);
|
|
115
|
+
var Slider = __toESM(require("./Slider.cjs"), 1);
|
|
116
|
+
var Form = __toESM(require("./Form.cjs"), 1);
|
|
117
|
+
var Menubar = __toESM(require("./Menubar.cjs"), 1);
|
|
118
|
+
var Select = __toESM(require("./Select.cjs"), 1);
|
|
119
|
+
var NavigationMenu = __toESM(require("./NavigationMenu.cjs"), 1);
|
|
120
|
+
var Toast = __toESM(require("./Toast.cjs"), 1);
|
|
121
|
+
var OneTimePasswordField = __toESM(require("./OneTimePasswordField.cjs"), 1);
|
|
122
|
+
var PasswordToggleField = __toESM(require("./PasswordToggleField.cjs"), 1);
|
|
123
|
+
var AccessibleIcon = __toESM(require("./AccessibleIcon.cjs"), 1);
|
|
124
|
+
var Direction = __toESM(require("./direction.cjs"), 1);
|
|
125
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
126
|
+
0 && (module.exports = {
|
|
127
|
+
AccessibleIcon,
|
|
128
|
+
Accordion,
|
|
129
|
+
AlertDialog,
|
|
130
|
+
Arrow,
|
|
131
|
+
AspectRatio,
|
|
132
|
+
Avatar,
|
|
133
|
+
Checkbox,
|
|
134
|
+
Collapsible,
|
|
135
|
+
ContextMenu,
|
|
136
|
+
Dialog,
|
|
137
|
+
Direction,
|
|
138
|
+
DropdownMenu,
|
|
139
|
+
Form,
|
|
140
|
+
HoverCard,
|
|
141
|
+
Label,
|
|
142
|
+
Menu,
|
|
143
|
+
Menubar,
|
|
144
|
+
NavigationMenu,
|
|
145
|
+
OneTimePasswordField,
|
|
146
|
+
PasswordToggleField,
|
|
147
|
+
Popover,
|
|
148
|
+
Popper,
|
|
149
|
+
Portal,
|
|
150
|
+
Presence,
|
|
151
|
+
Primitive,
|
|
152
|
+
Progress,
|
|
153
|
+
RadioGroup,
|
|
154
|
+
RovingFocus,
|
|
155
|
+
ScrollArea,
|
|
156
|
+
Select,
|
|
157
|
+
Separator,
|
|
158
|
+
Slider,
|
|
159
|
+
Slot,
|
|
160
|
+
Slottable,
|
|
161
|
+
Switch,
|
|
162
|
+
Tabs,
|
|
163
|
+
Toast,
|
|
164
|
+
Toggle,
|
|
165
|
+
ToggleGroup,
|
|
166
|
+
Toolbar,
|
|
167
|
+
Tooltip,
|
|
168
|
+
VisuallyHidden,
|
|
169
|
+
composeEventHandlers,
|
|
170
|
+
composeRefs,
|
|
171
|
+
createContextScope,
|
|
172
|
+
useComposedRefs,
|
|
173
|
+
useControllableState
|
|
174
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
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 internal_exports = {};
|
|
20
|
+
__export(internal_exports, {
|
|
21
|
+
S: () => S,
|
|
22
|
+
splitSlot: () => splitSlot,
|
|
23
|
+
subSlot: () => subSlot
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(internal_exports);
|
|
26
|
+
const subSlotCache = /* @__PURE__ */ new Map();
|
|
27
|
+
function subSlot(slot, tag) {
|
|
28
|
+
if (slot === void 0) return void 0;
|
|
29
|
+
let byTag = subSlotCache.get(slot);
|
|
30
|
+
if (byTag === void 0) subSlotCache.set(slot, byTag = /* @__PURE__ */ new Map());
|
|
31
|
+
let sym = byTag.get(tag);
|
|
32
|
+
if (sym === void 0) byTag.set(tag, sym = /* @__PURE__ */ Symbol.for((slot.description ?? "") + ":" + tag));
|
|
33
|
+
return sym;
|
|
34
|
+
}
|
|
35
|
+
function splitSlot(args) {
|
|
36
|
+
const tail = args[args.length - 1];
|
|
37
|
+
const slot = typeof tail === "symbol" ? tail : void 0;
|
|
38
|
+
return [slot !== void 0 ? args.slice(0, -1) : args, slot];
|
|
39
|
+
}
|
|
40
|
+
const sCache = /* @__PURE__ */ new Map();
|
|
41
|
+
function S(tag) {
|
|
42
|
+
let sym = sCache.get(tag);
|
|
43
|
+
if (sym === void 0) sCache.set(tag, sym = /* @__PURE__ */ Symbol.for("@octanejs/radix:" + tag));
|
|
44
|
+
return sym;
|
|
45
|
+
}
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
S,
|
|
49
|
+
splitSlot,
|
|
50
|
+
subSlot
|
|
51
|
+
});
|