se-design 1.0.90-dev.0 → 1.0.90

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 (462) hide show
  1. package/dist/assets/style.css +1 -1
  2. package/dist/components/AnchoredOverlay/index.d.ts +41 -0
  3. package/dist/components/index.d.ts +2 -0
  4. package/dist/index.js +132 -130
  5. package/dist/index.js.map +1 -1
  6. package/dist/index100.js +1 -1
  7. package/dist/index100.js.map +1 -1
  8. package/dist/index101.js +1 -1
  9. package/dist/index101.js.map +1 -1
  10. package/dist/index102.js +1 -1
  11. package/dist/index102.js.map +1 -1
  12. package/dist/index103.js +1 -1
  13. package/dist/index103.js.map +1 -1
  14. package/dist/index104.js +1 -1
  15. package/dist/index104.js.map +1 -1
  16. package/dist/index105.js +1 -1
  17. package/dist/index105.js.map +1 -1
  18. package/dist/index106.js +1 -1
  19. package/dist/index106.js.map +1 -1
  20. package/dist/index107.js +1 -1
  21. package/dist/index107.js.map +1 -1
  22. package/dist/index108.js +1 -1
  23. package/dist/index108.js.map +1 -1
  24. package/dist/index109.js +1 -1
  25. package/dist/index109.js.map +1 -1
  26. package/dist/index11.js +1 -1
  27. package/dist/index110.js +1 -1
  28. package/dist/index110.js.map +1 -1
  29. package/dist/index111.js +1 -1
  30. package/dist/index111.js.map +1 -1
  31. package/dist/index112.js +1 -1
  32. package/dist/index112.js.map +1 -1
  33. package/dist/index113.js +1 -1
  34. package/dist/index113.js.map +1 -1
  35. package/dist/index114.js +2 -2
  36. package/dist/index114.js.map +1 -1
  37. package/dist/index115.js +1 -1
  38. package/dist/index115.js.map +1 -1
  39. package/dist/index116.js +2 -2
  40. package/dist/index116.js.map +1 -1
  41. package/dist/index117.js +1 -1
  42. package/dist/index117.js.map +1 -1
  43. package/dist/index118.js +1 -1
  44. package/dist/index118.js.map +1 -1
  45. package/dist/index119.js +2 -2
  46. package/dist/index119.js.map +1 -1
  47. package/dist/index12.js +3 -3
  48. package/dist/index120.js +1 -1
  49. package/dist/index120.js.map +1 -1
  50. package/dist/index121.js +2 -2
  51. package/dist/index121.js.map +1 -1
  52. package/dist/index122.js +1 -1
  53. package/dist/index122.js.map +1 -1
  54. package/dist/index123.js +1 -1
  55. package/dist/index123.js.map +1 -1
  56. package/dist/index124.js +1 -1
  57. package/dist/index124.js.map +1 -1
  58. package/dist/index125.js +1 -1
  59. package/dist/index125.js.map +1 -1
  60. package/dist/index126.js +2 -2
  61. package/dist/index126.js.map +1 -1
  62. package/dist/index127.js +1 -1
  63. package/dist/index127.js.map +1 -1
  64. package/dist/index128.js +2 -2
  65. package/dist/index128.js.map +1 -1
  66. package/dist/index129.js +2 -2
  67. package/dist/index129.js.map +1 -1
  68. package/dist/index13.js +3 -3
  69. package/dist/index130.js +1 -1
  70. package/dist/index130.js.map +1 -1
  71. package/dist/index131.js +2 -2
  72. package/dist/index131.js.map +1 -1
  73. package/dist/index132.js +2 -2
  74. package/dist/index132.js.map +1 -1
  75. package/dist/index133.js +1 -1
  76. package/dist/index133.js.map +1 -1
  77. package/dist/index134.js +1 -1
  78. package/dist/index134.js.map +1 -1
  79. package/dist/index135.js +1 -1
  80. package/dist/index135.js.map +1 -1
  81. package/dist/index136.js +2 -2
  82. package/dist/index136.js.map +1 -1
  83. package/dist/index137.js +2 -2
  84. package/dist/index137.js.map +1 -1
  85. package/dist/index138.js +2 -2
  86. package/dist/index138.js.map +1 -1
  87. package/dist/index139.js +1 -1
  88. package/dist/index139.js.map +1 -1
  89. package/dist/index140.js +1 -1
  90. package/dist/index140.js.map +1 -1
  91. package/dist/index141.js +1 -1
  92. package/dist/index141.js.map +1 -1
  93. package/dist/index142.js +1 -1
  94. package/dist/index142.js.map +1 -1
  95. package/dist/index143.js +1 -1
  96. package/dist/index143.js.map +1 -1
  97. package/dist/index144.js +1 -1
  98. package/dist/index144.js.map +1 -1
  99. package/dist/index145.js +1 -1
  100. package/dist/index145.js.map +1 -1
  101. package/dist/index146.js +1 -1
  102. package/dist/index146.js.map +1 -1
  103. package/dist/index147.js +2 -2
  104. package/dist/index147.js.map +1 -1
  105. package/dist/index148.js +2 -2
  106. package/dist/index148.js.map +1 -1
  107. package/dist/index149.js +1 -1
  108. package/dist/index149.js.map +1 -1
  109. package/dist/index150.js +1 -1
  110. package/dist/index150.js.map +1 -1
  111. package/dist/index151.js +1 -1
  112. package/dist/index151.js.map +1 -1
  113. package/dist/index152.js +1 -1
  114. package/dist/index152.js.map +1 -1
  115. package/dist/index153.js +1 -1
  116. package/dist/index153.js.map +1 -1
  117. package/dist/index154.js +1 -1
  118. package/dist/index154.js.map +1 -1
  119. package/dist/index155.js +1 -1
  120. package/dist/index155.js.map +1 -1
  121. package/dist/index156.js +2 -2
  122. package/dist/index156.js.map +1 -1
  123. package/dist/index157.js +1 -1
  124. package/dist/index157.js.map +1 -1
  125. package/dist/index158.js +2 -2
  126. package/dist/index158.js.map +1 -1
  127. package/dist/index159.js +2 -2
  128. package/dist/index159.js.map +1 -1
  129. package/dist/index16.js +3 -3
  130. package/dist/index160.js +2 -2
  131. package/dist/index160.js.map +1 -1
  132. package/dist/index161.js +2 -2
  133. package/dist/index161.js.map +1 -1
  134. package/dist/index162.js +1 -1
  135. package/dist/index162.js.map +1 -1
  136. package/dist/index163.js +1 -1
  137. package/dist/index163.js.map +1 -1
  138. package/dist/index164.js +1 -1
  139. package/dist/index164.js.map +1 -1
  140. package/dist/index165.js +1 -1
  141. package/dist/index165.js.map +1 -1
  142. package/dist/index166.js +1 -1
  143. package/dist/index166.js.map +1 -1
  144. package/dist/index167.js +1 -1
  145. package/dist/index167.js.map +1 -1
  146. package/dist/index168.js +1 -1
  147. package/dist/index168.js.map +1 -1
  148. package/dist/index169.js +1 -1
  149. package/dist/index169.js.map +1 -1
  150. package/dist/index170.js +1 -1
  151. package/dist/index170.js.map +1 -1
  152. package/dist/index171.js +1 -1
  153. package/dist/index171.js.map +1 -1
  154. package/dist/index172.js +1 -1
  155. package/dist/index172.js.map +1 -1
  156. package/dist/index173.js +1 -1
  157. package/dist/index173.js.map +1 -1
  158. package/dist/index174.js +1 -1
  159. package/dist/index174.js.map +1 -1
  160. package/dist/index175.js +1 -1
  161. package/dist/index175.js.map +1 -1
  162. package/dist/index176.js +1 -1
  163. package/dist/index176.js.map +1 -1
  164. package/dist/index177.js +1 -1
  165. package/dist/index177.js.map +1 -1
  166. package/dist/index178.js +1 -1
  167. package/dist/index178.js.map +1 -1
  168. package/dist/index179.js +1 -1
  169. package/dist/index179.js.map +1 -1
  170. package/dist/index18.js +3 -3
  171. package/dist/index180.js +1 -1
  172. package/dist/index180.js.map +1 -1
  173. package/dist/index181.js +1 -1
  174. package/dist/index181.js.map +1 -1
  175. package/dist/index182.js +1 -1
  176. package/dist/index182.js.map +1 -1
  177. package/dist/index183.js +1 -1
  178. package/dist/index183.js.map +1 -1
  179. package/dist/index184.js +1 -1
  180. package/dist/index184.js.map +1 -1
  181. package/dist/index185.js +1 -1
  182. package/dist/index185.js.map +1 -1
  183. package/dist/index186.js +2 -2
  184. package/dist/index186.js.map +1 -1
  185. package/dist/index187.js +2 -2
  186. package/dist/index187.js.map +1 -1
  187. package/dist/index188.js +1 -1
  188. package/dist/index188.js.map +1 -1
  189. package/dist/index189.js +1 -1
  190. package/dist/index189.js.map +1 -1
  191. package/dist/index19.js +5 -5
  192. package/dist/index190.js +2 -2
  193. package/dist/index190.js.map +1 -1
  194. package/dist/index191.js +2 -2
  195. package/dist/index191.js.map +1 -1
  196. package/dist/index192.js +1 -1
  197. package/dist/index192.js.map +1 -1
  198. package/dist/index193.js +1 -1
  199. package/dist/index193.js.map +1 -1
  200. package/dist/index194.js +1 -1
  201. package/dist/index194.js.map +1 -1
  202. package/dist/index195.js +1 -1
  203. package/dist/index195.js.map +1 -1
  204. package/dist/index196.js +1 -1
  205. package/dist/index196.js.map +1 -1
  206. package/dist/index197.js +1 -1
  207. package/dist/index197.js.map +1 -1
  208. package/dist/index198.js +1 -1
  209. package/dist/index198.js.map +1 -1
  210. package/dist/index199.js +1 -1
  211. package/dist/index199.js.map +1 -1
  212. package/dist/index20.js +96 -18
  213. package/dist/index20.js.map +1 -1
  214. package/dist/index200.js +1 -1
  215. package/dist/index200.js.map +1 -1
  216. package/dist/index201.js +2 -2
  217. package/dist/index201.js.map +1 -1
  218. package/dist/index202.js +2 -2
  219. package/dist/index202.js.map +1 -1
  220. package/dist/index203.js +2 -2
  221. package/dist/index203.js.map +1 -1
  222. package/dist/index204.js +2 -149
  223. package/dist/index204.js.map +1 -1
  224. package/dist/index205.js +149 -9
  225. package/dist/index205.js.map +1 -1
  226. package/dist/index206.js +8 -5
  227. package/dist/index206.js.map +1 -1
  228. package/dist/index207.js +5 -42
  229. package/dist/index207.js.map +1 -1
  230. package/dist/index208.js +40 -18
  231. package/dist/index208.js.map +1 -1
  232. package/dist/index209.js +24 -0
  233. package/dist/index209.js.map +1 -0
  234. package/dist/index21.js +17 -32
  235. package/dist/index21.js.map +1 -1
  236. package/dist/index216.js +24 -68
  237. package/dist/index216.js.map +1 -1
  238. package/dist/index217.js +75 -0
  239. package/dist/index217.js.map +1 -0
  240. package/dist/index22.js +33 -66
  241. package/dist/index22.js.map +1 -1
  242. package/dist/{index223.js → index224.js} +1 -1
  243. package/dist/{index223.js.map → index224.js.map} +1 -1
  244. package/dist/{index225.js → index226.js} +1 -1
  245. package/dist/{index225.js.map → index226.js.map} +1 -1
  246. package/dist/index23.js +62 -83
  247. package/dist/index23.js.map +1 -1
  248. package/dist/{index233.js → index234.js} +1 -1
  249. package/dist/{index233.js.map → index234.js.map} +1 -1
  250. package/dist/{index236.js → index237.js} +1 -1
  251. package/dist/{index236.js.map → index237.js.map} +1 -1
  252. package/dist/index24.js +85 -21
  253. package/dist/index24.js.map +1 -1
  254. package/dist/index246.js +169 -3
  255. package/dist/index246.js.map +1 -1
  256. package/dist/index247.js +7 -0
  257. package/dist/index247.js.map +1 -0
  258. package/dist/index249.js +18 -9
  259. package/dist/index249.js.map +1 -1
  260. package/dist/index25.js +19 -401
  261. package/dist/index25.js.map +1 -1
  262. package/dist/index250.js +9 -9
  263. package/dist/index250.js.map +1 -1
  264. package/dist/index251.js +9 -4
  265. package/dist/index251.js.map +1 -1
  266. package/dist/index252.js +5 -170
  267. package/dist/index252.js.map +1 -1
  268. package/dist/index253.js +170 -11
  269. package/dist/index253.js.map +1 -1
  270. package/dist/index254.js +11 -6
  271. package/dist/index254.js.map +1 -1
  272. package/dist/index255.js +5 -5
  273. package/dist/index255.js.map +1 -1
  274. package/dist/index256.js +5 -37
  275. package/dist/index256.js.map +1 -1
  276. package/dist/index257.js +38 -2
  277. package/dist/index257.js.map +1 -1
  278. package/dist/index258.js +2 -8
  279. package/dist/index258.js.map +1 -1
  280. package/dist/index259.js +7 -326
  281. package/dist/index259.js.map +1 -1
  282. package/dist/index26.js +400 -44
  283. package/dist/index26.js.map +1 -1
  284. package/dist/index260.js +324 -47
  285. package/dist/index260.js.map +1 -1
  286. package/dist/index261.js +50 -2
  287. package/dist/index261.js.map +1 -1
  288. package/dist/index262.js +2 -76
  289. package/dist/index262.js.map +1 -1
  290. package/dist/index263.js +65 -82
  291. package/dist/index263.js.map +1 -1
  292. package/dist/index264.js +89 -48
  293. package/dist/index264.js.map +1 -1
  294. package/dist/index265.js +51 -7
  295. package/dist/index265.js.map +1 -1
  296. package/dist/index266.js +7 -4
  297. package/dist/index266.js.map +1 -1
  298. package/dist/index267.js +4 -51
  299. package/dist/index267.js.map +1 -1
  300. package/dist/index268.js +52 -2
  301. package/dist/index268.js.map +1 -1
  302. package/dist/index269.js +2 -2
  303. package/dist/index27.js +48 -23
  304. package/dist/index27.js.map +1 -1
  305. package/dist/index270.js +5 -0
  306. package/dist/index270.js.map +1 -0
  307. package/dist/index28.js +21 -108
  308. package/dist/index28.js.map +1 -1
  309. package/dist/index29.js +107 -147
  310. package/dist/index29.js.map +1 -1
  311. package/dist/index3.js +3 -3
  312. package/dist/index30.js +146 -132
  313. package/dist/index30.js.map +1 -1
  314. package/dist/index31.js +136 -76
  315. package/dist/index31.js.map +1 -1
  316. package/dist/index32.js +73 -94
  317. package/dist/index32.js.map +1 -1
  318. package/dist/index33.js +95 -73
  319. package/dist/index33.js.map +1 -1
  320. package/dist/index34.js +72 -38
  321. package/dist/index34.js.map +1 -1
  322. package/dist/index35.js +40 -72
  323. package/dist/index35.js.map +1 -1
  324. package/dist/index36.js +68 -94
  325. package/dist/index36.js.map +1 -1
  326. package/dist/index37.js +98 -77
  327. package/dist/index37.js.map +1 -1
  328. package/dist/index38.js +75 -311
  329. package/dist/index38.js.map +1 -1
  330. package/dist/index39.js +313 -75
  331. package/dist/index39.js.map +1 -1
  332. package/dist/index4.js +4 -4
  333. package/dist/index40.js +72 -79
  334. package/dist/index40.js.map +1 -1
  335. package/dist/index41.js +82 -32
  336. package/dist/index41.js.map +1 -1
  337. package/dist/index42.js +26 -43
  338. package/dist/index42.js.map +1 -1
  339. package/dist/index43.js +48 -109
  340. package/dist/index43.js.map +1 -1
  341. package/dist/index44.js +104 -50
  342. package/dist/index44.js.map +1 -1
  343. package/dist/index45.js +53 -142
  344. package/dist/index45.js.map +1 -1
  345. package/dist/index46.js +137 -188
  346. package/dist/index46.js.map +1 -1
  347. package/dist/index47.js +195 -35
  348. package/dist/index47.js.map +1 -1
  349. package/dist/index48.js +34 -32
  350. package/dist/index48.js.map +1 -1
  351. package/dist/index49.js +34 -147
  352. package/dist/index49.js.map +1 -1
  353. package/dist/index50.js +130 -67
  354. package/dist/index50.js.map +1 -1
  355. package/dist/index51.js +78 -453
  356. package/dist/index51.js.map +1 -1
  357. package/dist/index52.js +459 -96
  358. package/dist/index52.js.map +1 -1
  359. package/dist/index53.js +98 -43
  360. package/dist/index53.js.map +1 -1
  361. package/dist/index54.js +40 -35
  362. package/dist/index54.js.map +1 -1
  363. package/dist/index55.js +33 -87
  364. package/dist/index55.js.map +1 -1
  365. package/dist/index56.js +88 -159
  366. package/dist/index56.js.map +1 -1
  367. package/dist/index57.js +157 -143
  368. package/dist/index57.js.map +1 -1
  369. package/dist/index58.js +149 -33
  370. package/dist/index58.js.map +1 -1
  371. package/dist/index59.js +33 -86
  372. package/dist/index59.js.map +1 -1
  373. package/dist/index6.js +125 -125
  374. package/dist/index60.js +80 -113
  375. package/dist/index60.js.map +1 -1
  376. package/dist/index61.js +114 -73
  377. package/dist/index61.js.map +1 -1
  378. package/dist/index62.js +73 -147
  379. package/dist/index62.js.map +1 -1
  380. package/dist/index63.js +146 -312
  381. package/dist/index63.js.map +1 -1
  382. package/dist/index64.js +317 -46
  383. package/dist/index64.js.map +1 -1
  384. package/dist/index65.js +45 -142
  385. package/dist/index65.js.map +1 -1
  386. package/dist/index66.js +144 -12
  387. package/dist/index66.js.map +1 -1
  388. package/dist/index67.js +10 -53
  389. package/dist/index67.js.map +1 -1
  390. package/dist/index68.js +52 -110
  391. package/dist/index68.js.map +1 -1
  392. package/dist/index69.js +111 -17
  393. package/dist/index69.js.map +1 -1
  394. package/dist/index7.js +2 -2
  395. package/dist/index70.js +17 -64
  396. package/dist/index70.js.map +1 -1
  397. package/dist/index71.js +64 -25
  398. package/dist/index71.js.map +1 -1
  399. package/dist/index72.js +24 -105
  400. package/dist/index72.js.map +1 -1
  401. package/dist/index73.js +104 -58
  402. package/dist/index73.js.map +1 -1
  403. package/dist/index74.js +60 -19
  404. package/dist/index74.js.map +1 -1
  405. package/dist/index75.js +18 -168
  406. package/dist/index75.js.map +1 -1
  407. package/dist/index76.js +171 -18
  408. package/dist/index76.js.map +1 -1
  409. package/dist/index77.js +17 -10
  410. package/dist/index77.js.map +1 -1
  411. package/dist/index78.js +11 -5
  412. package/dist/index78.js.map +1 -1
  413. package/dist/index79.js +5 -62
  414. package/dist/index79.js.map +1 -1
  415. package/dist/index80.js +58 -23
  416. package/dist/index80.js.map +1 -1
  417. package/dist/index81.js +25 -9
  418. package/dist/index81.js.map +1 -1
  419. package/dist/index82.js +14 -0
  420. package/dist/index82.js.map +1 -0
  421. package/dist/index84.js +2 -2
  422. package/dist/index84.js.map +1 -1
  423. package/dist/index85.js +2 -2
  424. package/dist/index85.js.map +1 -1
  425. package/dist/index86.js +2 -2
  426. package/dist/index86.js.map +1 -1
  427. package/dist/index87.js +2 -2
  428. package/dist/index87.js.map +1 -1
  429. package/dist/index88.js +1 -1
  430. package/dist/index88.js.map +1 -1
  431. package/dist/index89.js +1 -1
  432. package/dist/index89.js.map +1 -1
  433. package/dist/index9.js +4 -4
  434. package/dist/index90.js +1 -1
  435. package/dist/index90.js.map +1 -1
  436. package/dist/index91.js +1 -1
  437. package/dist/index91.js.map +1 -1
  438. package/dist/index92.js +1 -1
  439. package/dist/index92.js.map +1 -1
  440. package/dist/index93.js +1 -1
  441. package/dist/index93.js.map +1 -1
  442. package/dist/index94.js +1 -1
  443. package/dist/index94.js.map +1 -1
  444. package/dist/index95.js +1 -1
  445. package/dist/index95.js.map +1 -1
  446. package/dist/index96.js +1 -1
  447. package/dist/index96.js.map +1 -1
  448. package/dist/index97.js +1 -1
  449. package/dist/index97.js.map +1 -1
  450. package/dist/index98.js +1 -1
  451. package/dist/index98.js.map +1 -1
  452. package/dist/index99.js +1 -1
  453. package/dist/index99.js.map +1 -1
  454. package/package.json +1 -1
  455. package/dist/index215.js +0 -31
  456. package/dist/index215.js.map +0 -1
  457. package/dist/index245.js +0 -173
  458. package/dist/index245.js.map +0 -1
  459. package/dist/index248.js +0 -22
  460. package/dist/index248.js.map +0 -1
  461. package/dist/index83.js +0 -5
  462. package/dist/index83.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index205.js","sources":["../src/utils/a11y/elementVisibility.ts"],"sourcesContent":["/**\n * Checks if an element is visible in the DOM.\n * \n * An element is considered visible if:\n * - It exists in the DOM\n * - It's not hidden via CSS (display: none, visibility: hidden)\n * - It has actual dimensions (width > 0 and height > 0)\n * \n * @param element - The element to check, or null\n * @returns true if the element is visible, false otherwise\n * \n * @example\n * const element = document.getElementById('my-element');\n * if (isElementVisible(element)) {\n * // Element is visible\n * }\n */\nexport function isElementVisible(element: HTMLElement | null): boolean {\n if (!element) return false;\n\n // Check computed style for display/visibility\n const style = window.getComputedStyle(element);\n if (style.display === 'none' || style.visibility === 'hidden') {\n return false;\n }\n\n // Check if element has dimensions\n const rect = element.getBoundingClientRect();\n return rect.width > 0 && rect.height > 0;\n}\n"],"names":["isElementVisible","element","style","window","getComputedStyle","display","visibility","rect","getBoundingClientRect","width","height"],"mappings":"AAiBO,SAASA,EAAiBC,GAAsC;AACrE,MAAI,CAACA,EAAS,QAAO;AAGrB,QAAMC,IAAQC,OAAOC,iBAAiBH,CAAO;AAC7C,MAAIC,EAAMG,YAAY,UAAUH,EAAMI,eAAe;AACnD,WAAO;AAIT,QAAMC,IAAON,EAAQO,sBAAAA;AACrB,SAAOD,EAAKE,QAAQ,KAAKF,EAAKG,SAAS;AACzC;"}
1
+ {"version":3,"file":"index205.js","sources":["../node_modules/react-svg/dist/react-svg.esm.js"],"sourcesContent":["import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';\nimport _extends from '@babel/runtime/helpers/extends';\nimport _inheritsLoose from '@babel/runtime/helpers/inheritsLoose';\nimport { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\n\n// Hat-tip: https://github.com/mui/material-ui/tree/master/packages/mui-utils/src.\nvar ownerWindow = function ownerWindow(node) {\n var doc = (node == null ? void 0 : node.ownerDocument) || document;\n return doc.defaultView || window;\n};\n\n// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nvar shallowDiffers = function shallowDiffers(a, b) {\n for (var i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (var _i in b) {\n if (a[_i] !== b[_i]) {\n return true;\n }\n }\n return false;\n};\n\nvar _excluded = [\"afterInjection\", \"beforeInjection\", \"desc\", \"evalScripts\", \"fallback\", \"httpRequestWithCredentials\", \"loading\", \"renumerateIRIElements\", \"src\", \"title\", \"useRequestCache\", \"wrapper\"];\nvar svgNamespace = 'http://www.w3.org/2000/svg';\nvar xlinkNamespace = 'http://www.w3.org/1999/xlink';\nvar ReactSVG = /*#__PURE__*/function (_React$Component) {\n function ReactSVG() {\n var _this;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;\n _this.initialState = {\n hasError: false,\n isLoading: true\n };\n _this.state = _this.initialState;\n _this._isMounted = false;\n _this.reactWrapper = void 0;\n _this.nonReactWrapper = void 0;\n _this.refCallback = function (reactWrapper) {\n _this.reactWrapper = reactWrapper;\n };\n return _this;\n }\n _inheritsLoose(ReactSVG, _React$Component);\n var _proto = ReactSVG.prototype;\n _proto.renderSVG = function renderSVG() {\n var _this2 = this;\n /* istanbul ignore else */\n if (this.reactWrapper instanceof ownerWindow(this.reactWrapper).Node) {\n var _this$props = this.props,\n desc = _this$props.desc,\n evalScripts = _this$props.evalScripts,\n httpRequestWithCredentials = _this$props.httpRequestWithCredentials,\n renumerateIRIElements = _this$props.renumerateIRIElements,\n src = _this$props.src,\n title = _this$props.title,\n useRequestCache = _this$props.useRequestCache;\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n var onError = this.props.onError;\n var beforeInjection = this.props.beforeInjection;\n var afterInjection = this.props.afterInjection;\n var wrapper = this.props.wrapper;\n var nonReactWrapper;\n var nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n } else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n var handleError = function handleError(error) {\n _this2.removeSVG();\n if (!_this2._isMounted) {\n onError(error);\n return;\n }\n _this2.setState(function () {\n return {\n hasError: true,\n isLoading: false\n };\n }, function () {\n onError(error);\n });\n };\n var afterEach = function afterEach(error, svg) {\n if (error) {\n handleError(error);\n return;\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (_this2._isMounted) {\n _this2.setState(function () {\n return {\n isLoading: false\n };\n }, function () {\n try {\n afterInjection(svg);\n } catch (afterInjectionError) {\n handleError(afterInjectionError);\n }\n });\n }\n };\n var beforeEach = function beforeEach(svg) {\n svg.setAttribute('role', 'img');\n if (desc) {\n var originalDesc = svg.querySelector(':scope > desc');\n if (originalDesc) {\n svg.removeChild(originalDesc);\n }\n var newDesc = document.createElement('desc');\n newDesc.innerHTML = desc;\n svg.prepend(newDesc);\n }\n if (title) {\n var originalTitle = svg.querySelector(':scope > title');\n if (originalTitle) {\n svg.removeChild(originalTitle);\n }\n var newTitle = document.createElement('title');\n newTitle.innerHTML = title;\n svg.prepend(newTitle);\n }\n try {\n beforeInjection(svg);\n } catch (error) {\n handleError(error);\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach: afterEach,\n beforeEach: beforeEach,\n cacheRequests: useRequestCache,\n evalScripts: evalScripts,\n httpRequestWithCredentials: httpRequestWithCredentials,\n renumerateIRIElements: renumerateIRIElements\n });\n }\n };\n _proto.removeSVG = function removeSVG() {\n var _this$nonReactWrapper;\n if ((_this$nonReactWrapper = this.nonReactWrapper) != null && _this$nonReactWrapper.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n };\n _proto.componentDidMount = function componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n };\n _proto.componentDidUpdate = function componentDidUpdate(prevProps) {\n var _this3 = this;\n if (shallowDiffers(_extends({}, prevProps), this.props)) {\n this.setState(function () {\n return _this3.initialState;\n }, function () {\n _this3.removeSVG();\n _this3.renderSVG();\n });\n }\n };\n _proto.componentWillUnmount = function componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n };\n _proto.render = function render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n var _this$props2 = this.props;\n _this$props2.afterInjection;\n _this$props2.beforeInjection;\n _this$props2.desc;\n _this$props2.evalScripts;\n var Fallback = _this$props2.fallback;\n _this$props2.httpRequestWithCredentials;\n var Loading = _this$props2.loading;\n _this$props2.renumerateIRIElements;\n _this$props2.src;\n _this$props2.title;\n _this$props2.useRequestCache;\n var wrapper = _this$props2.wrapper,\n rest = _objectWithoutPropertiesLoose(_this$props2, _excluded);\n /* eslint-enable @typescript-eslint/no-unused-vars */\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n var Wrapper = wrapper;\n return /*#__PURE__*/React.createElement(Wrapper, _extends({}, rest, {\n ref: this.refCallback\n }, wrapper === 'svg' ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace\n } : {}), this.state.isLoading && Loading && /*#__PURE__*/React.createElement(Loading, null), this.state.hasError && Fallback && /*#__PURE__*/React.createElement(Fallback, null));\n };\n return ReactSVG;\n}(React.Component);\nReactSVG.defaultProps = {\n afterInjection: function afterInjection() {\n return undefined;\n },\n beforeInjection: function beforeInjection() {\n return undefined;\n },\n desc: '',\n evalScripts: 'never',\n fallback: null,\n httpRequestWithCredentials: false,\n loading: null,\n onError: function onError() {\n return undefined;\n },\n renumerateIRIElements: true,\n title: '',\n useRequestCache: true,\n wrapper: 'div'\n};\nReactSVG.propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n desc: PropTypes.string,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.string]),\n httpRequestWithCredentials: PropTypes.bool,\n loading: PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.string]),\n onError: PropTypes.func,\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n title: PropTypes.string,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg'])\n} ;\n\nexport { ReactSVG };\n//# sourceMappingURL=react-svg.esm.js.map\n"],"names":["_objectWithoutPropertiesLoose","_extends","_inheritsLoose","SVGInjector","propTypesExports","React","ownerWindow","node","doc","shallowDiffers","a","b","i","_i","_excluded","svgNamespace","xlinkNamespace","ReactSVG","_React$Component","_this","_len","args","_key","reactWrapper","_proto","_this2","_this$props","desc","evalScripts","httpRequestWithCredentials","renumerateIRIElements","src","title","useRequestCache","onError","beforeInjection","afterInjection","wrapper","nonReactWrapper","nonReactTarget","handleError","error","afterEach","svg","afterInjectionError","beforeEach","originalDesc","newDesc","originalTitle","newTitle","_this$nonReactWrapper","prevProps","_this3","_this$props2","Fallback","Loading","rest","Wrapper","PropTypes.func","PropTypes.string","PropTypes.oneOf","PropTypes.oneOfType","PropTypes.object","PropTypes.bool"],"mappings":"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","x_google_ignoreList":[0]}
package/dist/index206.js CHANGED
@@ -1,9 +1,12 @@
1
- import { useRef as n } from "react";
2
- function u(e, t = "se-id") {
3
- const r = n("");
4
- return r.current || (r.current = `${t}-${crypto.randomUUID()}`), e || r.current;
1
+ function n(i) {
2
+ if (!i) return !1;
3
+ const t = window.getComputedStyle(i);
4
+ if (t.display === "none" || t.visibility === "hidden")
5
+ return !1;
6
+ const e = i.getBoundingClientRect();
7
+ return e.width > 0 && e.height > 0;
5
8
  }
6
9
  export {
7
- u as useStableId
10
+ n as isElementVisible
8
11
  };
9
12
  //# sourceMappingURL=index206.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index206.js","sources":["../src/utils/useStableId.ts"],"sourcesContent":["import { useRef } from 'react';\n\n/**\n * Generates a stable unique ID for component instances (React 16 compatible).\n * Returns the provided id if given, otherwise generates a stable per-mount id.\n * \n * @param id - Optional explicit id\n * @param prefix - Prefix for auto-generated ids (default: 'se-id')\n * @returns Stable id string\n */\nexport function useStableId(id?: string, prefix: string = 'se-id'): string {\n const autoIdRef = useRef<string>('');\n \n if (!autoIdRef.current) {\n autoIdRef.current = `${prefix}-${crypto.randomUUID()}`;\n }\n \n return id || autoIdRef.current;\n}\n\n\n\n\n\n\n\n"],"names":["useRef","useStableId","id","prefix","autoIdRef","current","crypto","randomUUID"],"mappings":"AAUO,SAAA,UAAAA,SAAA;AAAA,SAASC,EAAYC,GAAaC,IAAiB,SAAiB;AACzE,QAAMC,IAAYJ,EAAe,EAAE;AAEnC,SAAKI,EAAUC,YACbD,EAAUC,UAAU,GAAGF,CAAM,IAAIG,OAAOC,YAAY,KAG/CL,KAAME,EAAUC;AACzB;"}
1
+ {"version":3,"file":"index206.js","sources":["../src/utils/a11y/elementVisibility.ts"],"sourcesContent":["/**\n * Checks if an element is visible in the DOM.\n * \n * An element is considered visible if:\n * - It exists in the DOM\n * - It's not hidden via CSS (display: none, visibility: hidden)\n * - It has actual dimensions (width > 0 and height > 0)\n * \n * @param element - The element to check, or null\n * @returns true if the element is visible, false otherwise\n * \n * @example\n * const element = document.getElementById('my-element');\n * if (isElementVisible(element)) {\n * // Element is visible\n * }\n */\nexport function isElementVisible(element: HTMLElement | null): boolean {\n if (!element) return false;\n\n // Check computed style for display/visibility\n const style = window.getComputedStyle(element);\n if (style.display === 'none' || style.visibility === 'hidden') {\n return false;\n }\n\n // Check if element has dimensions\n const rect = element.getBoundingClientRect();\n return rect.width > 0 && rect.height > 0;\n}\n"],"names":["isElementVisible","element","style","window","getComputedStyle","display","visibility","rect","getBoundingClientRect","width","height"],"mappings":"AAiBO,SAASA,EAAiBC,GAAsC;AACrE,MAAI,CAACA,EAAS,QAAO;AAGrB,QAAMC,IAAQC,OAAOC,iBAAiBH,CAAO;AAC7C,MAAIC,EAAMG,YAAY,UAAUH,EAAMI,eAAe;AACnD,WAAO;AAIT,QAAMC,IAAON,EAAQO,sBAAAA;AACrB,SAAOD,EAAKE,QAAQ,KAAKF,EAAKG,SAAS;AACzC;"}
package/dist/index207.js CHANGED
@@ -1,46 +1,9 @@
1
- import { useRef as l } from "react";
2
- import { useFocusTrap as d } from "./index72.js";
3
- import { useDismissOnEscape as c } from "./index215.js";
4
- import { getA11yNameAttributes as f } from "./index81.js";
5
- import { useStableId as p } from "./index206.js";
6
- function x({
7
- isOpen: t,
8
- onDismiss: s,
9
- ariaLabel: o,
10
- ariaLabelledBy: i,
11
- titleIdPrefix: a = "modal-title",
12
- initialFocus: m = "first",
13
- portalContainerRefs: n
14
- }) {
15
- const e = l(null), r = p(void 0, a);
16
- d({
17
- enabled: t,
18
- containerRef: e,
19
- restoreFocus: !0,
20
- initialFocus: m,
21
- portalContainerRefs: n
22
- }), c({
23
- containerRef: e,
24
- onDismiss: s,
25
- enabled: t,
26
- useDocumentListener: !0
27
- });
28
- const u = {
29
- role: "dialog",
30
- "aria-modal": !0,
31
- tabIndex: -1,
32
- ...f({
33
- ariaLabelledBy: i ?? (o ? void 0 : r),
34
- ariaLabel: o
35
- })
36
- };
37
- return {
38
- containerRef: e,
39
- titleId: r,
40
- dialogProps: u
41
- };
1
+ import { useRef as n } from "react";
2
+ function u(e, t = "se-id") {
3
+ const r = n("");
4
+ return r.current || (r.current = `${t}-${crypto.randomUUID()}`), e || r.current;
42
5
  }
43
6
  export {
44
- x as useModalA11y
7
+ u as useStableId
45
8
  };
46
9
  //# sourceMappingURL=index207.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index207.js","sources":["../src/utils/a11y/useModalA11y.ts"],"sourcesContent":["import { useRef } from 'react';\nimport type { MutableRefObject, RefObject } from 'react';\nimport { useFocusTrap } from './useFocusTrap';\nimport { useDismissOnEscape } from './useDismissOnEscape';\nimport { getA11yNameAttributes } from './accessibleName';\nimport { useStableId } from 'src/utils/useStableId';\n\nexport interface UseModalA11yOptions {\n /**\n * Whether the modal is open. Controls focus trap and Escape handler activation.\n */\n isOpen: boolean;\n /**\n * Called when Escape is pressed while focus is within the modal.\n * If undefined, Escape dismissal is disabled.\n */\n onDismiss?: () => void;\n /**\n * aria-label for modals without a visible title heading.\n * Only used when `ariaLabelledBy` is not provided.\n */\n ariaLabel?: string;\n /**\n * ID of an existing visible element (e.g. an h2 inside the modal content) that labels\n * the dialog. Preferred over ariaLabel when a visible heading already exists in the content.\n * Only used when `title` is not provided.\n */\n ariaLabelledBy?: string;\n /**\n * Prefix for the auto-generated title element id. Default: 'modal-title'.\n */\n titleIdPrefix?: string;\n /**\n * Initial focus target when the modal opens. Forwarded to useFocusTrap.\n * - 'first': Focus first focusable element (default)\n * - 'container': Focus the dialog container itself\n * - 'none': Skip — browser handles it (e.g. autofocus attribute on inner element)\n * - CSS selector string: Focus matching element\n * - HTMLElement: Focus specific element\n */\n initialFocus?: 'first' | 'container' | 'none' | string | HTMLElement;\n /**\n * Additional container refs for portal content that is logically part of this modal.\n * Passed through to useFocusTrap and useDismissOnEscape so their safety nets\n * allow focus to move into portal-rendered content (e.g., Dropdown with isWithPortal).\n */\n portalContainerRefs?: MutableRefObject<RefObject<HTMLElement | null>[]>;\n}\n\nexport interface UseModalA11yReturn {\n /**\n * Ref to attach to the dialog container element.\n */\n containerRef: React.RefObject<HTMLDivElement | null>;\n /**\n * Stable ID to set on the visible title element: `<h2 id={titleId}>`.\n * Only relevant when `title` is provided.\n */\n titleId: string;\n /**\n * Spread onto the dialog container element.\n * Includes: role=\"dialog\", aria-modal, tabIndex, aria-labelledby or aria-label.\n */\n dialogProps: {\n role: 'dialog';\n 'aria-modal': true;\n tabIndex: number;\n [key: string]: unknown;\n };\n}\n\n/**\n * Bundles all WCAG dialog semantics into a single hook.\n *\n * Handles:\n * - Stable ID for title element (aria-labelledby association)\n * - Focus trap: moves focus into modal on open, wraps Tab, restores focus on close\n * - Escape dismissal: calls onDismiss when Escape is pressed within the modal\n * - dialogProps: role=\"dialog\", aria-modal, tabIndex, aria-labelledby / aria-label\n *\n * @example Modal with a visible title (most common)\n * ```tsx\n * const MyModal = ({ isOpen, onClose }) => {\n * const { containerRef, titleId, dialogProps } = useModalA11y({\n * isOpen,\n * onDismiss: onClose,\n * });\n *\n * return (\n * <div ref={containerRef} {...dialogProps} className=\"modal-content\">\n * <h2 id={titleId}>My Title</h2>\n * ...\n * </div>\n * );\n * };\n * ```\n *\n * @example Modal without a visible title\n * ```tsx\n * const { containerRef, dialogProps } = useModalA11y({\n * isOpen,\n * onDismiss: onClose,\n * ariaLabel: 'Upload document',\n * });\n * ```\n *\n * @example Custom initial focus (specific button) or skip (autofocus)\n * ```tsx\n * useModalA11y({ isOpen, onDismiss, initialFocus: '.my-cta-btn' });\n * useModalA11y({ isOpen, onDismiss, initialFocus: 'none' }); // autofocus on inner element\n * ```\n */\nexport function useModalA11y({\n isOpen,\n onDismiss,\n ariaLabel,\n ariaLabelledBy,\n titleIdPrefix = 'modal-title',\n initialFocus = 'first',\n portalContainerRefs,\n}: UseModalA11yOptions): UseModalA11yReturn {\n const containerRef = useRef<HTMLDivElement>(null);\n const titleId = useStableId(undefined, titleIdPrefix);\n\n useFocusTrap({\n enabled: isOpen,\n containerRef,\n restoreFocus: true,\n initialFocus,\n portalContainerRefs,\n });\n\n useDismissOnEscape({\n containerRef,\n onDismiss,\n enabled: isOpen,\n useDocumentListener: true,\n });\n\n const nameAttrs = getA11yNameAttributes({\n ariaLabelledBy: ariaLabelledBy ?? (ariaLabel ? undefined : titleId),\n ariaLabel: ariaLabel,\n });\n\n const dialogProps = {\n role: 'dialog' as const,\n 'aria-modal': true as const,\n tabIndex: -1,\n ...nameAttrs,\n };\n\n return { containerRef, titleId, dialogProps };\n}\n"],"names":["useRef","useFocusTrap","useDismissOnEscape","getA11yNameAttributes","useStableId","useModalA11y","isOpen","onDismiss","ariaLabel","ariaLabelledBy","titleIdPrefix","initialFocus","portalContainerRefs","containerRef","titleId","undefined","enabled","restoreFocus","useDocumentListener","dialogProps","role","tabIndex","nameAttrs"],"mappings":"AAgHO,SAAA,UAAAA,SAAA;AAAA,SAAA,gBAAAC,SAAA;AAAA,SAAA,sBAAAC,SAAA;AAAA,SAAA,yBAAAC,SAAA;AAAA,SAAA,eAAAC,SAAA;AAAA,SAASC,EAAa;AAAA,EAC3BC,QAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,eAAAA,IAAgB;AAAA,EAChBC,cAAAA,IAAe;AAAA,EACfC,qBAAAA;AACmB,GAAuB;AAC1C,QAAMC,IAAeb,EAAuB,IAAI,GAC1Cc,IAAUV,EAAYW,QAAWL,CAAa;AAEpDT,EAAAA,EAAa;AAAA,IACXe,SAASV;AAAAA,IACTO,cAAAA;AAAAA,IACAI,cAAc;AAAA,IACdN,cAAAA;AAAAA,IACAC,qBAAAA;AAAAA,EAAAA,CACD,GAEDV,EAAmB;AAAA,IACjBW,cAAAA;AAAAA,IACAN,WAAAA;AAAAA,IACAS,SAASV;AAAAA,IACTY,qBAAqB;AAAA,EAAA,CACtB;AAOD,QAAMC,IAAc;AAAA,IAClBC,MAAM;AAAA,IACN,cAAc;AAAA,IACdC,UAAU;AAAA,IACV,GATgBlB,EAAsB;AAAA,MACtCM,gBAAgBA,MAAmBD,IAAYO,SAAYD;AAAAA,MAC3DN,WAAAA;AAAAA,IAAAA,CACD;AAAA,EAMIc;AAGL,SAAO;AAAA,IAAET,cAAAA;AAAAA,IAAcC,SAAAA;AAAAA,IAASK,aAAAA;AAAAA,EAAAA;AAClC;"}
1
+ {"version":3,"file":"index207.js","sources":["../src/utils/useStableId.ts"],"sourcesContent":["import { useRef } from 'react';\n\n/**\n * Generates a stable unique ID for component instances (React 16 compatible).\n * Returns the provided id if given, otherwise generates a stable per-mount id.\n * \n * @param id - Optional explicit id\n * @param prefix - Prefix for auto-generated ids (default: 'se-id')\n * @returns Stable id string\n */\nexport function useStableId(id?: string, prefix: string = 'se-id'): string {\n const autoIdRef = useRef<string>('');\n \n if (!autoIdRef.current) {\n autoIdRef.current = `${prefix}-${crypto.randomUUID()}`;\n }\n \n return id || autoIdRef.current;\n}\n\n\n\n\n\n\n\n"],"names":["useRef","useStableId","id","prefix","autoIdRef","current","crypto","randomUUID"],"mappings":"AAUO,SAAA,UAAAA,SAAA;AAAA,SAASC,EAAYC,GAAaC,IAAiB,SAAiB;AACzE,QAAMC,IAAYJ,EAAe,EAAE;AAEnC,SAAKI,EAAUC,YACbD,EAAUC,UAAU,GAAGF,CAAM,IAAIG,OAAOC,YAAY,KAG/CL,KAAME,EAAUC;AACzB;"}
package/dist/index208.js CHANGED
@@ -1,24 +1,46 @@
1
- import { useRef as o, useCallback as u, createContext as s, useContext as c, useEffect as a } from "react";
2
- const f = /* @__PURE__ */ s(null);
3
- function l() {
4
- const r = o(/* @__PURE__ */ new Set()), t = o([]);
1
+ import { useRef as l } from "react";
2
+ import { useFocusTrap as d } from "./index73.js";
3
+ import { useDismissOnEscape as c } from "./index216.js";
4
+ import { getA11yNameAttributes as f } from "./index82.js";
5
+ import { useStableId as p } from "./index207.js";
6
+ function x({
7
+ isOpen: t,
8
+ onDismiss: s,
9
+ ariaLabel: o,
10
+ ariaLabelledBy: i,
11
+ titleIdPrefix: a = "modal-title",
12
+ initialFocus: m = "first",
13
+ portalContainerRefs: n
14
+ }) {
15
+ const e = l(null), r = p(void 0, a);
16
+ d({
17
+ enabled: t,
18
+ containerRef: e,
19
+ restoreFocus: !0,
20
+ initialFocus: m,
21
+ portalContainerRefs: n
22
+ }), c({
23
+ containerRef: e,
24
+ onDismiss: s,
25
+ enabled: t,
26
+ useDocumentListener: !0
27
+ });
28
+ const u = {
29
+ role: "dialog",
30
+ "aria-modal": !0,
31
+ tabIndex: -1,
32
+ ...f({
33
+ ariaLabelledBy: i ?? (o ? void 0 : r),
34
+ ariaLabel: o
35
+ })
36
+ };
5
37
  return {
6
- register: u((n) => (r.current.add(n), t.current = Array.from(r.current), () => {
7
- r.current.delete(n), t.current = Array.from(r.current);
8
- }), []),
9
- portalContainerRefs: t
38
+ containerRef: e,
39
+ titleId: r,
40
+ dialogProps: u
10
41
  };
11
42
  }
12
- function p(r, t) {
13
- const e = c(f);
14
- a(() => {
15
- if (!(!e || !t))
16
- return e(r);
17
- }, [e, t, r]);
18
- }
19
43
  export {
20
- f as FocusTrapPortalContext,
21
- l as useFocusTrapPortalRegistry,
22
- p as useRegisterPortalWithFocusTrap
44
+ x as useModalA11y
23
45
  };
24
46
  //# sourceMappingURL=index208.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index208.js","sources":["../src/utils/a11y/FocusTrapPortalContext.tsx"],"sourcesContent":["import { createContext, useCallback, useContext, useEffect, useRef } from 'react';\n\ntype RegisterPortal = (ref: React.RefObject<HTMLElement | null>) => () => void;\n\n/**\n * Context for portal content to register with the nearest focus trap.\n * When a Modal (or any focus trap owner) provides this context, portal-rendered\n * content (e.g., Popover with isWithPortal) can register its container ref so\n * the focus trap's safety net allows focus to move into it.\n */\nexport const FocusTrapPortalContext = createContext<RegisterPortal | null>(null);\n\n/**\n * Hook for the focus trap owner (Modal) to create a portal registration function\n * and a stable ref to the current list of portal container refs.\n *\n * Usage in Modal:\n * ```tsx\n * const { register, portalContainerRefs } = useFocusTrapPortalRegistry();\n * // Pass portalContainerRefs.current to useModalA11y\n * // Wrap children with <FocusTrapPortalContext.Provider value={register}>\n * ```\n */\nexport function useFocusTrapPortalRegistry() {\n const portalRefsSet = useRef<Set<React.RefObject<HTMLElement | null>>>(new Set());\n const portalContainerRefs = useRef<React.RefObject<HTMLElement | null>[]>([]);\n\n const register: RegisterPortal = useCallback((ref) => {\n portalRefsSet.current.add(ref);\n portalContainerRefs.current = Array.from(portalRefsSet.current);\n return () => {\n portalRefsSet.current.delete(ref);\n portalContainerRefs.current = Array.from(portalRefsSet.current);\n };\n }, []);\n\n return { register, portalContainerRefs };\n}\n\n/**\n * Hook for portal content (Popover) to register its container ref with the\n * nearest ancestor focus trap. No-op if there is no focus trap ancestor.\n *\n * @param portalRef - Ref to the portal's root DOM element\n * @param isActive - Whether the portal is currently mounted and should be registered\n */\nexport function useRegisterPortalWithFocusTrap(\n portalRef: React.RefObject<HTMLElement | null>,\n isActive: boolean\n) {\n const register = useContext(FocusTrapPortalContext);\n\n useEffect(() => {\n if (!register || !isActive) return;\n return register(portalRef);\n }, [register, isActive, portalRef]);\n}\n"],"names":["useRef","useCallback","createContext","useContext","useEffect","FocusTrapPortalContext","useFocusTrapPortalRegistry","portalRefsSet","Set","portalContainerRefs","register","ref","current","add","Array","from","delete","useRegisterPortalWithFocusTrap","portalRef","isActive"],"mappings":"AAUO,SAAA,UAAAA,GAAA,eAAAC,GAAA,iBAAAC,GAAA,cAAAC,GAAA,aAAAC,SAAA;AAAA,MAAMC,sBAA8D,IAAI;AAaxE,SAASC,IAA6B;AAC3C,QAAMC,IAAgBP,EAAiD,oBAAIQ,KAAK,GAC1EC,IAAsBT,EAA8C,EAAE;AAW5E,SAAO;AAAA,IAAEU,UATwBT,EAAaU,CAAAA,OAC5CJ,EAAcK,QAAQC,IAAIF,CAAG,GAC7BF,EAAoBG,UAAUE,MAAMC,KAAKR,EAAcK,OAAO,GACvD,MAAM;AACXL,MAAAA,EAAcK,QAAQI,OAAOL,CAAG,GAChCF,EAAoBG,UAAUE,MAAMC,KAAKR,EAAcK,OAAO;AAAA,IAChE,IACC,CAAA,CAAE;AAAA,IAEcH,qBAAAA;AAAAA,EAAAA;AACrB;AASO,SAASQ,EACdC,GACAC,GACA;AACA,QAAMT,IAAWP,EAAWE,CAAsB;AAElDD,EAAAA,EAAU,MAAM;AACd,QAAI,GAACM,KAAY,CAACS;AAClB,aAAOT,EAASQ,CAAS;AAAA,EAC3B,GAAG,CAACR,GAAUS,GAAUD,CAAS,CAAC;AACpC;"}
1
+ {"version":3,"file":"index208.js","sources":["../src/utils/a11y/useModalA11y.ts"],"sourcesContent":["import { useRef } from 'react';\nimport type { MutableRefObject, RefObject } from 'react';\nimport { useFocusTrap } from './useFocusTrap';\nimport { useDismissOnEscape } from './useDismissOnEscape';\nimport { getA11yNameAttributes } from './accessibleName';\nimport { useStableId } from 'src/utils/useStableId';\n\nexport interface UseModalA11yOptions {\n /**\n * Whether the modal is open. Controls focus trap and Escape handler activation.\n */\n isOpen: boolean;\n /**\n * Called when Escape is pressed while focus is within the modal.\n * If undefined, Escape dismissal is disabled.\n */\n onDismiss?: () => void;\n /**\n * aria-label for modals without a visible title heading.\n * Only used when `ariaLabelledBy` is not provided.\n */\n ariaLabel?: string;\n /**\n * ID of an existing visible element (e.g. an h2 inside the modal content) that labels\n * the dialog. Preferred over ariaLabel when a visible heading already exists in the content.\n * Only used when `title` is not provided.\n */\n ariaLabelledBy?: string;\n /**\n * Prefix for the auto-generated title element id. Default: 'modal-title'.\n */\n titleIdPrefix?: string;\n /**\n * Initial focus target when the modal opens. Forwarded to useFocusTrap.\n * - 'first': Focus first focusable element (default)\n * - 'container': Focus the dialog container itself\n * - 'none': Skip browser handles it (e.g. autofocus attribute on inner element)\n * - CSS selector string: Focus matching element\n * - HTMLElement: Focus specific element\n */\n initialFocus?: 'first' | 'container' | 'none' | string | HTMLElement;\n /**\n * Additional container refs for portal content that is logically part of this modal.\n * Passed through to useFocusTrap and useDismissOnEscape so their safety nets\n * allow focus to move into portal-rendered content (e.g., Dropdown with isWithPortal).\n */\n portalContainerRefs?: MutableRefObject<RefObject<HTMLElement | null>[]>;\n}\n\nexport interface UseModalA11yReturn {\n /**\n * Ref to attach to the dialog container element.\n */\n containerRef: React.RefObject<HTMLDivElement | null>;\n /**\n * Stable ID to set on the visible title element: `<h2 id={titleId}>`.\n * Only relevant when `title` is provided.\n */\n titleId: string;\n /**\n * Spread onto the dialog container element.\n * Includes: role=\"dialog\", aria-modal, tabIndex, aria-labelledby or aria-label.\n */\n dialogProps: {\n role: 'dialog';\n 'aria-modal': true;\n tabIndex: number;\n [key: string]: unknown;\n };\n}\n\n/**\n * Bundles all WCAG dialog semantics into a single hook.\n *\n * Handles:\n * - Stable ID for title element (aria-labelledby association)\n * - Focus trap: moves focus into modal on open, wraps Tab, restores focus on close\n * - Escape dismissal: calls onDismiss when Escape is pressed within the modal\n * - dialogProps: role=\"dialog\", aria-modal, tabIndex, aria-labelledby / aria-label\n *\n * @example Modal with a visible title (most common)\n * ```tsx\n * const MyModal = ({ isOpen, onClose }) => {\n * const { containerRef, titleId, dialogProps } = useModalA11y({\n * isOpen,\n * onDismiss: onClose,\n * });\n *\n * return (\n * <div ref={containerRef} {...dialogProps} className=\"modal-content\">\n * <h2 id={titleId}>My Title</h2>\n * ...\n * </div>\n * );\n * };\n * ```\n *\n * @example Modal without a visible title\n * ```tsx\n * const { containerRef, dialogProps } = useModalA11y({\n * isOpen,\n * onDismiss: onClose,\n * ariaLabel: 'Upload document',\n * });\n * ```\n *\n * @example Custom initial focus (specific button) or skip (autofocus)\n * ```tsx\n * useModalA11y({ isOpen, onDismiss, initialFocus: '.my-cta-btn' });\n * useModalA11y({ isOpen, onDismiss, initialFocus: 'none' }); // autofocus on inner element\n * ```\n */\nexport function useModalA11y({\n isOpen,\n onDismiss,\n ariaLabel,\n ariaLabelledBy,\n titleIdPrefix = 'modal-title',\n initialFocus = 'first',\n portalContainerRefs,\n}: UseModalA11yOptions): UseModalA11yReturn {\n const containerRef = useRef<HTMLDivElement>(null);\n const titleId = useStableId(undefined, titleIdPrefix);\n\n useFocusTrap({\n enabled: isOpen,\n containerRef,\n restoreFocus: true,\n initialFocus,\n portalContainerRefs,\n });\n\n useDismissOnEscape({\n containerRef,\n onDismiss,\n enabled: isOpen,\n useDocumentListener: true,\n });\n\n const nameAttrs = getA11yNameAttributes({\n ariaLabelledBy: ariaLabelledBy ?? (ariaLabel ? undefined : titleId),\n ariaLabel: ariaLabel,\n });\n\n const dialogProps = {\n role: 'dialog' as const,\n 'aria-modal': true as const,\n tabIndex: -1,\n ...nameAttrs,\n };\n\n return { containerRef, titleId, dialogProps };\n}\n"],"names":["useRef","useFocusTrap","useDismissOnEscape","getA11yNameAttributes","useStableId","useModalA11y","isOpen","onDismiss","ariaLabel","ariaLabelledBy","titleIdPrefix","initialFocus","portalContainerRefs","containerRef","titleId","undefined","enabled","restoreFocus","useDocumentListener","dialogProps","role","tabIndex","nameAttrs"],"mappings":"AAgHO,SAAA,UAAAA,SAAA;AAAA,SAAA,gBAAAC,SAAA;AAAA,SAAA,sBAAAC,SAAA;AAAA,SAAA,yBAAAC,SAAA;AAAA,SAAA,eAAAC,SAAA;AAAA,SAASC,EAAa;AAAA,EAC3BC,QAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,eAAAA,IAAgB;AAAA,EAChBC,cAAAA,IAAe;AAAA,EACfC,qBAAAA;AACmB,GAAuB;AAC1C,QAAMC,IAAeb,EAAuB,IAAI,GAC1Cc,IAAUV,EAAYW,QAAWL,CAAa;AAEpDT,EAAAA,EAAa;AAAA,IACXe,SAASV;AAAAA,IACTO,cAAAA;AAAAA,IACAI,cAAc;AAAA,IACdN,cAAAA;AAAAA,IACAC,qBAAAA;AAAAA,EAAAA,CACD,GAEDV,EAAmB;AAAA,IACjBW,cAAAA;AAAAA,IACAN,WAAAA;AAAAA,IACAS,SAASV;AAAAA,IACTY,qBAAqB;AAAA,EAAA,CACtB;AAOD,QAAMC,IAAc;AAAA,IAClBC,MAAM;AAAA,IACN,cAAc;AAAA,IACdC,UAAU;AAAA,IACV,GATgBlB,EAAsB;AAAA,MACtCM,gBAAgBA,MAAmBD,IAAYO,SAAYD;AAAAA,MAC3DN,WAAAA;AAAAA,IAAAA,CACD;AAAA,EAMIc;AAGL,SAAO;AAAA,IAAET,cAAAA;AAAAA,IAAcC,SAAAA;AAAAA,IAASK,aAAAA;AAAAA,EAAAA;AAClC;"}
@@ -0,0 +1,24 @@
1
+ import { useRef as o, useCallback as u, createContext as s, useContext as c, useEffect as a } from "react";
2
+ const f = /* @__PURE__ */ s(null);
3
+ function l() {
4
+ const r = o(/* @__PURE__ */ new Set()), t = o([]);
5
+ return {
6
+ register: u((n) => (r.current.add(n), t.current = Array.from(r.current), () => {
7
+ r.current.delete(n), t.current = Array.from(r.current);
8
+ }), []),
9
+ portalContainerRefs: t
10
+ };
11
+ }
12
+ function p(r, t) {
13
+ const e = c(f);
14
+ a(() => {
15
+ if (!(!e || !t))
16
+ return e(r);
17
+ }, [e, t, r]);
18
+ }
19
+ export {
20
+ f as FocusTrapPortalContext,
21
+ l as useFocusTrapPortalRegistry,
22
+ p as useRegisterPortalWithFocusTrap
23
+ };
24
+ //# sourceMappingURL=index209.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index209.js","sources":["../src/utils/a11y/FocusTrapPortalContext.tsx"],"sourcesContent":["import { createContext, useCallback, useContext, useEffect, useRef } from 'react';\n\ntype RegisterPortal = (ref: React.RefObject<HTMLElement | null>) => () => void;\n\n/**\n * Context for portal content to register with the nearest focus trap.\n * When a Modal (or any focus trap owner) provides this context, portal-rendered\n * content (e.g., Popover with isWithPortal) can register its container ref so\n * the focus trap's safety net allows focus to move into it.\n */\nexport const FocusTrapPortalContext = createContext<RegisterPortal | null>(null);\n\n/**\n * Hook for the focus trap owner (Modal) to create a portal registration function\n * and a stable ref to the current list of portal container refs.\n *\n * Usage in Modal:\n * ```tsx\n * const { register, portalContainerRefs } = useFocusTrapPortalRegistry();\n * // Pass portalContainerRefs.current to useModalA11y\n * // Wrap children with <FocusTrapPortalContext.Provider value={register}>\n * ```\n */\nexport function useFocusTrapPortalRegistry() {\n const portalRefsSet = useRef<Set<React.RefObject<HTMLElement | null>>>(new Set());\n const portalContainerRefs = useRef<React.RefObject<HTMLElement | null>[]>([]);\n\n const register: RegisterPortal = useCallback((ref) => {\n portalRefsSet.current.add(ref);\n portalContainerRefs.current = Array.from(portalRefsSet.current);\n return () => {\n portalRefsSet.current.delete(ref);\n portalContainerRefs.current = Array.from(portalRefsSet.current);\n };\n }, []);\n\n return { register, portalContainerRefs };\n}\n\n/**\n * Hook for portal content (Popover) to register its container ref with the\n * nearest ancestor focus trap. No-op if there is no focus trap ancestor.\n *\n * @param portalRef - Ref to the portal's root DOM element\n * @param isActive - Whether the portal is currently mounted and should be registered\n */\nexport function useRegisterPortalWithFocusTrap(\n portalRef: React.RefObject<HTMLElement | null>,\n isActive: boolean\n) {\n const register = useContext(FocusTrapPortalContext);\n\n useEffect(() => {\n if (!register || !isActive) return;\n return register(portalRef);\n }, [register, isActive, portalRef]);\n}\n"],"names":["useRef","useCallback","createContext","useContext","useEffect","FocusTrapPortalContext","useFocusTrapPortalRegistry","portalRefsSet","Set","portalContainerRefs","register","ref","current","add","Array","from","delete","useRegisterPortalWithFocusTrap","portalRef","isActive"],"mappings":"AAUO,SAAA,UAAAA,GAAA,eAAAC,GAAA,iBAAAC,GAAA,cAAAC,GAAA,aAAAC,SAAA;AAAA,MAAMC,sBAA8D,IAAI;AAaxE,SAASC,IAA6B;AAC3C,QAAMC,IAAgBP,EAAiD,oBAAIQ,KAAK,GAC1EC,IAAsBT,EAA8C,EAAE;AAW5E,SAAO;AAAA,IAAEU,UATwBT,EAAaU,CAAAA,OAC5CJ,EAAcK,QAAQC,IAAIF,CAAG,GAC7BF,EAAoBG,UAAUE,MAAMC,KAAKR,EAAcK,OAAO,GACvD,MAAM;AACXL,MAAAA,EAAcK,QAAQI,OAAOL,CAAG,GAChCF,EAAoBG,UAAUE,MAAMC,KAAKR,EAAcK,OAAO;AAAA,IAChE,IACC,CAAA,CAAE;AAAA,IAEcH,qBAAAA;AAAAA,EAAAA;AACrB;AASO,SAASQ,EACdC,GACAC,GACA;AACA,QAAMT,IAAWP,EAAWE,CAAsB;AAElDD,EAAAA,EAAU,MAAM;AACd,QAAI,GAACM,KAAY,CAACS;AAClB,aAAOT,EAASQ,CAAS;AAAA,EAC3B,GAAG,CAACR,GAAUS,GAAUD,CAAS,CAAC;AACpC;"}
package/dist/index21.js CHANGED
@@ -1,36 +1,21 @@
1
- import e from "react";
2
- import { Popover as l } from "./index19.js";
3
- import { Icon as s } from "./index6.js";
4
- const t = {
5
- base: "se-design-hamburger-menu rounded-[6px] transition-all duration-300 p-[3px] flex items-center",
6
- active: "bg-[var(--color-blue-450)]",
7
- hover: "hover:bg-[var(--color-blue-450)]"
8
- }, u = ({
9
- className: a = "",
10
- automationId: n = "",
11
- popoverContentAutomationId: m = "",
12
- menuContent: o,
13
- popoverClassName: c = ""
14
- }) => /* @__PURE__ */ e.createElement(l, {
1
+ import e, { forwardRef as u } from "react";
2
+ const m = /* @__PURE__ */ u(({
3
+ leftContainer: t,
4
+ centerContainer: l,
5
+ rightContainer: r,
15
6
  className: a,
16
- position: "bottom-left",
17
- automationId: n,
18
- popoverContentAutomationId: m,
19
- renderPopoverSrcElement: ({
20
- displayPopover: r
21
- }) => /* @__PURE__ */ e.createElement("div", {
22
- className: `${t.base} ${r ? t.active : ""} ${t.hover}`
23
- }, /* @__PURE__ */ e.createElement(s, {
24
- name: "hamburger",
25
- stroke: "var(--color-white)"
26
- })),
27
- renderPopoverContents: (r) => /* @__PURE__ */ e.createElement("div", {
28
- className: `min-w-[212px] ${c}`
29
- }, o && /* @__PURE__ */ e.createElement("div", {
30
- className: "menu-content"
31
- }, o(r)))
32
- });
7
+ id: o,
8
+ ...c
9
+ }, n) => /* @__PURE__ */ e.createElement("header", {
10
+ ref: n,
11
+ id: o,
12
+ tabIndex: -1,
13
+ style: {
14
+ "--focus-color": "var(--color-blue-300)"
15
+ },
16
+ className: `se-design-header ${a} sticky top-0 h-[48px] w-full z-[1010] bg-[var(--color-blue-600)] flex justify-between items-center focus:outline-none ${c?.type === "fixed" ? "fixed left-0 right-0 top-0" : ""}`
17
+ }, t && /* @__PURE__ */ e.createElement(e.Fragment, null, t), l && /* @__PURE__ */ e.createElement(e.Fragment, null, l), r && /* @__PURE__ */ e.createElement(e.Fragment, null, r)));
33
18
  export {
34
- u as HamburgerMenu
19
+ m as Header
35
20
  };
36
21
  //# sourceMappingURL=index21.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index21.js","sources":["../src/components/HamburgerMenu/index.tsx"],"sourcesContent":["import React, { FC } from 'react';\n\nimport { Popover } from 'src/components/Popover';\nimport { Icon } from 'src/components/Icon';\nexport interface HamburgerMenuProps {\n className?: string;\n automationId?: string;\n popoverContentAutomationId?: string;\n menuContent?: (data: any) => React.ReactNode;\n popoverClassName?: string;\n}\n\nconst menuClasses = {\n base: 'se-design-hamburger-menu rounded-[6px] transition-all duration-300 p-[3px] flex items-center',\n active: 'bg-[var(--color-blue-450)]',\n hover: 'hover:bg-[var(--color-blue-450)]'\n};\n\nexport const HamburgerMenu: FC<HamburgerMenuProps> = ({\n className = '',\n automationId = '',\n popoverContentAutomationId = '',\n menuContent,\n popoverClassName = ''\n}) => {\n\n return (\n <Popover\n className={className}\n position='bottom-left'\n automationId={automationId}\n popoverContentAutomationId={popoverContentAutomationId}\n renderPopoverSrcElement={({ displayPopover }) => (\n <div className={`${menuClasses.base} ${displayPopover ? menuClasses.active : ''} ${menuClasses.hover}`}>\n <Icon name='hamburger' stroke={'var(--color-white)'} />\n </div>\n )}\n renderPopoverContents={(data) => (\n <div className={`min-w-[212px] ${popoverClassName}`}>\n {menuContent && <div className='menu-content'>{menuContent(data)}</div>}\n </div>\n )}\n />\n );\n};\n"],"names":["React__default","Popover","Icon","menuClasses","base","active","hover","HamburgerMenu","className","automationId","popoverContentAutomationId","menuContent","popoverClassName","React","createElement","position","renderPopoverSrcElement","displayPopover","name","stroke","renderPopoverContents","data"],"mappings":"AAYA,OAAAA,OAAA;AAAA,SAAA,WAAAC,SAAA;AAAA,SAAA,QAAAC,SAAA;AAAA,MAAMC,IAAc;AAAA,EAClBC,MAAM;AAAA,EACNC,QAAQ;AAAA,EACRC,OAAO;AACT,GAEaC,IAAwCA,CAAC;AAAA,EACpDC,WAAAA,IAAY;AAAA,EACZC,cAAAA,IAAe;AAAA,EACfC,4BAAAA,IAA6B;AAAA,EAC7BC,aAAAA;AAAAA,EACAC,kBAAAA,IAAmB;AACrB,MAGIC,gBAAAA,EAAAC,cAACb,GAAO;AAAA,EACNO,WAAAA;AAAAA,EACAO,UAAS;AAAA,EACTN,cAAAA;AAAAA,EACAC,4BAAAA;AAAAA,EACAM,yBAAyBA,CAAC;AAAA,IAAEC,gBAAAA;AAAAA,EAAAA,MAC1BJ,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAKN,WAAW,GAAGL,EAAYC,IAAI,IAAIa,IAAiBd,EAAYE,SAAS,EAAE,IAAIF,EAAYG,KAAK;AAAA,EAAA,GAClGO,gBAAAA,EAAAC,cAACZ,GAAI;AAAA,IAACgB,MAAK;AAAA,IAAYC,QAAQ;AAAA,EAAA,CAAuB,CACnD;AAAA,EAEPC,uBAAwBC,CAAAA,MACtBR,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAKN,WAAW,iBAAiBI,CAAgB;AAAA,EAAA,GAC9CD,KAAeE,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAKN,WAAU;AAAA,EAAA,GAAgBG,EAAYU,CAAI,CAAO,CACnE;AAAA,CAER;"}
1
+ {"version":3,"file":"index21.js","sources":["../src/components/Header/index.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nexport interface HeaderProps {\n leftContainer?: React.ReactNode;\n centerContainer?: React.ReactNode;\n rightContainer?: React.ReactNode;\n type?: string;\n className?: string;\n id?: string;\n}\n\nexport const Header = forwardRef<HTMLElement, HeaderProps>(({\n leftContainer,\n centerContainer,\n rightContainer,\n className,\n id,\n ...props\n}, ref) => {\n return (\n <header\n ref={ref}\n id={id}\n tabIndex={-1}\n style={{ '--focus-color': 'var(--color-blue-300)' } as React.CSSProperties}\n className={`se-design-header ${className} sticky top-0 h-[48px] w-full z-[1010] bg-[var(--color-blue-600)] flex justify-between items-center focus:outline-none ${\n props?.type === 'fixed' ? 'fixed left-0 right-0 top-0' : ''\n }`}\n >\n {leftContainer && <>{leftContainer}</>}\n {centerContainer && <>{centerContainer}</>}\n {rightContainer && <>{rightContainer}</>}\n </header>\n );\n});\n"],"names":["React__default","forwardRef","Header","leftContainer","centerContainer","rightContainer","className","id","props","ref","React","createElement","tabIndex","style","type","Fragment"],"mappings":"AAWO,OAAAA,KAAA,cAAAC,SAAA;AAAA,MAAMC,sBAA8C,CAAC;AAAA,EAC1DC,eAAAA;AAAAA,EACAC,iBAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,IAAAA;AAAAA,EACA,GAAGC;AACL,GAAGC,MAECC,gBAAAA,EAAAC,cAAA,UAAA;AAAA,EACEF,KAAAA;AAAAA,EACAF,IAAAA;AAAAA,EACAK,UAAU;AAAA,EACVC,OAAO;AAAA,IAAE,iBAAiB;AAAA,EAAA;AAAA,EAC1BP,WAAW,oBAAoBA,CAAS,0HACtCE,GAAOM,SAAS,UAAU,+BAA+B,EAAE;AAAA,GAG5DX,KAAiBO,gBAAAA,EAAAC,cAAAD,EAAAK,UAAA,MAAGZ,CAAgB,GACpCC,KAAmBM,gBAAAA,EAAAC,cAAAD,EAAAK,UAAA,MAAGX,CAAkB,GACxCC,KAAkBK,gBAAAA,EAAAC,cAAAD,EAAAK,UAAA,MAAGV,CAAiB,CACjC,CAEX;"}
package/dist/index216.js CHANGED
@@ -1,75 +1,31 @@
1
- import { useRef as a, useLayoutEffect as m, useEffect as g } from "react";
2
- import { getFirstFocusableElement as d, getLastFocusableElement as F } from "./index71.js";
3
- import { consumeFocusAnchor as I, consumeLastInteractedElement as E } from "./index72.js";
4
- const f = {
5
- position: "absolute",
6
- opacity: 0,
7
- pointerEvents: "none",
8
- width: 0,
9
- height: 0
10
- };
11
- function T({
12
- isOpen: o,
13
- isModal: i,
14
- containerRef: e,
15
- returnFocusRef: l
1
+ import { useCallback as y, useEffect as d } from "react";
2
+ function p({
3
+ containerRef: E,
4
+ onDismiss: e,
5
+ enabled: t = !0,
6
+ useDocumentListener: u = !1,
7
+ preventDefault: c = !0,
8
+ stopPropagation: n = !0
16
9
  }) {
17
- const c = a(null), r = a(null), u = a(null);
18
- return m(() => {
19
- if (i || !o) return;
20
- const t = l?.current ?? I() ?? E() ?? document.activeElement;
21
- if (!(!t || t === document.body) && t.tagName !== "IFRAME")
22
- return c.current = t, u.current && (u.current.tabIndex = 0), () => {
23
- u.current && (u.current.tabIndex = -1);
24
- };
25
- }, [o, i]), g(() => {
26
- if (i || !o || !c.current) return;
27
- const t = requestAnimationFrame(() => {
28
- (d({
29
- container: e.current
30
- }) ?? e.current)?.focus(), r.current && (r.current.tabIndex = 0);
31
- });
32
- return () => {
33
- cancelAnimationFrame(t), r.current && (r.current.tabIndex = -1);
34
- const s = c.current;
35
- c.current = null, s?.isConnected && requestAnimationFrame(() => s.focus());
10
+ const f = y((r) => {
11
+ !t || !e || r.key !== "Escape" || (c && r.preventDefault(), n && r.stopPropagation(), e());
12
+ }, [t, e, c, n]);
13
+ return d(() => {
14
+ if (!u || !t || !e) return;
15
+ const r = E?.current, a = (o) => {
16
+ o.key === "Escape" && (r && !r.contains(document.activeElement) || (c && o.preventDefault(), n && o.stopPropagation(), e()));
36
17
  };
37
- }, [o, i]), {
38
- startSentinelProps: {
39
- ref: r,
40
- tabIndex: -1,
41
- style: f,
42
- "aria-hidden": !0,
43
- "data-focus-sentinel": "start",
44
- onFocus: (t) => {
45
- if (e.current?.contains(t.relatedTarget) && t.relatedTarget !== e.current) {
46
- const n = c.current;
47
- n?.isConnected && n.focus();
48
- } else
49
- r.current && (r.current.tabIndex = -1), (d({
50
- container: e.current
51
- }) ?? e.current)?.focus();
52
- }
53
- },
54
- endSentinelProps: {
55
- ref: u,
56
- tabIndex: -1,
57
- style: f,
58
- "aria-hidden": !0,
59
- "data-focus-sentinel": "end",
60
- onFocus: (t) => {
61
- if (e.current?.contains(t.relatedTarget) && t.relatedTarget !== e.current) {
62
- const n = c.current;
63
- n?.isConnected && n.focus();
64
- } else
65
- (F({
66
- container: e.current
67
- }) ?? e.current)?.focus();
68
- }
69
- }
18
+ return document.addEventListener("keydown", a, {
19
+ capture: !0
20
+ }), () => document.removeEventListener("keydown", a, {
21
+ capture: !0
22
+ });
23
+ }, [u, t, e, E, c, n]), {
24
+ onKeyDown: u ? () => {
25
+ } : f
70
26
  };
71
27
  }
72
28
  export {
73
- T as useFocusSentinel
29
+ p as useDismissOnEscape
74
30
  };
75
31
  //# sourceMappingURL=index216.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index216.js","sources":["../src/utils/a11y/useFocusSentinel.ts"],"sourcesContent":["import { useRef, useEffect, useLayoutEffect } from 'react';\n\nimport { getFirstFocusableElement, getLastFocusableElement } from './focusableElements';\nimport { consumeLastInteractedElement, consumeFocusAnchor } from './useFocusTrap';\n\nconst SENTINEL_STYLE: React.CSSProperties = {\n position: 'absolute',\n opacity: 0,\n pointerEvents: 'none',\n width: 0,\n height: 0,\n};\n\nexport interface UseFocusSentinelOptions {\n /** Whether the panel is currently open. */\n isOpen: boolean | undefined;\n /**\n * When true the hook is a no-op — dialog mode (focus trap) handles focus management instead.\n */\n isModal: boolean;\n /** Ref to the panel container element. */\n containerRef: React.RefObject<HTMLElement | null>;\n /**\n * Explicit element to restore focus to on close.\n * Overrides the automatic trigger capture.\n */\n returnFocusRef?: React.RefObject<HTMLElement | null>;\n}\n\nexport interface SentinelProps {\n ref: React.RefObject<HTMLDivElement | null>;\n tabIndex: number;\n style: React.CSSProperties;\n 'aria-hidden': true;\n 'data-focus-sentinel': 'start' | 'end';\n onFocus: (e: React.FocusEvent) => void;\n}\n\nexport interface UseFocusSentinelReturn {\n /** Spread onto an invisible div placed before the panel content. */\n startSentinelProps: SentinelProps;\n /** Spread onto an invisible div placed after the panel content. */\n endSentinelProps: SentinelProps;\n}\n\n/**\n * Focus management for complementary (non-modal) side panels.\n *\n * Moves focus into the panel on open, restores it to the trigger on close,\n * and wraps Tab / Shift+Tab back to the trigger when focus reaches either end.\n *\n * Sentinel tabIndex values are mutated imperatively (no state) to avoid\n * re-renders. React does not touch a DOM attribute unless the JSX prop value\n * changes, so the initial tabIndex={-1} in the returned props is safe.\n */\nexport function useFocusSentinel({\n isOpen,\n isModal,\n containerRef,\n returnFocusRef,\n}: UseFocusSentinelOptions): UseFocusSentinelReturn {\n const triggerRef = useRef<HTMLElement | null>(null);\n const startSentinelRef = useRef<HTMLDivElement>(null);\n const endSentinelRef = useRef<HTMLDivElement>(null);\n\n // Capture trigger before React commits (document.activeElement is still the opener).\n // Body focus = page-load open → skip so sentinels stay inert.\n useLayoutEffect(() => {\n if (isModal || !isOpen) return;\n const trigger =\n returnFocusRef?.current ??\n consumeFocusAnchor() ??\n consumeLastInteractedElement() ??\n (document.activeElement as HTMLElement);\n if (!trigger || trigger === document.body) return;\n // iframes manage their own internal focus. The parent doc only sees the\n // <iframe> element. Calling .focus() on any parent-doc element while the\n // user is inside an iframe forcibly blurs the iframe content (kills caret\n // on textareas, cancels native <select> dropdowns). Skip capture so the\n // auto-focus on open and focus-restore on close don't run.\n if (trigger.tagName === 'IFRAME') return;\n triggerRef.current = trigger;\n if (endSentinelRef.current) endSentinelRef.current.tabIndex = 0;\n return () => {\n if (endSentinelRef.current) endSentinelRef.current.tabIndex = -1;\n };\n }, [isOpen, isModal]);\n\n // Move focus into panel on open; restore to trigger on close.\n useEffect(() => {\n if (isModal || !isOpen || !triggerRef.current) return;\n\n const rafId = requestAnimationFrame(() => {\n const first = getFirstFocusableElement({ container: containerRef.current });\n (first ?? containerRef.current)?.focus();\n // Activate start sentinel so Shift+Tab from first content returns to trigger.\n if (startSentinelRef.current) startSentinelRef.current.tabIndex = 0;\n });\n\n return () => {\n cancelAnimationFrame(rafId);\n if (startSentinelRef.current) startSentinelRef.current.tabIndex = -1;\n const trigger = triggerRef.current;\n triggerRef.current = null;\n if (trigger?.isConnected) {\n requestAnimationFrame(() => trigger.focus());\n }\n };\n }, [isOpen, isModal]);\n\n const handleStartFocus = (e: React.FocusEvent) => {\n const fromInside =\n containerRef.current?.contains(e.relatedTarget as Node) &&\n e.relatedTarget !== containerRef.current;\n if (fromInside) {\n // Shift+Tab from first content restore trigger\n const trigger = triggerRef.current;\n if (trigger?.isConnected) trigger.focus();\n } else {\n // Natural Tab entry from outside → forward to first content,\n // deactivate so next Shift+Tab exits naturally.\n if (startSentinelRef.current) startSentinelRef.current.tabIndex = -1;\n const first = getFirstFocusableElement({ container: containerRef.current });\n (first ?? containerRef.current)?.focus();\n }\n };\n\n const handleEndFocus = (e: React.FocusEvent) => {\n const fromInside =\n containerRef.current?.contains(e.relatedTarget as Node) &&\n e.relatedTarget !== containerRef.current;\n if (fromInside) {\n // Tab from last content restore trigger\n const trigger = triggerRef.current;\n if (trigger?.isConnected) trigger.focus();\n } else {\n // Shift+Tab entry from outside → back to last content\n const last = getLastFocusableElement({ container: containerRef.current });\n (last ?? containerRef.current)?.focus();\n }\n };\n\n return {\n startSentinelProps: {\n ref: startSentinelRef,\n tabIndex: -1,\n style: SENTINEL_STYLE,\n 'aria-hidden': true as const,\n 'data-focus-sentinel': 'start' as const,\n onFocus: handleStartFocus,\n },\n endSentinelProps: {\n ref: endSentinelRef,\n tabIndex: -1,\n style: SENTINEL_STYLE,\n 'aria-hidden': true as const,\n 'data-focus-sentinel': 'end' as const,\n onFocus: handleEndFocus,\n },\n };\n}\n"],"names":["useRef","useLayoutEffect","useEffect","getFirstFocusableElement","getLastFocusableElement","consumeFocusAnchor","consumeLastInteractedElement","SENTINEL_STYLE","position","opacity","pointerEvents","width","height","useFocusSentinel","isOpen","isModal","containerRef","returnFocusRef","triggerRef","startSentinelRef","endSentinelRef","trigger","current","document","activeElement","body","tagName","tabIndex","rafId","requestAnimationFrame","container","focus","cancelAnimationFrame","isConnected","startSentinelProps","ref","style","onFocus","handleStartFocus","e","contains","relatedTarget","endSentinelProps","handleEndFocus"],"mappings":"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"}
1
+ {"version":3,"file":"index216.js","sources":["../src/utils/a11y/useDismissOnEscape.ts"],"sourcesContent":["import { useCallback, useEffect } from 'react';\nimport type { RefObject } from 'react';\n\nexport interface UseDismissOnEscapeOptions<T extends HTMLElement = HTMLElement> {\n /**\n * Container element ref used for focus-check in document-level mode,\n * and for the returned onKeyDown in React-event mode.\n */\n containerRef?: RefObject<T | null>;\n /**\n * Callback when Escape key is pressed.\n */\n onDismiss?: () => void;\n /**\n * Whether the Escape handler is active.\n * Default: true\n */\n enabled?: boolean;\n /**\n * Use a native document-level capture listener instead of React's event system.\n * Only use this when React events can't reach the container (e.g. portals outside\n * the container's DOM tree). Prefer the default (false) for layered dismiss support.\n * Default: false\n */\n useDocumentListener?: boolean;\n /**\n * Whether to call e.preventDefault() on Escape.\n * Default: true\n */\n preventDefault?: boolean;\n /**\n * Whether to call e.stopPropagation() on Escape.\n * In React-event mode this is the layered-dismiss mechanism set false only if\n * you want the event to continue bubbling to a parent dismiss handler.\n * Default: true\n */\n stopPropagation?: boolean;\n}\n\nexport interface UseDismissOnEscapeReturn {\n /**\n * Spread on the container element. In document-listener mode this is a no-op object.\n */\n onKeyDown: (e: React.KeyboardEvent) => void;\n}\n\n/**\n * Hook to handle Escape key dismissal.\n *\n * Default mode: returns an onKeyDown handler for the container element.\n * Uses React's synthetic events so child stopPropagation() is respected,\n * enabling layered dismiss (e.g. dropdown closes before sidebar).\n *\n * Document-listener mode (useDocumentListener: true): registers a native\n * capture listener on document. Use only when focus may be in a portal\n * outside the container's DOM tree.\n */\nexport function useDismissOnEscape<T extends HTMLElement = HTMLElement>({\n containerRef,\n onDismiss,\n enabled = true,\n useDocumentListener = false,\n preventDefault = true,\n stopPropagation = true,\n}: UseDismissOnEscapeOptions<T>): UseDismissOnEscapeReturn {\n // React-event mode: return handler to spread on container\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (!enabled || !onDismiss || e.key !== 'Escape') return;\n preventDefault && e.preventDefault();\n stopPropagation && e.stopPropagation();\n onDismiss();\n },\n [enabled, onDismiss, preventDefault, stopPropagation]\n );\n\n // Document-listener mode: native capture handler\n useEffect(() => {\n if (!useDocumentListener || !enabled || !onDismiss) return;\n\n const container = containerRef?.current;\n\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key !== 'Escape') return;\n // Only fire if focus is within the container (if provided)\n if (container && !container.contains(document.activeElement)) return;\n preventDefault && e.preventDefault();\n stopPropagation && e.stopPropagation();\n onDismiss();\n };\n\n document.addEventListener('keydown', handleEscape, { capture: true });\n return () => document.removeEventListener('keydown', handleEscape, { capture: true });\n }, [useDocumentListener, enabled, onDismiss, containerRef, preventDefault, stopPropagation]);\n\n return { onKeyDown: useDocumentListener ? (() => {}) : onKeyDown };\n}\n"],"names":["useCallback","useEffect","useDismissOnEscape","containerRef","onDismiss","enabled","useDocumentListener","preventDefault","stopPropagation","onKeyDown","e","key","container","current","handleEscape","contains","document","activeElement","addEventListener","capture","removeEventListener"],"mappings":"AAyDO,SAAA,eAAAA,GAAA,aAAAC,SAAA;AAAA,SAASC,EAAwD;AAAA,EACtEC,cAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,SAAAA,IAAU;AAAA,EACVC,qBAAAA,IAAsB;AAAA,EACtBC,gBAAAA,IAAiB;AAAA,EACjBC,iBAAAA,IAAkB;AACU,GAA6B;AAEzD,QAAMC,IAAYT,EAChB,CAACU,MAA2B;AAC1B,IAAI,CAACL,KAAW,CAACD,KAAaM,EAAEC,QAAQ,aACxCJ,KAAkBG,EAAEH,eAAAA,GACpBC,KAAmBE,EAAEF,gBAAAA,GACrBJ,EAAAA;AAAAA,EACF,GACA,CAACC,GAASD,GAAWG,GAAgBC,CAAe,CACtD;AAGAP,SAAAA,EAAU,MAAM;AACd,QAAI,CAACK,KAAuB,CAACD,KAAW,CAACD,EAAW;AAEpD,UAAMQ,IAAYT,GAAcU,SAE1BC,IAAeA,CAACJ,MAAqB;AACzC,MAAIA,EAAEC,QAAQ,aAEVC,KAAa,CAACA,EAAUG,SAASC,SAASC,aAAa,MAC3DV,KAAkBG,EAAEH,eAAAA,GACpBC,KAAmBE,EAAEF,gBAAAA,GACrBJ,EAAAA;AAAAA,IACF;AAEAY,oBAASE,iBAAiB,WAAWJ,GAAc;AAAA,MAAEK,SAAS;AAAA,IAAA,CAAM,GAC7D,MAAMH,SAASI,oBAAoB,WAAWN,GAAc;AAAA,MAAEK,SAAS;AAAA,IAAA,CAAM;AAAA,EACtF,GAAG,CAACb,GAAqBD,GAASD,GAAWD,GAAcI,GAAgBC,CAAe,CAAC,GAEpF;AAAA,IAAEC,WAAWH,IAAuB,MAAM;AAAA,IAAC,IAAKG;AAAAA,EAAAA;AACzD;"}
@@ -0,0 +1,75 @@
1
+ import { useRef as a, useLayoutEffect as m, useEffect as g } from "react";
2
+ import { getFirstFocusableElement as d, getLastFocusableElement as F } from "./index72.js";
3
+ import { consumeFocusAnchor as I, consumeLastInteractedElement as E } from "./index73.js";
4
+ const f = {
5
+ position: "absolute",
6
+ opacity: 0,
7
+ pointerEvents: "none",
8
+ width: 0,
9
+ height: 0
10
+ };
11
+ function T({
12
+ isOpen: o,
13
+ isModal: i,
14
+ containerRef: e,
15
+ returnFocusRef: l
16
+ }) {
17
+ const c = a(null), r = a(null), u = a(null);
18
+ return m(() => {
19
+ if (i || !o) return;
20
+ const t = l?.current ?? I() ?? E() ?? document.activeElement;
21
+ if (!(!t || t === document.body) && t.tagName !== "IFRAME")
22
+ return c.current = t, u.current && (u.current.tabIndex = 0), () => {
23
+ u.current && (u.current.tabIndex = -1);
24
+ };
25
+ }, [o, i]), g(() => {
26
+ if (i || !o || !c.current) return;
27
+ const t = requestAnimationFrame(() => {
28
+ (d({
29
+ container: e.current
30
+ }) ?? e.current)?.focus(), r.current && (r.current.tabIndex = 0);
31
+ });
32
+ return () => {
33
+ cancelAnimationFrame(t), r.current && (r.current.tabIndex = -1);
34
+ const s = c.current;
35
+ c.current = null, s?.isConnected && requestAnimationFrame(() => s.focus());
36
+ };
37
+ }, [o, i]), {
38
+ startSentinelProps: {
39
+ ref: r,
40
+ tabIndex: -1,
41
+ style: f,
42
+ "aria-hidden": !0,
43
+ "data-focus-sentinel": "start",
44
+ onFocus: (t) => {
45
+ if (e.current?.contains(t.relatedTarget) && t.relatedTarget !== e.current) {
46
+ const n = c.current;
47
+ n?.isConnected && n.focus();
48
+ } else
49
+ r.current && (r.current.tabIndex = -1), (d({
50
+ container: e.current
51
+ }) ?? e.current)?.focus();
52
+ }
53
+ },
54
+ endSentinelProps: {
55
+ ref: u,
56
+ tabIndex: -1,
57
+ style: f,
58
+ "aria-hidden": !0,
59
+ "data-focus-sentinel": "end",
60
+ onFocus: (t) => {
61
+ if (e.current?.contains(t.relatedTarget) && t.relatedTarget !== e.current) {
62
+ const n = c.current;
63
+ n?.isConnected && n.focus();
64
+ } else
65
+ (F({
66
+ container: e.current
67
+ }) ?? e.current)?.focus();
68
+ }
69
+ }
70
+ };
71
+ }
72
+ export {
73
+ T as useFocusSentinel
74
+ };
75
+ //# sourceMappingURL=index217.js.map