@mieweb/ui 0.8.0 → 0.9.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 (380) hide show
  1. package/README.md +162 -739
  2. package/agent/mieweb-ui.instructions.md +34 -16
  3. package/dist/Animated-Cs-naa2g.d.cts +175 -0
  4. package/dist/Animated-Cs-naa2g.d.ts +175 -0
  5. package/dist/CsvBlock-D7Z6ZCRP.js +6 -0
  6. package/dist/{CsvBlock-PUSTBQ5B.js.map → CsvBlock-D7Z6ZCRP.js.map} +1 -1
  7. package/dist/CsvBlock-QXXZ7ZUM.cjs +15 -0
  8. package/dist/{CsvBlock-OTFG3PYZ.cjs.map → CsvBlock-QXXZ7ZUM.cjs.map} +1 -1
  9. package/dist/HtmlPreviewBlock-AADG7MVB.cjs +15 -0
  10. package/dist/{HtmlPreviewBlock-QHLSIMWJ.cjs.map → HtmlPreviewBlock-AADG7MVB.cjs.map} +1 -1
  11. package/dist/HtmlPreviewBlock-F5VDM2EN.js +6 -0
  12. package/dist/{HtmlPreviewBlock-YF2YVKKX.js.map → HtmlPreviewBlock-F5VDM2EN.js.map} +1 -1
  13. package/dist/MermaidBlock-6PLITRBZ.js +6 -0
  14. package/dist/{MermaidBlock-H3TWNC4D.js.map → MermaidBlock-6PLITRBZ.js.map} +1 -1
  15. package/dist/MermaidBlock-TQ2O5CLV.cjs +15 -0
  16. package/dist/{MermaidBlock-ZLLBO3VY.cjs.map → MermaidBlock-TQ2O5CLV.cjs.map} +1 -1
  17. package/dist/SurveyBlock-OYL3VNU5.cjs +15 -0
  18. package/dist/{SurveyBlock-M2ZRTGVJ.cjs.map → SurveyBlock-OYL3VNU5.cjs.map} +1 -1
  19. package/dist/SurveyBlock-W5PSQ62F.js +6 -0
  20. package/dist/{SurveyBlock-JLHS3YQD.js.map → SurveyBlock-W5PSQ62F.js.map} +1 -1
  21. package/dist/ag-grid.cjs +5 -5
  22. package/dist/ag-grid.js +1 -1
  23. package/dist/brands/index.cjs +7 -7
  24. package/dist/brands/index.js +2 -2
  25. package/dist/{chunk-RZJXCI53.js → chunk-22CYDCXA.js} +3 -3
  26. package/dist/{chunk-RZJXCI53.js.map → chunk-22CYDCXA.js.map} +1 -1
  27. package/dist/{chunk-OTQ72WX3.js → chunk-2BPIVWAK.js} +3 -3
  28. package/dist/{chunk-OTQ72WX3.js.map → chunk-2BPIVWAK.js.map} +1 -1
  29. package/dist/{chunk-6EWJGRC3.js → chunk-3JWAABYI.js} +6 -6
  30. package/dist/chunk-3JWAABYI.js.map +1 -0
  31. package/dist/{chunk-5JZIDILK.cjs → chunk-3LHICE4I.cjs} +6 -6
  32. package/dist/chunk-3LHICE4I.cjs.map +1 -0
  33. package/dist/{chunk-JHZW3Y62.js → chunk-3RB35GYK.js} +5 -5
  34. package/dist/chunk-3RB35GYK.js.map +1 -0
  35. package/dist/{chunk-BOW7ZGI2.cjs → chunk-4SM3I7WE.cjs} +170 -10
  36. package/dist/chunk-4SM3I7WE.cjs.map +1 -0
  37. package/dist/{chunk-26DPQUSB.cjs → chunk-5BVFVXHN.cjs} +224 -157
  38. package/dist/chunk-5BVFVXHN.cjs.map +1 -0
  39. package/dist/{chunk-QHTDWIED.js → chunk-5H7SAEQO.js} +5 -5
  40. package/dist/{chunk-QHTDWIED.js.map → chunk-5H7SAEQO.js.map} +1 -1
  41. package/dist/{chunk-EMMYFHOT.js → chunk-5WOB4UBD.js} +3 -3
  42. package/dist/{chunk-EMMYFHOT.js.map → chunk-5WOB4UBD.js.map} +1 -1
  43. package/dist/{chunk-4CUFXCC5.cjs → chunk-5Z6UPVGC.cjs} +6 -6
  44. package/dist/{chunk-4CUFXCC5.cjs.map → chunk-5Z6UPVGC.cjs.map} +1 -1
  45. package/dist/{chunk-YIXTGWT4.cjs → chunk-6QKMMKRY.cjs} +5 -5
  46. package/dist/{chunk-YIXTGWT4.cjs.map → chunk-6QKMMKRY.cjs.map} +1 -1
  47. package/dist/{chunk-F57VRLKP.js → chunk-6SAYPXHX.js} +4 -4
  48. package/dist/{chunk-F57VRLKP.js.map → chunk-6SAYPXHX.js.map} +1 -1
  49. package/dist/{chunk-SK7H3Z67.cjs → chunk-6XDPJWSC.cjs} +99 -83
  50. package/dist/chunk-6XDPJWSC.cjs.map +1 -0
  51. package/dist/{chunk-4AE2L6AO.cjs → chunk-7FTBPLA6.cjs} +8 -8
  52. package/dist/chunk-7FTBPLA6.cjs.map +1 -0
  53. package/dist/{chunk-KVE7PQ5P.cjs → chunk-7KN6J7XV.cjs} +20 -20
  54. package/dist/{chunk-KVE7PQ5P.cjs.map → chunk-7KN6J7XV.cjs.map} +1 -1
  55. package/dist/{chunk-K4S4FAYX.cjs → chunk-AHINB2TP.cjs} +11 -11
  56. package/dist/{chunk-K4S4FAYX.cjs.map → chunk-AHINB2TP.cjs.map} +1 -1
  57. package/dist/{chunk-MYFZYUPR.cjs → chunk-AOHJILLU.cjs} +38 -3
  58. package/dist/chunk-AOHJILLU.cjs.map +1 -0
  59. package/dist/chunk-BKSPDTX4.js +3 -0
  60. package/dist/{chunk-3PXOIAF6.js.map → chunk-BKSPDTX4.js.map} +1 -1
  61. package/dist/chunk-BN75TLUN.cjs +163 -0
  62. package/dist/chunk-BN75TLUN.cjs.map +1 -0
  63. package/dist/{chunk-WWJIW2IH.cjs → chunk-BVMABVC4.cjs} +3 -3
  64. package/dist/{chunk-WWJIW2IH.cjs.map → chunk-BVMABVC4.cjs.map} +1 -1
  65. package/dist/{chunk-H7QSGFMZ.cjs → chunk-BZAGP5W6.cjs} +17 -10
  66. package/dist/chunk-BZAGP5W6.cjs.map +1 -0
  67. package/dist/{chunk-RS5VA6QU.cjs → chunk-C3DUS2VE.cjs} +3 -3
  68. package/dist/{chunk-RS5VA6QU.cjs.map → chunk-C3DUS2VE.cjs.map} +1 -1
  69. package/dist/{chunk-NLBT5O2X.js → chunk-CK3KLRNF.js} +3 -3
  70. package/dist/{chunk-NLBT5O2X.js.map → chunk-CK3KLRNF.js.map} +1 -1
  71. package/dist/{chunk-L6D4CKLV.cjs → chunk-CXDMZT45.cjs} +135 -4
  72. package/dist/chunk-CXDMZT45.cjs.map +1 -0
  73. package/dist/{chunk-TXRQQMG5.js → chunk-CYMZ2QS5.js} +2 -2
  74. package/dist/{chunk-TXRQQMG5.js.map → chunk-CYMZ2QS5.js.map} +1 -1
  75. package/dist/{chunk-DX64KLSN.js → chunk-D25WH7MH.js} +7 -7
  76. package/dist/{chunk-DX64KLSN.js.map → chunk-D25WH7MH.js.map} +1 -1
  77. package/dist/{chunk-XBKOZRDO.js → chunk-DFYMIRMW.js} +4 -4
  78. package/dist/{chunk-XBKOZRDO.js.map → chunk-DFYMIRMW.js.map} +1 -1
  79. package/dist/{chunk-AESFOMSH.js → chunk-DGRXAIWK.js} +135 -4
  80. package/dist/chunk-DGRXAIWK.js.map +1 -0
  81. package/dist/{chunk-UZ5NGGMI.js → chunk-EG7XFZ3W.js} +4 -4
  82. package/dist/{chunk-UZ5NGGMI.js.map → chunk-EG7XFZ3W.js.map} +1 -1
  83. package/dist/{chunk-RYQ3S3KO.cjs → chunk-FQBTGS3E.cjs} +23 -20
  84. package/dist/chunk-FQBTGS3E.cjs.map +1 -0
  85. package/dist/{chunk-LQHI44OZ.cjs → chunk-FUFBRKOG.cjs} +59 -59
  86. package/dist/{chunk-LQHI44OZ.cjs.map → chunk-FUFBRKOG.cjs.map} +1 -1
  87. package/dist/{chunk-DG7KE4YJ.cjs → chunk-FYAKUU2A.cjs} +38 -21
  88. package/dist/chunk-FYAKUU2A.cjs.map +1 -0
  89. package/dist/{chunk-7L7OPISJ.cjs → chunk-H4AVMUOC.cjs} +12 -6
  90. package/dist/chunk-H4AVMUOC.cjs.map +1 -0
  91. package/dist/{chunk-I2ECTLON.cjs → chunk-HXSA6QC5.cjs} +3 -3
  92. package/dist/{chunk-I2ECTLON.cjs.map → chunk-HXSA6QC5.cjs.map} +1 -1
  93. package/dist/{chunk-DCBMTFLE.js → chunk-HZ4MBUC3.js} +3 -3
  94. package/dist/{chunk-DCBMTFLE.js.map → chunk-HZ4MBUC3.js.map} +1 -1
  95. package/dist/{chunk-X5ZPYYMS.js → chunk-I3DQXUSC.js} +3 -3
  96. package/dist/{chunk-X5ZPYYMS.js.map → chunk-I3DQXUSC.js.map} +1 -1
  97. package/dist/{chunk-FN6VHMLM.cjs → chunk-IB54SKWB.cjs} +8 -8
  98. package/dist/{chunk-FN6VHMLM.cjs.map → chunk-IB54SKWB.cjs.map} +1 -1
  99. package/dist/{chunk-JP5SGIXA.cjs → chunk-IFDC4TXM.cjs} +4 -4
  100. package/dist/{chunk-JP5SGIXA.cjs.map → chunk-IFDC4TXM.cjs.map} +1 -1
  101. package/dist/{chunk-RDGRKYQ5.cjs → chunk-IINZWUGK.cjs} +58 -6
  102. package/dist/chunk-IINZWUGK.cjs.map +1 -0
  103. package/dist/{chunk-U3JU6BI5.cjs → chunk-JEIW7BSV.cjs} +3 -3
  104. package/dist/{chunk-U3JU6BI5.cjs.map → chunk-JEIW7BSV.cjs.map} +1 -1
  105. package/dist/{chunk-D2GID3YK.js → chunk-KREUYVMZ.js} +58 -6
  106. package/dist/chunk-KREUYVMZ.js.map +1 -0
  107. package/dist/{chunk-Y6YSJPVC.js → chunk-KRU6IGV7.js} +11 -3
  108. package/dist/chunk-KRU6IGV7.js.map +1 -0
  109. package/dist/{chunk-LZU7YBXG.js → chunk-KU3XRHWA.js} +169 -10
  110. package/dist/chunk-KU3XRHWA.js.map +1 -0
  111. package/dist/{chunk-P2VTQ5AR.cjs → chunk-L52N6BEN.cjs} +39 -23
  112. package/dist/chunk-L52N6BEN.cjs.map +1 -0
  113. package/dist/{chunk-XWYKLEKG.js → chunk-L5W7TJQ5.js} +11 -5
  114. package/dist/chunk-L5W7TJQ5.js.map +1 -0
  115. package/dist/{chunk-PAM5UUBL.cjs → chunk-L7L5S2HO.cjs} +18 -2
  116. package/dist/{chunk-PAM5UUBL.cjs.map → chunk-L7L5S2HO.cjs.map} +1 -1
  117. package/dist/{chunk-SEPYBAML.js → chunk-LAEIVOIY.js} +38 -21
  118. package/dist/chunk-LAEIVOIY.js.map +1 -0
  119. package/dist/{chunk-Z5KFXHDP.cjs → chunk-MM7QKUE3.cjs} +5 -5
  120. package/dist/{chunk-Z5KFXHDP.cjs.map → chunk-MM7QKUE3.cjs.map} +1 -1
  121. package/dist/{chunk-FJ7YPVKV.js → chunk-MUIDWFYJ.js} +3 -3
  122. package/dist/{chunk-FJ7YPVKV.js.map → chunk-MUIDWFYJ.js.map} +1 -1
  123. package/dist/{chunk-FDV7EQWH.js → chunk-MXQ7J4BB.js} +21 -18
  124. package/dist/chunk-MXQ7J4BB.js.map +1 -0
  125. package/dist/{chunk-YMHOF6WA.cjs → chunk-MYAU2ZUC.cjs} +3 -3
  126. package/dist/{chunk-YMHOF6WA.cjs.map → chunk-MYAU2ZUC.cjs.map} +1 -1
  127. package/dist/{chunk-5J5PEUUA.js → chunk-NHN6A3ZO.js} +6 -6
  128. package/dist/{chunk-5J5PEUUA.js.map → chunk-NHN6A3ZO.js.map} +1 -1
  129. package/dist/{chunk-EPQPUFS6.cjs → chunk-NYJIXR4Y.cjs} +6 -6
  130. package/dist/chunk-NYJIXR4Y.cjs.map +1 -0
  131. package/dist/{chunk-EKRT7K2K.js → chunk-O6GJ4IYS.js} +222 -157
  132. package/dist/chunk-O6GJ4IYS.js.map +1 -0
  133. package/dist/{chunk-WIYQI35R.cjs → chunk-O7XHHTTP.cjs} +8 -8
  134. package/dist/{chunk-WIYQI35R.cjs.map → chunk-O7XHHTTP.cjs.map} +1 -1
  135. package/dist/{chunk-IILJGFI5.js → chunk-OAZUDUGX.js} +8 -6
  136. package/dist/chunk-OAZUDUGX.js.map +1 -0
  137. package/dist/{chunk-JHGMZX4I.cjs → chunk-OCV33S5Q.cjs} +6 -6
  138. package/dist/{chunk-JHGMZX4I.cjs.map → chunk-OCV33S5Q.cjs.map} +1 -1
  139. package/dist/{chunk-IYXCFIMP.js → chunk-ODYQYLO2.js} +33 -17
  140. package/dist/chunk-ODYQYLO2.js.map +1 -0
  141. package/dist/{chunk-FPVRQCCL.js → chunk-OHDIJOGG.js} +4 -4
  142. package/dist/{chunk-FPVRQCCL.js.map → chunk-OHDIJOGG.js.map} +1 -1
  143. package/dist/{chunk-GQVL2JKQ.cjs → chunk-OHKO5THF.cjs} +3 -3
  144. package/dist/{chunk-GQVL2JKQ.cjs.map → chunk-OHKO5THF.cjs.map} +1 -1
  145. package/dist/{chunk-LMBXJZLG.js → chunk-ON4JULCA.js} +3 -3
  146. package/dist/{chunk-LMBXJZLG.js.map → chunk-ON4JULCA.js.map} +1 -1
  147. package/dist/{chunk-A5YOIJKL.js → chunk-ONNY7UO4.js} +15 -15
  148. package/dist/{chunk-A5YOIJKL.js.map → chunk-ONNY7UO4.js.map} +1 -1
  149. package/dist/{chunk-DWCYEPTT.js → chunk-OSPTA4UR.js} +4 -4
  150. package/dist/{chunk-DWCYEPTT.js.map → chunk-OSPTA4UR.js.map} +1 -1
  151. package/dist/{chunk-FDUA6OGN.js → chunk-PFKRHNYV.js} +8 -8
  152. package/dist/chunk-PFKRHNYV.js.map +1 -0
  153. package/dist/{chunk-XMECP2MD.js → chunk-PHK4XBO5.js} +4 -4
  154. package/dist/{chunk-XMECP2MD.js.map → chunk-PHK4XBO5.js.map} +1 -1
  155. package/dist/{chunk-ZZJ4ZVYR.cjs → chunk-PJ6CC53R.cjs} +3 -3
  156. package/dist/{chunk-ZZJ4ZVYR.cjs.map → chunk-PJ6CC53R.cjs.map} +1 -1
  157. package/dist/{chunk-N3Y43KOB.js → chunk-PYHFVYVZ.js} +12 -5
  158. package/dist/chunk-PYHFVYVZ.js.map +1 -0
  159. package/dist/{chunk-XMCIXHGH.js → chunk-Q7G56ZIO.js} +39 -23
  160. package/dist/chunk-Q7G56ZIO.js.map +1 -0
  161. package/dist/{chunk-4PIW3Y5M.js → chunk-QAKASRE6.js} +34 -26
  162. package/dist/chunk-QAKASRE6.js.map +1 -0
  163. package/dist/{chunk-QGZC43L7.js → chunk-QAQOCS2J.js} +5 -5
  164. package/dist/{chunk-QGZC43L7.js.map → chunk-QAQOCS2J.js.map} +1 -1
  165. package/dist/{chunk-YVIH26FG.cjs → chunk-QKAYRHWP.cjs} +12 -12
  166. package/dist/{chunk-YVIH26FG.cjs.map → chunk-QKAYRHWP.cjs.map} +1 -1
  167. package/dist/{chunk-P3JEMF6E.cjs → chunk-RSCA5AZW.cjs} +4 -4
  168. package/dist/{chunk-P3JEMF6E.cjs.map → chunk-RSCA5AZW.cjs.map} +1 -1
  169. package/dist/{chunk-5Y5FSR4N.js → chunk-SCXELRRZ.js} +3 -3
  170. package/dist/{chunk-5Y5FSR4N.js.map → chunk-SCXELRRZ.js.map} +1 -1
  171. package/dist/{chunk-JWTCEWQ4.cjs → chunk-SNEQXSC5.cjs} +2 -2
  172. package/dist/{chunk-JWTCEWQ4.cjs.map → chunk-SNEQXSC5.cjs.map} +1 -1
  173. package/dist/{chunk-U5TTXN45.cjs → chunk-SRA2L3SQ.cjs} +9 -7
  174. package/dist/chunk-SRA2L3SQ.cjs.map +1 -0
  175. package/dist/{chunk-5U6GETAW.js → chunk-TQDZLRIE.js} +3 -3
  176. package/dist/chunk-TQDZLRIE.js.map +1 -0
  177. package/dist/{chunk-HK3AMH3Q.cjs → chunk-VROIMIHB.cjs} +11 -3
  178. package/dist/chunk-VROIMIHB.cjs.map +1 -0
  179. package/dist/{chunk-3SHLOF4V.cjs → chunk-VTR2KGLY.cjs} +9 -9
  180. package/dist/{chunk-3SHLOF4V.cjs.map → chunk-VTR2KGLY.cjs.map} +1 -1
  181. package/dist/{chunk-XO3WLK65.js → chunk-VVDE4CHU.js} +3 -3
  182. package/dist/{chunk-XO3WLK65.js.map → chunk-VVDE4CHU.js.map} +1 -1
  183. package/dist/{chunk-XS35KPBZ.cjs → chunk-WIAQQNFU.cjs} +4 -4
  184. package/dist/{chunk-XS35KPBZ.cjs.map → chunk-WIAQQNFU.cjs.map} +1 -1
  185. package/dist/{chunk-BOOJDRJO.js → chunk-WSNMQQ4P.js} +38 -3
  186. package/dist/chunk-WSNMQQ4P.js.map +1 -0
  187. package/dist/chunk-WYMO3IIK.js +136 -0
  188. package/dist/chunk-WYMO3IIK.js.map +1 -0
  189. package/dist/{chunk-SPWVKDGC.cjs → chunk-X5QRRMGB.cjs} +35 -27
  190. package/dist/chunk-X5QRRMGB.cjs.map +1 -0
  191. package/dist/{chunk-SH6B4MG5.js → chunk-XBXDUAIM.js} +4 -4
  192. package/dist/{chunk-SH6B4MG5.js.map → chunk-XBXDUAIM.js.map} +1 -1
  193. package/dist/{chunk-56QJHQ5C.cjs → chunk-XEEVDZDK.cjs} +5 -5
  194. package/dist/{chunk-56QJHQ5C.cjs.map → chunk-XEEVDZDK.cjs.map} +1 -1
  195. package/dist/{chunk-GXODR6V4.js → chunk-XOIIUO6O.js} +3 -3
  196. package/dist/{chunk-GXODR6V4.js.map → chunk-XOIIUO6O.js.map} +1 -1
  197. package/dist/{chunk-ELYGV32O.cjs → chunk-XTHMC76F.cjs} +5 -5
  198. package/dist/{chunk-ELYGV32O.cjs.map → chunk-XTHMC76F.cjs.map} +1 -1
  199. package/dist/{chunk-FF235PKY.cjs → chunk-XWZEECEX.cjs} +3 -3
  200. package/dist/chunk-XWZEECEX.cjs.map +1 -0
  201. package/dist/{chunk-TVLZZI5Q.cjs → chunk-YJP6DUFO.cjs} +9 -9
  202. package/dist/{chunk-TVLZZI5Q.cjs.map → chunk-YJP6DUFO.cjs.map} +1 -1
  203. package/dist/{chunk-EHQ77LL5.js → chunk-ZB54MTMQ.js} +3 -3
  204. package/dist/{chunk-EHQ77LL5.js.map → chunk-ZB54MTMQ.js.map} +1 -1
  205. package/dist/components/Accordion/index.cjs +2 -2
  206. package/dist/components/Accordion/index.js +1 -1
  207. package/dist/components/Alert/index.cjs +5 -5
  208. package/dist/components/Alert/index.d.cts +1 -1
  209. package/dist/components/Alert/index.d.ts +1 -1
  210. package/dist/components/Alert/index.js +1 -1
  211. package/dist/components/AlertDialog/index.cjs +6 -5
  212. package/dist/components/AlertDialog/index.js +5 -4
  213. package/dist/components/AudioPlayer/index.cjs +6 -6
  214. package/dist/components/AudioPlayer/index.js +1 -1
  215. package/dist/components/Autocomplete/index.cjs +4 -4
  216. package/dist/components/Autocomplete/index.js +3 -3
  217. package/dist/components/Avatar/index.cjs +5 -5
  218. package/dist/components/Avatar/index.js +1 -1
  219. package/dist/components/Badge/index.d.cts +1 -1
  220. package/dist/components/Badge/index.d.ts +1 -1
  221. package/dist/components/Breadcrumb/index.cjs +3 -3
  222. package/dist/components/Breadcrumb/index.js +1 -1
  223. package/dist/components/Button/index.cjs +3 -3
  224. package/dist/components/Button/index.js +1 -1
  225. package/dist/components/Card/index.d.cts +2 -2
  226. package/dist/components/Card/index.d.ts +2 -2
  227. package/dist/components/CountryCodeDropdown/index.cjs +6 -6
  228. package/dist/components/CountryCodeDropdown/index.d.cts +11 -1
  229. package/dist/components/CountryCodeDropdown/index.d.ts +11 -1
  230. package/dist/components/CountryCodeDropdown/index.js +3 -3
  231. package/dist/components/CustomizableDashboard/index.cjs +11 -11
  232. package/dist/components/CustomizableDashboard/index.js +4 -4
  233. package/dist/components/DateInput/index.cjs +4 -4
  234. package/dist/components/DateInput/index.js +3 -3
  235. package/dist/components/Dropdown/index.cjs +13 -9
  236. package/dist/components/Dropdown/index.d.cts +38 -2
  237. package/dist/components/Dropdown/index.d.ts +38 -2
  238. package/dist/components/Dropdown/index.js +3 -3
  239. package/dist/components/FloatingWindow/index.cjs +4 -4
  240. package/dist/components/FloatingWindow/index.js +2 -2
  241. package/dist/components/GlossaryTooltip/index.cjs +4 -4
  242. package/dist/components/GlossaryTooltip/index.js +3 -3
  243. package/dist/components/KeyboardShortcutsOverlay/index.cjs +6 -5
  244. package/dist/components/KeyboardShortcutsOverlay/index.js +4 -3
  245. package/dist/components/Markdown/index.cjs +19 -19
  246. package/dist/components/Markdown/index.js +7 -7
  247. package/dist/components/MediaEditor/index.cjs +15 -14
  248. package/dist/components/MediaEditor/index.js +10 -9
  249. package/dist/components/MediaPlayer/index.cjs +6 -6
  250. package/dist/components/MediaPlayer/index.js +3 -3
  251. package/dist/components/Modal/index.cjs +11 -10
  252. package/dist/components/Modal/index.d.cts +1 -1
  253. package/dist/components/Modal/index.d.ts +1 -1
  254. package/dist/components/Modal/index.js +3 -2
  255. package/dist/components/Pagination/index.cjs +4 -4
  256. package/dist/components/Pagination/index.d.cts +1 -1
  257. package/dist/components/Pagination/index.d.ts +1 -1
  258. package/dist/components/Pagination/index.js +1 -1
  259. package/dist/components/PhoneInput/index.cjs +4 -4
  260. package/dist/components/PhoneInput/index.js +2 -2
  261. package/dist/components/Progress/index.d.cts +1 -1
  262. package/dist/components/Progress/index.d.ts +1 -1
  263. package/dist/components/QuickAction/index.cjs +6 -6
  264. package/dist/components/QuickAction/index.js +1 -1
  265. package/dist/components/RecordButton/index.d.cts +1 -1
  266. package/dist/components/RecordButton/index.d.ts +1 -1
  267. package/dist/components/RichTextEditor/index.cjs +9 -9
  268. package/dist/components/RichTextEditor/index.js +6 -6
  269. package/dist/components/SectionSpyNav/index.cjs +4 -4
  270. package/dist/components/SectionSpyNav/index.js +3 -3
  271. package/dist/components/Select/index.cjs +5 -5
  272. package/dist/components/Select/index.js +3 -3
  273. package/dist/components/Sheet/index.cjs +11 -11
  274. package/dist/components/Sheet/index.js +2 -2
  275. package/dist/components/Slider/index.cjs +5 -5
  276. package/dist/components/Slider/index.d.cts +2 -2
  277. package/dist/components/Slider/index.d.ts +2 -2
  278. package/dist/components/Slider/index.js +1 -1
  279. package/dist/components/SourceTip/index.cjs +4 -4
  280. package/dist/components/SourceTip/index.js +3 -3
  281. package/dist/components/SuperChat/index.cjs +264 -106
  282. package/dist/components/SuperChat/index.cjs.map +1 -1
  283. package/dist/components/SuperChat/index.d.cts +13 -5
  284. package/dist/components/SuperChat/index.d.ts +13 -5
  285. package/dist/components/SuperChat/index.js +255 -97
  286. package/dist/components/SuperChat/index.js.map +1 -1
  287. package/dist/components/SuperChat/plugins/index.cjs +7 -7
  288. package/dist/components/SuperChat/plugins/index.cjs.map +1 -1
  289. package/dist/components/SuperChat/plugins/index.d.cts +2 -2
  290. package/dist/components/SuperChat/plugins/index.d.ts +2 -2
  291. package/dist/components/SuperChat/plugins/index.js +6 -6
  292. package/dist/components/SuperChat/plugins/index.js.map +1 -1
  293. package/dist/components/Text/index.d.cts +1 -1
  294. package/dist/components/Text/index.d.ts +1 -1
  295. package/dist/components/ThemeProvider/index.cjs +9 -9
  296. package/dist/components/ThemeProvider/index.d.cts +1 -1
  297. package/dist/components/ThemeProvider/index.d.ts +1 -1
  298. package/dist/components/ThemeProvider/index.js +3 -3
  299. package/dist/components/Toggle/index.d.cts +1 -1
  300. package/dist/components/Toggle/index.d.ts +1 -1
  301. package/dist/components/Tooltip/index.cjs +3 -3
  302. package/dist/components/Tooltip/index.js +2 -2
  303. package/dist/components/TranscriptView/index.cjs +3 -3
  304. package/dist/components/TranscriptView/index.js +1 -1
  305. package/dist/datavis.cjs +2 -2
  306. package/dist/datavis.js +1 -1
  307. package/dist/esheet.cjs +15 -14
  308. package/dist/esheet.cjs.map +1 -1
  309. package/dist/esheet.js +12 -11
  310. package/dist/esheet.js.map +1 -1
  311. package/dist/hooks/index.cjs +3 -3
  312. package/dist/hooks/index.d.cts +1 -1
  313. package/dist/hooks/index.d.ts +1 -1
  314. package/dist/hooks/index.js +2 -2
  315. package/dist/index.cjs +2399 -1640
  316. package/dist/index.cjs.map +1 -1
  317. package/dist/index.d.cts +278 -43
  318. package/dist/index.d.ts +278 -43
  319. package/dist/index.js +1296 -574
  320. package/dist/index.js.map +1 -1
  321. package/dist/motion.cjs +87 -0
  322. package/dist/motion.cjs.map +1 -0
  323. package/dist/motion.d.cts +52 -0
  324. package/dist/motion.d.ts +52 -0
  325. package/dist/motion.js +50 -0
  326. package/dist/motion.js.map +1 -0
  327. package/dist/styles/init.css +25 -0
  328. package/dist/styles.css +1 -1
  329. package/dist/tailwind-preset.cjs +4 -4
  330. package/dist/tailwind-preset.js +1 -1
  331. package/dist/{types-BoTeTPdH.d.ts → types-9vK_YdEb.d.ts} +12 -1
  332. package/dist/{types-DyIB9HYT.d.cts → types-DZDroUW8.d.cts} +12 -1
  333. package/dist/{useAnchoredPosition-C7PNglzD.d.ts → useAnchoredPosition-CKwLSQW8.d.cts} +10 -3
  334. package/dist/{useAnchoredPosition-C7PNglzD.d.cts → useAnchoredPosition-CKwLSQW8.d.ts} +10 -3
  335. package/package.json +21 -2
  336. package/dist/CsvBlock-OTFG3PYZ.cjs +0 -15
  337. package/dist/CsvBlock-PUSTBQ5B.js +0 -6
  338. package/dist/HtmlPreviewBlock-QHLSIMWJ.cjs +0 -15
  339. package/dist/HtmlPreviewBlock-YF2YVKKX.js +0 -6
  340. package/dist/MermaidBlock-H3TWNC4D.js +0 -6
  341. package/dist/MermaidBlock-ZLLBO3VY.cjs +0 -15
  342. package/dist/SurveyBlock-JLHS3YQD.js +0 -6
  343. package/dist/SurveyBlock-M2ZRTGVJ.cjs +0 -15
  344. package/dist/chunk-26DPQUSB.cjs.map +0 -1
  345. package/dist/chunk-3PXOIAF6.js +0 -3
  346. package/dist/chunk-4AE2L6AO.cjs.map +0 -1
  347. package/dist/chunk-4PIW3Y5M.js.map +0 -1
  348. package/dist/chunk-5JZIDILK.cjs.map +0 -1
  349. package/dist/chunk-5U6GETAW.js.map +0 -1
  350. package/dist/chunk-6EWJGRC3.js.map +0 -1
  351. package/dist/chunk-7L7OPISJ.cjs.map +0 -1
  352. package/dist/chunk-AESFOMSH.js.map +0 -1
  353. package/dist/chunk-BOOJDRJO.js.map +0 -1
  354. package/dist/chunk-BOW7ZGI2.cjs.map +0 -1
  355. package/dist/chunk-D2GID3YK.js.map +0 -1
  356. package/dist/chunk-DG7KE4YJ.cjs.map +0 -1
  357. package/dist/chunk-EKRT7K2K.js.map +0 -1
  358. package/dist/chunk-EPQPUFS6.cjs.map +0 -1
  359. package/dist/chunk-FDUA6OGN.js.map +0 -1
  360. package/dist/chunk-FDV7EQWH.js.map +0 -1
  361. package/dist/chunk-FF235PKY.cjs.map +0 -1
  362. package/dist/chunk-H7QSGFMZ.cjs.map +0 -1
  363. package/dist/chunk-HK3AMH3Q.cjs.map +0 -1
  364. package/dist/chunk-IILJGFI5.js.map +0 -1
  365. package/dist/chunk-IYXCFIMP.js.map +0 -1
  366. package/dist/chunk-JHZW3Y62.js.map +0 -1
  367. package/dist/chunk-L6D4CKLV.cjs.map +0 -1
  368. package/dist/chunk-LZU7YBXG.js.map +0 -1
  369. package/dist/chunk-MYFZYUPR.cjs.map +0 -1
  370. package/dist/chunk-N3Y43KOB.js.map +0 -1
  371. package/dist/chunk-P2VTQ5AR.cjs.map +0 -1
  372. package/dist/chunk-RDGRKYQ5.cjs.map +0 -1
  373. package/dist/chunk-RYQ3S3KO.cjs.map +0 -1
  374. package/dist/chunk-SEPYBAML.js.map +0 -1
  375. package/dist/chunk-SK7H3Z67.cjs.map +0 -1
  376. package/dist/chunk-SPWVKDGC.cjs.map +0 -1
  377. package/dist/chunk-U5TTXN45.cjs.map +0 -1
  378. package/dist/chunk-XMCIXHGH.js.map +0 -1
  379. package/dist/chunk-XWYKLEKG.js.map +0 -1
  380. package/dist/chunk-Y6YSJPVC.js.map +0 -1
