@yselimcan/ui 0.0.3 → 0.0.4

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 (208) hide show
  1. package/dist/index100.js +5 -4
  2. package/dist/index101.js +128 -61
  3. package/dist/index102.js +27 -8
  4. package/dist/index103.js +7 -12
  5. package/dist/index104.js +5 -4
  6. package/dist/index105.js +12 -3
  7. package/dist/index106.js +22 -5
  8. package/dist/index108.js +7 -7
  9. package/dist/index109.js +1 -1
  10. package/dist/index110.js +4 -4
  11. package/dist/index113.js +1 -1
  12. package/dist/index115.js +1 -1
  13. package/dist/index118.js +1 -1
  14. package/dist/index119.js +2 -2
  15. package/dist/index121.js +19 -19
  16. package/dist/index122.js +1 -1
  17. package/dist/index124.js +7 -7
  18. package/dist/index126.js +3 -3
  19. package/dist/index127.js +5 -5
  20. package/dist/index128.js +1 -1
  21. package/dist/index129.js +14 -30
  22. package/dist/index130.js +4 -10
  23. package/dist/index131.js +27 -64
  24. package/dist/index132.js +15 -51
  25. package/dist/index133.js +21 -12
  26. package/dist/index134.js +58 -12
  27. package/dist/index135.js +16 -11
  28. package/dist/index136.js +23 -36
  29. package/dist/index137.js +40 -11
  30. package/dist/index138.js +43 -9
  31. package/dist/index139.js +21 -5
  32. package/dist/index140.js +46 -85
  33. package/dist/index141.js +51 -11
  34. package/dist/index142.js +14 -260
  35. package/dist/index143.js +11 -79
  36. package/dist/index144.js +21 -10
  37. package/dist/index145.js +34 -55
  38. package/dist/index146.js +230 -11
  39. package/dist/index147.js +283 -11
  40. package/dist/index148.js +53 -30
  41. package/dist/index149.js +14 -17
  42. package/dist/index150.js +72 -59
  43. package/dist/index151.js +3 -104
  44. package/dist/index152.js +29 -7
  45. package/dist/index153.js +24 -9
  46. package/dist/index154.js +15 -22
  47. package/dist/index155.js +66 -100
  48. package/dist/index156.js +2 -6
  49. package/dist/index157.js +103 -31
  50. package/dist/index158.js +75 -226
  51. package/dist/index159.js +257 -68
  52. package/dist/index160.js +11 -283
  53. package/dist/index161.js +10 -53
  54. package/dist/index162.js +40 -3
  55. package/dist/index163.js +4 -14
  56. package/dist/index164.js +65 -14
  57. package/dist/index165.js +10 -29
  58. package/dist/index166.js +8 -7
  59. package/dist/index167.js +5 -22
  60. package/dist/index168.js +53 -24
  61. package/dist/index169.js +11 -160
  62. package/dist/index170.js +114 -110
  63. package/dist/index171.js +11 -75
  64. package/dist/index172.js +11 -64
  65. package/dist/index173.js +65 -68
  66. package/dist/index174.js +13 -14
  67. package/dist/index175.js +13 -6
  68. package/dist/index176.js +11 -16
  69. package/dist/index177.js +11 -21
  70. package/dist/index178.js +86 -57
  71. package/dist/index179.js +11 -17
  72. package/dist/index18.js +1 -1
  73. package/dist/index180.js +11 -27
  74. package/dist/index181.js +56 -42
  75. package/dist/index182.js +10 -20
  76. package/dist/index183.js +11 -48
  77. package/dist/index184.js +15 -48
  78. package/dist/index185.js +8 -17
  79. package/dist/index186.js +8 -11
  80. package/dist/index187.js +102 -34
  81. package/dist/index188.js +7 -15
  82. package/dist/index189.js +31 -78
  83. package/dist/index190.js +74 -23
  84. package/dist/index191.js +15 -4
  85. package/dist/index192.js +28 -11
  86. package/dist/index193.js +7 -10
  87. package/dist/index194.js +22 -40
  88. package/dist/index195.js +25 -5
  89. package/dist/index196.js +160 -9
  90. package/dist/index197.js +113 -11
  91. package/dist/index198.js +73 -115
  92. package/dist/index199.js +64 -11
  93. package/dist/index200.js +47 -5
  94. package/dist/index201.js +193 -41
  95. package/dist/index202.js +30 -182
  96. package/dist/index203.js +20 -48
  97. package/dist/index204.js +6 -20
  98. package/dist/index205.js +3 -3
  99. package/dist/index206.js +12 -4
  100. package/dist/index207.js +9 -21
  101. package/dist/index208.js +14 -125
  102. package/dist/index209.js +7 -45
  103. package/dist/index210.js +4 -18
  104. package/dist/index211.js +22 -5
  105. package/dist/index212.js +122 -175
  106. package/dist/index213.js +45 -76
  107. package/dist/index214.js +15 -396
  108. package/dist/index215.js +5 -7
  109. package/dist/index216.js +181 -5
  110. package/dist/index217.js +74 -15
  111. package/dist/index218.js +396 -12
  112. package/dist/index219.js +38 -32
  113. package/dist/index220.js +57 -39
  114. package/dist/index221.js +28 -57
  115. package/dist/index222.js +7 -27
  116. package/dist/index223.js +12 -7
  117. package/dist/index224.js +10 -11
  118. package/dist/index225.js +5 -5
  119. package/dist/index226.js +21 -11
  120. package/dist/index227.js +11 -21
  121. package/dist/index228.js +7 -11
  122. package/dist/index229.js +42 -7
  123. package/dist/index230.js +594 -40
  124. package/dist/index231.js +11 -596
  125. package/dist/index232.js +32 -11
  126. package/dist/index233.js +3 -3
  127. package/dist/index234.js +5 -10
  128. package/dist/index235.js +14 -11
  129. package/dist/index236.js +208 -14
  130. package/dist/index237.js +4 -209
  131. package/dist/index238.js +13 -3
  132. package/dist/index239.js +47 -13
  133. package/dist/index24.js +2 -2
  134. package/dist/index240.js +3 -47
  135. package/dist/index241.js +12 -3
  136. package/dist/index242.js +56 -11
  137. package/dist/index243.js +29 -57
  138. package/dist/index244.js +13 -29
  139. package/dist/index245.js +9 -14
  140. package/dist/index246.js +207 -9
  141. package/dist/index247.js +304 -189
  142. package/dist/index248.js +3 -21
  143. package/dist/index249.js +3 -6
  144. package/dist/index250.js +14 -321
  145. package/dist/index251.js +21 -3
  146. package/dist/index252.js +6 -3
  147. package/dist/index253.js +1 -1
  148. package/dist/index28.js +1 -1
  149. package/dist/index32.js +1 -1
  150. package/dist/index33.js +12 -12
  151. package/dist/index34.js +4 -4
  152. package/dist/index35.js +9 -9
  153. package/dist/index36.js +6 -6
  154. package/dist/index37.js +7 -7
  155. package/dist/index38.js +9 -9
  156. package/dist/index39.js +2 -2
  157. package/dist/index40.js +2 -2
  158. package/dist/index41.js +2 -2
  159. package/dist/index42.js +2 -2
  160. package/dist/index43.js +1 -1
  161. package/dist/index45.js +5 -5
  162. package/dist/index46.js +7 -7
  163. package/dist/index47.js +7 -7
  164. package/dist/index48.js +14 -14
  165. package/dist/index49.js +4 -4
  166. package/dist/index50.js +6 -6
  167. package/dist/index52.js +20 -20
  168. package/dist/index53.js +2 -2
  169. package/dist/index54.js +23 -23
  170. package/dist/index55.js +7 -7
  171. package/dist/index56.js +5 -5
  172. package/dist/index57.js +1 -1
  173. package/dist/index58.js +2 -2
  174. package/dist/index59.js +4 -4
  175. package/dist/index60.js +8 -8
  176. package/dist/index61.js +3 -3
  177. package/dist/index62.js +3 -3
  178. package/dist/index63.js +8 -8
  179. package/dist/index64.js +3 -3
  180. package/dist/index65.js +3 -3
  181. package/dist/index66.js +8 -8
  182. package/dist/index67.js +1 -1
  183. package/dist/index69.js +26 -26
  184. package/dist/index70.js +4 -4
  185. package/dist/index71.js +11 -11
  186. package/dist/index72.js +16 -16
  187. package/dist/index73.js +7 -7
  188. package/dist/index74.js +1 -1
  189. package/dist/index75.js +11 -11
  190. package/dist/index76.js +2 -2
  191. package/dist/index77.js +2 -2
  192. package/dist/index78.js +2 -2
  193. package/dist/index79.js +1 -1
  194. package/dist/index80.js +1 -1
  195. package/dist/index81.js +14 -14
  196. package/dist/index82.js +3 -3
  197. package/dist/index83.js +4 -4
  198. package/dist/index86.js +7 -7
  199. package/dist/index88.js +81 -87
  200. package/dist/index89.js +87 -81
  201. package/dist/index94.js +4 -133
  202. package/dist/index95.js +63 -24
  203. package/dist/index96.js +8 -8
  204. package/dist/index97.js +14 -5
  205. package/dist/index98.js +3 -12
  206. package/dist/index99.js +3 -22
  207. package/dist/styles.css +1 -1
  208. package/package.json +1 -1
