@octanejs/radix 0.1.31 → 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,54 @@
|
|
|
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 Toggle_exports = {};
|
|
20
|
+
__export(Toggle_exports, {
|
|
21
|
+
Root: () => Toggle,
|
|
22
|
+
Toggle: () => Toggle
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(Toggle_exports);
|
|
25
|
+
var import_octane = require("octane");
|
|
26
|
+
var import_compose_event_handlers = require("./compose-event-handlers.cjs");
|
|
27
|
+
var import_internal = require("./internal.cjs");
|
|
28
|
+
var import_Primitive = require("./Primitive.cjs");
|
|
29
|
+
var import_useControllableState = require("./useControllableState.cjs");
|
|
30
|
+
function Toggle(props) {
|
|
31
|
+
const slot = (0, import_internal.S)("Toggle");
|
|
32
|
+
const { pressed: pressedProp, defaultPressed, onPressedChange, ...buttonProps } = props ?? {};
|
|
33
|
+
const [pressed, setPressed] = (0, import_useControllableState.useControllableState)(
|
|
34
|
+
{ prop: pressedProp, onChange: onPressedChange, defaultProp: defaultPressed ?? false },
|
|
35
|
+
(0, import_internal.subSlot)(slot, "pressed")
|
|
36
|
+
);
|
|
37
|
+
return (0, import_octane.createElement)(import_Primitive.Primitive.button, {
|
|
38
|
+
type: "button",
|
|
39
|
+
"aria-pressed": pressed,
|
|
40
|
+
"data-state": pressed ? "on" : "off",
|
|
41
|
+
"data-disabled": props?.disabled ? "" : void 0,
|
|
42
|
+
...buttonProps,
|
|
43
|
+
onClick: (0, import_compose_event_handlers.composeEventHandlers)(props?.onClick, () => {
|
|
44
|
+
if (!props?.disabled) {
|
|
45
|
+
setPressed(!pressed);
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
Root,
|
|
53
|
+
Toggle
|
|
54
|
+
});
|
|
@@ -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 ToggleGroup_exports = {};
|
|
30
|
+
__export(ToggleGroup_exports, {
|
|
31
|
+
Item: () => Item,
|
|
32
|
+
Root: () => Root,
|
|
33
|
+
ToggleGroup: () => Root,
|
|
34
|
+
ToggleGroupItem: () => Item,
|
|
35
|
+
createToggleGroupScope: () => createToggleGroupScope
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(ToggleGroup_exports);
|
|
38
|
+
var import_octane = require("octane");
|
|
39
|
+
var import_context = require("./context.cjs");
|
|
40
|
+
var import_internal = require("./internal.cjs");
|
|
41
|
+
var import_Primitive = require("./Primitive.cjs");
|
|
42
|
+
var RovingFocusGroup = __toESM(require("./RovingFocusGroup.cjs"), 1);
|
|
43
|
+
var import_RovingFocusGroup = require("./RovingFocusGroup.cjs");
|
|
44
|
+
var import_Toggle = require("./Toggle.cjs");
|
|
45
|
+
var import_useControllableState = require("./useControllableState.cjs");
|
|
46
|
+
const [createToggleGroupContext, createToggleGroupScope] = (0, import_context.createContextScope)("ToggleGroup", [
|
|
47
|
+
import_RovingFocusGroup.createRovingFocusGroupScope
|
|
48
|
+
]);
|
|
49
|
+
const useRovingFocusGroupScope = (0, import_RovingFocusGroup.createRovingFocusGroupScope)();
|
|
50
|
+
const [ToggleGroupValueProvider, useToggleGroupValueContext] = createToggleGroupContext("ToggleGroup");
|
|
51
|
+
const [ToggleGroupContext, useToggleGroupContext] = createToggleGroupContext("ToggleGroup");
|
|
52
|
+
function Root(props) {
|
|
53
|
+
const { type, ...toggleGroupProps } = props ?? {};
|
|
54
|
+
if (type === "single") {
|
|
55
|
+
return (0, import_octane.createElement)(ImplSingle, { role: "radiogroup", ...toggleGroupProps });
|
|
56
|
+
}
|
|
57
|
+
if (type === "multiple") {
|
|
58
|
+
return (0, import_octane.createElement)(ImplMultiple, { role: "toolbar", ...toggleGroupProps });
|
|
59
|
+
}
|
|
60
|
+
throw new Error("Missing prop `type` expected on `ToggleGroup`");
|
|
61
|
+
}
|
|
62
|
+
function ImplSingle(props) {
|
|
63
|
+
const slot = (0, import_internal.S)("ToggleGroup.Single");
|
|
64
|
+
const { value: valueProp, defaultValue, onValueChange = () => {
|
|
65
|
+
}, ...rest } = props;
|
|
66
|
+
const [value, setValue] = (0, import_useControllableState.useControllableState)(
|
|
67
|
+
{ prop: valueProp, defaultProp: defaultValue ?? "", onChange: onValueChange },
|
|
68
|
+
(0, import_internal.subSlot)(slot, "value")
|
|
69
|
+
);
|
|
70
|
+
return (0, import_octane.createElement)(ToggleGroupValueProvider, {
|
|
71
|
+
scope: props.__scopeToggleGroup,
|
|
72
|
+
type: "single",
|
|
73
|
+
value: (0, import_octane.useMemo)(() => value ? [value] : [], [value], (0, import_internal.subSlot)(slot, "arr")),
|
|
74
|
+
onItemActivate: setValue,
|
|
75
|
+
onItemDeactivate: (0, import_octane.useCallback)(() => setValue(""), [setValue], (0, import_internal.subSlot)(slot, "off")),
|
|
76
|
+
children: (0, import_octane.createElement)(Impl, rest)
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function ImplMultiple(props) {
|
|
80
|
+
const slot = (0, import_internal.S)("ToggleGroup.Multiple");
|
|
81
|
+
const { value: valueProp, defaultValue, onValueChange = () => {
|
|
82
|
+
}, ...rest } = props;
|
|
83
|
+
const [value, setValue] = (0, import_useControllableState.useControllableState)(
|
|
84
|
+
{ prop: valueProp, defaultProp: defaultValue ?? [], onChange: onValueChange },
|
|
85
|
+
(0, import_internal.subSlot)(slot, "value")
|
|
86
|
+
);
|
|
87
|
+
const handleButtonActivate = (0, import_octane.useCallback)(
|
|
88
|
+
(itemValue) => setValue((prev = []) => [...prev, itemValue]),
|
|
89
|
+
[setValue],
|
|
90
|
+
(0, import_internal.subSlot)(slot, "on")
|
|
91
|
+
);
|
|
92
|
+
const handleButtonDeactivate = (0, import_octane.useCallback)(
|
|
93
|
+
(itemValue) => setValue((prev = []) => prev.filter((v) => v !== itemValue)),
|
|
94
|
+
[setValue],
|
|
95
|
+
(0, import_internal.subSlot)(slot, "off")
|
|
96
|
+
);
|
|
97
|
+
return (0, import_octane.createElement)(ToggleGroupValueProvider, {
|
|
98
|
+
scope: props.__scopeToggleGroup,
|
|
99
|
+
type: "multiple",
|
|
100
|
+
value,
|
|
101
|
+
onItemActivate: handleButtonActivate,
|
|
102
|
+
onItemDeactivate: handleButtonDeactivate,
|
|
103
|
+
children: (0, import_octane.createElement)(Impl, rest)
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function Impl(props) {
|
|
107
|
+
const slot = (0, import_internal.S)("ToggleGroup.Impl");
|
|
108
|
+
const {
|
|
109
|
+
__scopeToggleGroup,
|
|
110
|
+
disabled = false,
|
|
111
|
+
rovingFocus = true,
|
|
112
|
+
orientation,
|
|
113
|
+
dir,
|
|
114
|
+
loop = true,
|
|
115
|
+
...toggleGroupProps
|
|
116
|
+
} = props;
|
|
117
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToggleGroup, (0, import_internal.subSlot)(slot, "rfs"));
|
|
118
|
+
const direction = dir === "rtl" ? "rtl" : "ltr";
|
|
119
|
+
const commonProps = { dir: direction, ...toggleGroupProps };
|
|
120
|
+
return (0, import_octane.createElement)(ToggleGroupContext, {
|
|
121
|
+
scope: __scopeToggleGroup,
|
|
122
|
+
rovingFocus,
|
|
123
|
+
disabled,
|
|
124
|
+
children: rovingFocus ? (0, import_octane.createElement)(RovingFocusGroup.Root, {
|
|
125
|
+
asChild: true,
|
|
126
|
+
...rovingFocusGroupScope,
|
|
127
|
+
orientation,
|
|
128
|
+
dir: direction,
|
|
129
|
+
loop,
|
|
130
|
+
children: (0, import_octane.createElement)(import_Primitive.Primitive.div, commonProps)
|
|
131
|
+
}) : (0, import_octane.createElement)(import_Primitive.Primitive.div, commonProps)
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function Item(props) {
|
|
135
|
+
const slot = (0, import_internal.S)("ToggleGroup.Item");
|
|
136
|
+
const valueContext = useToggleGroupValueContext("ToggleGroupItem", props?.__scopeToggleGroup);
|
|
137
|
+
const context = useToggleGroupContext("ToggleGroupItem", props?.__scopeToggleGroup);
|
|
138
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(
|
|
139
|
+
props?.__scopeToggleGroup,
|
|
140
|
+
(0, import_internal.subSlot)(slot, "rfs")
|
|
141
|
+
);
|
|
142
|
+
const pressed = valueContext.value.includes(props.value);
|
|
143
|
+
const disabled = context.disabled || props.disabled;
|
|
144
|
+
const commonProps = { ...props, pressed, disabled };
|
|
145
|
+
return context.rovingFocus ? (0, import_octane.createElement)(RovingFocusGroup.Item, {
|
|
146
|
+
asChild: true,
|
|
147
|
+
...rovingFocusGroupScope,
|
|
148
|
+
focusable: !disabled,
|
|
149
|
+
active: pressed,
|
|
150
|
+
children: (0, import_octane.createElement)(ItemImpl, commonProps)
|
|
151
|
+
}) : (0, import_octane.createElement)(ItemImpl, commonProps);
|
|
152
|
+
}
|
|
153
|
+
function ItemImpl(props) {
|
|
154
|
+
const { __scopeToggleGroup, value, ...itemProps } = props;
|
|
155
|
+
const valueContext = useToggleGroupValueContext("ToggleGroupItem", __scopeToggleGroup);
|
|
156
|
+
const singleProps = { role: "radio", "aria-checked": props.pressed, "aria-pressed": void 0 };
|
|
157
|
+
const typeProps = valueContext.type === "single" ? singleProps : void 0;
|
|
158
|
+
return (0, import_octane.createElement)(import_Toggle.Toggle, {
|
|
159
|
+
...typeProps,
|
|
160
|
+
...itemProps,
|
|
161
|
+
onPressedChange: (pressed) => {
|
|
162
|
+
if (pressed) valueContext.onItemActivate(value);
|
|
163
|
+
else valueContext.onItemDeactivate(value);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
168
|
+
0 && (module.exports = {
|
|
169
|
+
Item,
|
|
170
|
+
Root,
|
|
171
|
+
ToggleGroup,
|
|
172
|
+
ToggleGroupItem,
|
|
173
|
+
createToggleGroupScope
|
|
174
|
+
});
|
|
@@ -0,0 +1,165 @@
|
|
|
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 Toolbar_exports = {};
|
|
30
|
+
__export(Toolbar_exports, {
|
|
31
|
+
Button: () => Button,
|
|
32
|
+
Link: () => Link,
|
|
33
|
+
Root: () => Root,
|
|
34
|
+
Separator: () => Separator,
|
|
35
|
+
ToggleGroup: () => ToggleGroup,
|
|
36
|
+
ToggleItem: () => ToggleItem,
|
|
37
|
+
Toolbar: () => Root,
|
|
38
|
+
ToolbarButton: () => Button,
|
|
39
|
+
ToolbarLink: () => Link,
|
|
40
|
+
createToolbarScope: () => createToolbarScope
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(Toolbar_exports);
|
|
43
|
+
var import_octane = require("octane");
|
|
44
|
+
var import_compose_event_handlers = require("./compose-event-handlers.cjs");
|
|
45
|
+
var import_context = require("./context.cjs");
|
|
46
|
+
var import_internal = require("./internal.cjs");
|
|
47
|
+
var import_Primitive = require("./Primitive.cjs");
|
|
48
|
+
var RovingFocusGroup = __toESM(require("./RovingFocusGroup.cjs"), 1);
|
|
49
|
+
var import_RovingFocusGroup = require("./RovingFocusGroup.cjs");
|
|
50
|
+
var SeparatorPrimitive = __toESM(require("./Separator.cjs"), 1);
|
|
51
|
+
var ToggleGroupPrimitive = __toESM(require("./ToggleGroup.cjs"), 1);
|
|
52
|
+
var import_ToggleGroup = require("./ToggleGroup.cjs");
|
|
53
|
+
const [createToolbarContext, createToolbarScope] = (0, import_context.createContextScope)("Toolbar", [
|
|
54
|
+
import_RovingFocusGroup.createRovingFocusGroupScope,
|
|
55
|
+
import_ToggleGroup.createToggleGroupScope
|
|
56
|
+
]);
|
|
57
|
+
const useRovingFocusGroupScope = (0, import_RovingFocusGroup.createRovingFocusGroupScope)();
|
|
58
|
+
const useToggleGroupScope = (0, import_ToggleGroup.createToggleGroupScope)();
|
|
59
|
+
const [ToolbarProvider, useToolbarContext] = createToolbarContext("Toolbar");
|
|
60
|
+
function Root(props) {
|
|
61
|
+
const slot = (0, import_internal.S)("Toolbar.Root");
|
|
62
|
+
const {
|
|
63
|
+
__scopeToolbar,
|
|
64
|
+
orientation = "horizontal",
|
|
65
|
+
dir,
|
|
66
|
+
loop = true,
|
|
67
|
+
...toolbarProps
|
|
68
|
+
} = props ?? {};
|
|
69
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToolbar, (0, import_internal.subSlot)(slot, "rfs"));
|
|
70
|
+
const direction = dir === "rtl" ? "rtl" : "ltr";
|
|
71
|
+
return (0, import_octane.createElement)(ToolbarProvider, {
|
|
72
|
+
scope: __scopeToolbar,
|
|
73
|
+
orientation,
|
|
74
|
+
dir: direction,
|
|
75
|
+
children: (0, import_octane.createElement)(RovingFocusGroup.Root, {
|
|
76
|
+
asChild: true,
|
|
77
|
+
...rovingFocusGroupScope,
|
|
78
|
+
orientation,
|
|
79
|
+
dir: direction,
|
|
80
|
+
loop,
|
|
81
|
+
children: (0, import_octane.createElement)(import_Primitive.Primitive.div, {
|
|
82
|
+
role: "toolbar",
|
|
83
|
+
"aria-orientation": orientation,
|
|
84
|
+
dir: direction,
|
|
85
|
+
...toolbarProps
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function Separator(props) {
|
|
91
|
+
const { __scopeToolbar, ...separatorProps } = props ?? {};
|
|
92
|
+
const context = useToolbarContext("ToolbarSeparator", __scopeToolbar);
|
|
93
|
+
return (0, import_octane.createElement)(SeparatorPrimitive.Root, {
|
|
94
|
+
orientation: context.orientation === "horizontal" ? "vertical" : "horizontal",
|
|
95
|
+
...separatorProps
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function Button(props) {
|
|
99
|
+
const slot = (0, import_internal.S)("Toolbar.Button");
|
|
100
|
+
const { __scopeToolbar, ...buttonProps } = props ?? {};
|
|
101
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToolbar, (0, import_internal.subSlot)(slot, "rfs"));
|
|
102
|
+
return (0, import_octane.createElement)(RovingFocusGroup.Item, {
|
|
103
|
+
asChild: true,
|
|
104
|
+
...rovingFocusGroupScope,
|
|
105
|
+
focusable: !props?.disabled,
|
|
106
|
+
children: (0, import_octane.createElement)(import_Primitive.Primitive.button, { type: "button", ...buttonProps })
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function Link(props) {
|
|
110
|
+
const slot = (0, import_internal.S)("Toolbar.Link");
|
|
111
|
+
const { __scopeToolbar, ...linkProps } = props ?? {};
|
|
112
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToolbar, (0, import_internal.subSlot)(slot, "rfs"));
|
|
113
|
+
return (0, import_octane.createElement)(RovingFocusGroup.Item, {
|
|
114
|
+
asChild: true,
|
|
115
|
+
...rovingFocusGroupScope,
|
|
116
|
+
focusable: true,
|
|
117
|
+
children: (0, import_octane.createElement)(import_Primitive.Primitive.a, {
|
|
118
|
+
...linkProps,
|
|
119
|
+
onKeyDown: (0, import_compose_event_handlers.composeEventHandlers)(props?.onKeyDown, (event) => {
|
|
120
|
+
if (event.key === " ") event.currentTarget.click();
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function ToggleGroup(props) {
|
|
126
|
+
const slot = (0, import_internal.S)("Toolbar.ToggleGroup");
|
|
127
|
+
const { __scopeToolbar, ...toggleGroupProps } = props ?? {};
|
|
128
|
+
const context = useToolbarContext("ToolbarToggleGroup", __scopeToolbar);
|
|
129
|
+
const toggleGroupScope = useToggleGroupScope(__scopeToolbar, (0, import_internal.subSlot)(slot, "tgs"));
|
|
130
|
+
return (0, import_octane.createElement)(ToggleGroupPrimitive.Root, {
|
|
131
|
+
"data-orientation": context.orientation,
|
|
132
|
+
dir: context.dir,
|
|
133
|
+
...toggleGroupScope,
|
|
134
|
+
...toggleGroupProps,
|
|
135
|
+
// The toolbar is the roving group; the embedded toggle group must not compete.
|
|
136
|
+
rovingFocus: false
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function ToggleItem(props) {
|
|
140
|
+
const slot = (0, import_internal.S)("Toolbar.ToggleItem");
|
|
141
|
+
const { __scopeToolbar, ...toggleItemProps } = props ?? {};
|
|
142
|
+
const toggleGroupScope = useToggleGroupScope(__scopeToolbar, (0, import_internal.subSlot)(slot, "tgs"));
|
|
143
|
+
const scope = { __scopeToolbar };
|
|
144
|
+
return (0, import_octane.createElement)(Button, {
|
|
145
|
+
asChild: true,
|
|
146
|
+
...scope,
|
|
147
|
+
children: (0, import_octane.createElement)(ToggleGroupPrimitive.Item, {
|
|
148
|
+
...toggleGroupScope,
|
|
149
|
+
...toggleItemProps
|
|
150
|
+
})
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
154
|
+
0 && (module.exports = {
|
|
155
|
+
Button,
|
|
156
|
+
Link,
|
|
157
|
+
Root,
|
|
158
|
+
Separator,
|
|
159
|
+
ToggleGroup,
|
|
160
|
+
ToggleItem,
|
|
161
|
+
Toolbar,
|
|
162
|
+
ToolbarButton,
|
|
163
|
+
ToolbarLink,
|
|
164
|
+
createToolbarScope
|
|
165
|
+
});
|