@vritti/quantum-ui 0.6.0 → 0.6.1

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 (109) hide show
  1. package/dist/Alert.js +1 -1
  2. package/dist/Avatar.js +5 -5
  3. package/dist/Badge2.js +2 -2
  4. package/dist/Breadcrumb.js +1 -1
  5. package/dist/Button2.js +2 -2
  6. package/dist/Checkbox2.js +5 -5
  7. package/dist/DateTimePicker.js +1 -1
  8. package/dist/Dialog.js +1 -1
  9. package/dist/IconSelect.js +1 -1
  10. package/dist/Label.js +1 -1
  11. package/dist/Progress.js +2 -2
  12. package/dist/RadioGroup.js +7 -7
  13. package/dist/Select.js +1 -1
  14. package/dist/Sidebar.js +3 -3
  15. package/dist/Sonner.js +1 -1
  16. package/dist/Switch.js +5 -5
  17. package/dist/TabsSkeleton.js +2 -2
  18. package/dist/Toggle.js +2 -2
  19. package/dist/components/FormattedDate.js +1 -1
  20. package/dist/components/RichTextEditor.js +1 -1
  21. package/dist/components/TreeView.js +5 -5
  22. package/dist/dropdown-menu.js +9 -9
  23. package/dist/field.js +1 -1
  24. package/dist/image-component.js +1 -1
  25. package/dist/index.js +2 -2
  26. package/dist/index10.js +1499 -102
  27. package/dist/index10.js.map +1 -1
  28. package/dist/index11.js +37 -1499
  29. package/dist/index11.js.map +1 -1
  30. package/dist/index12.js +503 -28
  31. package/dist/index12.js.map +1 -1
  32. package/dist/index13.js +229 -454
  33. package/dist/index13.js.map +1 -1
  34. package/dist/index14.js +22 -281
  35. package/dist/index14.js.map +1 -1
  36. package/dist/index15.js +1139 -20
  37. package/dist/index15.js.map +1 -1
  38. package/dist/index16.js +14 -1139
  39. package/dist/index16.js.map +1 -1
  40. package/dist/index17.js +173 -19
  41. package/dist/index17.js.map +1 -1
  42. package/dist/index18.js +173 -168
  43. package/dist/index18.js.map +1 -1
  44. package/dist/index19.js +201 -171
  45. package/dist/index19.js.map +1 -1
  46. package/dist/index20.js +190 -186
  47. package/dist/index20.js.map +1 -1
  48. package/dist/index21.js +204 -202
  49. package/dist/index21.js.map +1 -1
  50. package/dist/index22.js +68 -209
  51. package/dist/index22.js.map +1 -1
  52. package/dist/index23.js +1128 -70
  53. package/dist/index23.js.map +1 -1
  54. package/dist/index24.js +4 -1133
  55. package/dist/index24.js.map +1 -1
  56. package/dist/index25.js +232 -4
  57. package/dist/index25.js.map +1 -1
  58. package/dist/index26.js +1100 -207
  59. package/dist/index26.js.map +1 -1
  60. package/dist/index27.js +2469 -1023
  61. package/dist/index27.js.map +1 -1
  62. package/dist/index28.js +35 -2569
  63. package/dist/index28.js.map +1 -1
  64. package/dist/index29.js +308 -36
  65. package/dist/index29.js.map +1 -1
  66. package/dist/index30.js +7 -307
  67. package/dist/index30.js.map +1 -1
  68. package/dist/index31.js +30 -8
  69. package/dist/index31.js.map +1 -1
  70. package/dist/index32.js +59 -29
  71. package/dist/index32.js.map +1 -1
  72. package/dist/index33.js +10 -59
  73. package/dist/index33.js.map +1 -1
  74. package/dist/index34.js +35347 -9
  75. package/dist/index34.js.map +1 -1
  76. package/dist/index35.js +72 -35342
  77. package/dist/index35.js.map +1 -1
  78. package/dist/index36.js +187 -72
  79. package/dist/index36.js.map +1 -1
  80. package/dist/index5.js +4 -4
  81. package/dist/index7.js +99 -13
  82. package/dist/index7.js.map +1 -1
  83. package/dist/index8.js +43 -99
  84. package/dist/index8.js.map +1 -1
  85. package/dist/index9.js +102 -42
  86. package/dist/index9.js.map +1 -1
  87. package/dist/lib/utils/timezone.d.ts +1 -0
  88. package/dist/lib/utils/timezone.d.ts.map +1 -1
  89. package/dist/popover.js +1 -1
  90. package/dist/select2.js +1 -1
  91. package/dist/separator2.js +1 -1
  92. package/dist/timezone.js +68 -0
  93. package/dist/timezone.js.map +1 -0
  94. package/dist/tooltip2.js +1 -1
  95. package/dist/useDataTable.js +1 -1
  96. package/dist/useTimer.js +1 -1
  97. package/dist/useWorkspaceTimeZone.js +1 -1
  98. package/dist/utils/axios.js +1 -1
  99. package/dist/utils/currency.js +2 -2
  100. package/dist/utils/format.js +1 -2
  101. package/dist/utils/format.js.map +1 -1
  102. package/dist/utils/money.js +1 -1
  103. package/dist/utils/motion.js +2 -2
  104. package/dist/utils/timezone.js +4 -51
  105. package/dist/utils/timezone.js.map +1 -1
  106. package/dist/value.js +1 -1
  107. package/package.json +1 -1
  108. package/dist/index37.js +0 -199
  109. package/dist/index37.js.map +0 -1
package/dist/index30.js CHANGED
@@ -1,313 +1,13 @@
1
1
  import * as React from 'react';
2
- import { u as useControllableState, P as Primitive, c as composeEventHandlers, a as createSlot } from './index20.js';
3
- import { u as useComposedRefs } from './index12.js';
4
- import { u as useId, P as Presence, c as createContextScope, a as createContext2 } from './index21.js';
5
- import { P as Portal$1, D as DismissableLayer } from './index26.js';
6
- import { h as hideOthers, R as ReactRemoveScroll, u as useFocusGuards, F as FocusScope } from './index27.js';
7
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
2
 