@@ -0,0 +1,136 @@
1
+ import { cn } from './chunk-TQONQSJO.js';
2
+ import * as React from 'react';
3
+ import { jsx, Fragment } from 'react/jsx-runtime';
4
+
5
+ // src/motion/presets.ts
6
+ var motionPresets = {
7
+ /**
8
+ * Off-canvas panel pinned to the inline-start edge. Animates `x` only, which
9
+ * the compositor can handle without layout or paint.
10
+ */
11
+ drawerStart: {
12
+ variants: {
13
+ open: { x: "0%" },
14
+ // Off-canvas direction follows writing direction, mirroring the
15
+ // `-translate-x-full rtl:translate-x-full` CSS fallback.
16
+ closed: (isRtl) => ({ x: isRtl ? "100%" : "-100%" })
17
+ },
18
+ transition: { type: "spring", stiffness: 400, damping: 40, mass: 1 }
19
+ },
20
+ /** Scrim behind a drawer or modal. */
21
+ overlay: {
22
+ variants: {
23
+ open: { opacity: 1 },
24
+ closed: { opacity: 0 }
25
+ },
26
+ transition: { duration: 0.2, ease: "easeOut" }
27
+ },
28
+ /** Centered dialog surface — rises and settles rather than popping. */
29
+ modalContent: {
30
+ variants: {
31
+ open: { opacity: 1, scale: 1, y: 0 },
32
+ closed: { opacity: 0, scale: 0.96, y: 8 }
33
+ },
34
+ transition: { type: "spring", stiffness: 500, damping: 40, mass: 0.8 }
35
+ },
36
+ /**
37
+ * Text that disappears as its container narrows — sidebar labels on collapse.
38
+ *
39
+ * Opacity only, and deliberately so. An inline-axis slide would read slightly
40
+ * better but would make every label direction-aware, and resolving direction
41
+ * per nav item is a disproportionate amount of plumbing for an 8px nudge.
42
+ * Fading also degrades to itself under reduced motion instead of becoming a
43
+ * different animation.
44
+ *
45
+ * Short because it runs on many elements at once and has to finish inside the
46
+ * container's own width transition, or labels are still fading after the rail
47
+ * has stopped moving.
48
+ */
49
+ sidebarLabel: {
50
+ variants: {
51
+ open: { opacity: 1 },
52
+ closed: { opacity: 0 }
53
+ },
54
+ transition: { duration: 0.15, ease: "easeOut" }
55
+ }
56
+ };
57
+ var CONTEXT_KEY = /* @__PURE__ */ Symbol.for("@mieweb/ui.motionRuntimeContext.v1");
58
+ function getMotionRuntimeContext() {
59
+ const globalScope = globalThis;
60
+ if (!globalScope[CONTEXT_KEY]) {
61
+ globalScope[CONTEXT_KEY] = React.createContext(null);
62
+ }
63
+ return globalScope[CONTEXT_KEY];
64
+ }
65
+ var MotionRuntimeContext = getMotionRuntimeContext();
66
+ function useMotionRuntime() {
67
+ return React.useContext(MotionRuntimeContext);
68
+ }
69
+ function createPresetPropBuilders() {
70
+ return {
71
+ toggle(preset, open, custom) {
72
+ const { variants, transition } = motionPresets[preset];
73
+ return {
74
+ variants,
75
+ transition,
76
+ custom,
77
+ // `false` pins the element to its current variant on mount instead of
78
+ // animating into it.
79
+ initial: false,
80
+ animate: open ? "open" : "closed"
81
+ };
82
+ },
83
+ presence(preset, custom) {
84
+ const { variants, transition } = motionPresets[preset];
85
+ return {
86
+ variants,
87
+ transition,
88
+ custom,
89
+ initial: "closed",
90
+ animate: "open",
91
+ exit: "closed"
92
+ };
93
+ }
94
+ };
95
+ }
96
+ var Animated = React.forwardRef(
97
+ function Animated2({
98
+ as = "div",
99
+ preset,
100
+ mode,
101
+ open = false,
102
+ custom,
103
+ className,
104
+ fallbackClassName,
105
+ enabled = true,
106
+ children,
107
+ ...rest
108
+ }, ref) {
109
+ const runtime = useMotionRuntime();
110
+ if (!runtime || !runtime.enabled || !enabled) {
111
+ const Tag = as;
112
+ return /* @__PURE__ */ jsx(Tag, { ref, className: cn(fallbackClassName, className), ...rest, children });
113
+ }
114
+ const Component = as === "nav" ? runtime.Nav : as === "span" ? runtime.Span : runtime.Div;
115
+ const motionProps = mode === "toggle" ? runtime.toggle(preset, open, custom) : runtime.presence(preset, custom);
116
+ return /* @__PURE__ */ jsx(Component, { ref, className, ...motionProps, ...rest, children });
117
+ }
118
+ );
119
+ Animated.displayName = "Animated";
120
+ function AnimatedPresence({
121
+ children,
122
+ initial,
123
+ onExitComplete
124
+ }) {
125
+ const runtime = useMotionRuntime();
126
+ if (!runtime) {
127
+ return /* @__PURE__ */ jsx(Fragment, { children });
128
+ }
129
+ const { Presence } = runtime;
130
+ return /* @__PURE__ */ jsx(Presence, { initial, onExitComplete, children });
131
+ }
132
+ AnimatedPresence.displayName = "AnimatedPresence";
133
+
134
+ export { Animated, AnimatedPresence, MotionRuntimeContext, createPresetPropBuilders, motionPresets, useMotionRuntime };
135
+ //# sourceMappingURL=chunk-WYMO3IIK.js.map
136
+ //# sourceMappingURL=chunk-WYMO3IIK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/motion/presets.ts","../src/motion/runtime.ts","../src/motion/Animated.tsx"],"names":["React2","Animated"],"mappings":";;;;;AAuDO,IAAM,aAAA,GAA8D;AAAA;AAAA;AAAA;AAA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,OAAA;AACrB,EAAA,uBACE,GAAA,CAAC,QAAA,EAAA,EAAS,OAAA,EAAkB,cAAA,EACzB,QAAA,EACH,CAAA;AAEJ;AAEA,gBAAA,CAAiB,WAAA,GAAc,kBAAA","file":"chunk-WYMO3IIK.js","sourcesContent":["/**\n * Motion presets — the shared vocabulary of animations.\n *\n * This module is intentionally **free of any `motion` import**. It ships in the\n * main `@mieweb/ui` entry so components can describe *what* they animate\n * without pulling in a runtime to actually do it. The `@mieweb/ui/motion` entry\n * is what turns these descriptions into real animations.\n *\n * Every preset is expressed as an open/closed variant pair so the same\n * definition serves both usages:\n *\n * - **toggle** — the element stays mounted and animates between `open` and\n * `closed` (a drawer sliding in and out).\n * - **presence** — the element mounts and unmounts, entering on `open` and\n * exiting back to `closed` (a modal).\n */\n\n// =============================================================================\n// Types\n// =============================================================================\n\n/** Named animation recipes shared by components. */\nexport type MotionPreset =\n | 'drawerStart'\n | 'overlay'\n | 'modalContent'\n | 'sidebarLabel';\n\n/**\n * A variant value. Either a plain target object or a function of the element's\n * `custom` value — the latter lets a single preset adapt to context, e.g. a\n * drawer flipping its off-canvas direction in RTL.\n */\nexport type MotionVariant =\n | Record<string, unknown>\n | ((custom: unknown) => Record<string, unknown>);\n\nexport interface MotionPresetDefinition {\n variants: {\n open: MotionVariant;\n closed: MotionVariant;\n };\n transition: Record<string, unknown>;\n}\n\n// =============================================================================\n// Presets\n// =============================================================================\n\n/**\n * `custom` contract per preset:\n *\n * - `drawerStart` — `boolean`, whether the document direction is RTL.\n * - `overlay`, `modalContent`, `sidebarLabel` — unused.\n */\nexport const motionPresets: Record<MotionPreset, MotionPresetDefinition> = {\n /**\n * Off-canvas panel pinned to the inline-start edge. Animates `x` only, which\n * the compositor can handle without layout or paint.\n */\n drawerStart: {\n variants: {\n open: { x: '0%' },\n // Off-canvas direction follows writing direction, mirroring the\n // `-translate-x-full rtl:translate-x-full` CSS fallback.\n closed: (isRtl: unknown) => ({ x: isRtl ? '100%' : '-100%' }),\n },\n transition: { type: 'spring', stiffness: 400, damping: 40, mass: 1 },\n },\n\n /** Scrim behind a drawer or modal. */\n overlay: {\n variants: {\n open: { opacity: 1 },\n closed: { opacity: 0 },\n },\n transition: { duration: 0.2, ease: 'easeOut' },\n },\n\n /** Centered dialog surface — rises and settles rather than popping. */\n modalContent: {\n variants: {\n open: { opacity: 1, scale: 1, y: 0 },\n closed: { opacity: 0, scale: 0.96, y: 8 },\n },\n transition: { type: 'spring', stiffness: 500, damping: 40, mass: 0.8 },\n },\n\n /**\n * Text that disappears as its container narrows — sidebar labels on collapse.\n *\n * Opacity only, and deliberately so. An inline-axis slide would read slightly\n * better but would make every label direction-aware, and resolving direction\n * per nav item is a disproportionate amount of plumbing for an 8px nudge.\n * Fading also degrades to itself under reduced motion instead of becoming a\n * different animation.\n *\n * Short because it runs on many elements at once and has to finish inside the\n * container's own width transition, or labels are still fading after the rail\n * has stopped moving.\n */\n sidebarLabel: {\n variants: {\n open: { opacity: 1 },\n closed: { opacity: 0 },\n },\n transition: { duration: 0.15, ease: 'easeOut' },\n },\n};\n","/**\n * Motion runtime — the seam between components and an optional animation library.\n *\n * Components in the main entry never import `motion`. They ask this module for\n * a runtime; if an app has opted in by rendering `<MotionProvider>` from\n * `@mieweb/ui/motion`, they get one and animate. If not, `useMotionRuntime()`\n * returns `null` and they fall back to their existing CSS transitions. That is\n * what keeps `motion` out of the bundle of every app that hasn't asked for it —\n * the opt-in is resolved in the *module graph*, not by a prop.\n *\n * Like `presets`, this module must stay free of any `motion` import.\n */\n\nimport * as React from 'react';\nimport { motionPresets, type MotionPreset } from './presets';\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport interface MotionPresenceProps {\n children?: React.ReactNode;\n /** Suppress the initial mount animation. */\n initial?: boolean;\n /**\n * Fires once every exiting child has finished and been removed.\n *\n * Needed by anything that guards the DOM while it is open — a focus trap, a\n * scroll lock — because those guards must outlive `open` for as long as the\n * subtree is still on screen. Never fires when no runtime is active, since\n * there is no exit to wait for.\n */\n onExitComplete?: () => void;\n}\n\n/**\n * The capabilities a motion library must supply. Deliberately small: element\n * factories, a presence wrapper, and prop builders. Components depend on this\n * interface, never on a concrete library, so swapping or dropping the library\n * stays a one-file change.\n */\nexport interface MotionRuntime {\n /**\n * Whether animations should actually run.\n *\n * A disabled provider still supplies a runtime rather than `null` so that\n * consumers can tell \"disabled\" apart from \"never opted in\": `Modal` uses it\n * to decide whether an exit animation will ever report completion, and\n * `AnimatedPresence` keeps its wrapper element stable across the flip.\n * `Animated` itself renders the plain fallback tag whenever this is false —\n * withholding animation props from a mounted motion component corrupts\n * `toggle`-mode elements, so the swap (and the remount it implies) is the\n * correct behaviour. See the render branches in `Animated`.\n */\n enabled: boolean;\n /** Animated `div`. */\n Div: React.ElementType;\n /** Animated `nav`. */\n Nav: React.ElementType;\n /** Animated `span`, for inline content that must not become a block. */\n Span: React.ElementType;\n /** Enables exit animations for conditionally rendered children. */\n Presence: React.ComponentType<MotionPresenceProps>;\n /**\n * Props for an element that stays mounted and animates between states.\n * Skips the initial animation so a closed drawer doesn't slide out on load.\n */\n toggle: (\n preset: MotionPreset,\n open: boolean,\n custom?: unknown\n ) => Record<string, unknown>;\n /** Props for an element that mounts and unmounts inside `Presence`. */\n presence: (preset: MotionPreset, custom?: unknown) => Record<string, unknown>;\n}\n\n// =============================================================================\n// Context\n// =============================================================================\n\n/**\n * The context is stashed on `globalThis` under a registered symbol rather than\n * held in a module-local `const`.\n *\n * `@mieweb/ui` and `@mieweb/ui/motion` are separate bundle entries, and CJS\n * builds cannot code-split. Without this, the provider and the components\n * would each get their own copy of the context object and the provider would\n * silently never be seen — animations would simply never turn on, with no\n * error to explain why. A duplicated install of the package causes the same\n * failure. Keying off the global symbol registry makes the context a true\n * singleton in every one of those cases.\n *\n * The key is versioned. Two copies of this package sharing one page share\n * whatever lives under the key, so the `v1` suffix is a compatibility\n * contract: bump it if the `MotionRuntime` interface ever changes shape,\n * or an old provider will hand a new component a runtime it cannot use.\n */\nconst CONTEXT_KEY = Symbol.for('@mieweb/ui.motionRuntimeContext.v1');\n\ntype GlobalWithMotionContext = typeof globalThis & {\n [CONTEXT_KEY]?: React.Context<MotionRuntime | null>;\n};\n\nfunction getMotionRuntimeContext(): React.Context<MotionRuntime | null> {\n const globalScope = globalThis as GlobalWithMotionContext;\n if (!globalScope[CONTEXT_KEY]) {\n globalScope[CONTEXT_KEY] = React.createContext<MotionRuntime | null>(null);\n }\n return globalScope[CONTEXT_KEY];\n}\n\n/** @internal Consumed by `<MotionProvider>` in the `@mieweb/ui/motion` entry. */\nexport const MotionRuntimeContext = getMotionRuntimeContext();\n\n// =============================================================================\n// Hooks\n// =============================================================================\n\n/**\n * The active motion runtime, or `null` when the app has not opted in.\n *\n * Components must treat `null` as the normal case and keep a CSS path that\n * looks good on its own — motion is an enhancement, never a requirement.\n */\nexport function useMotionRuntime(): MotionRuntime | null {\n return React.useContext(MotionRuntimeContext);\n}\n\n// =============================================================================\n// Prop builders\n// =============================================================================\n\n/**\n * Builds the `toggle`/`presence` prop builders around a library-agnostic core.\n * Exported so `<MotionProvider>` can assemble a runtime without restating the\n * preset lookup.\n *\n * @internal\n */\nexport function createPresetPropBuilders(): Pick<\n MotionRuntime,\n 'toggle' | 'presence'\n> {\n return {\n toggle(preset, open, custom) {\n const { variants, transition } = motionPresets[preset];\n return {\n variants,\n transition,\n custom,\n // `false` pins the element to its current variant on mount instead of\n // animating into it.\n initial: false,\n animate: open ? 'open' : 'closed',\n };\n },\n\n presence(preset, custom) {\n const { variants, transition } = motionPresets[preset];\n return {\n variants,\n transition,\n custom,\n initial: 'closed',\n animate: 'open',\n exit: 'closed',\n };\n },\n };\n}\n","/**\n * `Animated` / `AnimatedPresence` — the ergonomic layer components use.\n *\n * These exist so an individual component never has to branch on whether motion\n * is available. It declares the preset it wants and the CSS classes that stand\n * in when motion is absent; this module picks the element to render.\n *\n * Adding motion to a further component should be a matter of swapping its\n * root `<div>` for an `<Animated>` and naming a preset — no new imports, no\n * new dependency, and no behavior change for apps that have not opted in.\n */\n\nimport * as React from 'react';\nimport { cn } from '../utils/cn';\nimport { useMotionRuntime, type MotionPresenceProps } from './runtime';\nimport type { MotionPreset } from './presets';\n\n// =============================================================================\n// Animated\n// =============================================================================\n\nexport interface AnimatedProps extends React.HTMLAttributes<HTMLElement> {\n /** Intrinsic element to render. */\n as?: 'div' | 'nav' | 'span';\n /** Which shared animation recipe to use. */\n preset: MotionPreset;\n /**\n * - `toggle` — element stays mounted and animates between open and closed.\n * - `presence` — element mounts and unmounts; wrap it in `<AnimatedPresence>`\n * so the exit animation gets a chance to run.\n */\n mode: 'toggle' | 'presence';\n /** Current state. Only read in `toggle` mode. */\n open?: boolean;\n /** Per-preset context value — see the `custom` contract in `presets.ts`. */\n custom?: unknown;\n /**\n * Classes applied whenever this element is **not** animating — no provider,\n * a disabled provider, or `enabled={false}`. This is where a component's\n * existing CSS transition lives, so the two paths never both try to drive\n * the same property.\n */\n fallbackClassName?: string;\n /**\n * Set `false` to stop this element animating even when a runtime is active.\n *\n * For states where an animated element would be wrong rather than merely\n * unnecessary. Motion writes a `transform` to hold an element at its resting\n * position, and a transformed ancestor becomes the containing block for any\n * `position: fixed` descendant — so an element that is only sometimes\n * animated should opt out the rest of the time.\n *\n * Flipping this (or the provider's `disabled`) swaps the element back to a\n * plain tag, which **remounts** it — deliberately. See the note on the\n * render branches below.\n */\n enabled?: boolean;\n}\n\nexport const Animated = React.forwardRef<HTMLElement, AnimatedProps>(\n function Animated(\n {\n as = 'div',\n preset,\n mode,\n open = false,\n custom,\n className,\n fallbackClassName,\n enabled = true,\n children,\n ...rest\n },\n ref\n ) {\n const runtime = useMotionRuntime();\n\n /*\n * Anything not animating renders the plain tag with the CSS fallback —\n * no provider, a disabled provider, or `enabled={false}` alike.\n *\n * Crossing between this branch and the motion one changes the element\n * type, which remounts the subtree. That is deliberate. The obvious\n * alternative — keeping the motion component mounted and only withholding\n * its animation props — corrupts `toggle`-mode elements in both\n * directions, because motion only writes variant styles at mount or in\n * response to an animation:\n *\n * - props added in place (a drawer crossing into its mobile breakpoint\n * while closed) never get the `closed` transform, so the drawer sits\n * fully visible over the page;\n * - props removed in place strand whatever inline `transform` motion last\n * wrote, so a sidebar returning to desktop stays off-canvas.\n *\n * Fresh mounts are correct in both worlds, so remounting at the flip is\n * the fix. The flips are rare — a breakpoint cross, a test toggling the\n * provider — and a remount that resets local state beats a stale\n * transform that removes the navigation.\n */\n if (!runtime || !runtime.enabled || !enabled) {\n const Tag = as as React.ElementType;\n return (\n <Tag ref={ref} className={cn(fallbackClassName, className)} {...rest}>\n {children}\n </Tag>\n );\n }\n\n const Component =\n as === 'nav' ? runtime.Nav : as === 'span' ? runtime.Span : runtime.Div;\n\n const motionProps =\n mode === 'toggle'\n ? runtime.toggle(preset, open, custom)\n : runtime.presence(preset, custom);\n\n return (\n <Component ref={ref} className={className} {...motionProps} {...rest}>\n {children}\n </Component>\n );\n }\n);\n\nAnimated.displayName = 'Animated';\n\n// =============================================================================\n// AnimatedPresence\n// =============================================================================\n\n/**\n * Keeps unmounting children on screen long enough to animate out.\n *\n * Without a runtime this is a pass-through, so children disappear immediately —\n * which is exactly what they do today. Children rendered conditionally inside\n * it need a stable `key`.\n */\nexport function AnimatedPresence({\n children,\n initial,\n onExitComplete,\n}: MotionPresenceProps): React.JSX.Element {\n const runtime = useMotionRuntime();\n\n if (!runtime) {\n return <>{children}</>;\n }\n\n const { Presence } = runtime;\n return (\n <Presence initial={initial} onExitComplete={onExitComplete}>\n {children}\n </Presence>\n );\n}\n\nAnimatedPresence.displayName = 'AnimatedPresence';\n"]}
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ var chunkS5RVSXDV_cjs = require('./chunk-S5RVSXDV.cjs');
3
4
  var chunkFHY3K6PL_cjs = require('./chunk-FHY3K6PL.cjs');
