@worldcoin/mini-apps-ui-kit-react 1.3.6 → 1.4.0

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 (198) hide show
  1. package/dist/components/CountryDrawer/CountryDrawer.d.ts +6 -1
  2. package/dist/components/CountryDrawer/CountryDrawer.js +49 -34
  3. package/dist/components/CountryDrawer/useCountryFiltering.d.ts +2 -1
  4. package/dist/components/CountryDrawer/useCountryFiltering.js +13 -2
  5. package/dist/components/CountryDrawer/useCountryGrouping.d.ts +4 -2
  6. package/dist/components/CountryDrawer/useCountryGrouping.js +9 -3
  7. package/dist/components/Dialog/Dialog.d.ts +13 -0
  8. package/dist/components/Dialog/Dialog.js +91 -0
  9. package/dist/components/DrawerDialog/DrawerDialog.d.ts +32 -0
  10. package/dist/components/DrawerDialog/DrawerDialog.js +71 -0
  11. package/dist/components/DrawerDialog/index.d.ts +2 -0
  12. package/dist/components/PhoneField/CountryListItem.d.ts +3 -1
  13. package/dist/components/PhoneField/CountryListItem.js +3 -1
  14. package/dist/components/PhoneField/CountrySelectorButton.js +2 -1
  15. package/dist/components/PhoneField/GroupedCountryList.d.ts +4 -1
  16. package/dist/components/PhoneField/GroupedCountryList.js +14 -6
  17. package/dist/components/PhoneField/PhoneField.d.ts +7 -0
  18. package/dist/components/PhoneField/PhoneField.js +4 -0
  19. package/dist/components/PhoneField/utils.d.ts +14 -1
  20. package/dist/components/PhoneField/utils.js +14 -5
  21. package/dist/globals.css +1 -1
  22. package/dist/hooks/use-isomorphic-layout-effect.d.ts +15 -0
  23. package/dist/hooks/use-isomorphic-layout-effect.js +5 -0
  24. package/dist/hooks/use-media-query.d.ts +28 -0
  25. package/dist/hooks/use-media-query.js +40 -0
  26. package/dist/index.d.ts +5 -0
  27. package/dist/index.js +10 -0
  28. package/dist/lib/I18nProvider.d.ts +19 -0
  29. package/dist/lib/I18nProvider.js +37 -0
  30. package/dist/lib/i18n.d.ts +13 -0
  31. package/dist/lib/i18n.js +43 -0
  32. package/dist/lib/locales.d.ts +20 -0
  33. package/dist/lib/locales.js +96 -0
  34. package/dist/locales/af.json.d.ts +258 -0
  35. package/dist/locales/af.json.js +11 -0
  36. package/dist/locales/am.json.d.ts +258 -0
  37. package/dist/locales/am.json.js +11 -0
  38. package/dist/locales/ar.json.d.ts +258 -0
  39. package/dist/locales/ar.json.js +11 -0
  40. package/dist/locales/az.json.d.ts +258 -0
  41. package/dist/locales/az.json.js +11 -0
  42. package/dist/locales/be.json.d.ts +258 -0
  43. package/dist/locales/be.json.js +11 -0
  44. package/dist/locales/bg.json.d.ts +258 -0
  45. package/dist/locales/bg.json.js +11 -0
  46. package/dist/locales/bn.json.d.ts +258 -0
  47. package/dist/locales/bn.json.js +11 -0
  48. package/dist/locales/br.json.d.ts +258 -0
  49. package/dist/locales/br.json.js +11 -0
  50. package/dist/locales/bs.json.d.ts +258 -0
  51. package/dist/locales/bs.json.js +11 -0
  52. package/dist/locales/ca.json.d.ts +258 -0
  53. package/dist/locales/ca.json.js +11 -0
  54. package/dist/locales/cs.json.d.ts +258 -0
  55. package/dist/locales/cs.json.js +11 -0
  56. package/dist/locales/cy.json.d.ts +258 -0
  57. package/dist/locales/cy.json.js +11 -0
  58. package/dist/locales/da.json.d.ts +258 -0
  59. package/dist/locales/da.json.js +11 -0
  60. package/dist/locales/de.json.d.ts +258 -0
  61. package/dist/locales/de.json.js +11 -0
  62. package/dist/locales/dv.json.d.ts +258 -0
  63. package/dist/locales/dv.json.js +11 -0
  64. package/dist/locales/el.json.d.ts +324 -0
  65. package/dist/locales/el.json.js +11 -0
  66. package/dist/locales/en.json.d.ts +258 -0
  67. package/dist/locales/en.json.js +11 -0
  68. package/dist/locales/es.json.d.ts +258 -0
  69. package/dist/locales/es.json.js +11 -0
  70. package/dist/locales/et.json.d.ts +258 -0
  71. package/dist/locales/et.json.js +11 -0
  72. package/dist/locales/eu.json.d.ts +258 -0
  73. package/dist/locales/eu.json.js +11 -0
  74. package/dist/locales/fa.json.d.ts +258 -0
  75. package/dist/locales/fa.json.js +11 -0
  76. package/dist/locales/fi.json.d.ts +258 -0
  77. package/dist/locales/fi.json.js +11 -0
  78. package/dist/locales/fr.json.d.ts +258 -0
  79. package/dist/locales/fr.json.js +11 -0
  80. package/dist/locales/ga.json.d.ts +258 -0
  81. package/dist/locales/ga.json.js +11 -0
  82. package/dist/locales/gl.json.d.ts +258 -0
  83. package/dist/locales/gl.json.js +11 -0
  84. package/dist/locales/ha.json.d.ts +258 -0
  85. package/dist/locales/ha.json.js +11 -0
  86. package/dist/locales/he.json.d.ts +258 -0
  87. package/dist/locales/he.json.js +11 -0
  88. package/dist/locales/hi.json.d.ts +258 -0
  89. package/dist/locales/hi.json.js +11 -0
  90. package/dist/locales/hr.json.d.ts +258 -0
  91. package/dist/locales/hr.json.js +11 -0
  92. package/dist/locales/hu.json.d.ts +258 -0
  93. package/dist/locales/hu.json.js +11 -0
  94. package/dist/locales/hy.json.d.ts +258 -0
  95. package/dist/locales/hy.json.js +11 -0
  96. package/dist/locales/id.json.d.ts +258 -0
  97. package/dist/locales/id.json.js +11 -0
  98. package/dist/locales/index.d.ts +78 -0
  99. package/dist/locales/is.json.d.ts +258 -0
  100. package/dist/locales/is.json.js +11 -0
  101. package/dist/locales/it.json.d.ts +258 -0
  102. package/dist/locales/it.json.js +11 -0
  103. package/dist/locales/ja.json.d.ts +258 -0
  104. package/dist/locales/ja.json.js +11 -0
  105. package/dist/locales/ka.json.d.ts +258 -0
  106. package/dist/locales/ka.json.js +11 -0
  107. package/dist/locales/kk.json.d.ts +258 -0
  108. package/dist/locales/kk.json.js +11 -0
  109. package/dist/locales/km.json.d.ts +258 -0
  110. package/dist/locales/km.json.js +11 -0
  111. package/dist/locales/ko.json.d.ts +258 -0
  112. package/dist/locales/ko.json.js +11 -0
  113. package/dist/locales/ku.json.d.ts +258 -0
  114. package/dist/locales/ku.json.js +11 -0
  115. package/dist/locales/ky.json.d.ts +258 -0
  116. package/dist/locales/ky.json.js +11 -0
  117. package/dist/locales/lt.json.d.ts +258 -0
  118. package/dist/locales/lt.json.js +11 -0
  119. package/dist/locales/lv.json.d.ts +258 -0
  120. package/dist/locales/lv.json.js +11 -0
  121. package/dist/locales/mk.json.d.ts +258 -0
  122. package/dist/locales/mk.json.js +11 -0
  123. package/dist/locales/ml.json.d.ts +258 -0
  124. package/dist/locales/ml.json.js +11 -0
  125. package/dist/locales/mn.json.d.ts +258 -0
  126. package/dist/locales/mn.json.js +11 -0
  127. package/dist/locales/mr.json.d.ts +258 -0
  128. package/dist/locales/mr.json.js +11 -0
  129. package/dist/locales/ms.json.d.ts +258 -0
  130. package/dist/locales/ms.json.js +11 -0
  131. package/dist/locales/mt.json.d.ts +258 -0
  132. package/dist/locales/mt.json.js +11 -0
  133. package/dist/locales/nb.json.d.ts +258 -0
  134. package/dist/locales/nb.json.js +11 -0
  135. package/dist/locales/nl.json.d.ts +273 -0
  136. package/dist/locales/nl.json.js +11 -0
  137. package/dist/locales/nn.json.d.ts +258 -0
  138. package/dist/locales/nn.json.js +11 -0
  139. package/dist/locales/no.json.d.ts +258 -0
  140. package/dist/locales/no.json.js +11 -0
  141. package/dist/locales/pl.json.d.ts +258 -0
  142. package/dist/locales/pl.json.js +11 -0
  143. package/dist/locales/ps.json.d.ts +258 -0
  144. package/dist/locales/ps.json.js +11 -0
  145. package/dist/locales/pt.json.d.ts +258 -0
  146. package/dist/locales/pt.json.js +11 -0
  147. package/dist/locales/ro.json.d.ts +258 -0
  148. package/dist/locales/ro.json.js +11 -0
  149. package/dist/locales/ru.json.d.ts +258 -0
  150. package/dist/locales/ru.json.js +11 -0
  151. package/dist/locales/sd.json.d.ts +258 -0
  152. package/dist/locales/sd.json.js +11 -0
  153. package/dist/locales/sk.json.d.ts +258 -0
  154. package/dist/locales/sk.json.js +11 -0
  155. package/dist/locales/sl.json.d.ts +258 -0
  156. package/dist/locales/sl.json.js +11 -0
  157. package/dist/locales/so.json.d.ts +258 -0
  158. package/dist/locales/so.json.js +11 -0
  159. package/dist/locales/sq.json.d.ts +258 -0
  160. package/dist/locales/sq.json.js +11 -0
  161. package/dist/locales/sr.json.d.ts +258 -0
  162. package/dist/locales/sr.json.js +11 -0
  163. package/dist/locales/sv.json.d.ts +258 -0
  164. package/dist/locales/sv.json.js +11 -0
  165. package/dist/locales/sw.json.d.ts +258 -0
  166. package/dist/locales/sw.json.js +11 -0
  167. package/dist/locales/ta.json.d.ts +258 -0
  168. package/dist/locales/ta.json.js +11 -0
  169. package/dist/locales/tg.json.d.ts +258 -0
  170. package/dist/locales/tg.json.js +11 -0
  171. package/dist/locales/th.json.d.ts +258 -0
  172. package/dist/locales/th.json.js +11 -0
  173. package/dist/locales/tk.json.d.ts +258 -0
  174. package/dist/locales/tk.json.js +11 -0
  175. package/dist/locales/tr.json.d.ts +258 -0
  176. package/dist/locales/tr.json.js +11 -0
  177. package/dist/locales/tt.json.d.ts +258 -0
  178. package/dist/locales/tt.json.js +11 -0
  179. package/dist/locales/types.d.ts +1 -0
  180. package/dist/locales/ug.json.d.ts +258 -0
  181. package/dist/locales/ug.json.js +11 -0
  182. package/dist/locales/uk.json.d.ts +258 -0
  183. package/dist/locales/uk.json.js +11 -0
  184. package/dist/locales/ur.json.d.ts +258 -0
  185. package/dist/locales/ur.json.js +11 -0
  186. package/dist/locales/uz.json.d.ts +258 -0
  187. package/dist/locales/uz.json.js +11 -0
  188. package/dist/locales/vi.json.d.ts +258 -0
  189. package/dist/locales/vi.json.js +11 -0
  190. package/dist/locales/zh.json.d.ts +258 -0
  191. package/dist/locales/zh.json.js +11 -0
  192. package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.js +11 -0
  193. package/dist/node_modules/.pnpm/{@radix-ui_react-dialog@1.1.14_@types_react-dom@18.3.7_@types_react@18.3.23__@types_react@18.3_skdkbhdoafm46nddrsexoqxvsa → @radix-ui_react-dialog@1.1.15_@types_react-dom@18.3.7_@types_react@18.3.23__@types_react@18.3_n6h2mnlo6eeop2x37d75f7xnhe}/node_modules/@radix-ui/react-dialog/dist/index.js +4 -4
  194. package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@18.3.7_@types_react@18.3.23__@types_kg5q3nhutdslurngxomqmbsqyy/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +213 -0
  195. package/dist/node_modules/.pnpm/@radix-ui_react-focus-guards@1.1.3_@types_react@18.3.23_react@18.3.1/node_modules/@radix-ui/react-focus-guards/dist/index.js +30 -0
  196. package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.5_@types_react-dom@18.3.7_@types_react@18.3.23__@types_react@18._qvx2ax5olpxuodjkqaw7d5exbm/node_modules/@radix-ui/react-presence/dist/index.js +130 -0
  197. package/dist/node_modules/.pnpm/vaul@1.1.2_@types_react-dom@18.3.7_@types_react@18.3.23__@types_react@18.3.23_react-dom@18.3._hck6bgtscpcdlplcvchrs7yfhu/node_modules/vaul/dist/index.js +1 -1
  198. package/package.json +392 -1
