@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.
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,56 @@
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 AccessibleIcon_exports = {};
30
+ __export(AccessibleIcon_exports, {
31
+ AccessibleIcon: () => Root,
32
+ Root: () => Root
33
+ });
34
+ module.exports = __toCommonJS(AccessibleIcon_exports);
35
+ var import_octane = require("octane");
36
+ var VisuallyHiddenPrimitive = __toESM(require("./VisuallyHidden.cjs"), 1);
37
+ function Root(props) {
38
+ const { children, label } = props ?? {};
39
+ const array = import_octane.Children.toArray(children);
40
+ const child = array.length === 1 ? array[0] : import_octane.Children.only(children);
41
+ return [
42
+ (0, import_octane.cloneElement)(child, {
43
+ // accessibility
44
+ "aria-hidden": "true",
45
+ focusable: "false",
46
+ // See: https://allyjs.io/tutorials/focusing-in-svg.html#making-svg-elements-focusable
47
+ key: "icon"
48
+ }),
49
+ (0, import_octane.createElement)(VisuallyHiddenPrimitive.Root, { key: "label", children: label })
50
+ ];
51
+ }
52
+ // Annotate the CommonJS export names for ESM import in node:
53
+ 0 && (module.exports = {
54
+ AccessibleIcon,
55
+ Root
56
+ });
@@ -0,0 +1,272 @@
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 Accordion_exports = {};
30
+ __export(Accordion_exports, {
31
+ Accordion: () => Root,
32
+ Content: () => Content,
33
+ Header: () => Header,
34
+ Item: () => Item,
35
+ Root: () => Root,
36
+ Trigger: () => Trigger,
37
+ createAccordionScope: () => createAccordionScope
38
+ });
39
+ module.exports = __toCommonJS(Accordion_exports);
40
+ var import_octane = require("octane");
41
+ var Collapsible = __toESM(require("./Collapsible.cjs"), 1);
42
+ var import_Collapsible = require("./Collapsible.cjs");
43
+ var import_collection = require("./collection.cjs");
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 import_useControllableState = require("./useControllableState.cjs");
49
+ var import_useId = require("./useId.cjs");
50
+ const ACCORDION_KEYS = ["Home", "End", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"];
51
+ const [Collection, useCollection] = (0, import_collection.createCollection)("Accordion");
52
+ const [createAccordionContext, createAccordionScope] = (0, import_context.createContextScope)("Accordion", [
53
+ import_Collapsible.createCollapsibleScope
54
+ ]);
55
+ const useCollapsibleScope = (0, import_Collapsible.createCollapsibleScope)();
56
+ const [AccordionValueProvider, useAccordionValueContext] = createAccordionContext("Accordion");
57
+ const [AccordionImplProvider, useAccordionImplContext] = createAccordionContext("Accordion");
58
+ const [AccordionItemProvider, useAccordionItemContext] = createAccordionContext("AccordionItem");
59
+ function getState(open) {
60
+ return open ? "open" : "closed";
61
+ }
62
+ function Root(props) {
63
+ const slot = (0, import_internal.S)("Accordion.Root");
64
+ const {
65
+ __scopeAccordion,
66
+ type,
67
+ value: valueProp,
68
+ defaultValue,
69
+ onValueChange,
70
+ collapsible = false,
71
+ disabled,
72
+ dir,
73
+ orientation = "vertical",
74
+ ...rest
75
+ } = props ?? {};
76
+ const isMultiple = type === "multiple";
77
+ const [value, setValue] = (0, import_useControllableState.useControllableState)(
78
+ {
79
+ prop: valueProp,
80
+ defaultProp: defaultValue ?? (isMultiple ? [] : void 0),
81
+ onChange: onValueChange
82
+ },
83
+ (0, import_internal.subSlot)(slot, "value")
84
+ );
85
+ const valueArray = isMultiple ? value ?? [] : value != null && value !== "" ? [value] : [];
86
+ const onItemOpen = (0, import_octane.useCallback)(
87
+ (itemValue) => {
88
+ if (isMultiple) setValue((prev) => [...prev ?? [], itemValue]);
89
+ else setValue(itemValue);
90
+ },
91
+ [isMultiple],
92
+ (0, import_internal.subSlot)(slot, "open")
93
+ );
94
+ const onItemClose = (0, import_octane.useCallback)(
95
+ (itemValue) => {
96
+ if (isMultiple) setValue((prev) => (prev ?? []).filter((v) => v !== itemValue));
97
+ else if (collapsible) setValue("");
98
+ },
99
+ [isMultiple, collapsible],
100
+ (0, import_internal.subSlot)(slot, "close")
101
+ );
102
+ return (0, import_octane.createElement)(Collection.Provider, {
103
+ scope: __scopeAccordion,
104
+ children: (0, import_octane.createElement)(AccordionValueProvider, {
105
+ scope: __scopeAccordion,
106
+ value: valueArray,
107
+ onItemOpen,
108
+ onItemClose,
109
+ children: (0, import_octane.createElement)(AccordionImplProvider, {
110
+ scope: __scopeAccordion,
111
+ disabled,
112
+ orientation,
113
+ collapsible,
114
+ isMultiple,
115
+ children: (0, import_octane.createElement)(AccordionImpl, {
116
+ __scopeAccordion,
117
+ disabled,
118
+ dir,
119
+ orientation,
120
+ ...rest
121
+ })
122
+ })
123
+ })
124
+ });
125
+ }
126
+ function AccordionImpl(props) {
127
+ const slot = (0, import_internal.S)("Accordion.Impl");
128
+ const { __scopeAccordion, disabled, dir, orientation, ...accordionProps } = props;
129
+ const getItems = useCollection(__scopeAccordion, (0, import_internal.subSlot)(slot, "items"));
130
+ const isDirectionLTR = (dir ?? "ltr") === "ltr";
131
+ const handleKeyDown = (0, import_compose_event_handlers.composeEventHandlers)(accordionProps.onKeyDown, (event) => {
132
+ if (!ACCORDION_KEYS.includes(event.key)) return;
133
+ const target = event.target;
134
+ const triggerCollection = getItems().filter((item) => !item.ref.current?.disabled);
135
+ const triggerIndex = triggerCollection.findIndex((item) => item.ref.current === target);
136
+ const triggerCount = triggerCollection.length;
137
+ if (triggerIndex === -1) return;
138
+ event.preventDefault();
139
+ let nextIndex = triggerIndex;
140
+ const homeIndex = 0;
141
+ const endIndex = triggerCount - 1;
142
+ const moveNext = () => {
143
+ nextIndex = triggerIndex + 1;
144
+ if (nextIndex > endIndex) nextIndex = homeIndex;
145
+ };
146
+ const movePrev = () => {
147
+ nextIndex = triggerIndex - 1;
148
+ if (nextIndex < homeIndex) nextIndex = endIndex;
149
+ };
150
+ switch (event.key) {
151
+ case "Home":
152
+ nextIndex = homeIndex;
153
+ break;
154
+ case "End":
155
+ nextIndex = endIndex;
156
+ break;
157
+ case "ArrowRight":
158
+ if (orientation === "horizontal") {
159
+ if (isDirectionLTR) moveNext();
160
+ else movePrev();
161
+ }
162
+ break;
163
+ case "ArrowDown":
164
+ if (orientation === "vertical") moveNext();
165
+ break;
166
+ case "ArrowLeft":
167
+ if (orientation === "horizontal") {
168
+ if (isDirectionLTR) movePrev();
169
+ else moveNext();
170
+ }
171
+ break;
172
+ case "ArrowUp":
173
+ if (orientation === "vertical") movePrev();
174
+ break;
175
+ }
176
+ triggerCollection[nextIndex % triggerCount].ref.current?.focus();
177
+ });
178
+ return (0, import_octane.createElement)(Collection.Slot, {
179
+ scope: __scopeAccordion,
180
+ children: (0, import_octane.createElement)(import_Primitive.Primitive.div, {
181
+ ...accordionProps,
182
+ "data-orientation": orientation,
183
+ onKeyDown: disabled ? void 0 : handleKeyDown
184
+ })
185
+ });
186
+ }
187
+ function Item(props) {
188
+ const slot = (0, import_internal.S)("Accordion.Item");
189
+ const { __scopeAccordion, value: itemValue, disabled: itemDisabled, ...rest } = props ?? {};
190
+ const impl = useAccordionImplContext("AccordionItem", __scopeAccordion);
191
+ const valueCtx = useAccordionValueContext("AccordionItem", __scopeAccordion);
192
+ const collapsibleScope = useCollapsibleScope(__scopeAccordion, (0, import_internal.subSlot)(slot, "cscope"));
193
+ const triggerId = (0, import_useId.useId)((0, import_internal.subSlot)(slot, "id"));
194
+ const open = itemValue != null && valueCtx.value.includes(itemValue) || false;
195
+ const disabled = impl.disabled || itemDisabled || false;
196
+ return (0, import_octane.createElement)(AccordionItemProvider, {
197
+ scope: __scopeAccordion,
198
+ open,
199
+ disabled,
200
+ triggerId,
201
+ children: (0, import_octane.createElement)(Collapsible.Root, {
202
+ "data-orientation": impl.orientation,
203
+ "data-state": getState(open),
204
+ ...collapsibleScope,
205
+ ...rest,
206
+ disabled,
207
+ open,
208
+ onOpenChange: (isOpen) => {
209
+ if (isOpen) valueCtx.onItemOpen(itemValue);
210
+ else valueCtx.onItemClose(itemValue);
211
+ }
212
+ })
213
+ });
214
+ }
215
+ function Header(props) {
216
+ const { __scopeAccordion, ...rest } = props ?? {};
217
+ const impl = useAccordionImplContext("AccordionHeader", __scopeAccordion);
218
+ const item = useAccordionItemContext("AccordionHeader", __scopeAccordion);
219
+ return (0, import_octane.createElement)(import_Primitive.Primitive.h3, {
220
+ "data-orientation": impl.orientation,
221
+ "data-state": getState(item.open),
222
+ "data-disabled": item.disabled ? "" : void 0,
223
+ ...rest
224
+ });
225
+ }
226
+ function Trigger(props) {
227
+ const slot = (0, import_internal.S)("Accordion.Trigger");
228
+ const { __scopeAccordion, ...rest } = props ?? {};
229
+ const impl = useAccordionImplContext("AccordionTrigger", __scopeAccordion);
230
+ const item = useAccordionItemContext("AccordionTrigger", __scopeAccordion);
231
+ const collapsibleScope = useCollapsibleScope(__scopeAccordion, (0, import_internal.subSlot)(slot, "cscope"));
232
+ const ariaDisabled = item.open && !impl.isMultiple && !impl.collapsible || void 0;
233
+ return (0, import_octane.createElement)(Collection.ItemSlot, {
234
+ scope: __scopeAccordion,
235
+ children: (0, import_octane.createElement)(Collapsible.Trigger, {
236
+ "aria-disabled": ariaDisabled,
237
+ "data-orientation": impl.orientation,
238
+ id: item.triggerId,
239
+ ...collapsibleScope,
240
+ ...rest
241
+ })
242
+ });
243
+ }
244
+ function Content(props) {
245
+ const slot = (0, import_internal.S)("Accordion.Content");
246
+ const { __scopeAccordion, style, ...rest } = props ?? {};
247
+ const impl = useAccordionImplContext("AccordionContent", __scopeAccordion);
248
+ const item = useAccordionItemContext("AccordionContent", __scopeAccordion);
249
+ const collapsibleScope = useCollapsibleScope(__scopeAccordion, (0, import_internal.subSlot)(slot, "cscope"));
250
+ return (0, import_octane.createElement)(Collapsible.Content, {
251
+ role: "region",
252
+ "aria-labelledby": item.triggerId,
253
+ "data-orientation": impl.orientation,
254
+ ...collapsibleScope,
255
+ ...rest,
256
+ style: {
257
+ "--radix-accordion-content-height": "var(--radix-collapsible-content-height)",
258
+ "--radix-accordion-content-width": "var(--radix-collapsible-content-width)",
259
+ ...style
260
+ }
261
+ });
262
+ }
263
+ // Annotate the CommonJS export names for ESM import in node:
264
+ 0 && (module.exports = {
265
+ Accordion,
266
+ Content,
267
+ Header,
268
+ Item,
269
+ Root,
270
+ Trigger,
271
+ createAccordionScope
272
+ });
@@ -0,0 +1,144 @@
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 AlertDialog_exports = {};
30
+ __export(AlertDialog_exports, {
31
+ Action: () => Action,
32
+ AlertDialog: () => Root,
33
+ Cancel: () => Cancel,
34
+ Content: () => Content,
35
+ Description: () => Description,
36
+ Overlay: () => Overlay,
37
+ Portal: () => Portal,
38
+ Root: () => Root,
39
+ Title: () => Title,
40
+ Trigger: () => Trigger,
41
+ createAlertDialogScope: () => createAlertDialogScope
42
+ });
43
+ module.exports = __toCommonJS(AlertDialog_exports);
44
+ var import_octane = require("octane");
45
+ var import_compose_event_handlers = require("./compose-event-handlers.cjs");
46
+ var import_compose_refs = require("./compose-refs.cjs");
47
+ var import_context = require("./context.cjs");
48
+ var DialogPrimitive = __toESM(require("./Dialog.cjs"), 1);
49
+ var import_Dialog = require("./Dialog.cjs");
50
+ var import_internal = require("./internal.cjs");
51
+ const [createAlertDialogContext, createAlertDialogScope] = (0, import_context.createContextScope)("AlertDialog", [
52
+ import_Dialog.createDialogScope
53
+ ]);
54
+ const useDialogScope = (0, import_Dialog.createDialogScope)();
55
+ const [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext("AlertDialogContent");
56
+ function Root(props) {
57
+ const slot = (0, import_internal.S)("AlertDialog.Root");
58
+ const { __scopeAlertDialog, ...alertDialogProps } = props ?? {};
59
+ const dialogScope = useDialogScope(__scopeAlertDialog, (0, import_internal.subSlot)(slot, "scope"));
60
+ return (0, import_octane.createElement)(DialogPrimitive.Root, { ...dialogScope, ...alertDialogProps, modal: true });
61
+ }
62
+ function Trigger(props) {
63
+ const slot = (0, import_internal.S)("AlertDialog.Trigger");
64
+ const { __scopeAlertDialog, ...triggerProps } = props ?? {};
65
+ const dialogScope = useDialogScope(__scopeAlertDialog, (0, import_internal.subSlot)(slot, "scope"));
66
+ return (0, import_octane.createElement)(DialogPrimitive.Trigger, { ...dialogScope, ...triggerProps });
67
+ }
68
+ function Portal(props) {
69
+ const slot = (0, import_internal.S)("AlertDialog.Portal");
70
+ const { __scopeAlertDialog, ...portalProps } = props ?? {};
71
+ const dialogScope = useDialogScope(__scopeAlertDialog, (0, import_internal.subSlot)(slot, "scope"));
72
+ return (0, import_octane.createElement)(DialogPrimitive.Portal, { ...dialogScope, ...portalProps });
73
+ }
74
+ function Overlay(props) {
75
+ const slot = (0, import_internal.S)("AlertDialog.Overlay");
76
+ const { __scopeAlertDialog, ...overlayProps } = props ?? {};
77
+ const dialogScope = useDialogScope(__scopeAlertDialog, (0, import_internal.subSlot)(slot, "scope"));
78
+ return (0, import_octane.createElement)(DialogPrimitive.Overlay, { ...dialogScope, ...overlayProps });
79
+ }
80
+ function Content(props) {
81
+ const slot = (0, import_internal.S)("AlertDialog.Content");
82
+ const { __scopeAlertDialog, children, ref: forwardedRef, ...contentProps } = props ?? {};
83
+ const dialogScope = useDialogScope(__scopeAlertDialog, (0, import_internal.subSlot)(slot, "scope"));
84
+ const contentRef = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "content"));
85
+ const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef, (0, import_internal.subSlot)(slot, "refs"));
86
+ const cancelRef = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "cancel"));
87
+ return (0, import_octane.createElement)(AlertDialogContentProvider, {
88
+ scope: __scopeAlertDialog,
89
+ cancelRef,
90
+ children: (0, import_octane.createElement)(DialogPrimitive.Content, {
91
+ role: "alertdialog",
92
+ ...dialogScope,
93
+ ...contentProps,
94
+ ref: composedRefs,
95
+ onOpenAutoFocus: (0, import_compose_event_handlers.composeEventHandlers)(contentProps.onOpenAutoFocus, (event) => {
96
+ event.preventDefault();
97
+ cancelRef.current?.focus({ preventScroll: true });
98
+ }),
99
+ onPointerDownOutside: (event) => event.preventDefault(),
100
+ onInteractOutside: (event) => event.preventDefault(),
101
+ children
102
+ })
103
+ });
104
+ }
105
+ function Title(props) {
106
+ const slot = (0, import_internal.S)("AlertDialog.Title");
107
+ const { __scopeAlertDialog, ...titleProps } = props ?? {};
108
+ const dialogScope = useDialogScope(__scopeAlertDialog, (0, import_internal.subSlot)(slot, "scope"));
109
+ return (0, import_octane.createElement)(DialogPrimitive.Title, { ...dialogScope, ...titleProps });
110
+ }
111
+ function Description(props) {
112
+ const slot = (0, import_internal.S)("AlertDialog.Description");
113
+ const { __scopeAlertDialog, ...descriptionProps } = props ?? {};
114
+ const dialogScope = useDialogScope(__scopeAlertDialog, (0, import_internal.subSlot)(slot, "scope"));
115
+ return (0, import_octane.createElement)(DialogPrimitive.Description, { ...dialogScope, ...descriptionProps });
116
+ }
117
+ function Action(props) {
118
+ const slot = (0, import_internal.S)("AlertDialog.Action");
119
+ const { __scopeAlertDialog, ...actionProps } = props ?? {};
120
+ const dialogScope = useDialogScope(__scopeAlertDialog, (0, import_internal.subSlot)(slot, "scope"));
121
+ return (0, import_octane.createElement)(DialogPrimitive.Close, { ...dialogScope, ...actionProps });
122
+ }
123
+ function Cancel(props) {
124
+ const slot = (0, import_internal.S)("AlertDialog.Cancel");
125
+ const { __scopeAlertDialog, ref: forwardedRef, ...cancelProps } = props ?? {};
126
+ const { cancelRef } = useAlertDialogContentContext("AlertDialogCancel", __scopeAlertDialog);
127
+ const dialogScope = useDialogScope(__scopeAlertDialog, (0, import_internal.subSlot)(slot, "scope"));
128
+ const ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, cancelRef, (0, import_internal.subSlot)(slot, "refs"));
129
+ return (0, import_octane.createElement)(DialogPrimitive.Close, { ...dialogScope, ...cancelProps, ref });
130
+ }
131
+ // Annotate the CommonJS export names for ESM import in node:
132
+ 0 && (module.exports = {
133
+ Action,
134
+ AlertDialog,
135
+ Cancel,
136
+ Content,
137
+ Description,
138
+ Overlay,
139
+ Portal,
140
+ Root,
141
+ Title,
142
+ Trigger,
143
+ createAlertDialogScope
144
+ });
@@ -0,0 +1,43 @@
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 Arrow_exports = {};
20
+ __export(Arrow_exports, {
21
+ Arrow: () => Arrow,
22
+ Root: () => Arrow
23
+ });
24
+ module.exports = __toCommonJS(Arrow_exports);
25
+ var import_octane = require("octane");
26
+ var import_Primitive = require("./Primitive.cjs");
27
+ function Arrow(props) {
28
+ const { children, width = 10, height = 5, ...arrowProps } = props ?? {};
29
+ return (0, import_octane.createElement)(import_Primitive.Primitive.svg, {
30
+ ...arrowProps,
31
+ width,
32
+ height,
33
+ viewBox: "0 0 30 10",
34
+ preserveAspectRatio: "none",
35
+ // We use their children if they're slotting to replace the whole svg.
36
+ children: props?.asChild ? children : (0, import_octane.createElement)("polygon", { points: "0,0 30,0 15,10" })
37
+ });
38
+ }
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ Arrow,
42
+ Root
43
+ });
@@ -0,0 +1,56 @@
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 AspectRatio_exports = {};
20
+ __export(AspectRatio_exports, {
21
+ AspectRatio: () => AspectRatio,
22
+ Root: () => AspectRatio
23
+ });
24
+ module.exports = __toCommonJS(AspectRatio_exports);
25
+ var import_octane = require("octane");
26
+ var import_Primitive = require("./Primitive.cjs");
27
+ function AspectRatio(props) {
28
+ const { ratio = 1 / 1, style, ...aspectRatioProps } = props ?? {};
29
+ return (0, import_octane.createElement)("div", {
30
+ style: {
31
+ // ensures inner element is contained
32
+ position: "relative",
33
+ // ensures padding bottom trick maths works
34
+ width: "100%",
35
+ paddingBottom: `${100 / ratio}%`
36
+ },
37
+ "data-radix-aspect-ratio-wrapper": "",
38
+ children: (0, import_octane.createElement)(import_Primitive.Primitive.div, {
39
+ ...aspectRatioProps,
40
+ style: {
41
+ ...style,
42
+ // ensures children expand in ratio
43
+ position: "absolute",
44
+ top: 0,
45
+ right: 0,
46
+ bottom: 0,
47
+ left: 0
48
+ }
49
+ })
50
+ });
51
+ }
52
+ // Annotate the CommonJS export names for ESM import in node:
53
+ 0 && (module.exports = {
54
+ AspectRatio,
55
+ Root
56
+ });