@vritti/quantum-ui 0.3.5 → 0.3.7

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 (114) hide show
  1. package/dist/Avatar.js +5 -5
  2. package/dist/Checkbox2.js +2 -2
  3. package/dist/Combination.js +1 -1
  4. package/dist/ConfirmContext.js +20 -1
  5. package/dist/ConfirmContext.js.map +1 -1
  6. package/dist/Dialog.js +24 -38
  7. package/dist/Dialog.js.map +1 -1
  8. package/dist/DropdownMenu.js +1 -0
  9. package/dist/DropdownMenu.js.map +1 -1
  10. package/dist/Progress.js +2 -2
  11. package/dist/RadioGroup.js +2 -2
  12. package/dist/Sidebar.js +1 -1
  13. package/dist/Switch.js +19 -16
  14. package/dist/Switch.js.map +1 -1
  15. package/dist/TabsSkeleton.js +1 -1
  16. package/dist/TextField.js +64 -45
  17. package/dist/TextField.js.map +1 -1
  18. package/dist/Toggle.js +1 -1
  19. package/dist/ViewTabs.js +1 -2
  20. package/dist/ViewTabs.js.map +1 -1
  21. package/dist/assets/quantum-ui.css +13 -16
  22. package/dist/cells.js +50 -21
  23. package/dist/cells.js.map +1 -1
  24. package/dist/components/Dialog.js +1 -1
  25. package/dist/components/RichTextEditor.js +1 -1
  26. package/dist/dropdown-menu.js +3 -2
  27. package/dist/dropdown-menu.js.map +1 -1
  28. package/dist/image-component.js +1 -1
  29. package/dist/index.js +2 -3
  30. package/dist/index.js.map +1 -1
  31. package/dist/index12.js +3 -2
  32. package/dist/index12.js.map +1 -1
  33. package/dist/index13.js +2 -1
  34. package/dist/index13.js.map +1 -1
  35. package/dist/index14.js +6 -5
  36. package/dist/index14.js.map +1 -1
  37. package/dist/index15.js +1 -1
  38. package/dist/index16.js +1 -1
  39. package/dist/index18.js +1 -1
  40. package/dist/index20.js +1 -1
  41. package/dist/index21.js +1 -1
  42. package/dist/index23.js +1 -1
  43. package/dist/index25.js +3 -2534
  44. package/dist/index25.js.map +1 -1
  45. package/dist/index26.js +2526 -22
  46. package/dist/index26.js.map +1 -1
  47. package/dist/index27.js +32 -4
  48. package/dist/index27.js.map +1 -1
  49. package/dist/index28.js +4 -37
  50. package/dist/index28.js.map +1 -1
  51. package/dist/index29.js +36 -310
  52. package/dist/index29.js.map +1 -1
  53. package/dist/index30.js +309 -7
  54. package/dist/index30.js.map +1 -1
  55. package/dist/index31.js +8 -30
  56. package/dist/index31.js.map +1 -1
  57. package/dist/index32.js +29 -59
  58. package/dist/index32.js.map +1 -1
  59. package/dist/index33.js +59 -10
  60. package/dist/index33.js.map +1 -1
  61. package/dist/index34.js +10 -35
  62. package/dist/index34.js.map +1 -1
  63. package/dist/index35.js +27 -36810
  64. package/dist/index35.js.map +1 -1
  65. package/dist/index36.js +36809 -70
  66. package/dist/index36.js.map +1 -1
  67. package/dist/index37.js +72 -187
  68. package/dist/index37.js.map +1 -1
  69. package/dist/index38.js +199 -0
  70. package/dist/index38.js.map +1 -0
  71. package/dist/index4.js +1 -1
  72. package/dist/lib/components/DataTable/components/DataTableImportDialog.d.ts.map +1 -1
  73. package/dist/lib/components/DataTable/components/DataTableViewTabs.d.ts.map +1 -1
  74. package/dist/lib/components/DataTable/components/DataTableViewsMenu.d.ts.map +1 -1
  75. package/dist/lib/components/DataTable/components/RowActions.d.ts.map +1 -1
  76. package/dist/lib/components/Dialog/Dialog.d.ts +15 -16
  77. package/dist/lib/components/Dialog/Dialog.d.ts.map +1 -1
  78. package/dist/lib/components/Dialog/index.d.ts +2 -2
  79. package/dist/lib/components/Dialog/index.d.ts.map +1 -1
  80. package/dist/lib/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  81. package/dist/lib/components/DropdownMenu/types.d.ts +2 -1
  82. package/dist/lib/components/DropdownMenu/types.d.ts.map +1 -1
  83. package/dist/lib/components/Switch/Switch.d.ts.map +1 -1
  84. package/dist/lib/components/TextField/TextField.d.ts.map +1 -1
  85. package/dist/lib/context/ConfirmContext.d.ts.map +1 -1
  86. package/dist/lib/selects/index.d.ts +0 -1
  87. package/dist/lib/selects/index.d.ts.map +1 -1
  88. package/dist/lib/selects/tax-group/TaxGroupFilter.d.ts +12 -0
  89. package/dist/lib/selects/tax-group/TaxGroupFilter.d.ts.map +1 -0
  90. package/dist/lib/selects/tax-group/TaxGroupSelector.d.ts +4 -0
  91. package/dist/lib/selects/tax-group/TaxGroupSelector.d.ts.map +1 -0
  92. package/dist/lib/selects/tax-group/index.d.ts +3 -0
  93. package/dist/lib/selects/tax-group/index.d.ts.map +1 -0
  94. package/dist/selects/tax-group.js +37 -0
  95. package/dist/selects/tax-group.js.map +1 -0
  96. package/dist/shadcn/shadcnSwitch/Switch.d.ts +1 -1
  97. package/dist/shadcn/shadcnSwitch/Switch.d.ts.map +1 -1
  98. package/dist/trash-2.js +17 -3
  99. package/dist/trash-2.js.map +1 -1
  100. package/dist/utils/motion.js +2 -2
  101. package/dist/value.js +1 -1
  102. package/package.json +5 -5
  103. package/dist/BomSelector.js +0 -37
  104. package/dist/BomSelector.js.map +0 -1
  105. package/dist/lib/selects/bom/BomFilter.d.ts +0 -12
  106. package/dist/lib/selects/bom/BomFilter.d.ts.map +0 -1
  107. package/dist/lib/selects/bom/BomSelector.d.ts +0 -4
  108. package/dist/lib/selects/bom/BomSelector.d.ts.map +0 -1
  109. package/dist/lib/selects/bom/index.d.ts +0 -3
  110. package/dist/lib/selects/bom/index.d.ts.map +0 -1
  111. package/dist/plus.js +0 -18
  112. package/dist/plus.js.map +0 -1
  113. package/dist/selects/bom.js +0 -2
  114. package/dist/selects/bom.js.map +0 -1
