@rpcbase/ui 0.246.0 → 0.248.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 (177) hide show
  1. package/dist/components/Notifications/NotificationsDrawer.d.ts.map +1 -1
  2. package/dist/index10.js +2 -2
  3. package/dist/index106.js +1 -1
  4. package/dist/index11.js +2 -2
  5. package/dist/index12.js +3 -3
  6. package/dist/index13.js +2 -2
  7. package/dist/index14.js +2 -2
  8. package/dist/index15.js +2 -2
  9. package/dist/index16.js +158 -158
  10. package/dist/index16.js.map +1 -1
  11. package/dist/index167.js +3 -3
  12. package/dist/index17.js +1 -1
  13. package/dist/index172.js +6 -6
  14. package/dist/index178.js +1 -1
  15. package/dist/index18.js +7 -7
  16. package/dist/index184.js +1 -1
  17. package/dist/index185.js +1 -1
  18. package/dist/index186.js +1 -1
  19. package/dist/index187.js +1 -1
  20. package/dist/index188.js +2 -2
  21. package/dist/index189.js +3 -3
  22. package/dist/index19.js +16 -16
  23. package/dist/index21.js +1 -1
  24. package/dist/index22.js +2 -2
  25. package/dist/index23.js +1 -1
  26. package/dist/index24.js +1 -1
  27. package/dist/index246.js +1 -1
  28. package/dist/index25.js +1 -1
  29. package/dist/index252.js +1 -1
  30. package/dist/index272.js +2 -2
  31. package/dist/index277.js +1 -1
  32. package/dist/index278.js +1 -1
  33. package/dist/index28.js +2 -2
  34. package/dist/index282.js +1 -1
  35. package/dist/index287.js +1 -1
  36. package/dist/index29.js +56 -3
  37. package/dist/index29.js.map +1 -1
  38. package/dist/index293.js +1 -1
  39. package/dist/index3.js +2 -2
  40. package/dist/index30.js +3 -242
  41. package/dist/index30.js.map +1 -1
  42. package/dist/index302.js +1 -1
  43. package/dist/index31.js +239 -21
  44. package/dist/index31.js.map +1 -1
  45. package/dist/index32.js +23 -4
  46. package/dist/index32.js.map +1 -1
  47. package/dist/index321.js +2 -2
  48. package/dist/index33.js +3 -6
  49. package/dist/index33.js.map +1 -1
  50. package/dist/index334.js +1 -1
  51. package/dist/index338.js +8 -24
  52. package/dist/index338.js.map +1 -1
  53. package/dist/index339.js +11 -28
  54. package/dist/index339.js.map +1 -1
  55. package/dist/index34.js +8 -38
  56. package/dist/index34.js.map +1 -1
  57. package/dist/index340.js +7 -15
  58. package/dist/index340.js.map +1 -1
  59. package/dist/index341.js +13 -8
  60. package/dist/index341.js.map +1 -1
  61. package/dist/index342.js +3 -11
  62. package/dist/index342.js.map +1 -1
  63. package/dist/index343.js +3 -8
  64. package/dist/index343.js.map +1 -1
  65. package/dist/index344.js +16 -12
  66. package/dist/index344.js.map +1 -1
  67. package/dist/index345.js +24 -3
  68. package/dist/index345.js.map +1 -1
  69. package/dist/index346.js +28 -3
  70. package/dist/index346.js.map +1 -1
  71. package/dist/index347.js +15 -16
  72. package/dist/index347.js.map +1 -1
  73. package/dist/index349.js +61 -5
  74. package/dist/index349.js.map +1 -1
  75. package/dist/index35.js +35 -74
  76. package/dist/index35.js.map +1 -1
  77. package/dist/index350.js +65 -60
  78. package/dist/index350.js.map +1 -1
  79. package/dist/index351.js +5 -66
  80. package/dist/index351.js.map +1 -1
  81. package/dist/index36.js +74 -20
  82. package/dist/index36.js.map +1 -1
  83. package/dist/index365.js +4 -12
  84. package/dist/index365.js.map +1 -1
  85. package/dist/index366.js +12 -4
  86. package/dist/index366.js.map +1 -1
  87. package/dist/index37.js +18 -33
  88. package/dist/index37.js.map +1 -1
  89. package/dist/index379.js +2 -2
  90. package/dist/index38.js +36 -26
  91. package/dist/index38.js.map +1 -1
  92. package/dist/index386.js +1 -1
  93. package/dist/index388.js +1 -1
  94. package/dist/index39.js +26 -21
  95. package/dist/index39.js.map +1 -1
  96. package/dist/index4.js +2 -2
  97. package/dist/index40.js +20 -56
  98. package/dist/index40.js.map +1 -1
  99. package/dist/index41.js +59 -51
  100. package/dist/index41.js.map +1 -1
  101. package/dist/index411.js +15 -3
  102. package/dist/index411.js.map +1 -1
  103. package/dist/index412.js +3 -15
  104. package/dist/index412.js.map +1 -1
  105. package/dist/index417.js +1 -1
  106. package/dist/index419.js +1 -1
  107. package/dist/index42.js +50 -21
  108. package/dist/index42.js.map +1 -1
  109. package/dist/index420.js +2 -2
  110. package/dist/index423.js +1 -1
  111. package/dist/index424.js +1 -1
  112. package/dist/index427.js +1 -1
  113. package/dist/index428.js +1 -1
  114. package/dist/index43.js +18 -127
  115. package/dist/index43.js.map +1 -1
  116. package/dist/index430.js +16 -2
  117. package/dist/index430.js.map +1 -1
  118. package/dist/index431.js +29 -2
  119. package/dist/index431.js.map +1 -1
  120. package/dist/index432.js +13 -2
  121. package/dist/index432.js.map +1 -1
  122. package/dist/index433.js +7 -2
  123. package/dist/index433.js.map +1 -1
  124. package/dist/index434.js +2 -16
  125. package/dist/index434.js.map +1 -1
  126. package/dist/index435.js +2 -29
  127. package/dist/index435.js.map +1 -1
  128. package/dist/index436.js +2 -13
  129. package/dist/index436.js.map +1 -1
  130. package/dist/index437.js +2 -7
  131. package/dist/index437.js.map +1 -1
  132. package/dist/index44.js +122 -39
  133. package/dist/index44.js.map +1 -1
  134. package/dist/index45.js +42 -85
  135. package/dist/index45.js.map +1 -1
  136. package/dist/index46.js +87 -123
  137. package/dist/index46.js.map +1 -1
  138. package/dist/index47.js +126 -5
  139. package/dist/index47.js.map +1 -1
  140. package/dist/index48.js +5 -332
  141. package/dist/index48.js.map +1 -1
  142. package/dist/index49.js +320 -245
  143. package/dist/index49.js.map +1 -1
  144. package/dist/index5.js +2 -2
  145. package/dist/index50.js +254 -23
  146. package/dist/index50.js.map +1 -1
  147. package/dist/index51.js +25 -129
  148. package/dist/index51.js.map +1 -1
  149. package/dist/index52.js +129 -24
  150. package/dist/index52.js.map +1 -1
  151. package/dist/index53.js +22 -19
  152. package/dist/index53.js.map +1 -1
  153. package/dist/index54.js +19 -134
  154. package/dist/index54.js.map +1 -1
  155. package/dist/index55.js +133 -30
  156. package/dist/index55.js.map +1 -1
  157. package/dist/index56.js +30 -24
  158. package/dist/index56.js.map +1 -1
  159. package/dist/index57.js +26 -38
  160. package/dist/index57.js.map +1 -1
  161. package/dist/index58.js +38 -18
  162. package/dist/index58.js.map +1 -1
  163. package/dist/index59.js +17 -132
  164. package/dist/index59.js.map +1 -1
  165. package/dist/index6.js +4 -4
  166. package/dist/index60.js +134 -49
  167. package/dist/index60.js.map +1 -1
  168. package/dist/index61.js +48 -25
  169. package/dist/index61.js.map +1 -1
  170. package/dist/index62.js +28 -57
  171. package/dist/index62.js.map +1 -1
  172. package/dist/index63.js +57 -56
  173. package/dist/index63.js.map +1 -1
  174. package/dist/index7.js +11 -11
  175. package/dist/index8.js +2 -2
  176. package/dist/index9.js +1 -1
  177. package/package.json +1 -1