9
- var DIALOG_NAME = "Dialog";
10
- var [createDialogContext] = createContextScope(DIALOG_NAME);
11
- var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
12
- var Dialog = (props) => {
13
- const {
14
- __scopeDialog,
15
- children,
16
- open: openProp,
17
- defaultOpen,
18
- onOpenChange,
19
- modal = true
20
- } = props;
21
- const triggerRef = React.useRef(null);
22
- const contentRef = React.useRef(null);
23
- const [open, setOpen] = useControllableState({
24
- prop: openProp,
25
- defaultProp: defaultOpen ?? false,
26
- onChange: onOpenChange,
27
- caller: DIALOG_NAME
3
+ // packages/react/use-callback-ref/src/use-callback-ref.tsx
4
+ function useCallbackRef(callback) {
5
+ const callbackRef = React.useRef(callback);
6
+ React.useEffect(() => {
7
+ callbackRef.current = callback;
28
8
  });
29
- return /* @__PURE__ */ jsx(
30
- DialogProvider,
31
- {
32
- scope: __scopeDialog,
33
- triggerRef,
34
- contentRef,
35
- contentId: useId(),
36
- titleId: useId(),
37
- descriptionId: useId(),
38
- open,
39
- onOpenChange: setOpen,
40
- onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
41
- modal,
42
- children
43
- }
44
- );
45
- };
46
- Dialog.displayName = DIALOG_NAME;
47
- var TRIGGER_NAME = "DialogTrigger";
48
- var DialogTrigger = React.forwardRef(
49
- (props, forwardedRef) => {
50
- const { __scopeDialog, ...triggerProps } = props;
51
- const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
52
- const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
53
- return /* @__PURE__ */ jsx(
54
- Primitive.button,
55
- {
56
- type: "button",
57
- "aria-haspopup": "dialog",
58
- "aria-expanded": context.open,
59
- "aria-controls": context.contentId,
60
- "data-state": getState(context.open),
61
- ...triggerProps,
62
- ref: composedTriggerRef,
63
- onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
64
- }
65
- );
66
- }
67
- );
68
- DialogTrigger.displayName = TRIGGER_NAME;
69
- var PORTAL_NAME = "DialogPortal";
70
- var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
71
- forceMount: void 0
72
- });
73
- var DialogPortal = (props) => {
74
- const { __scopeDialog, forceMount, children, container } = props;
75
- const context = useDialogContext(PORTAL_NAME, __scopeDialog);
76
- return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: React.Children.map(children, (child) => /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal$1, { asChild: true, container, children: child }) })) });
77
- };
78
- DialogPortal.displayName = PORTAL_NAME;
79
- var OVERLAY_NAME = "DialogOverlay";
80
- var DialogOverlay = React.forwardRef(
81
- (props, forwardedRef) => {
82
- const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
83
- const { forceMount = portalContext.forceMount, ...overlayProps } = props;
84
- const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
85
- return context.modal ? /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
86
- }
87
- );
88
- DialogOverlay.displayName = OVERLAY_NAME;
89
- var Slot = createSlot("DialogOverlay.RemoveScroll");
90
- var DialogOverlayImpl = React.forwardRef(
91
- (props, forwardedRef) => {
92
- const { __scopeDialog, ...overlayProps } = props;
93
- const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
94
- return (
95
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
96
- // ie. when `Overlay` and `Content` are siblings
97
- /* @__PURE__ */ jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx(
98
- Primitive.div,
99
- {
100
- "data-state": getState(context.open),
101
- ...overlayProps,
102
- ref: forwardedRef,
103
- style: { pointerEvents: "auto", ...overlayProps.style }
104
- }
105
- ) })
106
- );
107
- }
108
- );
109
- var CONTENT_NAME = "DialogContent";
110
- var DialogContent = React.forwardRef(
111
- (props, forwardedRef) => {
112
- const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
113
- const { forceMount = portalContext.forceMount, ...contentProps } = props;
114
- const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
115
- return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
116
- }
117
- );
118
- DialogContent.displayName = CONTENT_NAME;
119
- var DialogContentModal = React.forwardRef(
120
- (props, forwardedRef) => {
121
- const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
122
- const contentRef = React.useRef(null);
123
- const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
124
- React.useEffect(() => {
125
- const content = contentRef.current;
126
- if (content) return hideOthers(content);
127
- }, []);
128
- return /* @__PURE__ */ jsx(
129
- DialogContentImpl,
130
- {
131
- ...props,
132
- ref: composedRefs,
133
- trapFocus: context.open,
134
- disableOutsidePointerEvents: true,
135
- onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
136
- event.preventDefault();
137
- context.triggerRef.current?.focus();
138
- }),
139
- onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
140
- const originalEvent = event.detail.originalEvent;
141
- const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
142
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
143
- if (isRightClick) event.preventDefault();
144
- }),
145
- onFocusOutside: composeEventHandlers(
146
- props.onFocusOutside,
147
- (event) => event.preventDefault()
148
- )
149
- }
150
- );
151
- }
152
- );
153
- var DialogContentNonModal = React.forwardRef(
154
- (props, forwardedRef) => {
155
- const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
156
- const hasInteractedOutsideRef = React.useRef(false);
157
- const hasPointerDownOutsideRef = React.useRef(false);
158
- return /* @__PURE__ */ jsx(
159
- DialogContentImpl,
160
- {
161
- ...props,
162
- ref: forwardedRef,
163
- trapFocus: false,
164
- disableOutsidePointerEvents: false,
165
- onCloseAutoFocus: (event) => {
166
- props.onCloseAutoFocus?.(event);
167
- if (!event.defaultPrevented) {
168
- if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
169
- event.preventDefault();
170
- }
171
- hasInteractedOutsideRef.current = false;
172
- hasPointerDownOutsideRef.current = false;
173
- },
174
- onInteractOutside: (event) => {
175
- props.onInteractOutside?.(event);
176
- if (!event.defaultPrevented) {
177
- hasInteractedOutsideRef.current = true;
178
- if (event.detail.originalEvent.type === "pointerdown") {
179
- hasPointerDownOutsideRef.current = true;
180
- }
181
- }
182
- const target = event.target;
183
- const targetIsTrigger = context.triggerRef.current?.contains(target);
184
- if (targetIsTrigger) event.preventDefault();
185
- if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
186
- event.preventDefault();
187
- }
188
- }
189
- }
190
- );
191
- }
192
- );
193
- var DialogContentImpl = React.forwardRef(
194
- (props, forwardedRef) => {
195
- const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
196
- const context = useDialogContext(CONTENT_NAME, __scopeDialog);
197
- const contentRef = React.useRef(null);
198
- const composedRefs = useComposedRefs(forwardedRef, contentRef);
199
- useFocusGuards();
200
- return /* @__PURE__ */ jsxs(Fragment, { children: [
201
- /* @__PURE__ */ jsx(
202
- FocusScope,
203
- {
204
- asChild: true,
205
- loop: true,
206
- trapped: trapFocus,
207
- onMountAutoFocus: onOpenAutoFocus,
208
- onUnmountAutoFocus: onCloseAutoFocus,
209
- children: /* @__PURE__ */ jsx(
210
- DismissableLayer,
211
- {
212
- role: "dialog",
213
- id: context.contentId,
214
- "aria-describedby": context.descriptionId,
215
- "aria-labelledby": context.titleId,
216
- "data-state": getState(context.open),
217
- ...contentProps,
218
- ref: composedRefs,
219
- onDismiss: () => context.onOpenChange(false)
220
- }
221
- )
222
- }
223
- ),
224
- /* @__PURE__ */ jsxs(Fragment, { children: [
225
- /* @__PURE__ */ jsx(TitleWarning, { titleId: context.titleId }),
226
- /* @__PURE__ */ jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
227
- ] })
228
- ] });
229
- }
230
- );
231
- var TITLE_NAME = "DialogTitle";
232
- var DialogTitle = React.forwardRef(
233
- (props, forwardedRef) => {
234
- const { __scopeDialog, ...titleProps } = props;
235
- const context = useDialogContext(TITLE_NAME, __scopeDialog);
236
- return /* @__PURE__ */ jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
237
- }
238
- );
239
- DialogTitle.displayName = TITLE_NAME;
240
- var DESCRIPTION_NAME = "DialogDescription";
241
- var DialogDescription = React.forwardRef(
242
- (props, forwardedRef) => {
243
- const { __scopeDialog, ...descriptionProps } = props;
244
- const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
245
- return /* @__PURE__ */ jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
246
- }
247
- );
248
- DialogDescription.displayName = DESCRIPTION_NAME;
249
- var CLOSE_NAME = "DialogClose";
250
- var DialogClose = React.forwardRef(
251
- (props, forwardedRef) => {
252
- const { __scopeDialog, ...closeProps } = props;
253
- const context = useDialogContext(CLOSE_NAME, __scopeDialog);
254
- return /* @__PURE__ */ jsx(
255
- Primitive.button,
256
- {
257
- type: "button",
258
- ...closeProps,
259
- ref: forwardedRef,
260
- onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
261
- }
262
- );
263
- }
264
- );
265
- DialogClose.displayName = CLOSE_NAME;
266
- function getState(open) {
267
- return open ? "open" : "closed";
9
+ return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
268
10
  }