package/dist/index30.js CHANGED
@@ -1,13 +1,315 @@
1
1
  import * as React from 'react';
2
+ import { u as useControllableState, P as Primitive, c as composeEventHandlers, b as createSlot } from './index18.js';
3
+ import { u as useComposedRefs } from './index11.js';
4
+ import { c as createContextScope, a as createContext2 } from './index19.js';
5
+ import { u as useId } from './index23.js';
6
+ import { P as Portal$1, D as DismissableLayer } from './index25.js';
7
+ import { h as hideOthers, R as ReactRemoveScroll, u as useFocusGuards, F as FocusScope } from './Combination.js';
8
+ import { P as Presence } from './index21.js';
9
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
10
 
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;
11
+ var DIALOG_NAME = "Dialog";
12
+ var [createDialogContext] = createContextScope(DIALOG_NAME);
13
+ var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
14
+ var Dialog = (props) => {
15
+ const {
16
+ __scopeDialog,
17
+ children,
18
+ open: openProp,
19
+ defaultOpen,
20
+ onOpenChange,
21
+ modal = true
22
+ } = props;
23
+ const triggerRef = React.useRef(null);
24
+ const contentRef = React.useRef(null);
25
+ const [open, setOpen] = useControllableState({
26
+ prop: openProp,
27
+ defaultProp: defaultOpen ?? false,
28
+ onChange: onOpenChange,
29
+ caller: DIALOG_NAME
8
30
  });
9
- return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
31
+ return /* @__PURE__ */ jsx(
32
+ DialogProvider,
33
+ {
34
+ scope: __scopeDialog,
35
+ triggerRef,
36
+ contentRef,
37
+ contentId: useId(),
38
+ titleId: useId(),
39
+ descriptionId: useId(),
40
+ open,
41
+ onOpenChange: setOpen,
42
+ onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
43
+ modal,
44
+ children
45
+ }
46
+ );
47
+ };
48
+ Dialog.displayName = DIALOG_NAME;
49
+ var TRIGGER_NAME = "DialogTrigger";
50
+ var DialogTrigger = React.forwardRef(
51
+ (props, forwardedRef) => {
52
+ const { __scopeDialog, ...triggerProps } = props;
53
+ const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
54
+ const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
55
+ return /* @__PURE__ */ jsx(
56
+ Primitive.button,
57
+ {
58
+ type: "button",
59
+ "aria-haspopup": "dialog",
60
+ "aria-expanded": context.open,
61
+ "aria-controls": context.contentId,
62
+ "data-state": getState(context.open),
63
+ ...triggerProps,
64
+ ref: composedTriggerRef,
65
+ onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
66
+ }
67
+ );
68
+ }
69
+ );
70
+ DialogTrigger.displayName = TRIGGER_NAME;
71
+ var PORTAL_NAME = "DialogPortal";
72
+ var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
73
+ forceMount: void 0
74
+ });
75
+ var DialogPortal = (props) => {
76
+ const { __scopeDialog, forceMount, children, container } = props;
77
+ const context = useDialogContext(PORTAL_NAME, __scopeDialog);
78
+ 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 }) })) });
79
+ };
80
+ DialogPortal.displayName = PORTAL_NAME;
81
+ var OVERLAY_NAME = "DialogOverlay";
82
+ var DialogOverlay = React.forwardRef(
83
+ (props, forwardedRef) => {
84
+ const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
85
+ const { forceMount = portalContext.forceMount, ...overlayProps } = props;
86
+ const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
87
+ return context.modal ? /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
88
+ }
89
+ );
90
+ DialogOverlay.displayName = OVERLAY_NAME;
91
+ var Slot = createSlot("DialogOverlay.RemoveScroll");
92
+ var DialogOverlayImpl = React.forwardRef(
93
+ (props, forwardedRef) => {
94
+ const { __scopeDialog, ...overlayProps } = props;
95
+ const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
96
+ return (
97
+ // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
98
+ // ie. when `Overlay` and `Content` are siblings
99
+ /* @__PURE__ */ jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx(
100
+ Primitive.div,
101
+ {
102
+ "data-state": getState(context.open),
103
+ ...overlayProps,
104
+ ref: forwardedRef,
105
+ style: { pointerEvents: "auto", ...overlayProps.style }
106
+ }
107
+ ) })
108
+ );
109
+ }
110
+ );
111
+ var CONTENT_NAME = "DialogContent";
112
+ var DialogContent = React.forwardRef(
113
+ (props, forwardedRef) => {
114
+ const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
115
+ const { forceMount = portalContext.forceMount, ...contentProps } = props;
116
+ const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
117
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
118
+ }
119
+ );
120
+ DialogContent.displayName = CONTENT_NAME;
121
+ var DialogContentModal = React.forwardRef(
122
+ (props, forwardedRef) => {
123
+ const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
124
+ const contentRef = React.useRef(null);
125
+ const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
126
+ React.useEffect(() => {
127
+ const content = contentRef.current;
128
+ if (content) return hideOthers(content);
129
+ }, []);
130
+ return /* @__PURE__ */ jsx(
131
+ DialogContentImpl,
132
+ {
133
+ ...props,
134
+ ref: composedRefs,
135
+ trapFocus: context.open,
136
+ disableOutsidePointerEvents: true,
137
+ onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
138
+ event.preventDefault();
139
+ context.triggerRef.current?.focus();
140
+ }),
141
+ onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
142
+ const originalEvent = event.detail.originalEvent;
143
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
144
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
145
+ if (isRightClick) event.preventDefault();
146
+ }),
147
+ onFocusOutside: composeEventHandlers(
148
+ props.onFocusOutside,
149
+ (event) => event.preventDefault()
150
+ )
151
+ }
152
+ );
153
+ }
154
+ );
155
+ var DialogContentNonModal = React.forwardRef(
156
+ (props, forwardedRef) => {
157
+ const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
158
+ const hasInteractedOutsideRef = React.useRef(false);
159
+ const hasPointerDownOutsideRef = React.useRef(false);
160
+ return /* @__PURE__ */ jsx(
161
+ DialogContentImpl,
162
+ {
163
+ ...props,
164
+ ref: forwardedRef,
165
+ trapFocus: false,
166
+ disableOutsidePointerEvents: false,
167
+ onCloseAutoFocus: (event) => {
168
+ props.onCloseAutoFocus?.(event);
169
+ if (!event.defaultPrevented) {
170
+ if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
171
+ event.preventDefault();
172
+ }
173
+ hasInteractedOutsideRef.current = false;
174
+ hasPointerDownOutsideRef.current = false;
175
+ },
176
+ onInteractOutside: (event) => {
177
+ props.onInteractOutside?.(event);
178
+ if (!event.defaultPrevented) {
179
+ hasInteractedOutsideRef.current = true;
180
+ if (event.detail.originalEvent.type === "pointerdown") {
181
+ hasPointerDownOutsideRef.current = true;
182
+ }
183
+ }
184
+ const target = event.target;
185
+ const targetIsTrigger = context.triggerRef.current?.contains(target);
186
+ if (targetIsTrigger) event.preventDefault();
187
+ if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
188
+ event.preventDefault();
189
+ }
190
+ }
191
+ }
192
+ );
193
+ }
194
+ );
195
+ var DialogContentImpl = React.forwardRef(
196
+ (props, forwardedRef) => {
197
+ const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
198
+ const context = useDialogContext(CONTENT_NAME, __scopeDialog);
199
+ const contentRef = React.useRef(null);
200
+ const composedRefs = useComposedRefs(forwardedRef, contentRef);
201
+ useFocusGuards();
202
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
203
+ /* @__PURE__ */ jsx(
204
+ FocusScope,
205
+ {
206
+ asChild: true,
207
+ loop: true,
208
+ trapped: trapFocus,
209
+ onMountAutoFocus: onOpenAutoFocus,
210
+ onUnmountAutoFocus: onCloseAutoFocus,
211
+ children: /* @__PURE__ */ jsx(
212
+ DismissableLayer,
213
+ {
214
+ role: "dialog",
215
+ id: context.contentId,
216
+ "aria-describedby": context.descriptionId,
217
+ "aria-labelledby": context.titleId,
218
+ "data-state": getState(context.open),
219
+ ...contentProps,
220
+ ref: composedRefs,
221
+ onDismiss: () => context.onOpenChange(false)
222
+ }
223
+ )
224
+ }
225
+ ),
226
+ /* @__PURE__ */ jsxs(Fragment, { children: [
227
+ /* @__PURE__ */ jsx(TitleWarning, { titleId: context.titleId }),
228
+ /* @__PURE__ */ jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
229
+ ] })
230
+ ] });
231
+ }
232
+ );
233
+ var TITLE_NAME = "DialogTitle";
234
+ var DialogTitle = React.forwardRef(
235
+ (props, forwardedRef) => {
236
+ const { __scopeDialog, ...titleProps } = props;
237
+ const context = useDialogContext(TITLE_NAME, __scopeDialog);
238
+ return /* @__PURE__ */ jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
239
+ }
240
+ );
241
+ DialogTitle.displayName = TITLE_NAME;
242
+ var DESCRIPTION_NAME = "DialogDescription";
243
+ var DialogDescription = React.forwardRef(
244
+ (props, forwardedRef) => {
245
+ const { __scopeDialog, ...descriptionProps } = props;
246
+ const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
247
+ return /* @__PURE__ */ jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
248
+ }
249
+ );
250
+ DialogDescription.displayName = DESCRIPTION_NAME;
251
+ var CLOSE_NAME = "DialogClose";
252
+ var DialogClose = React.forwardRef(
253
+ (props, forwardedRef) => {
254
+ const { __scopeDialog, ...closeProps } = props;
255
+ const context = useDialogContext(CLOSE_NAME, __scopeDialog);
256
+ return /* @__PURE__ */ jsx(
257
+ Primitive.button,
258
+ {
259
+ type: "button",
260
+ ...closeProps,
261
+ ref: forwardedRef,
262
+ onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
263
+ }
264
+ );
265
+ }
266
+ );
267
+ DialogClose.displayName = CLOSE_NAME;
268
+ function getState(open) {
269
+ return open ? "open" : "closed";
10
270
  }
