@rpcbase/ui 0.183.0 → 0.184.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 (632) hide show
  1. package/dist/index10.js +25 -24
  2. package/dist/index10.js.map +1 -1
  3. package/dist/index100.js +5 -5
  4. package/dist/index100.js.map +1 -1
  5. package/dist/index101.js +5 -4
  6. package/dist/index101.js.map +1 -1
  7. package/dist/index102.js +4 -4
  8. package/dist/index102.js.map +1 -1
  9. package/dist/index103.js +4 -6
  10. package/dist/index103.js.map +1 -1
  11. package/dist/index104.js +6 -145
  12. package/dist/index104.js.map +1 -1
  13. package/dist/index105.js +24 -39
  14. package/dist/index105.js.map +1 -1
  15. package/dist/index106.js +6 -4
  16. package/dist/index106.js.map +1 -1
  17. package/dist/index107.js +4 -7
  18. package/dist/index107.js.map +1 -1
  19. package/dist/index108.js +6 -13
  20. package/dist/index108.js.map +1 -1
  21. package/dist/index109.js +5 -13
  22. package/dist/index109.js.map +1 -1
  23. package/dist/index11.js +34 -66
  24. package/dist/index11.js.map +1 -1
  25. package/dist/index110.js +4 -7
  26. package/dist/index110.js.map +1 -1
  27. package/dist/index111.js +5 -31
  28. package/dist/index111.js.map +1 -1
  29. package/dist/index112.js +4 -10
  30. package/dist/index112.js.map +1 -1
  31. package/dist/index113.js +8 -10
  32. package/dist/index113.js.map +1 -1
  33. package/dist/index114.js +5 -8
  34. package/dist/index114.js.map +1 -1
  35. package/dist/index115.js +4 -13
  36. package/dist/index115.js.map +1 -1
  37. package/dist/index116.js +4 -101
  38. package/dist/index116.js.map +1 -1
  39. package/dist/index117.js +7 -20
  40. package/dist/index117.js.map +1 -1
  41. package/dist/index118.js +145 -53
  42. package/dist/index118.js.map +1 -1
  43. package/dist/index119.js +36 -69
  44. package/dist/index119.js.map +1 -1
  45. package/dist/index12.js +556 -525
  46. package/dist/index12.js.map +1 -1
  47. package/dist/index120.js +4 -9
  48. package/dist/index120.js.map +1 -1
  49. package/dist/index121.js +5 -18
  50. package/dist/index121.js.map +1 -1
  51. package/dist/index122.js +13 -16
  52. package/dist/index122.js.map +1 -1
  53. package/dist/index123.js +13 -23
  54. package/dist/index123.js.map +1 -1
  55. package/dist/index124.js +7 -6
  56. package/dist/index124.js.map +1 -1
  57. package/dist/index125.js +31 -5
  58. package/dist/index125.js.map +1 -1
  59. package/dist/index126.js +10 -23
  60. package/dist/index126.js.map +1 -1
  61. package/dist/index127.js +11 -35
  62. package/dist/index127.js.map +1 -1
  63. package/dist/index128.js +9 -16
  64. package/dist/index128.js.map +1 -1
  65. package/dist/index129.js +13 -6
  66. package/dist/index129.js.map +1 -1
  67. package/dist/index13.js +128 -118
  68. package/dist/index13.js.map +1 -1
  69. package/dist/index130.js +101 -4
  70. package/dist/index130.js.map +1 -1
  71. package/dist/index131.js +20 -5
  72. package/dist/index131.js.map +1 -1
  73. package/dist/index132.js +53 -4
  74. package/dist/index132.js.map +1 -1
  75. package/dist/index133.js +72 -4
  76. package/dist/index133.js.map +1 -1
  77. package/dist/index134.js +9 -3
  78. package/dist/index134.js.map +1 -1
  79. package/dist/index135.js +20 -6
  80. package/dist/index135.js.map +1 -1
  81. package/dist/index136.js +17 -24
  82. package/dist/index136.js.map +1 -1
  83. package/dist/index137.js +23 -7
  84. package/dist/index137.js.map +1 -1
  85. package/dist/index138.js +6 -6
  86. package/dist/index138.js.map +1 -1
  87. package/dist/index139.js +5 -5
  88. package/dist/index139.js.map +1 -1
  89. package/dist/index14.js +74 -74
  90. package/dist/index14.js.map +1 -1
  91. package/dist/index140.js +23 -3
  92. package/dist/index140.js.map +1 -1
  93. package/dist/index141.js +35 -4
  94. package/dist/index141.js.map +1 -1
  95. package/dist/index142.js +16 -5
  96. package/dist/index142.js.map +1 -1
  97. package/dist/index143.js +6 -3
  98. package/dist/index143.js.map +1 -1
  99. package/dist/index144.js +4 -4
  100. package/dist/index144.js.map +1 -1
  101. package/dist/index145.js +4 -3
  102. package/dist/index145.js.map +1 -1
  103. package/dist/index146.js +4 -3
  104. package/dist/index146.js.map +1 -1
  105. package/dist/index147.js +4 -3
  106. package/dist/index147.js.map +1 -1
  107. package/dist/index148.js +3 -46
  108. package/dist/index148.js.map +1 -1
  109. package/dist/index149.js +6 -205
  110. package/dist/index149.js.map +1 -1
  111. package/dist/index15.js +763 -624
  112. package/dist/index15.js.map +1 -1
  113. package/dist/index150.js +24 -22
  114. package/dist/index150.js.map +1 -1
  115. package/dist/index151.js +7 -24
  116. package/dist/index151.js.map +1 -1
  117. package/dist/index152.js +6 -399
  118. package/dist/index152.js.map +1 -1
  119. package/dist/index153.js +5 -46
  120. package/dist/index153.js.map +1 -1
  121. package/dist/index154.js +3 -605
  122. package/dist/index154.js.map +1 -1
  123. package/dist/index155.js +3 -5
  124. package/dist/index155.js.map +1 -1
  125. package/dist/index156.js +3 -67
  126. package/dist/index156.js.map +1 -1
  127. package/dist/index157.js +4 -2
  128. package/dist/index157.js.map +1 -1
  129. package/dist/index158.js +4 -363
  130. package/dist/index158.js.map +1 -1
  131. package/dist/index159.js +3 -261
  132. package/dist/index159.js.map +1 -1
  133. package/dist/index16.js +20 -22
  134. package/dist/index16.js.map +1 -1
  135. package/dist/index160.js +3 -60
  136. package/dist/index160.js.map +1 -1
  137. package/dist/index161.js +3 -46
  138. package/dist/index161.js.map +1 -1
  139. package/dist/index162.js +5 -169
  140. package/dist/index162.js.map +1 -1
  141. package/dist/index163.js +61 -102
  142. package/dist/index163.js.map +1 -1
  143. package/dist/index164.js +2 -25
  144. package/dist/index164.js.map +1 -1
  145. package/dist/index165.js +364 -8
  146. package/dist/index165.js.map +1 -1
  147. package/dist/index166.js +261 -4
  148. package/dist/index166.js.map +1 -1
  149. package/dist/index167.js +60 -5
  150. package/dist/index167.js.map +1 -1
  151. package/dist/index168.js +46 -4
  152. package/dist/index168.js.map +1 -1
  153. package/dist/index169.js +153 -450
  154. package/dist/index169.js.map +1 -1
  155. package/dist/index17.js +17 -17
  156. package/dist/index17.js.map +1 -1
  157. package/dist/index170.js +102 -178
  158. package/dist/index170.js.map +1 -1
  159. package/dist/index171.js +24 -107
  160. package/dist/index171.js.map +1 -1
  161. package/dist/index172.js +8 -263
  162. package/dist/index172.js.map +1 -1
  163. package/dist/index173.js +4 -9
  164. package/dist/index173.js.map +1 -1
  165. package/dist/index174.js +5 -42
  166. package/dist/index174.js.map +1 -1
  167. package/dist/index175.js +3 -3
  168. package/dist/index175.js.map +1 -1
  169. package/dist/index176.js +459 -51
  170. package/dist/index176.js.map +1 -1
  171. package/dist/index177.js +185 -8
  172. package/dist/index177.js.map +1 -1
  173. package/dist/index178.js +102 -61
  174. package/dist/index178.js.map +1 -1
  175. package/dist/index179.js +260 -17
  176. package/dist/index179.js.map +1 -1
  177. package/dist/index18.js +411 -341
  178. package/dist/index18.js.map +1 -1
  179. package/dist/index180.js +9 -16
  180. package/dist/index180.js.map +1 -1
  181. package/dist/index181.js +41 -4
  182. package/dist/index181.js.map +1 -1
  183. package/dist/index182.js +4 -5
  184. package/dist/index182.js.map +1 -1
  185. package/dist/index183.js +24 -6
  186. package/dist/index183.js.map +1 -1
  187. package/dist/index184.js +29 -5
  188. package/dist/index184.js.map +1 -1
  189. package/dist/index185.js +5 -8
  190. package/dist/index185.js.map +1 -1
  191. package/dist/index186.js +67 -17
  192. package/dist/index186.js.map +1 -1
  193. package/dist/index187.js +180 -5
  194. package/dist/index187.js.map +1 -1
  195. package/dist/index188.js +46 -5
  196. package/dist/index188.js.map +1 -1
  197. package/dist/index189.js +58 -13
  198. package/dist/index189.js.map +1 -1
  199. package/dist/index19.js +626 -660
  200. package/dist/index19.js.map +1 -1
  201. package/dist/index190.js +8 -10
  202. package/dist/index190.js.map +1 -1
  203. package/dist/index191.js +66 -14
  204. package/dist/index191.js.map +1 -1
  205. package/dist/index192.js +19 -14
  206. package/dist/index192.js.map +1 -1
  207. package/dist/index193.js +16 -5
  208. package/dist/index193.js.map +1 -1
  209. package/dist/index194.js +5 -6
  210. package/dist/index194.js.map +1 -1
  211. package/dist/index195.js +5 -7
  212. package/dist/index195.js.map +1 -1
  213. package/dist/index196.js +6 -6
  214. package/dist/index196.js.map +1 -1
  215. package/dist/index197.js +4 -9
  216. package/dist/index197.js.map +1 -1
  217. package/dist/index198.js +7 -5
  218. package/dist/index198.js.map +1 -1
  219. package/dist/index199.js +17 -5
  220. package/dist/index199.js.map +1 -1
  221. package/dist/index20.js +442 -634
  222. package/dist/index20.js.map +1 -1
  223. package/dist/index200.js +5 -9
  224. package/dist/index200.js.map +1 -1
  225. package/dist/index201.js +5 -5
  226. package/dist/index201.js.map +1 -1
  227. package/dist/index202.js +13 -5
  228. package/dist/index202.js.map +1 -1
  229. package/dist/index203.js +10 -4
  230. package/dist/index203.js.map +1 -1
  231. package/dist/index204.js +14 -11
  232. package/dist/index204.js.map +1 -1
  233. package/dist/index205.js +14 -10
  234. package/dist/index205.js.map +1 -1
  235. package/dist/index206.js +5 -10
  236. package/dist/index206.js.map +1 -1
  237. package/dist/index207.js +6 -11
  238. package/dist/index207.js.map +1 -1
  239. package/dist/index208.js +7 -11
  240. package/dist/index208.js.map +1 -1
  241. package/dist/index209.js +6 -10
  242. package/dist/index209.js.map +1 -1
  243. package/dist/index21.js +254 -200
  244. package/dist/index21.js.map +1 -1
  245. package/dist/index210.js +9 -7
  246. package/dist/index210.js.map +1 -1
  247. package/dist/index211.js +5 -6
  248. package/dist/index211.js.map +1 -1
  249. package/dist/index212.js +5 -5
  250. package/dist/index212.js.map +1 -1
  251. package/dist/index213.js +9 -6
  252. package/dist/index213.js.map +1 -1
  253. package/dist/index214.js +5 -7
  254. package/dist/index214.js.map +1 -1
  255. package/dist/index215.js +5 -6
  256. package/dist/index215.js.map +1 -1
  257. package/dist/index216.js +4 -55
  258. package/dist/index216.js.map +1 -1
  259. package/dist/index217.js +11 -16
  260. package/dist/index217.js.map +1 -1
  261. package/dist/index218.js +10 -7
  262. package/dist/index218.js.map +1 -1
  263. package/dist/index219.js +10 -10
  264. package/dist/index219.js.map +1 -1
  265. package/dist/index22.js +1 -1
  266. package/dist/index22.js.map +1 -1
  267. package/dist/index220.js +11 -10
  268. package/dist/index220.js.map +1 -1
  269. package/dist/index221.js +11 -21
  270. package/dist/index221.js.map +1 -1
  271. package/dist/index222.js +10 -10
  272. package/dist/index222.js.map +1 -1
  273. package/dist/index223.js +7 -9
  274. package/dist/index223.js.map +1 -1
  275. package/dist/index224.js +6 -9
  276. package/dist/index224.js.map +1 -1
  277. package/dist/index225.js +5 -4
  278. package/dist/index225.js.map +1 -1
  279. package/dist/index226.js +6 -5
  280. package/dist/index226.js.map +1 -1
  281. package/dist/index227.js +7 -16
  282. package/dist/index227.js.map +1 -1
  283. package/dist/index228.js +6 -9
  284. package/dist/index228.js.map +1 -1
  285. package/dist/index229.js +54 -17
  286. package/dist/index229.js.map +1 -1
  287. package/dist/index23.js +27 -34
  288. package/dist/index23.js.map +1 -1
  289. package/dist/index230.js +16 -15
  290. package/dist/index230.js.map +1 -1
  291. package/dist/index231.js +7 -12
  292. package/dist/index231.js.map +1 -1
  293. package/dist/index232.js +9 -28
  294. package/dist/index232.js.map +1 -1
  295. package/dist/index233.js +9 -11
  296. package/dist/index233.js.map +1 -1
  297. package/dist/index234.js +20 -24
  298. package/dist/index234.js.map +1 -1
  299. package/dist/index235.js +10 -5
  300. package/dist/index235.js.map +1 -1
  301. package/dist/index236.js +9 -24
  302. package/dist/index236.js.map +1 -1
  303. package/dist/index237.js +10 -29
  304. package/dist/index237.js.map +1 -1
  305. package/dist/index238.js +5 -5
  306. package/dist/index238.js.map +1 -1
  307. package/dist/index239.js +5 -67
  308. package/dist/index239.js.map +1 -1
  309. package/dist/index24.js +219 -222
  310. package/dist/index24.js.map +1 -1
  311. package/dist/index240.js +15 -179
  312. package/dist/index240.js.map +1 -1
  313. package/dist/index241.js +9 -46
  314. package/dist/index241.js.map +1 -1
  315. package/dist/index242.js +18 -13
  316. package/dist/index242.js.map +1 -1
  317. package/dist/index243.js +15 -154
  318. package/dist/index243.js.map +1 -1
  319. package/dist/index244.js +12 -30
  320. package/dist/index244.js.map +1 -1
  321. package/dist/index245.js +29 -9
  322. package/dist/index245.js.map +1 -1
  323. package/dist/index246.js +11 -46
  324. package/dist/index246.js.map +1 -1
  325. package/dist/index247.js +25 -11
  326. package/dist/index247.js.map +1 -1
  327. package/dist/index248.js +5 -44
  328. package/dist/index248.js.map +1 -1
  329. package/dist/index249.js +12 -94
  330. package/dist/index249.js.map +1 -1
  331. package/dist/index25.js +46 -50
  332. package/dist/index25.js.map +1 -1
  333. package/dist/index250.js +143 -75
  334. package/dist/index250.js.map +1 -1
  335. package/dist/index251.js +27 -102
  336. package/dist/index251.js.map +1 -1
  337. package/dist/index252.js +9 -52
  338. package/dist/index252.js.map +1 -1
  339. package/dist/index253.js +46 -10
  340. package/dist/index253.js.map +1 -1
  341. package/dist/index254.js +10 -36
  342. package/dist/index254.js.map +1 -1
  343. package/dist/index255.js +44 -8
  344. package/dist/index255.js.map +1 -1
  345. package/dist/index256.js +86 -107
  346. package/dist/index256.js.map +1 -1
  347. package/dist/index257.js +86 -17
  348. package/dist/index257.js.map +1 -1
  349. package/dist/index258.js +104 -14
  350. package/dist/index258.js.map +1 -1
  351. package/dist/index259.js +52 -3
  352. package/dist/index259.js.map +1 -1
  353. package/dist/index260.js +10 -35
  354. package/dist/index260.js.map +1 -1
  355. package/dist/index261.js +36 -19
  356. package/dist/index261.js.map +1 -1
  357. package/dist/index262.js +8 -9
  358. package/dist/index262.js.map +1 -1
  359. package/dist/index263.js +3 -8
  360. package/dist/index263.js.map +1 -1
  361. package/dist/index264.js +9 -19
  362. package/dist/index264.js.map +1 -1
  363. package/dist/index265.js +113 -25
  364. package/dist/index265.js.map +1 -1
  365. package/dist/index266.js +17 -16
  366. package/dist/index266.js.map +1 -1
  367. package/dist/index267.js +15 -4
  368. package/dist/index267.js.map +1 -1
  369. package/dist/index268.js +36 -18
  370. package/dist/index268.js.map +1 -1
  371. package/dist/index269.js +20 -12
  372. package/dist/index269.js.map +1 -1
  373. package/dist/index270.js +9 -5
  374. package/dist/index270.js.map +1 -1
  375. package/dist/index271.js +20 -3
  376. package/dist/index271.js.map +1 -1
  377. package/dist/index272.js +26 -21
  378. package/dist/index272.js.map +1 -1
  379. package/dist/index273.js +15 -111
  380. package/dist/index273.js.map +1 -1
  381. package/dist/index274.js +5 -16
  382. package/dist/index274.js.map +1 -1
  383. package/dist/index275.js +3 -525
  384. package/dist/index275.js.map +1 -1
  385. package/dist/index276.js +23 -127
  386. package/dist/index276.js.map +1 -1
  387. package/dist/index277.js +108 -129
  388. package/dist/index277.js.map +1 -1
  389. package/dist/index278.js +15 -20
  390. package/dist/index278.js.map +1 -1
  391. package/dist/index279.js +524 -5
  392. package/dist/index279.js.map +1 -1
  393. package/dist/index28.js +3 -37
  394. package/dist/index28.js.map +1 -1
  395. package/dist/index280.js +127 -5
  396. package/dist/index280.js.map +1 -1
  397. package/dist/index281.js +134 -4
  398. package/dist/index281.js.map +1 -1
  399. package/dist/index282.js +4 -15
  400. package/dist/index282.js.map +1 -1
  401. package/dist/index283.js +19 -9
  402. package/dist/index283.js.map +1 -1
  403. package/dist/index284.js +12 -5
  404. package/dist/index284.js.map +1 -1
  405. package/dist/index285.js +20 -4
  406. package/dist/index285.js.map +1 -1
  407. package/dist/index286.js +67 -544
  408. package/dist/index286.js.map +1 -1
  409. package/dist/index287.js +8 -46
  410. package/dist/index287.js.map +1 -1
  411. package/dist/index288.js +14 -18
  412. package/dist/index288.js.map +1 -1
  413. package/dist/index289.js +66 -7
  414. package/dist/index289.js.map +1 -1
  415. package/dist/index29.js +37 -3
  416. package/dist/index29.js.map +1 -1
  417. package/dist/index290.js +64 -8
  418. package/dist/index290.js.map +1 -1
  419. package/dist/index291.js +5 -7
  420. package/dist/index291.js.map +1 -1
  421. package/dist/index292.js +5 -8
  422. package/dist/index292.js.map +1 -1
  423. package/dist/index293.js +4 -13
  424. package/dist/index293.js.map +1 -1
  425. package/dist/index294.js +15 -9
  426. package/dist/index294.js.map +1 -1
  427. package/dist/index295.js +8 -13
  428. package/dist/index295.js.map +1 -1
  429. package/dist/index296.js +6 -69
  430. package/dist/index296.js.map +1 -1
  431. package/dist/index297.js +5 -9
  432. package/dist/index297.js.map +1 -1
  433. package/dist/index298.js +545 -13
  434. package/dist/index298.js.map +1 -1
  435. package/dist/index299.js +45 -64
  436. package/dist/index299.js.map +1 -1
  437. package/dist/index3.js.map +1 -1
  438. package/dist/index30.js +3 -125
  439. package/dist/index30.js.map +1 -1
  440. package/dist/index300.js +15 -62
  441. package/dist/index300.js.map +1 -1
  442. package/dist/index301.js +6 -4
  443. package/dist/index301.js.map +1 -1
  444. package/dist/index302.js +9 -56
  445. package/dist/index302.js.map +1 -1
  446. package/dist/index303.js +8 -68
  447. package/dist/index303.js.map +1 -1
  448. package/dist/index304.js +9 -31
  449. package/dist/index304.js.map +1 -1
  450. package/dist/index305.js +13 -9
  451. package/dist/index305.js.map +1 -1
  452. package/dist/index306.js +10 -153
  453. package/dist/index306.js.map +1 -1
  454. package/dist/index307.js +14 -108
  455. package/dist/index307.js.map +1 -1
  456. package/dist/index31.js +120 -227
  457. package/dist/index31.js.map +1 -1
  458. package/dist/index310.js +4 -15
  459. package/dist/index310.js.map +1 -1
  460. package/dist/index311.js +55 -28
  461. package/dist/index311.js.map +1 -1
  462. package/dist/index312.js +68 -13
  463. package/dist/index312.js.map +1 -1
  464. package/dist/index313.js +31 -7
  465. package/dist/index313.js.map +1 -1
  466. package/dist/index314.js +9 -23
  467. package/dist/index314.js.map +1 -1
  468. package/dist/index315.js +152 -12
  469. package/dist/index315.js.map +1 -1
  470. package/dist/index316.js +107 -27
  471. package/dist/index316.js.map +1 -1
  472. package/dist/index317.js +22 -4
  473. package/dist/index317.js.map +1 -1
  474. package/dist/index318.js +16 -0
  475. package/dist/index318.js.map +1 -0
  476. package/dist/index319.js +31 -0
  477. package/dist/index319.js.map +1 -0
  478. package/dist/index32.js +229 -21
  479. package/dist/index32.js.map +1 -1
  480. package/dist/index320.js +8 -0
  481. package/dist/index320.js.map +1 -0
  482. package/dist/index321.js +19 -0
  483. package/dist/index321.js.map +1 -0
  484. package/dist/index322.js +32 -0
  485. package/dist/index322.js.map +1 -0
  486. package/dist/index323.js +16 -0
  487. package/dist/index323.js.map +1 -0
  488. package/dist/index324.js +10 -0
  489. package/dist/index324.js.map +1 -0
  490. package/dist/index33.js +23 -50
  491. package/dist/index33.js.map +1 -1
  492. package/dist/index34.js +50 -2640
  493. package/dist/index34.js.map +1 -1
  494. package/dist/index35.js +2598 -351
  495. package/dist/index35.js.map +1 -1
  496. package/dist/index36.js +375 -214
  497. package/dist/index36.js.map +1 -1
  498. package/dist/index37.js +230 -19
  499. package/dist/index37.js.map +1 -1
  500. package/dist/index38.js +18 -138
  501. package/dist/index38.js.map +1 -1
  502. package/dist/index39.js +113 -170
  503. package/dist/index39.js.map +1 -1
  504. package/dist/index4.js +17 -15
  505. package/dist/index4.js.map +1 -1
  506. package/dist/index40.js +209 -64
  507. package/dist/index40.js.map +1 -1
  508. package/dist/index41.js +86 -94
  509. package/dist/index41.js.map +1 -1
  510. package/dist/index42.js +118 -5
  511. package/dist/index42.js.map +1 -1
  512. package/dist/index43.js +5 -843
  513. package/dist/index43.js.map +1 -1
  514. package/dist/index44.js +832 -54
  515. package/dist/index44.js.map +1 -1
  516. package/dist/index45.js +57 -8
  517. package/dist/index45.js.map +1 -1
  518. package/dist/index46.js +8 -2
  519. package/dist/index46.js.map +1 -1
  520. package/dist/index47.js +2 -24
  521. package/dist/index47.js.map +1 -1
  522. package/dist/index48.js +11 -233
  523. package/dist/index48.js.map +1 -1
  524. package/dist/index49.js +19 -205
  525. package/dist/index49.js.map +1 -1
  526. package/dist/index5.js +34 -34
  527. package/dist/index5.js.map +1 -1
  528. package/dist/index50.js +7 -3
  529. package/dist/index50.js.map +1 -1
  530. package/dist/index51.js +2 -7
  531. package/dist/index51.js.map +1 -1
  532. package/dist/index52.js +22 -46
  533. package/dist/index52.js.map +1 -1
  534. package/dist/index53.js +232 -25
  535. package/dist/index53.js.map +1 -1
  536. package/dist/index54.js +203 -49
  537. package/dist/index54.js.map +1 -1
  538. package/dist/index55.js +3 -7
  539. package/dist/index55.js.map +1 -1
  540. package/dist/index56.js +6 -14
  541. package/dist/index56.js.map +1 -1
  542. package/dist/index57.js +43 -129
  543. package/dist/index57.js.map +1 -1
  544. package/dist/index58.js +26 -10
  545. package/dist/index58.js.map +1 -1
  546. package/dist/index59.js +48 -214
  547. package/dist/index59.js.map +1 -1
  548. package/dist/index6.js +154 -120
  549. package/dist/index6.js.map +1 -1
  550. package/dist/index60.js +8 -13
  551. package/dist/index60.js.map +1 -1
  552. package/dist/index61.js +14 -33
  553. package/dist/index61.js.map +1 -1
  554. package/dist/index62.js +128 -41
  555. package/dist/index62.js.map +1 -1
  556. package/dist/index63.js +10 -7
  557. package/dist/index63.js.map +1 -1
  558. package/dist/index64.js +213 -46
  559. package/dist/index64.js.map +1 -1
  560. package/dist/index65.js +13 -4
  561. package/dist/index65.js.map +1 -1
  562. package/dist/index66.js +33 -5
  563. package/dist/index66.js.map +1 -1
  564. package/dist/index67.js +46 -27
  565. package/dist/index67.js.map +1 -1
  566. package/dist/index68.js +8 -50
  567. package/dist/index68.js.map +1 -1
  568. package/dist/index69.js +50 -9
  569. package/dist/index69.js.map +1 -1
  570. package/dist/index7.js +29 -24
  571. package/dist/index7.js.map +1 -1
  572. package/dist/index70.js +4 -12
  573. package/dist/index70.js.map +1 -1
  574. package/dist/index71.js +5 -53
  575. package/dist/index71.js.map +1 -1
  576. package/dist/index72.js +28 -6
  577. package/dist/index72.js.map +1 -1
  578. package/dist/index73.js +50 -8
  579. package/dist/index73.js.map +1 -1
  580. package/dist/index74.js +9 -6
  581. package/dist/index74.js.map +1 -1
  582. package/dist/index77.js +12 -52
  583. package/dist/index77.js.map +1 -1
  584. package/dist/index78.js +5 -4
  585. package/dist/index78.js.map +1 -1
  586. package/dist/index79.js +7 -4
  587. package/dist/index79.js.map +1 -1
  588. package/dist/index8.js +21 -24
  589. package/dist/index8.js.map +1 -1
  590. package/dist/index80.js +5 -15
  591. package/dist/index80.js.map +1 -1
  592. package/dist/index81.js +2 -6
  593. package/dist/index81.js.map +1 -1
  594. package/dist/index82.js +2 -8
  595. package/dist/index82.js.map +1 -1
  596. package/dist/index83.js +53 -16
  597. package/dist/index83.js.map +1 -1
  598. package/dist/index84.js +46 -4
  599. package/dist/index84.js.map +1 -1
  600. package/dist/index85.js +205 -4
  601. package/dist/index85.js.map +1 -1
  602. package/dist/index86.js +22 -6
  603. package/dist/index86.js.map +1 -1
  604. package/dist/index87.js +24 -5
  605. package/dist/index87.js.map +1 -1
  606. package/dist/index88.js +399 -4
  607. package/dist/index88.js.map +1 -1
  608. package/dist/index89.js +46 -4
  609. package/dist/index89.js.map +1 -1
  610. package/dist/index9.js +138 -187
  611. package/dist/index9.js.map +1 -1
  612. package/dist/index90.js +605 -6
  613. package/dist/index90.js.map +1 -1
  614. package/dist/index91.js +52 -25
  615. package/dist/index91.js.map +1 -1
  616. package/dist/index92.js +4 -6
  617. package/dist/index92.js.map +1 -1
  618. package/dist/index93.js +4 -4
  619. package/dist/index93.js.map +1 -1
  620. package/dist/index94.js +14 -5
  621. package/dist/index94.js.map +1 -1
  622. package/dist/index95.js +3 -3
  623. package/dist/index95.js.map +1 -1
  624. package/dist/index96.js +7 -4
  625. package/dist/index96.js.map +1 -1
  626. package/dist/index97.js +16 -5
  627. package/dist/index97.js.map +1 -1
  628. package/dist/index98.js +3 -3
  629. package/dist/index98.js.map +1 -1
  630. package/dist/index99.js +4 -8
  631. package/dist/index99.js.map +1 -1
  632. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index24.js","sources":["../src/components/Notifications/NotificationsDrawer.tsx"],"sourcesContent":["import { createContext, useCallback, useContext, useEffect, useMemo, useState, type Context } from \"react\"\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\"\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\"\nimport { Loader2, MoreVertical, X } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport type { NotificationItem, NotificationsRealtimeState } from \"./types\"\n\n\ntype ListResponse = {\n ok?: boolean\n error?: string\n notifications?: NotificationItem[]\n unreadCount?: number\n unseenCount?: number\n}\n\ntype DayGroup = {\n key: string\n label: string\n items: NotificationItem[]\n}\n\nconst toMs = (iso: string): number => {\n const ms = Date.parse(iso)\n return Number.isFinite(ms) ? ms : 0\n}\n\nconst getDayKey = (iso: string): string => {\n const date = new Date(toMs(iso))\n if (!Number.isFinite(date.getTime())) return \"unknown\"\n\n const year = date.getFullYear()\n const month = String(date.getMonth() + 1).padStart(2, \"0\")\n const day = String(date.getDate()).padStart(2, \"0\")\n\n return `${year}-${month}-${day}`\n}\n\nconst formatDayLabel = (key: string): string => {\n if (key === \"unknown\") return \"Unknown date\"\n const [yearRaw, monthRaw, dayRaw] = key.split(\"-\")\n const year = Number(yearRaw)\n const month = Number(monthRaw)\n const day = Number(dayRaw)\n\n if (!Number.isFinite(year) || !Number.isFinite(month) || !Number.isFinite(day)) return \"Unknown date\"\n\n const date = new Date(year, month - 1, day)\n if (!Number.isFinite(date.getTime())) return \"Unknown date\"\n\n const now = new Date()\n const includeYear = now.getFullYear() !== year\n return date.toLocaleDateString(undefined, includeYear\n ? { weekday: \"short\", month: \"short\", day: \"numeric\", year: \"numeric\" }\n : { weekday: \"short\", month: \"short\", day: \"numeric\" })\n}\n\nconst groupByDay = (items: NotificationItem[]): DayGroup[] => {\n const groups: DayGroup[] = []\n let currentKey: string | null = null\n\n for (const item of items) {\n const key = getDayKey(item.createdAt)\n if (key !== currentKey) {\n currentKey = key\n groups.push({ key, label: formatDayLabel(key), items: [] })\n }\n groups[groups.length - 1]!.items.push(item)\n }\n\n return groups\n}\n\nconst EmptyRealtimeContext = createContext<NotificationsRealtimeState | null>(null)\n\nexport function NotificationsDrawer({\n open,\n onOpenChange,\n className,\n limit = 50,\n defaultUnreadOnly = false,\n realtimeContext,\n}: {\n open: boolean\n onOpenChange: (open: boolean) => void\n className?: string\n limit?: number\n defaultUnreadOnly?: boolean\n realtimeContext?: Context<NotificationsRealtimeState | null>\n}) {\n const realtime = useContext(realtimeContext ?? EmptyRealtimeContext)\n\n const [items, setItems] = useState<NotificationItem[]>([])\n const [unreadCount, setUnreadCount] = useState<number>(0)\n const [unseenCount, setUnseenCount] = useState<number>(0)\n const [loading, setLoading] = useState(false)\n const [error, setError] = useState<string | null>(null)\n const [unreadOnly, setUnreadOnly] = useState<boolean>(defaultUnreadOnly)\n\n const mergedItems = realtime?.notifications ?? items\n const mergedUnreadCount = realtime?.unreadCount ?? unreadCount\n const mergedUnseenCount = realtime?.unseenCount ?? unseenCount\n const mergedLoading = realtime?.loading ?? loading\n const mergedError = realtime?.error\n ? (realtime.error instanceof Error ? realtime.error.message : String(realtime.error))\n : error\n\n const visibleItems = useMemo(() => mergedItems.slice(0, limit), [limit, mergedItems])\n\n const unread = useMemo(() => visibleItems.filter((n) => !n.readAt), [visibleItems])\n const read = useMemo(() => visibleItems.filter((n) => Boolean(n.readAt)), [visibleItems])\n const unreadGroups = useMemo(() => groupByDay(unread), [unread])\n const readGroups = useMemo(() => groupByDay(read), [read])\n\n const refresh = useCallback(async ({ unreadOnly, markSeen }: { unreadOnly: boolean; markSeen: boolean }) => {\n setLoading(true)\n setError(null)\n\n try {\n const res = await fetch(\"/api/rb/notifications\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n credentials: \"include\",\n body: JSON.stringify({ limit, unreadOnly, markSeen }),\n })\n\n const json = (await res.json().catch(() => null)) as ListResponse | null\n if (!res.ok || !json?.ok) {\n setError(json?.error || \"Unable to load notifications.\")\n return\n }\n\n const nextItems = Array.isArray(json.notifications) ? json.notifications : []\n setItems(nextItems)\n setUnreadCount(Number.isFinite(json.unreadCount) ? Math.max(0, Math.floor(json.unreadCount ?? 0)) : 0)\n setUnseenCount(Number.isFinite(json.unseenCount) ? Math.max(0, Math.floor(json.unseenCount ?? 0)) : 0)\n } catch {\n setError(\"Unable to load notifications.\")\n } finally {\n setLoading(false)\n }\n }, [limit])\n\n useEffect(() => {\n if (!open) return\n if (realtime) {\n void (async () => {\n try {\n await fetch(\"/api/rb/notifications\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n credentials: \"include\",\n keepalive: true,\n body: JSON.stringify({ limit: 1, markSeen: true }),\n })\n } catch {\n return\n }\n })()\n return\n }\n void refresh({ unreadOnly, markSeen: true })\n }, [open, realtime, refresh, unreadOnly])\n\n useEffect(() => {\n if (!open) return\n if (realtime) return\n void refresh({ unreadOnly, markSeen: false })\n }, [open, realtime, refresh, unreadOnly])\n\n const markAsRead = async (id: string) => {\n try {\n const res = await fetch(`/api/rb/notifications/${encodeURIComponent(id)}/read`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n credentials: \"include\",\n keepalive: true,\n body: \"{}\",\n })\n\n const json = (await res.json().catch(() => null)) as { ok?: boolean } | null\n if (!res.ok || !json?.ok) return\n\n const nowIso = new Date().toISOString()\n if (realtime) return\n setItems((current) => {\n const target = current.find((n) => n.id === id)\n if (target && !target.readAt) {\n setUnreadCount((count) => Math.max(0, count - 1))\n }\n if (target && !target.seenAt) {\n setUnseenCount((count) => Math.max(0, count - 1))\n }\n return current.map((n) => (n.id === id && !n.readAt ? { ...n, readAt: nowIso, ...(n.seenAt ? {} : { seenAt: nowIso }) } : n))\n })\n } catch {\n return\n }\n }\n\n const archive = async (id: string) => {\n try {\n const res = await fetch(`/api/rb/notifications/${encodeURIComponent(id)}/archive`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n credentials: \"include\",\n body: \"{}\",\n })\n\n const json = (await res.json().catch(() => null)) as { ok?: boolean } | null\n if (!res.ok || !json?.ok) return\n\n if (realtime) return\n setItems((current) => {\n const target = current.find((n) => n.id === id)\n if (target && !target.readAt) {\n setUnreadCount((count) => Math.max(0, count - 1))\n }\n if (target && !target.seenAt) {\n setUnseenCount((count) => Math.max(0, count - 1))\n }\n return current.filter((n) => n.id !== id)\n })\n } catch {\n return\n }\n }\n\n return (\n <DialogPrimitive.Root open={open} onOpenChange={onOpenChange}>\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay className=\"fixed inset-0 z-50 bg-black/50\" />\n <DialogPrimitive.Content\n className={cn(\n \"fixed right-0 top-0 z-50 flex h-full w-full max-w-md flex-col border-l bg-background shadow-xl outline-none\",\n className,\n )}\n >\n <header className=\"flex items-center justify-between gap-2 border-b px-4 py-3\">\n <div className=\"flex min-w-0 flex-col\">\n <DialogPrimitive.Title className=\"text-sm font-semibold\">Notifications</DialogPrimitive.Title>\n <span className=\"text-xs text-muted-foreground\">\n {mergedUnreadCount > 0 ? `${mergedUnreadCount} unread` : mergedUnseenCount > 0 ? `${mergedUnseenCount} new` : \"All caught up\"}\n </span>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setUnreadOnly((v) => !v)}\n className={cn(\n \"rounded-md border px-2 py-1 text-xs\",\n unreadOnly ? \"bg-accent text-foreground\" : \"bg-background text-muted-foreground hover:bg-accent\",\n )}\n >\n {unreadOnly ? \"Unread\" : \"All\"}\n </button>\n <DialogPrimitive.Close asChild>\n <button type=\"button\" className=\"inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-accent\">\n <X className=\"h-4 w-4\" />\n </button>\n </DialogPrimitive.Close>\n </div>\n </header>\n\n <div className=\"flex-1 overflow-y-auto px-4 pb-3\">\n {mergedLoading ? (\n <div className=\"flex items-center justify-center py-10 text-muted-foreground\">\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n </div>\n ) : mergedError ? (\n <div className=\"py-10 text-center text-sm text-muted-foreground\">{mergedError}</div>\n ) : visibleItems.length === 0 ? (\n <div className=\"py-10 text-center text-sm text-muted-foreground\">No notifications.</div>\n ) : (\n <div className=\"flex flex-col gap-4\">\n <div>\n <div className=\"sticky top-0 z-20 -mx-4 flex h-8 items-center border-b bg-background px-4 text-xs font-semibold text-muted-foreground\">\n Unread notifications\n </div>\n {unreadGroups.length === 0 ? (\n <div className=\"py-6 text-center text-sm text-muted-foreground\">No unread notifications.</div>\n ) : (\n unreadGroups.map((group) => (\n <div key={`unread:${group.key}`}>\n <div className=\"sticky top-8 z-10 -mx-4 flex h-7 items-center bg-background px-4 text-[11px] font-semibold text-muted-foreground\">\n {group.label}\n </div>\n <div className=\"-mx-4 flex flex-col divide-y divide-border\">\n {group.items.map((n) => (\n <NotificationRow\n key={n.id}\n notification={n}\n onMarkRead={markAsRead}\n onArchive={archive}\n />\n ))}\n </div>\n </div>\n ))\n )}\n </div>\n\n {unreadOnly ? null : (\n <div>\n <div className=\"sticky top-0 z-20 -mx-4 flex h-8 items-center border-b bg-background px-4 text-xs font-semibold text-muted-foreground\">\n Previous notifications\n </div>\n {readGroups.length === 0 ? (\n <div className=\"py-6 text-center text-sm text-muted-foreground\">No previous notifications.</div>\n ) : (\n readGroups.map((group) => (\n <div key={`previous:${group.key}`}>\n <div className=\"sticky top-8 z-10 -mx-4 flex h-7 items-center bg-background px-4 text-[11px] font-semibold text-muted-foreground\">\n {group.label}\n </div>\n <div className=\"-mx-4 flex flex-col divide-y divide-border\">\n {group.items.map((n) => (\n <NotificationRow\n key={n.id}\n notification={n}\n onMarkRead={markAsRead}\n onArchive={archive}\n />\n ))}\n </div>\n </div>\n ))\n )}\n </div>\n )}\n </div>\n )}\n </div>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n )\n}\n\nfunction NotificationRow({\n notification,\n onMarkRead,\n onArchive,\n}: {\n notification: NotificationItem\n onMarkRead: (id: string) => void\n onArchive: (id: string) => void\n}) {\n const isUnread = !notification.readAt\n const createdAtLabel = (() => {\n const date = new Date(toMs(notification.createdAt))\n if (!Number.isFinite(date.getTime())) return \"\"\n return date.toLocaleString()\n })()\n\n return (\n <div\n className={cn(\n \"group flex w-full gap-3 px-4 py-3 hover:bg-accent/40\",\n isUnread ? \"bg-primary/5\" : \"bg-background\",\n )}\n >\n <button\n type=\"button\"\n className=\"min-w-0 flex-1 text-left\"\n onClick={() => {\n if (isUnread) {\n void onMarkRead(notification.id)\n }\n if (notification.url) {\n window.location.href = notification.url\n }\n }}\n >\n <div className=\"min-w-0\">\n <div className=\"truncate text-sm font-semibold\">{notification.title}</div>\n {notification.body ? (\n <div className=\"mt-0.5 line-clamp-2 text-xs text-muted-foreground\">{notification.body}</div>\n ) : null}\n </div>\n {notification.url ? <div className=\"mt-2 truncate text-xs text-primary\">{notification.url}</div> : null}\n {createdAtLabel ? (\n <div className=\"mt-2 text-[11px] text-muted-foreground\">{createdAtLabel}</div>\n ) : null}\n </button>\n <div className=\"flex items-start\">\n <DropdownMenuPrimitive.Root>\n <DropdownMenuPrimitive.Trigger asChild>\n <button\n type=\"button\"\n className=\"inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-accent\"\n aria-label=\"Notification options\"\n >\n <MoreVertical className=\"h-4 w-4\" />\n </button>\n </DropdownMenuPrimitive.Trigger>\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n align=\"end\"\n sideOffset={6}\n className={cn(\n \"z-50 min-w-[10rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n )}\n >\n <DropdownMenuPrimitive.Item\n className=\"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\"\n onSelect={() => onArchive(notification.id)}\n >\n Archive\n </DropdownMenuPrimitive.Item>\n <DropdownMenuPrimitive.Item\n className=\"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\"\n disabled={!isUnread}\n onSelect={() => onMarkRead(notification.id)}\n >\n Mark as read\n </DropdownMenuPrimitive.Item>\n </DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>\n </DropdownMenuPrimitive.Root>\n </div>\n </div>\n )\n}\n"],"names":["toMs","iso","ms","getDayKey","date","year","month","day","formatDayLabel","key","yearRaw","monthRaw","dayRaw","includeYear","groupByDay","items","groups","currentKey","item","EmptyRealtimeContext","createContext","NotificationsDrawer","open","onOpenChange","className","limit","defaultUnreadOnly","realtimeContext","realtime","useContext","setItems","useState","unreadCount","setUnreadCount","unseenCount","setUnseenCount","loading","setLoading","error","setError","unreadOnly","setUnreadOnly","mergedItems","mergedUnreadCount","mergedUnseenCount","mergedLoading","mergedError","visibleItems","useMemo","unread","read","unreadGroups","readGroups","refresh","useCallback","markSeen","res","json","nextItems","useEffect","markAsRead","id","nowIso","current","target","n","count","archive","jsx","DialogPrimitive","jsxs","cn","v","X","Loader2","group","NotificationRow","notification","onMarkRead","onArchive","isUnread","createdAtLabel","DropdownMenuPrimitive.Root","DropdownMenuPrimitive.Trigger","MoreVertical","DropdownMenuPrimitive.Portal","DropdownMenuPrimitive.Content","DropdownMenuPrimitive.Item"],"mappings":";;;;;;AAwBA,MAAMA,IAAO,CAACC,MAAwB;AACpC,QAAMC,IAAK,KAAK,MAAMD,CAAG;AACzB,SAAO,OAAO,SAASC,CAAE,IAAIA,IAAK;AACpC,GAEMC,KAAY,CAACF,MAAwB;AACzC,QAAMG,IAAO,IAAI,KAAKJ,EAAKC,CAAG,CAAC;AAC/B,MAAI,CAAC,OAAO,SAASG,EAAK,QAAA,CAAS,EAAG,QAAO;AAE7C,QAAMC,IAAOD,EAAK,YAAA,GACZE,IAAQ,OAAOF,EAAK,SAAA,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A,UAAAd,gBAAAA,EAAAA,IAACe,GAAA,EAA8B,SAAO,IACpC,UAAAf,gBAAAA,EAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,WAAU;AAAA,cACV,cAAW;AAAA,cAEX,UAAAA,gBAAAA,EAAAA,IAACgB,IAAA,EAAa,WAAU,UAAA,CAAU;AAAA,YAAA;AAAA,UAAA,GAEtC;AAAA,UACAhB,gBAAAA,MAACiB,IAAA,EACC,UAAAf,gBAAAA,EAAAA;AAAAA,YAACgB;AAAAA,YAAA;AAAA,cACC,OAAM;AAAA,cACN,YAAY;AAAA,cACZ,WAAWf;AAAA,gBACT;AAAA,gBACA;AAAA,gBACA;AAAA,cAAA;AAAA,cAGF,UAAA;AAAA,gBAAAH,gBAAAA,EAAAA;AAAAA,kBAACmB;AAAAA,kBAAA;AAAA,oBACC,WAAU;AAAA,oBACV,UAAU,MAAMR,EAAUF,EAAa,EAAE;AAAA,oBAC1C,UAAA;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAGDT,gBAAAA,EAAAA;AAAAA,kBAACmB;AAAAA,kBAAA;AAAA,oBACC,WAAU;AAAA,oBACV,UAAU,CAACP;AAAA,oBACX,UAAU,MAAMF,EAAWD,EAAa,EAAE;AAAA,oBAC3C,UAAA;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAED;AAAA,YAAA;AAAA,UAAA,EACF,CACF;AAAA,QAAA,EAAA,CACF,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"index24.js","sources":["../src/components/Notifications/NotificationsDrawer.tsx"],"sourcesContent":["import { createContext, useCallback, useContext, useEffect, useMemo, useState, type Context } from \"react\"\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\"\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\"\nimport { Loader2, MoreVertical, X } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport type { NotificationItem, NotificationsRealtimeState } from \"./types\"\n\n\ntype ListResponse = {\n ok?: boolean\n error?: string\n notifications?: NotificationItem[]\n unreadCount?: number\n unseenCount?: number\n}\n\ntype DayGroup = {\n key: string\n label: string\n items: NotificationItem[]\n}\n\nconst toMs = (iso: string): number => {\n const ms = Date.parse(iso)\n return Number.isFinite(ms) ? ms : 0\n}\n\nconst getDayKey = (iso: string): string => {\n const date = new Date(toMs(iso))\n if (!Number.isFinite(date.getTime())) return \"unknown\"\n\n const year = date.getFullYear()\n const month = String(date.getMonth() + 1).padStart(2, \"0\")\n const day = String(date.getDate()).padStart(2, \"0\")\n\n return `${year}-${month}-${day}`\n}\n\nconst formatDayLabel = (key: string): string => {\n if (key === \"unknown\") return \"Unknown date\"\n const [yearRaw, monthRaw, dayRaw] = key.split(\"-\")\n const year = Number(yearRaw)\n const month = Number(monthRaw)\n const day = Number(dayRaw)\n\n if (!Number.isFinite(year) || !Number.isFinite(month) || !Number.isFinite(day)) return \"Unknown date\"\n\n const date = new Date(year, month - 1, day)\n if (!Number.isFinite(date.getTime())) return \"Unknown date\"\n\n const now = new Date()\n const includeYear = now.getFullYear() !== year\n return date.toLocaleDateString(undefined, includeYear\n ? { weekday: \"short\", month: \"short\", day: \"numeric\", year: \"numeric\" }\n : { weekday: \"short\", month: \"short\", day: \"numeric\" })\n}\n\nconst groupByDay = (items: NotificationItem[]): DayGroup[] => {\n const groups: DayGroup[] = []\n let currentKey: string | null = null\n\n for (const item of items) {\n const key = getDayKey(item.createdAt)\n if (key !== currentKey) {\n currentKey = key\n groups.push({ key, label: formatDayLabel(key), items: [] })\n }\n groups[groups.length - 1]!.items.push(item)\n }\n\n return groups\n}\n\nconst EmptyRealtimeContext = createContext<NotificationsRealtimeState | null>(null)\n\nexport function NotificationsDrawer({\n open,\n onOpenChange,\n className,\n limit = 50,\n defaultUnreadOnly = false,\n realtimeContext,\n}: {\n open: boolean\n onOpenChange: (open: boolean) => void\n className?: string\n limit?: number\n defaultUnreadOnly?: boolean\n realtimeContext?: Context<NotificationsRealtimeState | null>\n}) {\n const realtime = useContext(realtimeContext ?? EmptyRealtimeContext)\n\n const [items, setItems] = useState<NotificationItem[]>([])\n const [unreadCount, setUnreadCount] = useState<number>(0)\n const [unseenCount, setUnseenCount] = useState<number>(0)\n const [loading, setLoading] = useState(false)\n const [error, setError] = useState<string | null>(null)\n const [unreadOnly, setUnreadOnly] = useState<boolean>(defaultUnreadOnly)\n\n const mergedItems = realtime?.notifications ?? items\n const mergedUnreadCount = realtime?.unreadCount ?? unreadCount\n const mergedUnseenCount = realtime?.unseenCount ?? unseenCount\n const mergedLoading = realtime?.loading ?? loading\n const mergedError = realtime?.error\n ? (realtime.error instanceof Error ? realtime.error.message : String(realtime.error))\n : error\n\n const visibleItems = useMemo(() => mergedItems.slice(0, limit), [limit, mergedItems])\n\n const unread = useMemo(() => visibleItems.filter((n) => !n.readAt), [visibleItems])\n const read = useMemo(() => visibleItems.filter((n) => Boolean(n.readAt)), [visibleItems])\n const unreadGroups = useMemo(() => groupByDay(unread), [unread])\n const readGroups = useMemo(() => groupByDay(read), [read])\n\n const refresh = useCallback(async ({ unreadOnly, markSeen }: { unreadOnly: boolean; markSeen: boolean }) => {\n setLoading(true)\n setError(null)\n\n try {\n const res = await fetch(\"/api/rb/notifications\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n credentials: \"include\",\n body: JSON.stringify({ limit, unreadOnly, markSeen }),\n })\n\n const json = (await res.json().catch(() => null)) as ListResponse | null\n if (!res.ok || !json?.ok) {\n setError(json?.error || \"Unable to load notifications.\")\n return\n }\n\n const nextItems = Array.isArray(json.notifications) ? json.notifications : []\n setItems(nextItems)\n setUnreadCount(Number.isFinite(json.unreadCount) ? Math.max(0, Math.floor(json.unreadCount ?? 0)) : 0)\n setUnseenCount(Number.isFinite(json.unseenCount) ? Math.max(0, Math.floor(json.unseenCount ?? 0)) : 0)\n } catch {\n setError(\"Unable to load notifications.\")\n } finally {\n setLoading(false)\n }\n }, [limit])\n\n useEffect(() => {\n if (!open) return\n if (realtime) {\n void (async () => {\n try {\n await fetch(\"/api/rb/notifications\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n credentials: \"include\",\n keepalive: true,\n body: JSON.stringify({ limit: 1, markSeen: true }),\n })\n } catch {\n return\n }\n })()\n return\n }\n void refresh({ unreadOnly, markSeen: true })\n }, [open, realtime, refresh, unreadOnly])\n\n useEffect(() => {\n if (!open) return\n if (realtime) return\n void refresh({ unreadOnly, markSeen: false })\n }, [open, realtime, refresh, unreadOnly])\n\n const markAsRead = async (id: string) => {\n try {\n const res = await fetch(`/api/rb/notifications/${encodeURIComponent(id)}/read`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n credentials: \"include\",\n keepalive: true,\n body: \"{}\",\n })\n\n const json = (await res.json().catch(() => null)) as { ok?: boolean } | null\n if (!res.ok || !json?.ok) return\n\n const nowIso = new Date().toISOString()\n if (realtime) return\n setItems((current) => {\n const target = current.find((n) => n.id === id)\n if (target && !target.readAt) {\n setUnreadCount((count) => Math.max(0, count - 1))\n }\n if (target && !target.seenAt) {\n setUnseenCount((count) => Math.max(0, count - 1))\n }\n return current.map((n) => (n.id === id && !n.readAt ? { ...n, readAt: nowIso, ...(n.seenAt ? {} : { seenAt: nowIso }) } : n))\n })\n } catch {\n return\n }\n }\n\n const archive = async (id: string) => {\n try {\n const res = await fetch(`/api/rb/notifications/${encodeURIComponent(id)}/archive`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n credentials: \"include\",\n body: \"{}\",\n })\n\n const json = (await res.json().catch(() => null)) as { ok?: boolean } | null\n if (!res.ok || !json?.ok) return\n\n if (realtime) return\n setItems((current) => {\n const target = current.find((n) => n.id === id)\n if (target && !target.readAt) {\n setUnreadCount((count) => Math.max(0, count - 1))\n }\n if (target && !target.seenAt) {\n setUnseenCount((count) => Math.max(0, count - 1))\n }\n return current.filter((n) => n.id !== id)\n })\n } catch {\n return\n }\n }\n\n return (\n <DialogPrimitive.Root open={open} onOpenChange={onOpenChange}>\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay className=\"fixed inset-0 z-50 bg-black/50\" />\n <DialogPrimitive.Content\n className={cn(\n \"fixed right-0 top-0 z-50 flex h-full w-full max-w-md flex-col border-l bg-background shadow-xl outline-none\",\n className,\n )}\n >\n <header className=\"flex items-center justify-between gap-2 border-b px-4 py-3\">\n <div className=\"flex min-w-0 flex-col\">\n <DialogPrimitive.Title className=\"text-sm font-semibold\">Notifications</DialogPrimitive.Title>\n <span className=\"text-xs text-muted-foreground\">\n {mergedUnreadCount > 0 ? `${mergedUnreadCount} unread` : mergedUnseenCount > 0 ? `${mergedUnseenCount} new` : \"All caught up\"}\n </span>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setUnreadOnly((v) => !v)}\n className={cn(\n \"rounded-md border px-2 py-1 text-xs\",\n unreadOnly ? \"bg-accent text-foreground\" : \"bg-background text-muted-foreground hover:bg-accent\",\n )}\n >\n {unreadOnly ? \"Unread\" : \"All\"}\n </button>\n <DialogPrimitive.Close asChild>\n <button type=\"button\" className=\"inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-accent\">\n <X className=\"h-4 w-4\" />\n </button>\n </DialogPrimitive.Close>\n </div>\n </header>\n\n <div className=\"flex-1 overflow-y-auto px-4 pb-3\">\n {mergedLoading ? (\n <div className=\"flex items-center justify-center py-10 text-muted-foreground\">\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n </div>\n ) : mergedError ? (\n <div className=\"py-10 text-center text-sm text-muted-foreground\">{mergedError}</div>\n ) : visibleItems.length === 0 ? (\n <div className=\"py-10 text-center text-sm text-muted-foreground\">No notifications.</div>\n ) : (\n <div className=\"flex flex-col gap-4\">\n <div>\n <div className=\"sticky top-0 z-20 -mx-4 flex h-8 items-center border-b bg-background px-4 text-xs font-semibold text-muted-foreground\">\n Unread notifications\n </div>\n {unreadGroups.length === 0 ? (\n <div className=\"py-6 text-center text-sm text-muted-foreground\">No unread notifications.</div>\n ) : (\n unreadGroups.map((group) => (\n <div key={`unread:${group.key}`}>\n <div className=\"sticky top-8 z-10 -mx-4 flex h-7 items-center bg-background px-4 text-[11px] font-semibold text-muted-foreground\">\n {group.label}\n </div>\n <div className=\"-mx-4 flex flex-col divide-y divide-border\">\n {group.items.map((n) => (\n <NotificationRow\n key={n.id}\n notification={n}\n onMarkRead={markAsRead}\n onArchive={archive}\n />\n ))}\n </div>\n </div>\n ))\n )}\n </div>\n\n {unreadOnly ? null : (\n <div>\n <div className=\"sticky top-0 z-20 -mx-4 flex h-8 items-center border-b bg-background px-4 text-xs font-semibold text-muted-foreground\">\n Previous notifications\n </div>\n {readGroups.length === 0 ? (\n <div className=\"py-6 text-center text-sm text-muted-foreground\">No previous notifications.</div>\n ) : (\n readGroups.map((group) => (\n <div key={`previous:${group.key}`}>\n <div className=\"sticky top-8 z-10 -mx-4 flex h-7 items-center bg-background px-4 text-[11px] font-semibold text-muted-foreground\">\n {group.label}\n </div>\n <div className=\"-mx-4 flex flex-col divide-y divide-border\">\n {group.items.map((n) => (\n <NotificationRow\n key={n.id}\n notification={n}\n onMarkRead={markAsRead}\n onArchive={archive}\n />\n ))}\n </div>\n </div>\n ))\n )}\n </div>\n )}\n </div>\n )}\n </div>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n )\n}\n\nfunction NotificationRow({\n notification,\n onMarkRead,\n onArchive,\n}: {\n notification: NotificationItem\n onMarkRead: (id: string) => void\n onArchive: (id: string) => void\n}) {\n const isUnread = !notification.readAt\n const createdAtLabel = (() => {\n const date = new Date(toMs(notification.createdAt))\n if (!Number.isFinite(date.getTime())) return \"\"\n return date.toLocaleString()\n })()\n\n return (\n <div\n className={cn(\n \"group flex w-full gap-3 px-4 py-3 hover:bg-accent/40\",\n isUnread ? \"bg-primary/5\" : \"bg-background\",\n )}\n >\n <button\n type=\"button\"\n className=\"min-w-0 flex-1 text-left\"\n onClick={() => {\n if (isUnread) {\n void onMarkRead(notification.id)\n }\n if (notification.url) {\n window.location.href = notification.url\n }\n }}\n >\n <div className=\"min-w-0\">\n <div className=\"truncate text-sm font-semibold\">{notification.title}</div>\n {notification.body ? (\n <div className=\"mt-0.5 line-clamp-2 text-xs text-muted-foreground\">{notification.body}</div>\n ) : null}\n </div>\n {notification.url ? <div className=\"mt-2 truncate text-xs text-primary\">{notification.url}</div> : null}\n {createdAtLabel ? (\n <div className=\"mt-2 text-[11px] text-muted-foreground\">{createdAtLabel}</div>\n ) : null}\n </button>\n <div className=\"flex items-start\">\n <DropdownMenuPrimitive.Root>\n <DropdownMenuPrimitive.Trigger asChild>\n <button\n type=\"button\"\n className=\"inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-accent\"\n aria-label=\"Notification options\"\n >\n <MoreVertical className=\"h-4 w-4\" />\n </button>\n </DropdownMenuPrimitive.Trigger>\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n align=\"end\"\n sideOffset={6}\n className={cn(\n \"z-50 min-w-[10rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n )}\n >\n <DropdownMenuPrimitive.Item\n className=\"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\"\n onSelect={() => onArchive(notification.id)}\n >\n Archive\n </DropdownMenuPrimitive.Item>\n <DropdownMenuPrimitive.Item\n className=\"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\"\n disabled={!isUnread}\n onSelect={() => onMarkRead(notification.id)}\n >\n Mark as read\n </DropdownMenuPrimitive.Item>\n </DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>\n </DropdownMenuPrimitive.Root>\n </div>\n </div>\n )\n}\n"],"names":["toMs","iso","ms","Date","parse","Number","isFinite","getDayKey","date","getTime","year","getFullYear","month","String","getMonth","padStart","day","getDate","formatDayLabel","key","yearRaw","monthRaw","dayRaw","split","includeYear","toLocaleDateString","undefined","weekday","groupByDay","items","groups","currentKey","item","createdAt","push","label","length","EmptyRealtimeContext","createContext","NotificationsDrawer","open","onOpenChange","className","limit","defaultUnreadOnly","realtimeContext","realtime","useContext","setItems","useState","unreadCount","setUnreadCount","unseenCount","setUnseenCount","loading","setLoading","error","setError","unreadOnly","setUnreadOnly","mergedItems","notifications","mergedUnreadCount","mergedUnseenCount","mergedLoading","mergedError","Error","message","visibleItems","useMemo","slice","unread","filter","n","readAt","read","Boolean","unreadGroups","readGroups","refresh","useCallback","markSeen","res","fetch","method","headers","credentials","body","JSON","stringify","json","catch","ok","nextItems","Array","isArray","Math","max","floor","useEffect","keepalive","markAsRead","id","encodeURIComponent","nowIso","toISOString","current","target","find","count","seenAt","map","archive","jsx","DialogPrimitive","jsxs","cn","v","X","Loader2","group","NotificationRow","t0","$","_c","notification","onMarkRead","onArchive","isUnread","t1","bb0","toLocaleString","createdAtLabel","t2","t3","t4","url","window","location","href","t5","title","t6","t7","t8","t9","t10","t11","Symbol","for","DropdownMenuPrimitive.Trigger","MoreVertical","t12","t13","t14","t15","t16","t17","DropdownMenuPrimitive.Root","DropdownMenuPrimitive.Content","t18"],"mappings":";;;;;;;AAwBA,MAAMA,IAAOA,CAACC,MAAwB;AACpC,QAAMC,IAAKC,KAAKC,MAAMH,CAAG;AACzB,SAAOI,OAAOC,SAASJ,CAAE,IAAIA,IAAK;AACpC,GAEMK,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OAAA,EACa,WAAAmB,GAKXY,UAAAA;AAAAA,IAAAA;AAAAA,IAuBAW;AAAAA,EAAAA,GAsCF,GAAMlC,QAAAuB,GAAAvB,QAAAkC,GAAAlC,QAAAW,GAAAX,QAAAqC,KAAAA,IAAArC,EAAA,EAAA,GAnENqC;AAmEM;"}
