@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.
Files changed (60) hide show
  1. package/dist/cjs/AccessibleIcon.cjs +56 -0
  2. package/dist/cjs/Accordion.cjs +272 -0
  3. package/dist/cjs/AlertDialog.cjs +144 -0
  4. package/dist/cjs/Arrow.cjs +43 -0
  5. package/dist/cjs/AspectRatio.cjs +56 -0
  6. package/dist/cjs/Avatar.cjs +150 -0
  7. package/dist/cjs/Checkbox.cjs +281 -0
  8. package/dist/cjs/Collapsible.cjs +176 -0
  9. package/dist/cjs/ContextMenu.cjs +315 -0
  10. package/dist/cjs/Dialog.cjs +291 -0
  11. package/dist/cjs/DismissableLayer.cjs +382 -0
  12. package/dist/cjs/DropdownMenu.cjs +296 -0
  13. package/dist/cjs/FocusScope.cjs +257 -0
  14. package/dist/cjs/Form.cjs +537 -0
  15. package/dist/cjs/HoverCard.cjs +309 -0
  16. package/dist/cjs/Label.cjs +42 -0
  17. package/dist/cjs/Menu.cjs +925 -0
  18. package/dist/cjs/Menubar.cjs +475 -0
  19. package/dist/cjs/NavigationMenu.cjs +942 -0
  20. package/dist/cjs/OneTimePasswordField.cjs +729 -0
  21. package/dist/cjs/PasswordToggleField.cjs +377 -0
  22. package/dist/cjs/Popover.cjs +340 -0
  23. package/dist/cjs/Popper.cjs +368 -0
  24. package/dist/cjs/Portal.cjs +40 -0
  25. package/dist/cjs/Presence.cjs +183 -0
  26. package/dist/cjs/Primitive.cjs +63 -0
  27. package/dist/cjs/Progress.cjs +111 -0
  28. package/dist/cjs/Radio.cjs +240 -0
  29. package/dist/cjs/RadioGroup.cjs +216 -0
  30. package/dist/cjs/RovingFocusGroup.cjs +253 -0
  31. package/dist/cjs/ScrollArea.cjs +828 -0
  32. package/dist/cjs/Select.cjs +1429 -0
  33. package/dist/cjs/Separator.cjs +51 -0
  34. package/dist/cjs/Slider.cjs +634 -0
  35. package/dist/cjs/Slot.cjs +97 -0
  36. package/dist/cjs/Switch.cjs +253 -0
  37. package/dist/cjs/Tabs.cjs +195 -0
  38. package/dist/cjs/Toast.cjs +733 -0
  39. package/dist/cjs/Toggle.cjs +54 -0
  40. package/dist/cjs/ToggleGroup.cjs +174 -0
  41. package/dist/cjs/Toolbar.cjs +165 -0
  42. package/dist/cjs/Tooltip.cjs +628 -0
  43. package/dist/cjs/VisuallyHidden.cjs +52 -0
  44. package/dist/cjs/collection.cjs +95 -0
  45. package/dist/cjs/compose-event-handlers.cjs +35 -0
  46. package/dist/cjs/compose-refs.cjs +68 -0
  47. package/dist/cjs/context.cjs +96 -0
  48. package/dist/cjs/direction.cjs +41 -0
  49. package/dist/cjs/focus-guards.cjs +76 -0
  50. package/dist/cjs/index.cjs +174 -0
  51. package/dist/cjs/internal.cjs +51 -0
  52. package/dist/cjs/scroll-lock.cjs +67 -0
  53. package/dist/cjs/use-callback-ref.cjs +47 -0
  54. package/dist/cjs/use-effect-event.cjs +52 -0
  55. package/dist/cjs/use-is-hydrated.cjs +43 -0
  56. package/dist/cjs/use-previous.cjs +47 -0
  57. package/dist/cjs/use-size.cjs +69 -0
  58. package/dist/cjs/useControllableState.cjs +80 -0
  59. package/dist/cjs/useId.cjs +36 -0
  60. package/package.json +14 -7
