@anoki/fse-ui 1.0.424 → 1.0.425

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 (264) hide show
  1. package/dist/index.cjs186.js +1 -1
  2. package/dist/index.cjs190.js +1 -1
  3. package/dist/index.cjs197.js +1 -1
  4. package/dist/index.cjs208.js +1 -1
  5. package/dist/index.cjs215.js +1 -1
  6. package/dist/index.cjs220.js +1 -1
  7. package/dist/index.cjs227.js +1 -1
  8. package/dist/index.cjs235.js +1 -1
  9. package/dist/index.cjs288.js +1 -1
  10. package/dist/index.cjs288.js.map +1 -1
  11. package/dist/index.cjs291.js +1 -1
  12. package/dist/index.cjs291.js.map +1 -1
  13. package/dist/index.cjs292.js +1 -1
  14. package/dist/index.cjs292.js.map +1 -1
  15. package/dist/index.cjs293.js +1 -1
  16. package/dist/index.cjs293.js.map +1 -1
  17. package/dist/{index.cjs290.js → index.cjs294.js} +2 -2
  18. package/dist/{index.cjs290.js.map → index.cjs294.js.map} +1 -1
  19. package/dist/index.cjs295.js +1 -1
  20. package/dist/index.cjs295.js.map +1 -1
  21. package/dist/index.cjs296.js +1 -1
  22. package/dist/index.cjs296.js.map +1 -1
  23. package/dist/index.cjs297.js +1 -1
  24. package/dist/index.cjs297.js.map +1 -1
  25. package/dist/index.cjs298.js +1 -1
  26. package/dist/index.cjs298.js.map +1 -1
  27. package/dist/index.cjs299.js +1 -1
  28. package/dist/index.cjs299.js.map +1 -1
  29. package/dist/index.cjs300.js +1 -1
  30. package/dist/index.cjs300.js.map +1 -1
  31. package/dist/index.cjs301.js +1 -1
  32. package/dist/index.cjs301.js.map +1 -1
  33. package/dist/index.cjs302.js +1 -1
  34. package/dist/index.cjs302.js.map +1 -1
  35. package/dist/index.cjs303.js +1 -1
  36. package/dist/index.cjs303.js.map +1 -1
  37. package/dist/index.cjs304.js +1 -1
  38. package/dist/index.cjs304.js.map +1 -1
  39. package/dist/index.cjs305.js +1 -1
  40. package/dist/index.cjs305.js.map +1 -1
  41. package/dist/index.cjs306.js +1 -1
  42. package/dist/index.cjs306.js.map +1 -1
  43. package/dist/index.cjs307.js +1 -1
  44. package/dist/index.cjs307.js.map +1 -1
  45. package/dist/index.cjs308.js +1 -1
  46. package/dist/index.cjs308.js.map +1 -1
  47. package/dist/index.cjs309.js +1 -1
  48. package/dist/index.cjs309.js.map +1 -1
  49. package/dist/{index.cjs317.js → index.cjs310.js} +2 -2
  50. package/dist/index.cjs310.js.map +1 -0
  51. package/dist/index.cjs311.js +2 -0
  52. package/dist/index.cjs311.js.map +1 -0
  53. package/dist/index.cjs312.js +2 -0
  54. package/dist/index.cjs312.js.map +1 -0
  55. package/dist/index.cjs313.js +2 -0
  56. package/dist/index.cjs313.js.map +1 -0
  57. package/dist/index.cjs314.js +2 -0
  58. package/dist/index.cjs314.js.map +1 -0
  59. package/dist/index.cjs315.js +1 -1
  60. package/dist/index.cjs315.js.map +1 -1
  61. package/dist/index.cjs318.js +1 -1
  62. package/dist/index.cjs318.js.map +1 -1
  63. package/dist/index.cjs319.js +1 -1
  64. package/dist/index.cjs319.js.map +1 -1
  65. package/dist/index.cjs320.js +1 -1
  66. package/dist/index.cjs320.js.map +1 -1
  67. package/dist/index.cjs321.js +1 -1
  68. package/dist/index.cjs321.js.map +1 -1
  69. package/dist/index.cjs322.js +1 -1
  70. package/dist/index.cjs322.js.map +1 -1
  71. package/dist/index.cjs329.js +2 -0
  72. package/dist/index.cjs329.js.map +1 -0
  73. package/dist/index.cjs330.js +1 -1
  74. package/dist/index.cjs330.js.map +1 -1
  75. package/dist/index.cjs331.js +1 -1
  76. package/dist/index.cjs331.js.map +1 -1
  77. package/dist/index.cjs332.js +1 -1
  78. package/dist/index.cjs332.js.map +1 -1
  79. package/dist/index.cjs339.js +1 -1
  80. package/dist/index.cjs339.js.map +1 -1
  81. package/dist/index.cjs340.js +1 -1
  82. package/dist/index.cjs340.js.map +1 -1
  83. package/dist/index.cjs341.js +1 -1
  84. package/dist/index.cjs341.js.map +1 -1
  85. package/dist/index.cjs342.js +1 -4
  86. package/dist/index.cjs342.js.map +1 -1
  87. package/dist/index.cjs343.js +1 -1
  88. package/dist/index.cjs343.js.map +1 -1
  89. package/dist/index.cjs344.js +1 -1
  90. package/dist/index.cjs344.js.map +1 -1
  91. package/dist/index.cjs345.js +2 -0
  92. package/dist/index.cjs345.js.map +1 -0
  93. package/dist/index.cjs346.js +2 -0
  94. package/dist/index.cjs346.js.map +1 -0
  95. package/dist/index.cjs347.js +5 -0
  96. package/dist/index.cjs347.js.map +1 -0
  97. package/dist/index.cjs348.js +1 -1
  98. package/dist/index.cjs348.js.map +1 -1
  99. package/dist/index.cjs349.js +1 -1
  100. package/dist/index.cjs349.js.map +1 -1
  101. package/dist/index.cjs350.js +1 -1
  102. package/dist/index.cjs350.js.map +1 -1
  103. package/dist/index.cjs351.js +1 -38
  104. package/dist/index.cjs351.js.map +1 -1
  105. package/dist/index.cjs352.js +1 -1
  106. package/dist/index.cjs352.js.map +1 -1
  107. package/dist/index.cjs353.js +38 -1
  108. package/dist/index.cjs353.js.map +1 -1
  109. package/dist/index.cjs354.js +1 -1
  110. package/dist/index.cjs354.js.map +1 -1
  111. package/dist/index.cjs355.js +1 -1
  112. package/dist/index.cjs355.js.map +1 -1
  113. package/dist/index.cjs356.js +1 -1
  114. package/dist/index.cjs356.js.map +1 -1
  115. package/dist/index.es186.js +7 -7
  116. package/dist/index.es190.js +1 -1
  117. package/dist/index.es197.js +8 -8
  118. package/dist/index.es208.js +14 -14
  119. package/dist/index.es215.js +1 -1
  120. package/dist/index.es220.js +1 -1
  121. package/dist/index.es227.js +1 -1
  122. package/dist/index.es235.js +7 -7
  123. package/dist/index.es288.js +15 -27
  124. package/dist/index.es288.js.map +1 -1
  125. package/dist/index.es291.js +6 -32
  126. package/dist/index.es291.js.map +1 -1
  127. package/dist/index.es292.js +23 -618
  128. package/dist/index.es292.js.map +1 -1
  129. package/dist/index.es293.js +66 -9
  130. package/dist/index.es293.js.map +1 -1
  131. package/dist/{index.es290.js → index.es294.js} +2 -2
  132. package/dist/{index.es290.js.map → index.es294.js.map} +1 -1
  133. package/dist/index.es295.js +32 -10
  134. package/dist/index.es295.js.map +1 -1
  135. package/dist/index.es296.js +621 -45
  136. package/dist/index.es296.js.map +1 -1
  137. package/dist/index.es297.js +10 -45
  138. package/dist/index.es297.js.map +1 -1
  139. package/dist/index.es298.js +5 -7
  140. package/dist/index.es298.js.map +1 -1
  141. package/dist/index.es299.js +23 -123
  142. package/dist/index.es299.js.map +1 -1
  143. package/dist/index.es300.js +67 -13
  144. package/dist/index.es300.js.map +1 -1
  145. package/dist/index.es301.js +28 -134
  146. package/dist/index.es301.js.map +1 -1
  147. package/dist/index.es302.js +10 -217
  148. package/dist/index.es302.js.map +1 -1
  149. package/dist/index.es303.js +45 -13
  150. package/dist/index.es303.js.map +1 -1
  151. package/dist/index.es304.js +43 -66
  152. package/dist/index.es304.js.map +1 -1
  153. package/dist/index.es305.js +7 -177
  154. package/dist/index.es305.js.map +1 -1
  155. package/dist/index.es306.js +122 -47
  156. package/dist/index.es306.js.map +1 -1
  157. package/dist/index.es307.js +14 -8
  158. package/dist/index.es307.js.map +1 -1
  159. package/dist/index.es308.js +135 -4
  160. package/dist/index.es308.js.map +1 -1
  161. package/dist/index.es309.js +217 -14
  162. package/dist/index.es309.js.map +1 -1
  163. package/dist/{index.es317.js → index.es310.js} +3 -3
  164. package/dist/index.es310.js.map +1 -0
  165. package/dist/index.es311.js +181 -0
  166. package/dist/index.es311.js.map +1 -0
  167. package/dist/index.es312.js +53 -0
  168. package/dist/index.es312.js.map +1 -0
  169. package/dist/index.es313.js +12 -0
  170. package/dist/index.es313.js.map +1 -0
  171. package/dist/index.es314.js +7 -0
  172. package/dist/index.es314.js.map +1 -0
  173. package/dist/index.es315.js +37 -120
  174. package/dist/index.es315.js.map +1 -1
  175. package/dist/index.es318.js +122 -30
  176. package/dist/index.es318.js.map +1 -1
  177. package/dist/index.es319.js +130 -37
  178. package/dist/index.es319.js.map +1 -1
  179. package/dist/index.es320.js +13 -11
  180. package/dist/index.es320.js.map +1 -1
  181. package/dist/index.es321.js +32 -204
  182. package/dist/index.es321.js.map +1 -1
  183. package/dist/index.es322.js +41 -21
  184. package/dist/index.es322.js.map +1 -1
  185. package/dist/index.es329.js +15 -0
  186. package/dist/index.es329.js.map +1 -0
  187. package/dist/index.es330.js +202 -22
  188. package/dist/index.es330.js.map +1 -1
  189. package/dist/index.es331.js +20 -27
  190. package/dist/index.es331.js.map +1 -1
  191. package/dist/index.es332.js +393 -5
  192. package/dist/index.es332.js.map +1 -1
  193. package/dist/index.es339.js +29 -5
  194. package/dist/index.es339.js.map +1 -1
  195. package/dist/index.es340.js +25 -3
  196. package/dist/index.es340.js.map +1 -1
  197. package/dist/index.es341.js +29 -24
  198. package/dist/index.es341.js.map +1 -1
  199. package/dist/index.es342.js +5 -110
  200. package/dist/index.es342.js.map +1 -1
  201. package/dist/index.es343.js +41 -15
  202. package/dist/index.es343.js.map +1 -1
  203. package/dist/index.es344.js +5 -29
  204. package/dist/index.es344.js.map +1 -1
  205. package/dist/index.es345.js +6 -0
  206. package/dist/index.es345.js.map +1 -0
  207. package/dist/index.es346.js +27 -0
  208. package/dist/index.es346.js.map +1 -0
  209. package/dist/index.es347.js +113 -0
  210. package/dist/index.es347.js.map +1 -0
  211. package/dist/index.es348.js +14 -521
  212. package/dist/index.es348.js.map +1 -1
  213. package/dist/index.es349.js +509 -113
  214. package/dist/index.es349.js.map +1 -1
  215. package/dist/index.es350.js +121 -123
  216. package/dist/index.es350.js.map +1 -1
  217. package/dist/index.es351.js +127 -67
  218. package/dist/index.es351.js.map +1 -1
  219. package/dist/index.es352.js +64 -8
  220. package/dist/index.es352.js.map +1 -1
  221. package/dist/index.es353.js +68 -13
  222. package/dist/index.es353.js.map +1 -1
  223. package/dist/index.es354.js +8 -61
  224. package/dist/index.es354.js.map +1 -1
  225. package/dist/index.es355.js +13 -64
  226. package/dist/index.es355.js.map +1 -1
  227. package/dist/index.es356.js +62 -42
  228. package/dist/index.es356.js.map +1 -1
  229. package/package.json +1 -4
  230. package/dist/index.cjs287.js +0 -2
  231. package/dist/index.cjs287.js.map +0 -1
  232. package/dist/index.cjs289.js +0 -2
  233. package/dist/index.cjs289.js.map +0 -1
  234. package/dist/index.cjs316.js +0 -2
  235. package/dist/index.cjs316.js.map +0 -1
  236. package/dist/index.cjs317.js.map +0 -1
  237. package/dist/index.cjs323.js +0 -2
  238. package/dist/index.cjs323.js.map +0 -1
  239. package/dist/index.cjs324.js +0 -2
  240. package/dist/index.cjs324.js.map +0 -1
  241. package/dist/index.cjs325.js +0 -2
  242. package/dist/index.cjs325.js.map +0 -1
  243. package/dist/index.cjs326.js +0 -2
  244. package/dist/index.cjs326.js.map +0 -1
  245. package/dist/index.cjs338.js +0 -2
  246. package/dist/index.cjs338.js.map +0 -1
  247. package/dist/index.es287.js +0 -10
  248. package/dist/index.es287.js.map +0 -1
  249. package/dist/index.es289.js +0 -71
  250. package/dist/index.es289.js.map +0 -1
  251. package/dist/index.es316.js +0 -138
  252. package/dist/index.es316.js.map +0 -1
  253. package/dist/index.es317.js.map +0 -1
  254. package/dist/index.es323.js +0 -28
  255. package/dist/index.es323.js.map +0 -1
  256. package/dist/index.es324.js +0 -396
  257. package/dist/index.es324.js.map +0 -1
  258. package/dist/index.es325.js +0 -9
  259. package/dist/index.es325.js.map +0 -1
  260. package/dist/index.es326.js +0 -32
  261. package/dist/index.es326.js.map +0 -1
  262. package/dist/index.es338.js +0 -45
  263. package/dist/index.es338.js.map +0 -1
  264. /package/dist/components/ui/{ConsentModal/ConsentModalFooter/ConsentModalFooter.css → DoctorModal/DoctorModalFooter/DoctorModalFooter.css} +0 -0