271
+ var TITLE_WARNING_NAME = "DialogTitleWarning";
272
+ var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
273
+ contentName: CONTENT_NAME,
274
+ titleName: TITLE_NAME,
275
+ docsSlug: "dialog"
276
+ });
277
+ var TitleWarning = ({ titleId }) => {
278
+ const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
279
+ const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
280
+
281
+ If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
282
+
283
+ For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
284
+ React.useEffect(() => {
285
+ if (titleId) {
286
+ const hasTitle = document.getElementById(titleId);
287
+ if (!hasTitle) console.error(MESSAGE);
288
+ }
289
+ }, [MESSAGE, titleId]);
290
+ return null;
291
+ };
292
+ var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
293
+ var DescriptionWarning = ({ contentRef, descriptionId }) => {
294
+ const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
295
+ const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
296
+ React.useEffect(() => {
297
+ const describedById = contentRef.current?.getAttribute("aria-describedby");
298
+ if (descriptionId && describedById) {
299
+ const hasDescription = document.getElementById(descriptionId);
300
+ if (!hasDescription) console.warn(MESSAGE);
301
+ }
302
+ }, [MESSAGE, contentRef, descriptionId]);
303
+ return null;
304
+ };
305
+ var Root = Dialog;
306
+ var Trigger = DialogTrigger;
307
+ var Portal = DialogPortal;
308
+ var Overlay = DialogOverlay;
309
+ var Content = DialogContent;
310
+ var Title = DialogTitle;
311
+ var Description = DialogDescription;
312
+ var Close = DialogClose;
11
313
 