package/dist/index240.js CHANGED
@@ -1,184 +1,20 @@
1
- import * as s from "react";
2
- import { composeEventHandlers as p } from "./index51.js";
3
- import { createCollection as H } from "./index52.js";
4
- import { useComposedRefs as V } from "./index53.js";
5
- import { createContextScope as z } from "./index54.js";
6
- import { useId as q } from "./index58.js";
7
- import { Primitive as G } from "./index61.js";
8
- import { useCallbackRef as J } from "./index63.js";
9
- import { useControllableState as Q } from "./index64.js";
10
- import { useDirection as W } from "./index55.js";
11
- import { j as d } from "./index29.js";
12
- var _ = "rovingFocusGroup.onEntryFocus", X = { bubbles: !1, cancelable: !0 }, I = "RovingFocusGroup", [y, N, Z] = H(I), [$, Fe] = z(
13
- I,
14
- [Z]
15
- ), [ee, oe] = $(I), O = s.forwardRef(
16
- (e, r) => /* @__PURE__ */ d.jsx(y.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d.jsx(y.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d.jsx(te, { ...e, ref: r }) }) })
17
- );
18
- O.displayName = I;
19
- var te = s.forwardRef((e, r) => {
20
- const {
21
- __scopeRovingFocusGroup: c,
22
- orientation: o,
23
- loop: T = !1,
24
- dir: w,
25
- currentTabStopId: v,
26
- defaultCurrentTabStopId: C,
27
- onCurrentTabStopIdChange: S,
28
- onEntryFocus: m,
29
- preventScrollOnEntryFocus: u = !1,
30
- ...b
31
- } = e, F = s.useRef(null), g = V(r, F), R = W(w), [E, t] = Q({
32
- prop: v,
33
- defaultProp: C ?? null,
34
- onChange: S,
35
- caller: I
36
- }), [i, h] = s.useState(!1), a = J(m), l = N(c), x = s.useRef(!1), [k, D] = s.useState(0);
37
- return s.useEffect(() => {
38
- const n = F.current;
39
- if (n)
40
- return n.addEventListener(_, a), () => n.removeEventListener(_, a);
41
- }, [a]), /* @__PURE__ */ d.jsx(
42
- ee,
43
- {
44
- scope: c,
45
- orientation: o,
46
- dir: R,
47
- loop: T,
48
- currentTabStopId: E,
49
- onItemFocus: s.useCallback(
50
- (n) => t(n),
51
- [t]
52
- ),
53
- onItemShiftTab: s.useCallback(() => h(!0), []),
54
- onFocusableItemAdd: s.useCallback(
55
- () => D((n) => n + 1),
56
- []
57
- ),
58
- onFocusableItemRemove: s.useCallback(
59
- () => D((n) => n - 1),
60
- []
61
- ),
62
- children: /* @__PURE__ */ d.jsx(
63
- G.div,
64
- {
65
- tabIndex: i || k === 0 ? -1 : 0,
66
- "data-orientation": o,
67
- ...b,
68
- ref: g,
69
- style: { outline: "none", ...e.style },
70
- onMouseDown: p(e.onMouseDown, () => {
71
- x.current = !0;
72
- }),
73
- onFocus: p(e.onFocus, (n) => {
74
- const L = !x.current;
75
- if (n.target === n.currentTarget && L && !i) {
76
- const P = new CustomEvent(_, X);
77
- if (n.currentTarget.dispatchEvent(P), !P.defaultPrevented) {
78
- const A = l().filter((f) => f.focusable), U = A.find((f) => f.active), B = A.find((f) => f.id === E), Y = [U, B, ...A].filter(
79
- Boolean
80
- ).map((f) => f.ref.current);
81
- M(Y, u);
82
- }
83
- }
84
- x.current = !1;
85
- }),
86
- onBlur: p(e.onBlur, () => h(!1))
87
- }
88
- )
89
- }
90
- );
91
- }), K = "RovingFocusGroupItem", j = s.forwardRef(
92
- (e, r) => {
93
- const {
94
- __scopeRovingFocusGroup: c,
95
- focusable: o = !0,
96
- active: T = !1,
97
- tabStopId: w,
98
- children: v,
99
- ...C
100
- } = e, S = q(), m = w || S, u = oe(K, c), b = u.currentTabStopId === m, F = N(c), { onFocusableItemAdd: g, onFocusableItemRemove: R, currentTabStopId: E } = u;
101
- return s.useEffect(() => {
102
- if (o)
103
- return g(), () => R();
104
- }, [o, g, R]), /* @__PURE__ */ d.jsx(
105
- y.ItemSlot,
106
- {
107
- scope: c,
108
- id: m,
109
- focusable: o,
110
- active: T,
111
- children: /* @__PURE__ */ d.jsx(
112
- G.span,
113
- {
114
- tabIndex: b ? 0 : -1,
115
- "data-orientation": u.orientation,
116
- ...C,
117
- ref: r,
118
- onMouseDown: p(e.onMouseDown, (t) => {
119
- o ? u.onItemFocus(m) : t.preventDefault();
120
- }),
121
- onFocus: p(e.onFocus, () => u.onItemFocus(m)),
122
- onKeyDown: p(e.onKeyDown, (t) => {
123
- if (t.key === "Tab" && t.shiftKey) {
124
- u.onItemShiftTab();
125
- return;
126
- }
127
- if (t.target !== t.currentTarget) return;
128
- const i = se(t, u.orientation, u.dir);
129
- if (i !== void 0) {
130
- if (t.metaKey || t.ctrlKey || t.altKey || t.shiftKey) return;
131
- t.preventDefault();
132
- let a = F().filter((l) => l.focusable).map((l) => l.ref.current);
133
- if (i === "last") a.reverse();
134
- else if (i === "prev" || i === "next") {
135
- i === "prev" && a.reverse();
136
- const l = a.indexOf(t.currentTarget);
137
- a = u.loop ? ce(a, l + 1) : a.slice(l + 1);
138
- }
139
- setTimeout(() => M(a));
140
- }
141
- }),
142
- children: typeof v == "function" ? v({ isCurrentTabStop: b, hasTabStop: E != null }) : v
143
- }
144
- )
145
- }
146
- );
147
- }
148
- );
149
- j.displayName = K;
150
- var re = {
151
- ArrowLeft: "prev",
152
- ArrowUp: "prev",
153
- ArrowRight: "next",
154
- ArrowDown: "next",
155
- PageUp: "first",
156
- Home: "first",
157
- PageDown: "last",
158
- End: "last"
159
- };
160
- function ne(e, r) {
161
- return r !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
162
- }
163
- function se(e, r, c) {
164
- const o = ne(e.key, c);
165
- if (!(r === "vertical" && ["ArrowLeft", "ArrowRight"].includes(o)) && !(r === "horizontal" && ["ArrowUp", "ArrowDown"].includes(o)))
166
- return re[o];
1
+ import { DayFlag as s } from "./index131.js";
2
+ var d;
3
+ (function(e) {
4
+ e[e.Today = 0] = "Today", e[e.Selected = 1] = "Selected", e[e.LastFocused = 2] = "LastFocused", e[e.FocusedModifier = 3] = "FocusedModifier";
5
+ })(d || (d = {}));
6
+ function l(e) {
7
+ return !e[s.disabled] && !e[s.hidden] && !e[s.outside];
167
8
  }
168
- function M(e, r = !1) {
169
- const c = document.activeElement;
170
- for (const o of e)
171
- if (o === c || (o.focus({ preventScroll: r }), document.activeElement !== c)) return;
172
- }
173
- function ce(e, r) {
174
- return e.map((c, o) => e[(r + o) % e.length]);
9
+ function F(e, u, t, n) {
10
+ let f, c = -1;
11
+ for (const o of e) {
12
+ const a = u(o);
13
+ l(a) && (a[s.focused] && c < d.FocusedModifier ? (f = o, c = d.FocusedModifier) : n?.isEqualTo(o) && c < d.LastFocused ? (f = o, c = d.LastFocused) : t(o.date) && c < d.Selected ? (f = o, c = d.Selected) : a[s.today] && c < d.Today && (f = o, c = d.Today));
14
+ }
15
+ return f || (f = e.find((o) => l(u(o)))), f;
175
16
  }
176
- var ge = O, Re = j;
177
17
  export {
178
- Re as Item,
179
- ge as Root,
180
- O as RovingFocusGroup,
181
- j as RovingFocusGroupItem,
182
- Fe as createRovingFocusGroupScope
18
+ F as calculateFocusTarget
183
19
  };
184
20
  //# sourceMappingURL=index240.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index240.js","sources":["../../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/roving-focus-group.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { createCollection } from \"@radix-ui/react-collection\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useId } from \"@radix-ui/react-id\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { useDirection } from \"@radix-ui/react-direction\";\nimport { jsx } from \"react/jsx-runtime\";\nvar ENTRY_FOCUS = \"rovingFocusGroup.onEntryFocus\";\nvar EVENT_OPTIONS = { bubbles: false, cancelable: true };\nvar GROUP_NAME = \"RovingFocusGroup\";\nvar [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);\nvar [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(\n GROUP_NAME,\n [createCollectionScope]\n);\nvar [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);\nvar RovingFocusGroup = React.forwardRef(\n (props, forwardedRef) => {\n return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });\n }\n);\nRovingFocusGroup.displayName = GROUP_NAME;\nvar RovingFocusGroupImpl = React.forwardRef((props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n orientation,\n loop = false,\n dir,\n currentTabStopId: currentTabStopIdProp,\n defaultCurrentTabStopId,\n onCurrentTabStopIdChange,\n onEntryFocus,\n preventScrollOnEntryFocus = false,\n ...groupProps\n } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const direction = useDirection(dir);\n const [currentTabStopId, setCurrentTabStopId] = useControllableState({\n prop: currentTabStopIdProp,\n defaultProp: defaultCurrentTabStopId ?? null,\n onChange: onCurrentTabStopIdChange,\n caller: GROUP_NAME\n });\n const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);\n const handleEntryFocus = useCallbackRef(onEntryFocus);\n const getItems = useCollection(__scopeRovingFocusGroup);\n const isClickFocusRef = React.useRef(false);\n const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n node.addEventListener(ENTRY_FOCUS, handleEntryFocus);\n return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);\n }\n }, [handleEntryFocus]);\n return /* @__PURE__ */ jsx(\n RovingFocusProvider,\n {\n scope: __scopeRovingFocusGroup,\n orientation,\n dir: direction,\n loop,\n currentTabStopId,\n onItemFocus: React.useCallback(\n (tabStopId) => setCurrentTabStopId(tabStopId),\n [setCurrentTabStopId]\n ),\n onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []),\n onFocusableItemAdd: React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount + 1),\n []\n ),\n onFocusableItemRemove: React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount - 1),\n []\n ),\n children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,\n \"data-orientation\": orientation,\n ...groupProps,\n ref: composedRefs,\n style: { outline: \"none\", ...props.style },\n onMouseDown: composeEventHandlers(props.onMouseDown, () => {\n isClickFocusRef.current = true;\n }),\n onFocus: composeEventHandlers(props.onFocus, (event) => {\n const isKeyboardFocus = !isClickFocusRef.current;\n if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {\n const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);\n event.currentTarget.dispatchEvent(entryFocusEvent);\n if (!entryFocusEvent.defaultPrevented) {\n const items = getItems().filter((item) => item.focusable);\n const activeItem = items.find((item) => item.active);\n const currentItem = items.find((item) => item.id === currentTabStopId);\n const candidateItems = [activeItem, currentItem, ...items].filter(\n Boolean\n );\n const candidateNodes = candidateItems.map((item) => item.ref.current);\n focusFirst(candidateNodes, preventScrollOnEntryFocus);\n }\n }\n isClickFocusRef.current = false;\n }),\n onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))\n }\n )\n }\n );\n});\nvar ITEM_NAME = \"RovingFocusGroupItem\";\nvar RovingFocusGroupItem = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n focusable = true,\n active = false,\n tabStopId,\n children,\n ...itemProps\n } = props;\n const autoId = useId();\n const id = tabStopId || autoId;\n const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);\n const isCurrentTabStop = context.currentTabStopId === id;\n const getItems = useCollection(__scopeRovingFocusGroup);\n const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;\n React.useEffect(() => {\n if (focusable) {\n onFocusableItemAdd();\n return () => onFocusableItemRemove();\n }\n }, [focusable, onFocusableItemAdd, onFocusableItemRemove]);\n return /* @__PURE__ */ jsx(\n Collection.ItemSlot,\n {\n scope: __scopeRovingFocusGroup,\n id,\n focusable,\n active,\n children: /* @__PURE__ */ jsx(\n Primitive.span,\n {\n tabIndex: isCurrentTabStop ? 0 : -1,\n \"data-orientation\": context.orientation,\n ...itemProps,\n ref: forwardedRef,\n onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {\n if (!focusable) event.preventDefault();\n else context.onItemFocus(id);\n }),\n onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key === \"Tab\" && event.shiftKey) {\n context.onItemShiftTab();\n return;\n }\n if (event.target !== event.currentTarget) return;\n const focusIntent = getFocusIntent(event, context.orientation, context.dir);\n if (focusIntent !== void 0) {\n if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;\n event.preventDefault();\n const items = getItems().filter((item) => item.focusable);\n let candidateNodes = items.map((item) => item.ref.current);\n if (focusIntent === \"last\") candidateNodes.reverse();\n else if (focusIntent === \"prev\" || focusIntent === \"next\") {\n if (focusIntent === \"prev\") candidateNodes.reverse();\n const currentIndex = candidateNodes.indexOf(event.currentTarget);\n candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);\n }\n setTimeout(() => focusFirst(candidateNodes));\n }\n }),\n children: typeof children === \"function\" ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null }) : children\n }\n )\n }\n );\n }\n);\nRovingFocusGroupItem.displayName = ITEM_NAME;\nvar MAP_KEY_TO_FOCUS_INTENT = {\n ArrowLeft: \"prev\",\n ArrowUp: \"prev\",\n ArrowRight: \"next\",\n ArrowDown: \"next\",\n PageUp: \"first\",\n Home: \"first\",\n PageDown: \"last\",\n End: \"last\"\n};\nfunction getDirectionAwareKey(key, dir) {\n if (dir !== \"rtl\") return key;\n return key === \"ArrowLeft\" ? \"ArrowRight\" : key === \"ArrowRight\" ? \"ArrowLeft\" : key;\n}\nfunction getFocusIntent(event, orientation, dir) {\n const key = getDirectionAwareKey(event.key, dir);\n if (orientation === \"vertical\" && [\"ArrowLeft\", \"ArrowRight\"].includes(key)) return void 0;\n if (orientation === \"horizontal\" && [\"ArrowUp\", \"ArrowDown\"].includes(key)) return void 0;\n return MAP_KEY_TO_FOCUS_INTENT[key];\n}\nfunction focusFirst(candidates, preventScroll = false) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus({ preventScroll });\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\nfunction wrapArray(array, startIndex) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\nvar Root = RovingFocusGroup;\nvar Item = RovingFocusGroupItem;\nexport {\n Item,\n Root,\n RovingFocusGroup,\n RovingFocusGroupItem,\n createRovingFocusGroupScope\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["ENTRY_FOCUS","EVENT_OPTIONS","GROUP_NAME","Collection","useCollection","createCollectionScope","createCollection","createRovingFocusGroupContext","createRovingFocusGroupScope","createContextScope","RovingFocusProvider","useRovingFocusContext","RovingFocusGroup","React","props","forwardedRef","jsx","RovingFocusGroupImpl","__scopeRovingFocusGroup","orientation","loop","dir","currentTabStopIdProp","defaultCurrentTabStopId","onCurrentTabStopIdChange","onEntryFocus","preventScrollOnEntryFocus","groupProps","ref","composedRefs","useComposedRefs","direction","useDirection","currentTabStopId","setCurrentTabStopId","useControllableState","isTabbingBackOut","setIsTabbingBackOut","handleEntryFocus","useCallbackRef","getItems","isClickFocusRef","focusableItemsCount","setFocusableItemsCount","node","tabStopId","prevCount","Primitive","composeEventHandlers","event","isKeyboardFocus","entryFocusEvent","items","item","activeItem","currentItem","candidateNodes","focusFirst","ITEM_NAME","RovingFocusGroupItem","focusable","active","children","itemProps","autoId","useId","id","context","isCurrentTabStop","onFocusableItemAdd","onFocusableItemRemove","focusIntent","getFocusIntent","currentIndex","wrapArray","MAP_KEY_TO_FOCUS_INTENT","getDirectionAwareKey","key","candidates","preventScroll","PREVIOUSLY_FOCUSED_ELEMENT","candidate","array","startIndex","_","index","Root","Item"],"mappings":";;;;;;;;;;;AAcA,IAAIA,IAAc,iCACdC,IAAgB,EAAE,SAAS,IAAO,YAAY,GAAI,GAClDC,IAAa,oBACb,CAACC,GAAYC,GAAeC,CAAqB,IAAIC,EAAiBJ,CAAU,GAChF,CAACK,GAA+BC,EAA2B,IAAIC;AAAA,EACjEP;AAAA,EACA,CAACG,CAAqB;AACxB,GACI,CAACK,IAAqBC,EAAqB,IAAIJ,EAA8BL,CAAU,GACvFU,IAAmBC,EAAM;AAAA,EAC3B,CAACC,GAAOC,MACiBC,gBAAAA,MAAIb,EAAW,UAAU,EAAE,OAAOW,EAAM,yBAAyB,UAA0BE,gBAAAA,MAAIb,EAAW,MAAM,EAAE,OAAOW,EAAM,yBAAyB,UAA0BE,gBAAAA,EAAAA,IAAIC,IAAsB,EAAE,GAAGH,GAAO,KAAKC,GAAc,EAAC,CAAE,EAAC,CAAE;AAE5Q;AACAH,EAAiB,cAAcV;AAC/B,IAAIe,KAAuBJ,EAAM,WAAW,CAACC,GAAOC,MAAiB;AACnE,QAAM;AAAA,IACJ,yBAAAG;AAAA,IACA,aAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,KAAAC;AAAA,IACA,kBAAkBC;AAAA,IACl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,EAAAF,MAAgB,cAAc,CAAC,aAAa,YAAY,EAAE,SAAS0D,CAAG,MACtE,EAAA1D,MAAgB,gBAAgB,CAAC,WAAW,WAAW,EAAE,SAAS0D,CAAG;AACzE,WAAOF,GAAwBE,CAAG;AACpC;AACA,SAASpB,EAAWqB,GAAYC,IAAgB,IAAO;AACrD,QAAMC,IAA6B,SAAS;AAC5C,aAAWC,KAAaH;AAGtB,QAFIG,MAAcD,MAClBC,EAAU,MAAM,EAAE,eAAAF,GAAe,GAC7B,SAAS,kBAAkBC,GAA4B;AAE/D;AACA,SAASN,GAAUQ,GAAOC,GAAY;AACpC,SAAOD,EAAM,IAAI,CAACE,GAAGC,MAAUH,GAAOC,IAAaE,KAASH,EAAM,MAAM,CAAC;AAC3E;AACG,IAACI,KAAO1E,GACP2E,KAAO5B;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index240.js","sources":["../../../node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js"],"sourcesContent":["import { DayFlag } from \"../UI.js\";\nvar FocusTargetPriority;\n(function (FocusTargetPriority) {\n FocusTargetPriority[FocusTargetPriority[\"Today\"] = 0] = \"Today\";\n FocusTargetPriority[FocusTargetPriority[\"Selected\"] = 1] = \"Selected\";\n FocusTargetPriority[FocusTargetPriority[\"LastFocused\"] = 2] = \"LastFocused\";\n FocusTargetPriority[FocusTargetPriority[\"FocusedModifier\"] = 3] = \"FocusedModifier\";\n})(FocusTargetPriority || (FocusTargetPriority = {}));\n/**\n * Determines if a day is focusable based on its modifiers.\n *\n * A day is considered focusable if it is not disabled, hidden, or outside the\n * displayed month.\n *\n * @param modifiers The modifiers applied to the day.\n * @returns `true` if the day is focusable, otherwise `false`.\n */\nfunction isFocusableDay(modifiers) {\n return (!modifiers[DayFlag.disabled] &&\n !modifiers[DayFlag.hidden] &&\n !modifiers[DayFlag.outside]);\n}\n/**\n * Calculates the focus target day based on priority.\n *\n * This function determines the day that should receive focus in the calendar,\n * prioritizing days with specific modifiers (e.g., \"focused\", \"today\") or\n * selection states.\n *\n * @param days The array of `CalendarDay` objects to evaluate.\n * @param getModifiers A function to retrieve the modifiers for a given day.\n * @param isSelected A function to determine if a day is selected.\n * @param lastFocused The last focused day, if any.\n * @returns The `CalendarDay` that should receive focus, or `undefined` if no\n * focusable day is found.\n */\nexport function calculateFocusTarget(days, getModifiers, isSelected, lastFocused) {\n let focusTarget;\n let foundFocusTargetPriority = -1;\n for (const day of days) {\n const modifiers = getModifiers(day);\n if (isFocusableDay(modifiers)) {\n if (modifiers[DayFlag.focused] &&\n foundFocusTargetPriority < FocusTargetPriority.FocusedModifier) {\n focusTarget = day;\n foundFocusTargetPriority = FocusTargetPriority.FocusedModifier;\n }\n else if (lastFocused?.isEqualTo(day) &&\n foundFocusTargetPriority < FocusTargetPriority.LastFocused) {\n focusTarget = day;\n foundFocusTargetPriority = FocusTargetPriority.LastFocused;\n }\n else if (isSelected(day.date) &&\n foundFocusTargetPriority < FocusTargetPriority.Selected) {\n focusTarget = day;\n foundFocusTargetPriority = FocusTargetPriority.Selected;\n }\n else if (modifiers[DayFlag.today] &&\n foundFocusTargetPriority < FocusTargetPriority.Today) {\n focusTarget = day;\n foundFocusTargetPriority = FocusTargetPriority.Today;\n }\n }\n }\n if (!focusTarget) {\n // Return the first day that is focusable\n focusTarget = days.find((day) => isFocusableDay(getModifiers(day)));\n }\n return focusTarget;\n}\n"],"names":["FocusTargetPriority","isFocusableDay","modifiers","DayFlag","calculateFocusTarget","days","getModifiers","isSelected","lastFocused","focusTarget","foundFocusTargetPriority","day"],"mappings":";AACA,IAAIA;AAAA,CACH,SAAUA,GAAqB;AAC5B,EAAAA,EAAoBA,EAAoB,QAAW,CAAC,IAAI,SACxDA,EAAoBA,EAAoB,WAAc,CAAC,IAAI,YAC3DA,EAAoBA,EAAoB,cAAiB,CAAC,IAAI,eAC9DA,EAAoBA,EAAoB,kBAAqB,CAAC,IAAI;AACtE,GAAGA,MAAwBA,IAAsB,CAAA,EAAG;AAUpD,SAASC,EAAeC,GAAW;AAC/B,SAAQ,CAACA,EAAUC,EAAQ,QAAQ,KAC/B,CAACD,EAAUC,EAAQ,MAAM,KACzB,CAACD,EAAUC,EAAQ,OAAO;AAClC;AAeO,SAASC,EAAqBC,GAAMC,GAAcC,GAAYC,GAAa;AAC9E,MAAIC,GACAC,IAA2B;AAC/B,aAAWC,KAAON,GAAM;AACpB,UAAMH,IAAYI,EAAaK,CAAG;AAClC,IAAIV,EAAeC,CAAS,MACpBA,EAAUC,EAAQ,OAAO,KACzBO,IAA2BV,EAAoB,mBAC/CS,IAAcE,GACdD,IAA2BV,EAAoB,mBAE1CQ,GAAa,UAAUG,CAAG,KAC/BD,IAA2BV,EAAoB,eAC/CS,IAAcE,GACdD,IAA2BV,EAAoB,eAE1CO,EAAWI,EAAI,IAAI,KACxBD,IAA2BV,EAAoB,YAC/CS,IAAcE,GACdD,IAA2BV,EAAoB,YAE1CE,EAAUC,EAAQ,KAAK,KAC5BO,IAA2BV,EAAoB,UAC/CS,IAAcE,GACdD,IAA2BV,EAAoB;AAAA,EAG3D;AACA,SAAKS,MAEDA,IAAcJ,EAAK,KAAK,CAACM,MAAQV,EAAeK,EAAaK,CAAG,CAAC,CAAC,IAE/DF;AACX;","x_google_ignoreList":[0]}
package/dist/index241.js CHANGED
@@ -1,50 +1,13 @@
1
- import * as l from "react";
2
- import { composeRefs as m } from "./index53.js";
3
- import { j as u } from "./index29.js";
4
- // @__NO_SIDE_EFFECTS__
5
- function x(e) {
6
- const r = /* @__PURE__ */ y(e), t = l.forwardRef((o, n) => {
7
- const { children: i, ...c } = o, s = l.Children.toArray(i), a = s.find(g);
8
- if (a) {
9
- const f = a.props.children, d = s.map((p) => p === a ? l.Children.count(f) > 1 ? l.Children.only(null) : l.isValidElement(f) ? f.props.children : null : p);
10
- return /* @__PURE__ */ u.jsx(r, { ...c, ref: n, children: l.isValidElement(f) ? l.cloneElement(f, void 0, d) : null });
11
- }
12
- return /* @__PURE__ */ u.jsx(r, { ...c, ref: n, children: i });
13
- });
14
- return t.displayName = `${e}.Slot`, t;
15
- }
16
- // @__NO_SIDE_EFFECTS__
17
- function y(e) {
18
- const r = l.forwardRef((t, o) => {
19
- const { children: n, ...i } = t;
20
- if (l.isValidElement(n)) {
21
- const c = R(n), s = C(i, n.props);
22
- return n.type !== l.Fragment && (s.ref = o ? m(o, c) : c), l.cloneElement(n, s);
23
- }
24
- return l.Children.count(n) > 1 ? l.Children.only(null) : null;
25
- });
26
- return r.displayName = `${e}.SlotClone`, r;
27
- }
28
- var E = /* @__PURE__ */ Symbol("radix.slottable");
29
- function g(e) {
30
- return l.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === E;
31
- }
32
- function C(e, r) {
33
- const t = { ...r };
34
- for (const o in r) {
35
- const n = e[o], i = r[o];
36
- /^on[A-Z]/.test(o) ? n && i ? t[o] = (...s) => {
37
- const a = i(...s);
38
- return n(...s), a;
39
- } : n && (t[o] = n) : o === "style" ? t[o] = { ...n, ...i } : o === "className" && (t[o] = [n, i].filter(Boolean).join(" "));
40
- }
41
- return { ...e, ...t };
42
- }
43
- function R(e) {
44
- let r = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, t = r && "isReactWarning" in r && r.isReactWarning;
45
- return t ? e.ref : (r = Object.getOwnPropertyDescriptor(e, "ref")?.get, t = r && "isReactWarning" in r && r.isReactWarning, t ? e.props.ref : e.props.ref || e.ref);
1
+ import { dateMatchModifiers as u } from "./index33.js";
2
+ import { getFocusableDate as g } from "./index284.js";
3
+ import { CalendarDay as m } from "./index193.js";
4
+ function h(t, i, a, d, f, e, n, s = 0) {
5
+ if (s > 365)
6
+ return;
7
+ const o = g(t, i, a.date, d, f, e, n), r = !!(e.disabled && u(o, e.disabled, n)), l = !!(e.hidden && u(o, e.hidden, n)), D = o, c = new m(o, D, n);
8
+ return !r && !l ? c : h(t, i, c, d, f, e, n, s + 1);
46
9
  }
47
10
  export {
48
- x as createSlot
11
+ h as getNextFocus
49
12
  };
50
13
  //# sourceMappingURL=index241.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index241.js","sources":["../../../node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-slot/dist/index.mjs"],"sourcesContent":["// src/slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment as Fragment2, jsx } from \"react/jsx-runtime\";\n// @__NO_SIDE_EFFECTS__\nfunction createSlot(ownerName) {\n const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);\n const Slot2 = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n });\n Slot2.displayName = `${ownerName}.Slot`;\n return Slot2;\n}\nvar Slot = /* @__PURE__ */ createSlot(\"Slot\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlotClone(ownerName) {\n const SlotClone = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props2 = mergeProps(slotProps, children.props);\n if (children.type !== React.Fragment) {\n props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props2);\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\nvar SLOTTABLE_IDENTIFIER = Symbol(\"radix.slottable\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlottable(ownerName) {\n const Slottable2 = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment2, { children });\n };\n Slottable2.displayName = `${ownerName}.Slottable`;\n Slottable2.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable2;\n}\nvar Slottable = /* @__PURE__ */ createSlottable(\"Slottable\");\nfunction isSlottable(child) {\n return React.isValidElement(child) && typeof child.type === \"function\" && \"__radixId\" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nexport {\n Slot as Root,\n Slot,\n Slottable,\n createSlot,\n createSlottable\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["createSlot","ownerName","SlotClone","createSlotClone","Slot2","React","props","forwardedRef","children","slotProps","childrenArray","slottable","isSlottable","newElement","newChildren","child","jsx","childrenRef","getElementRef","props2","mergeProps","composeRefs","SLOTTABLE_IDENTIFIER","childProps","over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M,MAEhBA,EAAQ,MAAM,OAAOA,EAAQ;AACtC;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index241.js","sources":["../../../node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js"],"sourcesContent":["import { CalendarDay } from \"../classes/index.js\";\nimport { dateMatchModifiers } from \"../utils/dateMatchModifiers.js\";\nimport { getFocusableDate } from \"./getFocusableDate.js\";\n/**\n * Determines the next focusable day in the calendar.\n *\n * This function recursively calculates the next focusable day based on the\n * movement direction and modifiers applied to the days.\n *\n * @param moveBy The unit of movement (e.g., \"day\", \"week\").\n * @param moveDir The direction of movement (\"before\" or \"after\").\n * @param refDay The currently focused day.\n * @param calendarStartMonth The earliest month the user can navigate to.\n * @param calendarEndMonth The latest month the user can navigate to.\n * @param props The DayPicker props, including modifiers and configuration\n * options.\n * @param dateLib The date library to use for date manipulation.\n * @param attempt The current recursion attempt (used to limit recursion depth).\n * @returns The next focusable day, or `undefined` if no focusable day is found.\n */\nexport function getNextFocus(moveBy, moveDir, refDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt = 0) {\n if (attempt > 365) {\n // Limit the recursion to 365 attempts\n return undefined;\n }\n const focusableDate = getFocusableDate(moveBy, moveDir, refDay.date, calendarStartMonth, calendarEndMonth, props, dateLib);\n const isDisabled = Boolean(props.disabled &&\n dateMatchModifiers(focusableDate, props.disabled, dateLib));\n const isHidden = Boolean(props.hidden && dateMatchModifiers(focusableDate, props.hidden, dateLib));\n const targetMonth = focusableDate;\n const focusDay = new CalendarDay(focusableDate, targetMonth, dateLib);\n if (!isDisabled && !isHidden) {\n return focusDay;\n }\n // Recursively attempt to find the next focusable date\n return getNextFocus(moveBy, moveDir, focusDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt + 1);\n}\n"],"names":["getNextFocus","moveBy","moveDir","refDay","calendarStartMonth","calendarEndMonth","props","dateLib","attempt","focusableDate","getFocusableDate","isDisabled","dateMatchModifiers","isHidden","targetMonth","focusDay","CalendarDay"],"mappings":";;;AAoBO,SAASA,EAAaC,GAAQC,GAASC,GAAQC,GAAoBC,GAAkBC,GAAOC,GAASC,IAAU,GAAG;AACrH,MAAIA,IAAU;AAEV;AAEJ,QAAMC,IAAgBC,EAAiBT,GAAQC,GAASC,EAAO,MAAMC,GAAoBC,GAAkBC,GAAOC,CAAO,GACnHI,IAAa,GAAQL,EAAM,YAC7BM,EAAmBH,GAAeH,EAAM,UAAUC,CAAO,IACvDM,IAAW,GAAQP,EAAM,UAAUM,EAAmBH,GAAeH,EAAM,QAAQC,CAAO,IAC1FO,IAAcL,GACdM,IAAW,IAAIC,EAAYP,GAAeK,GAAaP,CAAO;AACpE,SAAI,CAACI,KAAc,CAACE,IACTE,IAGJf,EAAaC,GAAQC,GAASa,GAAUX,GAAoBC,GAAkBC,GAAOC,GAASC,IAAU,CAAC;AACpH;","x_google_ignoreList":[0]}
package/dist/index242.js CHANGED
@@ -1,17 +1,22 @@
1
- import h from "./index169.js";
2
- function L(i, r, u) {
3
- return s(i, r, void 0, u);
4
- }
5
- function s(i, r, u, e) {
6
- r && (e = new h(e.metadata), e.selectNumberingPlan(r));
7
- var f = e.type(u), n = f && f.possibleLengths() || e.possibleLengths();
8
- if (!n)
9
- return "IS_POSSIBLE";
10
- var t = i.length, l = n[0];
11
- return l === t ? "IS_POSSIBLE" : l > t ? "TOO_SHORT" : n[n.length - 1] < t ? "TOO_LONG" : n.indexOf(t, 1) >= 0 ? "IS_POSSIBLE" : "INVALID_LENGTH";
1
+ import { useControlledValue as x } from "./index239.js";
2
+ function C(i, d) {
3
+ const { selected: s, required: f, onSelect: l } = i, [r, m] = x(s, l ? s : void 0), e = l ? s : r, { isSameDay: o } = d, u = (t) => e?.some((c) => o(c, t)) ?? !1, { min: S, max: a } = i;
4
+ return {
5
+ selected: e,
6
+ select: (t, c, h) => {
7
+ let n = [...e ?? []];
8
+ if (u(t)) {
9
+ if (e?.length === S || f && e?.length === 1)
10
+ return;
11
+ n = e?.filter((y) => !o(y, t));
12
+ } else
13
+ e?.length === a ? n = [t] : n = [...n, t];
14
+ return l || m(n), l?.(n, t, c, h), n;
15
+ },
16
+ isSelected: u
17
+ };
12
18
  }
13
19
  export {
14
- s as checkNumberLengthForType,
15
- L as default
20
+ C as useMulti
16
21
  };
17
22
  //# sourceMappingURL=index242.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index242.js","sources":["../../../node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js"],"sourcesContent":["import Metadata from '../metadata.js';\nimport mergeArrays from './mergeArrays.js';\nexport default function checkNumberLength(nationalNumber, country, metadata) {\n return checkNumberLengthForType(nationalNumber, country, undefined, metadata);\n}\n\n// Checks whether a number is possible for a certain `country` based on the number length.\n//\n// This function is not supported by metadata generated with ancient versions of\n// `libphonenumber-js` (before version `1.0.18`) which didn't include \"possible lengths\".\n//\n// There was also a known issue with `checkNumberLength()` function:\n// if a number is possible only in a certain `country` among several `countries`\n// that share the same \"country calling code\", that function would check\n// the possibility of the phone number only in the \"main\" `country` for the \"country calling code\"\n// and would not check if it's actually be possible in the speciifc `country`.\n//\n// For example, \"+1310xxxx\" numbers are valid in Canada.\n// However, they are not possible in the US due to being too short.\n// Since Canada and the US share the same country calling code — \"+1\" —\n// `checkNumberLength()` function used to return not \"IS_POSSIBLE\" for \"+1310xxxx\" numbers.\n//\n// In such cases, when using \"/max\" metadata, `isValid()` could output `true`\n// but at the same time `isPossible()` could output `false`, which was contradictory.\n//\n// See https://issuetracker.google.com/issues/335892662 for the discusson in Google's issues.\n//\n// The solution suggested by Google was implemented: an optional `country` argument\n// was added to `checkNumberLength()` function. If present, that `country` will be used\n// to check phone number length for that specific `country` rather than the \"main\" country\n// for the shared \"country calling code\".\n//\nexport function checkNumberLengthForType(nationalNumber, country, type, metadata) {\n // If the exact `country` is specified, it's no necessarily already selected in `metadata`.\n // Most likely, in cases when there're multiple countries corresponding to the same\n // \"country calling code\", the \"main\" country for that \"country calling code\" will be selected.\n if (country) {\n metadata = new Metadata(metadata.metadata);\n metadata.selectNumberingPlan(country);\n }\n var type_info = metadata.type(type);\n\n // There should always be \"<possiblePengths/>\" set for every type element.\n // This is declared in the XML schema.\n // For size efficiency, where a sub-description (e.g. fixed-line)\n // has the same \"<possiblePengths/>\" as the \"general description\", this is missing,\n // so we fall back to the \"general description\". Where no numbers of the type\n // exist at all, there is one possible length (-1) which is guaranteed\n // not to match the length of any real phone number.\n var possible_lengths = type_info && type_info.possibleLengths() || metadata.possibleLengths();\n // let local_lengths = type_info && type.possibleLengthsLocal() || metadata.possibleLengthsLocal()\n\n // Metadata before version `1.0.18` didn't contain `possible_lengths`.\n if (!possible_lengths) {\n return 'IS_POSSIBLE';\n }\n if (type === 'FIXED_LINE_OR_MOBILE') {\n // No such country in metadata.\n /* istanbul ignore next */\n if (!metadata.type('FIXED_LINE')) {\n // The rare case has been encountered where no fixedLine data is available\n // (true for some non-geographic entities), so we just check mobile.\n return checkNumberLengthForType(nationalNumber, country, 'MOBILE', metadata);\n }\n var mobile_type = metadata.type('MOBILE');\n if (mobile_type) {\n // Merge the mobile data in if there was any. \"Concat\" creates a new\n // array, it doesn't edit possible_lengths in place, so we don't need a copy.\n // Note that when adding the possible lengths from mobile, we have\n // to again check they aren't empty since if they are this indicates\n // they are the same as the general desc and should be obtained from there.\n possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths());\n // The current list is sorted; we need to merge in the new list and\n // re-sort (duplicates are okay). Sorting isn't so expensive because\n // the lists are very small.\n\n // if (local_lengths) {\n // \tlocal_lengths = mergeArrays(local_lengths, mobile_type.possibleLengthsLocal())\n // } else {\n // \tlocal_lengths = mobile_type.possibleLengthsLocal()\n // }\n }\n }\n // If the type doesn't exist then return 'INVALID_LENGTH'.\n else if (type && !type_info) {\n return 'INVALID_LENGTH';\n }\n var actual_length = nationalNumber.length;\n\n // In `libphonenumber-js` all \"local-only\" formats are dropped for simplicity.\n // // This is safe because there is never an overlap beween the possible lengths\n // // and the local-only lengths; this is checked at build time.\n // if (local_lengths && local_lengths.indexOf(nationalNumber.length) >= 0)\n // {\n // \treturn 'IS_POSSIBLE_LOCAL_ONLY'\n // }\n\n var minimum_length = possible_lengths[0];\n if (minimum_length === actual_length) {\n return 'IS_POSSIBLE';\n }\n if (minimum_length > actual_length) {\n return 'TOO_SHORT';\n }\n if (possible_lengths[possible_lengths.length - 1] < actual_length) {\n return 'TOO_LONG';\n }\n\n // We skip the first element since we've already checked it.\n return possible_lengths.indexOf(actual_length, 1) >= 0 ? 'IS_POSSIBLE' : 'INVALID_LENGTH';\n}\n//# sourceMappingURL=checkNumberLength.js.map"],"names":["checkNumberLength","nationalNumber","country","metadata","checkNumberLengthForType","type","Metadata","type_info","possible_lengths","actual_length","minimum_length"],"mappings":";AAEe,SAASA,EAAkBC,GAAgBC,GAASC,GAAU;AAC3E,SAAOC,EAAyBH,GAAgBC,GAAS,QAAWC,CAAQ;AAC9E;AA4BO,SAASC,EAAyBH,GAAgBC,GAASG,GAAMF,GAAU;AAIhF,EAAID,MACFC,IAAW,IAAIG,EAASH,EAAS,QAAQ,GACzCA,EAAS,oBAAoBD,CAAO;AAEtC,MAAIK,IAAYJ,EAAS,KAAKE,CAAI,GAS9BG,IAAmBD,KAAaA,EAAU,gBAAe,KAAMJ,EAAS,gBAAe;AAI3F,MAAI,CAACK;AACH,WAAO;AAiCT,MAAIC,IAAgBR,EAAe,QAU/BS,IAAiBF,EAAiB,CAAC;AACvC,SAAIE,MAAmBD,IACd,gBAELC,IAAiBD,IACZ,cAELD,EAAiBA,EAAiB,SAAS,CAAC,IAAIC,IAC3C,aAIFD,EAAiB,QAAQC,GAAe,CAAC,KAAK,IAAI,gBAAgB;AAC3E;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index242.js","sources":["../../../node_modules/react-day-picker/dist/esm/selection/useMulti.js"],"sourcesContent":["import { useControlledValue } from \"../helpers/useControlledValue.js\";\n/**\n * Hook to manage multiple-date selection in the DayPicker component.\n *\n * @template T - The type of DayPicker props.\n * @param props - The DayPicker props.\n * @param dateLib - The date utility library instance.\n * @returns An object containing the selected dates, a function to select dates,\n * and a function to check if a date is selected.\n */\nexport function useMulti(props, dateLib) {\n const { selected: initiallySelected, required, onSelect, } = props;\n const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : undefined);\n const selected = !onSelect ? internallySelected : initiallySelected;\n const { isSameDay } = dateLib;\n const isSelected = (date) => {\n return selected?.some((d) => isSameDay(d, date)) ?? false;\n };\n const { min, max } = props;\n const select = (triggerDate, modifiers, e) => {\n let newDates = [...(selected ?? [])];\n if (isSelected(triggerDate)) {\n if (selected?.length === min) {\n // Min value reached, do nothing\n return;\n }\n if (required && selected?.length === 1) {\n // Required value already selected do nothing\n return;\n }\n newDates = selected?.filter((d) => !isSameDay(d, triggerDate));\n }\n else {\n if (selected?.length === max) {\n // Max value reached, reset the selection to date\n newDates = [triggerDate];\n }\n else {\n // Add the date to the selection\n newDates = [...newDates, triggerDate];\n }\n }\n if (!onSelect) {\n setSelected(newDates);\n }\n onSelect?.(newDates, triggerDate, modifiers, e);\n return newDates;\n };\n return {\n selected,\n select,\n isSelected,\n };\n}\n"],"names":["useMulti","props","dateLib","initiallySelected","required","onSelect","internallySelected","setSelected","useControlledValue","selected","isSameDay","isSelected","date","d","min","max","triggerDate","modifiers","e","newDates"],"mappings":";AAUO,SAASA,EAASC,GAAOC,GAAS;AACrC,QAAM,EAAE,UAAUC,GAAmB,UAAAC,GAAU,UAAAC,EAAQ,IAAMJ,GACvD,CAACK,GAAoBC,CAAW,IAAIC,EAAmBL,GAAmBE,IAAWF,IAAoB,MAAS,GAClHM,IAAYJ,IAAgCF,IAArBG,GACvB,EAAE,WAAAI,EAAS,IAAKR,GAChBS,IAAa,CAACC,MACTH,GAAU,KAAK,CAACI,MAAMH,EAAUG,GAAGD,CAAI,CAAC,KAAK,IAElD,EAAE,KAAAE,GAAK,KAAAC,EAAG,IAAKd;AA8BrB,SAAO;AAAA,IACH,UAAAQ;AAAA,IACA,QA/BW,CAACO,GAAaC,GAAWC,MAAM;AAC1C,UAAIC,IAAW,CAAC,GAAIV,KAAY,CAAA,CAAG;AACnC,UAAIE,EAAWK,CAAW,GAAG;AAKzB,YAJIP,GAAU,WAAWK,KAIrBV,KAAYK,GAAU,WAAW;AAEjC;AAEJ,QAAAU,IAAWV,GAAU,OAAO,CAACI,MAAM,CAACH,EAAUG,GAAGG,CAAW,CAAC;AAAA,MACjE;AAEI,QAAIP,GAAU,WAAWM,IAErBI,IAAW,CAACH,CAAW,IAIvBG,IAAW,CAAC,GAAGA,GAAUH,CAAW;AAG5C,aAAKX,KACDE,EAAYY,CAAQ,GAExBd,IAAWc,GAAUH,GAAaC,GAAWC,CAAC,GACvCC;AAAA,IACX;AAAA,IAII,YAAAR;AAAA,EACR;AACA;","x_google_ignoreList":[0]}