@@ -0,0 +1,97 @@
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 Slot_exports = {};
20
+ __export(Slot_exports, {
21
+ Slot: () => Slot,
22
+ Slottable: () => Slottable
23
+ });
24
+ module.exports = __toCommonJS(Slot_exports);
25
+ var import_octane = require("octane");
26
+ var import_compose_refs = require("./compose-refs.cjs");
27
+ var import_internal = require("./internal.cjs");
28
+ function Slottable(props) {
29
+ return props.children;
30
+ }
31
+ function isSlottable(child) {
32
+ return (0, import_octane.isValidElement)(child) && child.type === Slottable;
33
+ }
34
+ function mergeProps(slotProps, childProps) {
35
+ const overrideProps = { ...childProps };
36
+ for (const propName in childProps) {
37
+ const slotPropValue = slotProps[propName];
38
+ const childPropValue = childProps[propName];
39
+ const isHandler = /^on[A-Z]/.test(propName);
40
+ if (isHandler) {
41
+ if (slotPropValue && childPropValue) {
42
+ overrideProps[propName] = (...args) => {
43
+ const result = childPropValue(...args);
44
+ slotPropValue(...args);
45
+ return result;
46
+ };
47
+ } else if (slotPropValue) {
48
+ overrideProps[propName] = slotPropValue;
49
+ }
50
+ } else if (propName === "style") {
51
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
52
+ } else if (propName === "className" || propName === "class") {
53
+ overrideProps[propName] = (0, import_octane.normalizeClass)([slotPropValue, childPropValue]);
54
+ }
55
+ }
56
+ return { ...slotProps, ...overrideProps };
57
+ }
58
+ function Slot(props) {
59
+ const slot = (0, import_internal.S)("Slot");
60
+ const { children, ...slotProps } = props ?? {};
61
+ const childrenArray = import_octane.Children.toArray(children);
62
+ const slottable = childrenArray.find(isSlottable);
63
+ let targetChild = children;
64
+ if (!slottable && Array.isArray(children) && childrenArray.length === 1) {
65
+ targetChild = childrenArray[0];
66
+ }
67
+ let newChildren = null;
68
+ let hasSlottable = false;
69
+ if (slottable) {
70
+ hasSlottable = true;
71
+ const newElement = slottable.props.children;
72
+ newChildren = import_octane.Children.map(children, (child) => {
73
+ if (child === slottable) {
74
+ if (import_octane.Children.count(newElement) > 1) return import_octane.Children.only(null);
75
+ return (0, import_octane.isValidElement)(newElement) ? newElement.props.children : null;
76
+ }
77
+ return child;
78
+ });
79
+ targetChild = (0, import_octane.isValidElement)(newElement) ? (0, import_octane.cloneElement)(newElement, void 0, newChildren) : null;
80
+ }
81
+ const childIsElement = (0, import_octane.isValidElement)(targetChild);
82
+ const childRef = childIsElement ? targetChild.props?.ref : void 0;
83
+ const slotRef = slotProps.ref;
84
+ const composedRef = (0, import_compose_refs.useComposedRefs)(slotRef, childRef, (0, import_internal.subSlot)(slot, "refs"));
85
+ if (childIsElement) {
86
+ const merged = mergeProps(slotProps, targetChild.props ?? {});
87
+ merged.ref = slotRef !== void 0 ? composedRef : childRef;
88
+ if (hasSlottable) merged.children = newChildren;
89
+ return (0, import_octane.cloneElement)(targetChild, merged);
90
+ }
91
+ return import_octane.Children.count(targetChild) > 1 ? import_octane.Children.only(targetChild) : null;
92
+ }
93
+ // Annotate the CommonJS export names for ESM import in node:
94
+ 0 && (module.exports = {
95
+ Slot,
96
+ Slottable
97
+ });
@@ -0,0 +1,253 @@
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 Switch_exports = {};
20
+ __export(Switch_exports, {
21
+ BubbleInput: () => BubbleInput,
22
+ Provider: () => Provider,
23
+ Root: () => Root,
24
+ Switch: () => Root,
25
+ SwitchBubbleInput: () => BubbleInput,
26
+ SwitchProvider: () => Provider,
27
+ SwitchThumb: () => Thumb,
28
+ SwitchTrigger: () => Trigger,
29
+ Thumb: () => Thumb,
30
+ Trigger: () => Trigger,
31
+ createSwitchScope: () => createSwitchScope
32
+ });
33
+ module.exports = __toCommonJS(Switch_exports);
34
+ var import_octane = require("octane");
35
+ var import_compose_event_handlers = require("./compose-event-handlers.cjs");
36
+ var import_compose_refs = require("./compose-refs.cjs");
37
+ var import_context = require("./context.cjs");
38
+ var import_internal = require("./internal.cjs");
39
+ var import_Primitive = require("./Primitive.cjs");
40
+ var import_use_previous = require("./use-previous.cjs");
41
+ var import_use_size = require("./use-size.cjs");
42
+ var import_useControllableState = require("./useControllableState.cjs");
43
+ const SWITCH_NAME = "Switch";
44
+ const [createSwitchContext, createSwitchScope] = (0, import_context.createContextScope)(SWITCH_NAME);
45
+ const [SwitchProviderImpl, useSwitchContext] = createSwitchContext(SWITCH_NAME);
46
+ function Provider(props) {
47
+ const slot = (0, import_internal.S)("Switch.Provider");
48
+ const {
49
+ __scopeSwitch,
50
+ checked: checkedProp,
51
+ children,
52
+ defaultChecked,
53
+ disabled,
54
+ form,
55
+ name,
56
+ onCheckedChange,
57
+ required,
58
+ value = "on",
59
+ internal_do_not_use_render
60
+ } = props ?? {};
61
+ const [checked, setChecked] = (0, import_useControllableState.useControllableState)(
62
+ { prop: checkedProp, defaultProp: defaultChecked ?? false, onChange: onCheckedChange },
63
+ (0, import_internal.subSlot)(slot, "checked")
64
+ );
65
+ const [control, setControl] = (0, import_octane.useState)(null, (0, import_internal.subSlot)(slot, "control"));
66
+ const [bubbleInput, setBubbleInput] = (0, import_octane.useState)(
67
+ null,
68
+ (0, import_internal.subSlot)(slot, "input")
69
+ );
70
+ const hasConsumerStoppedPropagationRef = (0, import_octane.useRef)(false, (0, import_internal.subSlot)(slot, "stopped"));
71
+ const isFormControl = control ? !!form || !!control.closest("form") : (
72
+ // We set this to true by default so that events bubble to forms without JS (SSR)
73
+ true
74
+ );
75
+ const context = {
76
+ checked,
77
+ setChecked,
78
+ disabled,
79
+ control,
80
+ setControl,
81
+ name,
82
+ form,
83
+ value,
84
+ hasConsumerStoppedPropagationRef,
85
+ required,
86
+ defaultChecked,
87
+ isFormControl,
88
+ bubbleInput,
89
+ setBubbleInput
90
+ };
91
+ return (0, import_octane.createElement)(SwitchProviderImpl, {
92
+ scope: __scopeSwitch,
93
+ ...context,
94
+ children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children
95
+ });
96
+ }
97
+ function Trigger(props) {
98
+ const slot = (0, import_internal.S)("Switch.Trigger");
99
+ const { __scopeSwitch, onClick, ref: forwardedRef, ...switchProps } = props ?? {};
100
+ const {
101
+ value,
102
+ disabled,
103
+ checked,
104
+ required,
105
+ setControl,
106
+ setChecked,
107
+ hasConsumerStoppedPropagationRef,
108
+ isFormControl,
109
+ bubbleInput
110
+ } = useSwitchContext("SwitchTrigger", __scopeSwitch);
111
+ const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, setControl, (0, import_internal.subSlot)(slot, "refs"));
112
+ return (0, import_octane.createElement)(import_Primitive.Primitive.button, {
113
+ type: "button",
114
+ role: "switch",
115
+ "aria-checked": checked,
116
+ "aria-required": required,
117
+ "data-state": getState(checked),
118
+ "data-disabled": disabled ? "" : void 0,
119
+ disabled,
120
+ value,
121
+ ...switchProps,
122
+ ref: composedRefs,
123
+ onClick: (0, import_compose_event_handlers.composeEventHandlers)(onClick, (event) => {
124
+ setChecked((prevChecked) => !prevChecked);
125
+ if (bubbleInput && isFormControl) {
126
+ hasConsumerStoppedPropagationRef.current = event.cancelBubble;
127
+ if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
128
+ }
129
+ })
130
+ });
131
+ }
132
+ function Root(props) {
133
+ const {
134
+ __scopeSwitch,
135
+ name,
136
+ checked,
137
+ defaultChecked,
138
+ required,
139
+ disabled,
140
+ value,
141
+ onCheckedChange,
142
+ form,
143
+ ref: forwardedRef,
144
+ ...switchProps
145
+ } = props ?? {};
146
+ return (0, import_octane.createElement)(Provider, {
147
+ __scopeSwitch,
148
+ checked,
149
+ defaultChecked,
150
+ disabled,
151
+ required,
152
+ onCheckedChange,
153
+ name,
154
+ form,
155
+ value,
156
+ internal_do_not_use_render: ({ isFormControl }) => [
157
+ (0, import_octane.createElement)(Trigger, {
158
+ key: "trigger",
159
+ ...switchProps,
160
+ ref: forwardedRef,
161
+ __scopeSwitch
162
+ }),
163
+ isFormControl ? (0, import_octane.createElement)(BubbleInput, { key: "bubble", __scopeSwitch }) : null
164
+ ]
165
+ });
166
+ }
167
+ function Thumb(props) {
168
+ const { __scopeSwitch, ...thumbProps } = props ?? {};
169
+ const context = useSwitchContext("SwitchThumb", __scopeSwitch);
170
+ return (0, import_octane.createElement)(import_Primitive.Primitive.span, {
171
+ "data-state": getState(context.checked),
172
+ "data-disabled": context.disabled ? "" : void 0,
173
+ ...thumbProps
174
+ });
175
+ }
176
+ function BubbleInput(props) {
177
+ const slot = (0, import_internal.S)("Switch.BubbleInput");
178
+ const { __scopeSwitch, ref: forwardedRef, ...inputProps } = props ?? {};
179
+ const {
180
+ control,
181
+ hasConsumerStoppedPropagationRef,
182
+ checked,
183
+ required,
184
+ disabled,
185
+ name,
186
+ value,
187
+ form,
188
+ bubbleInput,
189
+ setBubbleInput
190
+ } = useSwitchContext("SwitchBubbleInput", __scopeSwitch);
191
+ const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, setBubbleInput, (0, import_internal.subSlot)(slot, "refs"));
192
+ const prevChecked = (0, import_use_previous.usePrevious)(checked, (0, import_internal.subSlot)(slot, "prev"));
193
+ const controlSize = (0, import_use_size.useSize)(control, (0, import_internal.subSlot)(slot, "size"));
194
+ (0, import_octane.useEffect)(
195
+ () => {
196
+ const input = bubbleInput;
197
+ if (!input) return;
198
+ const bubbles = !hasConsumerStoppedPropagationRef.current;
199
+ if (prevChecked !== checked) {
200
+ input.dispatchEvent(new Event("click", { bubbles }));
201
+ input.dispatchEvent(new Event("change", { bubbles }));
202
+ }
203
+ },
204
+ [bubbleInput, prevChecked, checked, hasConsumerStoppedPropagationRef],
205
+ (0, import_internal.subSlot)(slot, "e:bubble")
206
+ );
207
+ return (0, import_octane.createElement)(import_Primitive.Primitive.input, {
208
+ type: "checkbox",
209
+ "aria-hidden": true,
210
+ // Live CONTROLLED checked (octane React-parity — see Checkbox.ts).
211
+ checked,
212
+ required,
213
+ disabled,
214
+ name,
215
+ value,
216
+ form,
217
+ ...inputProps,
218
+ tabIndex: -1,
219
+ ref: composedRefs,
220
+ style: {
221
+ ...props?.style,
222
+ ...controlSize,
223
+ position: "absolute",
224
+ pointerEvents: "none",
225
+ opacity: 0,
226
+ margin: 0,
227
+ // We transform because the input is absolutely positioned but we have
228
+ // rendered it **after** the button. This pulls it back to sit on top
229
+ // of the button.
230
+ transform: "translateX(-100%)"
231
+ }
232
+ });
233
+ }
234
+ function isFunction(value) {
235
+ return typeof value === "function";
236
+ }
237
+ function getState(checked) {
238
+ return checked ? "checked" : "unchecked";
239
+ }
240
+ // Annotate the CommonJS export names for ESM import in node:
241
+ 0 && (module.exports = {
242
+ BubbleInput,
243
+ Provider,
244
+ Root,
245
+ Switch,
246
+ SwitchBubbleInput,
247
+ SwitchProvider,
248
+ SwitchThumb,
249
+ SwitchTrigger,
250
+ Thumb,
251
+ Trigger,
252
+ createSwitchScope
253
+ });
@@ -0,0 +1,195 @@
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 Tabs_exports = {};
30
+ __export(Tabs_exports, {
31
+ Content: () => Content,
32
+ List: () => List,
33
+ Root: () => Root,
34
+ Tabs: () => Root,
35
+ Trigger: () => Trigger,
36
+ createTabsScope: () => createTabsScope
37
+ });
38
+ module.exports = __toCommonJS(Tabs_exports);
39
+ var import_octane = require("octane");
40
+ var import_compose_event_handlers = require("./compose-event-handlers.cjs");
41
+ var import_context = require("./context.cjs");
42
+ var import_internal = require("./internal.cjs");
43
+ var import_Presence = require("./Presence.cjs");
44
+ var import_Primitive = require("./Primitive.cjs");
45
+ var RovingFocusGroup = __toESM(require("./RovingFocusGroup.cjs"), 1);
46
+ var import_RovingFocusGroup = require("./RovingFocusGroup.cjs");
47
+ var import_useControllableState = require("./useControllableState.cjs");
48
+ var import_useId = require("./useId.cjs");
49
+ const [createTabsContext, createTabsScope] = (0, import_context.createContextScope)("Tabs", [
50
+ import_RovingFocusGroup.createRovingFocusGroupScope
51
+ ]);
52
+ const useRovingFocusGroupScope = (0, import_RovingFocusGroup.createRovingFocusGroupScope)();
53
+ const [TabsProvider, useTabsContext] = createTabsContext("Tabs");
54
+ function Root(props) {
55
+ const slot = (0, import_internal.S)("Tabs.Root");
56
+ const {
57
+ __scopeTabs,
58
+ value: valueProp,
59
+ onValueChange,
60
+ defaultValue,
61
+ orientation = "horizontal",
62
+ dir,
63
+ activationMode = "automatic",
64
+ ...tabsProps
65
+ } = props ?? {};
66
+ const direction = dir === "rtl" ? "rtl" : "ltr";
67
+ const [value, setValue] = (0, import_useControllableState.useControllableState)(
68
+ { prop: valueProp, onChange: onValueChange, defaultProp: defaultValue ?? "" },
69
+ (0, import_internal.subSlot)(slot, "value")
70
+ );
71
+ return (0, import_octane.createElement)(TabsProvider, {
72
+ scope: __scopeTabs,
73
+ baseId: (0, import_useId.useId)((0, import_internal.subSlot)(slot, "id")),
74
+ value,
75
+ onValueChange: setValue,
76
+ orientation,
77
+ dir: direction,
78
+ activationMode,
79
+ children: (0, import_octane.createElement)(import_Primitive.Primitive.div, {
80
+ dir: direction,
81
+ "data-orientation": orientation,
82
+ ...tabsProps
83
+ })
84
+ });
85
+ }
86
+ function List(props) {
87
+ const slot = (0, import_internal.S)("Tabs.List");
88
+ const { __scopeTabs, loop = true, ...listProps } = props ?? {};
89
+ const context = useTabsContext("TabsList", __scopeTabs);
90
+ const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs, (0, import_internal.subSlot)(slot, "rfs"));
91
+ return (0, import_octane.createElement)(RovingFocusGroup.Root, {
92
+ asChild: true,
93
+ ...rovingFocusGroupScope,
94
+ orientation: context.orientation,
95
+ dir: context.dir,
96
+ loop,
97
+ children: (0, import_octane.createElement)(import_Primitive.Primitive.div, {
98
+ role: "tablist",
99
+ "aria-orientation": context.orientation,
100
+ ...listProps
101
+ })
102
+ });
103
+ }
104
+ function Trigger(props) {
105
+ const slot = (0, import_internal.S)("Tabs.Trigger");
106
+ const { __scopeTabs, value, disabled = false, ...triggerProps } = props ?? {};
107
+ const context = useTabsContext("TabsTrigger", __scopeTabs);
108
+ const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs, (0, import_internal.subSlot)(slot, "rfs"));
109
+ const triggerId = makeTriggerId(context.baseId, value);
110
+ const contentId = makeContentId(context.baseId, value);
111
+ const isSelected = value === context.value;
112
+ return (0, import_octane.createElement)(RovingFocusGroup.Item, {
113
+ asChild: true,
114
+ ...rovingFocusGroupScope,
115
+ focusable: !disabled,
116
+ active: isSelected,
117
+ children: (0, import_octane.createElement)(import_Primitive.Primitive.button, {
118
+ type: "button",
119
+ role: "tab",
120
+ "aria-selected": isSelected,
121
+ "aria-controls": contentId,
122
+ "data-state": isSelected ? "active" : "inactive",
123
+ "data-disabled": disabled ? "" : void 0,
124
+ disabled,
125
+ id: triggerId,
126
+ ...triggerProps,
127
+ onMouseDown: (0, import_compose_event_handlers.composeEventHandlers)(props?.onMouseDown, (event) => {
128
+ if (!disabled && event.button === 0 && event.ctrlKey === false) {
129
+ context.onValueChange(value);
130
+ } else {
131
+ event.preventDefault();
132
+ }
133
+ }),
134
+ onKeyDown: (0, import_compose_event_handlers.composeEventHandlers)(props?.onKeyDown, (event) => {
135
+ if ([" ", "Enter"].includes(event.key)) context.onValueChange(value);
136
+ }),
137
+ onFocus: (0, import_compose_event_handlers.composeEventHandlers)(props?.onFocus, () => {
138
+ const isAutomaticActivation = context.activationMode !== "manual";
139
+ if (!isSelected && !disabled && isAutomaticActivation) {
140
+ context.onValueChange(value);
141
+ }
142
+ })
143
+ })
144
+ });
145
+ }
146
+ function Content(props) {
147
+ const slot = (0, import_internal.S)("Tabs.Content");
148
+ const { __scopeTabs, value, forceMount, children, ...contentProps } = props ?? {};
149
+ const context = useTabsContext("TabsContent", __scopeTabs);
150
+ const triggerId = makeTriggerId(context.baseId, value);
151
+ const contentId = makeContentId(context.baseId, value);
152
+ const isSelected = value === context.value;
153
+ const isMountAnimationPreventedRef = (0, import_octane.useRef)(isSelected, (0, import_internal.subSlot)(slot, "prevent"));
154
+ (0, import_octane.useEffect)(
155
+ () => {
156
+ const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
157
+ return () => cancelAnimationFrame(rAF);
158
+ },
159
+ [],
160
+ (0, import_internal.subSlot)(slot, "e:mount")
161
+ );
162
+ return (0, import_octane.createElement)(import_Presence.Presence, {
163
+ present: forceMount || isSelected,
164
+ children: ({ present }) => (0, import_octane.createElement)(import_Primitive.Primitive.div, {
165
+ "data-state": isSelected ? "active" : "inactive",
166
+ "data-orientation": context.orientation,
167
+ role: "tabpanel",
168
+ "aria-labelledby": triggerId,
169
+ hidden: !present,
170
+ id: contentId,
171
+ tabIndex: 0,
172
+ ...contentProps,
173
+ style: {
174
+ ...props.style,
175
+ animationDuration: isMountAnimationPreventedRef.current ? "0s" : void 0
176
+ },
177
+ children: present ? children : null
178
+ })
179
+ });
180
+ }
181
+ function makeTriggerId(baseId, value) {
182
+ return `${baseId}-trigger-${value}`;
183
+ }
184
+ function makeContentId(baseId, value) {
185
+ return `${baseId}-content-${value}`;
186
+ }
187
+ // Annotate the CommonJS export names for ESM import in node:
188
+ 0 && (module.exports = {
189
+ Content,
190
+ List,
191
+ Root,
192
+ Tabs,
193
+ Trigger,
194
+ createTabsScope
195
+ });