@vritti/quantum-ui 0.2.7 → 0.2.8

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 (174) hide show
  1. package/dist/Avatar.js +219 -0
  2. package/dist/Avatar.js.map +1 -0
  3. package/dist/Badge.js +32 -0
  4. package/dist/Badge.js.map +1 -0
  5. package/dist/Button2.js +2 -2
  6. package/dist/Chart.js +19003 -0
  7. package/dist/Chart.js.map +1 -0
  8. package/dist/Checkbox.js +6 -26
  9. package/dist/Checkbox.js.map +1 -1
  10. package/dist/Combination.js +3868 -0
  11. package/dist/Combination.js.map +1 -0
  12. package/dist/DatePicker.js +15 -3877
  13. package/dist/DatePicker.js.map +1 -1
  14. package/dist/DropdownMenu.js +1591 -0
  15. package/dist/DropdownMenu.js.map +1 -0
  16. package/dist/Form.js +7 -4
  17. package/dist/Form.js.map +1 -1
  18. package/dist/Label.js +1 -1
  19. package/dist/OTPField.js +16 -5
  20. package/dist/OTPField.js.map +1 -1
  21. package/dist/PhoneField.js +14 -6
  22. package/dist/PhoneField.js.map +1 -1
  23. package/dist/Progress.js +116 -0
  24. package/dist/Progress.js.map +1 -0
  25. package/dist/Separator.js +6 -0
  26. package/dist/Separator.js.map +1 -0
  27. package/dist/Spinner.js +1 -9
  28. package/dist/Spinner.js.map +1 -1
  29. package/dist/Switch.js +210 -0
  30. package/dist/Switch.js.map +1 -0
  31. package/dist/ThemeContext.js +57 -0
  32. package/dist/ThemeContext.js.map +1 -0
  33. package/dist/ThemeToggle.js +4 -15
  34. package/dist/ThemeToggle.js.map +1 -1
  35. package/dist/Toggle.js +69 -0
  36. package/dist/Toggle.js.map +1 -0
  37. package/dist/_commonjsHelpers.js +6 -0
  38. package/dist/_commonjsHelpers.js.map +1 -0
  39. package/dist/assets/quantum-ui.css +18 -0
  40. package/dist/axios.js.map +1 -1
  41. package/dist/check.js +15 -0
  42. package/dist/check.js.map +1 -0
  43. package/dist/components/Avatar.js +2 -0
  44. package/dist/components/Avatar.js.map +1 -0
  45. package/dist/components/Badge.js +2 -0
  46. package/dist/components/Badge.js.map +1 -0
  47. package/dist/components/Chart.js +2 -0
  48. package/dist/components/Chart.js.map +1 -0
  49. package/dist/components/DropdownMenu.js +2 -0
  50. package/dist/components/DropdownMenu.js.map +1 -0
  51. package/dist/components/Progress.js +1 -174
  52. package/dist/components/Progress.js.map +1 -1
  53. package/dist/components/Separator.js +2 -0
  54. package/dist/components/Separator.js.map +1 -0
  55. package/dist/components/Switch.js +2 -0
  56. package/dist/components/Switch.js.map +1 -0
  57. package/dist/components/Toggle.js +2 -0
  58. package/dist/components/Toggle.js.map +1 -0
  59. package/dist/context/index.js +2 -0
  60. package/dist/context/index.js.map +1 -0
  61. package/dist/field.js +2 -49
  62. package/dist/field.js.map +1 -1
  63. package/dist/hooks/index.js +2 -0
  64. package/dist/hooks/index.js.map +1 -0
  65. package/dist/index.js +10 -0
  66. package/dist/index.js.map +1 -1
  67. package/dist/index10.js +105 -0
  68. package/dist/index10.js.map +1 -0
  69. package/dist/index11.js +101 -0
  70. package/dist/index11.js.map +1 -0
  71. package/dist/index12.js +205 -0
  72. package/dist/index12.js.map +1 -0
  73. package/dist/index13.js +199 -0
  74. package/dist/index13.js.map +1 -0
  75. package/dist/index2.js +55 -130
  76. package/dist/index2.js.map +1 -1
  77. package/dist/index3.js +10 -42
  78. package/dist/index3.js.map +1 -1
  79. package/dist/index4.js +125 -35
  80. package/dist/index4.js.map +1 -1
  81. package/dist/index5.js +26 -414
  82. package/dist/index5.js.map +1 -1
  83. package/dist/index6.js +8 -0
  84. package/dist/index6.js.map +1 -0
  85. package/dist/index7.js +16 -0
  86. package/dist/index7.js.map +1 -0
  87. package/dist/index8.js +45 -0
  88. package/dist/index8.js.map +1 -0
  89. package/dist/index9.js +41 -0
  90. package/dist/index9.js.map +1 -0
  91. package/dist/lib/components/Avatar/Avatar.d.ts +8 -0
  92. package/dist/lib/components/Avatar/Avatar.d.ts.map +1 -0
  93. package/dist/lib/components/Avatar/index.d.ts +2 -0
  94. package/dist/lib/components/Avatar/index.d.ts.map +1 -0
  95. package/dist/lib/components/Badge/Badge.d.ts +5 -0
  96. package/dist/lib/components/Badge/Badge.d.ts.map +1 -0
  97. package/dist/lib/components/Badge/index.d.ts +3 -0
  98. package/dist/lib/components/Badge/index.d.ts.map +1 -0
  99. package/dist/lib/components/Button/index.d.ts +1 -1
  100. package/dist/lib/components/Button/index.d.ts.map +1 -1
  101. package/dist/lib/components/Chart/Chart.d.ts +13 -0
  102. package/dist/lib/components/Chart/Chart.d.ts.map +1 -0
  103. package/dist/lib/components/Chart/index.d.ts +3 -0
  104. package/dist/lib/components/Chart/index.d.ts.map +1 -0
  105. package/dist/lib/components/DropdownMenu/DropdownMenu.d.ts +28 -0
  106. package/dist/lib/components/DropdownMenu/DropdownMenu.d.ts.map +1 -0
  107. package/dist/lib/components/DropdownMenu/index.d.ts +3 -0
  108. package/dist/lib/components/DropdownMenu/index.d.ts.map +1 -0
  109. package/dist/lib/components/DropdownMenu/types.d.ts +72 -0
  110. package/dist/lib/components/DropdownMenu/types.d.ts.map +1 -0
  111. package/dist/lib/components/Form/Form.d.ts.map +1 -1
  112. package/dist/lib/components/OTPField/OTPField.d.ts.map +1 -1
  113. package/dist/lib/components/PhoneField/PhoneField.d.ts.map +1 -1
  114. package/dist/lib/components/Separator/Separator.d.ts +3 -0
  115. package/dist/lib/components/Separator/Separator.d.ts.map +1 -0
  116. package/dist/lib/components/Separator/index.d.ts +2 -0
  117. package/dist/lib/components/Separator/index.d.ts.map +1 -0
  118. package/dist/lib/components/Switch/Switch.d.ts +9 -0
  119. package/dist/lib/components/Switch/Switch.d.ts.map +1 -0
  120. package/dist/lib/components/Switch/index.d.ts +3 -0
  121. package/dist/lib/components/Switch/index.d.ts.map +1 -0
  122. package/dist/lib/components/ThemeToggle/ThemeToggle.d.ts.map +1 -1
  123. package/dist/lib/components/Toggle/Toggle.d.ts +7 -0
  124. package/dist/lib/components/Toggle/Toggle.d.ts.map +1 -0
  125. package/dist/lib/components/Toggle/index.d.ts +2 -0
  126. package/dist/lib/components/Toggle/index.d.ts.map +1 -0
  127. package/dist/lib/components/index.d.ts +8 -0
  128. package/dist/lib/components/index.d.ts.map +1 -1
  129. package/dist/lib/context/ThemeContext.d.ts +18 -0
  130. package/dist/lib/context/ThemeContext.d.ts.map +1 -0
  131. package/dist/lib/context/index.d.ts +2 -0
  132. package/dist/lib/context/index.d.ts.map +1 -0
  133. package/dist/lib/hooks/index.d.ts +2 -0
  134. package/dist/lib/hooks/index.d.ts.map +1 -0
  135. package/dist/lib/hooks/useTheme.d.ts +8 -0
  136. package/dist/lib/hooks/useTheme.d.ts.map +1 -0
  137. package/dist/lib/index.d.ts +2 -0
  138. package/dist/lib/index.d.ts.map +1 -1
  139. package/dist/lib/theme/index.d.ts +13 -0
  140. package/dist/lib/theme/index.d.ts.map +1 -0
  141. package/dist/lib/utils/axios.d.ts +1 -0
  142. package/dist/lib/utils/axios.d.ts.map +1 -1
  143. package/dist/lib/utils/formHelpers.d.ts.map +1 -1
  144. package/dist/separator2.js +53 -0
  145. package/dist/separator2.js.map +1 -0
  146. package/dist/shadcn/index.d.ts +1 -1
  147. package/dist/shadcn/index.d.ts.map +1 -1
  148. package/dist/shadcn/shadcnAvatar/Avatar.d.ts +12 -0
  149. package/dist/shadcn/shadcnAvatar/Avatar.d.ts.map +1 -0
  150. package/dist/shadcn/shadcnAvatar/index.d.ts +2 -0
  151. package/dist/shadcn/shadcnAvatar/index.d.ts.map +1 -0
  152. package/dist/shadcn/shadcnBadge/Badge.d.ts +11 -0
  153. package/dist/shadcn/shadcnBadge/Badge.d.ts.map +1 -0
  154. package/dist/shadcn/shadcnBadge/index.d.ts +3 -0
  155. package/dist/shadcn/shadcnBadge/index.d.ts.map +1 -0
  156. package/dist/shadcn/shadcnButton/Button.d.ts +1 -1
  157. package/dist/shadcn/shadcnChart/Chart.d.ts +58 -0
  158. package/dist/shadcn/shadcnChart/Chart.d.ts.map +1 -0
  159. package/dist/shadcn/shadcnChart/index.d.ts +3 -0
  160. package/dist/shadcn/shadcnChart/index.d.ts.map +1 -0
  161. package/dist/shadcn/shadcnSpinner/Spinner.d.ts.map +1 -1
  162. package/dist/shadcn/shadcnSwitch/Switch.d.ts +7 -0
  163. package/dist/shadcn/shadcnSwitch/Switch.d.ts.map +1 -0
  164. package/dist/shadcn/shadcnSwitch/index.d.ts +2 -0
  165. package/dist/shadcn/shadcnSwitch/index.d.ts.map +1 -0
  166. package/dist/shadcn/shadcnToggle/Toggle.d.ts +10 -0
  167. package/dist/shadcn/shadcnToggle/Toggle.d.ts.map +1 -0
  168. package/dist/shadcn/shadcnToggle/index.d.ts +2 -0
  169. package/dist/shadcn/shadcnToggle/index.d.ts.map +1 -0
  170. package/dist/theme/index.js +11 -0
  171. package/dist/theme/index.js.map +1 -0
  172. package/dist/useTheme.js +15 -0
  173. package/dist/useTheme.js.map +1 -0
  174. package/package.json +45 -1