12
- export { useCallbackRef as u };
314
+ 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 };
13
315
  //# sourceMappingURL=index30.js.map
@@ -1 +1 @@
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]}
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,EA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AAI;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]}
package/dist/index31.js CHANGED
@@ -1,35 +1,13 @@
1
1
  import * as React from 'react';
2
- import { u as useControllableState, P as Primitive, c as composeEventHandlers } from './index18.js';
3
- import { jsx } from 'react/jsx-runtime';
4
2
 
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
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;
13
8
  });
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;
9
+ return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
10
+ }
33
11
 
34
- export { Root as R, Toggle as T };
12
+ export { useCallbackRef as u };
35
13
  //# sourceMappingURL=index31.js.map
@@ -1 +1 @@
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]}
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]}
package/dist/index32.js CHANGED
@@ -1,65 +1,35 @@
1
1
  import * as React from 'react';
2
+ import { u as useControllableState, P as Primitive, c as composeEventHandlers } from './index18.js';
2
3
  import { jsx } from 'react/jsx-runtime';
3
4
 
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}\``);
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
+ })
25
28
  }
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
- }
29
+ );
30
+ });
31
+ Toggle.displayName = NAME;
32
+ var Root = Toggle;
63
33
 
64
- export { createContextScope as c };
34
+ export { Root as R, Toggle as T };
65
35
  //# sourceMappingURL=index32.js.map