269
- var TITLE_WARNING_NAME = "DialogTitleWarning";
270
- var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
271
- contentName: CONTENT_NAME,
272
- titleName: TITLE_NAME,
273
- docsSlug: "dialog"
274
- });
275
- var TitleWarning = ({ titleId }) => {
276
- const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
277
- const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
278
-
279
- If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
280
-
281
- For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
282
- React.useEffect(() => {
283
- if (titleId) {
284
- const hasTitle = document.getElementById(titleId);
285
- if (!hasTitle) console.error(MESSAGE);
286
- }
287
- }, [MESSAGE, titleId]);
288
- return null;
289
- };
290
- var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
291
- var DescriptionWarning = ({ contentRef, descriptionId }) => {
292
- const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
293
- const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
294
- React.useEffect(() => {
295
- const describedById = contentRef.current?.getAttribute("aria-describedby");
296
- if (descriptionId && describedById) {
297
- const hasDescription = document.getElementById(descriptionId);
298
- if (!hasDescription) console.warn(MESSAGE);
299
- }
300
- }, [MESSAGE, contentRef, descriptionId]);
301
- return null;
302
- };
303
- var Root = Dialog;
304
- var Trigger = DialogTrigger;
305
- var Portal = DialogPortal;
306
- var Overlay = DialogOverlay;
307
- var Content = DialogContent;
308
- var Title = DialogTitle;
309
- var Description = DialogDescription;
310
- var Close = DialogClose;
311
11
 