package/dist/index2.js CHANGED
@@ -1,140 +1,65 @@
1
1
  import * as React from 'react';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
 
4
- // packages/react/compose-refs/src/compose-refs.tsx
5
- function setRef(ref, value) {
6
- if (typeof ref === "function") {
7
- return ref(value);
8
- } else if (ref !== null && ref !== void 0) {
9
- ref.current = 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}\``);
25
+ }
26
+ return [Provider, useContext2];
10
27
  }
11
- }
12
- function composeRefs(...refs) {
13
- return (node) => {
14
- let hasCleanup = false;
15
- const cleanups = refs.map((ref) => {
16
- const cleanup = setRef(ref, node);
17
- if (!hasCleanup && typeof cleanup == "function") {
18
- hasCleanup = true;
19
- }
20
- return cleanup;
28
+ const createScope = () => {
29
+ const scopeContexts = defaultContexts.map((defaultContext) => {
30
+ return React.createContext(defaultContext);
21
31
  });
22
- if (hasCleanup) {
23
- return () => {
24
- for (let i = 0; i < cleanups.length; i++) {
25
- const cleanup = cleanups[i];
26
- if (typeof cleanup == "function") {
27
- cleanup();
28
- } else {
29
- setRef(refs[i], null);
30
- }
31
- }
32
- };
33
- }
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
+ };
34
39
  };
40
+ createScope.scopeName = scopeName;
41
+ return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
35
42
  }
36
- function useComposedRefs(...refs) {
37
- return React.useCallback(composeRefs(...refs), refs);
38
- }
39
-
40
- // src/slot.tsx
41
- var REACT_LAZY_TYPE = Symbol.for("react.lazy");
42
- var use = React[" use ".trim().toString()];
43
- function isPromiseLike(value) {
44
- return typeof value === "object" && value !== null && "then" in value;
45
- }
46
- function isLazyComponent(element) {
47
- return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
48
- }
49
- // @__NO_SIDE_EFFECTS__
50
- function createSlot(ownerName) {
51
- const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
52
- const Slot2 = React.forwardRef((props, forwardedRef) => {
53
- let { children, ...slotProps } = props;
54
- if (isLazyComponent(children) && typeof use === "function") {
55
- children = use(children._payload);
56
- }
57
- const childrenArray = React.Children.toArray(children);
58
- const slottable = childrenArray.find(isSlottable);
59
- if (slottable) {
60
- const newElement = slottable.props.children;
61
- const newChildren = childrenArray.map((child) => {
62
- if (child === slottable) {
63
- if (React.Children.count(newElement) > 1) return React.Children.only(null);
64
- return React.isValidElement(newElement) ? newElement.props.children : null;
65
- } else {
66
- return child;
67
- }
68
- });
69
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
70
- }
71
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
72
- });
73
- Slot2.displayName = `${ownerName}.Slot`;
74
- return Slot2;
75
- }
76
- var Slot = /* @__PURE__ */ createSlot("Slot");
77
- // @__NO_SIDE_EFFECTS__
78
- function createSlotClone(ownerName) {
79
- const SlotClone = React.forwardRef((props, forwardedRef) => {
80
- let { children, ...slotProps } = props;
81
- if (isLazyComponent(children) && typeof use === "function") {
82
- children = use(children._payload);
83
- }
84
- if (React.isValidElement(children)) {
85
- const childrenRef = getElementRef(children);
86
- const props2 = mergeProps(slotProps, children.props);
87
- if (children.type !== React.Fragment) {
88
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
89
- }
90
- return React.cloneElement(children, props2);
91
- }
92
- return React.Children.count(children) > 1 ? React.Children.only(null) : null;
93
- });
94
- SlotClone.displayName = `${ownerName}.SlotClone`;
95
- return SlotClone;
96
- }
97
- var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
98
- function isSlottable(child) {
99
- return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
100
- }
101
- function mergeProps(slotProps, childProps) {
102
- const overrideProps = { ...childProps };
103
- for (const propName in childProps) {
104
- const slotPropValue = slotProps[propName];
105
- const childPropValue = childProps[propName];
106
- const isHandler = /^on[A-Z]/.test(propName);
107
- if (isHandler) {
108
- if (slotPropValue && childPropValue) {
109
- overrideProps[propName] = (...args) => {
110
- const result = childPropValue(...args);
111
- slotPropValue(...args);
112
- return result;
113
- };
114
- } else if (slotPropValue) {
115
- overrideProps[propName] = slotPropValue;
116
- }
117
- } else if (propName === "style") {
118
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
119
- } else if (propName === "className") {
120
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
121
- }
122
- }
123
- return { ...slotProps, ...overrideProps };
124
- }
125
- function getElementRef(element) {
126
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
127
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
128
- if (mayWarn) {
129
- return element.ref;
130
- }
131
- getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
132
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
133
- if (mayWarn) {
134
- return element.props.ref;
135
- }
136
- return element.props.ref || element.ref;
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;
137
62
  }
138
63
 
139
- export { Slot as S, composeRefs as a, createSlot as c, useComposedRefs as u };
64
+ export { createContextScope as c };
140
65
  //# sourceMappingURL=index2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","sources":["../node_modules/.pnpm/@radix-ui+react-compose-refs@1.1.2_@types+react@19.2.9_react@19.2.3/node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../node_modules/.pnpm/@radix-ui+react-slot@1.2.4_@types+react@19.2.9_react@19.2.3/node_modules/@radix-ui/react-slot/dist/index.mjs"],"sourcesContent":["// packages/react/compose-refs/src/compose-refs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == \"function\") {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","// src/slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment as Fragment2, jsx } from \"react/jsx-runtime\";\nvar REACT_LAZY_TYPE = Symbol.for(\"react.lazy\");\nvar use = React[\" use \".trim().toString()];\nfunction isPromiseLike(value) {\n return typeof value === \"object\" && value !== null && \"then\" in value;\n}\nfunction isLazyComponent(element) {\n return element != null && typeof element === \"object\" && \"$$typeof\" in element && element.$$typeof === REACT_LAZY_TYPE && \"_payload\" in element && isPromiseLike(element._payload);\n}\n// @__NO_SIDE_EFFECTS__\nfunction createSlot(ownerName) {\n const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);\n const Slot2 = React.forwardRef((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n if (isLazyComponent(children) && typeof use === \"function\") {\n children = use(children._payload);\n }\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n });\n Slot2.displayName = `${ownerName}.Slot`;\n return Slot2;\n}\nvar Slot = /* @__PURE__ */ createSlot(\"Slot\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlotClone(ownerName) {\n const SlotClone = React.forwardRef((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n if (isLazyComponent(children) && typeof use === \"function\") {\n children = use(children._payload);\n }\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props2 = mergeProps(slotProps, children.props);\n if (children.type !== React.Fragment) {\n props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props2);\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\nvar SLOTTABLE_IDENTIFIER = Symbol(\"radix.slottable\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlottable(ownerName) {\n const Slottable2 = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment2, { children });\n };\n Slottable2.displayName = `${ownerName}.Slottable`;\n Slottable2.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable2;\n}\nvar Slottable = /* @__PURE__ */ createSlottable(\"Slottable\");\nfunction isSlottable(child) {\n return React.isValidElement(child) && typeof child.type === \"function\" && \"__radixId\" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nexport {\n Slot as Root,\n Slot,\n Slottable,\n createSlot,\n createSlottable\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;;AAAA;AAEA,SAAS,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE;AAC5B,EAAE,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;AACjC,IAAI,OAAO,GAAG,CAAC,KAAK,CAAC;AACrB,EAAE,CAAC,MAAM,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,EAAE;AAC7C,IAAI,GAAG,CAAC,OAAO,GAAG,KAAK;AACvB,EAAE;AACF;AACA,SAAS,WAAW,CAAC,GAAG,IAAI,EAAE;AAC9B,EAAE,OAAO,CAAC,IAAI,KAAK;AACnB,IAAI,IA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AAG,IAAI,OAAO,CAAC,GAAG;AACzC;;;;","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"index2.js","sources":["../node_modules/.pnpm/@radix-ui+react-context@1.1.3_@types+react@19.2.9_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;AA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AAC,SAAS,GAAG,SAAS,CAAC,SAAS;AAC7C,EAAE,OAAO,WAAW;AACpB;;;;","x_google_ignoreList":[0]}
package/dist/index3.js CHANGED
@@ -1,45 +1,13 @@
1
- import { a as clsx } from './utils.js';
1
+ import * as React from 'react';
2
2
 
3
- const falsyToString = (value)=>typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
4
- const cx = clsx;
5
- const cva = (base, config)=>(props)=>{
6
- var _config_compoundVariants;
7
- if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
8
- const { variants, defaultVariants } = config;
9
- const getVariantClassNames = Object.keys(variants).map((variant)=>{
10
- const variantProp = props === null || props === void 0 ? void 0 : props[variant];
11
- const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
12
- if (variantProp === null) return null;
13
- const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
14
- return variants[variant][variantKey];
15
- });
16
- const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{
17
- let [key, value] = param;
18
- if (value === undefined) {
19
- return acc;
20
- }
21
- acc[key] = value;
22
- return acc;
23
- }, {});
24
- const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{
25
- let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
26
- return Object.entries(compoundVariantOptions).every((param)=>{
27
- let [key, value] = param;
28
- return Array.isArray(value) ? value.includes({
29
- ...defaultVariants,
30
- ...propsWithoutUndefined
31
- }[key]) : ({
32
- ...defaultVariants,
33
- ...propsWithoutUndefined
34
- })[key] === value;
35
- }) ? [
36
- ...acc,
37
- cvClass,
38
- cvClassName
39
- ] : acc;
40
- }, []);
41
- return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
42
- };
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;
8
+ });
9
+ return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
10
+ }
43
11
 