package/dist/index161.js CHANGED
@@ -1,56 +1,13 @@
1
- import * as o from "react";
2
- import { useStableCallback as S } from "./index95.js";
3
- import { useIsoLayoutEffect as T } from "./index97.js";
4
- import { useTimeout as D } from "./index148.js";
5
- import { EMPTY_ARRAY as U } from "./index106.js";
6
- import { stopEvent as O } from "./index222.js";
7
- function H(l, b) {
8
- const g = "rootStore" in l ? l.rootStore : l, c = g.useState("open"), u = g.context.dataRef, {
9
- listRef: E,
10
- activeIndex: p,
11
- onMatch: A,
12
- onTypingChange: R,
13
- enabled: h = !0,
14
- findMatch: L = null,
15
- resetMs: F = 750,
16
- ignoreKeys: P = U,
17
- selectedIndex: y = null
18
- } = b, m = D(), r = o.useRef(""), i = o.useRef(y ?? p ?? -1), f = o.useRef(null);
19
- T(() => {
20
- c && (m.clear(), f.current = null, r.current = "");
21
- }, [c, m]), T(() => {
22
- c && r.current === "" && (i.current = y ?? p ?? -1);
23
- }, [c, y, p]);
24
- const n = S((e) => {
25
- e ? u.current.typing || (u.current.typing = e, R?.(e)) : u.current.typing && (u.current.typing = e, R?.(e));
26
- }), a = S((e) => {
27
- function C(s, x, I) {
28
- const K = L ? L(x, I) : x.find((Y) => Y?.toLocaleLowerCase().indexOf(I.toLocaleLowerCase()) === 0);
29
- return K ? s.indexOf(K) : -1;
30
- }
31
- const t = E.current;
32
- if (r.current.length > 0 && r.current[0] !== " " && (C(t, t, r.current) === -1 ? n(!1) : e.key === " " && O(e)), t == null || P.includes(e.key) || // Character key.
33
- e.key.length !== 1 || // Modifier key.
34
- e.ctrlKey || e.metaKey || e.altKey)
35
- return;
36
- c && e.key !== " " && (O(e), n(!0)), t.every((s) => s ? s[0]?.toLocaleLowerCase() !== s[1]?.toLocaleLowerCase() : !0) && r.current === e.key && (r.current = "", i.current = f.current), r.current += e.key, m.start(F, () => {
37
- r.current = "", i.current = f.current, n(!1);
38
- });
39
- const w = i.current, d = C(t, [...t.slice((w || 0) + 1), ...t.slice(0, (w || 0) + 1)], r.current);
40
- d !== -1 ? (A?.(d), f.current = d) : e.key !== " " && (r.current = "", n(!1));
41
- }), k = o.useMemo(() => ({
42
- onKeyDown: a
43
- }), [a]), M = o.useMemo(() => ({
44
- onKeyDown: a,
45
- onKeyUp(e) {
46
- e.key === " " && n(!1);
47
- }
48
- }), [a, n]);
49
- return o.useMemo(() => h ? {
50
- reference: k,
51
- floating: M
52
- } : {}, [h, k, M]);
1
+ function e(o, t) {
2
+ o && Object.assign(o.style, t);
53
3
  }
4
+ const i = {
5
+ position: "relative",
6
+ maxHeight: "100%",
7
+ overflowX: "hidden",
8
+ overflowY: "auto"
9
+ };
54
10
  export {
55
- H as useTypeahead
11
+ i as LIST_FUNCTIONAL_STYLES,
12
+ e as clearStyles
56
13
  };
package/dist/index162.js CHANGED
@@ -1,6 +1,43 @@
1
- function e(n) {
2
- return n?.ownerDocument || document;
1
+ const a = typeof navigator < "u", o = e(), n = f(), r = u(), c = typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter:none"), m = (
2
+ // iPads can claim to be MacIntel
3
+ o.platform === "MacIntel" && o.maxTouchPoints > 1 ? !0 : /iP(hone|ad|od)|iOS/.test(o.platform)
4
+ ), p = a && /firefox/i.test(r), g = a && /apple/i.test(navigator.vendor), d = a && /android/i.test(n) || /android/i.test(r), l = a && n.toLowerCase().startsWith("mac") && !navigator.maxTouchPoints, v = r.includes("jsdom/");
5
+ function e() {
6
+ if (!a)
7
+ return {
8
+ platform: "",
9
+ maxTouchPoints: -1
10
+ };
11
+ const t = navigator.userAgentData;
12
+ return t?.platform ? {
13
+ platform: t.platform,
14
+ maxTouchPoints: navigator.maxTouchPoints
15
+ } : {
16
+ platform: navigator.platform ?? "",
17
+ maxTouchPoints: navigator.maxTouchPoints ?? -1
18
+ };
19
+ }
20
+ function u() {
21
+ if (!a)
22
+ return "";
23
+ const t = navigator.userAgentData;
24
+ return t && Array.isArray(t.brands) ? t.brands.map(({
25
+ brand: i,
26
+ version: s
27
+ }) => `${i}/${s}`).join(" ") : navigator.userAgent;
28
+ }
29
+ function f() {
30
+ if (!a)
31
+ return "";
32
+ const t = navigator.userAgentData;
33
+ return t?.platform ? t.platform : navigator.platform ?? "";
3
34
  }
4
35
  export {
5
- e as ownerDocument
36
+ d as isAndroid,
37
+ p as isFirefox,
38
+ m as isIOS,
39
+ v as isJSDOM,
40
+ l as isMac,
41
+ g as isSafari,
42
+ c as isWebKit
6
43
  };
package/dist/index163.js CHANGED
@@ -1,17 +1,7 @@
1
- import { createEventEmitter as n } from "./index218.js";
2
- class d {
3
- nodesRef = {
4
- current: []
5
- };
6
- events = n();
7
- addNode(e) {
8
- this.nodesRef.current.push(e);
9
- }
10
- removeNode(e) {
11
- const t = this.nodesRef.current.findIndex((r) => r === e);
12
- t !== -1 && this.nodesRef.current.splice(t, 1);
13
- }
1
+ function o(t) {
2
+ const i = t.currentTarget.getBoundingClientRect();
3
+ return i.top + 1 <= t.clientY && t.clientY <= i.bottom - 1 && i.left + 1 <= t.clientX && t.clientX <= i.right - 1;
14
4
  }
15
5
  export {
16
- d as FloatingTreeStore
6
+ o as isMouseWithinBounds
17
7
  };
package/dist/index164.js CHANGED
@@ -1,18 +1,69 @@
1
- function l(e) {
2
- const t = e.getBoundingClientRect();
3
- if (process.env.NODE_ENV === "test")
4
- return t;
5
- const o = window.getComputedStyle(e, "::before"), n = window.getComputedStyle(e, "::after");
6
- if (!(o.content !== "none" || n.content !== "none"))
7
- return t;
8
- const i = parseFloat(o.width) || 0, r = parseFloat(o.height) || 0, a = parseFloat(n.width) || 0, c = parseFloat(n.height) || 0, d = Math.max(t.width, i, a), f = Math.max(t.height, r, c), s = d - t.width, h = f - t.height;
9
- return {
10
- left: t.left - s / 2,
11
- right: t.right + s / 2,
12
- top: t.top - h / 2,
13
- bottom: t.bottom + h / 2
1
+ "use client";
2
+ import { useRefWithInit as u } from "./index107.js";
3
+ import { useOnMount as h } from "./index209.js";
4
+ const s = null;
5
+ let l = globalThis.requestAnimationFrame;
6
+ class o {
7
+ /* This implementation uses an array as a backing data-structure for frame callbacks.
8
+ * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
9
+ * never calls the native `cancelAnimationFrame` if there are no frames left. This can
10
+ * be much more efficient if there is a call pattern that alterns as
11
+ * "request-cancel-request-cancel-…".
12
+ * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
13
+ * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
14
+ callbacks = [];
15
+ callbacksCount = 0;
16
+ nextId = 1;
17
+ startId = 1;
18
+ isScheduled = !1;
19
+ tick = (t) => {
20
+ this.isScheduled = !1;
21
+ const e = this.callbacks, i = this.callbacksCount;
22
+ if (this.callbacks = [], this.callbacksCount = 0, this.startId = this.nextId, i > 0)
23
+ for (let r = 0; r < e.length; r += 1)
24
+ e[r]?.(t);
14
25
  };
26
+ request(t) {
27
+ const e = this.nextId;
28
+ this.nextId += 1, this.callbacks.push(t), this.callbacksCount += 1;
29
+ const i = process.env.NODE_ENV === "test" && l !== requestAnimationFrame && (l = requestAnimationFrame, !0);
30
+ return (!this.isScheduled || i) && (requestAnimationFrame(this.tick), this.isScheduled = !0), e;
31
+ }
32
+ cancel(t) {
33
+ const e = t - this.startId;
34
+ e < 0 || e >= this.callbacks.length || (this.callbacks[e] = null, this.callbacksCount -= 1);
35
+ }
36
+ }
37
+ const c = new o();
38
+ class a {
39
+ static create() {
40
+ return new a();
41
+ }
42
+ static request(t) {
43
+ return c.request(t);
44
+ }
45
+ static cancel(t) {
46
+ return c.cancel(t);
47
+ }
48
+ currentId = s;
49
+ /**
50
+ * Executes `fn` after `delay`, clearing any previously scheduled call.
51
+ */
52
+ request(t) {
53
+ this.cancel(), this.currentId = c.request(() => {
54
+ this.currentId = s, t();
55
+ });
56
+ }
57
+ cancel = () => {
58
+ this.currentId !== s && (c.cancel(this.currentId), this.currentId = s);
59
+ };
60
+ disposeEffect = () => this.cancel;
61
+ }
62
+ function k() {
63
+ const n = u(a.create).current;
64
+ return h(n.disposeEffect), n;
15
65
  }
16
66
  export {
17
- l as getPseudoElementBounds
67
+ a as AnimationFrame,
68
+ k as useAnimationFrame
18
69
  };
package/dist/index165.js CHANGED
@@ -1,31 +1,12 @@
1
- "use client";
2
- import { useRenderElement as c } from "./index86.js";
3
- import { useCompositeItem as u } from "./index219.js";
4
- import { EMPTY_OBJECT as d, EMPTY_ARRAY as t } from "./index106.js";
5
- function M(e) {
6
- const {
7
- render: l,
8
- className: E,
9
- state: o = d,
10
- props: r = t,
11
- refs: s = t,
12
- metadata: m,
13
- stateAttributesMapping: p,
14
- tag: i = "div",
15
- ...a
16
- } = e, {
17
- compositeProps: n,
18
- compositeRef: f
19
- } = u({
20
- metadata: m
21
- });
22
- return c(i, e, {
23
- state: o,
24
- ref: [...s, f],
25
- props: [n, ...r, a],
26
- stateAttributesMapping: p
27
- });
28
- }
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ const e = "base-ui-disable-scrollbar", r = {
3
+ className: e,
4
+ element: /* @__PURE__ */ l("style", {
5
+ href: e,
6
+ precedence: "base-ui:low",
7
+ children: `.${e}{scrollbar-width:none}.${e}::-webkit-scrollbar{display:none}`
8
+ })
9
+ };
29
10
  export {
30
- M as CompositeItem
11
+ r as styleDisableScrollbar
31
12
  };
package/dist/index166.js CHANGED
@@ -1,10 +1,11 @@
1
- import { isHTMLElement as r, isLastTraversableNode as e, getParentNode as i } from "./index94.js";
2
- function n(t) {
3
- if (r(t) && t.hasAttribute("data-rootownerid"))
4
- return t.getAttribute("data-rootownerid") ?? void 0;
5
- if (!e(t))
6
- return n(i(t));
1
+ "use client";
2
+ import * as o from "react";
3
+ const t = /* @__PURE__ */ o.createContext(void 0);
4
+ process.env.NODE_ENV !== "production" && (t.displayName = "ToolbarRootContext");
5
+ function r(e) {
6
+ return o.useContext(t);
7
7
  }
8
8
  export {
9
- n as findRootOwnerId
9
+ t as ToolbarRootContext,
10
+ r as useToolbarRootContext
10
11
  };
package/dist/index167.js CHANGED
@@ -1,25 +1,8 @@
1
- import * as c from "react";
2
- import { ownerDocument as i } from "./index162.js";
3
- import { EMPTY_OBJECT as s } from "./index106.js";
4
- function a(u) {
5
- const {
6
- enabled: t = !0,
7
- mouseDownAction: r,
8
- open: n
9
- } = u, e = c.useRef(!1);
10
- return c.useMemo(() => t ? {
11
- onMouseDown: (o) => {
12
- (r === "open" && !n || r === "close" && n) && (e.current = !0, i(o.currentTarget).addEventListener("click", () => {
13
- e.current = !1;
14
- }, {
15
- once: !0
16
- }));
17
- },
18
- onClick: (o) => {
19
- e.current && (e.current = !1, o.preventBaseUIHandler());
20
- }
21
- } : s, [t, r, n]);
1
+ import { DISABLED_TRANSITIONS_STYLE as r } from "./index125.js";
2
+ import { EMPTY_OBJECT as o } from "./index100.js";
3
+ function T(t) {
4
+ return t === "starting" ? r : o;
22
5
  }
23
6
  export {
24
- a as useMixedToggleClickHandler
7
+ T as getDisabledMountTransitionStyles
25
8
  };
package/dist/index168.js CHANGED
@@ -1,27 +1,56 @@
1
1
  "use client";
2
- import * as r from "react";
3
- import { useIsoLayoutEffect as a } from "./index97.js";
4
- import { isSafari as u } from "./index194.js";
5
- import { visuallyHidden as i } from "./index174.js";
6
- import { jsx as f } from "react/jsx-runtime";
7
- const n = /* @__PURE__ */ r.forwardRef(function(e, t) {
8
- const [o, s] = r.useState();
9
- return a(() => {
10
- u && s("button");
11
- }, []), /* @__PURE__ */ f("span", {
12
- ...e,
13
- ref: t,
14
- style: i,
15
- "aria-hidden": o ? void 0 : !0,
16
- ...{
17
- tabIndex: 0,
18
- // Role is only for VoiceOver
19
- role: o
20
- },
21
- "data-base-ui-focus-guard": ""
22
- });
23
- });
24
- process.env.NODE_ENV !== "production" && (n.displayName = "FocusGuard");
2
+ import * as u from "react";
3
+ import { useIsoLayoutEffect as g } from "./index104.js";
4
+ import { useCompositeListContext as F } from "./index211.js";
5
+ let I = /* @__PURE__ */ (function(t) {
6
+ return t[t.None = 0] = "None", t[t.GuessFromOrder = 1] = "GuessFromOrder", t;
7
+ })({});
8
+ function N(t = {}) {
9
+ const {
10
+ label: c,
11
+ metadata: l,
12
+ textRef: d,
13
+ indexGuessBehavior: L,
14
+ index: r
15
+ } = t, {
16
+ register: m,
17
+ unregister: a,
18
+ subscribeMapChange: x,
19
+ elementsRef: R,
20
+ labelsRef: i,
21
+ nextIndexRef: p
22
+ } = F(), f = u.useRef(-1), [n, C] = u.useState(r ?? (L === I.GuessFromOrder ? () => {
23
+ if (f.current === -1) {
24
+ const e = p.current;
25
+ p.current += 1, f.current = e;
26
+ }
27
+ return f.current;
28
+ } : -1)), s = u.useRef(null), b = u.useCallback((e) => {
29
+ if (s.current = e, n !== -1 && e !== null && (R.current[n] = e, i)) {
30
+ const o = c !== void 0;
31
+ i.current[n] = o ? c : d?.current?.textContent ?? e.textContent;
32
+ }
33
+ }, [n, R, i, c, d]);
34
+ return g(() => {
35
+ if (r != null)
36
+ return;
37
+ const e = s.current;
38
+ if (e)
39
+ return m(e, l), () => {
40
+ a(e);
41
+ };
42
+ }, [r, m, a, l]), g(() => {
43
+ if (r == null)
44
+ return x((e) => {
45
+ const o = s.current ? e.get(s.current)?.index : null;
46
+ o != null && C(o);
47
+ });
48
+ }, [r, x, C]), u.useMemo(() => ({
49
+ ref: b,
50
+ index: n
51
+ }), [n, b]);
52
+ }
25
53
  export {
26
- n as FocusGuard
54
+ I as IndexGuessBehavior,
55
+ N as useCompositeListItem
27
56
  };
package/dist/index169.js CHANGED
@@ -1,163 +1,14 @@
1
- import * as H from "react";
2
- import * as te from "react-dom";
3
- import { isElement as re } from "./index94.js";
4
- import { useValueAsRef as N } from "./index176.js";
5
- import { useStableCallback as Y } from "./index95.js";
6
- import { createChangeEventDetails as C } from "./index113.js";
7
- import { getDelay as V } from "./index245.js";
8
- import { useFloatingTree as ne } from "./index145.js";
9
- import { useHoverInteractionSharedState as oe, safePolygonIdentifier as ce } from "./index244.js";
10
- import { triggerHover as L } from "./index114.js";
11
- import { getDocument as z, contains as O } from "./index173.js";
12
- import { isMouseLikePointerType as B } from "./index222.js";
13
- function W(l) {
14
- return typeof l == "function" ? l() : l;
15
- }
16
- const se = {
17
- current: null
18
- };
19
- function Re(l, G = {}) {
20
- const t = "rootStore" in l ? l.rootStore : l, {
21
- dataRef: a,
22
- events: A
23
- } = t.context, {
24
- enabled: x = !0,
25
- delay: J = 0,
26
- handleClose: K = null,
27
- mouseOnly: D = !1,
28
- restMs: Q = 0,
29
- move: X = !0,
30
- triggerElementRef: b = se,
31
- externalTree: U,
32
- isActiveTrigger: _ = !0
33
- } = G, w = ne(U), {
34
- pointerTypeRef: o,
35
- interactedInsideRef: Z,
36
- handlerRef: d,
37
- blockMouseMoveRef: p,
38
- performedPointerEventsMutationRef: j,
39
- unbindMouseMoveRef: P,
40
- restTimeoutPendingRef: f,
41
- openChangeTimeout: c,
42
- restTimeout: m,
43
- handleCloseOptionsRef: $
44
- } = oe(t), v = N(K), M = N(J), T = N(Q);
45
- _ && ($.current = v.current?.__options);
46
- const y = Y(() => Z.current ? !0 : a.current.openEvent ? ["click", "mousedown"].includes(a.current.openEvent.type) : !1), S = H.useCallback((e, r = !0) => {
47
- const s = V(M.current, "close", o.current);
48
- s && !d.current ? c.start(s, () => t.setOpen(!1, C(L, e))) : r && (c.clear(), t.setOpen(!1, C(L, e)));
49
- }, [M, d, t, o, c]), F = Y(() => {
50
- P.current(), d.current = void 0;
51
- }), k = Y(() => {
52
- if (j.current) {
53
- const e = z(t.select("domReferenceElement")).body;
54
- e.style.pointerEvents = "", e.removeAttribute(ce), j.current = !1;
55
- }
56
- });
57
- H.useEffect(() => {
58
- if (!x)
59
- return;
60
- function e(r) {
61
- r.open || (c.clear(), m.clear(), p.current = !0, f.current = !1);
62
- }
63
- return A.on("openchange", e), () => {
64
- A.off("openchange", e);
65
- };
66
- }, [x, A, c, m, p, f]);
67
- const q = Y((e) => {
68
- if (y() || !a.current.floatingContext)
69
- return;
70
- const r = t.context.triggerElements;
71
- if (e.relatedTarget && r.hasElement(e.relatedTarget))
72
- return;
73
- const s = b.current;
74
- v.current?.({
75
- ...a.current.floatingContext,
76
- tree: w,
77
- x: e.clientX,
78
- y: e.clientY,
79
- onClose() {
80
- k(), F(), !y() && s === t.select("domReferenceElement") && S(e);
81
- }
82
- })(e);
83
- });
84
- return H.useEffect(() => {
85
- if (!x)
86
- return;
87
- const e = b.current ?? (_ ? t.select("domReferenceElement") : null);
88
- if (!re(e))
89
- return;
90
- function r(n) {
91
- if (c.clear(), p.current = !1, D && !B(o.current) || W(T.current) > 0 && !V(M.current, "open"))
92
- return;
93
- const g = V(M.current, "open", o.current), u = t.select("domReferenceElement"), i = t.context.triggerElements, E = (i.hasElement(n.target) || i.hasMatchingElement((ee) => O(ee, n.target))) && (!u || !O(u, n.target)), R = n.currentTarget ?? null, h = !t.select("open") || E;
94
- g ? c.start(g, () => {
95
- h && t.setOpen(!0, C(L, n, R));
96
- }) : h && t.setOpen(!0, C(L, n, R));
97
- }
98
- function s(n) {
99
- if (y()) {
100
- k();
101
- return;
102
- }
103
- P.current();
104
- const g = t.select("domReferenceElement"), u = z(g);
105
- m.clear(), f.current = !1;
106
- const i = t.context.triggerElements;
107
- if (n.relatedTarget && i.hasElement(n.relatedTarget))
108
- return;
109
- if (v.current && a.current.floatingContext) {
110
- t.select("open") || c.clear();
111
- const R = b.current;
112
- d.current = v.current({
113
- ...a.current.floatingContext,
114
- tree: w,
115
- x: n.clientX,
116
- y: n.clientY,
117
- onClose() {
118
- k(), F(), !y() && R === t.select("domReferenceElement") && S(n, !0);
119
- }
120
- });
121
- const h = d.current;
122
- h(n), u.addEventListener("mousemove", h), P.current = () => {
123
- u.removeEventListener("mousemove", h);
124
- };
125
- return;
126
- }
127
- (o.current !== "touch" || !O(t.select("floatingElement"), n.relatedTarget)) && S(n);
128
- }
129
- function I(n) {
130
- q(n);
131
- }
132
- return t.select("open") && e.addEventListener("mouseleave", I), X && e.addEventListener("mousemove", r, {
133
- once: !0
134
- }), e.addEventListener("mouseenter", r), e.addEventListener("mouseleave", s), () => {
135
- e.removeEventListener("mouseleave", I), X && e.removeEventListener("mousemove", r), e.removeEventListener("mouseenter", r), e.removeEventListener("mouseleave", s);
136
- };
137
- }, [F, k, p, a, M, S, t, x, v, q, _, y, D, X, o, T, m, f, c, b, w, P, d]), H.useMemo(() => {
138
- function e(r) {
139
- o.current = r.pointerType;
140
- }
141
- return {
142
- onPointerDown: e,
143
- onPointerEnter: e,
144
- onMouseMove(r) {
145
- const {
146
- nativeEvent: s
147
- } = r, I = r.currentTarget, n = t.select("domReferenceElement"), g = t.context.triggerElements, u = t.select("open"), i = (g.hasElement(r.target) || g.hasMatchingElement((R) => O(R, r.target))) && (!n || !O(n, r.target));
148
- if (D && !B(o.current) || u && !i || W(T.current) === 0 || !i && f.current && r.movementX ** 2 + r.movementY ** 2 < 2)
149
- return;
150
- m.clear();
151
- function E() {
152
- !p.current && (!u || i) && t.setOpen(!0, C(L, s, I));
153
- }
154
- o.current === "touch" ? te.flushSync(() => {
155
- E();
156
- }) : i && u ? E() : (f.current = !0, m.start(W(T.current), E));
157
- }
158
- };
159
- }, [p, D, t, o, T, m, f]);
1
+ import n from "./index94.js";
2
+ import * as t from "react";
3
+ const o = /* @__PURE__ */ t.createContext(void 0);
4
+ process.env.NODE_ENV !== "production" && (o.displayName = "SelectItemContext");
5
+ function s() {
6
+ const e = t.useContext(o);
7
+ if (!e)
8
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>." : n(57));
9
+ return e;
160
10
  }
161
11
  export {
162
- Re as useHoverReferenceInteraction
12
+ o as SelectItemContext,
13
+ s as useSelectItemContext
163
14
  };