package/dist/index49.js CHANGED
@@ -1,261 +1,336 @@
1
- import * as M from "react";
2
- import { rectToClientRect as Jt } from "./index299.js";
3
- import { addEventListener as Qt } from "./index300.js";
4
- import { useStableCallback as te } from "./index262.js";
5
- import { ownerDocument as Tt } from "./index284.js";
6
- import { useIsoLayoutEffect as rt } from "./index261.js";
7
- import { useAnimationFrame as ee } from "./index301.js";
8
- import { useSelectRootContext as oe, useSelectFloatingContext as ne } from "./index265.js";
9
- import { popupStateMapping as re } from "./index173.js";
10
- import { useSelectPositionerContext as ie } from "./index295.js";
11
- import { styleDisableScrollbar as Rt } from "./index302.js";
12
- import { transitionStatusMapping as se } from "./index174.js";
13
- import { useOpenChangeComplete as le } from "./index182.js";
14
- import { useRenderElement as ce } from "./index172.js";
15
- import { selectors as a } from "./index270.js";
16
- import { clearStyles as Ct, LIST_FUNCTIONAL_STYLES as ae } from "./index296.js";
1
+ import * as n from "react";
2
+ import { visuallyHiddenInput as nt, visuallyHidden as st } from "./index254.js";
3
+ import { useMergedRefs as lt } from "./index255.js";
4
+ import { useRefWithInit as it } from "./index256.js";
5
+ import { useOnFirstRender as at } from "./index257.js";
6
+ import { usePreviousValue as ut } from "./index258.js";
7
+ import { isElementDisabled as ct } from "./index259.js";
8
+ import { useControlled as de } from "./index260.js";
9
+ import { useIsoLayoutEffect as P } from "./index261.js";
10
+ import { useStableCallback as C } from "./index262.js";
11
+ import { useValueAsRef as ft } from "./index263.js";
12
+ import { EMPTY_OBJECT as dt, EMPTY_ARRAY as me } from "./index264.js";
13
+ import { SelectRootContext as mt, SelectFloatingContext as pt } from "./index265.js";
14
+ import { useFieldRootContext as gt } from "./index266.js";
15
+ import { useRegisterFieldControl as ht } from "./index267.js";
16
+ import { useLabelableId as Rt } from "./index268.js";
17
+ import { useTransitionStatus as yt } from "./index269.js";
18
+ import { selectors as M } from "./index270.js";
17
19
  import { createChangeEventDetails as pe } from "./index175.js";