44
- export { cva as c };
12
+ export { useCallbackRef as u };
45
13
  //# sourceMappingURL=index3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index3.js","sources":["../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs"],"sourcesContent":["/**\n * Copyright 2022 Joe Bell. All rights reserved.\n *\n * This file is licensed to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with the\n * License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */ import { clsx } from \"clsx\";\nconst falsyToString = (value)=>typeof value === \"boolean\" ? `${value}` : value === 0 ? \"0\" : value;\nexport const cx = clsx;\nexport const cva = (base, config)=>(props)=>{\n var _config_compoundVariants;\n if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n const { variants, defaultVariants } = config;\n const getVariantClassNames = Object.keys(variants).map((variant)=>{\n const variantProp = props === null || props === void 0 ? void 0 : props[variant];\n const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];\n if (variantProp === null) return null;\n const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);\n return variants[variant][variantKey];\n });\n const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{\n let [key, value] = param;\n if (value === undefined) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{\n let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;\n return Object.entries(compoundVariantOptions).every((param)=>{\n let [key, value] = param;\n return Array.isArray(value) ? value.includes({\n ...defaultVariants,\n ...propsWithoutUndefined\n }[key]) : ({\n ...defaultVariants,\n ...propsWithoutUndefined\n })[key] === value;\n }) ? [\n ...acc,\n cvClass,\n cvClassName\n ] : acc;\n }, []);\n return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n };\n\n"],"names":[],"mappings":";;AAeA,MAAM,aAAa,GAAG,CAAC,KAAK,GAAG,OAAO,KAAK,KAAK,SAAS,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,KAAK;AAC3F,MAAM,EAAE,GAAG,IAAI;AACV,MAAC,GAAG,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,KAAK,GAAG;AAC5C,QAAQ,IAAI,wBAAwB;AACpC,QAAQ,IAAI,CAAC,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,QAAQ,KAAK,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;AAChO,QAAQ,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,MAAM;AACpD,QAAQ,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GA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YAAY,OAAO,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG;AACzE,gBAAgB,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,KAAK;AACxC,gBAAgB,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC;AAC7D,oBAAoB,GAAG,eAAe;AACtC,oBAAoB,GAAG;AACvB,iBAAiB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;AAC3B,oBAAoB,GAAG,eAAe;AACtC,oBAAoB,GAAG;AACvB,iBAAiB,EAAE,GAAG,CAAC,KAAK,KAAK;AACjC,YAAY,CAAC,CAAC,GAAG;AACjB,gBAAgB,GAAG,GAAG;AACtB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB,aAAa,GAAG,GAAG;AACnB,QAAQ,CAAC,EAAE,EAAE,CAAC;AACd,QAAQ,OAAO,EAAE,CAAC,IAAI,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;AACrM,IAAI;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index3.js","sources":["../node_modules/.pnpm/@radix-ui+react-use-callback-ref@1.1.1_@types+react@19.2.9_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/index4.js CHANGED