@@ -0,0 +1,213 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ import { composeEventHandlers } from "../../../../../@radix-ui_primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.js";
4
+ import { Primitive, dispatchDiscreteCustomEvent } from "../../../../../@radix-ui_react-primitive@2.1.3_@types_react-dom@18.3.7_@types_react@18.3.23__@types_react@18_ujcax4x2btumxxy334cxx2hjfq/node_modules/@radix-ui/react-primitive/dist/index.js";
5
+ import { useComposedRefs } from "../../../../../@radix-ui_react-compose-refs@1.1.2_@types_react@18.3.23_react@18.3.1/node_modules/@radix-ui/react-compose-refs/dist/index.js";
6
+ import { useCallbackRef } from "../../../../../@radix-ui_react-use-callback-ref@1.1.1_@types_react@18.3.23_react@18.3.1/node_modules/@radix-ui/react-use-callback-ref/dist/index.js";
7
+ import { useEscapeKeydown } from "../../../../../@radix-ui_react-use-escape-keydown@1.1.1_@types_react@18.3.23_react@18.3.1/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js";
8
+ import { jsx } from "react/jsx-runtime";
9
+ var DISMISSABLE_LAYER_NAME = "DismissableLayer";
10
+ var CONTEXT_UPDATE = "dismissableLayer.update";
11
+ var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
12
+ var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
13
+ var originalBodyPointerEvents;
14
+ var DismissableLayerContext = React.createContext({
15
+ layers: /* @__PURE__ */ new Set(),
16
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
17
+ branches: /* @__PURE__ */ new Set()
18
+ });
19
+ var DismissableLayer = React.forwardRef(
20
+ (props, forwardedRef) => {
21
+ const {
22
+ disableOutsidePointerEvents = false,
23
+ onEscapeKeyDown,
24
+ onPointerDownOutside,
25
+ onFocusOutside,
26
+ onInteractOutside,
27
+ onDismiss,
28
+ ...layerProps
29
+ } = props;
30
+ const context = React.useContext(DismissableLayerContext);
31
+ const [node, setNode] = React.useState(null);
32
+ const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
33
+ const [, force] = React.useState({});
34
+ const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
35
+ const layers = Array.from(context.layers);
36
+ const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
37
+ const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
38
+ const index = node ? layers.indexOf(node) : -1;
39
+ const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
40
+ const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
41
+ const pointerDownOutside = usePointerDownOutside((event) => {
42
+ const target = event.target;
43
+ const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
44
+ if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
45
+ onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
46
+ onInteractOutside == null ? void 0 : onInteractOutside(event);
47
+ if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
48
+ }, ownerDocument);
49
+ const focusOutside = useFocusOutside((event) => {
50
+ const target = event.target;
51
+ const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
52
+ if (isFocusInBranch) return;
53
+ onFocusOutside == null ? void 0 : onFocusOutside(event);
54
+ onInteractOutside == null ? void 0 : onInteractOutside(event);
55
+ if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
56
+ }, ownerDocument);
57
+ useEscapeKeydown((event) => {
58
+ const isHighestLayer = index === context.layers.size - 1;
59
+ if (!isHighestLayer) return;
60
+ onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
61
+ if (!event.defaultPrevented && onDismiss) {
62
+ event.preventDefault();
63
+ onDismiss();
64
+ }
65
+ }, ownerDocument);
66
+ React.useEffect(() => {
67
+ if (!node) return;
68
+ if (disableOutsidePointerEvents) {
69
+ if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
70
+ originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
71
+ ownerDocument.body.style.pointerEvents = "none";
72
+ }
73
+ context.layersWithOutsidePointerEventsDisabled.add(node);
74
+ }
75
+ context.layers.add(node);
76
+ dispatchUpdate();
77
+ return () => {
78
+ if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
79
+ ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
80
+ }
81
+ };
82
+ }, [node, ownerDocument, disableOutsidePointerEvents, context]);
83
+ React.useEffect(() => {
84
+ return () => {
85
+ if (!node) return;
86
+ context.layers.delete(node);
87
+ context.layersWithOutsidePointerEventsDisabled.delete(node);
88
+ dispatchUpdate();
89
+ };
90
+ }, [node, context]);
91
+ React.useEffect(() => {
92
+ const handleUpdate = () => force({});
93
+ document.addEventListener(CONTEXT_UPDATE, handleUpdate);
94
+ return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
95
+ }, []);
96
+ return /* @__PURE__ */ jsx(
97
+ Primitive.div,
98
+ {
99
+ ...layerProps,
100
+ ref: composedRefs,
101
+ style: {
102
+ pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
103
+ ...props.style
104
+ },
105
+ onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
106
+ onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
107
+ onPointerDownCapture: composeEventHandlers(
108
+ props.onPointerDownCapture,
109
+ pointerDownOutside.onPointerDownCapture
110
+ )
111
+ }
112
+ );
113
+ }
114
+ );
115
+ DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
116
+ var BRANCH_NAME = "DismissableLayerBranch";
117
+ var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
118
+ const context = React.useContext(DismissableLayerContext);
119
+ const ref = React.useRef(null);
120
+ const composedRefs = useComposedRefs(forwardedRef, ref);
121
+ React.useEffect(() => {
122
+ const node = ref.current;
123
+ if (node) {
124
+ context.branches.add(node);
125
+ return () => {
126
+ context.branches.delete(node);
127
+ };
128
+ }
129
+ }, [context.branches]);
130
+ return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
131
+ });
132
+ DismissableLayerBranch.displayName = BRANCH_NAME;
133
+ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
134
+ const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
135
+ const isPointerInsideReactTreeRef = React.useRef(false);
136
+ const handleClickRef = React.useRef(() => {
137
+ });
138
+ React.useEffect(() => {
139
+ const handlePointerDown = (event) => {
140
+ if (event.target && !isPointerInsideReactTreeRef.current) {
141
+ let handleAndDispatchPointerDownOutsideEvent2 = function() {
142
+ handleAndDispatchCustomEvent(
143
+ POINTER_DOWN_OUTSIDE,
144
+ handlePointerDownOutside,
145
+ eventDetail,
146
+ { discrete: true }
147
+ );
148
+ };
149
+ const eventDetail = { originalEvent: event };
150
+ if (event.pointerType === "touch") {
151
+ ownerDocument.removeEventListener("click", handleClickRef.current);
152
+ handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
153
+ ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
154
+ } else {
155
+ handleAndDispatchPointerDownOutsideEvent2();
156
+ }
157
+ } else {
158
+ ownerDocument.removeEventListener("click", handleClickRef.current);
159
+ }
160
+ isPointerInsideReactTreeRef.current = false;
161
+ };
162
+ const timerId = window.setTimeout(() => {
163
+ ownerDocument.addEventListener("pointerdown", handlePointerDown);
164
+ }, 0);
165
+ return () => {
166
+ window.clearTimeout(timerId);
167
+ ownerDocument.removeEventListener("pointerdown", handlePointerDown);
168
+ ownerDocument.removeEventListener("click", handleClickRef.current);
169
+ };
170
+ }, [ownerDocument, handlePointerDownOutside]);
171
+ return {
172
+ // ensures we check React component tree (not just DOM tree)
173
+ onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
174
+ };
175
+ }
176
+ function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
177
+ const handleFocusOutside = useCallbackRef(onFocusOutside);
178
+ const isFocusInsideReactTreeRef = React.useRef(false);
179
+ React.useEffect(() => {
180
+ const handleFocus = (event) => {
181
+ if (event.target && !isFocusInsideReactTreeRef.current) {
182
+ const eventDetail = { originalEvent: event };
183
+ handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
184
+ discrete: false
185
+ });
186
+ }
187
+ };
188
+ ownerDocument.addEventListener("focusin", handleFocus);
189
+ return () => ownerDocument.removeEventListener("focusin", handleFocus);
190
+ }, [ownerDocument, handleFocusOutside]);
191
+ return {
192
+ onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
193
+ onBlurCapture: () => isFocusInsideReactTreeRef.current = false
194
+ };
195
+ }
196
+ function dispatchUpdate() {
197
+ const event = new CustomEvent(CONTEXT_UPDATE);
198
+ document.dispatchEvent(event);
199
+ }
200
+ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
201
+ const target = detail.originalEvent.target;
202
+ const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
203
+ if (handler) target.addEventListener(name, handler, { once: true });
204
+ if (discrete) {
205
+ dispatchDiscreteCustomEvent(target, event);
206
+ } else {
207
+ target.dispatchEvent(event);
208
+ }
209
+ }
210
+ export {
211
+ DismissableLayer,
212
+ DismissableLayerBranch
213
+ };
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ var count = 0;
4
+ function useFocusGuards() {
5
+ React.useEffect(() => {
6
+ const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
7
+ document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
8
+ document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
9
+ count++;
10
+ return () => {
11
+ if (count === 1) {
12
+ document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
13
+ }
14
+ count--;
15
+ };
16
+ }, []);
17
+ }
18
+ function createFocusGuard() {
19
+ const element = document.createElement("span");
20
+ element.setAttribute("data-radix-focus-guard", "");
21
+ element.tabIndex = 0;
22
+ element.style.outline = "none";
23
+ element.style.opacity = "0";
24
+ element.style.position = "fixed";
25
+ element.style.pointerEvents = "none";
26
+ return element;
27
+ }
28
+ export {
29
+ useFocusGuards
30
+ };
@@ -0,0 +1,130 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ import { useComposedRefs } from "../../../../../@radix-ui_react-compose-refs@1.1.2_@types_react@18.3.23_react@18.3.1/node_modules/@radix-ui/react-compose-refs/dist/index.js";
4
+ import { useLayoutEffect as useLayoutEffect2 } from "../../../../../@radix-ui_react-use-layout-effect@1.1.1_@types_react@18.3.23_react@18.3.1/node_modules/@radix-ui/react-use-layout-effect/dist/index.js";
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
+ var Presence = (props) => {
12
+ const { present, children } = props;
13
+ const presence = usePresence(present);
14
+ const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
15
+ const ref = useComposedRefs(presence.ref, getElementRef(child));
16
+ const forceMount = typeof children === "function";
17
+ return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
18
+ };
19
+ Presence.displayName = "Presence";
20
+ function usePresence(present) {
21
+ const [node, setNode] = React.useState();
22
+ const stylesRef = React.useRef(null);
23
+ const prevPresentRef = React.useRef(present);
24
+ const prevAnimationNameRef = React.useRef("none");
25
+ const initialState = present ? "mounted" : "unmounted";
26
+ const [state, send] = useStateMachine(initialState, {
27
+ mounted: {
28
+ UNMOUNT: "unmounted",
29
+ ANIMATION_OUT: "unmountSuspended"
30
+ },
31
+ unmountSuspended: {
32
+ MOUNT: "mounted",
33
+ ANIMATION_END: "unmounted"
34
+ },
35
+ unmounted: {
36
+ MOUNT: "mounted"
37
+ }
38
+ });
39
+ React.useEffect(() => {
40
+ const currentAnimationName = getAnimationName(stylesRef.current);
41
+ prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
42
+ }, [state]);
43
+ useLayoutEffect2(() => {
44
+ const styles = stylesRef.current;
45
+ const wasPresent = prevPresentRef.current;
46
+ const hasPresentChanged = wasPresent !== present;
47
+ if (hasPresentChanged) {
48
+ const prevAnimationName = prevAnimationNameRef.current;
49
+ const currentAnimationName = getAnimationName(styles);
50
+ if (present) {
51
+ send("MOUNT");
52
+ } else if (currentAnimationName === "none" || (styles == null ? void 0 : styles.display) === "none") {
53
+ send("UNMOUNT");
54
+ } else {
55
+ const isAnimating = prevAnimationName !== currentAnimationName;
56
+ if (wasPresent && isAnimating) {
57
+ send("ANIMATION_OUT");
58
+ } else {
59
+ send("UNMOUNT");
60
+ }
61
+ }
62
+ prevPresentRef.current = present;
63
+ }
64
+ }, [present, send]);
65
+ useLayoutEffect2(() => {
66
+ if (node) {
67
+ let timeoutId;
68
+ const ownerWindow = node.ownerDocument.defaultView ?? window;
69
+ const handleAnimationEnd = (event) => {
70
+ const currentAnimationName = getAnimationName(stylesRef.current);
71
+ const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
72
+ if (event.target === node && isCurrentAnimation) {
73
+ send("ANIMATION_END");
74
+ if (!prevPresentRef.current) {
75
+ const currentFillMode = node.style.animationFillMode;
76
+ node.style.animationFillMode = "forwards";
77
+ timeoutId = ownerWindow.setTimeout(() => {
78
+ if (node.style.animationFillMode === "forwards") {
79
+ node.style.animationFillMode = currentFillMode;
80
+ }
81
+ });
82
+ }
83
+ }
84
+ };
85
+ const handleAnimationStart = (event) => {
86
+ if (event.target === node) {
87
+ prevAnimationNameRef.current = getAnimationName(stylesRef.current);
88
+ }
89
+ };
90
+ node.addEventListener("animationstart", handleAnimationStart);
91
+ node.addEventListener("animationcancel", handleAnimationEnd);
92
+ node.addEventListener("animationend", handleAnimationEnd);
93
+ return () => {
94
+ ownerWindow.clearTimeout(timeoutId);
95
+ node.removeEventListener("animationstart", handleAnimationStart);
96
+ node.removeEventListener("animationcancel", handleAnimationEnd);
97
+ node.removeEventListener("animationend", handleAnimationEnd);
98
+ };
99
+ } else {
100
+ send("ANIMATION_END");
101
+ }
102
+ }, [node, send]);
103
+ return {
104
+ isPresent: ["mounted", "unmountSuspended"].includes(state),
105
+ ref: React.useCallback((node2) => {
106
+ stylesRef.current = node2 ? getComputedStyle(node2) : null;
107
+ setNode(node2);
108
+ }, [])
109
+ };
110
+ }
111
+ function getAnimationName(styles) {
112
+ return (styles == null ? void 0 : styles.animationName) || "none";
113
+ }
114
+ function getElementRef(element) {
115
+ var _a, _b;
116
+ let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
117
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
118
+ if (mayWarn) {
119
+ return element.ref;
120
+ }
121
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
122
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
123
+ if (mayWarn) {
124
+ return element.props.ref;
125
+ }
126
+ return element.props.ref || element.ref;
127
+ }
128
+ export {
129
+ Presence
130
+ };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { Trigger, Close, Title, Portal as Portal$1, Description, Root as Root$1, Content as Content$1, Overlay as Overlay$1 } from "../../../../@radix-ui_react-dialog@1.1.14_@types_react-dom@18.3.7_@types_react@18.3.23__@types_react@18.3_skdkbhdoafm46nddrsexoqxvsa/node_modules/@radix-ui/react-dialog/dist/index.js";
2
+ import { Trigger, Close, Title, Portal as Portal$1, Description, Root as Root$1, Content as Content$1, Overlay as Overlay$1 } from "../../../../@radix-ui_react-dialog@1.1.15_@types_react-dom@18.3.7_@types_react@18.3.23__@types_react@18.3_n6h2mnlo6eeop2x37d75f7xnhe/node_modules/@radix-ui/react-dialog/dist/index.js";
3
3
  import * as React from "react";
4
4
  import React__default, { useLayoutEffect, useEffect, useMemo } from "react";
5
5
  function __insertCSS(code) {