18
- import { useToolbarRootContext as me } from "./index303.js";
19
- import { COMPOSITE_KEYS as ue } from "./index183.js";
20
- import { getDisabledMountTransitionStyles as ge } from "./index304.js";
21
- import { clamp as U } from "./index305.js";
22
- import { SCROLL_EDGE_TOLERANCE_PX as v, getMaxScrollOffset as fe } from "./index276.js";
23
- import { useCSPContext as he } from "./index306.js";
24
- import { useDirection as de } from "./index307.js";
25
- import { j as Ht } from "./index28.js";
26
- import { useStore as d } from "./index277.js";
27
- import { getWindow as it } from "./index308.js";
28
- import { FloatingFocusManager as ye } from "./index185.js";
29
- import { platform as xe } from "./index309.js";
30
- import { webkit as Se } from "./index310.js";
31
- import { windowResize as Te } from "./index177.js";
32
- const Re = {
33
- ...re,
34
- ...se
35
- }, Ce = /* @__PURE__ */ M.forwardRef(function(o, F) {
20
+ import { useOpenChangeComplete as It } from "./index182.js";
21
+ import { useFormContext as xt } from "./index271.js";
22
+ import { stringifyAsValue as I, stringifyAsLabel as vt } from "./index272.js";
23
+ import { defaultItemEquality as Ct, findItemIndex as ge, compareItemEquality as bt } from "./index273.js";
24
+ import { areArraysEqual as Vt } from "./index274.js";
25
+ import { useValueChanged as At } from "./index275.js";
26
+ import { useOpenInteractionType as St } from "./index192.js";
27
+ import { getMaxScrollOffset as Pt, normalizeScrollOffset as Mt } from "./index276.js";
28
+ import { j as w } from "./index30.js";
29
+ import { useStore as E } from "./index277.js";
30
+ import { useFloatingRootContext as wt } from "./index278.js";
31
+ import { useClick as Et } from "./index193.js";
32
+ import { useDismiss as Ot } from "./index279.js";
33
+ import { useListNavigation as Tt } from "./index280.js";
34
+ import { useTypeahead as Ft } from "./index281.js";
35
+ import { mergeProps as he } from "./index282.js";
36
+ import { FOCUSABLE_POPUP_PROPS as Lt } from "./index184.js";
37
+ import { Store as Ut } from "./index283.js";
38
+ import { none as Ht, focusOut as qt, outsidePress as Dt } from "./index177.js";
39
+ function Cr(Re) {
36
40
  const {
37
- render: y,
38
- className: A,
39
- style: Ee,
40
- finalFocus: Mt,
41
- ...vt
42
- } = o, {
43
- store: i,
44
- popupRef: p,
45
- onOpenChangeComplete: Ft,
46
- setOpen: st,
47
- valueRef: lt,
48
- firstItemTextRef: J,
49
- selectedItemTextRef: ct,
50
- multiple: wt,
51
- handleScrollArrowVisibility: H,
52
- scrollHandlerRef: Bt,
53
- listRef: at,
54
- highlightItemOnHover: pt
55
- } = oe(), {
56
- side: It,
57
- align: Ot,
58
- alignItemWithTriggerActive: s,
59
- isPositioned: mt,
60
- setControlledAlignItemWithTrigger: ut
61
- } = ie(), At = me() != null, Lt = ne(), Q = de(), {
62
- nonce: Dt,
63
- disableStyleElements: Nt
64
- } = he(), _t = d(i, a.id), m = d(i, a.open), $t = d(i, a.openMethod), Vt = d(i, a.mounted), Wt = d(i, a.popupProps), gt = d(i, a.transitionStatus), L = d(i, a.triggerElement), t = d(i, a.positionerElement), w = d(i, a.listElement), D = M.useRef(!1), N = M.useRef(!1), k = M.useRef({}), ft = ee(), tt = te((e) => {
65
- if (!t || !p.current || !N.current)
66
- return;
67
- if (D.current || !s) {
68
- H();
69
- return;
70
- }
71
- const x = t.style.top === "0px", u = t.style.bottom === "0px";
72
- if (!x && !u) {
73
- H();
74
- return;
75
- }
76
- const K = Pt(t), g = j(t.getBoundingClientRect().height, "y", K), _ = Tt(t), $ = it(t), V = $.getComputedStyle(t), B = parseFloat(V.marginTop), f = parseFloat(V.marginBottom), l = Et($.getComputedStyle(p.current)), S = Math.min(_.documentElement.clientHeight - B - f, l), c = e.scrollTop, W = X(e);
77
- let T = 0, R = null, E = !1, I = !1;
78
- const q = (r) => {
79
- t.style.height = `${r}px`;
80
- }, et = (r, O) => {
81
- const z = U(r, 0, S - g);
82
- z > 0 && q(g + z), e.scrollTop = O, S - (g + z) <= v && (D.current = !0), H();
83
- }, P = x ? W - c : c, Y = Math.min(g + P, S);
84
- if (T = Y, P <= v) {
85
- et(P, x ? W : 0);
86
- return;
87
- }
88
- if (S - Y > v)
89
- x ? I = !0 : R = 0;
90
- else if (E = !0, u && c < W) {
91
- const r = g + P - S;
92
- R = c - (P - r);
93
- }
94
- if (T = Math.ceil(T), T !== 0 && q(T), I || R != null) {
95
- const r = X(e), O = I ? r : U(R, 0, r);
96
- Math.abs(e.scrollTop - O) > v && (e.scrollTop = O);
41
+ id: ye,
42
+ value: Ie,
43
+ defaultValue: G = null,
44
+ onValueChange: xe,
45
+ open: ve,
46
+ defaultOpen: Ce = !1,
47
+ onOpenChange: be,
48
+ name: K,
49
+ form: O,
50
+ autoComplete: Ve,
51
+ disabled: Ae = !1,
52
+ readOnly: p = !1,
53
+ required: T = !1,
54
+ modal: F = !0,
55
+ actionsRef: Q,
56
+ inputRef: Se,
57
+ onOpenChangeComplete: L,
58
+ items: U,
59
+ multiple: s = !1,
60
+ itemToStringLabel: b,
61
+ itemToStringValue: a,
62
+ isItemEqualToValue: g = Ct,
63
+ highlightItemOnHover: H = !0,
64
+ children: Pe
65
+ } = Re, {
66
+ clearErrors: Me
67
+ } = xt(), {
68
+ setDirty: we,
69
+ setTouched: Ee,
70
+ setFocused: Oe,
71
+ validityData: Te,
72
+ setFilled: X,
73
+ name: Fe,
74
+ disabled: Le,
75
+ validation: y,
76
+ validationMode: Ue
77
+ } = gt(), f = Rt({
78
+ id: ye
79
+ }), c = Le || Ae, d = Fe ?? K, [t, He] = de({
80
+ controlled: Ie,
81
+ default: s ? G ?? me : G,
82
+ name: "Select",
83
+ state: "value"
84
+ }), [l, qe] = de({
85
+ controlled: ve,
86
+ default: Ce,
87
+ name: "Select",
88
+ state: "open"
89
+ }), q = n.useRef([]), D = n.useRef([]), j = n.useRef(null), De = n.useRef(null), je = n.useRef(0), Ne = n.useRef(null), h = n.useRef([]), Z = n.useRef(!1), _e = n.useRef(null), N = n.useRef(null), ke = n.useRef({
90
+ allowSelectedMouseUp: !1,
91
+ allowUnselectedMouseUp: !1,
92
+ dragY: 0
93
+ }), Ye = n.useRef(!1), {
94
+ mounted: _,
95
+ setMounted: ze,
96
+ transitionStatus: k
97
+ } = yt(l), {
98
+ openMethod: ee,
99
+ triggerProps: te
100
+ } = St(l), r = it(() => new Ut({
101
+ id: f,
102
+ labelId: void 0,
103
+ modal: F,
104
+ multiple: s,
105
+ itemToStringLabel: b,
106
+ itemToStringValue: a,
107
+ isItemEqualToValue: g,
108
+ value: t,
109
+ open: l,
110
+ mounted: _,
111
+ transitionStatus: k,
112
+ items: U,
113
+ forceMount: !1,
114
+ openMethod: null,
115
+ activeIndex: null,
116
+ selectedIndex: null,
117
+ popupProps: {},
118
+ triggerProps: {},
119
+ triggerElement: null,
120
+ positionerElement: null,
121
+ listElement: null,
122
+ popupSide: null,
123
+ scrollUpArrowVisible: !1,
124
+ scrollDownArrowVisible: !1,
125
+ hasScrollArrows: !1
126
+ })).current, re = E(r, M.activeIndex), oe = E(r, M.selectedIndex), Be = E(r, M.triggerElement), We = E(r, M.positionerElement), Je = ut(ee), ne = ee ?? Je ?? null, $e = n.useMemo(() => s ? "" : I(t, a), [s, t, a]), Ge = n.useMemo(() => s && Array.isArray(t) ? t.map((e) => I(e, a)) : I(t, a), [s, t, a]), Ke = ft(r.state.triggerElement), Qe = C(() => Ge);
127
+ ht(Ke, f, t, Qe, !c, K);
128
+ const se = n.useRef(t), Y = s ? Array.isArray(t) && t.length > 0 : t != null && I(t, a) !== "";
129
+ P(() => {
130
+ t !== se.current && r.set("forceMount", !0);
131
+ }, [r, t]), P(() => {
132
+ X(Y);
133
+ }, [Y, X]), P(function() {
134
+ const o = h.current;
135
+ let u;
136
+ if (s) {
137
+ const i = Array.isArray(t) ? t : [];
138
+ if (i.length === 0)
139
+ u = null;
140
+ else {
141
+ const m = i[i.length - 1], R = ge(o, m, g);
142
+ u = R === -1 ? null : R;
143
+ }
144
+ } else {
145
+ const i = ge(o, t, g);
146
+ u = i === -1 ? null : i;
97
147
  }
98
- (E || T >= S - v) && (D.current = !0), H();
148
+ u === null && (N.current = null), !l && r.set("selectedIndex", u);
149
+ }, [Y, s, l, t, h, g, r, N]);
150
+ function Xe(e) {
151
+ const o = Te.initialValue;
152
+ return Array.isArray(e) && Array.isArray(o) ? !Vt(e, o, (u, i) => bt(u, i, g)) : e !== o;
153
+ }
154
+ At(t, () => {
155
+ Me(d), we(Xe(t)), y.change(t);
99
156
  });
100
- M.useImperativeHandle(Bt, () => tt, [tt]), le({
101
- open: m,
102
- ref: p,
103
- onComplete() {
104
- m && Ft?.(!0);
105
- }
157
+ const z = C((e, o) => {
158
+ be?.(e, o), !o.isCanceled && (qe(e), !e && (o.reason === qt || o.reason === Dt) && (Ee(!0), Oe(!1), Ue === "onBlur" && y.commit(t)));
159
+ }), B = C(() => {
160
+ ze(!1), r.update({
161
+ activeIndex: null,
162
+ openMethod: null
163
+ }), L?.(!1);
106
164
  });
107
- const Yt = {
108
- open: m,
109
- transitionStatus: gt,
110
- side: It,
111
- align: Ot
112
- };
113
- rt(() => {
114
- !t || !p.current || Object.keys(k.current).length || (k.current = {
115
- top: t.style.top || "0",
116
- left: t.style.left || "0",
117
- right: t.style.right,
118
- height: t.style.height,
119
- bottom: t.style.bottom,
120
- minHeight: t.style.minHeight,
121
- maxHeight: t.style.maxHeight,
122
- marginTop: t.style.marginTop,
123
- marginBottom: t.style.marginBottom
124
- });
125
- }, [p, t]), rt(() => {
126
- m || s || (N.current = !1, D.current = !1, Ct(t, k.current));
127
- }, [m, s, t, p]), rt(() => {
128
- const e = p.current;
129
- if (!m || !L || !t || !e || s && !mt || i.state.transitionStatus === "ending")
130
- return;
131
- if (!s) {
132
- N.current = !0, ft.request(H), e.style.removeProperty("--transform-origin");
133
- return;
134
- }
135
- const x = He(e);
136
- e.style.removeProperty("--transform-origin");
137
- try {
138
- let u = ct.current;
139
- u?.isConnected || (u = !a.hasSelectedValue(i.state) && J.current?.isConnected ? J.current : null);
140
- const K = lt.current, g = it(t), _ = g.getComputedStyle(t), $ = g.getComputedStyle(e), V = Tt(L), B = Pt(L), f = Z(L.getBoundingClientRect(), B), l = Z(t.getBoundingClientRect(), B), S = f.height, c = w || e, W = c.scrollHeight, T = parseFloat($.borderBottomWidth), R = parseFloat(_.marginTop) || 10, E = parseFloat(_.marginBottom) || 10, I = parseFloat(_.minHeight) || 100, q = Et($), et = 5, P = 5, Y = 20, r = V.documentElement.clientHeight - R - E, O = V.documentElement.clientWidth, z = r - f.bottom + S;
141
- let C, ht = Q === "rtl" ? f.right - l.width : f.left, dt = 0;
142
- if (u && K) {
143
- const h = Z(K.getBoundingClientRect(), B);
144
- C = Z(u.getBoundingClientRect(), B), ht = l.left + (Q === "rtl" ? h.right - C.right : h.left - C.left);
145
- const G = h.top - f.top + h.height / 2;
146
- dt = C.top - l.top + C.height / 2 - G;
147
- }
148
- const ot = z + dt + E + T;
149
- let b = Math.min(r, ot);
150
- const kt = r - R - E, nt = ot - b, Kt = O - P;
151
- t.style.left = `${U(ht, et, Kt - l.width)}px`, t.style.height = `${b}px`, t.style.maxHeight = "none", t.style.marginTop = `${R}px`, t.style.marginBottom = `${E}px`, e.style.height = "100%";
152
- const yt = X(c), xt = nt >= yt - v;
153
- xt && (b = Math.min(r, l.height) - (nt - yt));
154
- const qt = f.top < Y || f.bottom > r - Y || Math.ceil(b) + v < Math.min(W, I), Gt = (g.visualViewport?.scale ?? 1) !== 1 && Se;
155
- if (qt || Gt) {
156
- N.current = !0, Ct(t, k.current), ut(!1);
157
- return;
158
- }
159
- const Ut = Math.max(I, b);
160
- if (xt) {
161
- const h = Math.max(0, r - ot);
162
- t.style.top = l.height >= kt ? "0" : `${h}px`, t.style.height = `${b}px`, c.scrollTop = X(c);
163
- } else
164
- t.style.bottom = "0", c.scrollTop = nt;
165
- if (C) {
166
- const h = l.top, G = l.height, St = C.top + C.height / 2, Xt = G > 0 ? (St - h) / G * 100 : 50, Zt = U(Xt, 0, 100);
167
- e.style.setProperty("--transform-origin", `50% ${Zt}%`);
168
- }
169
- (Ut === r || b >= q) && (D.current = !0), H(), pt && i.state.selectedIndex === null && i.state.activeIndex === null && at.current[0] != null && i.set("activeIndex", 0), N.current = !0;
170
- } finally {
171
- x();
165
+ It({
166
+ enabled: !Q,
167
+ open: l,
168
+ ref: j,
169
+ onComplete() {
170
+ l || B();
172
171
  }
173
- }, [i, m, t, L, lt, J, ct, p, H, s, ut, ft, w, at, pt, Q, mt]), M.useEffect(() => {
174
- if (!s || !t || !m)
172
+ }), n.useImperativeHandle(Q, () => ({
173
+ unmount: B
174
+ }), [B]);
175
+ const V = C((e, o) => {
176
+ xe?.(e, o), !o.isCanceled && He(e);
177
+ }), le = C(() => {
178
+ const e = r.state.listElement || j.current;
179
+ if (!e)
175
180
  return;
176
- const e = it(t);
177
- function x(u) {
178
- st(!1, pe(Te, u));
181
+ const o = Pt(e.scrollHeight, e.clientHeight), u = Mt(e.scrollTop, o), i = u > 0, m = u < o;
182
+ r.state.scrollUpArrowVisible !== i && r.set("scrollUpArrowVisible", i), r.state.scrollDownArrowVisible !== m && r.set("scrollDownArrowVisible", m);
183
+ }), x = wt({
184
+ open: l,
185
+ onOpenChange: z,
186
+ elements: {
187
+ reference: Be,
188
+ floating: We
179
189
  }
180
- return Qt(e, "resize", x);
181
- }, [st, s, t, m]);
182
- const zt = {
183
- ...w ? {
184
- role: "presentation",
185
- "aria-orientation": void 0
186
- } : {
187
- role: "listbox",
188
- "aria-multiselectable": wt || void 0,
189
- id: `${_t}-list`
190
- },
191
- onKeyDown(e) {
192
- At && ue.has(e.key) && e.stopPropagation();
190
+ }), ie = Et(x, {
191
+ enabled: !p && !c,
192
+ event: "mousedown"
193
+ }), A = Ot(x), v = Tt(x, {
194
+ enabled: !p && !c,
195
+ listRef: q,
196
+ activeIndex: re,
197
+ selectedIndex: oe,
198
+ disabledIndices: me,
199
+ onNavigate(e) {
200
+ e === null && !l || r.set("activeIndex", e);
193
201
  },
194
- onScroll(e) {
195
- w || tt(e.currentTarget);
202
+ focusItemOnHover: H
203
+ }), S = Ft(x, {
204
+ enabled: !p && !c && (l || !s),
205
+ listRef: D,
206
+ activeIndex: re,
207
+ selectedIndex: oe,
208
+ // Skip disabled items while matching so typeahead advances to the next selectable item
209
+ // (a click can never select a disabled item and native `<select>` skips them too). Resolve
210
+ // the disabled state from the element via the attribute-only `isElementDisabled` so the
211
+ // hidden, force-mounted items used for closed-trigger typeahead aren't dropped by the
212
+ // `elementsRef`/visibility filter that `disabledIndices` deliberately sidesteps.
213
+ disabledIndices: (e) => ct(q.current[e]),
214
+ onMatch(e) {
215
+ l ? r.set("activeIndex", e) : V(h.current[e], pe("none"));
196
216
  },
197
- ...s && {
198
- style: w ? {
199
- height: "100%"
200
- } : ae
217
+ onTyping(e) {
218
+ Z.current = e;
201
219
  }
202
- }, jt = ce("div", o, {
203
- ref: [F, p],
204
- state: Yt,
205
- stateAttributesMapping: Re,
206
- props: [Wt, zt, ge(gt), {
207
- className: !w && s ? Rt.className : void 0
208
- }, vt]
209
- });
210
- return /* @__PURE__ */ Ht.jsxs(M.Fragment, {
211
- children: [!Nt && Rt.getElement(Dt), /* @__PURE__ */ Ht.jsx(ye, {
212
- context: Lt,
213
- modal: !1,
214
- disabled: !Vt,
215
- openInteractionType: $t,
216
- returnFocus: Mt,
217
- restoreFocus: !0,
218
- children: jt
219
- })]
220
- });
221
- });
222
- process.env.NODE_ENV !== "production" && (Ce.displayName = "SelectPopup");
223
- function Et(n) {
224
- const o = n.maxHeight || "";
225
- return o.endsWith("px") && parseFloat(o) || 1 / 0;
226
- }
227
- function X(n) {
228
- return fe(n.scrollHeight, n.clientHeight);
229
- }
230
- function Pt(n) {
231
- return xe.getScale(n);
232
- }
233
- function j(n, o, F) {
234
- return n / F[o];
235
- }
236
- function Z(n, o) {
237
- return Jt({
238
- x: j(n.x, "x", o),
239
- y: j(n.y, "y", o),
240
- width: j(n.width, "x", o),
241
- height: j(n.height, "y", o)
220
+ }), W = n.useMemo(() => {
221
+ const e = he(S.reference, v.reference, A.reference, ie.reference, te);
222
+ return f && (e.id = f), e;
223
+ }, [ie.reference, S.reference, v.reference, A.reference, te, f]), J = n.useMemo(() => he(Lt, S.floating, v.floating, A.floating), [S.floating, v.floating, A.floating]), ae = v.item ?? dt;
224
+ at(() => {
225
+ r.update({
226
+ popupProps: J,
227
+ triggerProps: W
228
+ });
229
+ }), P(() => {
230
+ r.update({
231
+ id: f,
232
+ modal: F,
233
+ multiple: s,
234
+ value: t,
235
+ open: l,
236
+ mounted: _,
237
+ transitionStatus: k,
238
+ popupProps: J,
239
+ triggerProps: W,
240
+ items: U,
241
+ itemToStringLabel: b,
242
+ itemToStringValue: a,
243
+ isItemEqualToValue: g,
244
+ openMethod: ne
245
+ });
246
+ }, [r, f, F, s, t, l, _, k, J, W, U, b, a, g, ne]);
247
+ const Ze = n.useMemo(() => ({
248
+ store: r,
249
+ name: d,
250
+ required: T,
251
+ disabled: c,
252
+ readOnly: p,
253
+ multiple: s,
254
+ highlightItemOnHover: H,
255
+ setValue: V,
256
+ setOpen: z,
257
+ listRef: q,
258
+ popupRef: j,
259
+ scrollHandlerRef: De,
260
+ handleScrollArrowVisibility: le,
261
+ scrollArrowsMountedCountRef: je,
262
+ itemProps: ae,
263
+ valueRef: Ne,
264
+ valuesRef: h,
265
+ labelsRef: D,
266
+ typingRef: Z,
267
+ selectionRef: ke,
268
+ firstItemTextRef: _e,
269
+ selectedItemTextRef: N,
270
+ validation: y,
271
+ onOpenChangeComplete: L,
272
+ alignItemWithTriggerActiveRef: Ye,
273
+ initialValueRef: se
274
+ }), [r, d, T, c, p, s, H, V, z, ae, y, L, le]), et = lt(Se, y.inputRef), tt = s && Array.isArray(t) && t.length > 0, ue = s ? void 0 : d, rt = n.useMemo(() => !s || !Array.isArray(t) || !d ? null : t.map((e) => {
275
+ const o = I(e, a);
276
+ return /* @__PURE__ */ w.jsx("input", {
277
+ type: "hidden",
278
+ form: O,
279
+ name: d,
280
+ value: o,
281
+ disabled: c
282
+ }, o);
283
+ }), [s, t, O, d, a, c]);
284
+ return /* @__PURE__ */ w.jsx(mt.Provider, {
285
+ value: Ze,
286
+ children: /* @__PURE__ */ w.jsxs(pt.Provider, {
287
+ value: x,
288
+ children: [Pe, /* @__PURE__ */ w.jsx("input", {
289
+ ...y.getValidationProps(c, {
290
+ onFocus() {
291
+ r.state.triggerElement?.focus({
292
+ // Supported in Chrome from 144 (January 2026)
293
+ focusVisible: !0
294
+ });
295
+ },
296
+ // Handle browser autofill.
297
+ onChange(e) {
298
+ if (e.nativeEvent.defaultPrevented || c || p)
299
+ return;
300
+ const o = e.currentTarget.value, u = pe(Ht, e.nativeEvent);
301
+ function i() {
302
+ if (s)
303
+ return;
304
+ const m = o.toLowerCase();
305
+ let R = h.current.findIndex(($) => I($, a).toLowerCase() === m || vt($, b).toLowerCase() === m);
306
+ R === -1 && (R = h.current.findIndex(($, ot) => {
307
+ const fe = D.current[ot];
308
+ return fe != null && fe.toLowerCase() === m;
309
+ }));
310
+ const ce = R === -1 ? void 0 : h.current[R];
311
+ ce != null && V(ce, u);
312
+ }
313
+ r.set("forceMount", !0), queueMicrotask(i);
314
+ }
315
+ }),
316
+ id: f && ue == null ? `${f}-hidden-input` : void 0,
317
+ form: O,
318
+ name: ue,
319
+ autoComplete: Ve,
320
+ value: $e,
321
+ disabled: c,
322
+ required: T && !tt,
323
+ readOnly: p,
324
+ ref: et,
325
+ style: d ? nt : st,
326
+ tabIndex: -1,
327
+ "aria-hidden": !0,
328
+ suppressHydrationWarning: !0
329
+ }), rt]
330
+ })
242
331
  });
243
332
  }
244
- const bt = [["transform", "none"], ["scale", "1"], ["translate", "0 0"]];
245
- function He(n) {
246
- const {
247
- style: o
248
- } = n, F = {};
249
- for (const [y, A] of bt)
250
- F[y] = o.getPropertyValue(y), o.setProperty(y, A, "important");
251
- return () => {
252
- for (const [y] of bt) {
253
- const A = F[y];
254
- A ? o.setProperty(y, A) : o.removeProperty(y);
255
- }
256
- };
257
- }
258
333
  export {
259
- Ce as SelectPopup
334
+ Cr as SelectRoot
260
335
  };
261
336
  //# sourceMappingURL=index49.js.map