@@ -1,41 +1,131 @@
1
1
  import * as React from 'react';
2
- import 'react-dom';
3
- import { c as createSlot } from './index2.js';
4
- import { jsx } from 'react/jsx-runtime';
2
+ import { u as useComposedRefs } from './index5.js';
3
+ import { u as useLayoutEffect2 } from './index6.js';
5
4
 
6
- // src/primitive.tsx
7
- var NODES = [
8
- "a",
9
- "button",
10
- "div",
11
- "form",
12
- "h2",
13
- "h3",
14
- "img",
15
- "input",
16
- "label",
17
- "li",
18
- "nav",
19
- "ol",
20
- "p",
21
- "select",
22
- "span",
23
- "svg",
24
- "ul"
25
- ];
26
- var Primitive = NODES.reduce((primitive, node) => {
27
- const Slot = createSlot(`Primitive.${node}`);
28
- const Node = React.forwardRef((props, forwardedRef) => {
29
- const { asChild, ...primitiveProps } = props;
30
- const Comp = asChild ? Slot : node;
31
- if (typeof window !== "undefined") {
32
- window[Symbol.for("radix-ui")] = true;
5
+ function useStateMachine(initialState, machine) {
6
+ return React.useReducer((state, event) => {
7
+ const nextState = machine[state][event];
8
+ return nextState ?? state;
9
+ }, initialState);
10
+ }
11
+
12
+ // src/presence.tsx
13
+ var Presence = (props) => {
14
+ const { present, children } = props;
15
+ const presence = usePresence(present);
16
+ const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
17
+ const ref = useComposedRefs(presence.ref, getElementRef(child));
18
+ const forceMount = typeof children === "function";
19
+ return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
20
+ };
21
+ Presence.displayName = "Presence";
22
+ function usePresence(present) {
23
+ const [node, setNode] = React.useState();
24
+ const stylesRef = React.useRef(null);
25
+ const prevPresentRef = React.useRef(present);
26
+ const prevAnimationNameRef = React.useRef("none");
27
+ const initialState = present ? "mounted" : "unmounted";
28
+ const [state, send] = useStateMachine(initialState, {
29
+ mounted: {
30
+ UNMOUNT: "unmounted",
31
+ ANIMATION_OUT: "unmountSuspended"
32
+ },
33
+ unmountSuspended: {
34
+ MOUNT: "mounted",
35
+ ANIMATION_END: "unmounted"
36
+ },
37
+ unmounted: {
38
+ MOUNT: "mounted"
33
39
  }
34
- return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
35
40
  });
36
- Node.displayName = `Primitive.${node}`;
37
- return { ...primitive, [node]: Node };
38
- }, {});
41
+ React.useEffect(() => {
42
+ const currentAnimationName = getAnimationName(stylesRef.current);
43
+ prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
44
+ }, [state]);
45
+ useLayoutEffect2(() => {
46
+ const styles = stylesRef.current;
47
+ const wasPresent = prevPresentRef.current;
48
+ const hasPresentChanged = wasPresent !== present;
49
+ if (hasPresentChanged) {
50
+ const prevAnimationName = prevAnimationNameRef.current;
51
+ const currentAnimationName = getAnimationName(styles);
52
+ if (present) {
53
+ send("MOUNT");
54
+ } else if (currentAnimationName === "none" || styles?.display === "none") {
55
+ send("UNMOUNT");
56
+ } else {
57
+ const isAnimating = prevAnimationName !== currentAnimationName;
58
+ if (wasPresent && isAnimating) {
59
+ send("ANIMATION_OUT");
60
+ } else {
61
+ send("UNMOUNT");
62
+ }
63
+ }
64
+ prevPresentRef.current = present;
65
+ }
66
+ }, [present, send]);
67
+ useLayoutEffect2(() => {
68
+ if (node) {
69
+ let timeoutId;
70
+ const ownerWindow = node.ownerDocument.defaultView ?? window;
71
+ const handleAnimationEnd = (event) => {
72
+ const currentAnimationName = getAnimationName(stylesRef.current);
73
+ const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
74
+ if (event.target === node && isCurrentAnimation) {
75
+ send("ANIMATION_END");
76
+ if (!prevPresentRef.current) {
77
+ const currentFillMode = node.style.animationFillMode;
78
+ node.style.animationFillMode = "forwards";
79
+ timeoutId = ownerWindow.setTimeout(() => {
80
+ if (node.style.animationFillMode === "forwards") {
81
+ node.style.animationFillMode = currentFillMode;
82
+ }
83
+ });
84
+ }
85
+ }
86
+ };
87
+ const handleAnimationStart = (event) => {
88
+ if (event.target === node) {
89
+ prevAnimationNameRef.current = getAnimationName(stylesRef.current);
90
+ }
91
+ };
92
+ node.addEventListener("animationstart", handleAnimationStart);
93
+ node.addEventListener("animationcancel", handleAnimationEnd);
94
+ node.addEventListener("animationend", handleAnimationEnd);
95
+ return () => {
96
+ ownerWindow.clearTimeout(timeoutId);
97
+ node.removeEventListener("animationstart", handleAnimationStart);
98
+ node.removeEventListener("animationcancel", handleAnimationEnd);
99
+ node.removeEventListener("animationend", handleAnimationEnd);
100
+ };
101
+ } else {
102
+ send("ANIMATION_END");
103
+ }
104
+ }, [node, send]);
105
+ return {
106
+ isPresent: ["mounted", "unmountSuspended"].includes(state),
107
+ ref: React.useCallback((node2) => {
108
+ stylesRef.current = node2 ? getComputedStyle(node2) : null;
109
+ setNode(node2);
110
+ }, [])
111
+ };
112
+ }
113
+ function getAnimationName(styles) {
114
+ return styles?.animationName || "none";
115
+ }
116
+ function getElementRef(element) {
117
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
118
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
119
+ if (mayWarn) {
120
+ return element.ref;
121
+ }
122
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
123
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
124
+ if (mayWarn) {
125
+ return element.props.ref;
126
+ }
127
+ return element.props.ref || element.ref;
128
+ }
39
129
 
40
- export { Primitive as P };
130
+ export { Presence as P };
41
131
  //# sourceMappingURL=index4.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index4.js","sources":["../node_modules/.pnpm/@radix-ui+react-primitive@2.1.4_@types+react-dom@19.2.3_@types+react@19.2.9__@types+rea_80b0e86615c8e72f2e6ad5b837a6e15c/node_modules/@radix-ui/react-primitive/dist/index.mjs"],"sourcesContent":["// src/primitive.tsx\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NODES = [\n \"a\",\n \"button\",\n \"div\",\n \"form\",\n \"h2\",\n \"h3\",\n \"img\",\n \"input\",\n \"label\",\n \"li\",\n \"nav\",\n \"ol\",\n \"p\",\n \"select\",\n \"span\",\n \"svg\",\n \"ul\"\n];\nvar Primitive = NODES.reduce((primitive, node) => {\n const Slot = createSlot(`Primitive.${node}`);\n const Node = React.forwardRef((props, forwardedRef) => {\n const { asChild, ...primitiveProps } = props;\n const Comp = asChild ? Slot : node;\n if (typeof window !== \"undefined\") {\n window[Symbol.for(\"radix-ui\")] = true;\n }\n return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });\n });\n Node.displayName = `Primitive.${node}`;\n return { ...primitive, [node]: Node };\n}, {});\nfunction dispatchDiscreteCustomEvent(target, event) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));\n}\nvar Root = Primitive;\nexport {\n Primitive,\n Root,\n dispatchDiscreteCustomEvent\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;;;;AAAA;AAKA,IAAI,KAAK,GAAG;AACZ,EAAE,GAAG;AACL,EAAE,QAAQ;AACV,EAAE,KAAK;AACP,EAAE,MAAM;AACR,EAAE,IAAI;AACN,EAAE,IAAI;AACN,EAAE,KAAK;AACP,EAAE,OAAO;AACT,EAAE,OAAO;AACT,EAAE,IAAI;AACN,EAAE,KAAK;AACP,EAAE,IAAI;AACN,EAAE,GAAG;AACL,EAAE,QAAQ;AACV,EAAE,MAAM;AACR,EAAE,KAAK;AACP,EAAE;AACF,CAAC;AACE,IAAC,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,IAAI,KAAK;AAClD,EAAE,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;AAC9C,EAAE,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,YAAY,KAAK;AACzD,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,GAAG,KAAK;AAChD,IAAI,MAAM,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI;AACtC,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACvC,MAAM,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,GAAG,IAAI;AAC3C,IAAI;AACJ,IAAI,uBAAuB,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC;AAC9E,EAAE,CAAC,CAAC;AACJ,EAAE,IAAI,CAAC,WAAW,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AACxC,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAC,IAAI,GAAG,IAAI,EAAE;AACvC,CAAC,EAAE,EAAE;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index4.js","sources":["../node_modules/.pnpm/@radix-ui+react-presence@1.1.5_@types+react-dom@19.2.3_@types+react@19.2.9__@types+reac_e89ee5370fa5954404ef113347ae9cd5/node_modules/@radix-ui/react-presence/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/presence.tsx\nimport * as React2 from \"react\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\n\n// src/use-state-machine.tsx\nimport * as React from \"react\";\nfunction useStateMachine(initialState, machine) {\n return React.useReducer((state, event) => {\n const nextState = machine[state][event];\n return nextState ?? state;\n }, initialState);\n}\n\n// src/presence.tsx\nvar Presence = (props) => {\n const { present, children } = props;\n const presence = usePresence(present);\n const child = typeof children === \"function\" ? children({ present: presence.isPresent }) : React2.Children.only(children);\n const ref = useComposedRefs(presence.ref, getElementRef(child));\n const forceMount = typeof children === \"function\";\n return forceMount || presence.isPresent ? React2.cloneElement(child, { ref }) : null;\n};\nPresence.displayName = \"Presence\";\nfunction usePresence(present) {\n const [node, setNode] = React2.useState();\n const stylesRef = React2.useRef(null);\n const prevPresentRef = React2.useRef(present);\n const prevAnimationNameRef = React2.useRef(\"none\");\n const initialState = present ? \"mounted\" : \"unmounted\";\n const [state, send] = useStateMachine(initialState, {\n mounted: {\n UNMOUNT: \"unmounted\",\n ANIMATION_OUT: \"unmountSuspended\"\n },\n unmountSuspended: {\n MOUNT: \"mounted\",\n ANIMATION_END: \"unmounted\"\n },\n unmounted: {\n MOUNT: \"mounted\"\n }\n });\n React2.useEffect(() => {\n const currentAnimationName = getAnimationName(stylesRef.current);\n prevAnimationNameRef.current = state === \"mounted\" ? currentAnimationName : \"none\";\n }, [state]);\n useLayoutEffect(() => {\n const styles = stylesRef.current;\n const wasPresent = prevPresentRef.current;\n const hasPresentChanged = wasPresent !== present;\n if (hasPresentChanged) {\n const prevAnimationName = prevAnimationNameRef.current;\n const currentAnimationName = getAnimationName(styles);\n if (present) {\n send(\"MOUNT\");\n } else if (currentAnimationName === \"none\" || styles?.display === \"none\") {\n send(\"UNMOUNT\");\n } else {\n const isAnimating = prevAnimationName !== currentAnimationName;\n if (wasPresent && isAnimating) {\n send(\"ANIMATION_OUT\");\n } else {\n send(\"UNMOUNT\");\n }\n }\n prevPresentRef.current = present;\n }\n }, [present, send]);\n useLayoutEffect(() => {\n if (node) {\n let timeoutId;\n const ownerWindow = node.ownerDocument.defaultView ?? window;\n const handleAnimationEnd = (event) => {\n const currentAnimationName = getAnimationName(stylesRef.current);\n const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));\n if (event.target === node && isCurrentAnimation) {\n send(\"ANIMATION_END\");\n if (!prevPresentRef.current) {\n const currentFillMode = node.style.animationFillMode;\n node.style.animationFillMode = \"forwards\";\n timeoutId = ownerWindow.setTimeout(() => {\n if (node.style.animationFillMode === \"forwards\") {\n node.style.animationFillMode = currentFillMode;\n }\n });\n }\n }\n };\n const handleAnimationStart = (event) => {\n if (event.target === node) {\n prevAnimationNameRef.current = getAnimationName(stylesRef.current);\n }\n };\n node.addEventListener(\"animationstart\", handleAnimationStart);\n node.addEventListener(\"animationcancel\", handleAnimationEnd);\n node.addEventListener(\"animationend\", handleAnimationEnd);\n return () => {\n ownerWindow.clearTimeout(timeoutId);\n node.removeEventListener(\"animationstart\", handleAnimationStart);\n node.removeEventListener(\"animationcancel\", handleAnimationEnd);\n node.removeEventListener(\"animationend\", handleAnimationEnd);\n };\n } else {\n send(\"ANIMATION_END\");\n }\n }, [node, send]);\n return {\n isPresent: [\"mounted\", \"unmountSuspended\"].includes(state),\n ref: React2.useCallback((node2) => {\n stylesRef.current = node2 ? getComputedStyle(node2) : null;\n setNode(node2);\n }, [])\n };\n}\nfunction getAnimationName(styles) {\n return styles?.animationName || \"none\";\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nvar Root = Presence;\nexport {\n Presence,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["React2","useLayoutEffect"],"mappings":";;;;AASA,SAAS,eAAe,CAAC,YAAY,EAAE,OAAO,EAAE;AAChD,EAAE,OAAO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