4
5
  var chunkFSGEDDF2_cjs = require('./chunk-FSGEDDF2.cjs');
5
- var chunkMYFZYUPR_cjs = require('./chunk-MYFZYUPR.cjs');
6
- var chunkS5RVSXDV_cjs = require('./chunk-S5RVSXDV.cjs');
6
+ var chunkAOHJILLU_cjs = require('./chunk-AOHJILLU.cjs');
7
7
  var React = require('react');
8
8
  var reactDom = require('react-dom');
9
9
  var libphonenumber = require('google-libphonenumber');
@@ -38,18 +38,21 @@ function isoToEmoji(code) {
38
38
  function buildCountryList() {
39
39
  const phoneUtil = PhoneNumberUtil2.getInstance();
40
40
  const regions = phoneUtil.getSupportedRegions();
41
- const list = regions.map((code) => {
42
- const callingCode = phoneUtil.getCountryCodeForRegion(code);
43
- return {
44
- code,
45
- name: regionDisplayName(code),
46
- dialCode: `+${callingCode}`,
47
- flag: isoToEmoji(code)
48
- };
49
- });
41
+ const list = regions.map(countryFromCode);
50
42
  list.sort((a, b) => a.name.localeCompare(b.name));
51
43
  return list;
52
44
  }
45
+ function countryFromCode(code) {
46
+ return {
47
+ code,
48
+ name: regionDisplayName(code),
49
+ dialCode: `+${PhoneNumberUtil2.getInstance().getCountryCodeForRegion(code)}`,
50
+ flag: isoToEmoji(code)
51
+ };
52
+ }
53
+ function isSupportedRegion(code) {
54
+ return PhoneNumberUtil2.getInstance().getSupportedRegions().includes(code);
55
+ }
53
56
  var _countries = null;
54
57
  function getCountries() {
55
58
  if (!_countries) _countries = buildCountryList();
@@ -92,6 +95,8 @@ function formatE164(phoneNumber, countryCode) {
92
95
  }
93
96
  function CountryDropdownBase({
94
97
  value,
98
+ defaultValue = "US",
99
+ placeholder = "Select country\u2026",
95
100
  onChange,
96
101
  disabled = false,
97
102
  className,
@@ -103,7 +108,7 @@ function CountryDropdownBase({
103
108
  }) {
104
109
  const [isOpen, setIsOpen] = React__namespace.useState(false);
105
110
  const [search, setSearch] = React__namespace.useState("");
106
- const [internalValue, setInternalValue] = React__namespace.useState(value ?? "US");
111
+ const [internalValue, setInternalValue] = React__namespace.useState(defaultValue);
107
112
  const containerRef = React__namespace.useRef(null);
108
113
  const searchInputRef = React__namespace.useRef(null);
109
114
  const listRef = React__namespace.useRef(null);
@@ -119,15 +124,11 @@ function CountryDropdownBase({
119
124
  if (isOpen && !countriesLoaded) setCountriesLoaded(true);
120
125
  }, [isOpen, countriesLoaded]);
121
126
  const selected = React__namespace.useMemo(() => {
127
+ if (!activeValue) return null;
122
128
  if (countries.length) {
123
- return countries.find((c) => c.code === activeValue) ?? countries.find((c) => c.code === "US");
129
+ return countries.find((c) => c.code === activeValue) ?? null;
124
130
  }
125
- return {
126
- code: activeValue ?? "US",
127
- name: regionDisplayName(activeValue ?? "US"),
128
- dialCode: `+${PhoneNumberUtil2.getInstance().getCountryCodeForRegion(activeValue ?? "US")}`,
129
- flag: isoToEmoji(activeValue ?? "US")
130
- };
131
+ return isSupportedRegion(activeValue) ? countryFromCode(activeValue) : null;
131
132
  }, [activeValue, countries]);
132
133
  const filtered = React__namespace.useMemo(() => {
133
134
  if (!search) return countries;
@@ -140,7 +141,7 @@ function CountryDropdownBase({
140
141
  setIsOpen(false);
141
142
  setSearch("");
142
143
  }, []);
143
- const { anchorRef, floatingRef, style } = chunkMYFZYUPR_cjs.useAnchoredPosition({ open: isOpen, placement });
144
+ const { anchorRef, floatingRef, style } = chunkAOHJILLU_cjs.useAnchoredPosition({ open: isOpen, placement });
144
145
  const outsideRefs = React__namespace.useMemo(
145
146
  () => [containerRef, floatingRef],
146
147
  [containerRef, floatingRef]
@@ -225,10 +226,17 @@ function CountryDropdownBase({
225
226
  "data-slot": "country-dropdown-flag",
226
227
  className: "text-base leading-none",
227
228
  "aria-hidden": "true",
228
- children: selected.flag
229
+ children: selected?.flag ?? "\u{1F310}"
229
230
  }
230
231
  ),
231
- showDialCode ? /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "country-dropdown-dialcode", children: selected.dialCode }) : /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "country-dropdown-name", className: "min-w-0 truncate", children: selected.name }),
232
+ !selected ? /* @__PURE__ */ jsxRuntime.jsx(
233
+ "span",
234
+ {
235
+ "data-slot": "country-dropdown-placeholder",
236
+ className: "text-muted-foreground min-w-0 truncate",
237
+ children: placeholder
238
+ }
239
+ ) : showDialCode ? /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "country-dropdown-dialcode", children: selected.dialCode }) : /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "country-dropdown-name", className: "min-w-0 truncate", children: selected.name }),
232
240
  /* @__PURE__ */ jsxRuntime.jsx(
233
241
  "svg",
234
242
  {
@@ -310,13 +318,13 @@ function CountryDropdownBase({
310
318
  type: "button",
311
319
  role: "option",
312
320
  "data-slot": "country-dropdown-option",
313
- "aria-selected": country.code === selected.code,
321
+ "aria-selected": country.code === selected?.code,
314
322
  onClick: () => handleSelect(country),
315
323
  className: chunkS5RVSXDV_cjs.cn(
316
- "flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm",
324
+ "flex w-full items-center gap-3 rounded-lg px-3 py-2 text-start text-sm",
317
325
  "transition-colors duration-150",
318
326
  "focus:outline-none",
319
- country.code === selected.code ? "bg-neutral-100 font-medium text-neutral-900 dark:bg-neutral-700 dark:text-white" : "text-neutral-700 hover:bg-neutral-50 dark:text-neutral-300 dark:hover:bg-neutral-700/50",
327
+ country.code === selected?.code ? "bg-neutral-100 font-medium text-neutral-900 dark:bg-neutral-700 dark:text-white" : "text-neutral-700 hover:bg-neutral-50 dark:text-neutral-300 dark:hover:bg-neutral-700/50",
320
328
  "focus:bg-neutral-100 dark:focus:bg-neutral-700"
321
329
  ),
322
330
  children: [
@@ -370,5 +378,5 @@ exports.CountryCodeDropdown = CountryCodeDropdown;
370
378
  exports.CountryDropdownBase = CountryDropdownBase;
371
379
  exports.formatE164 = formatE164;
372
380
  exports.validatePhoneNumber = validatePhoneNumber;
373
- //# sourceMappingURL=chunk-SPWVKDGC.cjs.map
374
- //# sourceMappingURL=chunk-SPWVKDGC.cjs.map
381
+ //# sourceMappingURL=chunk-X5QRRMGB.cjs.map
382
+ //# sourceMappingURL=chunk-X5QRRMGB.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/CountryCodeDropdown/CountryCodeDropdown.tsx"],"names":["PhoneNumberUtil","libphonenumber","PhoneNumberFormat","React","useAnchoredPosition","useClickOutside","useEscapeKey","jsxs","cn","jsx","createPortal"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,IAAMA,gBAAAA,GAC+DC,mCAC/D,eAAA,IAAkCA,yBAAA,CAAA,eAAA;AACxC,IAAMC,kBAAAA,GAC+DD,mCAC/D,iBAAA,IAAoCA,yBAAA,CAAA,iBAAA;AAmD1C,SAAS,WAAW,IAAA,EAAsB;AACxC,EAAA,OAAO,CAAC,GAAG,IAAA,CAAK,WAAA,EAAa,CAAA,CAC1B,GAAA,CAAI,CAAC,CAAA,KAAM,MAAA,CAAO,cAAc,MAAA,GAAU,EAAA,GAAK,EAAE,UAAA,CAAW,CAAC,CAAC,CAAC,CAAA,CAC/D,KAAK,EAAE,CAAA;AACZ;AAGA,SAAS,gBAAA,GAAkC;AACzC,EAAA,MAAM,SAAA,GAAYD,iBAAgB,WAAA,EAAY;AAC9C,EAAA,MAAM,OAAA,GAAU,UAAU,mBAAA,EAAoB;AAC9C,EAAA,MAAM,IAAA,GAAsB,OAAA,CAAQ,GAAA,CAAI,eAAe,CAAA;AACvD,EAAA,IAAA,CAAK,IAAA,CAAK,CAAC,CAAA,EAAG,CAAA,KAAM,EAAE,IAAA,CAAK,aAAA,CAAc,CAAA,CAAE,IAAI,CAAC,CAAA;AAChD,EAAA,OAAO,IAAA;AACT;AAGA,SAAS,gBAAgB,IAAA,EAA2B;AAClD,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,IAAA,EAAM,kBAAkB,IAAI,CAAA;AAAA,IAC5B,UAAU,CAAA,CAAA,EAAIA,gBAAAA,CAAgB,aAAY,CAAE,uBAAA,CAAwB,IAAI,CAAC,CAAA,CAAA;AAAA,IACzE,IAAA,EAAM,WAAW,IAAI;AAAA,GACvB;AACF;AAGA,SAA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;AAAA;AAAA,2BACX;AAAA,0BACC,YAAA,oBACCA,cAAA;AAAA,4BAAC,MAAA;AAAA,4BAAA;AAAA,8BACC,WAAA,EAAU,kCAAA;AAAA,8BACV,SAAA,EAAU,wCAAA;AAAA,8BAET,QAAA,EAAA,OAAA,CAAQ;AAAA;AAAA;AACX;AAAA,uBAAA;AAAA,sBAnCG,OAAA,CAAQ;AAAA,qBAsChB;AAAA;AAAA;AAEL;AAAA;AAAA,WACF;AAAA,UACA,QAAA,CAAS;AAAA;AACX;AAAA;AAAA,GACJ;AAEJ;AAEA,mBAAA,CAAoB,WAAA,GAAc,qBAAA;AAuBlC,SAAS,oBAAoB,KAAA,EAAiC;AAC5D,EAAA,uBAAOA,cAAA,CAAC,mBAAA,EAAA,EAAqB,GAAG,KAAA,EAAO,CAAA;AACzC;AAEA,mBAAA,CAAoB,WAAA,GAAc,qBAAA","file":"chunk-X5QRRMGB.cjs","sourcesContent":["import * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport * as libphonenumber from 'google-libphonenumber';\nimport { cn } from '../../utils/cn';\nimport { useClickOutside } from '../../hooks/useClickOutside';\nimport { useEscapeKey } from '../../hooks/useEscapeKey';\nimport { useAnchoredPosition } from '../../hooks/useAnchoredPosition';\n\nconst PhoneNumberUtil =\n (libphonenumber as unknown as { default?: typeof libphonenumber }).default\n ?.PhoneNumberUtil ?? libphonenumber.PhoneNumberUtil;\nconst PhoneNumberFormat =\n (libphonenumber as unknown as { default?: typeof libphonenumber }).default\n ?.PhoneNumberFormat ?? libphonenumber.PhoneNumberFormat;\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport interface CountryData {\n /** ISO 3166-1 alpha-2 country code (e.g. \"US\") */\n code: string;\n /** Country name (e.g. \"United States\") */\n name: string;\n /** Dial code (e.g. \"+1\") */\n dialCode: string;\n /** Emoji flag (e.g. \"🇺🇸\") */\n flag: string;\n}\n\nexport interface CountryCodeDropdownProps {\n /**\n * The currently selected country code (ISO alpha-2, e.g. \"US\").\n * Pass `\"\"` for a controlled component with no selection.\n */\n value?: string;\n /**\n * Initial selection when uncontrolled (`value` undefined).\n * `CountryCodeDropdown` defaults to \"US\"; `CountryDropdown` defaults to no selection.\n */\n defaultValue?: string;\n /** Trigger text shown when nothing is selected */\n placeholder?: string;\n /** Called when a country is selected */\n onChange?: (country: CountryData) => void;\n /** Whether the dropdown is disabled */\n disabled?: boolean;\n /** Additional class name for the trigger button */\n className?: string;\n /** Placement of the dropdown panel */\n placement?: 'bottom-start' | 'bottom-end';\n /** Placeholder text for the search field */\n searchPlaceholder?: string;\n /** id for the trigger button, enabling `<label htmlFor>` association */\n id?: string;\n /** Label for accessibility — visually hidden */\n 'aria-label'?: string;\n}\n\n// =============================================================================\n// Country Data (generated from libphonenumber)\n// =============================================================================\n\n/** Convert an ISO alpha-2 code to an emoji flag. */\nfunction isoToEmoji(code: string): string {\n return [...code.toUpperCase()]\n .map((c) => String.fromCodePoint(0x1f1e6 - 65 + c.charCodeAt(0)))\n .join('');\n}\n\n/** Build the full sorted list of countries from libphonenumber. */\nfunction buildCountryList(): CountryData[] {\n const phoneUtil = PhoneNumberUtil.getInstance();\n const regions = phoneUtil.getSupportedRegions() as string[];\n const list: CountryData[] = regions.map(countryFromCode);\n list.sort((a, b) => a.name.localeCompare(b.name));\n return list;\n}\n\n/** Build a single country's data without loading the full list. */\nfunction countryFromCode(code: string): CountryData {\n return {\n code,\n name: regionDisplayName(code),\n dialCode: `+${PhoneNumberUtil.getInstance().getCountryCodeForRegion(code)}`,\n flag: isoToEmoji(code),\n };\n}\n\n/** Whether libphonenumber knows this ISO alpha-2 region. */\nfunction isSupportedRegion(code: string): boolean {\n return (\n PhoneNumberUtil.getInstance().getSupportedRegions() as string[]\n ).includes(code);\n}\n\n/** Lazy singleton so we only build the list once. */\nlet _countries: CountryData[] | null = null;\nfunction getCountries(): CountryData[] {\n if (!_countries) _countries = buildCountryList();\n return _countries;\n}\n\n// =============================================================================\n// Region display name mapping\n// =============================================================================\n\n/** Lazy singleton for Intl.DisplayNames so we only construct it once. */\nlet _regionDisplayNames: Intl.DisplayNames | null = null;\n\nfunction getRegionDisplayNames(): Intl.DisplayNames | null {\n if (_regionDisplayNames === null) {\n try {\n const locales =\n typeof navigator !== 'undefined' && navigator.languages?.length\n ? [...navigator.languages]\n : ['en'];\n _regionDisplayNames = new Intl.DisplayNames(locales, { type: 'region' });\n } catch {\n return null;\n }\n }\n return _regionDisplayNames;\n}\n\n/**\n * Use the browser Intl API for display names where available,\n * falling back to the raw ISO code.\n */\nfunction regionDisplayName(code: string): string {\n const dn = getRegionDisplayNames();\n if (!dn) return code;\n return dn.of(code) ?? code;\n}\n\n// =============================================================================\n// Validation helper (exported for consumers)\n// =============================================================================\n\n/**\n * Validate a phone number string for a given country code using libphonenumber.\n *\n * @param phoneNumber - The phone number (digits, may include formatting)\n * @param countryCode - ISO alpha-2 code (e.g. \"US\")\n * @returns Whether the number is valid for the given region.\n */\nexport function validatePhoneNumber(\n phoneNumber: string,\n countryCode: string\n): boolean {\n try {\n const phoneUtil = PhoneNumberUtil.getInstance();\n const parsed = phoneUtil.parse(phoneNumber, countryCode);\n return phoneUtil.isValidNumberForRegion(parsed, countryCode);\n } catch {\n return false;\n }\n}\n\n/**\n * Format a phone number into E.164 international format.\n *\n * @param phoneNumber - The phone number (digits, may include formatting)\n * @param countryCode - ISO alpha-2 code (e.g. \"US\")\n * @returns The formatted number (e.g. \"+15551234567\") or the original string if parsing fails.\n */\nexport function formatE164(phoneNumber: string, countryCode: string): string {\n try {\n const phoneUtil = PhoneNumberUtil.getInstance();\n const parsed = phoneUtil.parse(phoneNumber, countryCode);\n return phoneUtil.format(parsed, PhoneNumberFormat.E164);\n } catch {\n return phoneNumber;\n }\n}\n\n// =============================================================================\n// Component\n// =============================================================================\n\n/** Internal base props — `showDialCode` is not part of the public API. */\ninterface CountryDropdownBaseProps extends CountryCodeDropdownProps {\n /** Show dial codes on the trigger and in the list (default: true) */\n showDialCode?: boolean;\n}\n\n/**\n * Shared implementation behind {@link CountryCodeDropdown} (dial-code mode)\n * and `CountryDropdown` (country-only mode). Not exported from the package.\n */\nfunction CountryDropdownBase({\n value,\n defaultValue = 'US',\n placeholder = 'Select country…',\n onChange,\n disabled = false,\n className,\n placement = 'bottom-start',\n searchPlaceholder = 'Search countries…',\n id,\n showDialCode = true,\n 'aria-label': ariaLabel = 'Select country code',\n}: CountryDropdownBaseProps) {\n const [isOpen, setIsOpen] = React.useState(false);\n const [search, setSearch] = React.useState('');\n const [internalValue, setInternalValue] = React.useState(defaultValue);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const searchInputRef = React.useRef<HTMLInputElement>(null);\n const listRef = React.useRef<HTMLDivElement>(null);\n const menuId = React.useId();\n\n const isControlled = value !== undefined;\n const activeValue = isControlled ? value : internalValue;\n\n // Defer building the full country list until the dropdown is first opened\n const [countriesLoaded, setCountriesLoaded] = React.useState(false);\n const countries = React.useMemo(\n () => (countriesLoaded ? getCountries() : []),\n [countriesLoaded]\n );\n\n React.useEffect(() => {\n if (isOpen && !countriesLoaded) setCountriesLoaded(true);\n }, [isOpen, countriesLoaded]);\n\n const selected = React.useMemo<CountryData | null>(() => {\n if (!activeValue) return null;\n if (countries.length) {\n return countries.find((c) => c.code === activeValue) ?? null;\n }\n // Lightweight fallback while list hasn't loaded yet\n return isSupportedRegion(activeValue) ? countryFromCode(activeValue) : null;\n }, [activeValue, countries]);\n\n const filtered = React.useMemo(() => {\n if (!search) return countries;\n const q = search.toLowerCase();\n return countries.filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n (showDialCode && c.dialCode.includes(q)) ||\n c.code.toLowerCase().includes(q)\n );\n }, [search, countries, showDialCode]);\n\n // Close helpers\n const close = React.useCallback(() => {\n setIsOpen(false);\n setSearch('');\n }, []);\n\n // Portal + fixed positioning so the panel escapes overflow-hidden ancestors.\n const { anchorRef, floatingRef, style } = useAnchoredPosition<\n HTMLDivElement,\n HTMLDivElement\n >({ open: isOpen, placement });\n\n const outsideRefs = React.useMemo(\n () => [containerRef, floatingRef],\n [containerRef, floatingRef]\n );\n useClickOutside(outsideRefs, close, isOpen);\n useEscapeKey(close, isOpen);\n\n // Focus search input when opening\n React.useEffect(() => {\n if (isOpen) {\n // Defer to let the DOM render\n requestAnimationFrame(() => searchInputRef.current?.focus());\n }\n }, [isOpen]);\n\n const handleToggle = React.useCallback(() => {\n if (!disabled) setIsOpen((prev) => !prev);\n }, [disabled]);\n\n const handleSelect = React.useCallback(\n (country: CountryData) => {\n if (!isControlled) {\n setInternalValue(country.code);\n }\n onChange?.(country);\n close();\n },\n [isControlled, onChange, close]\n );\n\n // Keyboard navigation inside the list\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (!isOpen) return;\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n e.preventDefault();\n const items =\n listRef.current?.querySelectorAll<HTMLButtonElement>(\n '[role=\"option\"]'\n );\n if (!items?.length) return;\n\n const current = document.activeElement as HTMLElement;\n const idx = Array.from(items).indexOf(current as HTMLButtonElement);\n let next: number;\n if (e.key === 'ArrowDown') {\n next = idx < items.length - 1 ? idx + 1 : 0;\n } else {\n next = idx > 0 ? idx - 1 : items.length - 1;\n }\n items[next].focus();\n }\n },\n [isOpen]\n );\n\n return (\n <div\n ref={(node) => {\n containerRef.current = node;\n anchorRef.current = node;\n }}\n data-slot=\"country-dropdown\"\n className=\"relative inline-flex\"\n >\n {/* Trigger button */}\n <button\n type=\"button\"\n id={id}\n data-slot=\"country-dropdown-trigger\"\n onClick={handleToggle}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? menuId : undefined}\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-lg border px-3 py-2 text-sm',\n 'border-input bg-background text-foreground',\n 'transition-colors duration-200',\n 'hover:bg-neutral-50 dark:hover:bg-neutral-700',\n 'focus:ring-ring focus:ring-2 focus:outline-none',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n className\n )}\n >\n <span\n data-slot=\"country-dropdown-flag\"\n className=\"text-base leading-none\"\n aria-hidden=\"true\"\n >\n {selected?.flag ?? '🌐'}\n </span>\n {!selected ? (\n <span\n data-slot=\"country-dropdown-placeholder\"\n className=\"text-muted-foreground min-w-0 truncate\"\n >\n {placeholder}\n </span>\n ) : showDialCode ? (\n <span data-slot=\"country-dropdown-dialcode\">{selected.dialCode}</span>\n ) : (\n <span data-slot=\"country-dropdown-name\" className=\"min-w-0 truncate\">\n {selected.name}\n </span>\n )}\n <svg\n data-slot=\"country-dropdown-chevron\"\n className={cn(\n 'h-4 w-4 shrink-0 text-neutral-500 transition-transform duration-200',\n isOpen && 'rotate-180'\n )}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n </button>\n\n {/* Dropdown panel */}\n {isOpen &&\n createPortal(\n <div\n ref={floatingRef}\n style={style}\n id={menuId}\n role=\"listbox\"\n data-slot=\"country-dropdown-panel\"\n aria-label={ariaLabel}\n tabIndex={-1}\n onKeyDown={handleKeyDown}\n className={cn(\n 'flex w-72 flex-col overflow-hidden',\n 'rounded-xl border border-neutral-200 bg-white shadow-lg',\n 'dark:border-neutral-700 dark:bg-neutral-800',\n 'animate-in fade-in zoom-in-95 duration-100'\n )}\n >\n {/* Search input */}\n <div\n data-slot=\"country-dropdown-search\"\n className=\"shrink-0 border-b border-neutral-200 p-2 dark:border-neutral-700\"\n >\n <input\n ref={searchInputRef}\n type=\"text\"\n data-slot=\"country-dropdown-search-input\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n placeholder={searchPlaceholder}\n aria-label=\"Search countries\"\n className={cn(\n 'w-full rounded-lg border border-neutral-200 px-3 py-1.5 text-sm',\n 'text-foreground placeholder:text-muted-foreground bg-white',\n 'focus:ring-ring focus:border-transparent focus:ring-2 focus:outline-none',\n 'dark:border-neutral-600 dark:bg-neutral-700 dark:text-neutral-100'\n )}\n />\n </div>\n\n {/* Country list */}\n <div\n ref={listRef}\n data-slot=\"country-dropdown-list\"\n className=\"max-h-60 min-h-0 overflow-y-auto p-1\"\n >\n {filtered.length === 0 ? (\n <div className=\"text-muted-foreground px-3 py-4 text-center text-sm\">\n No countries found\n </div>\n ) : (\n filtered.map((country) => (\n <button\n key={country.code}\n type=\"button\"\n role=\"option\"\n data-slot=\"country-dropdown-option\"\n aria-selected={country.code === selected?.code}\n onClick={() => handleSelect(country)}\n className={cn(\n 'flex w-full items-center gap-3 rounded-lg px-3 py-2 text-start text-sm',\n 'transition-colors duration-150',\n 'focus:outline-none',\n country.code === selected?.code\n ? 'bg-neutral-100 font-medium text-neutral-900 dark:bg-neutral-700 dark:text-white'\n : 'text-neutral-700 hover:bg-neutral-50 dark:text-neutral-300 dark:hover:bg-neutral-700/50',\n 'focus:bg-neutral-100 dark:focus:bg-neutral-700'\n )}\n >\n <span\n data-slot=\"country-dropdown-option-flag\"\n className=\"text-base leading-none\"\n aria-hidden=\"true\"\n >\n {country.flag}\n </span>\n <span\n data-slot=\"country-dropdown-option-name\"\n className=\"flex-1 truncate\"\n >\n {country.name}\n </span>\n {showDialCode && (\n <span\n data-slot=\"country-dropdown-option-dialcode\"\n className=\"text-muted-foreground shrink-0 text-xs\"\n >\n {country.dialCode}\n </span>\n )}\n </button>\n ))\n )}\n </div>\n </div>,\n document.body\n )}\n </div>\n );\n}\n\nCountryDropdownBase.displayName = 'CountryDropdownBase';\n\n/**\n * A country-code selector dropdown designed to sit beside a phone number input.\n *\n * Defaults to United States (+1) with the 🇺🇸 flag. Clicking the trigger opens\n * a searchable list of all supported countries with their dial codes and flags.\n *\n * Uses Google's libphonenumber for the canonical country/code list and provides\n * a `validatePhoneNumber` helper for phone validation.\n *\n * For a country selector without dial codes, use `CountryDropdown`.\n *\n * @example\n * ```tsx\n * const [country, setCountry] = useState<CountryData>();\n *\n * <div className=\"flex gap-2\">\n * <CountryCodeDropdown value={country?.code} onChange={setCountry} />\n * <Input placeholder=\"Phone number\" />\n * </div>\n * ```\n */\nfunction CountryCodeDropdown(props: CountryCodeDropdownProps) {\n return <CountryDropdownBase {...props} />;\n}\n\nCountryCodeDropdown.displayName = 'CountryCodeDropdown';\n\nexport { CountryCodeDropdown, CountryDropdownBase };\n"]}
@@ -1,6 +1,6 @@
1
- import { Tooltip } from './chunk-FJ7YPVKV.js';
2
- import { useTheme } from './chunk-KJZNEVYM.js';
1
+ import { Tooltip } from './chunk-MUIDWFYJ.js';
3
2
  import { cn } from './chunk-TQONQSJO.js';
3
+ import { useTheme } from './chunk-KJZNEVYM.js';
4
4
  import * as React from 'react';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
  import { cva } from 'class-variance-authority';
@@ -215,5 +215,5 @@ var ThemeToggle = React.forwardRef(
215
215
  ThemeToggle.displayName = "ThemeToggle";
216
216
 
217
217
  export { ThemeProvider, ThemeProviderContext, ThemeToggle, themeToggleIconVariants, themeToggleVariants, useThemeContext };
218
- //# sourceMappingURL=chunk-SH6B4MG5.js.map
219
- //# sourceMappingURL=chunk-SH6B4MG5.js.map
218
+ //# sourceMappingURL=chunk-XBXDUAIM.js.map
219
+ //# sourceMappingURL=chunk-XBXDUAIM.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ThemeProvider/ThemeProvider.tsx","../src/components/ThemeProvider/ThemeToggle.tsx"],"names":["jsx","React2"],"mappings":";;;;;;;AASA,IAAM,oBAAA,GAA6B,oBAEjC,MAAS;AAwBX,SAAS,aAAA,CAAc;AAAA,EACrB,QAAA;AAAA,EACA,cAAc,aAAA,GAAgB;AAChC,CAAA,EAAuB;AACrB,EAAA,MAAM,E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,WAAA;AAAA,QACT,SAAA,EAAW,GAAG,mBAAA,CAAoB,EAAE,MAAM,OAAA,EAAS,GAAG,SAAS,CAAA;AAAA,QAC9D,GAAG,KAAA;AAAA,QAEH,QAAA,EAAA,cAAA;AAAe;AAAA,KAClB;AAGF,IAAA,IAAI,WAAA,EAAa;AACf,MAAA,uBACEA,GAAAA;AAAA,QAAC,OAAA;AAAA,QAAA;AAAA,UACC,OAAA,EAAS,KAAA;AAAA,UACT,SAAA,EAAW,gBAAA;AAAA,UACX,KAAA,EAAO,YAAA;AAAA,UAEN,QAAA,EAAA;AAAA;AAAA,OACH;AAAA,IAEJ;AAEA,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAEA,WAAA,CAAY,WAAA,GAAc,aAAA","file":"chunk-SH6B4MG5.js","sourcesContent":["import * as React from 'react';\nimport { useTheme, type Theme, type ResolvedTheme } from '../../hooks/useTheme';\n\nexport interface ThemeProviderContextValue {\n theme: Theme;\n setTheme: (theme: Theme) => void;\n resolvedTheme: ResolvedTheme;\n}\n\nconst ThemeProviderContext = React.createContext<\n ThemeProviderContextValue | undefined\n>(undefined);\n\nexport interface ThemeProviderProps {\n children: React.ReactNode;\n /** Default theme to use on first load */\n defaultTheme?: Theme;\n /** Storage key for persisting theme */\n storageKey?: string;\n}\n\n/**\n * Provider component that wraps your app to enable theme switching.\n *\n * @example\n * ```tsx\n * function App() {\n * return (\n * <ThemeProvider defaultTheme=\"system\">\n * <YourApp />\n * </ThemeProvider>\n * );\n * }\n * ```\n */\nfunction ThemeProvider({\n children,\n defaultTheme: _defaultTheme = 'system',\n}: ThemeProviderProps) {\n const { theme, setTheme, resolvedTheme } = useTheme();\n\n const value = React.useMemo(\n () => ({ theme, setTheme, resolvedTheme }),\n [theme, setTheme, resolvedTheme]\n );\n\n return (\n <ThemeProviderContext.Provider value={value}>\n {children}\n </ThemeProviderContext.Provider>\n );\n}\n\nThemeProvider.displayName = 'ThemeProvider';\n\n/**\n * Hook to access the theme context.\n *\n * @example\n * ```tsx\n * function ThemeToggle() {\n * const { theme, setTheme, resolvedTheme } = useThemeContext();\n * return (\n * <button onClick={() => setTheme(resolvedTheme === 'dark' ? 'light' : 'dark')}>\n * Toggle theme\n * </button>\n * );\n * }\n * ```\n */\nfunction useThemeContext(): ThemeProviderContextValue {\n const context = React.useContext(ThemeProviderContext);\n if (!context) {\n throw new Error('useThemeContext must be used within a ThemeProvider');\n }\n return context;\n}\n\nexport { ThemeProvider, ThemeProviderContext, useThemeContext };\n","import * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { useTheme, type Theme } from '../../hooks/useTheme';\nimport { Tooltip } from '../Tooltip';\n\n// ============================================================================\n// Theme Toggle Variants\n// ============================================================================\n\nconst themeToggleVariants = cva(\n [\n 'inline-flex items-center justify-center',\n 'rounded-md border transition-colors',\n 'focus:outline-none focus:ring-2 focus:ring-primary-500/40',\n ],\n {\n variants: {\n size: {\n sm: 'h-7 w-7',\n md: 'h-8 w-8',\n lg: 'h-9 w-9',\n },\n variant: {\n default: [\n 'border-neutral-300 bg-white text-neutral-600 shadow-sm',\n 'hover:bg-neutral-100',\n 'dark:border-neutral-600 dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-700',\n ],\n ghost: [\n 'border-transparent bg-transparent text-neutral-600',\n 'hover:bg-neutral-100',\n 'dark:text-neutral-300 dark:hover:bg-neutral-700',\n ],\n },\n },\n defaultVariants: {\n size: 'md',\n variant: 'default',\n },\n }\n);\n\nconst themeToggleIconVariants = cva('', {\n variants: {\n size: {\n sm: 'h-3.5 w-3.5',\n md: 'h-4 w-4',\n lg: 'h-5 w-5',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\n// ============================================================================\n// Icon Components\n// ============================================================================\n\ninterface IconProps {\n className?: string;\n}\n\nconst SunIcon: React.FC<IconProps> = ({ className }) => (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z\"\n />\n </svg>\n);\n\nconst MoonIcon: React.FC<IconProps> = ({ className }) => (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z\"\n />\n </svg>\n);\n\nconst SystemIcon: React.FC<IconProps> = ({ className }) => (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z\"\n />\n </svg>\n);\n\n// ============================================================================\n// Three-way cycle (single source of truth)\n// ============================================================================\n\n/** The three-way cycle order: light → dark → system → light. Click handler,\n * tooltip label, and default icon are all derived from this one map. */\nconst THREE_WAY_NEXT: Record<Theme, Theme> = {\n light: 'dark',\n dark: 'system',\n system: 'light',\n};\n\nconst THEME_LABELS: Record<Theme, string> = {\n light: 'Switch to light mode',\n dark: 'Switch to dark mode',\n system: 'Switch to system theme',\n};\n\n// ============================================================================\n// ThemeToggle Component\n// ============================================================================\n\nexport interface ThemeToggleProps\n extends\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'>,\n VariantProps<typeof themeToggleVariants> {\n /**\n * What themes to cycle through.\n * - 'two-way': Toggle between light and dark only\n * - 'three-way': Cycle through light → dark → system\n * @default 'two-way'\n */\n mode?: 'two-way' | 'three-way';\n /**\n * Whether to show a tooltip with the current/next theme\n * @default true\n */\n showTooltip?: boolean;\n /**\n * Tooltip placement\n * @default 'bottom'\n */\n tooltipPlacement?: 'top' | 'right' | 'bottom' | 'left';\n /**\n * Delay before showing tooltip in ms\n * @default 140\n */\n tooltipDelay?: number;\n /**\n * Custom icon for light theme\n */\n lightIcon?: React.ReactNode;\n /**\n * Custom icon for dark theme\n */\n darkIcon?: React.ReactNode;\n /**\n * Custom icon for system theme (only used in three-way mode)\n */\n systemIcon?: React.ReactNode;\n}\n\n/**\n * An accessible theme toggle button that switches between light/dark modes.\n *\n * Uses the mieweb-ui useTheme hook for state management and persists\n * the user's preference to localStorage.\n *\n * @example\n * ```tsx\n * // Simple two-way toggle (light/dark)\n * <ThemeToggle />\n *\n * // Three-way cycle (light → dark → system)\n * <ThemeToggle mode=\"three-way\" />\n *\n * // With custom styling\n * <ThemeToggle size=\"lg\" variant=\"ghost\" />\n *\n * // Without tooltip\n * <ThemeToggle showTooltip={false} />\n * ```\n */\nconst ThemeToggle = React.forwardRef<HTMLButtonElement, ThemeToggleProps>(\n (\n {\n className,\n size,\n variant,\n mode = 'two-way',\n showTooltip = true,\n tooltipPlacement = 'bottom',\n tooltipDelay = 140,\n lightIcon,\n darkIcon,\n systemIcon,\n ...props\n },\n ref\n ) => {\n const { theme, setTheme, resolvedTheme } = useTheme();\n\n const handleClick = React.useCallback(() => {\n if (mode === 'two-way') {\n // Simple toggle between light and dark\n setTheme(resolvedTheme === 'dark' ? 'light' : 'dark');\n } else {\n setTheme(THREE_WAY_NEXT[theme]);\n }\n }, [mode, theme, resolvedTheme, setTheme]);\n\n const getLabel = () => {\n if (mode === 'two-way') {\n return resolvedTheme === 'dark'\n ? 'Switch to light mode'\n : 'Switch to dark mode';\n }\n // Three-way mode - name the next stop in the cycle\n return THEME_LABELS[THREE_WAY_NEXT[theme]];\n };\n\n const getCurrentIcon = () => {\n const iconClass = themeToggleIconVariants({ size });\n if (mode === 'three-way') {\n // The DEFAULT icon previews the next theme in the cycle, matching the\n // tooltip (previously dark showed a sun while the click gave system,\n // and system showed the current state instead of the next). The\n // lightIcon/darkIcon/systemIcon overrides are keyed by the CURRENT\n // theme — they replace the icon shown while in that theme.\n const override = {\n light: lightIcon,\n dark: darkIcon,\n system: systemIcon,\n }[theme];\n if (override) return override;\n const defaultIcons: Record<Theme, React.ReactNode> = {\n light: <SunIcon className={iconClass} />,\n dark: <MoonIcon className={iconClass} />,\n system: <SystemIcon className={iconClass} />,\n };\n return defaultIcons[THREE_WAY_NEXT[theme]];\n }\n\n // Two-way keeps the classic convention: sun while dark (\"click for\n // light\"), moon while light (\"click for dark\").\n if (resolvedTheme === 'dark') {\n return darkIcon || <SunIcon className={iconClass} />;\n }\n\n return lightIcon || <MoonIcon className={iconClass} />;\n };\n\n const label = getLabel();\n\n const button = (\n <button\n ref={ref}\n type=\"button\"\n aria-label={label}\n onClick={handleClick}\n className={cn(themeToggleVariants({ size, variant }), className)}\n {...props}\n >\n {getCurrentIcon()}\n </button>\n );\n\n if (showTooltip) {\n return (\n <Tooltip\n content={label}\n placement={tooltipPlacement}\n delay={tooltipDelay}\n >\n {button}\n </Tooltip>\n );\n }\n\n return button;\n }\n);\n\nThemeToggle.displayName = 'ThemeToggle';\n\nexport { ThemeToggle, themeToggleVariants, themeToggleIconVariants };\n"]}
1
+ {"version":3,"sources":["../src/components/ThemeProvider/ThemeProvider.tsx","../src/components/ThemeProvider/ThemeToggle.tsx"],"names":["jsx","React2"],"mappings":";;;;;;;AASA,IAAM,oBAAA,GAA6B,oBAEjC,MAAS;AAwBX,SAAS,aAAA,CAAc;AAAA,EACrB,QAAA;AAAA,EACA,cAAc,aAAA,GAAgB;AAChC,CAAA,EAAuB;AACrB,EAAA,MAAM,EAAE,KAAA,EAAO,QAAA,EAAU,aAAA,KAAkB,QAAA,EAAS;AAEpD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M,OAAA,EAAS,GAAG,SAAS,CAAA;AAAA,QAC9D,GAAG,KAAA;AAAA,QAEH,QAAA,EAAA,cAAA;AAAe;AAAA,KAClB;AAGF,IAAA,IAAI,WAAA,EAAa;AACf,MAAA,uBACEA,GAAAA;AAAA,QAAC,OAAA;AAAA,QAAA;AAAA,UACC,OAAA,EAAS,KAAA;AAAA,UACT,SAAA,EAAW,gBAAA;AAAA,UACX,KAAA,EAAO,YAAA;AAAA,UAEN,QAAA,EAAA;AAAA;AAAA,OACH;AAAA,IAEJ;AAEA,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAEA,WAAA,CAAY,WAAA,GAAc,aAAA","file":"chunk-XBXDUAIM.js","sourcesContent":["import * as React from 'react';\nimport { useTheme, type Theme, type ResolvedTheme } from '../../hooks/useTheme';\n\nexport interface ThemeProviderContextValue {\n theme: Theme;\n setTheme: (theme: Theme) => void;\n resolvedTheme: ResolvedTheme;\n}\n\nconst ThemeProviderContext = React.createContext<\n ThemeProviderContextValue | undefined\n>(undefined);\n\nexport interface ThemeProviderProps {\n children: React.ReactNode;\n /** Default theme to use on first load */\n defaultTheme?: Theme;\n /** Storage key for persisting theme */\n storageKey?: string;\n}\n\n/**\n * Provider component that wraps your app to enable theme switching.\n *\n * @example\n * ```tsx\n * function App() {\n * return (\n * <ThemeProvider defaultTheme=\"system\">\n * <YourApp />\n * </ThemeProvider>\n * );\n * }\n * ```\n */\nfunction ThemeProvider({\n children,\n defaultTheme: _defaultTheme = 'system',\n}: ThemeProviderProps) {\n const { theme, setTheme, resolvedTheme } = useTheme();\n\n const value = React.useMemo(\n () => ({ theme, setTheme, resolvedTheme }),\n [theme, setTheme, resolvedTheme]\n );\n\n return (\n <ThemeProviderContext.Provider value={value}>\n {children}\n </ThemeProviderContext.Provider>\n );\n}\n\nThemeProvider.displayName = 'ThemeProvider';\n\n/**\n * Hook to access the theme context.\n *\n * @example\n * ```tsx\n * function ThemeToggle() {\n * const { theme, setTheme, resolvedTheme } = useThemeContext();\n * return (\n * <button onClick={() => setTheme(resolvedTheme === 'dark' ? 'light' : 'dark')}>\n * Toggle theme\n * </button>\n * );\n * }\n * ```\n */\nfunction useThemeContext(): ThemeProviderContextValue {\n const context = React.useContext(ThemeProviderContext);\n if (!context) {\n throw new Error('useThemeContext must be used within a ThemeProvider');\n }\n return context;\n}\n\nexport { ThemeProvider, ThemeProviderContext, useThemeContext };\n","import * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { useTheme, type Theme } from '../../hooks/useTheme';\nimport { Tooltip } from '../Tooltip';\n\n// ============================================================================\n// Theme Toggle Variants\n// ============================================================================\n\nconst themeToggleVariants = cva(\n [\n 'inline-flex items-center justify-center',\n 'rounded-md border transition-colors',\n 'focus:outline-none focus:ring-2 focus:ring-primary-500/40',\n ],\n {\n variants: {\n size: {\n sm: 'h-7 w-7',\n md: 'h-8 w-8',\n lg: 'h-9 w-9',\n },\n variant: {\n default: [\n 'border-neutral-300 bg-white text-neutral-600 shadow-sm',\n 'hover:bg-neutral-100',\n 'dark:border-neutral-600 dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-700',\n ],\n ghost: [\n 'border-transparent bg-transparent text-neutral-600',\n 'hover:bg-neutral-100',\n 'dark:text-neutral-300 dark:hover:bg-neutral-700',\n ],\n },\n },\n defaultVariants: {\n size: 'md',\n variant: 'default',\n },\n }\n);\n\nconst themeToggleIconVariants = cva('', {\n variants: {\n size: {\n sm: 'h-3.5 w-3.5',\n md: 'h-4 w-4',\n lg: 'h-5 w-5',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\n// ============================================================================\n// Icon Components\n// ============================================================================\n\ninterface IconProps {\n className?: string;\n}\n\nconst SunIcon: React.FC<IconProps> = ({ className }) => (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z\"\n />\n </svg>\n);\n\nconst MoonIcon: React.FC<IconProps> = ({ className }) => (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z\"\n />\n </svg>\n);\n\nconst SystemIcon: React.FC<IconProps> = ({ className }) => (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z\"\n />\n </svg>\n);\n\n// ============================================================================\n// Three-way cycle (single source of truth)\n// ============================================================================\n\n/** The three-way cycle order: light → dark → system → light. Click handler,\n * tooltip label, and default icon are all derived from this one map. */\nconst THREE_WAY_NEXT: Record<Theme, Theme> = {\n light: 'dark',\n dark: 'system',\n system: 'light',\n};\n\nconst THEME_LABELS: Record<Theme, string> = {\n light: 'Switch to light mode',\n dark: 'Switch to dark mode',\n system: 'Switch to system theme',\n};\n\n// ============================================================================\n// ThemeToggle Component\n// ============================================================================\n\nexport interface ThemeToggleProps\n extends\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'>,\n VariantProps<typeof themeToggleVariants> {\n /**\n * What themes to cycle through.\n * - 'two-way': Toggle between light and dark only\n * - 'three-way': Cycle through light → dark → system\n * @default 'two-way'\n */\n mode?: 'two-way' | 'three-way';\n /**\n * Whether to show a tooltip with the current/next theme\n * @default true\n */\n showTooltip?: boolean;\n /**\n * Tooltip placement\n * @default 'bottom'\n */\n tooltipPlacement?: 'top' | 'right' | 'bottom' | 'left';\n /**\n * Delay before showing tooltip in ms\n * @default 140\n */\n tooltipDelay?: number;\n /**\n * Custom icon for light theme\n */\n lightIcon?: React.ReactNode;\n /**\n * Custom icon for dark theme\n */\n darkIcon?: React.ReactNode;\n /**\n * Custom icon for system theme (only used in three-way mode)\n */\n systemIcon?: React.ReactNode;\n}\n\n/**\n * An accessible theme toggle button that switches between light/dark modes.\n *\n * Uses the mieweb-ui useTheme hook for state management and persists\n * the user's preference to localStorage.\n *\n * @example\n * ```tsx\n * // Simple two-way toggle (light/dark)\n * <ThemeToggle />\n *\n * // Three-way cycle (light → dark → system)\n * <ThemeToggle mode=\"three-way\" />\n *\n * // With custom styling\n * <ThemeToggle size=\"lg\" variant=\"ghost\" />\n *\n * // Without tooltip\n * <ThemeToggle showTooltip={false} />\n * ```\n */\nconst ThemeToggle = React.forwardRef<HTMLButtonElement, ThemeToggleProps>(\n (\n {\n className,\n size,\n variant,\n mode = 'two-way',\n showTooltip = true,\n tooltipPlacement = 'bottom',\n tooltipDelay = 140,\n lightIcon,\n darkIcon,\n systemIcon,\n ...props\n },\n ref\n ) => {\n const { theme, setTheme, resolvedTheme } = useTheme();\n\n const handleClick = React.useCallback(() => {\n if (mode === 'two-way') {\n // Simple toggle between light and dark\n setTheme(resolvedTheme === 'dark' ? 'light' : 'dark');\n } else {\n setTheme(THREE_WAY_NEXT[theme]);\n }\n }, [mode, theme, resolvedTheme, setTheme]);\n\n const getLabel = () => {\n if (mode === 'two-way') {\n return resolvedTheme === 'dark'\n ? 'Switch to light mode'\n : 'Switch to dark mode';\n }\n // Three-way mode - name the next stop in the cycle\n return THEME_LABELS[THREE_WAY_NEXT[theme]];\n };\n\n const getCurrentIcon = () => {\n const iconClass = themeToggleIconVariants({ size });\n if (mode === 'three-way') {\n // The DEFAULT icon previews the next theme in the cycle, matching the\n // tooltip (previously dark showed a sun while the click gave system,\n // and system showed the current state instead of the next). The\n // lightIcon/darkIcon/systemIcon overrides are keyed by the CURRENT\n // theme — they replace the icon shown while in that theme.\n const override = {\n light: lightIcon,\n dark: darkIcon,\n system: systemIcon,\n }[theme];\n if (override) return override;\n const defaultIcons: Record<Theme, React.ReactNode> = {\n light: <SunIcon className={iconClass} />,\n dark: <MoonIcon className={iconClass} />,\n system: <SystemIcon className={iconClass} />,\n };\n return defaultIcons[THREE_WAY_NEXT[theme]];\n }\n\n // Two-way keeps the classic convention: sun while dark (\"click for\n // light\"), moon while light (\"click for dark\").\n if (resolvedTheme === 'dark') {\n return darkIcon || <SunIcon className={iconClass} />;\n }\n\n return lightIcon || <MoonIcon className={iconClass} />;\n };\n\n const label = getLabel();\n\n const button = (\n <button\n ref={ref}\n type=\"button\"\n aria-label={label}\n onClick={handleClick}\n className={cn(themeToggleVariants({ size, variant }), className)}\n {...props}\n >\n {getCurrentIcon()}\n </button>\n );\n\n if (showTooltip) {\n return (\n <Tooltip\n content={label}\n placement={tooltipPlacement}\n delay={tooltipDelay}\n >\n {button}\n </Tooltip>\n );\n }\n\n return button;\n }\n);\n\nThemeToggle.displayName = 'ThemeToggle';\n\nexport { ThemeToggle, themeToggleVariants, themeToggleIconVariants };\n"]}
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkZ5S5JEJD_cjs = require('./chunk-Z5S5JEJD.cjs');
4
+ var chunkS5RVSXDV_cjs = require('./chunk-S5RVSXDV.cjs');
4
5
  var chunkFHY3K6PL_cjs = require('./chunk-FHY3K6PL.cjs');
5
6
  var chunkFSGEDDF2_cjs = require('./chunk-FSGEDDF2.cjs');
6
- var chunkMYFZYUPR_cjs = require('./chunk-MYFZYUPR.cjs');
7
- var chunkS5RVSXDV_cjs = require('./chunk-S5RVSXDV.cjs');
7
+ var chunkAOHJILLU_cjs = require('./chunk-AOHJILLU.cjs');
8
8
  var React = require('react');
9
9
  var reactDom = require('react-dom');
10
10
  var classVarianceAuthority = require('class-variance-authority');
@@ -221,7 +221,7 @@ function Select(props) {
221
221
  anchorRef,
222
222
  floatingRef,
223
223
  style: dropdownStyle
224
- } = chunkMYFZYUPR_cjs.useAnchoredPosition({
224
+ } = chunkAOHJILLU_cjs.useAnchoredPosition({
225
225
  open: isOpen,
226
226
  matchWidth: true,
227
227
  maxHeight: 300
@@ -681,5 +681,5 @@ function CheckIcon({ className }) {
681
681
 
682
682
  exports.Select = Select;
683
683
  exports.selectTriggerVariants = selectTriggerVariants;
684
- //# sourceMappingURL=chunk-56QJHQ5C.cjs.map
685
- //# sourceMappingURL=chunk-56QJHQ5C.cjs.map
684
+ //# sourceMappingURL=chunk-XEEVDZDK.cjs.map
685
+ //# sourceMappingURL=chunk-XEEVDZDK.cjs.map