@@ -1,72 +1,49 @@
1
- import * as a from "react";
2
- import { useComposedRefs as E } from "./index.es288.js";
3
- import { useLayoutEffect as A } from "./index.es308.js";
4
- function T(n, e) {
5
- return a.useReducer((r, t) => e[r][t] ?? r, n);
6
- }
7
- var R = (n) => {
8
- const { present: e, children: r } = n, t = v(e), i = typeof r == "function" ? r({ present: t.isPresent }) : a.Children.only(r), c = E(t.ref, P(i));
9
- return typeof r == "function" || t.isPresent ? a.cloneElement(i, { ref: c }) : null;
10
- };
11
- R.displayName = "Presence";
12
- function v(n) {
13
- const [e, r] = a.useState(), t = a.useRef({}), i = a.useRef(n), c = a.useRef("none"), p = n ? "mounted" : "unmounted", [N, s] = T(p, {
14
- mounted: {
15
- UNMOUNT: "unmounted",
16
- ANIMATION_OUT: "unmountSuspended"
17
- },
18
- unmountSuspended: {
19
- MOUNT: "mounted",
20
- ANIMATION_END: "unmounted"
21
- },
22
- unmounted: {
23
- MOUNT: "mounted"
1
+ import n from "react";
2
+ import { createContextScope as O } from "./index.es293.js";
3
+ import { useComposedRefs as I } from "./index.es292.js";
4
+ import { Slot as S } from "./index.es303.js";
5
+ import { j as u } from "./index.es161.js";
6
+ function L(s) {
7
+ const f = s + "CollectionProvider", [A, E] = O(f), [N, m] = A(
8
+ f,
9
+ { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
10
+ ), a = (c) => {
11
+ const { scope: e, children: l } = c, o = n.useRef(null), t = n.useRef(/* @__PURE__ */ new Map()).current;
12
+ return /* @__PURE__ */ u.jsx(N, { scope: e, itemMap: t, collectionRef: o, children: l });
13
+ };
14
+ a.displayName = f;
15
+ const d = s + "CollectionSlot", p = n.forwardRef(
16
+ (c, e) => {
17
+ const { scope: l, children: o } = c, t = m(d, l), r = I(e, t.collectionRef);
18
+ return /* @__PURE__ */ u.jsx(S, { ref: r, children: o });
24
19
  }
25
- });
26
- return a.useEffect(() => {
27
- const o = l(t.current);
28
- c.current = N === "mounted" ? o : "none";
29
- }, [N]), A(() => {
30
- const o = t.current, m = i.current;
31
- if (m !== n) {
32
- const f = c.current, u = l(o);
33
- n ? s("MOUNT") : u === "none" || (o == null ? void 0 : o.display) === "none" ? s("UNMOUNT") : s(m && f !== u ? "ANIMATION_OUT" : "UNMOUNT"), i.current = n;
20
+ );
21
+ p.displayName = d;
22
+ const C = s + "CollectionItemSlot", R = "data-radix-collection-item", x = n.forwardRef(
23
+ (c, e) => {
24
+ const { scope: l, children: o, ...t } = c, r = n.useRef(null), M = I(e, r), i = m(C, l);
25
+ return n.useEffect(() => (i.itemMap.set(r, { ref: r, ...t }), () => void i.itemMap.delete(r))), /* @__PURE__ */ u.jsx(S, { [R]: "", ref: M, children: o });
34
26
  }
35
- }, [n, s]), A(() => {
36
- if (e) {
37
- let o;
38
- const m = e.ownerDocument.defaultView ?? window, d = (u) => {
39
- const g = l(t.current).includes(u.animationName);
40
- if (u.target === e && g && (s("ANIMATION_END"), !i.current)) {
41
- const O = e.style.animationFillMode;
42
- e.style.animationFillMode = "forwards", o = m.setTimeout(() => {
43
- e.style.animationFillMode === "forwards" && (e.style.animationFillMode = O);
44
- });
45
- }
46
- }, f = (u) => {
47
- u.target === e && (c.current = l(t.current));
48
- };
49
- return e.addEventListener("animationstart", f), e.addEventListener("animationcancel", d), e.addEventListener("animationend", d), () => {
50
- m.clearTimeout(o), e.removeEventListener("animationstart", f), e.removeEventListener("animationcancel", d), e.removeEventListener("animationend", d);
51
- };
52
- } else
53
- s("ANIMATION_END");
54
- }, [e, s]), {
55
- isPresent: ["mounted", "unmountSuspended"].includes(N),
56
- ref: a.useCallback((o) => {
57
- o && (t.current = getComputedStyle(o)), r(o);
58
- }, [])
59
- };
60
- }
61
- function l(n) {
62
- return (n == null ? void 0 : n.animationName) || "none";
63
- }
64
- function P(n) {
65
- var t, i;
66
- let e = (t = Object.getOwnPropertyDescriptor(n.props, "ref")) == null ? void 0 : t.get, r = e && "isReactWarning" in e && e.isReactWarning;
67
- return r ? n.ref : (e = (i = Object.getOwnPropertyDescriptor(n, "ref")) == null ? void 0 : i.get, r = e && "isReactWarning" in e && e.isReactWarning, r ? n.props.ref : n.props.ref || n.ref);
27
+ );
28
+ x.displayName = C;
29
+ function _(c) {
30
+ const e = m(s + "CollectionConsumer", c);
31
+ return n.useCallback(() => {
32
+ const o = e.collectionRef.current;
33
+ if (!o) return [];
34
+ const t = Array.from(o.querySelectorAll(`[${R}]`));
35
+ return Array.from(e.itemMap.values()).sort(
36
+ (i, T) => t.indexOf(i.ref.current) - t.indexOf(T.ref.current)
37
+ );
38
+ }, [e.collectionRef, e.itemMap]);
39
+ }
40
+ return [
41
+ { Provider: a, Slot: p, ItemSlot: x },
42
+ _,
43
+ E
44
+ ];
68
45
  }
69
46
  export {
70
- R as Presence
47
+ L as createCollection
71
48
  };
72
49
  //# sourceMappingURL=index.es304.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es304.js","sources":["../node_modules/@radix-ui/react-presence/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// packages/react/presence/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// packages/react/presence/src/useStateMachine.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// packages/react/presence/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({});\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(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 if (node2) stylesRef.current = getComputedStyle(node2);\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}\nexport {\n Presence\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["useStateMachine","initialState","machine","React","state","event","Presence","props","present","children","presence","usePresence","child","React2","ref","useComposedRefs","getElementRef","node","setNode","stylesRef","prevPresentRef","prevAnimationNameRef","send","currentAnimationName","getAnimationName","useLayoutEffect","styles","wasPresent","prevAnimationName","timeoutId","ownerWindow","handleAnimationEnd","isCurrentAnimation","currentFillMode","handleAnimationStart","node2","element","getter","_a","mayWarn","_b"],"mappings":";;;AASA,SAASA,EAAgBC,GAAcC,GAAS;AAC9C,SAAOC,EAAM,WAAW,CAACC,GAAOC,MACZH,EAAQE,CAAK,EAAEC,CAAK,KAClBD,GACnBH,CAAY;AACjB;AAGG,IAACK,IAAW,CAACC,MAAU;AACxB,QAAM,EAAE,SAAAC,GAAS,UAAAC,EAAQ,IAAKF,GACxBG,IAAWC,EAAYH,CAAO,GAC9BI,IAAQ,OAAOH,KAAa,aAAaA,EAAS,EAAE,SAASC,EAAS,UAAW,CAAA,IAAIG,EAAO,SAAS,KAAKJ,CAAQ,GAClHK,IAAMC,EAAgBL,EAAS,KAAKM,EAAcJ,CAAK,CAAC;AAE9D,SADmB,OAAOH,KAAa,cAClBC,EAAS,YAAYG,EAAO,aAAaD,GAAO,EAAE,K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;AAC7D,SAAIE,IACKH,EAAQ,OAEjBC,KAASG,IAAA,OAAO,yBAAyBJ,GAAS,KAAK,MAA9C,gBAAAI,EAAiD,KAC1DD,IAAUF,KAAU,oBAAoBA,KAAUA,EAAO,gBACrDE,IACKH,EAAQ,MAAM,MAEhBA,EAAQ,MAAM,OAAOA,EAAQ;AACtC;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.es304.js","sources":["../node_modules/@radix-ui/react-collection/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// packages/react/collection/src/Collection.tsx\nimport React from \"react\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createCollection(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }\n );\n const CollectionProvider = (props) => {\n const { scope, children } = props;\n const ref = React.useRef(null);\n const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;\n return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx(Slot, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...itemData });\n return () => void context.itemMap.delete(ref);\n });\n return /* @__PURE__ */ jsx(Slot, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useCollection(scope) {\n const context = useCollectionContext(name + \"CollectionConsumer\", scope);\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n return getItems;\n }\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope\n ];\n}\nexport {\n createCollection\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["createCollection","name","PROVIDER_NAME","createCollectionContext","createCollectionScope","createContextScope","CollectionProviderImpl","useCollectionContext","CollectionProvider","props","scope","children","ref","React","itemMap","jsx","COLLECTION_SLOT_NAME","CollectionSlot","forwardedRef","context","composedRefs","useComposedRefs","Slot","ITEM_SLOT_NAME","ITEM_DATA_ATTR","CollectionItemSlot","itemData","useCollection","collectionNode","orderedNodes","a","b"],"mappings":";;;;;AAQA,SAASA,EAAiBC,GAAM;AAC9B,QAAMC,IAAgBD,IAAO,sBACvB,CAACE,GAAyBC,CAAqB,IAAIC,EAAmBH,CAAa,GACnF,CAACI,GAAwBC,CAAoB,IAAIJ;AAAA,IACrDD;AAAA,IACA,EAAE,eAAe,EAAE,SAAS,KAAI,GAAI,SAAyB,oBAAI,IAAK,EAAA;A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cF;AACjC,WAASI,EAAcjB,GAAO;AAC5B,UAAMS,IAAUZ,EAAqBN,IAAO,sBAAsBS,CAAK;AAWvE,WAViBG,EAAM,YAAY,MAAM;AACvC,YAAMe,IAAiBT,EAAQ,cAAc;AAC7C,UAAI,CAACS,EAAgB,QAAO,CAAE;AAC9B,YAAMC,IAAe,MAAM,KAAKD,EAAe,iBAAiB,IAAIJ,CAAc,GAAG,CAAC;AAKtF,aAJc,MAAM,KAAKL,EAAQ,QAAQ,QAAQ,EACtB;AAAA,QACzB,CAACW,GAAGC,MAAMF,EAAa,QAAQC,EAAE,IAAI,OAAO,IAAID,EAAa,QAAQE,EAAE,IAAI,OAAO;AAAA,MACnF;AAAA,IAEF,GAAE,CAACZ,EAAQ,eAAeA,EAAQ,OAAO,CAAC;AAAA,EAE/C;AACE,SAAO;AAAA,IACL,EAAE,UAAUX,GAAoB,MAAMS,GAAgB,UAAUQ,EAAoB;AAAA,IACpFE;AAAA,IACAvB;AAAA,EACD;AACH;","x_google_ignoreList":[0]}
@@ -1,181 +1,11 @@
1
- import * as s from "react";
2
- import { composeEventHandlers as p } from "./index.es287.js";
3
- import { createCollection as H } from "./index.es297.js";
4
- import { useComposedRefs as V } from "./index.es288.js";
5
- import { createContextScope as z } from "./index.es289.js";
6
- import { useId as q } from "./index.es293.js";
7
- import { Primitive as P } from "./index.es291.js";
8
- import { useCallbackRef as J } from "./index.es295.js";
9
- import { useControllableState as Q } from "./index.es290.js";
10
- import { useDirection as W } from "./index.es298.js";
11
- import { j as d } from "./index.es161.js";
12
- var _ = "rovingFocusGroup.onEntryFocus", X = { bubbles: !1, cancelable: !0 }, b = "RovingFocusGroup", [h, G, Z] = H(b), [$, Fe] = z(
13
- b,
14
- [Z]
15
- ), [ee, oe] = $(b), N = s.forwardRef(
16
- (e, r) => /* @__PURE__ */ d.jsx(h.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d.jsx(h.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d.jsx(te, { ...e, ref: r }) }) })
17
- );
18
- N.displayName = b;
19
- var te = s.forwardRef((e, r) => {
20
- const {
21
- __scopeRovingFocusGroup: c,
22
- orientation: o,
23
- loop: F = !1,
24
- dir: g,
25
- currentTabStopId: R,
26
- defaultCurrentTabStopId: E,
27
- onCurrentTabStopIdChange: m,
28
- onEntryFocus: u,
29
- preventScrollOnEntryFocus: w = !1,
30
- ...C
31
- } = e, v = s.useRef(null), I = V(r, v), t = W(g), [f = null, T] = Q({
32
- prop: R,
33
- defaultProp: E,
34
- onChange: m
35
- }), [a, i] = s.useState(!1), S = J(u), M = G(c), x = s.useRef(!1), [k, y] = s.useState(0);
36
- return s.useEffect(() => {
37
- const n = v.current;
38
- if (n)
39
- return n.addEventListener(_, S), () => n.removeEventListener(_, S);
40
- }, [S]), /* @__PURE__ */ d.jsx(
41
- ee,
42
- {
43
- scope: c,
44
- orientation: o,
45
- dir: t,
46
- loop: F,
47
- currentTabStopId: f,
48
- onItemFocus: s.useCallback(
49
- (n) => T(n),
50
- [T]
51
- ),
52
- onItemShiftTab: s.useCallback(() => i(!0), []),
53
- onFocusableItemAdd: s.useCallback(
54
- () => y((n) => n + 1),
55
- []
56
- ),
57
- onFocusableItemRemove: s.useCallback(
58
- () => y((n) => n - 1),
59
- []
60
- ),
61
- children: /* @__PURE__ */ d.jsx(
62
- P.div,
63
- {
64
- tabIndex: a || k === 0 ? -1 : 0,
65
- "data-orientation": o,
66
- ...C,
67
- ref: I,
68
- style: { outline: "none", ...e.style },
69
- onMouseDown: p(e.onMouseDown, () => {
70
- x.current = !0;
71
- }),
72
- onFocus: p(e.onFocus, (n) => {
73
- const L = !x.current;
74
- if (n.target === n.currentTarget && L && !a) {
75
- const D = new CustomEvent(_, X);
76
- if (n.currentTarget.dispatchEvent(D), !D.defaultPrevented) {
77
- const A = M().filter((l) => l.focusable), U = A.find((l) => l.active), B = A.find((l) => l.id === f), Y = [U, B, ...A].filter(
78
- Boolean
79
- ).map((l) => l.ref.current);
80
- j(Y, w);
81
- }
82
- }
83
- x.current = !1;
84
- }),
85
- onBlur: p(e.onBlur, () => i(!1))
86
- }
87
- )
88
- }
89
- );
90
- }), O = "RovingFocusGroupItem", K = s.forwardRef(
91
- (e, r) => {
92
- const {
93
- __scopeRovingFocusGroup: c,
94
- focusable: o = !0,
95
- active: F = !1,
96
- tabStopId: g,
97
- ...R
98
- } = e, E = q(), m = g || E, u = oe(O, c), w = u.currentTabStopId === m, C = G(c), { onFocusableItemAdd: v, onFocusableItemRemove: I } = u;
99
- return s.useEffect(() => {
100
- if (o)
101
- return v(), () => I();
102
- }, [o, v, I]), /* @__PURE__ */ d.jsx(
103
- h.ItemSlot,
104
- {
105
- scope: c,
106
- id: m,
107
- focusable: o,
108
- active: F,
109
- children: /* @__PURE__ */ d.jsx(
110
- P.span,
111
- {
112
- tabIndex: w ? 0 : -1,
113
- "data-orientation": u.orientation,
114
- ...R,
115
- ref: r,
116
- onMouseDown: p(e.onMouseDown, (t) => {
117
- o ? u.onItemFocus(m) : t.preventDefault();
118
- }),
119
- onFocus: p(e.onFocus, () => u.onItemFocus(m)),
120
- onKeyDown: p(e.onKeyDown, (t) => {
121
- if (t.key === "Tab" && t.shiftKey) {
122
- u.onItemShiftTab();
123
- return;
124
- }
125
- if (t.target !== t.currentTarget) return;
126
- const f = se(t, u.orientation, u.dir);
127
- if (f !== void 0) {
128
- if (t.metaKey || t.ctrlKey || t.altKey || t.shiftKey) return;
129
- t.preventDefault();
130
- let a = C().filter((i) => i.focusable).map((i) => i.ref.current);
131
- if (f === "last") a.reverse();
132
- else if (f === "prev" || f === "next") {
133
- f === "prev" && a.reverse();
134
- const i = a.indexOf(t.currentTarget);
135
- a = u.loop ? ce(a, i + 1) : a.slice(i + 1);
136
- }
137
- setTimeout(() => j(a));
138
- }
139
- })
140
- }
141
- )
142
- }
143
- );
144
- }
145
- );
146
- K.displayName = O;
147
- var re = {
148
- ArrowLeft: "prev",
149
- ArrowUp: "prev",
150
- ArrowRight: "next",
151
- ArrowDown: "next",
152
- PageUp: "first",
153
- Home: "first",
154
- PageDown: "last",
155
- End: "last"
156
- };
157
- function ne(e, r) {
158
- return r !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
159
- }
160
- function se(e, r, c) {
161
- const o = ne(e.key, c);
162
- if (!(r === "vertical" && ["ArrowLeft", "ArrowRight"].includes(o)) && !(r === "horizontal" && ["ArrowUp", "ArrowDown"].includes(o)))
163
- return re[o];
164
- }
165
- function j(e, r = !1) {
166
- const c = document.activeElement;
167
- for (const o of e)
168
- if (o === c || (o.focus({ preventScroll: r }), document.activeElement !== c)) return;
169
- }
170
- function ce(e, r) {
171
- return e.map((c, o) => e[(r + o) % e.length]);
1
+ import * as t from "react";
2
+ import "./index.es161.js";
3
+ var r = t.createContext(void 0);
4
+ function i(e) {
5
+ const o = t.useContext(r);
6
+ return e || o || "ltr";
172
7
  }
173
- var ge = N, Re = K;
174
8
  export {
175
- Re as Item,
176
- ge as Root,
177
- N as RovingFocusGroup,
178
- K as RovingFocusGroupItem,
179
- Fe as createRovingFocusGroupScope
9
+ i as useDirection
180
10
  };
181
11
  //# sourceMappingURL=index.es305.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es305.js","sources":["../node_modules/@radix-ui/react-roving-focus/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// packages/react/roving-focus/src/RovingFocusGroup.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { createCollection } from \"@radix-ui/react-collection\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useId } from \"@radix-ui/react-id\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { useDirection } from \"@radix-ui/react-direction\";\nimport { jsx } from \"react/jsx-runtime\";\nvar ENTRY_FOCUS = \"rovingFocusGroup.onEntryFocus\";\nvar EVENT_OPTIONS = { bubbles: false, cancelable: true };\nvar GROUP_NAME = \"RovingFocusGroup\";\nvar [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);\nvar [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(\n GROUP_NAME,\n [createCollectionScope]\n);\nvar [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);\nvar RovingFocusGroup = React.forwardRef(\n (props, forwardedRef) => {\n return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });\n }\n);\nRovingFocusGroup.displayName = GROUP_NAME;\nvar RovingFocusGroupImpl = React.forwardRef((props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n orientation,\n loop = false,\n dir,\n currentTabStopId: currentTabStopIdProp,\n defaultCurrentTabStopId,\n onCurrentTabStopIdChange,\n onEntryFocus,\n preventScrollOnEntryFocus = false,\n ...groupProps\n } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const direction = useDirection(dir);\n const [currentTabStopId = null, setCurrentTabStopId] = useControllableState({\n prop: currentTabStopIdProp,\n defaultProp: defaultCurrentTabStopId,\n onChange: onCurrentTabStopIdChange\n });\n const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);\n const handleEntryFocus = useCallbackRef(onEntryFocus);\n const getItems = useCollection(__scopeRovingFocusGroup);\n const isClickFocusRef = React.useRef(false);\n const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n node.addEventListener(ENTRY_FOCUS, handleEntryFocus);\n return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);\n }\n }, [handleEntryFocus]);\n return /* @__PURE__ */ jsx(\n RovingFocusProvider,\n {\n scope: __scopeRovingFocusGroup,\n orientation,\n dir: direction,\n loop,\n currentTabStopId,\n onItemFocus: React.useCallback(\n (tabStopId) => setCurrentTabStopId(tabStopId),\n [setCurrentTabStopId]\n ),\n onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []),\n onFocusableItemAdd: React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount + 1),\n []\n ),\n onFocusableItemRemove: React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount - 1),\n []\n ),\n children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,\n \"data-orientation\": orientation,\n ...groupProps,\n ref: composedRefs,\n style: { outline: \"none\", ...props.style },\n onMouseDown: composeEventHandlers(props.onMouseDown, () => {\n isClickFocusRef.current = true;\n }),\n onFocus: composeEventHandlers(props.onFocus, (event) => {\n const isKeyboardFocus = !isClickFocusRef.current;\n if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {\n const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);\n event.currentTarget.dispatchEvent(entryFocusEvent);\n if (!entryFocusEvent.defaultPrevented) {\n const items = getItems().filter((item) => item.focusable);\n const activeItem = items.find((item) => item.active);\n const currentItem = items.find((item) => item.id === currentTabStopId);\n const candidateItems = [activeItem, currentItem, ...items].filter(\n Boolean\n );\n const candidateNodes = candidateItems.map((item) => item.ref.current);\n focusFirst(candidateNodes, preventScrollOnEntryFocus);\n }\n }\n isClickFocusRef.current = false;\n }),\n onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))\n }\n )\n }\n );\n});\nvar ITEM_NAME = \"RovingFocusGroupItem\";\nvar RovingFocusGroupItem = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n focusable = true,\n active = false,\n tabStopId,\n ...itemProps\n } = props;\n const autoId = useId();\n const id = tabStopId || autoId;\n const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);\n const isCurrentTabStop = context.currentTabStopId === id;\n const getItems = useCollection(__scopeRovingFocusGroup);\n const { onFocusableItemAdd, onFocusableItemRemove } = context;\n React.useEffect(() => {\n if (focusable) {\n onFocusableItemAdd();\n return () => onFocusableItemRemove();\n }\n }, [focusable, onFocusableItemAdd, onFocusableItemRemove]);\n return /* @__PURE__ */ jsx(\n Collection.ItemSlot,\n {\n scope: __scopeRovingFocusGroup,\n id,\n focusable,\n active,\n children: /* @__PURE__ */ jsx(\n Primitive.span,\n {\n tabIndex: isCurrentTabStop ? 0 : -1,\n \"data-orientation\": context.orientation,\n ...itemProps,\n ref: forwardedRef,\n onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {\n if (!focusable) event.preventDefault();\n else context.onItemFocus(id);\n }),\n onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key === \"Tab\" && event.shiftKey) {\n context.onItemShiftTab();\n return;\n }\n if (event.target !== event.currentTarget) return;\n const focusIntent = getFocusIntent(event, context.orientation, context.dir);\n if (focusIntent !== void 0) {\n if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;\n event.preventDefault();\n const items = getItems().filter((item) => item.focusable);\n let candidateNodes = items.map((item) => item.ref.current);\n if (focusIntent === \"last\") candidateNodes.reverse();\n else if (focusIntent === \"prev\" || focusIntent === \"next\") {\n if (focusIntent === \"prev\") candidateNodes.reverse();\n const currentIndex = candidateNodes.indexOf(event.currentTarget);\n candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);\n }\n setTimeout(() => focusFirst(candidateNodes));\n }\n })\n }\n )\n }\n );\n }\n);\nRovingFocusGroupItem.displayName = ITEM_NAME;\nvar MAP_KEY_TO_FOCUS_INTENT = {\n ArrowLeft: \"prev\",\n ArrowUp: \"prev\",\n ArrowRight: \"next\",\n ArrowDown: \"next\",\n PageUp: \"first\",\n Home: \"first\",\n PageDown: \"last\",\n End: \"last\"\n};\nfunction getDirectionAwareKey(key, dir) {\n if (dir !== \"rtl\") return key;\n return key === \"ArrowLeft\" ? \"ArrowRight\" : key === \"ArrowRight\" ? \"ArrowLeft\" : key;\n}\nfunction getFocusIntent(event, orientation, dir) {\n const key = getDirectionAwareKey(event.key, dir);\n if (orientation === \"vertical\" && [\"ArrowLeft\", \"ArrowRight\"].includes(key)) return void 0;\n if (orientation === \"horizontal\" && [\"ArrowUp\", \"ArrowDown\"].includes(key)) return void 0;\n return MAP_KEY_TO_FOCUS_INTENT[key];\n}\nfunction focusFirst(candidates, preventScroll = false) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus({ preventScroll });\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\nfunction wrapArray(array, startIndex) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\nvar Root = RovingFocusGroup;\nvar Item = RovingFocusGroupItem;\nexport {\n Item,\n Root,\n RovingFocusGroup,\n RovingFocusGroupItem,\n createRovingFocusGroupScope\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["ENTRY_FOCUS","EVENT_OPTIONS","GROUP_NAME","Collection","useCollection","createCollectionScope","createCollection","createRovingFocusGroupContext","createRovingFocusGroupScope","createContextScope","RovingFocusProvider","useRovingFocusContext","RovingFocusGroup","React","props","forwardedRef","jsx","RovingFocusGroupImpl","__scopeRovingFocusGroup","orientation","loop","dir","currentTabStopIdProp","defaultCurrentTabStopId","onCurrentTabStopIdChange","onEntryFocus","preventScrollOnEntryFocus","groupProps","ref","composedRefs","useComposedRefs","direction","useDirection","currentTabStopId","setCurrentTabStopId","useControllableState","isTabbingBackOut","setIsTabbingBackOut","handleEntryFocus","useCallbackRef","getItems","isClickFocusRef","focusableItemsCount","setFocusableItemsCount","node","tabStopId","prevCount","Primitive","composeEventHandlers","event","isKeyboardFocus","entryFocusEvent","items","item","activeItem","currentItem","candidateNodes","focusFirst","ITEM_NAME","RovingFocusGroupItem","focusable","active","itemProps","autoId","useId","id","context","isCurrentTabStop","onFocusableItemAdd","onFocusableItemRemove","focusIntent","getFocusIntent","currentIndex","wrapArray","MAP_KEY_TO_FOCUS_INTENT","getDirectionAwareKey","key","candidates","preventScroll","PREVIOUSLY_FOCUSED_ELEMENT","candidate","array","startIndex","_","index","Root","Item"],"mappings":";;;;;;;;;;;AAcA,IAAIA,IAAc,iCACdC,IAAgB,EAAE,SAAS,IAAO,YAAY,GAAM,GACpDC,IAAa,oBACb,CAACC,GAAYC,GAAeC,CAAqB,IAAIC,EAAiBJ,CAAU,GAChF,CAACK,GAA+BC,EAA2B,IAAIC;AAAA,EACjEP;AAAA,EACA,CAACG,CAAqB;AACxB,GACI,CAACK,IAAqBC,EAAqB,IAAIJ,EAA8BL,CAAU,GACvFU,IAAmBC,EAAM;AAAA,EAC3B,CAACC,GAAOC,MACiBC,gBAAAA,MAAIb,EAAW,UAAU,EAAE,OAAOW,EAAM,yBAAyB,UAA0BE,gBAAAA,MAAIb,EAAW,MAAM,EAAE,OAAOW,EAAM,yBAAyB,UAA0BE,gBAAAA,EAAAA,IAAIC,IAAsB,EAAE,GAAGH,GAAO,KAAKC,GAAc,EAAC,CAAE,EAAC,CAAE;AAE5Q;AACAH,EAAiB,cAAcV;AAC/B,IAAIe,KAAuBJ,EAAM,WAAW,CAACC,GAAOC,MAAiB;AACnE,QAAM;AAAA,IACJ,yBAAAG;AAAA,IACA,aAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,KAAAC;AAAA,IACA,kBAAkBC;AAAA,IAClB,yBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,cAAAC;AAAA,IACA,2BAAAC,IAA4B;AAAA,IAC5B,GAAGC;AAAA,EACP,IAAMb,GACEc,IAAMf,EAA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AAE,eAAAF,GAAe,GAC7B,SAAS,kBAAkBC,GAA4B;AAE/D;AACA,SAASN,GAAUQ,GAAOC,GAAY;AACpC,SAAOD,EAAM,IAAI,CAACE,GAAGC,MAAUH,GAAOC,IAAaE,KAASH,EAAM,MAAM,CAAC;AAC3E;AACG,IAACI,KAAOzE,GACP0E,KAAO3B;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.es305.js","sources":["../node_modules/@radix-ui/react-direction/dist/index.mjs"],"sourcesContent":["// packages/react/direction/src/Direction.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DirectionContext = React.createContext(void 0);\nvar DirectionProvider = (props) => {\n const { dir, children } = props;\n return /* @__PURE__ */ jsx(DirectionContext.Provider, { value: dir, children });\n};\nfunction useDirection(localDir) {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || \"ltr\";\n}\nvar Provider = DirectionProvider;\nexport {\n DirectionProvider,\n Provider,\n useDirection\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["DirectionContext","React","useDirection","localDir","globalDir"],"mappings":";;AAGA,IAAIA,IAAmBC,EAAM,cAAc,MAAM;AAKjD,SAASC,EAAaC,GAAU;AAC9B,QAAMC,IAAYH,EAAM,WAAWD,CAAgB;AACnD,SAAOG,KAAYC,KAAa;AAClC;","x_google_ignoreList":[0]}
@@ -1,53 +1,128 @@
1
- var S = function(r) {
2
- if (typeof document > "u")
3
- return null;
4
- var u = Array.isArray(r) ? r[0] : r;
5
- return u.ownerDocument.body;
6
- }, f = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), p = {}, h = 0, W = function(r) {
7
- return r && (r.host || W(r.parentNode));
8
- }, D = function(r, u) {
9
- return u.map(function(t) {
10
- if (r.contains(t))
11
- return t;
12
- var n = W(t);
13
- return n && r.contains(n) ? n : (console.error("aria-hidden", t, "in not contained inside", r, ". Doing nothing"), null);
14
- }).filter(function(t) {
15
- return !!t;
1
+ import * as n from "react";
2
+ import { composeEventHandlers as m } from "./index.es291.js";
3
+ import { Primitive as R, dispatchDiscreteCustomEvent as k } from "./index.es295.js";
4
+ import { useComposedRefs as g } from "./index.es292.js";
5
+ import { useCallbackRef as w } from "./index.es302.js";
6
+ import { useEscapeKeydown as U } from "./index.es329.js";
7
+ import { j as x } from "./index.es161.js";
8
+ var j = "DismissableLayer", p = "dismissableLayer.update", z = "dismissableLayer.pointerDownOutside", H = "dismissableLayer.focusOutside", L, T = n.createContext({
9
+ layers: /* @__PURE__ */ new Set(),
10
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
11
+ branches: /* @__PURE__ */ new Set()
12
+ }), M = n.forwardRef(
13
+ (r, e) => {
14
+ const {
15
+ disableOutsidePointerEvents: i = !1,
16
+ onEscapeKeyDown: o,
17
+ onPointerDownOutside: t,
18
+ onFocusOutside: a,
19
+ onInteractOutside: l,
20
+ onDismiss: d,
21
+ ...E
22
+ } = r, c = n.useContext(T), [u, S] = n.useState(null), f = (u == null ? void 0 : u.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, F] = n.useState({}), W = g(e, (s) => S(s)), y = Array.from(c.layers), [A] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), N = y.indexOf(A), b = u ? y.indexOf(u) : -1, I = c.layersWithOutsidePointerEventsDisabled.size > 0, P = b >= N, _ = q((s) => {
23
+ const v = s.target, C = [...c.branches].some((h) => h.contains(v));
24
+ !P || C || (t == null || t(s), l == null || l(s), s.defaultPrevented || d == null || d());
25
+ }, f), D = G((s) => {
26
+ const v = s.target;
27
+ [...c.branches].some((h) => h.contains(v)) || (a == null || a(s), l == null || l(s), s.defaultPrevented || d == null || d());
28
+ }, f);
29
+ return U((s) => {
30
+ b === c.layers.size - 1 && (o == null || o(s), !s.defaultPrevented && d && (s.preventDefault(), d()));
31
+ }, f), n.useEffect(() => {
32
+ if (u)
33
+ return i && (c.layersWithOutsidePointerEventsDisabled.size === 0 && (L = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), c.layersWithOutsidePointerEventsDisabled.add(u)), c.layers.add(u), O(), () => {
34
+ i && c.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = L);
35
+ };
36
+ }, [u, f, i, c]), n.useEffect(() => () => {
37
+ u && (c.layers.delete(u), c.layersWithOutsidePointerEventsDisabled.delete(u), O());
38
+ }, [u, c]), n.useEffect(() => {
39
+ const s = () => F({});
40
+ return document.addEventListener(p, s), () => document.removeEventListener(p, s);
41
+ }, []), /* @__PURE__ */ x.jsx(
42
+ R.div,
43
+ {
44
+ ...E,
45
+ ref: W,
46
+ style: {
47
+ pointerEvents: I ? P ? "auto" : "none" : void 0,
48
+ ...r.style
49
+ },
50
+ onFocusCapture: m(r.onFocusCapture, D.onFocusCapture),
51
+ onBlurCapture: m(r.onBlurCapture, D.onBlurCapture),
52
+ onPointerDownCapture: m(
53
+ r.onPointerDownCapture,
54
+ _.onPointerDownCapture
55
+ )
56
+ }
57
+ );
58
+ }
59
+ );
60
+ M.displayName = j;
61
+ var X = "DismissableLayerBranch", Y = n.forwardRef((r, e) => {
62
+ const i = n.useContext(T), o = n.useRef(null), t = g(e, o);
63
+ return n.useEffect(() => {
64
+ const a = o.current;
65
+ if (a)
66
+ return i.branches.add(a), () => {
67
+ i.branches.delete(a);
68
+ };
69
+ }, [i.branches]), /* @__PURE__ */ x.jsx(R.div, { ...r, ref: t });
70
+ });
71
+ Y.displayName = X;
72
+ function q(r, e = globalThis == null ? void 0 : globalThis.document) {
73
+ const i = w(r), o = n.useRef(!1), t = n.useRef(() => {
16
74
  });
17
- }, E = function(r, u, t, n) {
18
- var i = D(u, Array.isArray(r) ? r : [r]);
19
- p[t] || (p[t] = /* @__PURE__ */ new WeakMap());
20
- var s = p[t], l = [], o = /* @__PURE__ */ new Set(), b = new Set(i), y = function(e) {
21
- !e || o.has(e) || (o.add(e), y(e.parentNode));
75
+ return n.useEffect(() => {
76
+ const a = (d) => {
77
+ if (d.target && !o.current) {
78
+ let E = function() {
79
+ B(
80
+ z,
81
+ i,
82
+ c,
83
+ { discrete: !0 }
84
+ );
85
+ };
86
+ const c = { originalEvent: d };
87
+ d.pointerType === "touch" ? (e.removeEventListener("click", t.current), t.current = E, e.addEventListener("click", t.current, { once: !0 })) : E();
88
+ } else
89
+ e.removeEventListener("click", t.current);
90
+ o.current = !1;
91
+ }, l = window.setTimeout(() => {
92
+ e.addEventListener("pointerdown", a);
93
+ }, 0);
94
+ return () => {
95
+ window.clearTimeout(l), e.removeEventListener("pointerdown", a), e.removeEventListener("click", t.current);
96
+ };
97
+ }, [e, i]), {
98
+ // ensures we check React component tree (not just DOM tree)
99
+ onPointerDownCapture: () => o.current = !0
22
100
  };
23
- i.forEach(y);
24
- var A = function(e) {
25
- !e || b.has(e) || Array.prototype.forEach.call(e.children, function(a) {
26
- if (o.has(a))
27
- A(a);
28
- else
29
- try {
30
- var c = a.getAttribute(n), w = c !== null && c !== "false", d = (f.get(a) || 0) + 1, M = (s.get(a) || 0) + 1;
31
- f.set(a, d), s.set(a, M), l.push(a), d === 1 && w && v.set(a, !0), M === 1 && a.setAttribute(t, "true"), w || a.setAttribute(n, "true");
32
- } catch (k) {
33
- console.error("aria-hidden: cannot operate on ", a, k);
34
- }
35
- });
101
+ }
102
+ function G(r, e = globalThis == null ? void 0 : globalThis.document) {
103
+ const i = w(r), o = n.useRef(!1);
104
+ return n.useEffect(() => {
105
+ const t = (a) => {
106
+ a.target && !o.current && B(H, i, { originalEvent: a }, {
107
+ discrete: !1
108
+ });
109
+ };
110
+ return e.addEventListener("focusin", t), () => e.removeEventListener("focusin", t);
111
+ }, [e, i]), {
112
+ onFocusCapture: () => o.current = !0,
113
+ onBlurCapture: () => o.current = !1
36
114
  };
37
- return A(u), o.clear(), h++, function() {
38
- l.forEach(function(e) {
39
- var a = f.get(e) - 1, c = s.get(e) - 1;
40
- f.set(e, a), s.set(e, c), a || (v.has(e) || e.removeAttribute(n), v.delete(e)), c || e.removeAttribute(t);
41
- }), h--, h || (f = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), p = {});
42
- };
43
- }, C = function(r, u, t) {
44
- t === void 0 && (t = "data-aria-hidden");
45
- var n = Array.from(Array.isArray(r) ? r : [r]), i = S(r);
46
- return i ? (n.push.apply(n, Array.from(i.querySelectorAll("[aria-live]"))), E(n, i, t, "aria-hidden")) : function() {
47
- return null;
48
- };
49
- };
115
+ }
116
+ function O() {
117
+ const r = new CustomEvent(p);
118
+ document.dispatchEvent(r);
119
+ }
120
+ function B(r, e, i, { discrete: o }) {
121
+ const t = i.originalEvent.target, a = new CustomEvent(r, { bubbles: !1, cancelable: !0, detail: i });
122
+ e && t.addEventListener(r, e, { once: !0 }), o ? k(t, a) : t.dispatchEvent(a);
123
+ }
50
124
  export {
51
- C as hideOthers
125
+ M as DismissableLayer,
126
+ Y as DismissableLayerBranch
52
127
  };
53
128
  //# sourceMappingURL=index.es306.js.map