312
- export { Content as C, Description as D, Overlay as O, Portal as P, Root as R, Trigger as T, Close as a, Title as b };
12
+ export { useCallbackRef as u };
313
13
  //# sourceMappingURL=index30.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index30.js","sources":["../node_modules/.pnpm/@radix-ui+react-dialog@1.1.15_@types+react-dom@19.2.3_@types+react@19.2.14__@types+reac_759603dcb12523e99413fb21d5cebc08/node_modules/@radix-ui/react-dialog/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/dialog.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContext, createContextScope } from \"@radix-ui/react-context\";\nimport { useId } from \"@radix-ui/react-id\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { DismissableLayer } from \"@radix-ui/react-dismissable-layer\";\nimport { FocusScope } from \"@radix-ui/react-focus-scope\";\nimport { Portal as PortalPrimitive } from \"@radix-ui/react-portal\";\nimport { Presence } from \"@radix-ui/react-presence\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useFocusGuards } from \"@radix-ui/react-focus-guards\";\nimport { RemoveScroll } from \"react-remove-scroll\";\nimport { hideOthers } from \"aria-hidden\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nvar DIALOG_NAME = \"Dialog\";\nvar [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);\nvar [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);\nvar Dialog = (props) => {\n const {\n __scopeDialog,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true\n } = props;\n const triggerRef = React.useRef(null);\n const contentRef = React.useRef(null);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: DIALOG_NAME\n });\n return /* @__PURE__ */ jsx(\n DialogProvider,\n {\n scope: __scopeDialog,\n triggerRef,\n contentRef,\n contentId: useId(),\n titleId: useId(),\n descriptionId: useId(),\n open,\n onOpenChange: setOpen,\n onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),\n modal,\n children\n }\n );\n};\nDialog.displayName = DIALOG_NAME;\nvar TRIGGER_NAME = \"DialogTrigger\";\nvar DialogTrigger = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDialog, ...triggerProps } = props;\n const context = useDialogContext(TRIGGER_NAME, __scopeDialog);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n return /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": context.open,\n \"aria-controls\": context.contentId,\n \"data-state\": getState(context.open),\n ...triggerProps,\n ref: composedTriggerRef,\n onClick: composeEventHandlers(props.onClick, context.onOpenToggle)\n }\n );\n }\n);\nDialogTrigger.displayName = TRIGGER_NAME;\nvar PORTAL_NAME = \"DialogPortal\";\nvar [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {\n forceMount: void 0\n});\nvar DialogPortal = (props) => {\n const { __scopeDialog, forceMount, children, container } = props;\n const context = useDialogContext(PORTAL_NAME, __scopeDialog);\n return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: React.Children.map(children, (child) => /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(PortalPrimitive, { asChild: true, container, children: child }) })) });\n};\nDialogPortal.displayName = PORTAL_NAME;\nvar OVERLAY_NAME = \"DialogOverlay\";\nvar DialogOverlay = React.forwardRef(\n (props, forwardedRef) => {\n const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);\n return context.modal ? /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;\n }\n);\nDialogOverlay.displayName = OVERLAY_NAME;\nvar Slot = createSlot(\"DialogOverlay.RemoveScroll\");\nvar DialogOverlayImpl = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDialog, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, __scopeDialog);\n return (\n // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`\n // ie. when `Overlay` and `Content` are siblings\n /* @__PURE__ */ jsx(RemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n \"data-state\": getState(context.open),\n ...overlayProps,\n ref: forwardedRef,\n style: { pointerEvents: \"auto\", ...overlayProps.style }\n }\n ) })\n );\n }\n);\nvar CONTENT_NAME = \"DialogContent\";\nvar DialogContent = React.forwardRef(\n (props, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });\n }\n);\nDialogContent.displayName = CONTENT_NAME;\nvar DialogContentModal = React.forwardRef(\n (props, forwardedRef) => {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const contentRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n return /* @__PURE__ */ jsx(\n DialogContentImpl,\n {\n ...props,\n ref: composedRefs,\n trapFocus: context.open,\n disableOutsidePointerEvents: true,\n onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault();\n context.triggerRef.current?.focus();\n }),\n onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n if (isRightClick) event.preventDefault();\n }),\n onFocusOutside: composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault()\n )\n }\n );\n }\n);\nvar DialogContentNonModal = React.forwardRef(\n (props, forwardedRef) => {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const hasInteractedOutsideRef = React.useRef(false);\n const hasPointerDownOutsideRef = React.useRef(false);\n return /* @__PURE__ */ jsx(\n DialogContentImpl,\n {\n ...props,\n ref: forwardedRef,\n trapFocus: false,\n disableOutsidePointerEvents: false,\n onCloseAutoFocus: (event) => {\n props.onCloseAutoFocus?.(event);\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n event.preventDefault();\n }\n hasInteractedOutsideRef.current = false;\n hasPointerDownOutsideRef.current = false;\n },\n onInteractOutside: (event) => {\n props.onInteractOutside?.(event);\n if (!event.defaultPrevented) {\n hasInteractedOutsideRef.current = true;\n if (event.detail.originalEvent.type === \"pointerdown\") {\n hasPointerDownOutsideRef.current = true;\n }\n }\n const target = event.target;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n if (event.detail.originalEvent.type === \"focusin\" && hasPointerDownOutsideRef.current) {\n event.preventDefault();\n }\n }\n }\n );\n }\n);\nvar DialogContentImpl = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;\n const context = useDialogContext(CONTENT_NAME, __scopeDialog);\n const contentRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n useFocusGuards();\n return /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(\n FocusScope,\n {\n asChild: true,\n loop: true,\n trapped: trapFocus,\n onMountAutoFocus: onOpenAutoFocus,\n onUnmountAutoFocus: onCloseAutoFocus,\n children: /* @__PURE__ */ jsx(\n DismissableLayer,\n {\n role: \"dialog\",\n id: context.contentId,\n \"aria-describedby\": context.descriptionId,\n \"aria-labelledby\": context.titleId,\n \"data-state\": getState(context.open),\n ...contentProps,\n ref: composedRefs,\n onDismiss: () => context.onOpenChange(false)\n }\n )\n }\n ),\n /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(TitleWarning, { titleId: context.titleId }),\n /* @__PURE__ */ jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })\n ] })\n ] });\n }\n);\nvar TITLE_NAME = \"DialogTitle\";\nvar DialogTitle = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDialog, ...titleProps } = props;\n const context = useDialogContext(TITLE_NAME, __scopeDialog);\n return /* @__PURE__ */ jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });\n }\n);\nDialogTitle.displayName = TITLE_NAME;\nvar DESCRIPTION_NAME = \"DialogDescription\";\nvar DialogDescription = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDialog, ...descriptionProps } = props;\n const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);\n return /* @__PURE__ */ jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });\n }\n);\nDialogDescription.displayName = DESCRIPTION_NAME;\nvar CLOSE_NAME = \"DialogClose\";\nvar DialogClose = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDialog, ...closeProps } = props;\n const context = useDialogContext(CLOSE_NAME, __scopeDialog);\n return /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n ...closeProps,\n ref: forwardedRef,\n onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))\n }\n );\n }\n);\nDialogClose.displayName = CLOSE_NAME;\nfunction getState(open) {\n return open ? \"open\" : \"closed\";\n}\nvar TITLE_WARNING_NAME = \"DialogTitleWarning\";\nvar [WarningProvider, useWarningContext] = createContext(TITLE_WARNING_NAME, {\n contentName: CONTENT_NAME,\n titleName: TITLE_NAME,\n docsSlug: \"dialog\"\n});\nvar TitleWarning = ({ titleId }) => {\n const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);\n const MESSAGE = `\\`${titleWarningContext.contentName}\\` requires a \\`${titleWarningContext.titleName}\\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \\`${titleWarningContext.titleName}\\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;\n React.useEffect(() => {\n if (titleId) {\n const hasTitle = document.getElementById(titleId);\n if (!hasTitle) console.error(MESSAGE);\n }\n }, [MESSAGE, titleId]);\n return null;\n};\nvar DESCRIPTION_WARNING_NAME = \"DialogDescriptionWarning\";\nvar DescriptionWarning = ({ contentRef, descriptionId }) => {\n const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);\n const MESSAGE = `Warning: Missing \\`Description\\` or \\`aria-describedby={undefined}\\` for {${descriptionWarningContext.contentName}}.`;\n React.useEffect(() => {\n const describedById = contentRef.current?.getAttribute(\"aria-describedby\");\n if (descriptionId && describedById) {\n const hasDescription = document.getElementById(descriptionId);\n if (!hasDescription) console.warn(MESSAGE);\n }\n }, [MESSAGE, contentRef, descriptionId]);\n return null;\n};\nvar Root = Dialog;\nvar Trigger = DialogTrigger;\nvar Portal = DialogPortal;\nvar Overlay = DialogOverlay;\nvar Content = DialogContent;\nvar Title = DialogTitle;\nvar Description = DialogDescription;\nvar Close = DialogClose;\nexport {\n Close,\n Content,\n Description,\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n Overlay,\n Portal,\n Root,\n Title,\n Trigger,\n WarningProvider,\n createDialogScope\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["PortalPrimitive","RemoveScroll","createContext"],"mappings":";;;;;;;;AAmBA,IAAI,WAAW,GAAG,QAAQ;AAC1B,IAAI,CAAC,mBAAsC,CAAC,GAAG,kBAAkB,CAAC,WAAW,CAAC;AAC9E,IAAI,CAAC,cAAc,EAAE,gBAAgB,CAAC,GAAG,mBAAmB,CAAC,WAAW,CAAC;AACzE,IAAI,MAAM,GAAG,CAAC,KAAK,KAAK;AACxB,EAAE,MAAM;AACR,IAAI,aAAa;AACjB,IAAI,QAAQ;AACZ,IAAI,IAAI,EAAE,QAAQ;AAClB,IAAI,WAAW;AACf,IAAI,YAAY;AAChB,IAAI,KAAK,GAAG;AACZ,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;AACvC,EAAE,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;AACvC,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,oBAAoB,CAAC;AAC/C,IAAI,IAAI,EAAE,QAAQ;AAClB,IAAI,WAAW,EAAE,WAAW,IAAI,KAAK;AACrC,IAAI,QAAQ,EAAE,YAAY;AAC1B,IAAI,MAAM,EAAE;AACZ,GAAG,CAAC;AACJ,EAAE,uBAAuB,GAAG;AAC5B,IAAI,cAAc;AAClB,IAAI;AACJ,MAAM,KAAK,EAAE,aAAa;AAC1B,MAAM,UAAU;AAChB,MAAM,UAAU;AAChB,MAAM,SAAS,EAAE,KAAK,EAAE;A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EAAE,OAAO,CAAC,CAAC;AACxB,EAAE,OAAO,IAAI;AACb,CAAC;AACD,IAAI,wBAAwB,GAAG,0BAA0B;AACzD,IAAI,kBAAkB,GAAG,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK;AAC5D,EAAE,MAAM,yBAAyB,GAAG,iBAAiB,CAAC,wBAAwB,CAAC;AAC/E,EAAE,MAAM,OAAO,GAAG,CAAC,0EAA0E,EAAE,yBAAyB,CAAC,WAAW,CAAC,EAAE,CAAC;AACxI,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM;AACxB,IAAI,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,kBAAkB,CAAC;AAC9E,IAAI,IAAI,aAAa,IAAI,aAAa,EAAE;AACxC,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAC;AACnE,MAAM,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;AAChD,IAAI;AACJ,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;AAC1C,EAAE,OAAO,IAAI;AACb,CAAC;AACE,IAAC,IAAI,GAAG;AACR,IAAC,OAAO,GAAG;AACX,IAAC,MAAM,GAAG;AACV,IAAC,OAAO,GAAG;AACX,IAAC,OAAO,GAAG;AACX,IAAC,KAAK,GAAG;AACT,IAAC,WAAW,GAAG;AACf,IAAC,KAAK,GAAG;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index30.js","sources":["../node_modules/.pnpm/@radix-ui+react-use-callback-ref@1.1.1_@types+react@19.2.14_react@19.2.3/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs"],"sourcesContent":["// packages/react/use-callback-ref/src/use-callback-ref.tsx\nimport * as React from \"react\";\nfunction useCallbackRef(callback) {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);\n}\nexport {\n useCallbackRef\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;AAAA;AAEA,SAAS,cAAc,CAAC,QAAQ,EAAE;AAClC,EAAE,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;AAC5C,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM;AACxB,IAAI,WAAW,CAAC,OAAO,GAAG,QAAQ;AAClC,EAAE,CAAC,CAAC;AACJ,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,KAAK,WAAW,CAAC,OAAO,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAC7E;;;;","x_google_ignoreList":[0]}