@@ -1 +1 @@
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":";;;AAAA;AAoBA,SAAS,kBAAkB,CAAC,SAAS,EAAE,sBAAsB,GAAG,EAAE,EAAE;AACpE,EAAE,IAAI,eAAe,GAAG,EAAE;AAC1B,EAAE,SAAS,cAAc,CAAC,iBAAiB,EAAE,cAAc,EAAE;AAC7D,IAAI,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC;AAC3D,IAAI,WAAW,CAAC,WAAW,GAAG,iBAAiB,GAAG,SAAS;AAC3D,IAAI,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM;AACxC,IAAI,eAAe,GAAG,CAAC,GAAG,eAAe,EAAE,cAAc,CAAC;AAC1D,IAAI,MAAM,QAAQ,GAAG,CAAC,KAAK,KAAK;AAChC,MAAM,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK;AACnD,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC,GAAG,KAAK,CAAC,IAAI,WAAW;AAChE,MAAM,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACxE,MAAM,uBAAuB,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACvE,IAAI,CAAC;AACL,IAAI,QAAQ,CAAC,WAAW,GAAG,iBAAi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GAAG,MAAM,EAAE;AACzC,EAAE,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC;AAC7B,EAAE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,OAAO,SAAS;AAC3C,EAAE,MAAM,WAAW,GAAG,MAAM;AAC5B,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,YAAY,MAAM;AACrD,MAAM,QAAQ,EAAE,YAAY,EAAE;AAC9B,MAAM,SAAS,EAAE,YAAY,CAAC;AAC9B,KAAK,CAAC,CAAC;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]}
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]}
package/dist/index33.js CHANGED
@@ -1,16 +1,65 @@
1
1
  import * as React from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
2
3
 
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;
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}\``);
10
25
  }
11
- return ref.current.previous;
12
- }, [value]);
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;
13
62
  }
14
63
 
15
- export { usePrevious as u };
64
+ export { createContextScope as c };
16
65
  //# sourceMappingURL=index33.js.map