@rpcbase/ui 0.243.0 → 0.245.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.
- package/dist/index10.js +2 -2
- package/dist/index106.js +1 -1
- package/dist/index11.js +2 -2
- package/dist/index12.js +3 -3
- package/dist/index13.js +2 -2
- package/dist/index14.js +2 -2
- package/dist/index149.js +14 -5
- package/dist/index149.js.map +1 -1
- package/dist/index15.js +2 -2
- package/dist/index150.js +63 -63
- package/dist/index150.js.map +1 -1
- package/dist/index151.js +38 -2
- package/dist/index151.js.map +1 -1
- package/dist/index152.js +13 -385
- package/dist/index152.js.map +1 -1
- package/dist/index153.js +23 -261
- package/dist/index153.js.map +1 -1
- package/dist/index154.js +109 -58
- package/dist/index154.js.map +1 -1
- package/dist/index155.js +13 -47
- package/dist/index155.js.map +1 -1
- package/dist/index156.js +4 -169
- package/dist/index156.js.map +1 -1
- package/dist/index157.js +4 -110
- package/dist/index157.js.map +1 -1
- package/dist/index158.js +5 -25
- package/dist/index158.js.map +1 -1
- package/dist/index159.js +12 -8
- package/dist/index159.js.map +1 -1
- package/dist/index16.js +8 -8
- package/dist/index160.js +19 -4
- package/dist/index160.js.map +1 -1
- package/dist/index161.js +11 -6
- package/dist/index161.js.map +1 -1
- package/dist/index162.js +176 -4
- package/dist/index162.js.map +1 -1
- package/dist/index163.js +268 -476
- package/dist/index163.js.map +1 -1
- package/dist/index164.js +4 -189
- package/dist/index164.js.map +1 -1
- package/dist/index165.js +28 -14
- package/dist/index165.js.map +1 -1
- package/dist/index166.js +124 -105
- package/dist/index166.js.map +1 -1
- package/dist/index167.js +63 -262
- package/dist/index167.js.map +1 -1
- package/dist/index168.js +8 -6
- package/dist/index168.js.map +1 -1
- package/dist/index169.js +15 -40
- package/dist/index169.js.map +1 -1
- package/dist/index17.js +1 -1
- package/dist/index170.js +30 -4
- package/dist/index170.js.map +1 -1
- package/dist/index171.js +69 -14
- package/dist/index171.js.map +1 -1
- package/dist/index172.js +5 -68
- package/dist/index172.js.map +1 -1
- package/dist/index173.js +66 -35
- package/dist/index173.js.map +1 -1
- package/dist/index174.js +2 -14
- package/dist/index174.js.map +1 -1
- package/dist/index175.js +384 -22
- package/dist/index175.js.map +1 -1
- package/dist/index176.js +258 -108
- package/dist/index176.js.map +1 -1
- package/dist/index177.js +61 -13
- package/dist/index177.js.map +1 -1
- package/dist/index178.js +46 -4
- package/dist/index178.js.map +1 -1
- package/dist/index179.js +170 -4
- package/dist/index179.js.map +1 -1
- package/dist/index18.js +7 -7
- package/dist/index180.js +110 -5
- package/dist/index180.js.map +1 -1
- package/dist/index181.js +24 -11
- package/dist/index181.js.map +1 -1
- package/dist/index182.js +8 -20
- package/dist/index182.js.map +1 -1
- package/dist/index183.js +5 -11
- package/dist/index183.js.map +1 -1
- package/dist/index184.js +5 -176
- package/dist/index184.js.map +1 -1
- package/dist/index185.js +4 -279
- package/dist/index185.js.map +1 -1
- package/dist/index186.js +487 -4
- package/dist/index186.js.map +1 -1
- package/dist/index187.js +189 -27
- package/dist/index187.js.map +1 -1
- package/dist/index188.js +13 -126
- package/dist/index188.js.map +1 -1
- package/dist/index189.js +107 -63
- package/dist/index189.js.map +1 -1
- package/dist/index19.js +16 -16
- package/dist/index190.js +262 -8
- package/dist/index190.js.map +1 -1
- package/dist/index191.js +7 -16
- package/dist/index191.js.map +1 -1
- package/dist/index192.js +39 -29
- package/dist/index192.js.map +1 -1
- package/dist/index193.js +4 -69
- package/dist/index193.js.map +1 -1
- package/dist/index21.js +1 -1
- package/dist/index22.js +2 -2
- package/dist/index23.js +1 -1
- package/dist/index24.js +1 -1
- package/dist/index246.js +1 -1
- package/dist/index25.js +1 -1
- package/dist/index252.js +1 -1
- package/dist/index254.js +58 -146
- package/dist/index254.js.map +1 -1
- package/dist/index255.js +8 -32
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +11 -11
- package/dist/index256.js.map +1 -1
- package/dist/index257.js +7 -48
- package/dist/index257.js.map +1 -1
- package/dist/index258.js +5 -9
- package/dist/index258.js.map +1 -1
- package/dist/index259.js +13 -11
- package/dist/index259.js.map +1 -1
- package/dist/index260.js +3 -43
- package/dist/index260.js.map +1 -1
- package/dist/index261.js +3 -97
- package/dist/index261.js.map +1 -1
- package/dist/index262.js +87 -74
- package/dist/index262.js.map +1 -1
- package/dist/index263.js +16 -104
- package/dist/index263.js.map +1 -1
- package/dist/index264.js +27 -50
- package/dist/index264.js.map +1 -1
- package/dist/index265.js +51 -11
- package/dist/index265.js.map +1 -1
- package/dist/index266.js +5 -4
- package/dist/index266.js.map +1 -1
- package/dist/index267.js +5 -37
- package/dist/index267.js.map +1 -1
- package/dist/index268.js +61 -8
- package/dist/index268.js.map +1 -1
- package/dist/index269.js +61 -130
- package/dist/index269.js.map +1 -1
- package/dist/index270.js +133 -17
- package/dist/index270.js.map +1 -1
- package/dist/index271.js +7 -14
- package/dist/index271.js.map +1 -1
- package/dist/index272.js +5 -4
- package/dist/index272.js.map +1 -1
- package/dist/index273.js +4 -37
- package/dist/index273.js.map +1 -1
- package/dist/index274.js +11 -20
- package/dist/index274.js.map +1 -1
- package/dist/index275.js +21 -8
- package/dist/index275.js.map +1 -1
- package/dist/index276.js +16 -9
- package/dist/index276.js.map +1 -1
- package/dist/index277.js +11 -24
- package/dist/index277.js.map +1 -1
- package/dist/index278.js +8 -29
- package/dist/index278.js.map +1 -1
- package/dist/index279.js +142 -14
- package/dist/index279.js.map +1 -1
- package/dist/index28.js +1 -1
- package/dist/index280.js +79 -19
- package/dist/index280.js.map +1 -1
- package/dist/index281.js +60 -65
- package/dist/index281.js.map +1 -1
- package/dist/index282.js +15 -7
- package/dist/index282.js.map +1 -1
- package/dist/index283.js +20 -6
- package/dist/index283.js.map +1 -1
- package/dist/index284.js +6 -11
- package/dist/index284.js.map +1 -1
- package/dist/index285.js +11 -3
- package/dist/index285.js.map +1 -1
- package/dist/index286.js +3 -50
- package/dist/index286.js.map +1 -1
- package/dist/index287.js +51 -4
- package/dist/index287.js.map +1 -1
- package/dist/index288.js +12 -25
- package/dist/index288.js.map +1 -1
- package/dist/index289.js +19 -14
- package/dist/index289.js.map +1 -1
- package/dist/index29.js +3 -56
- package/dist/index29.js.map +1 -1
- package/dist/index290.js +53 -5
- package/dist/index290.js.map +1 -1
- package/dist/index291.js +20 -21
- package/dist/index291.js.map +1 -1
- package/dist/index292.js +41 -53
- package/dist/index292.js.map +1 -1
- package/dist/index293.js +38 -19
- package/dist/index293.js.map +1 -1
- package/dist/index294.js +46 -42
- package/dist/index294.js.map +1 -1
- package/dist/index295.js +19 -38
- package/dist/index295.js.map +1 -1
- package/dist/index296.js +71 -46
- package/dist/index296.js.map +1 -1
- package/dist/index297.js +17 -20
- package/dist/index297.js.map +1 -1
- package/dist/index298.js +3 -70
- package/dist/index298.js.map +1 -1
- package/dist/index299.js +12 -16
- package/dist/index299.js.map +1 -1
- package/dist/index3.js +2 -2
- package/dist/index30.js +242 -3
- package/dist/index30.js.map +1 -1
- package/dist/index300.js +18 -3
- package/dist/index300.js.map +1 -1
- package/dist/index301.js +36 -11
- package/dist/index301.js.map +1 -1
- package/dist/index302.js +238 -12
- package/dist/index302.js.map +1 -1
- package/dist/index303.js +249 -15
- package/dist/index303.js.map +1 -1
- package/dist/index304.js +67 -35
- package/dist/index304.js.map +1 -1
- package/dist/index305.js +77 -233
- package/dist/index305.js.map +1 -1
- package/dist/index306.js +3 -252
- package/dist/index306.js.map +1 -1
- package/dist/index307.js +29 -68
- package/dist/index307.js.map +1 -1
- package/dist/index308.js +16 -99
- package/dist/index308.js.map +1 -1
- package/dist/index309.js +33 -82
- package/dist/index309.js.map +1 -1
- package/dist/index31.js +21 -239
- package/dist/index31.js.map +1 -1
- package/dist/index310.js +17 -3
- package/dist/index310.js.map +1 -1
- package/dist/index311.js +3 -29
- package/dist/index311.js.map +1 -1
- package/dist/index312.js +26 -16
- package/dist/index312.js.map +1 -1
- package/dist/index313.js +28 -34
- package/dist/index313.js.map +1 -1
- package/dist/index314.js +4 -18
- package/dist/index314.js.map +1 -1
- package/dist/index315.js +78 -3
- package/dist/index315.js.map +1 -1
- package/dist/index316.js +269 -23
- package/dist/index316.js.map +1 -1
- package/dist/index317.js +10 -27
- package/dist/index317.js.map +1 -1
- package/dist/index318.js +11 -4
- package/dist/index318.js.map +1 -1
- package/dist/index319.js +24 -77
- package/dist/index319.js.map +1 -1
- package/dist/index32.js +4 -23
- package/dist/index32.js.map +1 -1
- package/dist/index320.js +15 -271
- package/dist/index320.js.map +1 -1
- package/dist/index321.js +125 -11
- package/dist/index321.js.map +1 -1
- package/dist/index322.js +5 -10
- package/dist/index322.js.map +1 -1
- package/dist/index323.js +64 -24
- package/dist/index323.js.map +1 -1
- package/dist/index324.js +14 -17
- package/dist/index324.js.map +1 -1
- package/dist/index325.js +7 -125
- package/dist/index325.js.map +1 -1
- package/dist/index326.js +5 -5
- package/dist/index326.js.map +1 -1
- package/dist/index327.js +3 -65
- package/dist/index327.js.map +1 -1
- package/dist/index328.js +10 -13
- package/dist/index328.js.map +1 -1
- package/dist/index329.js +7 -7
- package/dist/index329.js.map +1 -1
- package/dist/index33.js +6 -3
- package/dist/index33.js.map +1 -1
- package/dist/index330.js +399 -5
- package/dist/index330.js.map +1 -1
- package/dist/index331.js +5 -4
- package/dist/index331.js.map +1 -1
- package/dist/index332.js +52 -10
- package/dist/index332.js.map +1 -1
- package/dist/index333.js +10 -6
- package/dist/index333.js.map +1 -1
- package/dist/index334.js +22 -128
- package/dist/index334.js.map +1 -1
- package/dist/index335.js +11 -399
- package/dist/index335.js.map +1 -1
- package/dist/index336.js +155 -5
- package/dist/index336.js.map +1 -1
- package/dist/index337.js +31 -51
- package/dist/index337.js.map +1 -1
- package/dist/index338.js +11 -11
- package/dist/index338.js.map +1 -1
- package/dist/index339.js +45 -23
- package/dist/index339.js.map +1 -1
- package/dist/index34.js +38 -8
- package/dist/index34.js.map +1 -1
- package/dist/index340.js +9 -11
- package/dist/index340.js.map +1 -1
- package/dist/index341.js +11 -8
- package/dist/index341.js.map +1 -1
- package/dist/index342.js +43 -11
- package/dist/index342.js.map +1 -1
- package/dist/index343.js +96 -7
- package/dist/index343.js.map +1 -1
- package/dist/index344.js +84 -11
- package/dist/index344.js.map +1 -1
- package/dist/index345.js +105 -3
- package/dist/index345.js.map +1 -1
- package/dist/index346.js +52 -3
- package/dist/index346.js.map +1 -1
- package/dist/index347.js +10 -16
- package/dist/index347.js.map +1 -1
- package/dist/index348.js +4 -61
- package/dist/index348.js.map +1 -1
- package/dist/index349.js +34 -63
- package/dist/index349.js.map +1 -1
- package/dist/index35.js +74 -35
- package/dist/index35.js.map +1 -1
- package/dist/index350.js +8 -51
- package/dist/index350.js.map +1 -1
- package/dist/index351.js +135 -5
- package/dist/index351.js.map +1 -1
- package/dist/index352.js +17 -8
- package/dist/index352.js.map +1 -1
- package/dist/index353.js +16 -5
- package/dist/index353.js.map +1 -1
- package/dist/index354.js +3 -11
- package/dist/index354.js.map +1 -1
- package/dist/index355.js +34 -19
- package/dist/index355.js.map +1 -1
- package/dist/index356.js +20 -16
- package/dist/index356.js.map +1 -1
- package/dist/index357.js +10 -8
- package/dist/index357.js.map +1 -1
- package/dist/index358.js +8 -144
- package/dist/index358.js.map +1 -1
- package/dist/index359.js +22 -77
- package/dist/index359.js.map +1 -1
- package/dist/index36.js +20 -74
- package/dist/index36.js.map +1 -1
- package/dist/index360.js +28 -61
- package/dist/index360.js.map +1 -1
- package/dist/index361.js +17 -15
- package/dist/index361.js.map +1 -1
- package/dist/index363.js +5 -5
- package/dist/index365.js +8 -4
- package/dist/index365.js.map +1 -1
- package/dist/index366.js +27 -21
- package/dist/index366.js.map +1 -1
- package/dist/index367.js +138 -4
- package/dist/index367.js.map +1 -1
- package/dist/index368.js +11 -10
- package/dist/index368.js.map +1 -1
- package/dist/index369.js +46 -5
- package/dist/index369.js.map +1 -1
- package/dist/index37.js +33 -18
- package/dist/index37.js.map +1 -1
- package/dist/index370.js +4 -3
- package/dist/index370.js.map +1 -1
- package/dist/index371.js +20 -19
- package/dist/index371.js.map +1 -1
- package/dist/index372.js +75 -44
- package/dist/index372.js.map +1 -1
- package/dist/index373.js +11 -17
- package/dist/index373.js.map +1 -1
- package/dist/index374.js +4 -5
- package/dist/index374.js.map +1 -1
- package/dist/index375.js +70 -197
- package/dist/index375.js.map +1 -1
- package/dist/index376.js +197 -70
- package/dist/index376.js.map +1 -1
- package/dist/index377.js +66 -118
- package/dist/index377.js.map +1 -1
- package/dist/index378.js +35 -8
- package/dist/index378.js.map +1 -1
- package/dist/index379.js +7 -27
- package/dist/index379.js.map +1 -1
- package/dist/index38.js +26 -36
- package/dist/index38.js.map +1 -1
- package/dist/index380.js +14 -136
- package/dist/index380.js.map +1 -1
- package/dist/index381.js +121 -10
- package/dist/index381.js.map +1 -1
- package/dist/index382.js +4 -47
- package/dist/index382.js.map +1 -1
- package/dist/index383.js +11 -3
- package/dist/index383.js.map +1 -1
- package/dist/index384.js +5 -21
- package/dist/index384.js.map +1 -1
- package/dist/index385.js +3 -76
- package/dist/index385.js.map +1 -1
- package/dist/index386.js +21 -12
- package/dist/index386.js.map +1 -1
- package/dist/index387.js +45 -4
- package/dist/index387.js.map +1 -1
- package/dist/index388.js +16 -70
- package/dist/index388.js.map +1 -1
- package/dist/index389.js +5 -36
- package/dist/index389.js.map +1 -1
- package/dist/index39.js +21 -26
- package/dist/index39.js.map +1 -1
- package/dist/index390.js +5 -7
- package/dist/index390.js.map +1 -1
- package/dist/index391.js +20 -15
- package/dist/index391.js.map +1 -1
- package/dist/index399.js +2 -2
- package/dist/index4.js +2 -2
- package/dist/index40.js +56 -20
- package/dist/index40.js.map +1 -1
- package/dist/index409.js +3 -3
- package/dist/index409.js.map +1 -1
- package/dist/index41.js +51 -59
- package/dist/index41.js.map +1 -1
- package/dist/index410.js +15 -3
- package/dist/index410.js.map +1 -1
- package/dist/index411.js +488 -11
- package/dist/index411.js.map +1 -1
- package/dist/index412.js +3 -3
- package/dist/index412.js.map +1 -1
- package/dist/index413.js +3 -492
- package/dist/index413.js.map +1 -1
- package/dist/index414.js +5 -68
- package/dist/index414.js.map +1 -1
- package/dist/index415.js +55 -30
- package/dist/index415.js.map +1 -1
- package/dist/index416.js +68 -9
- package/dist/index416.js.map +1 -1
- package/dist/index417.js +26 -148
- package/dist/index417.js.map +1 -1
- package/dist/index418.js +9 -108
- package/dist/index418.js.map +1 -1
- package/dist/index419.js +153 -5
- package/dist/index419.js.map +1 -1
- package/dist/index42.js +21 -50
- package/dist/index42.js.map +1 -1
- package/dist/index420.js +106 -54
- package/dist/index420.js.map +1 -1
- package/dist/index421.js +32 -7
- package/dist/index421.js.map +1 -1
- package/dist/index422.js +8 -2
- package/dist/index422.js.map +1 -1
- package/dist/index423.js +2 -44
- package/dist/index423.js.map +1 -1
- package/dist/index424.js +40 -52
- package/dist/index424.js.map +1 -1
- package/dist/index425.js +55 -7
- package/dist/index425.js.map +1 -1
- package/dist/index426.js +8 -2
- package/dist/index426.js.map +1 -1
- package/dist/index427.js +2 -55
- package/dist/index427.js.map +1 -1
- package/dist/index428.js +52 -53
- package/dist/index428.js.map +1 -1
- package/dist/index429.js +55 -32
- package/dist/index429.js.map +1 -1
- package/dist/index43.js +127 -18
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +39 -122
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +85 -42
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +123 -87
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +5 -126
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +332 -5
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +246 -321
- package/dist/index49.js.map +1 -1
- package/dist/index5.js +2 -2
- package/dist/index50.js +23 -254
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +129 -25
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +24 -129
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +19 -22
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +134 -19
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +30 -133
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +24 -30
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +38 -26
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +19 -39
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +133 -18
- package/dist/index59.js.map +1 -1
- package/dist/index6.js +4 -4
- package/dist/index60.js +49 -134
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +25 -48
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +57 -28
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +56 -57
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +5 -5
- package/dist/index64.js.map +1 -1
- package/dist/index66.js +22 -10
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +232 -17
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +5 -5
- package/dist/index68.js.map +1 -1
- package/dist/index7.js +11 -11
- package/dist/index70.js +10 -22
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +17 -232
- package/dist/index71.js.map +1 -1
- package/dist/index76.js +1 -1
- package/dist/index77.js +2 -2
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +2 -2
- package/dist/index78.js.map +1 -1
- package/dist/index8.js +2 -2
- package/dist/index9.js +1 -1
- package/package.json +1 -1
package/dist/index303.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index303.js","sources":["../node_modules/@base-ui/utils/store/useStore.mjs"],"sourcesContent":["import * as React from 'react';\n/* We need to import the shim because React 17 does not support the `useSyncExternalStore` API.\n * More info: https://github.com/mui/mui-x/issues/18303#issuecomment-2958392341 */\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport { isReactVersionAtLeast } from \"../reactVersion.mjs\";\nimport { register, getInstance } from \"../fastHooks.mjs\";\n/* Some tests fail in R18 with the raw useSyncExternalStore. It may be possible to make it work\n * but for now we only enable it for R19+. */\nconst canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);\nconst useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;\nexport function useStore(store, selector, a1, a2, a3) {\n return useStoreImplementation(store, selector, a1, a2, a3);\n}\nfunction useStoreR19(store, selector, a1, a2, a3) {\n const getSelection = React.useCallback(() => selector(store.getSnapshot(), a1, a2, a3), [store, selector, a1, a2, a3]);\n return useSyncExternalStore(store.subscribe, getSelection, getSelection);\n}\nregister({\n before(instance) {\n instance.syncIndex = 0;\n if (!instance.didInitialize) {\n instance.syncTick = 1;\n instance.syncHooks = [];\n instance.didChangeStore = true;\n instance.getSnapshot = () => {\n let didChange = false;\n for (let i = 0; i < instance.syncHooks.length; i += 1) {\n const hook = instance.syncHooks[i];\n const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);\n if (!Object.is(hook.value, value)) {\n didChange = true;\n hook.value = value;\n }\n }\n if (didChange) {\n instance.syncTick += 1;\n }\n return instance.syncTick;\n };\n }\n },\n after(instance) {\n if (instance.syncHooks.length > 0) {\n if (instance.didChangeStore) {\n instance.didChangeStore = false;\n instance.subscribe = onStoreChange => {\n const stores = new Set();\n for (const hook of instance.syncHooks) {\n stores.add(hook.store);\n }\n const unsubscribes = [];\n for (const store of stores) {\n unsubscribes.push(store.subscribe(onStoreChange));\n }\n return () => {\n for (const unsubscribe of unsubscribes) {\n unsubscribe();\n }\n };\n };\n }\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useSyncExternalStore(instance.subscribe, instance.getSnapshot, instance.getSnapshot);\n }\n }\n});\nfunction useStoreFast(store, selector, a1, a2, a3) {\n const instance = getInstance();\n if (!instance) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useStoreR19(store, selector, a1, a2, a3);\n }\n const index = instance.syncIndex;\n instance.syncIndex += 1;\n let hook;\n if (!instance.didInitialize) {\n hook = {\n store,\n selector,\n a1,\n a2,\n a3,\n value: selector(store.getSnapshot(), a1, a2, a3)\n };\n instance.syncHooks.push(hook);\n } else {\n hook = instance.syncHooks[index];\n if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {\n if (hook.store !== store) {\n instance.didChangeStore = true;\n }\n hook.store = store;\n hook.selector = selector;\n hook.a1 = a1;\n hook.a2 = a2;\n hook.a3 = a3;\n hook.value = selector(store.getSnapshot(), a1, a2, a3);\n }\n }\n return hook.value;\n}\nfunction useStoreLegacy(store, selector, a1, a2, a3) {\n return useSyncExternalStoreWithSelector(store.subscribe, store.getSnapshot, store.getSnapshot, state => selector(state, a1, a2, a3));\n}"],"names":["canUseRawUseSyncExternalStore","isReactVersionAtLeast","useStoreImplementation","useStoreFast","useStoreLegacy","useStore","store","selector","a1","a2","a3","useStoreR19","getSelection","React","useSyncExternalStore","useSyncExternalStoreWithSelector","state"],"mappings":";;;;AASA,MAAMA,IAAgCC,EAAsB,EAAE,GACxDC,IAAyBF,IAAgCG,IAAeC;AACvE,SAASC,EAASC,GAAOC,GAAUC,GAAIC,GAAIC,GAAI;AACpD,SAAOR,EAAuBI,GAAOC,GAAUC,GAAIC,GAAIC,CAAE;AAC3D;AACA,SAASC,EAAYL,GAAOC,GAAUC,GAAIC,GAAIC,GAAI;AAChD,QAAME,IAAeC,EAAM,YAAY,MAAMN,EAASD,EAAM,eAAeE,GAAIC,GAAIC,CAAE,GAAG,CAACJ,GAAOC,GAAUC,GAAIC,GAAIC,CAAE,CAAC;AACrH,SAAOI,EAAAA,qBAAqBR,EAAM,WAAWM,GAAcA,CAAY;AACzE;AAkDA,SAAST,EAAaG,GAAOC,GAAUC,GAAIC,GAAIC,GAAI;AAI/C,SAAOC,EAAYL,GAAOC,GAAUC,GAAIC,GAAIC,CAAE;AA8BlD;AACA,SAASN,EAAeE,GAAOC,GAAUC,GAAIC,GAAIC,GAAI;AACnD,SAAOK,EAAAA,iCAAiCT,EAAM,WAAWA,EAAM,aAAaA,EAAM,aAAa,CAAAU,MAAST,EAASS,GAAOR,GAAIC,GAAIC,CAAE,CAAC;AACrI;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index303.js","sources":["../../../node_modules/@base-ui/react/floating-ui-react/hooks/useListNavigation.mjs"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { isHTMLElement } from '@floating-ui/utils/dom';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useFloatingParentNodeId, useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { findNonDisabledListIndex, getMaxListIndex, getMinListIndex, isIndexOutOfListBounds } from \"../utils/composite.mjs\";\nimport { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP } from \"../utils/constants.mjs\";\nimport { activeElement, contains, getFloatingFocusElement, getTarget, isTypeableCombobox } from \"../utils/element.mjs\";\nimport { enqueueFocus } from \"../utils/enqueueFocus.mjs\";\nimport { isVirtualClick, isVirtualPointerEvent, stopEvent } from \"../utils/event.mjs\";\nexport const ESCAPE = 'Escape';\nfunction doSwitch(orientation, vertical, horizontal) {\n switch (orientation) {\n case 'vertical':\n return vertical;\n case 'horizontal':\n return horizontal;\n default:\n return vertical || horizontal;\n }\n}\nfunction isMainOrientationKey(key, orientation) {\n const vertical = key === ARROW_UP || key === ARROW_DOWN;\n const horizontal = key === ARROW_LEFT || key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isMainOrientationToEndKey(key, orientation, rtl) {\n const vertical = key === ARROW_DOWN;\n const horizontal = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal) || key === 'Enter' || key === ' ' || key === '';\n}\nfunction isCrossOrientationOpenKey(key, orientation, rtl) {\n const vertical = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n const horizontal = key === ARROW_DOWN;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isCrossOrientationCloseKey(key, orientation, rtl, grid) {\n const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT;\n const horizontal = key === ARROW_UP;\n if (orientation === 'both' || orientation === 'horizontal' && grid) {\n return key === ESCAPE;\n }\n return doSwitch(orientation, vertical, horizontal);\n}\n/**\n * Adds arrow key-based navigation of a list of items, either using real DOM\n * focus or virtual focus.\n * @see https://floating-ui.com/docs/useListNavigation\n */\nexport function useListNavigation(context, props) {\n const {\n listRef,\n activeIndex,\n onNavigate: onNavigateProp = () => {},\n enabled = true,\n selectedIndex = null,\n allowEscape = false,\n loopFocus = false,\n nested = false,\n rtl = false,\n virtual = false,\n focusItemOnOpen = 'auto',\n focusItemOnHover = true,\n openOnArrowKeyDown = true,\n disabledIndices = undefined,\n orientation = 'vertical',\n parentOrientation,\n id,\n resetOnPointerLeave = true,\n externalTree,\n grid: navigateGrid\n } = props;\n const isGrid = navigateGrid != null;\n if (process.env.NODE_ENV !== 'production') {\n if (allowEscape) {\n if (!loopFocus) {\n console.warn('`useListNavigation` looping must be enabled to allow escaping.');\n }\n if (!virtual) {\n console.warn('`useListNavigation` must be virtual to allow escaping.');\n }\n }\n if (orientation === 'vertical' && isGrid) {\n console.warn('In grid list navigation mode, the `orientation` should', 'be either \"horizontal\" or \"both\".');\n }\n }\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const floatingElement = store.useState('floatingElement');\n const domReferenceElement = store.useState('domReferenceElement');\n const dataRef = store.context.dataRef;\n const floatingFocusElement = getFloatingFocusElement(floatingElement);\n const typeableComboboxReference = isTypeableCombobox(domReferenceElement);\n const floatingFocusElementRef = useValueAsRef(floatingFocusElement);\n const parentId = useFloatingParentNodeId();\n const tree = useFloatingTree(externalTree);\n const focusItemOnOpenRef = React.useRef(focusItemOnOpen);\n const indexRef = React.useRef(selectedIndex ?? -1);\n const keyRef = React.useRef(null);\n const isPointerModalityRef = React.useRef(true);\n const onNavigate = useStableCallback(event => {\n onNavigateProp(indexRef.current === -1 ? null : indexRef.current, event);\n });\n const previousMountedRef = React.useRef(!!floatingElement);\n const previousOpenRef = React.useRef(open);\n const forceSyncFocusRef = React.useRef(false);\n const forceScrollIntoViewRef = React.useRef(false);\n const cancelQueuedFocusRef = React.useRef(null);\n const disabledIndicesRef = useValueAsRef(disabledIndices);\n const latestOpenRef = useValueAsRef(open);\n const selectedIndexRef = useValueAsRef(selectedIndex);\n const resetOnPointerLeaveRef = useValueAsRef(resetOnPointerLeave);\n const focusFrame = useAnimationFrame();\n const waitForListPopulatedFrame = useAnimationFrame();\n const focusItem = useStableCallback(() => {\n function runFocus(item) {\n if (virtual) {\n tree?.events.emit('virtualfocus', item);\n } else {\n cancelQueuedFocusRef.current = enqueueFocus(item, {\n sync: forceSyncFocusRef.current,\n preventScroll: true\n });\n }\n }\n const initialItem = listRef.current[indexRef.current];\n const forceScrollIntoView = forceScrollIntoViewRef.current;\n if (initialItem) {\n runFocus(initialItem);\n }\n const scheduler = forceSyncFocusRef.current ? callback => callback() : callback => focusFrame.request(callback);\n scheduler(() => {\n const waitedItem = listRef.current[indexRef.current] || initialItem;\n if (!waitedItem) {\n return;\n }\n if (!initialItem) {\n runFocus(waitedItem);\n }\n const shouldScrollIntoView =\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n item && (forceScrollIntoView || !isPointerModalityRef.current);\n if (shouldScrollIntoView) {\n // JSDOM doesn't support `.scrollIntoView()` but it's widely supported\n // by all browsers.\n waitedItem.scrollIntoView?.({\n block: 'nearest',\n inline: 'nearest'\n });\n }\n });\n });\n useIsoLayoutEffect(() => {\n dataRef.current.orientation = orientation;\n }, [dataRef, orientation]);\n\n // Sync `selectedIndex` to be the `activeIndex` upon opening the floating\n // element. Also, reset `activeIndex` upon closing the floating element.\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return;\n }\n if (open && floatingElement) {\n indexRef.current = selectedIndex ?? -1;\n if (focusItemOnOpenRef.current && selectedIndex != null) {\n // Regardless of the pointer modality, we want to ensure the selected\n // item comes into view when the floating element is opened.\n forceScrollIntoViewRef.current = true;\n onNavigate();\n }\n } else if (previousMountedRef.current) {\n // Reset the active index when the list is no longer open and mounted (closing or\n // unmounting). `onNavigate` is a stable callback that always forwards to the latest\n // `onNavigate` prop.\n indexRef.current = -1;\n onNavigate();\n }\n }, [enabled, open, floatingElement, selectedIndex, onNavigate]);\n\n // Sync `activeIndex` to be the focused item while the floating element is\n // open.\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return;\n }\n if (!open) {\n forceSyncFocusRef.current = false;\n return;\n }\n if (!floatingElement) {\n return;\n }\n if (activeIndex == null) {\n forceSyncFocusRef.current = false;\n if (selectedIndexRef.current != null) {\n return;\n }\n\n // Reset while the floating element was open (e.g. the list changed).\n if (previousMountedRef.current) {\n indexRef.current = -1;\n focusItem();\n }\n\n // Initial sync.\n if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {\n let runs = 0;\n const waitForListPopulated = () => {\n if (listRef.current[0] == null) {\n // Avoid letting the browser paint if possible on the first try,\n // otherwise use rAF. Don't try more than twice, since something\n // is wrong otherwise.\n if (runs < 2) {\n const scheduler = runs ? callback => waitForListPopulatedFrame.request(callback) : queueMicrotask;\n scheduler(waitForListPopulated);\n }\n runs += 1;\n } else {\n // Initially focus the first non-disabled item. `disabledIndices` is deliberately\n // omitted here so attribute-disabled items (`disabled`/`aria-disabled`) are skipped\n // on open even when the consumer passes an empty `disabledIndices` array. Passing it\n // would regress that behavior (see mui/base-ui#2604).\n indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? getMinListIndex(listRef) : getMaxListIndex(listRef);\n keyRef.current = null;\n onNavigate();\n }\n };\n waitForListPopulated();\n }\n } else if (!isIndexOutOfListBounds(listRef.current, activeIndex)) {\n indexRef.current = activeIndex;\n focusItem();\n forceScrollIntoViewRef.current = false;\n }\n }, [enabled, open, floatingElement, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem, waitForListPopulatedFrame]);\n\n // Ensure the parent floating element has focus when a nested child closes\n // to allow arrow key navigation to work after the pointer leaves the child.\n useIsoLayoutEffect(() => {\n if (!enabled || floatingElement || !tree || virtual || !previousMountedRef.current) {\n return;\n }\n const nodes = tree.nodesRef.current;\n const parent = nodes.find(node => node.id === parentId)?.context?.elements.floating;\n // `floatingElement` is null here (see the guard above), so resolve the owner document from an\n // in-DOM element for realm-safety (shadow DOM/iframes): the reference element, falling back to\n // the parent floating element when the reference is virtual (`domReferenceElement` is null).\n const activeEl = activeElement(ownerDocument(domReferenceElement ?? parent ?? null));\n const treeContainsActiveEl = nodes.some(node => node.context && contains(node.context.elements.floating, activeEl));\n if (parent && !treeContainsActiveEl && isPointerModalityRef.current) {\n parent.focus({\n preventScroll: true\n });\n }\n }, [enabled, floatingElement, domReferenceElement, tree, parentId, virtual]);\n useIsoLayoutEffect(() => {\n previousOpenRef.current = open;\n previousMountedRef.current = !!floatingElement;\n });\n useIsoLayoutEffect(() => {\n if (!open) {\n keyRef.current = null;\n focusItemOnOpenRef.current = focusItemOnOpen;\n }\n }, [open, focusItemOnOpen]);\n const hasActiveIndex = activeIndex != null;\n const syncCurrentTarget = useStableCallback(event => {\n if (!latestOpenRef.current) {\n return;\n }\n const index = listRef.current.indexOf(event.currentTarget);\n if (index !== -1 && (indexRef.current !== index || activeIndex !== index)) {\n indexRef.current = index;\n onNavigate(event);\n }\n });\n const getParentOrientation = useStableCallback(() => {\n return parentOrientation ?? tree?.nodesRef.current.find(node => node.id === parentId)?.context?.dataRef?.current.orientation;\n });\n const getMinEnabledIndex = useStableCallback(() => {\n return getMinListIndex(listRef, disabledIndicesRef.current);\n });\n const commonOnKeyDown = useStableCallback(event => {\n isPointerModalityRef.current = false;\n forceSyncFocusRef.current = true;\n\n // When composing a character, Chrome fires ArrowDown twice. Firefox/Safari\n // don't appear to suffer from this. `event.isComposing` is avoided due to\n // Safari not supporting it properly (although it's not needed in the first\n // place for Safari, just avoiding any possible issues).\n if (event.which === 229) {\n return;\n }\n\n // If the floating element is animating out, ignore navigation. Otherwise,\n // the `activeIndex` gets set to 0 despite not being open so the next time\n // the user ArrowDowns, the first item won't be focused.\n if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) {\n return;\n }\n if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl, isGrid)) {\n // If the nested list's close key is also the parent navigation key,\n // let the parent navigate. Otherwise, stop propagating the event.\n if (!isMainOrientationKey(event.key, getParentOrientation())) {\n stopEvent(event);\n }\n store.setOpen(false, createChangeEventDetails(REASONS.listNavigation, event.nativeEvent));\n if (isHTMLElement(domReferenceElement)) {\n if (virtual) {\n tree?.events.emit('virtualfocus', domReferenceElement);\n } else {\n domReferenceElement.focus();\n }\n }\n return;\n }\n const currentIndex = indexRef.current;\n const minIndex = getMinListIndex(listRef, disabledIndices);\n const maxIndex = getMaxListIndex(listRef, disabledIndices);\n if (!typeableComboboxReference) {\n if (event.key === 'Home') {\n stopEvent(event);\n indexRef.current = minIndex;\n onNavigate(event);\n }\n if (event.key === 'End') {\n stopEvent(event);\n indexRef.current = maxIndex;\n onNavigate(event);\n }\n }\n\n // Grid navigation is injected by grid-capable consumers so non-grid\n // consumers (menu, select) tree-shake the grid helpers out.\n if (navigateGrid != null) {\n const index = navigateGrid(event, indexRef.current, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex);\n if (index != null) {\n indexRef.current = index;\n onNavigate(event);\n }\n if (orientation === 'both') {\n return;\n }\n }\n if (isMainOrientationKey(event.key, orientation)) {\n stopEvent(event);\n\n // Reset the index if no item is focused.\n if (open && !virtual && activeElement(event.currentTarget.ownerDocument) === event.currentTarget) {\n indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex;\n onNavigate(event);\n return;\n }\n if (isMainOrientationToEndKey(event.key, orientation, rtl)) {\n if (loopFocus) {\n if (currentIndex >= maxIndex) {\n if (allowEscape && currentIndex !== listRef.current.length) {\n indexRef.current = -1;\n } else {\n // Give time for virtualizers to update the listRef.\n forceSyncFocusRef.current = false;\n indexRef.current = minIndex;\n }\n } else {\n indexRef.current = findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n disabledIndices\n });\n }\n } else {\n indexRef.current = Math.min(maxIndex, findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n disabledIndices\n }));\n }\n } else if (loopFocus) {\n if (currentIndex <= minIndex) {\n if (allowEscape && currentIndex !== -1) {\n indexRef.current = listRef.current.length;\n } else {\n // Give time for virtualizers to update the listRef.\n forceSyncFocusRef.current = false;\n indexRef.current = maxIndex;\n }\n } else {\n indexRef.current = findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n });\n }\n } else {\n indexRef.current = Math.max(minIndex, findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n }));\n }\n if (isIndexOutOfListBounds(listRef.current, indexRef.current)) {\n indexRef.current = -1;\n }\n onNavigate(event);\n }\n });\n const item = React.useMemo(() => {\n const itemProps = {\n onFocus(event) {\n forceSyncFocusRef.current = true;\n syncCurrentTarget(event);\n },\n onClick: ({\n currentTarget\n }) => currentTarget.focus({\n preventScroll: true\n }),\n // Safari\n onMouseMove(event) {\n forceSyncFocusRef.current = true;\n forceScrollIntoViewRef.current = false;\n if (focusItemOnHover) {\n syncCurrentTarget(event);\n }\n },\n onPointerLeave(event) {\n if (!latestOpenRef.current || !isPointerModalityRef.current || event.pointerType === 'touch') {\n return;\n }\n forceSyncFocusRef.current = true;\n const relatedTarget = event.relatedTarget;\n if (!focusItemOnHover || listRef.current.includes(relatedTarget)) {\n return;\n }\n if (!resetOnPointerLeaveRef.current) {\n return;\n }\n cancelQueuedFocusRef.current?.();\n cancelQueuedFocusRef.current = null;\n indexRef.current = -1;\n onNavigate(event);\n if (!virtual) {\n const floatingFocusEl = floatingFocusElementRef.current;\n const activeEl = activeElement(ownerDocument(floatingFocusEl));\n if (floatingFocusEl && contains(floatingFocusEl, activeEl)) {\n floatingFocusEl.focus({\n preventScroll: true\n });\n }\n }\n }\n };\n return itemProps;\n }, [syncCurrentTarget, latestOpenRef, floatingFocusElementRef, focusItemOnHover, listRef, onNavigate, resetOnPointerLeaveRef, virtual]);\n const ariaActiveDescendantProp = React.useMemo(() => {\n return virtual && open && hasActiveIndex && {\n 'aria-activedescendant': `${id}-${activeIndex}`\n };\n }, [virtual, open, hasActiveIndex, id, activeIndex]);\n const floating = React.useMemo(() => {\n return {\n 'aria-orientation': orientation === 'both' ? undefined : orientation,\n ...(!typeableComboboxReference ? ariaActiveDescendantProp : {}),\n onKeyDown(event) {\n // Close submenu on Shift+Tab\n if (event.key === 'Tab' && event.shiftKey && open && !virtual) {\n // If the event originated from within a nested element (e.g., a Dialog opened from\n // within the menu), don't close the menu. The nested element has its own focus\n // management and should handle the Tab key.\n const target = getTarget(event.nativeEvent);\n if (target && !contains(floatingFocusElementRef.current, target)) {\n return;\n }\n stopEvent(event);\n store.setOpen(false, createChangeEventDetails(REASONS.focusOut, event.nativeEvent));\n if (isHTMLElement(domReferenceElement)) {\n domReferenceElement.focus();\n }\n return;\n }\n commonOnKeyDown(event);\n },\n onPointerMove() {\n isPointerModalityRef.current = true;\n }\n };\n }, [ariaActiveDescendantProp, commonOnKeyDown, floatingFocusElementRef, orientation, typeableComboboxReference, store, open, virtual, domReferenceElement]);\n const trigger = React.useMemo(() => {\n function openOnNavigationKeyDown(event) {\n store.setOpen(true, createChangeEventDetails(REASONS.listNavigation, event.nativeEvent, event.currentTarget));\n }\n function checkVirtualMouse(event) {\n if (focusItemOnOpen === 'auto' && isVirtualClick(event.nativeEvent)) {\n focusItemOnOpenRef.current = !virtual;\n }\n }\n function checkVirtualPointer(event) {\n // `pointerdown` fires first, reset the state then perform the checks.\n focusItemOnOpenRef.current = focusItemOnOpen;\n if (focusItemOnOpen === 'auto' && isVirtualPointerEvent(event.nativeEvent)) {\n focusItemOnOpenRef.current = true;\n }\n }\n return {\n onKeyDown(event) {\n // non-reactive open state (to prevent re-creation of the handler)\n const currentOpen = store.select('open');\n isPointerModalityRef.current = false;\n const isArrowKey = event.key.startsWith('Arrow');\n const isParentCrossOpenKey = isCrossOrientationOpenKey(event.key, getParentOrientation(), rtl);\n const isMainKey = isMainOrientationKey(event.key, orientation);\n const isNavigationKey = (nested ? isParentCrossOpenKey : isMainKey) || event.key === 'Enter' || event.key.trim() === '';\n if (virtual && currentOpen) {\n return commonOnKeyDown(event);\n }\n\n // If a floating element should not open on arrow key down, avoid\n // setting `activeIndex` while it's closed.\n if (!currentOpen && !openOnArrowKeyDown && isArrowKey) {\n return undefined;\n }\n if (isNavigationKey) {\n const isParentMainKey = isMainOrientationKey(event.key, getParentOrientation());\n keyRef.current = nested && isParentMainKey ? null : event.key;\n }\n if (nested) {\n if (isParentCrossOpenKey) {\n stopEvent(event);\n if (currentOpen) {\n indexRef.current = getMinEnabledIndex();\n onNavigate(event);\n } else {\n openOnNavigationKeyDown(event);\n }\n }\n return undefined;\n }\n if (isMainKey) {\n if (selectedIndexRef.current != null) {\n indexRef.current = selectedIndexRef.current;\n }\n stopEvent(event);\n if (!currentOpen && openOnArrowKeyDown) {\n openOnNavigationKeyDown(event);\n } else {\n commonOnKeyDown(event);\n }\n if (currentOpen) {\n onNavigate(event);\n }\n }\n return undefined;\n },\n onFocus(event) {\n if (store.select('open') && !virtual) {\n indexRef.current = -1;\n onNavigate(event);\n }\n },\n onPointerDown: checkVirtualPointer,\n onPointerEnter: checkVirtualPointer,\n onMouseDown: checkVirtualMouse,\n onClick: checkVirtualMouse\n };\n }, [commonOnKeyDown, focusItemOnOpen, getMinEnabledIndex, nested, onNavigate, store, openOnArrowKeyDown, orientation, getParentOrientation, rtl, selectedIndexRef, virtual]);\n const reference = React.useMemo(() => {\n return {\n ...ariaActiveDescendantProp,\n ...trigger\n };\n }, [ariaActiveDescendantProp, trigger]);\n return React.useMemo(() => enabled ? {\n reference,\n floating,\n item,\n trigger\n } : {}, [enabled, reference, floating, trigger, item]);\n}"],"names":["ESCAPE","doSwitch","orientation","vertical","horizontal","isMainOrientationKey","key","ARROW_UP","ARROW_DOWN","ARROW_LEFT","ARROW_RIGHT","isMainOrientationToEndKey","rtl","isCrossOrientationOpenKey","isCrossOrientationCloseKey","grid","useListNavigation","context","props","listRef","activeIndex","onNavigateProp","enabled","selectedIndex","allowEscape","loopFocus","nested","virtual","focusItemOnOpen","focusItemOnHover","openOnArrowKeyDown","disabledIndices","parentOrientation","id","resetOnPointerLeave","externalTree","navigateGrid","isGrid","store","open","floatingElement","domReferenceElement","dataRef","floatingFocusElement","getFloatingFocusElement","typeableComboboxReference","isTypeableCombobox","floatingFocusElementRef","useValueAsRef","parentId","useFloatingParentNodeId","tree","useFloatingTree","focusItemOnOpenRef","React","indexRef","keyRef","isPointerModalityRef","onNavigate","useStableCallback","event","previousMountedRef","previousOpenRef","forceSyncFocusRef","forceScrollIntoViewRef","cancelQueuedFocusRef","disabledIndicesRef","latestOpenRef","selectedIndexRef","resetOnPointerLeaveRef","focusFrame","useAnimationFrame","waitForListPopulatedFrame","focusItem","runFocus","item","enqueueFocus","initialItem","forceScrollIntoView","callback","waitedItem","useIsoLayoutEffect","runs","waitForListPopulated","getMinListIndex","getMaxListIndex","isIndexOutOfListBounds","nodes","parent","node","activeEl","activeElement","ownerDocument","treeContainsActiveEl","contains","hasActiveIndex","syncCurrentTarget","index","getParentOrientation","getMinEnabledIndex","commonOnKeyDown","stopEvent","createChangeEventDetails","REASONS.listNavigation","isHTMLElement","currentIndex","minIndex","maxIndex","findNonDisabledListIndex","currentTarget","relatedTarget","floatingFocusEl","ariaActiveDescendantProp","floating","target","getTarget","REASONS.focusOut","trigger","openOnNavigationKeyDown","checkVirtualMouse","isVirtualClick","checkVirtualPointer","isVirtualPointerEvent","currentOpen","isArrowKey","isParentCrossOpenKey","isMainKey","isNavigationKey","isParentMainKey","reference"],"mappings":";;;;;;;;;;;;;;;;AAiBY,MAACA,KAAS;AACtB,SAASC,EAASC,GAAaC,GAAUC,GAAY;AACnD,UAAQF,GAAW;AAAA,IACjB,KAAK;AACH,aAAOC;AAAA,IACT,KAAK;AACH,aAAOC;AAAA,IACT;AACE,aAAOD,KAAYC;AAAA,EACzB;AACA;AACA,SAASC,EAAqBC,GAAKJ,GAAa;AAG9C,SAAOD,EAASC,GAFCI,MAAQC,MAAYD,MAAQE,IAC1BF,MAAQG,KAAcH,MAAQI,CACA;AACnD;AACA,SAASC,GAA0BL,GAAKJ,GAAaU,GAAK;AAGxD,SAAOX,EAASC,GAFCI,MAAQE,IACNI,IAAMN,MAAQG,IAAaH,MAAQI,CACL,KAAKJ,MAAQ,WAAWA,MAAQ,OAAOA,MAAQ;AAClG;AACA,SAASO,GAA0BP,GAAKJ,GAAaU,GAAK;AAGxD,SAAOX,EAASC,GAFCU,IAAMN,MAAQG,IAAaH,MAAQI,GACjCJ,MAAQE,EACsB;AACnD;AACA,SAASM,GAA2BR,GAAKJ,GAAaU,GAAKG,GAAM;AAC/D,QAAMZ,IAAWS,IAAMN,MAAQI,IAAcJ,MAAQG,GAC/CL,IAAaE,MAAQC;AAC3B,SAAIL,MAAgB,UAAUA,MAAgB,gBAAgBa,IACrDT,MAAQN,KAEVC,EAASC,GAAaC,GAAUC,CAAU;AACnD;AAMO,SAASY,GAAkBC,GAASC,GAAO;AAChD,QAAM;AAAA,IACJ,SAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAYC,IAAiB,MAAM;AAAA,IAAC;AAAA,IACpC,SAAAC,IAAU;AAAA,IACV,eAAAC,IAAgB;AAAA,IAChB,aAAAC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
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import * as a from "react";
|
|
2
|
+
import { useIsoLayoutEffect as L } from "./index273.js";
|
|
3
|
+
import { useStableCallback as M } from "./index264.js";
|
|
4
|
+
import { useTimeout as N } from "./index307.js";
|
|
5
|
+
import { EMPTY_ARRAY as W } from "./index258.js";
|
|
6
|
+
import { isListIndexDisabled as _, isElementVisible as j } from "./index369.js";
|
|
7
|
+
import { contains as T } from "./index313.js";
|
|
8
|
+
import { stopEvent as K } from "./index334.js";
|
|
9
|
+
function ee(h, A) {
|
|
9
10
|
const {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
11
|
+
listRef: D,
|
|
12
|
+
elementsRef: F,
|
|
13
|
+
activeIndex: u,
|
|
14
|
+
onMatch: P,
|
|
15
|
+
disabledIndices: S,
|
|
16
|
+
onTyping: o,
|
|
17
|
+
enabled: b = !0,
|
|
18
|
+
resetMs: O = 750,
|
|
19
|
+
selectedIndex: n = null
|
|
20
|
+
} = A, y = "rootStore" in h ? h.rootStore : h, i = y.useState("open"), m = N(), t = a.useRef(""), c = a.useRef(n ?? u ?? -1), l = a.useRef(null), k = M((r) => {
|
|
21
|
+
function d(e) {
|
|
22
|
+
const s = F?.current[e];
|
|
23
|
+
return !s || j(s);
|
|
24
|
+
}
|
|
25
|
+
function p(e) {
|
|
26
|
+
return d(e) ? S == null || !_(W, e, S) : !1;
|
|
27
|
+
}
|
|
28
|
+
function g(e, s, Y = 0) {
|
|
29
|
+
if (e.length === 0)
|
|
30
|
+
return -1;
|
|
31
|
+
const z = (Y % e.length + e.length) % e.length, B = s.toLowerCase();
|
|
32
|
+
for (let w = 0; w < e.length; w += 1) {
|
|
33
|
+
const x = (z + w) % e.length;
|
|
34
|
+
if (!(!e[x]?.toLowerCase().startsWith(B) || !p(x)))
|
|
35
|
+
return x;
|
|
36
|
+
}
|
|
37
|
+
return -1;
|
|
38
|
+
}
|
|
39
|
+
const f = D.current;
|
|
40
|
+
if (t.current.length > 0 && r.key === " " && (K(r), o?.(!0)), t.current.length > 0 && t.current[0] !== " " && g(f, t.current) === -1 && r.key !== " " && o?.(!1), f == null || // Character key.
|
|
41
|
+
r.key.length !== 1 || // Modifier key.
|
|
42
|
+
r.ctrlKey || r.metaKey || r.altKey)
|
|
43
|
+
return;
|
|
44
|
+
i && r.key !== " " && (K(r), o?.(!0));
|
|
45
|
+
const E = t.current === "";
|
|
46
|
+
E && (c.current = n ?? u ?? -1), f.every((e, s) => e && p(s) ? e[0]?.toLowerCase() !== e[1]?.toLowerCase() : !0) && t.current === r.key && (t.current = "", c.current = l.current), t.current += r.key, m.start(O, () => {
|
|
47
|
+
t.current = "", c.current = l.current, o?.(!1);
|
|
48
|
+
});
|
|
49
|
+
const V = ((E ? n ?? u ?? -1 : c.current) ?? 0) + 1, I = g(f, t.current, V);
|
|
50
|
+
I !== -1 ? (P?.(I), l.current = I) : r.key !== " " && (t.current = "", o?.(!1));
|
|
51
|
+
}), C = M((r) => {
|
|
52
|
+
const d = r.relatedTarget, p = y.select("domReferenceElement"), g = y.select("floatingElement");
|
|
53
|
+
T(p, d) || T(g, d) || (m.clear(), t.current = "", c.current = l.current, o?.(!1));
|
|
54
|
+
});
|
|
55
|
+
L(() => {
|
|
56
|
+
!i && n !== null || (m.clear(), l.current = null, t.current !== "" && (t.current = ""));
|
|
57
|
+
}, [i, n, m]), L(() => {
|
|
58
|
+
i && t.current === "" && (c.current = n ?? u ?? -1);
|
|
59
|
+
}, [i, n, u]);
|
|
60
|
+
const R = a.useMemo(() => ({
|
|
61
|
+
onKeyDown: k,
|
|
62
|
+
onBlur: C
|
|
63
|
+
}), [k, C]);
|
|
64
|
+
return a.useMemo(() => b ? {
|
|
65
|
+
reference: R,
|
|
66
|
+
floating: R
|
|
67
|
+
} : {}, [b, R]);
|
|
36
68
|
}
|
|
37
69
|
export {
|
|
38
|
-
|
|
70
|
+
ee as useTypeahead
|
|
39
71
|
};
|
|
40
72
|
//# sourceMappingURL=index304.js.map
|
package/dist/index304.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index304.js","sources":["../node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs"],"sourcesContent":["'use client';\n\nimport { isElement } from '@floating-ui/utils/dom';\nimport { useId } from '@base-ui/utils/useId';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { PopupTriggerMap } from \"../../utils/popups/index.mjs\";\nimport { useFloatingParentNodeId } from \"../components/FloatingTree.mjs\";\nimport { FloatingRootStore } from \"../components/FloatingRootStore.mjs\";\nexport function useFloatingRootContext(options) {\n const {\n open = false,\n onOpenChange,\n elements = {}\n } = options;\n const floatingId = useId();\n const nested = useFloatingParentNodeId() != null;\n if (process.env.NODE_ENV !== 'production') {\n const optionDomReference = elements.reference;\n if (optionDomReference && !isElement(optionDomReference)) {\n console.error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `context.setPositionReference()`', 'instead.');\n }\n }\n const store = useRefWithInit(() => new FloatingRootStore({\n open,\n transitionStatus: undefined,\n onOpenChange,\n referenceElement: elements.reference ?? null,\n floatingElement: elements.floating ?? null,\n triggerElements: new PopupTriggerMap(),\n floatingId,\n syncOnly: false,\n nested\n })).current;\n useIsoLayoutEffect(() => {\n const valuesToSync = {\n open,\n floatingId\n };\n\n // Only sync elements that are defined to avoid overwriting existing ones\n if (elements.reference !== undefined) {\n valuesToSync.referenceElement = elements.reference;\n valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null;\n }\n if (elements.floating !== undefined) {\n valuesToSync.floatingElement = elements.floating;\n }\n store.update(valuesToSync);\n }, [open, floatingId, elements.reference, elements.floating, store]);\n store.context.onOpenChange = onOpenChange;\n store.context.nested = nested;\n return store;\n}"],"names":["useFloatingRootContext","options","open","onOpenChange","elements","floatingId","useId","nested","useFloatingParentNodeId","optionDomReference","isElement","store","useRefWithInit","FloatingRootStore","PopupTriggerMap","useIsoLayoutEffect","valuesToSync"],"mappings":";;;;;;;AASO,SAASA,EAAuBC,GAAS;AAC9C,QAAM;AAAA,IACJ,MAAAC,IAAO;AAAA,IACP,cAAAC;AAAA,IACA,UAAAC,IAAW,CAAA;AAAA,EACf,IAAMH,GACEI,IAAaC,EAAK,GAClBC,IAASC,EAAuB,KAAM;AAC5C,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,UAAMC,IAAqBL,EAAS;AACpC,IAAIK,KAAsB,CAACC,EAAUD,CAAkB,KACrD,QAAQ,MAAM,qEAAqE,0EAA0E,UAAU;AAAA,EAE3K;AACA,QAAME,IAAQC,EAAe,MAAM,IAAIC,EAAkB;AAAA,IACvD,MAAAX;AAAA,IACA,kBAAkB;AAAA,IAClB,cAAAC;AAAA,IACA,kBAAkBC,EAAS,aAAa;AAAA,IACxC,iBAAiBA,EAAS,YAAY;AAAA,IACtC,iBAAiB,IAAIU,EAAe;AAAA,IACpC,YAAAT;AAAA,IACA,UAAU;AAAA,IACV,QAAAE;AAAA,EACJ,CAAG,CAAC,EAAE;AACJ,SAAAQ,EAAmB,MAAM;AACvB,UAAMC,IAAe;AAAA,MACnB,MAAAd;AAAA,MACA,YAAAG;AAAA,IACN;AAGI,IAAID,EAAS,cAAc,WACzBY,EAAa,mBAAmBZ,EAAS,WACzCY,EAAa,sBAAsBN,EAAUN,EAAS,SAAS,IAAIA,EAAS,YAAY,OAEtFA,EAAS,aAAa,WACxBY,EAAa,kBAAkBZ,EAAS,WAE1CO,EAAM,OAAOK,CAAY;AAAA,EAC3B,GAAG,CAACd,GAAMG,GAAYD,EAAS,WAAWA,EAAS,UAAUO,CAAK,CAAC,GACnEA,EAAM,QAAQ,eAAeR,GAC7BQ,EAAM,QAAQ,SAASJ,GAChBI;AACT;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index304.js","sources":["../../../node_modules/@base-ui/react/floating-ui-react/hooks/useTypeahead.mjs"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { EMPTY_ARRAY } from '@base-ui/utils/empty';\nimport { isElementVisible, isListIndexDisabled } from \"../utils/composite.mjs\";\nimport { contains } from \"../utils/element.mjs\";\nimport { stopEvent } from \"../utils/event.mjs\";\n/**\n * Provides a matching callback that can be used to focus an item as the user\n * types, often used in tandem with `useListNavigation()`.\n * @see https://floating-ui.com/docs/useTypeahead\n */\nexport function useTypeahead(context, props) {\n const {\n listRef,\n elementsRef,\n activeIndex,\n onMatch: onMatchProp,\n disabledIndices,\n onTyping,\n enabled = true,\n resetMs = 750,\n selectedIndex = null\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const timeout = useTimeout();\n const stringRef = React.useRef('');\n const prevIndexRef = React.useRef(selectedIndex ?? activeIndex ?? -1);\n const matchIndexRef = React.useRef(null);\n const onKeyDown = useStableCallback(event => {\n function isVisible(index) {\n const element = elementsRef?.current[index];\n return !element || isElementVisible(element);\n }\n function isItemAvailable(index) {\n if (!isVisible(index)) {\n return false;\n }\n // Visibility is handled above; pass an empty element list so `isListIndexDisabled`\n // resolves only the explicit `disabledIndices` (array/predicate) and skips its own\n // visibility/attribute fallbacks. Consumers that don't opt in keep matching every\n // visible item.\n return disabledIndices == null || !isListIndexDisabled(EMPTY_ARRAY, index, disabledIndices);\n }\n function getMatchingIndex(list, string, startIndex = 0) {\n if (list.length === 0) {\n return -1;\n }\n const normalizedStartIndex = (startIndex % list.length + list.length) % list.length;\n const lowerString = string.toLowerCase();\n for (let offset = 0; offset < list.length; offset += 1) {\n const index = (normalizedStartIndex + offset) % list.length;\n const text = list[index];\n if (!text?.toLowerCase().startsWith(lowerString) || !isItemAvailable(index)) {\n continue;\n }\n return index;\n }\n return -1;\n }\n const listContent = listRef.current;\n if (stringRef.current.length > 0 && event.key === ' ') {\n // Space should continue the in-progress typeahead session.\n stopEvent(event);\n onTyping?.(true);\n }\n if (stringRef.current.length > 0 && stringRef.current[0] !== ' ') {\n if (getMatchingIndex(listContent, stringRef.current) === -1 && event.key !== ' ') {\n onTyping?.(false);\n }\n }\n if (listContent == null ||\n // Character key.\n event.key.length !== 1 ||\n // Modifier key.\n event.ctrlKey || event.metaKey || event.altKey) {\n return;\n }\n if (open && event.key !== ' ') {\n stopEvent(event);\n onTyping?.(true);\n }\n\n // Capture whether this is a new typing session before mutating the string.\n const isNewSession = stringRef.current === '';\n if (isNewSession) {\n prevIndexRef.current = selectedIndex ?? activeIndex ?? -1;\n }\n\n // Bail out if the list contains a word like \"llama\" or \"aaron\". TODO:\n // allow it in this case, too. Unavailable items are skipped while matching, so\n // they must be ignored here as well — otherwise a hidden or disabled double-letter\n // label would block rapid cycling through the available items.\n const allowRapidSuccessionOfFirstLetter = listContent.every((text, index) => text && isItemAvailable(index) ? text[0]?.toLowerCase() !== text[1]?.toLowerCase() : true);\n\n // Allows the user to cycle through items that start with the same letter\n // in rapid succession.\n if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) {\n stringRef.current = '';\n prevIndexRef.current = matchIndexRef.current;\n }\n stringRef.current += event.key;\n timeout.start(resetMs, () => {\n stringRef.current = '';\n prevIndexRef.current = matchIndexRef.current;\n onTyping?.(false);\n });\n\n // Compute the starting index for this search.\n // If this is a new typing session (string is empty), base it on the current\n // selection/active item; otherwise continue from the last matched index.\n const prevIndex = isNewSession ? selectedIndex ?? activeIndex ?? -1 : prevIndexRef.current;\n const startIndex = (prevIndex ?? 0) + 1;\n const index = getMatchingIndex(listContent, stringRef.current, startIndex);\n if (index !== -1) {\n onMatchProp?.(index);\n matchIndexRef.current = index;\n } else if (event.key !== ' ') {\n stringRef.current = '';\n onTyping?.(false);\n }\n });\n const onBlur = useStableCallback(event => {\n const next = event.relatedTarget;\n const currentDomReferenceElement = store.select('domReferenceElement');\n const currentFloatingElement = store.select('floatingElement');\n const withinComposite = contains(currentDomReferenceElement, next) || contains(currentFloatingElement, next);\n\n // Keep the session if focus moves within the composite (reference <-> floating).\n if (withinComposite) {\n return;\n }\n\n // End the current typing session when focus leaves the composite entirely.\n timeout.clear();\n stringRef.current = '';\n prevIndexRef.current = matchIndexRef.current;\n onTyping?.(false);\n });\n useIsoLayoutEffect(() => {\n if (!open && selectedIndex !== null) {\n return;\n }\n timeout.clear();\n matchIndexRef.current = null;\n if (stringRef.current !== '') {\n stringRef.current = '';\n }\n }, [open, selectedIndex, timeout]);\n useIsoLayoutEffect(() => {\n // Sync arrow key navigation but not typeahead navigation.\n if (open && stringRef.current === '') {\n prevIndexRef.current = selectedIndex ?? activeIndex ?? -1;\n }\n }, [open, selectedIndex, activeIndex]);\n const sharedProps = React.useMemo(() => ({\n onKeyDown,\n onBlur\n }), [onKeyDown, onBlur]);\n return React.useMemo(() => enabled ? {\n reference: sharedProps,\n floating: sharedProps\n } : {}, [enabled, sharedProps]);\n}"],"names":["useTypeahead","context","props","listRef","elementsRef","activeIndex","onMatchProp","disabledIndices","onTyping","enabled","resetMs","selectedIndex","store","open","timeout","useTimeout","stringRef","React","prevIndexRef","matchIndexRef","onKeyDown","useStableCallback","event","isVisible","index","element","isElementVisible","isItemAvailable","isListIndexDisabled","EMPTY_ARRAY","getMatchingIndex","list","string","startIndex","normalizedStartIndex","lowerString","offset","listContent","stopEvent","isNewSession","text","onBlur","next","currentDomReferenceEl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BhC,EAAM,OAAO,iBAAiB;AAI7D,IAHwBiC,EAASF,GAA4BD,CAAI,KAAKG,EAASD,GAAwBF,CAAI,MAQ3G5B,EAAQ,MAAK,GACbE,EAAU,UAAU,IACpBE,EAAa,UAAUC,EAAc,SACrCX,IAAW,EAAK;AAAA,EAClB,CAAC;AACD,EAAAsC,EAAmB,MAAM;AACvB,IAAI,CAACjC,KAAQF,MAAkB,SAG/BG,EAAQ,MAAK,GACbK,EAAc,UAAU,MACpBH,EAAU,YAAY,OACxBA,EAAU,UAAU;AAAA,EAExB,GAAG,CAACH,GAAMF,GAAeG,CAAO,CAAC,GACjCgC,EAAmB,MAAM;AAEvB,IAAIjC,KAAQG,EAAU,YAAY,OAChCE,EAAa,UAAUP,KAAiBN,KAAe;AAAA,EAE3D,GAAG,CAACQ,GAAMF,GAAeN,CAAW,CAAC;AACrC,QAAM0C,IAAc9B,EAAM,QAAQ,OAAO;AAAA,IACvC,WAAAG;AAAA,IACA,QAAAqB;AAAA,EACJ,IAAM,CAACrB,GAAWqB,CAAM,CAAC;AACvB,SAAOxB,EAAM,QAAQ,MAAMR,IAAU;AAAA,IACnC,WAAWsC;AAAA,IACX,UAAUA;AAAA,EACd,IAAM,IAAI,CAACtC,GAASsC,CAAW,CAAC;AAChC;","x_google_ignoreList":[0]}
|
package/dist/index305.js
CHANGED
|
@@ -1,243 +1,87 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
outsidePress: typeof f == "boolean" ? f : f?.outsidePress ?? !0
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function dt(f, he = {}) {
|
|
27
|
-
const {
|
|
28
|
-
enabled: m = !0,
|
|
29
|
-
escapeKey: v = !0,
|
|
30
|
-
outsidePress: I = !0,
|
|
31
|
-
outsidePressEvent: ge = "sloppy",
|
|
32
|
-
referencePress: ye = Ge,
|
|
33
|
-
bubbles: Pe,
|
|
34
|
-
externalTree: Ee
|
|
35
|
-
} = he, n = "rootStore" in f ? f.rootStore : f, C = n.useState("open"), ee = n.useState("floatingElement"), {
|
|
36
|
-
dataRef: h
|
|
37
|
-
} = n.context, S = Ne(Ee), Te = p(typeof I == "function" ? I : () => !1), y = typeof I == "function" ? Te : I, te = y !== !1, re = p(() => ge), {
|
|
38
|
-
escapeKey: K,
|
|
39
|
-
outsidePress: ne
|
|
40
|
-
} = Je(Pe), O = l.useRef(!1), X = l.useRef(!1), P = l.useRef(!1), A = l.useRef(!1), H = l.useRef(""), s = l.useRef(null), D = de(), se = de(), g = p(() => {
|
|
41
|
-
se.clear(), h.current.insideReactTree = !1;
|
|
42
|
-
}), N = p((r) => {
|
|
43
|
-
const a = h.current.floatingContext?.nodeId;
|
|
44
|
-
return (S ? me(S.nodesRef.current, a) : []).some((x) => x.context?.open && !x.context.dataRef.current[r]);
|
|
45
|
-
}), E = p((r) => Z(r, n.select("floatingElement")) || Z(r, n.select("domReferenceElement"))), L = p((r) => {
|
|
46
|
-
ye() && n.setOpen(!1, Q(qe, r.nativeEvent));
|
|
47
|
-
}), b = p((r) => {
|
|
48
|
-
if (!C || !m || !v || r.key !== "Escape" || A.current || !K && N("__escapeKeyBubbles"))
|
|
49
|
-
return;
|
|
50
|
-
const a = $e(r) ? r.nativeEvent : r, w = Q(Ve, a);
|
|
51
|
-
n.setOpen(!1, w), w.isCanceled || r.preventDefault(), !K && !w.isPropagationAllowed && r.stopPropagation();
|
|
52
|
-
}), T = p(() => {
|
|
53
|
-
h.current.insideReactTree = !0, se.start(0, g);
|
|
54
|
-
}), F = p((r) => {
|
|
55
|
-
if (!C || !m || r.button !== 0)
|
|
56
|
-
return;
|
|
57
|
-
const a = z(r.nativeEvent);
|
|
58
|
-
B(n.select("floatingElement"), a) && (O.current || (O.current = !0, X.current = !1));
|
|
59
|
-
}), $ = p((r) => {
|
|
60
|
-
!C || !m || (r.defaultPrevented || r.nativeEvent.defaultPrevented) && O.current && (X.current = !0);
|
|
1
|
+
import { useStore as r } from "./index300.js";
|
|
2
|
+
class n {
|
|
3
|
+
/**
|
|
4
|
+
* The current state of the store.
|
|
5
|
+
* This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.
|
|
6
|
+
* To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).
|
|
7
|
+
* The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
|
|
8
|
+
*
|
|
9
|
+
* Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
|
|
10
|
+
*/
|
|
11
|
+
// Internal state to handle recursive `setState()` calls
|
|
12
|
+
constructor(t) {
|
|
13
|
+
this.state = t, this.listeners = /* @__PURE__ */ new Set(), this.updateTick = 0;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Registers a listener that will be called whenever the store's state changes.
|
|
17
|
+
*
|
|
18
|
+
* @param fn The listener function to be called on state changes.
|
|
19
|
+
* @returns A function to unsubscribe the listener.
|
|
20
|
+
*/
|
|
21
|
+
subscribe = (t) => (this.listeners.add(t), () => {
|
|
22
|
+
this.listeners.delete(t);
|
|
61
23
|
});
|
|
62
|
-
|
|
63
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Returns the current state of the store.
|
|
26
|
+
*/
|
|
27
|
+
getSnapshot = () => this.state;
|
|
28
|
+
/**
|
|
29
|
+
* Updates the entire store's state and notifies all registered listeners.
|
|
30
|
+
*
|
|
31
|
+
* @param newState The new state to set for the store.
|
|
32
|
+
*/
|
|
33
|
+
setState(t) {
|
|
34
|
+
if (this.state === t)
|
|
64
35
|
return;
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
function x() {
|
|
71
|
-
r.start(
|
|
72
|
-
// 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
|
|
73
|
-
// Only apply to WebKit for the test to remain 0ms.
|
|
74
|
-
je ? 5 : 0,
|
|
75
|
-
() => {
|
|
76
|
-
A.current = !1;
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
function ce() {
|
|
81
|
-
P.current = !0, a.start(0, () => {
|
|
82
|
-
P.current = !1;
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function ie() {
|
|
86
|
-
O.current = !1, X.current = !1;
|
|
87
|
-
}
|
|
88
|
-
function R() {
|
|
89
|
-
const e = H.current, t = e === "pen" || !e ? "mouse" : e, o = re(), c = typeof o == "function" ? o() : o;
|
|
90
|
-
return typeof c == "string" ? c : c[t];
|
|
91
|
-
}
|
|
92
|
-
function Re(e) {
|
|
93
|
-
const t = R();
|
|
94
|
-
return t === "intentional" && e.type !== "click" || t === "sloppy" && e.type === "click";
|
|
95
|
-
}
|
|
96
|
-
function ue(e) {
|
|
97
|
-
const t = h.current.floatingContext?.nodeId, o = S && me(S.nodesRef.current, t).some((c) => Z(e, c.context?.elements.floating));
|
|
98
|
-
return E(e) || o;
|
|
99
|
-
}
|
|
100
|
-
function W(e) {
|
|
101
|
-
if (Re(e)) {
|
|
102
|
-
e.type !== "click" && !E(e) && (a.clear(), P.current = !1), g();
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
if (h.current.insideReactTree) {
|
|
106
|
-
g();
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
const t = z(e), o = `[${Le("inert")}]`, c = _(t) ? t.getRootNode() : null, k = Array.from((Be(c) ? c : fe(n.select("floatingElement"))).querySelectorAll(o)), ae = n.context.triggerElements;
|
|
110
|
-
if (t && (ae.hasElement(t) || ae.hasMatchingElement((d) => B(d, t))))
|
|
111
|
-
return;
|
|
112
|
-
let M = _(t) ? t : null;
|
|
113
|
-
for (; M && !J(M); ) {
|
|
114
|
-
const d = ve(M);
|
|
115
|
-
if (J(d) || !_(d))
|
|
116
|
-
break;
|
|
117
|
-
M = d;
|
|
118
|
-
}
|
|
119
|
-
if (!(k.length && _(t) && !Fe(t) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
|
|
120
|
-
!B(t, n.select("floatingElement")) && // If the target root element contains none of the markers, then the
|
|
121
|
-
// element was injected after the floating element rendered.
|
|
122
|
-
k.every((d) => !B(M, d)))) {
|
|
123
|
-
if (Ae(t) && !("touches" in e)) {
|
|
124
|
-
const d = J(t), j = He(t), le = /auto|scroll/, Ie = d || le.test(j.overflowX), Ke = d || le.test(j.overflowY), Xe = Ie && t.clientWidth > 0 && t.scrollWidth > t.clientWidth, xe = Ke && t.clientHeight > 0 && t.scrollHeight > t.clientHeight, We = j.direction === "rtl", Ye = xe && (We ? e.offsetX <= t.offsetWidth - t.clientWidth : e.offsetX > t.clientWidth), _e = Xe && e.offsetY > t.clientHeight;
|
|
125
|
-
if (Ye || _e)
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
if (!ue(e)) {
|
|
129
|
-
if (R() === "intentional" && P.current) {
|
|
130
|
-
a.clear(), P.current = !1;
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
typeof y == "function" && !y(e) || N("__outsidePressBubbles") || (n.setOpen(!1, Q(Ue, e)), g());
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
function be(e) {
|
|
138
|
-
R() !== "sloppy" || e.pointerType === "touch" || !n.select("open") || !m || E(e) || W(e);
|
|
139
|
-
}
|
|
140
|
-
function we(e) {
|
|
141
|
-
if (R() !== "sloppy" || !n.select("open") || !m || E(e))
|
|
36
|
+
this.state = t, this.updateTick += 1;
|
|
37
|
+
const s = this.updateTick;
|
|
38
|
+
for (const e of this.listeners) {
|
|
39
|
+
if (s !== this.updateTick)
|
|
142
40
|
return;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const c = i(o, e.type, () => {
|
|
159
|
-
t(e), c();
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
function Ce(e) {
|
|
163
|
-
H.current = "touch", Y(e, we);
|
|
164
|
-
}
|
|
165
|
-
function V(e) {
|
|
166
|
-
D.clear(), e.type === "pointerdown" && (H.current = e.pointerType), !(e.type === "mousedown" && s.current && !s.current.dismissOnMouseDown) && Y(e, (t) => {
|
|
167
|
-
t.type === "pointerdown" ? be(t) : W(t);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
function U(e) {
|
|
171
|
-
if (!O.current)
|
|
41
|
+
e(t);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Merges the provided changes into the current state and notifies listeners if there are changes.
|
|
46
|
+
*
|
|
47
|
+
* @param changes An object containing the changes to apply to the current state.
|
|
48
|
+
*/
|
|
49
|
+
update(t) {
|
|
50
|
+
for (const s in t)
|
|
51
|
+
if (!Object.is(this.state[s], t[s])) {
|
|
52
|
+
this.setState({
|
|
53
|
+
...this.state,
|
|
54
|
+
...t
|
|
55
|
+
});
|
|
172
56
|
return;
|
|
173
|
-
const t = X.current;
|
|
174
|
-
if (ie(), R() === "intentional") {
|
|
175
|
-
if (e.type === "pointercancel") {
|
|
176
|
-
t && ce();
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
if (!ue(e)) {
|
|
180
|
-
if (t) {
|
|
181
|
-
ce();
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
typeof y == "function" && !y(e) || (a.clear(), P.current = !0, g());
|
|
185
|
-
}
|
|
186
57
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
const u = fe(ee), Me = G(v && G(i(u, "keydown", b), i(u, "compositionstart", w), i(u, "compositionend", x)), te && G(i(u, "click", V, !0), i(u, "pointerdown", V, !0), i(u, "pointerup", U, !0), i(u, "pointercancel", U, !0), i(u, "mousedown", V, !0), i(u, "mouseup", U, !0), i(u, "touchstart", Ce, !0), i(u, "touchmove", Oe, !0), i(u, "touchend", ke, !0)));
|
|
207
|
-
return () => {
|
|
208
|
-
Me(), r.clear(), a.clear(), ie(), P.current = !1;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
|
|
61
|
+
*
|
|
62
|
+
* @param key The key in the store's state to update.
|
|
63
|
+
* @param value The new value to set for the specified key.
|
|
64
|
+
*/
|
|
65
|
+
set(t, s) {
|
|
66
|
+
Object.is(this.state[t], s) || this.setState({
|
|
67
|
+
...this.state,
|
|
68
|
+
[t]: s
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gives the state a new reference and updates all registered listeners.
|
|
73
|
+
*/
|
|
74
|
+
notifyAll() {
|
|
75
|
+
const t = {
|
|
76
|
+
...this.state
|
|
209
77
|
};
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}), [b, L]), oe = l.useMemo(() => ({
|
|
216
|
-
onKeyDown: b,
|
|
217
|
-
// `onMouseDown` may be blocked if `event.preventDefault()` is called in
|
|
218
|
-
// `onPointerDown`, such as with <NumberField.ScrubArea>.
|
|
219
|
-
// See https://github.com/mui/base-ui/pull/3379
|
|
220
|
-
onPointerDown: $,
|
|
221
|
-
onMouseDown: $,
|
|
222
|
-
onClickCapture: T,
|
|
223
|
-
onMouseDownCapture(r) {
|
|
224
|
-
T(), F(r);
|
|
225
|
-
},
|
|
226
|
-
onPointerDownCapture(r) {
|
|
227
|
-
T(), F(r);
|
|
228
|
-
},
|
|
229
|
-
onMouseUpCapture: T,
|
|
230
|
-
onTouchEndCapture: T,
|
|
231
|
-
onTouchMoveCapture: T
|
|
232
|
-
}), [b, T, F, $]);
|
|
233
|
-
return l.useMemo(() => m ? {
|
|
234
|
-
reference: q,
|
|
235
|
-
floating: oe,
|
|
236
|
-
trigger: q
|
|
237
|
-
} : {}, [m, q, oe]);
|
|
78
|
+
this.setState(t);
|
|
79
|
+
}
|
|
80
|
+
use(t, s, e, i) {
|
|
81
|
+
return r(this, t, s, e, i);
|
|
82
|
+
}
|
|
238
83
|
}
|
|
239
84
|
export {
|
|
240
|
-
|
|
241
|
-
dt as useDismiss
|
|
85
|
+
n as Store
|
|
242
86
|
};
|
|
243
87
|
//# sourceMappingURL=index305.js.map
|