package/dist/index31.js CHANGED
@@ -1,13 +1,35 @@
1
1
  import * as React from 'react';
2
+ import { u as useControllableState, P as Primitive, c as composeEventHandlers } from './index19.js';
3
+ import { jsx } from 'react/jsx-runtime';
2
4
 
3
- // packages/react/use-callback-ref/src/use-callback-ref.tsx
4
- function useCallbackRef(callback) {
5
- const callbackRef = React.useRef(callback);
6
- React.useEffect(() => {
7
- callbackRef.current = callback;
5
+ var NAME = "Toggle";
6
+ var Toggle = React.forwardRef((props, forwardedRef) => {
7
+ const { pressed: pressedProp, defaultPressed, onPressedChange, ...buttonProps } = props;
8
+ const [pressed, setPressed] = useControllableState({
9
+ prop: pressedProp,
10
+ onChange: onPressedChange,
11
+ defaultProp: defaultPressed ?? false,
12
+ caller: NAME
8
13
  });
9
- return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
10
- }
14
+ return /* @__PURE__ */ jsx(
15
+ Primitive.button,
16
+ {
17
+ type: "button",
18
+ "aria-pressed": pressed,
19
+ "data-state": pressed ? "on" : "off",
20
+ "data-disabled": props.disabled ? "" : void 0,
21
+ ...buttonProps,
22
+ ref: forwardedRef,
23
+ onClick: composeEventHandlers(props.onClick, () => {
24
+ if (!props.disabled) {
25
+ setPressed(!pressed);
26
+ }
27
+ })
28
+ }
29
+ );
30
+ });
31
+ Toggle.displayName = NAME;
32
+ var Root = Toggle;
11
33
 
12
- export { useCallbackRef as u };
34
+ export { Root as R, Toggle as T };
13
35
  //# sourceMappingURL=index31.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index31.js","sources":["../node_modules/.pnpm/@radix-ui+react-use-callback-ref@1.1.1_@types+react@19.2.14_react@19.2.3/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs"],"sourcesContent":["// packages/react/use-callback-ref/src/use-callback-ref.tsx\nimport * as React from \"react\";\nfunction useCallbackRef(callback) {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);\n}\nexport {\n useCallbackRef\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;AAAA;AAEA,SAAS,cAAc,CAAC,QAAQ,EAAE;AAClC,EAAE,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;AAC5C,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM;AACxB,IAAI,WAAW,CAAC,OAAO,GAAG,QAAQ;AAClC,EAAE,CAAC,CAAC;AACJ,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,KAAK,WAAW,CAAC,OAAO,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAC7E;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index31.js","sources":["../node_modules/.pnpm/@radix-ui+react-toggle@1.1.10_@types+react-dom@19.2.3_@types+react@19.2.14__@types+reac_02bb79b21a738a2104b8454b73513f70/node_modules/@radix-ui/react-toggle/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/toggle.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NAME = \"Toggle\";\nvar Toggle = React.forwardRef((props, forwardedRef) => {\n const { pressed: pressedProp, defaultPressed, onPressedChange, ...buttonProps } = props;\n const [pressed, setPressed] = useControllableState({\n prop: pressedProp,\n onChange: onPressedChange,\n defaultProp: defaultPressed ?? false,\n caller: NAME\n });\n return /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n \"aria-pressed\": pressed,\n \"data-state\": pressed ? \"on\" : \"off\",\n \"data-disabled\": props.disabled ? \"\" : void 0,\n ...buttonProps,\n ref: forwardedRef,\n onClick: composeEventHandlers(props.onClick, () => {\n if (!props.disabled) {\n setPressed(!pressed);\n }\n })\n }\n );\n});\nToggle.displayName = NAME;\nvar Root = Toggle;\nexport {\n Root,\n Toggle\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;;;AAQA,IAAI,IAAI,GAAG,QAAQ;AAChB,IAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,YAAY,KAAK;AACvD,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,WAAW,EAAE,GAAG,KAAK;AACzF,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,oBAAoB,CAAC;AACrD,IAAI,IAAI,EAAE,WAAW;AACrB,IAAI,QAAQ,EAAE,eAAe;AAC7B,IAAI,WAAW,EAAE,cAAc,IAAI,KAAK;AACxC,IAAI,MAAM,EAAE;AACZ,GAAG,CAAC;AACJ,EAAE,uBAAuB,GAAG;AAC5B,IAAI,SAAS,CAAC,MAAM;AACpB,IAAI;AACJ,MAAM,IAAI,EAAE,QAAQ;AACpB,MAAM,cAAc,EAAE,OAAO;AAC7B,MAAM,YAAY,EAAE,OAAO,GAAG,IAAI,GAAG,KAAK;AAC1C,MAAM,eAAe,EAAE,KAAK,CAAC,QAAQ,GAAG,EAAE,GAAG,MAAM;AACnD,MAAM,GAAG,WAAW;AACpB,MAAM,GAAG,EAAE,YAAY;AACvB,MAAM,OAAO,EAAE,oBAAoB,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM;AACzD,QAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;AAC7B,UAAU,UAAU,CAAC,CAAC,OAAO,CAAC;AAC9B,QAAQ;AACR,MAAM,CAAC;AACP;AACA,GAAG;AACH,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,IAAI;AACtB,IAAC,IAAI,GAAG;;;;","x_google_ignoreList":[0]}
package/dist/index32.js CHANGED
@@ -1,35 +1,65 @@
1
1
  import * as React from 'react';
2
- import { u as useControllableState, P as Primitive, c as composeEventHandlers } from './index20.js';
3
2
  import { jsx } from 'react/jsx-runtime';
4
3
 
5
- var NAME = "Toggle";
6
- var Toggle = React.forwardRef((props, forwardedRef) => {
7
- const { pressed: pressedProp, defaultPressed, onPressedChange, ...buttonProps } = props;
8
- const [pressed, setPressed] = useControllableState({
9
- prop: pressedProp,
10
- onChange: onPressedChange,
11
- defaultProp: defaultPressed ?? false,
12
- caller: NAME
13
- });
14
- return /* @__PURE__ */ jsx(
15
- Primitive.button,
16
- {
17
- type: "button",
18
- "aria-pressed": pressed,
19
- "data-state": pressed ? "on" : "off",
20
- "data-disabled": props.disabled ? "" : void 0,
21
- ...buttonProps,
22
- ref: forwardedRef,
23
- onClick: composeEventHandlers(props.onClick, () => {
24
- if (!props.disabled) {
25
- setPressed(!pressed);
26
- }
27
- })
4
+ // src/create-context.tsx
5
+ function createContextScope(scopeName, createContextScopeDeps = []) {
6
+ let defaultContexts = [];
7
+ function createContext3(rootComponentName, defaultContext) {
8
+ const BaseContext = React.createContext(defaultContext);
9
+ BaseContext.displayName = rootComponentName + "Context";
10
+ const index = defaultContexts.length;
11
+ defaultContexts = [...defaultContexts, defaultContext];
12
+ const Provider = (props) => {
13
+ const { scope, children, ...context } = props;
14
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
15
+ const value = React.useMemo(() => context, Object.values(context));
16
+ return /* @__PURE__ */ jsx(Context.Provider, { value, children });
17
+ };
18
+ Provider.displayName = rootComponentName + "Provider";
19
+ function useContext2(consumerName, scope) {
20
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
21
+ const context = React.useContext(Context);
22
+ if (context) return context;
23
+ if (defaultContext !== void 0) return defaultContext;
24
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
28
25
  }
29
- );
30
- });
31
- Toggle.displayName = NAME;
32
- var Root = Toggle;
26
+ return [Provider, useContext2];
27
+ }
28
+ const createScope = () => {
29
+ const scopeContexts = defaultContexts.map((defaultContext) => {
30
+ return React.createContext(defaultContext);
31
+ });
32
+ return function useScope(scope) {
33
+ const contexts = scope?.[scopeName] || scopeContexts;
34
+ return React.useMemo(
35
+ () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
36
+ [scope, contexts]
37
+ );
38
+ };
39
+ };
40
+ createScope.scopeName = scopeName;
41
+ return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
42
+ }
43
+ function composeContextScopes(...scopes) {
44
+ const baseScope = scopes[0];
45
+ if (scopes.length === 1) return baseScope;
46
+ const createScope = () => {
47
+ const scopeHooks = scopes.map((createScope2) => ({
48
+ useScope: createScope2(),
49
+ scopeName: createScope2.scopeName
50
+ }));
51
+ return function useComposedScopes(overrideScopes) {
52
+ const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
53
+ const scopeProps = useScope(overrideScopes);
54
+ const currentScope = scopeProps[`__scope${scopeName}`];
55
+ return { ...nextScopes2, ...currentScope };
56
+ }, {});
57
+ return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
58
+ };
59
+ };
60
+ createScope.scopeName = baseScope.scopeName;
61
+ return createScope;
62
+ }
33
63
 
34
- export { Root as R, Toggle as T };
64
+ export { createContextScope as c };
35
65
  //# sourceMappingURL=index32.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index32.js","sources":["../node_modules/.pnpm/@radix-ui+react-toggle@1.1.10_@types+react-dom@19.2.3_@types+react@19.2.14__@types+reac_02bb79b21a738a2104b8454b73513f70/node_modules/@radix-ui/react-toggle/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/toggle.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NAME = \"Toggle\";\nvar Toggle = React.forwardRef((props, forwardedRef) => {\n const { pressed: pressedProp, defaultPressed, onPressedChange, ...buttonProps } = props;\n const [pressed, setPressed] = useControllableState({\n prop: pressedProp,\n onChange: onPressedChange,\n defaultProp: defaultPressed ?? false,\n caller: NAME\n });\n return /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n \"aria-pressed\": pressed,\n \"data-state\": pressed ? \"on\" : \"off\",\n \"data-disabled\": props.disabled ? \"\" : void 0,\n ...buttonProps,\n ref: forwardedRef,\n onClick: composeEventHandlers(props.onClick, () => {\n if (!props.disabled) {\n setPressed(!pressed);\n }\n })\n }\n );\n});\nToggle.displayName = NAME;\nvar Root = Toggle;\nexport {\n Root,\n Toggle\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;;;AAQA,IAAI,IAAI,GAAG,QAAQ;AAChB,IAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,YAAY,KAAK;AACvD,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,WAAW,EAAE,GAAG,KAAK;AACzF,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,oBAAoB,CAAC;AACrD,IAAI,IAAI,EAAE,WAAW;AACrB,IAAI,QAAQ,EAAE,eAAe;AAC7B,IAAI,WAAW,EAAE,cAAc,IAAI,KAAK;AACxC,IAAI,MAAM,EAAE;AACZ,GAAG,CAAC;AACJ,EAAE,uBAAuB,GAAG;AAC5B,IAAI,SAAS,CAAC,MAAM;AACpB,IAAI;AACJ,MAAM,IAAI,EAAE,QAAQ;AACpB,MAAM,cAAc,EAAE,OAAO;AAC7B,MAAM,YAAY,EAAE,OAAO,GAAG,IAAI,GAAG,KAAK;AAC1C,MAAM,eAAe,EAAE,KAAK,CAAC,QAAQ,GAAG,EAAE,GAAG,MAAM;AACnD,MAAM,GAAG,WAAW;AACpB,MAAM,GAAG,EAAE,YAAY;AACvB,MAAM,OAAO,EAAE,oBAAoB,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM;AACzD,QAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;AAC7B,UAAU,UAAU,CAAC,CAAC,OAAO,CAAC;AAC9B,QAAQ;AACR,MAAM,CAAC;AACP;AACA,GAAG;AACH,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,IAAI;AACtB,IAAC,IAAI,GAAG;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index32.js","sources":["../node_modules/.pnpm/@radix-ui+react-context@1.1.3_@types+react@19.2.14_react@19.2.3/node_modules/@radix-ui/react-context/dist/index.mjs"],"sourcesContent":["// src/create-context.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createContext2(rootComponentName, defaultContext) {\n const Context = React.createContext(defaultContext);\n Context.displayName = rootComponentName + \"Context\";\n const Provider = (props) => {\n const { children, ...context } = props;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n };\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName) {\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n return [Provider, useContext2];\n}\nfunction createContextScope(scopeName, createContextScopeDeps = []) {\n let defaultContexts = [];\n function createContext3(rootComponentName, defaultContext) {\n const BaseContext = React.createContext(defaultContext);\n BaseContext.displayName = rootComponentName + \"Context\";\n const index = defaultContexts.length;\n defaultContexts = [...defaultContexts, defaultContext];\n const Provider = (props) => {\n const { scope, children, ...context } = props;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n };\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName, scope) {\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n return [Provider, useContext2];\n }\n const createScope = () => {\n const scopeContexts = defaultContexts.map((defaultContext) => {\n return React.createContext(defaultContext);\n });\n return function useScope(scope) {\n const contexts = scope?.[scopeName] || scopeContexts;\n return React.useMemo(\n () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),\n [scope, contexts]\n );\n };\n };\n createScope.scopeName = scopeName;\n return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];\n}\nfunction composeContextScopes(...scopes) {\n const baseScope = scopes[0];\n if (scopes.length === 1) return baseScope;\n const createScope = () => {\n const scopeHooks = scopes.map((createScope2) => ({\n useScope: createScope2(),\n scopeName: createScope2.scopeName\n }));\n return function useComposedScopes(overrideScopes) {\n const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {\n const scopeProps = useScope(overrideScopes);\n const currentScope = scopeProps[`__scope${scopeName}`];\n return { ...nextScopes2, ...currentScope };\n }, {});\n return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);\n };\n };\n createScope.scopeName = baseScope.scopeName;\n return createScope;\n}\nexport {\n createContext2 as createContext,\n createContextScope\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;;A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;AACP,IAAI,OAAO,SAAS,iBAAiB,CAAC,cAAc,EAAE;AACtD,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK;AACrF,QAAQ,MAAM,UAAU,GAAG,QAAQ,CAAC,cAAc,CAAC;AACnD,QAAQ,MAAM,YAAY,GAAG,UAAU,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;AAC9D,QAAQ,OAAO,EAAE,GAAG,WAAW,EAAE,GAAG,YAAY,EAAE;AAClD,MAAM,CAAC,EAAE,EAAE,CAAC;AACZ,MAAM,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;AACnG,IAAI,CAAC;AACL,EAAE,CAAC;AACH,EAAE,WAAW,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS;AAC7C,EAAE,OAAO,WAAW;AACpB;;;;","x_google_ignoreList":[0]}
package/dist/index33.js CHANGED
@@ -1,65 +1,16 @@
1
1
  import * as React from 'react';
2
- import { jsx } from 'react/jsx-runtime';
3
2
 
4
- // src/create-context.tsx
5
- function createContextScope(scopeName, createContextScopeDeps = []) {
6
- let defaultContexts = [];
7
- function createContext3(rootComponentName, defaultContext) {
8
- const BaseContext = React.createContext(defaultContext);
9
- BaseContext.displayName = rootComponentName + "Context";
10
- const index = defaultContexts.length;
11
- defaultContexts = [...defaultContexts, defaultContext];
12
- const Provider = (props) => {
13
- const { scope, children, ...context } = props;
14
- const Context = scope?.[scopeName]?.[index] || BaseContext;
15
- const value = React.useMemo(() => context, Object.values(context));
16
- return /* @__PURE__ */ jsx(Context.Provider, { value, children });
17
- };
18
- Provider.displayName = rootComponentName + "Provider";
19
- function useContext2(consumerName, scope) {
20
- const Context = scope?.[scopeName]?.[index] || BaseContext;
21
- const context = React.useContext(Context);
22
- if (context) return context;
23
- if (defaultContext !== void 0) return defaultContext;
24
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
3
+ // packages/react/use-previous/src/use-previous.tsx
4
+ function usePrevious(value) {
5
+ const ref = React.useRef({ value, previous: value });
6
+ return React.useMemo(() => {
7
+ if (ref.current.value !== value) {
8
+ ref.current.previous = ref.current.value;
9
+ ref.current.value = value;
25
10
  }
26
- return [Provider, useContext2];
27
- }
28
- const createScope = () => {
29
- const scopeContexts = defaultContexts.map((defaultContext) => {
30
- return React.createContext(defaultContext);
31
- });
32
- return function useScope(scope) {
33
- const contexts = scope?.[scopeName] || scopeContexts;
34
- return React.useMemo(
35
- () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
36
- [scope, contexts]
37
- );
38
- };
39
- };
40
- createScope.scopeName = scopeName;
41
- return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
42
- }
43
- function composeContextScopes(...scopes) {
44
- const baseScope = scopes[0];
45
- if (scopes.length === 1) return baseScope;
46
- const createScope = () => {
47
- const scopeHooks = scopes.map((createScope2) => ({
48
- useScope: createScope2(),
49
- scopeName: createScope2.scopeName
50
- }));
51
- return function useComposedScopes(overrideScopes) {
52
- const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
53
- const scopeProps = useScope(overrideScopes);
54
- const currentScope = scopeProps[`__scope${scopeName}`];
55
- return { ...nextScopes2, ...currentScope };
56
- }, {});
57
- return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
58
- };
59
- };
60
- createScope.scopeName = baseScope.scopeName;
61
- return createScope;
11
+ return ref.current.previous;
12
+ }, [value]);
62
13
  }
63
14
 
64
- export { createContextScope as c };
15
+ export { usePrevious as u };
65
16
  //# sourceMappingURL=index33.js.map