@mieweb/ui 0.11.0-dev.44 → 0.11.0-dev.45

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 (183) hide show
  1. package/dist/ag-grid.cjs +2 -2
  2. package/dist/ag-grid.js +1 -1
  3. package/dist/{chunk-AHYDJN4H.cjs → chunk-2XHPPOXY.cjs} +32 -32
  4. package/dist/{chunk-AHYDJN4H.cjs.map → chunk-2XHPPOXY.cjs.map} +1 -1
  5. package/dist/{chunk-3IKIRGHI.cjs → chunk-3H6BQV2D.cjs} +6 -6
  6. package/dist/{chunk-3IKIRGHI.cjs.map → chunk-3H6BQV2D.cjs.map} +1 -1
  7. package/dist/{chunk-IIV5GNSK.cjs → chunk-3PT4B4JT.cjs} +4 -4
  8. package/dist/{chunk-IIV5GNSK.cjs.map → chunk-3PT4B4JT.cjs.map} +1 -1
  9. package/dist/{chunk-GLG6UE2H.cjs → chunk-3SEQVGLH.cjs} +4 -4
  10. package/dist/{chunk-GLG6UE2H.cjs.map → chunk-3SEQVGLH.cjs.map} +1 -1
  11. package/dist/{chunk-JUY2JLFL.js → chunk-3XDU7XIC.js} +3 -3
  12. package/dist/{chunk-JUY2JLFL.js.map → chunk-3XDU7XIC.js.map} +1 -1
  13. package/dist/{chunk-LQ22CY7X.js → chunk-46ZUORUE.js} +5 -5
  14. package/dist/{chunk-LQ22CY7X.js.map → chunk-46ZUORUE.js.map} +1 -1
  15. package/dist/{chunk-CKECOCYJ.js → chunk-4IOIDS2Z.js} +3 -3
  16. package/dist/{chunk-CKECOCYJ.js.map → chunk-4IOIDS2Z.js.map} +1 -1
  17. package/dist/{chunk-F7SZSOB3.js → chunk-6PCA5H47.js} +3 -3
  18. package/dist/{chunk-F7SZSOB3.js.map → chunk-6PCA5H47.js.map} +1 -1
  19. package/dist/{chunk-ULEX7OOJ.js → chunk-6Y6W5DUY.js} +4 -4
  20. package/dist/{chunk-ULEX7OOJ.js.map → chunk-6Y6W5DUY.js.map} +1 -1
  21. package/dist/{chunk-S7AMZ4RD.cjs → chunk-7K6SW4VB.cjs} +4 -4
  22. package/dist/{chunk-S7AMZ4RD.cjs.map → chunk-7K6SW4VB.cjs.map} +1 -1
  23. package/dist/{chunk-KY67AMQ5.cjs → chunk-7MF3O3BU.cjs} +4 -4
  24. package/dist/{chunk-KY67AMQ5.cjs.map → chunk-7MF3O3BU.cjs.map} +1 -1
  25. package/dist/{chunk-Z3WMDVMR.cjs → chunk-7QNBPB7F.cjs} +9 -5
  26. package/dist/chunk-7QNBPB7F.cjs.map +1 -0
  27. package/dist/{chunk-YFWDS6MX.js → chunk-AB24H2RM.js} +3 -3
  28. package/dist/{chunk-YFWDS6MX.js.map → chunk-AB24H2RM.js.map} +1 -1
  29. package/dist/{chunk-DIIXY6EB.js → chunk-AQBZEN43.js} +5 -5
  30. package/dist/{chunk-DIIXY6EB.js.map → chunk-AQBZEN43.js.map} +1 -1
  31. package/dist/{chunk-2W73UQ3T.js → chunk-BPYI7BDC.js} +3 -3
  32. package/dist/{chunk-2W73UQ3T.js.map → chunk-BPYI7BDC.js.map} +1 -1
  33. package/dist/{chunk-7U7SONM5.js → chunk-CVCUQ2MZ.js} +3 -3
  34. package/dist/{chunk-7U7SONM5.js.map → chunk-CVCUQ2MZ.js.map} +1 -1
  35. package/dist/{chunk-PWXDRFJL.cjs → chunk-DHEOWRIE.cjs} +6 -6
  36. package/dist/{chunk-PWXDRFJL.cjs.map → chunk-DHEOWRIE.cjs.map} +1 -1
  37. package/dist/{chunk-OYUIEJPN.js → chunk-GTRYDFMT.js} +38 -10
  38. package/dist/chunk-GTRYDFMT.js.map +1 -0
  39. package/dist/{chunk-2FZYZ4HT.cjs → chunk-HDSYYQYM.cjs} +4 -4
  40. package/dist/{chunk-2FZYZ4HT.cjs.map → chunk-HDSYYQYM.cjs.map} +1 -1
  41. package/dist/{chunk-HH7PWD5I.cjs → chunk-HOE2U27V.cjs} +21 -21
  42. package/dist/{chunk-HH7PWD5I.cjs.map → chunk-HOE2U27V.cjs.map} +1 -1
  43. package/dist/{chunk-JCIQIR5V.js → chunk-IGUDEWIW.js} +4 -4
  44. package/dist/{chunk-JCIQIR5V.js.map → chunk-IGUDEWIW.js.map} +1 -1
  45. package/dist/{chunk-2KK4WZ7Y.cjs → chunk-IKHK4GTF.cjs} +4 -4
  46. package/dist/{chunk-2KK4WZ7Y.cjs.map → chunk-IKHK4GTF.cjs.map} +1 -1
  47. package/dist/{chunk-YVKBXNPK.js → chunk-JBNQ2L3K.js} +10 -6
  48. package/dist/chunk-JBNQ2L3K.js.map +1 -0
  49. package/dist/{chunk-GU6TPVXF.cjs → chunk-JK2IWOI7.cjs} +6 -6
  50. package/dist/{chunk-GU6TPVXF.cjs.map → chunk-JK2IWOI7.cjs.map} +1 -1
  51. package/dist/{chunk-TZKBW4GA.cjs → chunk-K76UNS22.cjs} +6 -6
  52. package/dist/{chunk-TZKBW4GA.cjs.map → chunk-K76UNS22.cjs.map} +1 -1
  53. package/dist/{chunk-DAAJ3B2T.js → chunk-KP72MDFB.js} +4 -4
  54. package/dist/{chunk-DAAJ3B2T.js.map → chunk-KP72MDFB.js.map} +1 -1
  55. package/dist/{chunk-MLCIINXT.js → chunk-LBUXS6FJ.js} +4 -4
  56. package/dist/{chunk-MLCIINXT.js.map → chunk-LBUXS6FJ.js.map} +1 -1
  57. package/dist/{chunk-GG3IK5TL.cjs → chunk-MQK2D6I6.cjs} +9 -9
  58. package/dist/{chunk-GG3IK5TL.cjs.map → chunk-MQK2D6I6.cjs.map} +1 -1
  59. package/dist/{chunk-IPHJQ6CF.js → chunk-MQSGJB2B.js} +5 -5
  60. package/dist/{chunk-IPHJQ6CF.js.map → chunk-MQSGJB2B.js.map} +1 -1
  61. package/dist/{chunk-2GBVJHWN.cjs → chunk-NH5JOZLG.cjs} +13 -13
  62. package/dist/{chunk-2GBVJHWN.cjs.map → chunk-NH5JOZLG.cjs.map} +1 -1
  63. package/dist/{chunk-NWU634SO.cjs → chunk-O2EAHOXM.cjs} +4 -4
  64. package/dist/{chunk-NWU634SO.cjs.map → chunk-O2EAHOXM.cjs.map} +1 -1
  65. package/dist/{chunk-JUYBJLPI.cjs → chunk-O7Y56J4R.cjs} +4 -4
  66. package/dist/{chunk-JUYBJLPI.cjs.map → chunk-O7Y56J4R.cjs.map} +1 -1
  67. package/dist/{chunk-EAAVFTKI.cjs → chunk-OJ2NCQ2R.cjs} +14 -14
  68. package/dist/{chunk-EAAVFTKI.cjs.map → chunk-OJ2NCQ2R.cjs.map} +1 -1
  69. package/dist/{chunk-GLRKXJCR.js → chunk-OX32ITWC.js} +3 -3
  70. package/dist/{chunk-GLRKXJCR.js.map → chunk-OX32ITWC.js.map} +1 -1
  71. package/dist/{chunk-L4APW65W.cjs → chunk-PJ4XEBMU.cjs} +4 -4
  72. package/dist/{chunk-L4APW65W.cjs.map → chunk-PJ4XEBMU.cjs.map} +1 -1
  73. package/dist/{chunk-OZKJYLN6.js → chunk-PSCSU63K.js} +3 -3
  74. package/dist/{chunk-OZKJYLN6.js.map → chunk-PSCSU63K.js.map} +1 -1
  75. package/dist/{chunk-EI4JU5JF.js → chunk-RKM4VGAN.js} +3 -3
  76. package/dist/{chunk-EI4JU5JF.js.map → chunk-RKM4VGAN.js.map} +1 -1
  77. package/dist/{chunk-ME7EVT6F.js → chunk-RYGVILUR.js} +3 -3
  78. package/dist/{chunk-ME7EVT6F.js.map → chunk-RYGVILUR.js.map} +1 -1
  79. package/dist/{chunk-EGPDT7SM.js → chunk-S7NJV335.js} +3 -3
  80. package/dist/{chunk-EGPDT7SM.js.map → chunk-S7NJV335.js.map} +1 -1
  81. package/dist/{chunk-AHT2HRHC.cjs → chunk-TNRANQVI.cjs} +16 -16
  82. package/dist/{chunk-AHT2HRHC.cjs.map → chunk-TNRANQVI.cjs.map} +1 -1
  83. package/dist/{chunk-TERHGQ73.cjs → chunk-U7XWWU5H.cjs} +5 -5
  84. package/dist/{chunk-TERHGQ73.cjs.map → chunk-U7XWWU5H.cjs.map} +1 -1
  85. package/dist/{chunk-G35LXI2A.js → chunk-UIFN2LYT.js} +3 -3
  86. package/dist/{chunk-G35LXI2A.js.map → chunk-UIFN2LYT.js.map} +1 -1
  87. package/dist/{chunk-L3CAWGBU.js → chunk-UQAWXY6R.js} +3 -3
  88. package/dist/{chunk-L3CAWGBU.js.map → chunk-UQAWXY6R.js.map} +1 -1
  89. package/dist/{chunk-ZULFKL3C.js → chunk-VOPRL4RF.js} +7 -7
  90. package/dist/{chunk-ZULFKL3C.js.map → chunk-VOPRL4RF.js.map} +1 -1
  91. package/dist/{chunk-KB2PLV5Q.js → chunk-VQGRMCVT.js} +4 -4
  92. package/dist/{chunk-KB2PLV5Q.js.map → chunk-VQGRMCVT.js.map} +1 -1
  93. package/dist/{chunk-MD55WRGN.cjs → chunk-X6THHGTZ.cjs} +37 -37
  94. package/dist/{chunk-MD55WRGN.cjs.map → chunk-X6THHGTZ.cjs.map} +1 -1
  95. package/dist/{chunk-Q6QLGCL7.cjs → chunk-XCCH5KHW.cjs} +9 -9
  96. package/dist/{chunk-Q6QLGCL7.cjs.map → chunk-XCCH5KHW.cjs.map} +1 -1
  97. package/dist/{chunk-KQXD6BFO.cjs → chunk-XM3D4KAF.cjs} +9 -9
  98. package/dist/{chunk-KQXD6BFO.cjs.map → chunk-XM3D4KAF.cjs.map} +1 -1
  99. package/dist/{chunk-PINIBEIU.cjs → chunk-XRXOGMMG.cjs} +39 -11
  100. package/dist/chunk-XRXOGMMG.cjs.map +1 -0
  101. package/dist/{chunk-XPWFIDZM.cjs → chunk-XU3X2AUL.cjs} +4 -4
  102. package/dist/{chunk-XPWFIDZM.cjs.map → chunk-XU3X2AUL.cjs.map} +1 -1
  103. package/dist/{chunk-3A4N5E6P.js → chunk-XZ65FX6T.js} +3 -3
  104. package/dist/{chunk-3A4N5E6P.js.map → chunk-XZ65FX6T.js.map} +1 -1
  105. package/dist/{chunk-CRR7AE5D.js → chunk-Z6I4XFPC.js} +3 -3
  106. package/dist/{chunk-CRR7AE5D.js.map → chunk-Z6I4XFPC.js.map} +1 -1
  107. package/dist/{chunk-LTCHD3K5.cjs → chunk-Z7ZOSENN.cjs} +5 -5
  108. package/dist/{chunk-LTCHD3K5.cjs.map → chunk-Z7ZOSENN.cjs.map} +1 -1
  109. package/dist/{chunk-NZUQL42A.cjs → chunk-ZDA6FEKA.cjs} +5 -5
  110. package/dist/{chunk-NZUQL42A.cjs.map → chunk-ZDA6FEKA.cjs.map} +1 -1
  111. package/dist/{chunk-UY2EZYIC.js → chunk-ZSBG6C3P.js} +3 -3
  112. package/dist/{chunk-UY2EZYIC.js.map → chunk-ZSBG6C3P.js.map} +1 -1
  113. package/dist/{chunk-KAQNYX7B.js → chunk-ZVRJVUFX.js} +3 -3
  114. package/dist/{chunk-KAQNYX7B.js.map → chunk-ZVRJVUFX.js.map} +1 -1
  115. package/dist/components/AudioPlayer/index.cjs +7 -7
  116. package/dist/components/AudioPlayer/index.js +2 -2
  117. package/dist/components/BoardView/index.cjs +5 -5
  118. package/dist/components/BoardView/index.js +2 -2
  119. package/dist/components/CollabStatus/index.cjs +5 -5
  120. package/dist/components/CollabStatus/index.js +2 -2
  121. package/dist/components/Dropdown/index.cjs +9 -9
  122. package/dist/components/Dropdown/index.d.cts +6 -1
  123. package/dist/components/Dropdown/index.d.ts +6 -1
  124. package/dist/components/Dropdown/index.js +2 -2
  125. package/dist/components/EmailEditor/index.cjs +16 -16
  126. package/dist/components/EmailEditor/index.js +7 -7
  127. package/dist/components/MediaEditor/index.cjs +10 -10
  128. package/dist/components/MediaEditor/index.js +5 -5
  129. package/dist/components/MediaFeed/index.cjs +6 -6
  130. package/dist/components/MediaFeed/index.js +5 -5
  131. package/dist/components/MediaPlayer/index.cjs +8 -8
  132. package/dist/components/MediaPlayer/index.js +4 -4
  133. package/dist/components/MegaMenu/index.cjs +5 -5
  134. package/dist/components/MegaMenu/index.js +2 -2
  135. package/dist/components/RecordHeader/index.cjs +5 -5
  136. package/dist/components/RecordHeader/index.js +3 -3
  137. package/dist/components/RecordLayout/index.cjs +5 -5
  138. package/dist/components/RecordLayout/index.js +3 -3
  139. package/dist/components/RichTextEditor/index.cjs +6 -6
  140. package/dist/components/RichTextEditor/index.js +3 -3
  141. package/dist/components/Slider/index.cjs +6 -6
  142. package/dist/components/Slider/index.js +2 -2
  143. package/dist/components/SliderCalculator/index.cjs +5 -5
  144. package/dist/components/SliderCalculator/index.js +3 -3
  145. package/dist/components/SuperChat/index.cjs +23 -23
  146. package/dist/components/SuperChat/index.js +8 -8
  147. package/dist/components/SuperChat/plugins/index.cjs +5 -5
  148. package/dist/components/SuperChat/plugins/index.js +4 -4
  149. package/dist/components/Tabs/index.cjs +8 -8
  150. package/dist/components/Tabs/index.js +2 -2
  151. package/dist/components/Textarea/index.cjs +8 -8
  152. package/dist/components/Textarea/index.js +5 -5
  153. package/dist/components/ThemeProvider/index.cjs +9 -9
  154. package/dist/components/ThemeProvider/index.js +3 -3
  155. package/dist/components/Tooltip/index.cjs +3 -3
  156. package/dist/components/Tooltip/index.js +2 -2
  157. package/dist/components/ViewSet/index.cjs +5 -5
  158. package/dist/components/ViewSet/index.js +4 -4
  159. package/dist/components/ViewSwitcher/index.cjs +4 -4
  160. package/dist/components/ViewSwitcher/index.js +2 -2
  161. package/dist/deck.cjs +3 -3
  162. package/dist/deck.js +1 -1
  163. package/dist/esheet.cjs +107 -107
  164. package/dist/esheet.js +10 -10
  165. package/dist/hooks/index.cjs +5 -5
  166. package/dist/hooks/index.js +1 -1
  167. package/dist/index.cjs +284 -284
  168. package/dist/index.d.cts +6 -1
  169. package/dist/index.d.ts +6 -1
  170. package/dist/index.js +40 -40
  171. package/dist/kerebron.cjs +6 -6
  172. package/dist/kerebron.js +4 -4
  173. package/dist/{model-5PB6KNYH.cjs → model-2TISYEYF.cjs} +20 -20
  174. package/dist/{model-5PB6KNYH.cjs.map → model-2TISYEYF.cjs.map} +1 -1
  175. package/dist/{model-OGWTZEXR.js → model-BCS5BUK3.js} +6 -6
  176. package/dist/{model-OGWTZEXR.js.map → model-BCS5BUK3.js.map} +1 -1
  177. package/dist/org-chart.cjs +2 -2
  178. package/dist/org-chart.js +1 -1
  179. package/package.json +1 -1
  180. package/dist/chunk-OYUIEJPN.js.map +0 -1
  181. package/dist/chunk-PINIBEIU.cjs.map +0 -1
  182. package/dist/chunk-YVKBXNPK.js.map +0 -1
  183. package/dist/chunk-Z3WMDVMR.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/MediaPlayer/overlayButton.ts","../src/components/MediaPlayer/pictureInPicture.ts","../src/components/MediaPlayer/MediaControls.tsx","../src/components/MediaPlayer/MediaPlayer.tsx"],"names":["MediaControls","className","React2","jsx","jsxs"],"mappings":";;;;;;;;;;;AAUO,IAAM,kBAAA,GAAqB;AAAA,EAChC,sDAAA;AAAA,EACA,uDAAA;AAAA,EACA,gEAAA;AAAA,EACA,sDAAA;AAAA,EACA;AACF,CAAA,CAAE,KAAK,GAAG;AAGH,IAAM,cAAA,GACX;AAEK,IAAM,kBAAA,GAAqB;;;ACT3B,IAAM,UAAA,GAAgC;AAAA,EAC3C,uBAAA;AAAA,EACA,uBAAA;AAAA,EACA;AACF;AAMA,IAAM,mBAAA,GAAsB,GAAA;AAGrB,SAAS,qBACd,KAAA,EACS;AACT,EAAA,IAAI,CAAC,KAAA,IAAS,OAAO,QAAA,KAAa,aAAa,OAAO,KAAA;AACtD,EAAA,OACE,QAAA,CAAS,uBAAA,KAA4B,KAAA,IACpC,KAAA,CAAsB,sBAAA,KAA2B,oBAAA;AAEtD;AAMO,SAAS,qBACd,KAAA,EACe;AACf,EAAA,IAAI,CAAC,SAAS,CAAC,oBAAA,CAAqB,KAAK,CAAA,EAAG,OAAO,QAAQ,OAAA,EAAQ;AACnE,EAAA,IAAI,SAAS,uBAAA,KAA4B,KAAA;AACvC,IAAA,OAAO,QAAA,CAAS,oBAAA,EAAqB,CAAE,KAAA,CAAM,MAAM;AAAA,IAAC,CAAC,CA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IAAA,EAAK,IAAA;AAAA,gBACL,SAAA,EAAU,eAAA;AAAA,gBACV,OAAA,EAAS,WAAA;AAAA,gBAER,kBAAQ,KAAA,IAAS;AAAA;AAAA;AACpB;AAAA;AAAA,OACF,EACF,CAAA;AAAA,IAEJ;AAEA,IAAA,uBACEA,GAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,mBAAA,CAAoB,EAAE,OAAA,EAAS,SAAA,EAAW,CAAA,EACvD,QAAA,EAAA,YAAA,KAAiB,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAQhBC,IAAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,GAAA,EAAK,MAAA;AAAA,UACL,WAAA,EAAW,UAAU,kBAAA,GAAqB,MAAA;AAAA,UAC1C,YAAA,EAAY,UAAU,MAAA,GAAS,MAAA;AAAA,UAC/B,SAAA,EAAW,UAAU,iCAAA,GAAoC,UAAA;AAAA,UAExD,QAAA,EAAA;AAAA,YAAA,KAAA;AAAA,YACA,OAAA,IAAW,4BACVD,GAAAA;AAAA,cAAC,aAAA;AAAA,cAAA;AAAA,gBACC,SAAA;AAAA,gBACA,gBAAA,EAAkB,MAAA;AAAA,gBAClB,MAAA;AAAA,gBACA;AAAA;AAAA;AACF;AAAA;AAAA;AAEJ;AAAA;AAAA,sBAGAA,GAAAA;AAAA,QAAC,OAAA;AAAA,QAAA;AAAA,UACC,GAAA,EAAK,UAAA;AAAA,UACL,SAAA,EAAU,uBAAA;AAAA,UACT,GAAG,gBAAA;AAAA,UAEH;AAAA;AAAA;AACH,KAAA,EAEJ,CAAA;AAAA,EAEJ;AACF;AAEA,WAAA,CAAY,WAAA,GAAc,aAAA","file":"chunk-JCIQIR5V.js","sourcesContent":["// Internal to the media components; not part of the public API.\n\n/**\n * The round, translucent icon button over a video (the feed's Previous/Next,\n * its inactive item's Play). Pass it to `<Button variant=\"ghost\" size=\"icon\">`;\n * it sets the `dark:` colours too, because these buttons sit inside a\n * `data-theme=\"dark\"` surface. Add `bg-transparent` where the button sits on a\n * scrim already, as the player's bar does. The scrim is black on purpose: it\n * has to read over any frame of the video.\n */\nexport const overlayButtonClass = [\n 'rounded-full bg-black/45 text-white backdrop-blur-sm',\n 'hover:bg-black/65 hover:text-white active:bg-black/75',\n 'dark:text-white dark:hover:bg-black/65 dark:active:bg-black/75',\n 'focus-visible:ring-white focus-visible:ring-offset-0',\n 'pointer-fine:h-9 pointer-fine:w-9',\n].join(' ');\n\n/** The large round ▶ in the middle of a paused video, and its glyph. */\nexport const playBadgeClass =\n 'flex h-14 w-14 items-center justify-center rounded-full bg-black/60 text-white';\n// Optical centring; media glyphs don't flip in RTL.\nexport const playBadgeIconClass = 'h-6 w-6 translate-x-0.5 fill-current';\n","// Internal to the media components (MediaControls, MediaFeed); not part of\n// the public API.\n\n/** Safari's own full screen and picture in picture, beside the standard APIs. */\nexport type WebKitVideo = HTMLVideoElement & {\n webkitEnterFullscreen?: () => void;\n webkitSupportsFullscreen?: boolean;\n webkitSupportsPresentationMode?: (mode: string) => boolean;\n webkitSetPresentationMode?: (mode: string) => void;\n webkitPresentationMode?: string;\n};\n\n/** The events that say a video went into or out of picture in picture. */\nexport const PIP_EVENTS: readonly string[] = [\n 'enterpictureinpicture',\n 'leavepictureinpicture',\n 'webkitpresentationmodechanged',\n];\n\n/**\n * How long to wait for Safari to say a video left picture in picture before\n * carrying on: the event may never come.\n */\nconst PIP_EXIT_TIMEOUT_MS = 1000;\n\n/** Whether `video` is floating in picture in picture (either API). */\nexport function isInPictureInPicture(\n video: HTMLMediaElement | null | undefined\n): boolean {\n if (!video || typeof document === 'undefined') return false;\n return (\n document.pictureInPictureElement === video ||\n (video as WebKitVideo).webkitPresentationMode === 'picture-in-picture'\n );\n}\n\n/**\n * Bring `video` back from picture in picture (either API). Resolves once it is\n * back inline, or straight away when it wasn't floating.\n */\nexport function exitPictureInPicture(\n video: HTMLMediaElement | null | undefined\n): Promise<void> {\n if (!video || !isInPictureInPicture(video)) return Promise.resolve();\n if (document.pictureInPictureElement === video)\n return document.exitPictureInPicture().catch(() => {});\n return new Promise((resolve) => {\n // Whichever comes first, the event or the timeout, cleans up the other.\n const done = () => {\n clearTimeout(timer);\n video.removeEventListener('webkitpresentationmodechanged', done);\n resolve();\n };\n const timer = setTimeout(done, PIP_EXIT_TIMEOUT_MS);\n video.addEventListener('webkitpresentationmodechanged', done, {\n once: true,\n });\n (video as WebKitVideo).webkitSetPresentationMode?.('inline');\n });\n}\n\n/** Whether this browser can float `video` in picture in picture. */\nexport function canPictureInPicture(video: WebKitVideo | null): boolean {\n if (!video || typeof document === 'undefined') return false;\n if (video.disablePictureInPicture) return false;\n return (\n document.pictureInPictureEnabled ||\n !!video.webkitSupportsPresentationMode?.('picture-in-picture')\n );\n}\n","import * as React from 'react';\nimport {\n Captions,\n CaptionsOff,\n Maximize,\n Minimize,\n Pause,\n PictureInPicture2,\n Play,\n Volume2,\n VolumeX,\n} from 'lucide-react';\n\nimport { cn } from '../../utils/cn';\nimport type { UseMediaTransportReturn } from '../../hooks/useMediaTransport';\nimport { formatTime } from '../AudioPlayer/AudioPlayer';\nimport { Button } from '../Button';\nimport { Slider } from '../Slider';\nimport {\n overlayButtonClass,\n playBadgeClass,\n playBadgeIconClass,\n} from './overlayButton';\nimport {\n canPictureInPicture,\n exitPictureInPicture,\n isInPictureInPicture,\n PIP_EVENTS,\n type WebKitVideo,\n} from './pictureInPicture';\n\n/** Every string the controls show or announce, for the host to localize. */\nexport interface MediaControlsLabels {\n play: string;\n pause: string;\n mute: string;\n unmute: string;\n seek: string;\n fullscreen: string;\n exitFullscreen: string;\n pictureInPicture: string;\n exitPictureInPicture: string;\n /** The elapsed and total time, already formatted (`1:05`, `4:30`). */\n time: (current: string, duration: string) => string;\n /** The speed button's text for a rate (`1.5×`). */\n rate: (rate: number) => string;\n /** The speed button's accessible name, given its text. */\n speed: (rate: string) => string;\n showCaptions: string;\n hideCaptions: string;\n}\n\n/** The English defaults; MediaFeed reuses them for its player labels. */\nexport const defaultMediaControlsLabels: MediaControlsLabels = {\n play: 'Play',\n pause: 'Pause',\n mute: 'Mute',\n unmute: 'Unmute',\n seek: 'Seek',\n fullscreen: 'Full screen',\n exitFullscreen: 'Exit full screen',\n pictureInPicture: 'Picture in picture',\n exitPictureInPicture: 'Exit picture in picture',\n time: (current, duration) => `${current} / ${duration}`,\n rate: (rate) => `${rate}×`,\n speed: (rate) => `Playback speed ${rate}`,\n showCaptions: 'Show captions',\n hideCaptions: 'Hide captions',\n};\n\nexport interface MediaControlsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The transport attached to the `<video>` these controls drive. */\n transport: UseMediaTransportReturn;\n /**\n * The box that goes full screen with the controls (the video and these\n * controls' shared parent). Where the browser can't take an element full\n * screen (an iPhone), the video opens in the system's own player instead.\n */\n fullscreenTarget?: React.RefObject<HTMLElement | null>;\n /** Localized text for every control; English by default. */\n labels?: Partial<MediaControlsLabels>;\n /** The speeds the speed button cycles through (default `[1, 1.5, 2]`). */\n playbackRates?: readonly number[];\n}\n\nconst defaultPlaybackRates = [1, 1.5, 2] as const;\n\n/** Controls a small player (under 20rem wide) leaves out: speed and picture in picture. */\nconst SMALL_PLAYER_HIDDEN = '@max-xs:hidden';\n\n/** Where a tap or drag on the seek bar lands: to the tenth of a second. */\nconst SEEK_STEP_MS = 100;\n\n/**\n * How far an arrow key seeks, as a share of the clip (2%): a few presses cross\n * a short clip, and a long one isn't hundreds of presses long.\n */\nconst KEYBOARD_SEEK_FRACTION = 0.02;\n\n/**\n * Browsers size caption text at about 5% of the video's height, and step a\n * cue's `line` by its line box, so this approximates one line's height.\n */\nconst CUE_LINE_HEIGHT_FRACTION = 0.05;\n\n/** The line a cue is lifted to before the video has a size to measure. */\nconst DEFAULT_CUE_LINE = -4;\n\nconst formatMs = (ms: number) => formatTime(ms / 1000);\n\n/**\n * The cue line just above the bar's controls. Lines count up from -1 (the\n * bottom one), so a cue on line -(n + 1) clears n lines. The bar's top padding\n * is the transparent start of its scrim, which captions may cover.\n */\nfunction cueLineAboveBar(\n video: HTMLVideoElement,\n bar: HTMLElement | null\n): number {\n const lineHeight =\n video.getBoundingClientRect().height * CUE_LINE_HEIGHT_FRACTION;\n if (!bar || lineHeight <= 0) return DEFAULT_CUE_LINE;\n const controls =\n bar.getBoundingClientRect().height -\n (parseFloat(getComputedStyle(bar).paddingTop) || 0);\n return -(Math.ceil(Math.max(controls, 0) / lineHeight) + 1);\n}\n\n/** Whether `video` is in picture in picture, following every change. */\nfunction useInPictureInPicture(video: HTMLVideoElement | null): boolean {\n const [inPip, setInPip] = React.useState(false);\n React.useEffect(() => {\n if (!video) return;\n const update = () => setInPip(isInPictureInPicture(video));\n update();\n for (const event of PIP_EVENTS) video.addEventListener(event, update);\n return () => {\n for (const event of PIP_EVENTS) video.removeEventListener(event, update);\n };\n }, [video]);\n return inPip;\n}\n\n/**\n * The video's caption and subtitle tracks, and whether one is showing,\n * following tracks the host adds, removes or switches itself.\n */\nfunction useCaptionTracks(\n video: HTMLVideoElement | null,\n barRef: React.RefObject<HTMLElement | null>\n) {\n const [tracks, setTracks] = React.useState<globalThis.TextTrack[]>([]);\n const [showing, setShowing] = React.useState(false);\n React.useEffect(() => {\n const list = video?.textTracks;\n if (!list) {\n setTracks([]);\n setShowing(false);\n return;\n }\n // Browsers draw cues at the very bottom, under the bar: lift any cue the\n // host left on the default line to just above it. A fixed line count\n // isn't enough, since lines scale with the video and the bar doesn't (it\n // takes two rows in a small card). Cues load lazily, and the player can\n // change size, so this runs again as cues become active and as the video\n // or bar is resized. `lifted` keeps\n // the line each cue was lifted to: a cue still on it is ours to move, and\n // goes back to the default line when these controls unmount (the video\n // may stay, with no bar to clear). One the host has moved since is theirs.\n const lifted = new Map<globalThis.VTTCue, number>();\n const place = (\n track: globalThis.TextTrack | null,\n cue: globalThis.VTTCue,\n line: number | 'auto'\n ) => {\n cue.line = line;\n // A cue already on screen keeps its old place until it's re-added.\n if (track && Array.from(track.activeCues ?? []).includes(cue)) {\n track.removeCue(cue);\n track.addCue(cue);\n }\n };\n const liftCues = (track: globalThis.TextTrack) => {\n const line = video\n ? cueLineAboveBar(video, barRef.current)\n : DEFAULT_CUE_LINE;\n for (const each of Array.from(track.cues ?? [])) {\n if (!('line' in each)) continue;\n const cue = each as globalThis.VTTCue;\n if (cue.line !== 'auto' && lifted.get(cue) !== cue.line) continue;\n if (cue.line === line) continue;\n lifted.set(cue, line);\n place(track, cue, line);\n }\n };\n const lift = (event: Event) =>\n liftCues(event.target as globalThis.TextTrack);\n let watched: globalThis.TextTrack[] = [];\n const update = () => {\n const captions = Array.from(list).filter(\n (track) => track.kind === 'captions' || track.kind === 'subtitles'\n );\n for (const track of watched)\n track.removeEventListener?.('cuechange', lift);\n for (const track of captions) track.addEventListener?.('cuechange', lift);\n watched = captions;\n setTracks(captions);\n setShowing(captions.some((track) => track.mode === 'showing'));\n };\n update();\n const events = ['addtrack', 'removetrack', 'change'];\n for (const name of events) list.addEventListener?.(name, update);\n // A new size (a phone turned, full screen left) needs a new line but\n // brings no cuechange, so the cues move then too, paused or playing.\n const resize =\n typeof ResizeObserver === 'undefined'\n ? null\n : new ResizeObserver(() => watched.forEach(liftCues));\n for (const element of [video, barRef.current])\n if (element) resize?.observe(element);\n return () => {\n resize?.disconnect();\n for (const name of events) list.removeEventListener?.(name, update);\n for (const track of watched)\n track.removeEventListener?.('cuechange', lift);\n for (const [cue, line] of lifted)\n if (cue.line === line) place(cue.track, cue, 'auto');\n };\n }, [video, barRef]);\n return { tracks, showing };\n}\n\n/** Whether `element`'s audio is muted, following every change to it. */\nfunction useMuted(element: HTMLMediaElement | null): boolean {\n const [muted, setMuted] = React.useState(element?.muted ?? false);\n React.useEffect(() => {\n if (!element) return;\n const update = () => setMuted(element.muted);\n update();\n element.addEventListener('volumechange', update);\n return () => element.removeEventListener('volumechange', update);\n }, [element]);\n return muted;\n}\n\n/** Whether `target` is the page's full-screen element. */\nfunction useIsFullscreen(\n target: React.RefObject<HTMLElement | null> | undefined\n): boolean {\n const [fullscreen, setFullscreen] = React.useState(false);\n React.useEffect(() => {\n if (typeof document === 'undefined') return;\n const update = () =>\n setFullscreen(\n !!target?.current && document.fullscreenElement === target.current\n );\n // Controls that mount while their box is already full screen say so.\n update();\n document.addEventListener('fullscreenchange', update);\n return () => document.removeEventListener('fullscreenchange', update);\n }, [target]);\n return fullscreen;\n}\n\n/**\n * Touch-first controls laid over a `<video>`, in place of the browser's own.\n * A tap on the picture plays or pauses it, a round ▶ shows while it's paused,\n * and a bar along the bottom has play/pause, the time, a seek bar, playback\n * speed, captions on/off when the video has a caption track, mute, and\n * picture in picture and full screen where the browser supports them.\n *\n * `MediaPlayer` renders it for `controlsStyle=\"overlay\"`. To use it directly,\n * render it in a positioned box with the video, attach\n * `transport.setMediaElement` to the video's `ref` and give the video\n * `playsInline` (without it, an iPhone plays it in the system player, away\n * from these controls).\n */\nexport const MediaControls = React.forwardRef<\n HTMLDivElement,\n MediaControlsProps\n>(function MediaControls(\n {\n transport,\n fullscreenTarget,\n labels: labelOverrides,\n playbackRates = defaultPlaybackRates,\n className,\n ...rest\n },\n ref\n) {\n const labels = { ...defaultMediaControlsLabels, ...labelOverrides };\n const video = transport.mediaElement as WebKitVideo | null;\n const muted = useMuted(video);\n const isFullscreen = useIsFullscreen(fullscreenTarget);\n const inPip = useInPictureInPicture(video);\n const barRef = React.useRef<HTMLDivElement>(null);\n const captions = useCaptionTracks(video, barRef);\n // What this browser can do is read once mounted: the server can't know it,\n // and markup that differs from the server's breaks hydration. Safari only\n // says a video can float once its metadata is in, so read again then (and\n // on each new source).\n const [support, setSupport] = React.useState({ box: false, pip: false });\n React.useEffect(() => {\n const read = () =>\n setSupport({\n box: document.fullscreenEnabled && !!fullscreenTarget,\n pip: canPictureInPicture(video),\n });\n read();\n video?.addEventListener('loadedmetadata', read);\n return () => video?.removeEventListener('loadedmetadata', read);\n }, [video, fullscreenTarget]);\n const playing = transport.isPlaying;\n const durationMs = transport.durationMs;\n\n const togglePlay = transport.togglePlay;\n const toggleMuted = () => {\n if (video) video.muted = !video.muted;\n };\n // The iPhone fallback only where it works: Chromium has the method too, but\n // it does nothing in a frame that isn't allowed full screen.\n const canFullscreen =\n support.box ||\n (!!video?.webkitEnterFullscreen && !!video.webkitSupportsFullscreen);\n // Leaves only a full screen these controls entered: a page that is full\n // screen itself (a kiosk, a presentation) stays that way.\n const toggleFullscreen = () => {\n if (isFullscreen) {\n void document.exitFullscreen?.()?.catch(() => {});\n } else if (support.box && fullscreenTarget?.current) {\n void fullscreenTarget.current.requestFullscreen?.()?.catch(() => {});\n } else {\n video?.webkitEnterFullscreen?.();\n }\n };\n // Each press moves to the next speed, and from the last back to the first.\n const rate = transport.playbackRate;\n const cycleSpeed = () => {\n const index = playbackRates.indexOf(rate);\n transport.setPlaybackRate(\n playbackRates[(index + 1) % playbackRates.length] ?? 1\n );\n };\n // Shows the first caption track, or hides whichever is showing.\n const toggleCaptions = () => {\n const [first] = captions.tracks;\n for (const track of captions.tracks)\n track.mode =\n !captions.showing && track === first ? 'showing' : 'disabled';\n };\n // The standard API, else Safari's presentation mode on an iPhone.\n const togglePictureInPicture = () => {\n if (!video) return;\n if (isInPictureInPicture(video)) {\n void exitPictureInPicture(video);\n } else if (document.pictureInPictureEnabled) {\n void video.requestPictureInPicture().catch(() => {});\n } else {\n video.webkitSetPresentationMode?.('picture-in-picture');\n }\n };\n\n const barButton = (\n label: string,\n onClick: () => void,\n icon: React.ReactElement,\n className?: string\n ) => (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={label}\n title={label}\n onClick={onClick}\n className={cn(overlayButtonClass, 'shrink-0 bg-transparent', className)}\n >\n {icon}\n </Button>\n );\n\n return (\n <div\n ref={ref}\n data-slot=\"media-controls\"\n className={cn(\n // A container query: a narrow player (a portrait clip) gives the seek\n // bar a row of its own, so it's always long enough to drag.\n '@container pointer-events-none absolute inset-0 flex flex-col justify-end',\n className\n )}\n {...rest}\n >\n {/* A pointer convenience over the picture, as in every video app. The\n bar's Play is the keyboard and screen-reader control. */}\n <div\n data-slot=\"media-controls-surface\"\n aria-hidden=\"true\"\n className=\"pointer-events-auto absolute inset-0 flex cursor-pointer items-center justify-center\"\n onClick={togglePlay}\n >\n {!playing && (\n <span className={playBadgeClass}>\n <Play className={playBadgeIconClass} />\n </span>\n )}\n </div>\n {/* Left to right in every language: a media timeline follows the\n media, not the reading direction (Material: don't mirror playback\n controls or their progress bar). Labels keep their own direction. */}\n <div\n ref={barRef}\n data-slot=\"media-controls-bar\"\n dir=\"ltr\"\n // A small player (a card in a chat, under 20rem wide) keeps play,\n // time, seek, mute and full screen on two short rows and leaves speed\n // and picture in picture to the larger view, as in-chat players do;\n // its gradient starts lower so the picture stays visible.\n className=\"pointer-events-auto relative flex flex-wrap items-center gap-x-1 bg-gradient-to-t from-black/75 via-black/40 to-transparent px-1 pt-6 pb-1 text-white sm:px-2 @max-xs:pt-2\"\n >\n {barButton(\n playing ? labels.pause : labels.play,\n togglePlay,\n playing ? (\n <Pause className=\"h-5 w-5 fill-current\" aria-hidden=\"true\" />\n ) : (\n <Play className=\"h-5 w-5 fill-current\" aria-hidden=\"true\" />\n )\n )}\n <span\n data-slot=\"media-controls-time\"\n className=\"shrink-0 px-1 text-xs whitespace-nowrap tabular-nums @max-md:me-auto\"\n >\n {/* The label may be RTL text (\"0:01 من 0:04\"): isolate its\n direction without turning the bar's layout around. */}\n <bdi>\n {labels.time(\n formatMs(transport.currentTimeMs),\n formatMs(durationMs)\n )}\n </bdi>\n </span>\n <Slider\n // Taller to grab on a touch screen; the track itself stays thin.\n className=\"mx-1 min-w-0 flex-1 @max-md:order-first @max-md:mx-2 @max-md:basis-full pointer-coarse:[&_[data-slot=slider-track-wrapper]]:py-4\"\n // dark: too, or the dark surface's own track colour wins.\n trackClassName=\"bg-white/30 dark:bg-white/30\"\n size=\"sm\"\n min={0}\n max={durationMs > 0 ? durationMs : 1}\n step={SEEK_STEP_MS}\n keyboardStep={Math.max(\n SEEK_STEP_MS,\n Math.round(durationMs * KEYBOARD_SEEK_FRACTION)\n )}\n value={transport.currentTimeMs}\n onValueChange={transport.seekToMs}\n formatValue={formatMs}\n disabled={durationMs <= 0}\n aria-label={labels.seek}\n />\n {playbackRates.length > 1 &&\n barButton(\n labels.speed(labels.rate(rate)),\n cycleSpeed,\n <span className=\"text-xs font-semibold tabular-nums\">\n {labels.rate(rate)}\n </span>,\n SMALL_PLAYER_HIDDEN\n )}\n {/* The label says what a press does, so it carries the state: no\n aria-pressed as well, or it would read \"Hide captions, pressed\". */}\n {captions.tracks.length > 0 &&\n barButton(\n captions.showing ? labels.hideCaptions : labels.showCaptions,\n toggleCaptions,\n // The icon shows the state, as mute's does.\n captions.showing ? (\n <Captions className=\"h-5 w-5\" aria-hidden=\"true\" />\n ) : (\n <CaptionsOff className=\"h-5 w-5\" aria-hidden=\"true\" />\n )\n )}\n {barButton(\n muted ? labels.unmute : labels.mute,\n toggleMuted,\n muted ? (\n <VolumeX className=\"h-5 w-5\" aria-hidden=\"true\" />\n ) : (\n <Volume2 className=\"h-5 w-5\" aria-hidden=\"true\" />\n )\n )}\n {support.pip &&\n barButton(\n inPip ? labels.exitPictureInPicture : labels.pictureInPicture,\n togglePictureInPicture,\n <PictureInPicture2 className=\"h-5 w-5\" aria-hidden=\"true\" />,\n SMALL_PLAYER_HIDDEN\n )}\n {canFullscreen &&\n barButton(\n isFullscreen ? labels.exitFullscreen : labels.fullscreen,\n toggleFullscreen,\n isFullscreen ? (\n <Minimize className=\"h-5 w-5\" aria-hidden=\"true\" />\n ) : (\n <Maximize className=\"h-5 w-5\" aria-hidden=\"true\" />\n )\n )}\n </div>\n </div>\n );\n});\n","import * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { Button } from '../Button';\nimport { useMediaTransport } from '../../hooks/useMediaTransport';\nimport { MediaControls, type MediaControlsLabels } from './MediaControls';\n\n// ============================================================================\n// Types & Interfaces\n// ============================================================================\n\nexport type MediaPlayerState =\n | 'idle'\n | 'loading'\n | 'playing'\n | 'paused'\n | 'error';\n\nexport type MediaKind = 'video' | 'audio';\n\n/** Ref handle for controlling {@link MediaPlayer} programmatically. */\nexport interface MediaPlayerRef {\n /** Seek to a specific time in milliseconds. */\n seekToMs: (timeMs: number) => void;\n /** Start playback. */\n play: () => void;\n /** Pause playback. */\n pause: () => void;\n /** Get current playback time in milliseconds. */\n getCurrentTimeMs: () => number;\n /** Get total duration in milliseconds. */\n getDurationMs: () => number;\n /** Whether playback is currently paused. */\n isPaused: () => boolean;\n /** Set playback speed multiplier. */\n setPlaybackRate: (rate: number) => void;\n /**\n * The underlying media element.\n * Escape hatch for host integrations (e.g. thumbnail capture); prefer the\n * typed methods above for playback control.\n */\n mediaElement: HTMLVideoElement | HTMLAudioElement | null;\n}\n\nexport interface MediaPlayerProps extends VariantProps<\n typeof mediaPlayerVariants\n> {\n /** Media source URL. */\n src: string;\n /** Force the media kind; when omitted it is inferred from the src extension. */\n kind?: MediaKind;\n /** Whether to show controls (default `true`). */\n controls?: boolean;\n /**\n * Which controls a video gets (default `'native'`, the browser's own).\n * `'overlay'` lays touch-first controls over it ({@link MediaControls}),\n * the same in every browser and in a mobile app's web view. Audio always uses\n * the browser's.\n */\n controlsStyle?: 'native' | 'overlay';\n /** Begin muted; the controls can still unmute it. */\n muted?: boolean;\n /** Repeat playback when the media ends. */\n loop?: boolean;\n /** Video thumbnail displayed before playback. */\n poster?: string;\n /** Browser preload hint (default browser behavior when omitted). */\n preload?: 'none' | 'metadata' | 'auto';\n /** Caption/subtitle `<track>` elements. The `src` attribute is always set\n * on the media element, so alternative `<source>` children are ignored. */\n children?: React.ReactNode;\n /** The speeds the overlay controls' speed button cycles through (default `[1, 1.5, 2]`). */\n playbackRates?: readonly number[];\n /** Localized load-error and retry text, and the overlay controls' labels. */\n labels?: { error?: string; retry?: string } & Partial<MediaControlsLabels>;\n /** Callback when playback state changes. */\n onStateChange?: (state: MediaPlayerState) => void;\n /** Callback when playback ends. */\n onEnded?: () => void;\n /** Callback when an error occurs. */\n onError?: (error: Error) => void;\n /** Callback after the user requests a fresh media load on the error surface. */\n onRetry?: () => void;\n /** Callback on time updates (milliseconds). */\n onTimeUpdate?: (currentTimeMs: number, durationMs: number) => void;\n /** Additional class name. */\n className?: string;\n /** Accessible label for the media element. */\n 'aria-label'?: string;\n /**\n * Transitional: exposes the raw media element to legacy consumers.\n * Prefer {@link MediaPlayerRef} for playback control.\n */\n mediaElementRef?: React.RefObject<HTMLVideoElement | HTMLAudioElement | null>;\n}\n\n// ============================================================================\n// Variants\n// ============================================================================\n\nconst mediaPlayerVariants = cva(\n 'flex h-full w-full items-center justify-center',\n {\n variants: {\n variant: {\n plain: '',\n card: 'rounded-xl border border-border bg-card text-card-foreground p-2',\n },\n },\n defaultVariants: {\n variant: 'plain',\n },\n }\n);\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\nconst VIDEO_EXTENSIONS = /\\.(mp4|mov|avi|webm|mkv|m4v)$/i;\n\n/** Infer media kind from a URL's file extension; defaults to audio. */\nexport function inferMediaKind(src: string): MediaKind {\n // Strip any query string / fragment before matching. Testing the extension\n // against the full URL required a trailing `.*`, which backtracks\n // polynomially on crafted inputs (ReDoS); splitting first is linear.\n const path = src.split(/[?#]/, 1)[0];\n return VIDEO_EXTENSIONS.test(path) ? 'video' : 'audio';\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * Media playback surface for audio and video with a shared imperative handle.\n *\n * Renders a native `<video>` or `<audio>` element (kind inferred from the src\n * extension unless forced) with themed error/retry handling. Playback state and\n * controls come from the shared {@link useMediaTransport} hook and are exposed\n * through {@link MediaPlayerRef} (all times in milliseconds) — consumers should\n * not reach into the DOM element directly.\n */\nexport const MediaPlayer = React.forwardRef<MediaPlayerRef, MediaPlayerProps>(\n (\n {\n src,\n kind,\n controls = true,\n controlsStyle = 'native',\n muted,\n loop,\n poster,\n preload,\n children,\n playbackRates,\n labels,\n variant,\n onStateChange,\n onEnded,\n onError,\n onRetry,\n onTimeUpdate,\n className,\n 'aria-label': ariaLabel,\n mediaElementRef,\n },\n ref\n ) => {\n const [error, setError] = React.useState<string | null>(null);\n\n // A failed load must not outlive its src: clearing on change lets a host\n // swap in a corrected URL without being trapped on the error surface\n // (which unmounts the media element, so the new src would never load).\n React.useEffect(() => {\n setError(null);\n }, [src]);\n const resolvedKind = kind ?? inferMediaKind(src);\n\n const transport = useMediaTransport({\n onTimeUpdate,\n onStateChange,\n onEnded,\n onError: (err) => {\n setError(\n labels?.error ??\n 'Unable to load media. The server may be unavailable.'\n );\n onError?.(err);\n },\n endedState: 'paused',\n errorLabel: `media: ${src}`,\n });\n\n const { setMediaElement, mediaElement } = transport;\n\n const setElement = React.useCallback(\n (el: HTMLVideoElement | HTMLAudioElement | null) => {\n setMediaElement(el);\n if (mediaElementRef) {\n (mediaElementRef as React.MutableRefObject<typeof el>).current = el;\n }\n },\n [setMediaElement, mediaElementRef]\n );\n\n React.useImperativeHandle(\n ref,\n (): MediaPlayerRef => ({\n seekToMs: transport.seekToMs,\n play: transport.play,\n pause: transport.pause,\n getCurrentTimeMs: transport.getCurrentTimeMs,\n getDurationMs: transport.getDurationMs,\n isPaused: transport.isPaused,\n setPlaybackRate: transport.setPlaybackRate,\n get mediaElement() {\n return mediaElement;\n },\n }),\n [transport, mediaElement]\n );\n\n const handleRetry = React.useCallback(() => {\n setError(null);\n mediaElement?.load();\n onRetry?.();\n }, [mediaElement, onRetry]);\n\n const overlay = controlsStyle === 'overlay' && resolvedKind === 'video';\n const boxRef = React.useRef<HTMLDivElement>(null);\n const sharedMediaProps = {\n src,\n controls: controls && !overlay,\n muted,\n loop,\n preload,\n 'aria-label': ariaLabel,\n };\n\n // Tracks belong to the caller's media resource and can be supplied as\n // children. The feed also supports a custom renderer for captions.\n const video = (\n // eslint-disable-next-line jsx-a11y/media-has-caption\n <video\n ref={setElement as React.Ref<HTMLVideoElement>}\n playsInline\n poster={poster}\n className={\n overlay\n ? 'h-full w-full object-contain'\n : 'h-auto max-h-full w-auto max-w-full object-contain'\n }\n {...sharedMediaProps}\n >\n {children}\n </video>\n );\n\n if (error) {\n return (\n <div className={mediaPlayerVariants({ variant, className })}>\n <div\n role=\"alert\"\n className=\"border-destructive/30 bg-destructive/10 flex min-h-36 flex-col items-center justify-center gap-3 rounded-lg border p-8 text-center\"\n >\n {/* destructive-700/300 instead of the base token: #dc2626 on the\n destructive/10 tint is 4.14:1 — below WCAG AA (axe: color-contrast). */}\n <p className=\"text-destructive-700 dark:text-destructive-300 m-0 text-sm\">\n {error}\n </p>\n {/* bg-background: the outline button is transparent, and its text on\n the destructive/10 tint sits exactly at the 4.5:1 AA boundary. */}\n <Button\n variant=\"outline\"\n size=\"sm\"\n className=\"bg-background\"\n onClick={handleRetry}\n >\n {labels?.retry ?? 'Retry'}\n </Button>\n </div>\n </div>\n );\n }\n\n return (\n <div className={mediaPlayerVariants({ variant, className })}>\n {resolvedKind === 'video' ? (\n // The controls cover the player's box, so the video fills it at its\n // own shape and the bar spans the box. The box is a dark surface in\n // every theme (black letterboxing, as on VideoCard), so library\n // controls inside it take their dark-theme colours. With the\n // browser's controls the box is `contents`, leaving the video laid\n // out as before; it stays in the tree either way, so changing\n // `controlsStyle` keeps the same video, its time and playback.\n <div\n ref={boxRef}\n data-slot={overlay ? 'media-player-box' : undefined}\n data-theme={overlay ? 'dark' : undefined}\n className={overlay ? 'relative h-full w-full bg-black' : 'contents'}\n >\n {video}\n {overlay && controls && (\n <MediaControls\n transport={transport}\n fullscreenTarget={boxRef}\n labels={labels}\n playbackRates={playbackRates}\n />\n )}\n </div>\n ) : (\n // eslint-disable-next-line jsx-a11y/media-has-caption\n <audio\n ref={setElement as React.Ref<HTMLAudioElement>}\n className=\"my-4 w-[90%] max-w-lg\"\n {...sharedMediaProps}\n >\n {children}\n </audio>\n )}\n </div>\n );\n }\n);\n\nMediaPlayer.displayName = 'MediaPlayer';\n\nexport { mediaPlayerVariants };\n"]}
1
+ {"version":3,"sources":["../src/components/MediaPlayer/overlayButton.ts","../src/components/MediaPlayer/pictureInPicture.ts","../src/components/MediaPlayer/MediaControls.tsx","../src/components/MediaPlayer/MediaPlayer.tsx"],"names":["MediaControls","className","React2","jsx","jsxs"],"mappings":";;;;;;;;;;;AAUO,IAAM,kBAAA,GAAqB;AAAA,EAChC,sDAAA;AAAA,EACA,uDAAA;AAAA,EACA,gEAAA;AAAA,EACA,sDAAA;AAAA,EACA;AACF,CAAA,CAAE,KAAK,GAAG;AAGH,IAAM,cAAA,GACX;AAEK,IAAM,kBAAA,GAAqB;;;ACT3B,IAAM,UAAA,GAAgC;AAAA,EAC3C,uBAAA;AAAA,EACA,uBAAA;AAAA,EACA;AACF;AAMA,IAAM,mBAAA,GAAsB,GAAA;AAGrB,SAAS,qBACd,KAAA,EACS;AACT,EAAA,IAAI,CAAC,KAAA,IAAS,OAAO,QAAA,KAAa,aAAa,OAAO,KAAA;AACtD,EAAA,OACE,QAAA,CAAS,uBAAA,KAA4B,KAAA,IACpC,KAAA,CAAsB,sBAAA,KAA2B,oBAAA;AAEtD;AAMO,SAAS,qBACd,KAAA,EACe;AACf,EAAA,IAAI,CAAC,SAAS,CAAC,oBAAA,CAAqB,KAAK,CAAA,EAAG,OAAO,QAAQ,OAAA,EAAQ;AACnE,EAAA,IAAI,SAAS,uBAAA,KAA4B,KAAA;AACvC,IAAA,OAAO,QAAA,CAAS,oBAAA,EAAqB,CAAE,KAAA,CAAM,MAAM;AAAA,IAAC,CAAC,CAAA;AACvD,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,OAAA,KAAY;AAE9B,IAAA,MAAM,OAAO,MAAM;AACjB,MAAA,YAAA,CAAa,KAAK,CAAA;AAClB,MAAA,KAAA,CAAM,mBAAA,CAAoB,iCAAiC,IAAI,CAAA;AAC/D,MAAA,OAAA,EAAQ;AAAA,IACV,CAAA;AACA,IAAA,MAAM,KAAA,GAAQ,UAAA,CAAW,IAAA,EAAM,mBAAmB,CAAA;AACl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YAAA,KAAiB,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAQhBC,IAAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,GAAA,EAAK,MAAA;AAAA,UACL,WAAA,EAAW,UAAU,kBAAA,GAAqB,MAAA;AAAA,UAC1C,YAAA,EAAY,UAAU,MAAA,GAAS,MAAA;AAAA,UAC/B,SAAA,EAAW,UAAU,iCAAA,GAAoC,UAAA;AAAA,UAExD,QAAA,EAAA;AAAA,YAAA,KAAA;AAAA,YACA,OAAA,IAAW,4BACVD,GAAAA;AAAA,cAAC,aAAA;AAAA,cAAA;AAAA,gBACC,SAAA;AAAA,gBACA,gBAAA,EAAkB,MAAA;AAAA,gBAClB,MAAA;AAAA,gBACA;AAAA;AAAA;AACF;AAAA;AAAA;AAEJ;AAAA;AAAA,sBAGAA,GAAAA;AAAA,QAAC,OAAA;AAAA,QAAA;AAAA,UACC,GAAA,EAAK,UAAA;AAAA,UACL,SAAA,EAAU,uBAAA;AAAA,UACT,GAAG,gBAAA;AAAA,UAEH;AAAA;AAAA;AACH,KAAA,EAEJ,CAAA;AAAA,EAEJ;AACF;AAEA,WAAA,CAAY,WAAA,GAAc,aAAA","file":"chunk-IGUDEWIW.js","sourcesContent":["// Internal to the media components; not part of the public API.\n\n/**\n * The round, translucent icon button over a video (the feed's Previous/Next,\n * its inactive item's Play). Pass it to `<Button variant=\"ghost\" size=\"icon\">`;\n * it sets the `dark:` colours too, because these buttons sit inside a\n * `data-theme=\"dark\"` surface. Add `bg-transparent` where the button sits on a\n * scrim already, as the player's bar does. The scrim is black on purpose: it\n * has to read over any frame of the video.\n */\nexport const overlayButtonClass = [\n 'rounded-full bg-black/45 text-white backdrop-blur-sm',\n 'hover:bg-black/65 hover:text-white active:bg-black/75',\n 'dark:text-white dark:hover:bg-black/65 dark:active:bg-black/75',\n 'focus-visible:ring-white focus-visible:ring-offset-0',\n 'pointer-fine:h-9 pointer-fine:w-9',\n].join(' ');\n\n/** The large round ▶ in the middle of a paused video, and its glyph. */\nexport const playBadgeClass =\n 'flex h-14 w-14 items-center justify-center rounded-full bg-black/60 text-white';\n// Optical centring; media glyphs don't flip in RTL.\nexport const playBadgeIconClass = 'h-6 w-6 translate-x-0.5 fill-current';\n","// Internal to the media components (MediaControls, MediaFeed); not part of\n// the public API.\n\n/** Safari's own full screen and picture in picture, beside the standard APIs. */\nexport type WebKitVideo = HTMLVideoElement & {\n webkitEnterFullscreen?: () => void;\n webkitSupportsFullscreen?: boolean;\n webkitSupportsPresentationMode?: (mode: string) => boolean;\n webkitSetPresentationMode?: (mode: string) => void;\n webkitPresentationMode?: string;\n};\n\n/** The events that say a video went into or out of picture in picture. */\nexport const PIP_EVENTS: readonly string[] = [\n 'enterpictureinpicture',\n 'leavepictureinpicture',\n 'webkitpresentationmodechanged',\n];\n\n/**\n * How long to wait for Safari to say a video left picture in picture before\n * carrying on: the event may never come.\n */\nconst PIP_EXIT_TIMEOUT_MS = 1000;\n\n/** Whether `video` is floating in picture in picture (either API). */\nexport function isInPictureInPicture(\n video: HTMLMediaElement | null | undefined\n): boolean {\n if (!video || typeof document === 'undefined') return false;\n return (\n document.pictureInPictureElement === video ||\n (video as WebKitVideo).webkitPresentationMode === 'picture-in-picture'\n );\n}\n\n/**\n * Bring `video` back from picture in picture (either API). Resolves once it is\n * back inline, or straight away when it wasn't floating.\n */\nexport function exitPictureInPicture(\n video: HTMLMediaElement | null | undefined\n): Promise<void> {\n if (!video || !isInPictureInPicture(video)) return Promise.resolve();\n if (document.pictureInPictureElement === video)\n return document.exitPictureInPicture().catch(() => {});\n return new Promise((resolve) => {\n // Whichever comes first, the event or the timeout, cleans up the other.\n const done = () => {\n clearTimeout(timer);\n video.removeEventListener('webkitpresentationmodechanged', done);\n resolve();\n };\n const timer = setTimeout(done, PIP_EXIT_TIMEOUT_MS);\n video.addEventListener('webkitpresentationmodechanged', done, {\n once: true,\n });\n (video as WebKitVideo).webkitSetPresentationMode?.('inline');\n });\n}\n\n/** Whether this browser can float `video` in picture in picture. */\nexport function canPictureInPicture(video: WebKitVideo | null): boolean {\n if (!video || typeof document === 'undefined') return false;\n if (video.disablePictureInPicture) return false;\n return (\n document.pictureInPictureEnabled ||\n !!video.webkitSupportsPresentationMode?.('picture-in-picture')\n );\n}\n","import * as React from 'react';\nimport {\n Captions,\n CaptionsOff,\n Maximize,\n Minimize,\n Pause,\n PictureInPicture2,\n Play,\n Volume2,\n VolumeX,\n} from 'lucide-react';\n\nimport { cn } from '../../utils/cn';\nimport type { UseMediaTransportReturn } from '../../hooks/useMediaTransport';\nimport { formatTime } from '../AudioPlayer/AudioPlayer';\nimport { Button } from '../Button';\nimport { Slider } from '../Slider';\nimport {\n overlayButtonClass,\n playBadgeClass,\n playBadgeIconClass,\n} from './overlayButton';\nimport {\n canPictureInPicture,\n exitPictureInPicture,\n isInPictureInPicture,\n PIP_EVENTS,\n type WebKitVideo,\n} from './pictureInPicture';\n\n/** Every string the controls show or announce, for the host to localize. */\nexport interface MediaControlsLabels {\n play: string;\n pause: string;\n mute: string;\n unmute: string;\n seek: string;\n fullscreen: string;\n exitFullscreen: string;\n pictureInPicture: string;\n exitPictureInPicture: string;\n /** The elapsed and total time, already formatted (`1:05`, `4:30`). */\n time: (current: string, duration: string) => string;\n /** The speed button's text for a rate (`1.5×`). */\n rate: (rate: number) => string;\n /** The speed button's accessible name, given its text. */\n speed: (rate: string) => string;\n showCaptions: string;\n hideCaptions: string;\n}\n\n/** The English defaults; MediaFeed reuses them for its player labels. */\nexport const defaultMediaControlsLabels: MediaControlsLabels = {\n play: 'Play',\n pause: 'Pause',\n mute: 'Mute',\n unmute: 'Unmute',\n seek: 'Seek',\n fullscreen: 'Full screen',\n exitFullscreen: 'Exit full screen',\n pictureInPicture: 'Picture in picture',\n exitPictureInPicture: 'Exit picture in picture',\n time: (current, duration) => `${current} / ${duration}`,\n rate: (rate) => `${rate}×`,\n speed: (rate) => `Playback speed ${rate}`,\n showCaptions: 'Show captions',\n hideCaptions: 'Hide captions',\n};\n\nexport interface MediaControlsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The transport attached to the `<video>` these controls drive. */\n transport: UseMediaTransportReturn;\n /**\n * The box that goes full screen with the controls (the video and these\n * controls' shared parent). Where the browser can't take an element full\n * screen (an iPhone), the video opens in the system's own player instead.\n */\n fullscreenTarget?: React.RefObject<HTMLElement | null>;\n /** Localized text for every control; English by default. */\n labels?: Partial<MediaControlsLabels>;\n /** The speeds the speed button cycles through (default `[1, 1.5, 2]`). */\n playbackRates?: readonly number[];\n}\n\nconst defaultPlaybackRates = [1, 1.5, 2] as const;\n\n/** Controls a small player (under 20rem wide) leaves out: speed and picture in picture. */\nconst SMALL_PLAYER_HIDDEN = '@max-xs:hidden';\n\n/** Where a tap or drag on the seek bar lands: to the tenth of a second. */\nconst SEEK_STEP_MS = 100;\n\n/**\n * How far an arrow key seeks, as a share of the clip (2%): a few presses cross\n * a short clip, and a long one isn't hundreds of presses long.\n */\nconst KEYBOARD_SEEK_FRACTION = 0.02;\n\n/**\n * Browsers size caption text at about 5% of the video's height, and step a\n * cue's `line` by its line box, so this approximates one line's height.\n */\nconst CUE_LINE_HEIGHT_FRACTION = 0.05;\n\n/** The line a cue is lifted to before the video has a size to measure. */\nconst DEFAULT_CUE_LINE = -4;\n\nconst formatMs = (ms: number) => formatTime(ms / 1000);\n\n/**\n * The cue line just above the bar's controls. Lines count up from -1 (the\n * bottom one), so a cue on line -(n + 1) clears n lines. The bar's top padding\n * is the transparent start of its scrim, which captions may cover.\n */\nfunction cueLineAboveBar(\n video: HTMLVideoElement,\n bar: HTMLElement | null\n): number {\n const lineHeight =\n video.getBoundingClientRect().height * CUE_LINE_HEIGHT_FRACTION;\n if (!bar || lineHeight <= 0) return DEFAULT_CUE_LINE;\n const controls =\n bar.getBoundingClientRect().height -\n (parseFloat(getComputedStyle(bar).paddingTop) || 0);\n return -(Math.ceil(Math.max(controls, 0) / lineHeight) + 1);\n}\n\n/** Whether `video` is in picture in picture, following every change. */\nfunction useInPictureInPicture(video: HTMLVideoElement | null): boolean {\n const [inPip, setInPip] = React.useState(false);\n React.useEffect(() => {\n if (!video) return;\n const update = () => setInPip(isInPictureInPicture(video));\n update();\n for (const event of PIP_EVENTS) video.addEventListener(event, update);\n return () => {\n for (const event of PIP_EVENTS) video.removeEventListener(event, update);\n };\n }, [video]);\n return inPip;\n}\n\n/**\n * The video's caption and subtitle tracks, and whether one is showing,\n * following tracks the host adds, removes or switches itself.\n */\nfunction useCaptionTracks(\n video: HTMLVideoElement | null,\n barRef: React.RefObject<HTMLElement | null>\n) {\n const [tracks, setTracks] = React.useState<globalThis.TextTrack[]>([]);\n const [showing, setShowing] = React.useState(false);\n React.useEffect(() => {\n const list = video?.textTracks;\n if (!list) {\n setTracks([]);\n setShowing(false);\n return;\n }\n // Browsers draw cues at the very bottom, under the bar: lift any cue the\n // host left on the default line to just above it. A fixed line count\n // isn't enough, since lines scale with the video and the bar doesn't (it\n // takes two rows in a small card). Cues load lazily, and the player can\n // change size, so this runs again as cues become active and as the video\n // or bar is resized. `lifted` keeps\n // the line each cue was lifted to: a cue still on it is ours to move, and\n // goes back to the default line when these controls unmount (the video\n // may stay, with no bar to clear). One the host has moved since is theirs.\n const lifted = new Map<globalThis.VTTCue, number>();\n const place = (\n track: globalThis.TextTrack | null,\n cue: globalThis.VTTCue,\n line: number | 'auto'\n ) => {\n cue.line = line;\n // A cue already on screen keeps its old place until it's re-added.\n if (track && Array.from(track.activeCues ?? []).includes(cue)) {\n track.removeCue(cue);\n track.addCue(cue);\n }\n };\n const liftCues = (track: globalThis.TextTrack) => {\n const line = video\n ? cueLineAboveBar(video, barRef.current)\n : DEFAULT_CUE_LINE;\n for (const each of Array.from(track.cues ?? [])) {\n if (!('line' in each)) continue;\n const cue = each as globalThis.VTTCue;\n if (cue.line !== 'auto' && lifted.get(cue) !== cue.line) continue;\n if (cue.line === line) continue;\n lifted.set(cue, line);\n place(track, cue, line);\n }\n };\n const lift = (event: Event) =>\n liftCues(event.target as globalThis.TextTrack);\n let watched: globalThis.TextTrack[] = [];\n const update = () => {\n const captions = Array.from(list).filter(\n (track) => track.kind === 'captions' || track.kind === 'subtitles'\n );\n for (const track of watched)\n track.removeEventListener?.('cuechange', lift);\n for (const track of captions) track.addEventListener?.('cuechange', lift);\n watched = captions;\n setTracks(captions);\n setShowing(captions.some((track) => track.mode === 'showing'));\n };\n update();\n const events = ['addtrack', 'removetrack', 'change'];\n for (const name of events) list.addEventListener?.(name, update);\n // A new size (a phone turned, full screen left) needs a new line but\n // brings no cuechange, so the cues move then too, paused or playing.\n const resize =\n typeof ResizeObserver === 'undefined'\n ? null\n : new ResizeObserver(() => watched.forEach(liftCues));\n for (const element of [video, barRef.current])\n if (element) resize?.observe(element);\n return () => {\n resize?.disconnect();\n for (const name of events) list.removeEventListener?.(name, update);\n for (const track of watched)\n track.removeEventListener?.('cuechange', lift);\n for (const [cue, line] of lifted)\n if (cue.line === line) place(cue.track, cue, 'auto');\n };\n }, [video, barRef]);\n return { tracks, showing };\n}\n\n/** Whether `element`'s audio is muted, following every change to it. */\nfunction useMuted(element: HTMLMediaElement | null): boolean {\n const [muted, setMuted] = React.useState(element?.muted ?? false);\n React.useEffect(() => {\n if (!element) return;\n const update = () => setMuted(element.muted);\n update();\n element.addEventListener('volumechange', update);\n return () => element.removeEventListener('volumechange', update);\n }, [element]);\n return muted;\n}\n\n/** Whether `target` is the page's full-screen element. */\nfunction useIsFullscreen(\n target: React.RefObject<HTMLElement | null> | undefined\n): boolean {\n const [fullscreen, setFullscreen] = React.useState(false);\n React.useEffect(() => {\n if (typeof document === 'undefined') return;\n const update = () =>\n setFullscreen(\n !!target?.current && document.fullscreenElement === target.current\n );\n // Controls that mount while their box is already full screen say so.\n update();\n document.addEventListener('fullscreenchange', update);\n return () => document.removeEventListener('fullscreenchange', update);\n }, [target]);\n return fullscreen;\n}\n\n/**\n * Touch-first controls laid over a `<video>`, in place of the browser's own.\n * A tap on the picture plays or pauses it, a round ▶ shows while it's paused,\n * and a bar along the bottom has play/pause, the time, a seek bar, playback\n * speed, captions on/off when the video has a caption track, mute, and\n * picture in picture and full screen where the browser supports them.\n *\n * `MediaPlayer` renders it for `controlsStyle=\"overlay\"`. To use it directly,\n * render it in a positioned box with the video, attach\n * `transport.setMediaElement` to the video's `ref` and give the video\n * `playsInline` (without it, an iPhone plays it in the system player, away\n * from these controls).\n */\nexport const MediaControls = React.forwardRef<\n HTMLDivElement,\n MediaControlsProps\n>(function MediaControls(\n {\n transport,\n fullscreenTarget,\n labels: labelOverrides,\n playbackRates = defaultPlaybackRates,\n className,\n ...rest\n },\n ref\n) {\n const labels = { ...defaultMediaControlsLabels, ...labelOverrides };\n const video = transport.mediaElement as WebKitVideo | null;\n const muted = useMuted(video);\n const isFullscreen = useIsFullscreen(fullscreenTarget);\n const inPip = useInPictureInPicture(video);\n const barRef = React.useRef<HTMLDivElement>(null);\n const captions = useCaptionTracks(video, barRef);\n // What this browser can do is read once mounted: the server can't know it,\n // and markup that differs from the server's breaks hydration. Safari only\n // says a video can float once its metadata is in, so read again then (and\n // on each new source).\n const [support, setSupport] = React.useState({ box: false, pip: false });\n React.useEffect(() => {\n const read = () =>\n setSupport({\n box: document.fullscreenEnabled && !!fullscreenTarget,\n pip: canPictureInPicture(video),\n });\n read();\n video?.addEventListener('loadedmetadata', read);\n return () => video?.removeEventListener('loadedmetadata', read);\n }, [video, fullscreenTarget]);\n const playing = transport.isPlaying;\n const durationMs = transport.durationMs;\n\n const togglePlay = transport.togglePlay;\n const toggleMuted = () => {\n if (video) video.muted = !video.muted;\n };\n // The iPhone fallback only where it works: Chromium has the method too, but\n // it does nothing in a frame that isn't allowed full screen.\n const canFullscreen =\n support.box ||\n (!!video?.webkitEnterFullscreen && !!video.webkitSupportsFullscreen);\n // Leaves only a full screen these controls entered: a page that is full\n // screen itself (a kiosk, a presentation) stays that way.\n const toggleFullscreen = () => {\n if (isFullscreen) {\n void document.exitFullscreen?.()?.catch(() => {});\n } else if (support.box && fullscreenTarget?.current) {\n void fullscreenTarget.current.requestFullscreen?.()?.catch(() => {});\n } else {\n video?.webkitEnterFullscreen?.();\n }\n };\n // Each press moves to the next speed, and from the last back to the first.\n const rate = transport.playbackRate;\n const cycleSpeed = () => {\n const index = playbackRates.indexOf(rate);\n transport.setPlaybackRate(\n playbackRates[(index + 1) % playbackRates.length] ?? 1\n );\n };\n // Shows the first caption track, or hides whichever is showing.\n const toggleCaptions = () => {\n const [first] = captions.tracks;\n for (const track of captions.tracks)\n track.mode =\n !captions.showing && track === first ? 'showing' : 'disabled';\n };\n // The standard API, else Safari's presentation mode on an iPhone.\n const togglePictureInPicture = () => {\n if (!video) return;\n if (isInPictureInPicture(video)) {\n void exitPictureInPicture(video);\n } else if (document.pictureInPictureEnabled) {\n void video.requestPictureInPicture().catch(() => {});\n } else {\n video.webkitSetPresentationMode?.('picture-in-picture');\n }\n };\n\n const barButton = (\n label: string,\n onClick: () => void,\n icon: React.ReactElement,\n className?: string\n ) => (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={label}\n title={label}\n onClick={onClick}\n className={cn(overlayButtonClass, 'shrink-0 bg-transparent', className)}\n >\n {icon}\n </Button>\n );\n\n return (\n <div\n ref={ref}\n data-slot=\"media-controls\"\n className={cn(\n // A container query: a narrow player (a portrait clip) gives the seek\n // bar a row of its own, so it's always long enough to drag.\n '@container pointer-events-none absolute inset-0 flex flex-col justify-end',\n className\n )}\n {...rest}\n >\n {/* A pointer convenience over the picture, as in every video app. The\n bar's Play is the keyboard and screen-reader control. */}\n <div\n data-slot=\"media-controls-surface\"\n aria-hidden=\"true\"\n className=\"pointer-events-auto absolute inset-0 flex cursor-pointer items-center justify-center\"\n onClick={togglePlay}\n >\n {!playing && (\n <span className={playBadgeClass}>\n <Play className={playBadgeIconClass} />\n </span>\n )}\n </div>\n {/* Left to right in every language: a media timeline follows the\n media, not the reading direction (Material: don't mirror playback\n controls or their progress bar). Labels keep their own direction. */}\n <div\n ref={barRef}\n data-slot=\"media-controls-bar\"\n dir=\"ltr\"\n // A small player (a card in a chat, under 20rem wide) keeps play,\n // time, seek, mute and full screen on two short rows and leaves speed\n // and picture in picture to the larger view, as in-chat players do;\n // its gradient starts lower so the picture stays visible.\n className=\"pointer-events-auto relative flex flex-wrap items-center gap-x-1 bg-gradient-to-t from-black/75 via-black/40 to-transparent px-1 pt-6 pb-1 text-white sm:px-2 @max-xs:pt-2\"\n >\n {barButton(\n playing ? labels.pause : labels.play,\n togglePlay,\n playing ? (\n <Pause className=\"h-5 w-5 fill-current\" aria-hidden=\"true\" />\n ) : (\n <Play className=\"h-5 w-5 fill-current\" aria-hidden=\"true\" />\n )\n )}\n <span\n data-slot=\"media-controls-time\"\n className=\"shrink-0 px-1 text-xs whitespace-nowrap tabular-nums @max-md:me-auto\"\n >\n {/* The label may be RTL text (\"0:01 من 0:04\"): isolate its\n direction without turning the bar's layout around. */}\n <bdi>\n {labels.time(\n formatMs(transport.currentTimeMs),\n formatMs(durationMs)\n )}\n </bdi>\n </span>\n <Slider\n // Taller to grab on a touch screen; the track itself stays thin.\n className=\"mx-1 min-w-0 flex-1 @max-md:order-first @max-md:mx-2 @max-md:basis-full pointer-coarse:[&_[data-slot=slider-track-wrapper]]:py-4\"\n // dark: too, or the dark surface's own track colour wins.\n trackClassName=\"bg-white/30 dark:bg-white/30\"\n size=\"sm\"\n min={0}\n max={durationMs > 0 ? durationMs : 1}\n step={SEEK_STEP_MS}\n keyboardStep={Math.max(\n SEEK_STEP_MS,\n Math.round(durationMs * KEYBOARD_SEEK_FRACTION)\n )}\n value={transport.currentTimeMs}\n onValueChange={transport.seekToMs}\n formatValue={formatMs}\n disabled={durationMs <= 0}\n aria-label={labels.seek}\n />\n {playbackRates.length > 1 &&\n barButton(\n labels.speed(labels.rate(rate)),\n cycleSpeed,\n <span className=\"text-xs font-semibold tabular-nums\">\n {labels.rate(rate)}\n </span>,\n SMALL_PLAYER_HIDDEN\n )}\n {/* The label says what a press does, so it carries the state: no\n aria-pressed as well, or it would read \"Hide captions, pressed\". */}\n {captions.tracks.length > 0 &&\n barButton(\n captions.showing ? labels.hideCaptions : labels.showCaptions,\n toggleCaptions,\n // The icon shows the state, as mute's does.\n captions.showing ? (\n <Captions className=\"h-5 w-5\" aria-hidden=\"true\" />\n ) : (\n <CaptionsOff className=\"h-5 w-5\" aria-hidden=\"true\" />\n )\n )}\n {barButton(\n muted ? labels.unmute : labels.mute,\n toggleMuted,\n muted ? (\n <VolumeX className=\"h-5 w-5\" aria-hidden=\"true\" />\n ) : (\n <Volume2 className=\"h-5 w-5\" aria-hidden=\"true\" />\n )\n )}\n {support.pip &&\n barButton(\n inPip ? labels.exitPictureInPicture : labels.pictureInPicture,\n togglePictureInPicture,\n <PictureInPicture2 className=\"h-5 w-5\" aria-hidden=\"true\" />,\n SMALL_PLAYER_HIDDEN\n )}\n {canFullscreen &&\n barButton(\n isFullscreen ? labels.exitFullscreen : labels.fullscreen,\n toggleFullscreen,\n isFullscreen ? (\n <Minimize className=\"h-5 w-5\" aria-hidden=\"true\" />\n ) : (\n <Maximize className=\"h-5 w-5\" aria-hidden=\"true\" />\n )\n )}\n </div>\n </div>\n );\n});\n","import * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { Button } from '../Button';\nimport { useMediaTransport } from '../../hooks/useMediaTransport';\nimport { MediaControls, type MediaControlsLabels } from './MediaControls';\n\n// ============================================================================\n// Types & Interfaces\n// ============================================================================\n\nexport type MediaPlayerState =\n | 'idle'\n | 'loading'\n | 'playing'\n | 'paused'\n | 'error';\n\nexport type MediaKind = 'video' | 'audio';\n\n/** Ref handle for controlling {@link MediaPlayer} programmatically. */\nexport interface MediaPlayerRef {\n /** Seek to a specific time in milliseconds. */\n seekToMs: (timeMs: number) => void;\n /** Start playback. */\n play: () => void;\n /** Pause playback. */\n pause: () => void;\n /** Get current playback time in milliseconds. */\n getCurrentTimeMs: () => number;\n /** Get total duration in milliseconds. */\n getDurationMs: () => number;\n /** Whether playback is currently paused. */\n isPaused: () => boolean;\n /** Set playback speed multiplier. */\n setPlaybackRate: (rate: number) => void;\n /**\n * The underlying media element.\n * Escape hatch for host integrations (e.g. thumbnail capture); prefer the\n * typed methods above for playback control.\n */\n mediaElement: HTMLVideoElement | HTMLAudioElement | null;\n}\n\nexport interface MediaPlayerProps extends VariantProps<\n typeof mediaPlayerVariants\n> {\n /** Media source URL. */\n src: string;\n /** Force the media kind; when omitted it is inferred from the src extension. */\n kind?: MediaKind;\n /** Whether to show controls (default `true`). */\n controls?: boolean;\n /**\n * Which controls a video gets (default `'native'`, the browser's own).\n * `'overlay'` lays touch-first controls over it ({@link MediaControls}),\n * the same in every browser and in a mobile app's web view. Audio always uses\n * the browser's.\n */\n controlsStyle?: 'native' | 'overlay';\n /** Begin muted; the controls can still unmute it. */\n muted?: boolean;\n /** Repeat playback when the media ends. */\n loop?: boolean;\n /** Video thumbnail displayed before playback. */\n poster?: string;\n /** Browser preload hint (default browser behavior when omitted). */\n preload?: 'none' | 'metadata' | 'auto';\n /** Caption/subtitle `<track>` elements. The `src` attribute is always set\n * on the media element, so alternative `<source>` children are ignored. */\n children?: React.ReactNode;\n /** The speeds the overlay controls' speed button cycles through (default `[1, 1.5, 2]`). */\n playbackRates?: readonly number[];\n /** Localized load-error and retry text, and the overlay controls' labels. */\n labels?: { error?: string; retry?: string } & Partial<MediaControlsLabels>;\n /** Callback when playback state changes. */\n onStateChange?: (state: MediaPlayerState) => void;\n /** Callback when playback ends. */\n onEnded?: () => void;\n /** Callback when an error occurs. */\n onError?: (error: Error) => void;\n /** Callback after the user requests a fresh media load on the error surface. */\n onRetry?: () => void;\n /** Callback on time updates (milliseconds). */\n onTimeUpdate?: (currentTimeMs: number, durationMs: number) => void;\n /** Additional class name. */\n className?: string;\n /** Accessible label for the media element. */\n 'aria-label'?: string;\n /**\n * Transitional: exposes the raw media element to legacy consumers.\n * Prefer {@link MediaPlayerRef} for playback control.\n */\n mediaElementRef?: React.RefObject<HTMLVideoElement | HTMLAudioElement | null>;\n}\n\n// ============================================================================\n// Variants\n// ============================================================================\n\nconst mediaPlayerVariants = cva(\n 'flex h-full w-full items-center justify-center',\n {\n variants: {\n variant: {\n plain: '',\n card: 'rounded-xl border border-border bg-card text-card-foreground p-2',\n },\n },\n defaultVariants: {\n variant: 'plain',\n },\n }\n);\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\nconst VIDEO_EXTENSIONS = /\\.(mp4|mov|avi|webm|mkv|m4v)$/i;\n\n/** Infer media kind from a URL's file extension; defaults to audio. */\nexport function inferMediaKind(src: string): MediaKind {\n // Strip any query string / fragment before matching. Testing the extension\n // against the full URL required a trailing `.*`, which backtracks\n // polynomially on crafted inputs (ReDoS); splitting first is linear.\n const path = src.split(/[?#]/, 1)[0];\n return VIDEO_EXTENSIONS.test(path) ? 'video' : 'audio';\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * Media playback surface for audio and video with a shared imperative handle.\n *\n * Renders a native `<video>` or `<audio>` element (kind inferred from the src\n * extension unless forced) with themed error/retry handling. Playback state and\n * controls come from the shared {@link useMediaTransport} hook and are exposed\n * through {@link MediaPlayerRef} (all times in milliseconds) — consumers should\n * not reach into the DOM element directly.\n */\nexport const MediaPlayer = React.forwardRef<MediaPlayerRef, MediaPlayerProps>(\n (\n {\n src,\n kind,\n controls = true,\n controlsStyle = 'native',\n muted,\n loop,\n poster,\n preload,\n children,\n playbackRates,\n labels,\n variant,\n onStateChange,\n onEnded,\n onError,\n onRetry,\n onTimeUpdate,\n className,\n 'aria-label': ariaLabel,\n mediaElementRef,\n },\n ref\n ) => {\n const [error, setError] = React.useState<string | null>(null);\n\n // A failed load must not outlive its src: clearing on change lets a host\n // swap in a corrected URL without being trapped on the error surface\n // (which unmounts the media element, so the new src would never load).\n React.useEffect(() => {\n setError(null);\n }, [src]);\n const resolvedKind = kind ?? inferMediaKind(src);\n\n const transport = useMediaTransport({\n onTimeUpdate,\n onStateChange,\n onEnded,\n onError: (err) => {\n setError(\n labels?.error ??\n 'Unable to load media. The server may be unavailable.'\n );\n onError?.(err);\n },\n endedState: 'paused',\n errorLabel: `media: ${src}`,\n });\n\n const { setMediaElement, mediaElement } = transport;\n\n const setElement = React.useCallback(\n (el: HTMLVideoElement | HTMLAudioElement | null) => {\n setMediaElement(el);\n if (mediaElementRef) {\n (mediaElementRef as React.MutableRefObject<typeof el>).current = el;\n }\n },\n [setMediaElement, mediaElementRef]\n );\n\n React.useImperativeHandle(\n ref,\n (): MediaPlayerRef => ({\n seekToMs: transport.seekToMs,\n play: transport.play,\n pause: transport.pause,\n getCurrentTimeMs: transport.getCurrentTimeMs,\n getDurationMs: transport.getDurationMs,\n isPaused: transport.isPaused,\n setPlaybackRate: transport.setPlaybackRate,\n get mediaElement() {\n return mediaElement;\n },\n }),\n [transport, mediaElement]\n );\n\n const handleRetry = React.useCallback(() => {\n setError(null);\n mediaElement?.load();\n onRetry?.();\n }, [mediaElement, onRetry]);\n\n const overlay = controlsStyle === 'overlay' && resolvedKind === 'video';\n const boxRef = React.useRef<HTMLDivElement>(null);\n const sharedMediaProps = {\n src,\n controls: controls && !overlay,\n muted,\n loop,\n preload,\n 'aria-label': ariaLabel,\n };\n\n // Tracks belong to the caller's media resource and can be supplied as\n // children. The feed also supports a custom renderer for captions.\n const video = (\n // eslint-disable-next-line jsx-a11y/media-has-caption\n <video\n ref={setElement as React.Ref<HTMLVideoElement>}\n playsInline\n poster={poster}\n className={\n overlay\n ? 'h-full w-full object-contain'\n : 'h-auto max-h-full w-auto max-w-full object-contain'\n }\n {...sharedMediaProps}\n >\n {children}\n </video>\n );\n\n if (error) {\n return (\n <div className={mediaPlayerVariants({ variant, className })}>\n <div\n role=\"alert\"\n className=\"border-destructive/30 bg-destructive/10 flex min-h-36 flex-col items-center justify-center gap-3 rounded-lg border p-8 text-center\"\n >\n {/* destructive-700/300 instead of the base token: #dc2626 on the\n destructive/10 tint is 4.14:1 — below WCAG AA (axe: color-contrast). */}\n <p className=\"text-destructive-700 dark:text-destructive-300 m-0 text-sm\">\n {error}\n </p>\n {/* bg-background: the outline button is transparent, and its text on\n the destructive/10 tint sits exactly at the 4.5:1 AA boundary. */}\n <Button\n variant=\"outline\"\n size=\"sm\"\n className=\"bg-background\"\n onClick={handleRetry}\n >\n {labels?.retry ?? 'Retry'}\n </Button>\n </div>\n </div>\n );\n }\n\n return (\n <div className={mediaPlayerVariants({ variant, className })}>\n {resolvedKind === 'video' ? (\n // The controls cover the player's box, so the video fills it at its\n // own shape and the bar spans the box. The box is a dark surface in\n // every theme (black letterboxing, as on VideoCard), so library\n // controls inside it take their dark-theme colours. With the\n // browser's controls the box is `contents`, leaving the video laid\n // out as before; it stays in the tree either way, so changing\n // `controlsStyle` keeps the same video, its time and playback.\n <div\n ref={boxRef}\n data-slot={overlay ? 'media-player-box' : undefined}\n data-theme={overlay ? 'dark' : undefined}\n className={overlay ? 'relative h-full w-full bg-black' : 'contents'}\n >\n {video}\n {overlay && controls && (\n <MediaControls\n transport={transport}\n fullscreenTarget={boxRef}\n labels={labels}\n playbackRates={playbackRates}\n />\n )}\n </div>\n ) : (\n // eslint-disable-next-line jsx-a11y/media-has-caption\n <audio\n ref={setElement as React.Ref<HTMLAudioElement>}\n className=\"my-4 w-[90%] max-w-lg\"\n {...sharedMediaProps}\n >\n {children}\n </audio>\n )}\n </div>\n );\n }\n);\n\nMediaPlayer.displayName = 'MediaPlayer';\n\nexport { mediaPlayerVariants };\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkHH7PWD5I_cjs = require('./chunk-HH7PWD5I.cjs');
3
+ var chunkHOE2U27V_cjs = require('./chunk-HOE2U27V.cjs');
4
4
  var chunkZ5S5JEJD_cjs = require('./chunk-Z5S5JEJD.cjs');
5
5
  var chunkS5RVSXDV_cjs = require('./chunk-S5RVSXDV.cjs');
6
6
  var React2 = require('react');
@@ -724,7 +724,7 @@ var RichTextarea = React2__namespace.forwardRef(
724
724
  onKeyDown: onKeyDown && ((event) => onKeyDown(retargetEvent(event))),
725
725
  onKeyUp: onKeyUp && ((event) => onKeyUp(retargetEvent(event))),
726
726
  children: /* @__PURE__ */ jsxRuntime.jsx(
727
- chunkHH7PWD5I_cjs.TextAreaRichKerebron,
727
+ chunkHOE2U27V_cjs.TextAreaRichKerebron,
728
728
  {
729
729
  value: state.html,
730
730
  onChange: handleHtmlChange,
@@ -832,5 +832,5 @@ exports.Textarea = Textarea;
832
832
  exports.htmlToPlain = htmlToPlain;
833
833
  exports.plainToHtml = plainToHtml;
834
834
  exports.textareaVariants = textareaVariants;
835
- //# sourceMappingURL=chunk-2KK4WZ7Y.cjs.map
836
- //# sourceMappingURL=chunk-2KK4WZ7Y.cjs.map
835
+ //# sourceMappingURL=chunk-IKHK4GTF.cjs.map
836
+ //# sourceMappingURL=chunk-IKHK4GTF.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/TextAreaPlain/TextAreaPlain.tsx","../src/components/Textarea/Textarea.tsx"],"names":["cva","React","jsx","RequiredMark","cn","jsxs","React2","TextAreaRichKerebron"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAM,gBAAA,GAAmBA,0BAAA;AAAA,EACvB;AAAA,IACE,kBAAA;AAAA,IACA,gCAAA;AAAA,IACA,+BAAA;AAAA,IACA,mCAAA;AAAA,IACA,gCAAA;AAAA,IACA,0EAAA;AAAA,IACA,iDAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,sBAAA;AAAA,QACJ,EAAA,EAAI,wBAAA;AAAA,QACJ,EAAA,EAAI;AAAA,OACN;AAAA,MACA,QAAA,EAAU;AAAA,QACR,IAAA,EAAM,2CAAA;AAAA,QACN,KAAA,EAAO;AAAA,OACT;AAAA,MACA,MAAA,EAAQ;AAAA,QACN,IAAA,EAAM,aAAA;AAAA,QACN,QAAA,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AAA,IAAa;AAAA,iBAC9C;AAAA,gBAEC,QAAA,EAAA;AAAA,kBAAA,cAAA;AAAA,kBACA,SAAA,IAAa,IAAI,SAAS,CAAA;AAAA;AAAA;AAAA;AAC7B;AAAA;AAAA;AAEJ,KAAA,EACF,CAAA;AAAA,EAEJ;AACF,CAAA;AAEA,YAAA,CAAa,WAAA,GAAc,cAAA;AAkB3B,IAAM,QAAA,GAAiBE,iBAAA,CAAA,UAAA;AAAA,EACrB,CAAC,EAAE,QAAA,GAAW,IAAA,EAAM,GAAG,KAAA,EAAM,EAAG,QAC9B,QAAA,mBACEJ,eAAC,YAAA,EAAA,EAAa,GAAA,EAAW,GAAG,KAAA,EAAO,CAAA,mBAEnCA,cAAAA,CAAC,aAAA,EAAA,EAAc,GAAA,EAAW,GAAG,KAAA,EAAO;AAE1C;AAEA,QAAA,CAAS,WAAA,GAAc,UAAA","file":"chunk-2KK4WZ7Y.cjs","sourcesContent":["import * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { RequiredMark, type RequiredMarkVariant } from '../Input';\n\nconst textareaVariants = cva(\n [\n 'w-full px-3 py-2',\n 'border border-input rounded-lg',\n 'bg-background text-foreground',\n 'placeholder:text-muted-foreground',\n 'transition-colors duration-200',\n 'focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n 'resize-y',\n ],\n {\n variants: {\n size: {\n sm: 'text-sm min-h-[60px]',\n md: 'text-base min-h-[80px]',\n lg: 'text-lg min-h-[100px]',\n },\n hasError: {\n true: 'border-destructive focus:ring-destructive',\n false: '',\n },\n resize: {\n none: 'resize-none',\n vertical: 'resize-y',\n horizontal: 'resize-x',\n both: 'resize',\n },\n labelVariant: {\n stacked: '',\n floating: 'peer placeholder:text-transparent',\n },\n autoResize: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n // Floating labels reserve top padding so entered text always starts\n // below the floated label, plus a little extra min-height.\n {\n labelVariant: 'floating',\n size: 'sm',\n className: 'pt-5 min-h-[76px]',\n },\n {\n labelVariant: 'floating',\n size: 'md',\n className: 'pt-6 min-h-[96px]',\n },\n {\n labelVariant: 'floating',\n size: 'lg',\n className: 'pt-7 min-h-[120px]',\n },\n // Auto-growing textareas start at the same visual height as a\n // single-line Input (h-8/h-10/h-12): min-height matches the Input\n // size token and the vertical padding is tuned so one line of text\n // plus padding plus borders lands exactly on that height.\n {\n autoResize: true,\n labelVariant: 'stacked',\n size: 'sm',\n className: 'min-h-8 py-[5px]',\n },\n {\n autoResize: true,\n labelVariant: 'stacked',\n size: 'md',\n className: 'min-h-10 py-[7px]',\n },\n {\n autoResize: true,\n labelVariant: 'stacked',\n size: 'lg',\n className: 'min-h-12 py-[9px]',\n },\n // Floating label + auto-grow: single line below the floated label.\n {\n autoResize: true,\n labelVariant: 'floating',\n size: 'sm',\n className: 'min-h-[50px]',\n },\n {\n autoResize: true,\n labelVariant: 'floating',\n size: 'md',\n className: 'min-h-[58px]',\n },\n {\n autoResize: true,\n labelVariant: 'floating',\n size: 'lg',\n className: 'min-h-[66px]',\n },\n ],\n defaultVariants: {\n size: 'md',\n hasError: false,\n resize: 'vertical',\n labelVariant: 'stacked',\n autoResize: true,\n },\n }\n);\n\nconst floatingLabelVariants = cva(\n [\n 'absolute start-3 pointer-events-none select-none',\n 'transition-all duration-200 ease-out',\n ],\n {\n variants: {\n size: {\n sm: [\n 'text-sm top-3',\n 'peer-focus:top-1 peer-[:not(:placeholder-shown)]:top-1 peer-autofill:top-1',\n 'peer-focus:text-[0.65rem] peer-[:not(:placeholder-shown)]:text-[0.65rem] peer-autofill:text-[0.65rem]',\n ],\n md: [\n 'text-base top-4',\n 'peer-focus:top-1.5 peer-[:not(:placeholder-shown)]:top-1.5 peer-autofill:top-1.5',\n 'peer-focus:text-xs peer-[:not(:placeholder-shown)]:text-xs peer-autofill:text-xs',\n ],\n lg: [\n 'text-lg top-5',\n 'peer-focus:top-2 peer-[:not(:placeholder-shown)]:top-2 peer-autofill:top-2',\n 'peer-focus:text-sm peer-[:not(:placeholder-shown)]:text-sm peer-autofill:text-sm',\n ],\n },\n hasError: {\n true: 'text-destructive',\n false: 'text-muted-foreground',\n },\n },\n defaultVariants: {\n size: 'md',\n hasError: false,\n },\n }\n);\n\nexport interface TextAreaPlainProps\n extends\n Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'>,\n Omit<VariantProps<typeof textareaVariants>, 'labelVariant'> {\n /** Label for the textarea */\n label?: string;\n /**\n * How the label is rendered.\n * - `stacked` (default): label above the textarea.\n * - `floating`: label rests inside the textarea like a placeholder and\n * floats to the top (staying inside it) when focused or filled.\n * Ignores `placeholder`; when `hideLabel` is set, falls back to a\n * visually-hidden stacked label.\n */\n labelVariant?: 'stacked' | 'floating';\n /** Whether the label should be visually hidden */\n hideLabel?: boolean;\n /** Error message to display */\n error?: string;\n /** Helper text to display */\n helperText?: string;\n /** Maximum character count */\n maxLength?: number;\n /** Show character count */\n showCount?: boolean;\n /**\n * Grow and shrink with content (default). The empty control matches a\n * single-line `Input`'s height; `rows` sets a taller growth floor, and\n * dragging the native resize handle sets a new floor the same way. Set\n * `false` for a classic fixed-height textarea.\n */\n autoResize?: boolean;\n /**\n * Color of the required asterisk.\n * - `default`: destructive (hard requirement).\n * - `warning`: warning color (soft requirement / recommended).\n */\n requiredVariant?: RequiredMarkVariant;\n}\n\n/**\n * A multi-line text input component with character count and auto-resize.\n *\n * @example\n * ```tsx\n * <TextAreaPlain label=\"Description\" placeholder=\"Enter a description...\" />\n * <TextAreaPlain\n * label=\"Bio\"\n * maxLength={280}\n * showCount\n * helperText=\"Tell us about yourself\"\n * />\n * ```\n */\nconst TextAreaPlain = React.forwardRef<HTMLTextAreaElement, TextAreaPlainProps>(\n (\n {\n className,\n size,\n hasError,\n resize,\n label,\n labelVariant = 'stacked',\n hideLabel,\n error,\n helperText,\n maxLength,\n showCount = false,\n autoResize = true,\n required = false,\n requiredVariant,\n id,\n rows,\n value,\n defaultValue,\n onChange,\n placeholder,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref\n ) => {\n const internalRef = React.useRef<HTMLTextAreaElement>(null);\n const [internalValue, setInternalValue] = React.useState(\n (defaultValue as string) || ''\n );\n\n const generatedId = React.useId();\n const textareaId = id || generatedId;\n const errorId = `${textareaId}-error`;\n const helperId = `${textareaId}-helper`;\n const countId = `${textareaId}-count`;\n\n // Combine refs\n React.useImperativeHandle(ref, () => internalRef.current!);\n\n // Get current value\n const currentValue = value !== undefined ? String(value) : internalValue;\n const characterCount = currentValue.length;\n\n // Auto-resize logic: collapse to natural height, then grow to fit\n // content. CSS min-height (single-line baseline) and rows (via\n // scrollHeight) act as floors; a consumer-configured initial height\n // (style/class) and dragging the native resize handle set a user floor;\n // a consumer max-height still caps the rendered height.\n const userFloorRef = React.useRef<number | null>(null);\n const expectedHeightRef = React.useRef<number | null>(null);\n const initialFloorCapturedRef = React.useRef(false);\n\n const adjustHeight = React.useCallback(() => {\n const textarea = internalRef.current;\n if (textarea && autoResize) {\n textarea.style.height = 'auto';\n const borders = textarea.offsetHeight - textarea.clientHeight;\n const next = Math.max(\n textarea.scrollHeight + borders,\n userFloorRef.current ?? 0\n );\n textarea.style.height = `${next}px`;\n // Record the actual rendered height (a CSS max-height may clamp the\n // value we set) so clamping is never mistaken for a manual drag.\n expectedHeightRef.current = textarea.offsetHeight || next;\n }\n }, [autoResize]);\n\n // Measures prefilled values on mount and controlled values on update.\n // On mount, a consumer-configured initial height (inline style or a\n // height class) that exceeds the content height becomes the growth\n // floor — auto-sizing must not collapse below a configured baseline.\n React.useEffect(() => {\n const textarea = internalRef.current;\n if (textarea && autoResize && !initialFloorCapturedRef.current) {\n initialFloorCapturedRef.current = true;\n const configured = textarea.offsetHeight;\n adjustHeight();\n if (configured - textarea.offsetHeight > 1) {\n userFloorRef.current = configured;\n textarea.style.height = `${configured}px`;\n expectedHeightRef.current = textarea.offsetHeight || configured;\n }\n return;\n }\n adjustHeight();\n }, [currentValue, adjustHeight, autoResize]);\n\n // Re-measure when the available width changes (wrapping changes), and\n // detect heights we didn't set ourselves — the user dragging the native\n // resize handle — adopting the dragged height as the new growth floor.\n // The drag check runs first so a diagonal resize (width + height in one\n // notification) keeps the dragged height through the re-measure.\n React.useEffect(() => {\n const textarea = internalRef.current;\n if (!autoResize || !textarea || typeof ResizeObserver === 'undefined') {\n return;\n }\n let lastWidth = textarea.offsetWidth;\n const observer = new ResizeObserver(() => {\n const expected = expectedHeightRef.current;\n const height = textarea.offsetHeight;\n if (expected !== null && Math.abs(height - expected) > 1) {\n userFloorRef.current = height;\n expectedHeightRef.current = height;\n }\n if (textarea.offsetWidth !== lastWidth) {\n lastWidth = textarea.offsetWidth;\n adjustHeight();\n }\n });\n observer.observe(textarea);\n return () => observer.disconnect();\n }, [autoResize, adjustHeight]);\n\n // Handle change\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (value === undefined) {\n setInternalValue(e.target.value);\n }\n onChange?.(e);\n adjustHeight();\n },\n [value, onChange, adjustHeight]\n );\n\n // Build aria-describedby\n const describedByIds = [\n error ? errorId : null,\n helperText && !error ? helperId : null,\n showCount ? countId : null,\n ariaDescribedBy,\n ]\n .filter(Boolean)\n .join(' ');\n\n const isFloating = labelVariant === 'floating' && !!label && !hideLabel;\n\n const requiredMark = required && <RequiredMark variant={requiredVariant} />;\n\n const textareaElement = (\n <textarea\n data-slot=\"textarea\"\n data-auto-resize={autoResize ? 'true' : undefined}\n ref={internalRef}\n id={textareaId}\n value={value}\n defaultValue={value === undefined ? defaultValue : undefined}\n onChange={handleChange}\n maxLength={maxLength}\n aria-invalid={hasError || !!error}\n aria-describedby={describedByIds || undefined}\n required={required}\n // Auto-grow starts at one visible line; an explicit rows raises the\n // floor (scrollHeight never reports less than the rows box).\n rows={autoResize ? (rows ?? 1) : rows}\n // A single-space placeholder keeps :placeholder-shown reliable so the\n // label can float via CSS alone.\n placeholder={isFloating ? ' ' : placeholder}\n className={cn(\n textareaVariants({\n size,\n hasError: hasError || !!error,\n resize,\n labelVariant: isFloating ? 'floating' : 'stacked',\n autoResize,\n }),\n className\n )}\n {...props}\n />\n );\n\n return (\n <div data-slot=\"textarea-wrapper\" className=\"flex flex-col gap-1.5\">\n {label && !isFloating && (\n <label\n data-slot=\"textarea-label\"\n htmlFor={textareaId}\n className={cn(\n 'text-foreground text-sm font-medium',\n hideLabel && 'sr-only'\n )}\n >\n {label}\n {requiredMark}\n </label>\n )}\n {isFloating ? (\n <div className=\"relative\">\n {textareaElement}\n <label\n data-slot=\"textarea-label\"\n htmlFor={textareaId}\n className={floatingLabelVariants({\n size,\n hasError: hasError || !!error,\n })}\n >\n {label}\n {requiredMark}\n </label>\n </div>\n ) : (\n textareaElement\n )}\n <div\n data-slot=\"textarea-footer\"\n className=\"flex items-center justify-between gap-2\"\n >\n <div className=\"flex-1\">\n {error && (\n <p\n id={errorId}\n data-slot=\"textarea-error\"\n className=\"text-destructive-700 dark:text-destructive-400 text-sm\"\n role=\"alert\"\n >\n {error}\n </p>\n )}\n {helperText && !error && (\n <p\n id={helperId}\n data-slot=\"textarea-helper\"\n className=\"text-muted-foreground text-sm\"\n >\n {helperText}\n </p>\n )}\n </div>\n {showCount && (\n <p\n id={countId}\n data-slot=\"textarea-count\"\n className={cn(\n 'text-muted-foreground shrink-0 text-xs',\n maxLength && characterCount >= maxLength && 'text-destructive'\n )}\n >\n {characterCount}\n {maxLength && `/${maxLength}`}\n </p>\n )}\n </div>\n </div>\n );\n }\n);\n\nTextAreaPlain.displayName = 'TextAreaPlain';\n\nexport { TextAreaPlain, textareaVariants };\n","import * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { RequiredMark } from '../Input';\nimport { TextAreaRichKerebron } from '../TextAreaRich/TextAreaRichKerebron';\nimport { TextAreaPlain } from '../TextAreaPlain';\nimport type { TextAreaPlainProps } from '../TextAreaPlain';\n\n/**\n * `Textarea` keeps `TextAreaPlain`'s prop surface so existing call sites\n * compile unchanged while rendering `TextAreaRich` underneath.\n */\nexport interface TextareaProps extends TextAreaPlainProps {\n /**\n * Set `false` to opt out of the rich surface: renders the native\n * `TextAreaPlain` instead — no block gutter menu, no formatting, no HTML —\n * and restores every native textarea behaviour (`maxLength` enforcement,\n * `resize`, `autoResize={false}`, floating labels).\n */\n richText?: boolean;\n}\n\n// --- plain text <-> HTML (lossless round-trip for plain text) --------------\n\nfunction escapeHtml(text: string): string {\n return text\n .replaceAll('&', '&amp;')\n .replaceAll('<', '&lt;')\n .replaceAll('>', '&gt;');\n}\n\n/**\n * Newline normalization applied to every incoming plain value: a native\n * textarea's API value never contains CR, so CRLF/CR collapse to LF before\n * any conversion. Without this, `'a\\r\\nb'` would leave a literal CR inside a\n * paragraph and gain a blank line on the next round-trip.\n */\nfunction normalizeNewlines(text: string): string {\n return text.replace(/\\r\\n?/g, '\\n');\n}\n\n/**\n * Converts plain text to the editor's HTML: each line becomes a paragraph,\n * empty lines become `<p><br></p>`. Newlines are normalized to LF first\n * (matching native textarea behaviour); after that,\n * `htmlToPlain(plainToHtml(text)) === text` for every string, so stored\n * plain values survive untouched.\n */\nexport function plainToHtml(text: string): string {\n if (!text) return '';\n return normalizeNewlines(text)\n .split('\\n')\n .map((line) => (line ? `<p>${escapeHtml(line)}</p>` : '<p><br></p>'))\n .join('');\n}\n\nconst BLOCK_TAGS = new Set([\n 'P',\n 'DIV',\n 'H1',\n 'H2',\n 'H3',\n 'H4',\n 'H5',\n 'H6',\n 'LI',\n 'UL',\n 'OL',\n 'BLOCKQUOTE',\n 'PRE',\n 'TABLE',\n 'CAPTION',\n 'THEAD',\n 'TBODY',\n 'TFOOT',\n 'TR',\n]);\n\n/** Table cells separate with tabs; their row supplies the newline. */\nconst CELL_TAGS = new Set(['TD', 'TH']);\n\n/**\n * Structural table tags never render text of their own — whitespace-only\n * text nodes directly under them are pretty-printing between cells/rows\n * (`<tr>\\n <td>`), not field content.\n */\nconst TABLE_STRUCTURE_TAGS = new Set([\n 'TABLE',\n 'THEAD',\n 'TBODY',\n 'TFOOT',\n 'TR',\n]);\n\n/** Tags whose text is invisible — contributing it would leak code as text. */\nconst IGNORED_TAGS = new Set(['SCRIPT', 'STYLE', 'TEMPLATE', 'NOSCRIPT']);\n\nfunction nodeListToText(nodes: Iterable<Node>): string {\n let out = '';\n // Cell separators are positional, not content-based: an empty cell still\n // owns a column, so `Drug | (blank) | Dose` must stay `Drug\\t\\tDose`.\n let afterCell = false;\n for (const node of nodes) {\n if (node.nodeType === Node.TEXT_NODE) {\n const text = node.textContent ?? '';\n const parentTag = node.parentElement?.tagName;\n // Indentation between structural table elements is markup\n // formatting, not content — whitespace inside cells still counts.\n if (!text.trim() && parentTag && TABLE_STRUCTURE_TAGS.has(parentTag)) {\n continue;\n }\n out += text;\n // Inter-cell whitespace from pretty-printed table markup does not\n // break the cell sequence.\n if (text.trim()) afterCell = false;\n continue;\n }\n if (node.nodeType !== Node.ELEMENT_NODE) continue;\n const el = node as Element;\n if (IGNORED_TAGS.has(el.tagName)) continue;\n if (el.tagName === 'BR') {\n afterCell = false;\n out += '\\n';\n continue;\n }\n if (CELL_TAGS.has(el.tagName)) {\n if (afterCell) out += '\\t';\n out += nodeListToText(el.childNodes);\n afterCell = true;\n continue;\n }\n afterCell = false;\n if (BLOCK_TAGS.has(el.tagName)) {\n // A block starts its own line — inline content before it\n // (`a<div>b</div>`) must not fuse with the block's first line.\n if (out && !out.endsWith('\\n')) out += '\\n';\n let inner = nodeListToText(el.childNodes);\n // A lone <br> inside a block is the \"empty paragraph\" convention,\n // not an extra line break.\n if (inner === '\\n') inner = '';\n out += inner;\n // A block ends its own line — but a nested block\n // (`<blockquote><p>a</p></blockquote>`) already supplied the\n // newline; adding another would fabricate a blank line.\n if (inner === '' || !inner.endsWith('\\n')) out += '\\n';\n continue;\n }\n out += nodeListToText(el.childNodes);\n }\n return out;\n}\n\n/** Extracts plain text from editor HTML: blocks and `<br>` become newlines. */\nexport function htmlToPlain(html: string): string {\n if (!html) return '';\n // A <template> is the spec's inert parser: untrusted markup (pasted HTML\n // reaches this extractor) cannot load resources or run handlers like\n // `<img onerror>` while being read — unlike a detached <div>, whose\n // subtree is still \"browsing-context connected\" enough to fetch.\n const root = document.createElement('template');\n root.innerHTML = html;\n const text = nodeListToText(root.content.childNodes);\n return text.endsWith('\\n') ? text.slice(0, -1) : text;\n}\n\n/**\n * Paste/drop insertion policy: clipboard HTML is flattened to escaped plain\n * paragraphs before it reaches the live editable, so clipboard styles, host\n * CSS classes and embedded content never become active inside a field whose\n * contract is plain text.\n */\nfunction sanitizePastedHtml(html: string): string {\n return plainToHtml(htmlToPlain(html));\n}\n\n// --- dev-only one-time warnings for dropped native behaviours ---------------\n\nconst warned = new Set<string>();\nfunction warnOnce(key: string, message: string): void {\n if (process.env.NODE_ENV !== 'production' && !warned.has(key)) {\n warned.add(key);\n console.warn(`[mieweb/ui Textarea] ${message}`);\n }\n}\n\n/**\n * The rich implementation behind `Textarea` (see its docs). Separate\n * component so the `richText={false}` branch never mounts these hooks.\n */\nconst RichTextarea = React.forwardRef<HTMLTextAreaElement, TextAreaPlainProps>(\n (\n {\n label,\n labelVariant = 'stacked',\n hideLabel,\n error,\n helperText,\n maxLength,\n showCount,\n autoResize = true,\n requiredVariant,\n size = 'md',\n hasError,\n resize,\n className,\n value,\n defaultValue,\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n onKeyUp,\n name,\n form,\n id,\n rows,\n required,\n readOnly,\n disabled,\n placeholder,\n 'aria-describedby': ariaDescribedBy,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n },\n ref\n ) => {\n // One-time upgrade notice: this surface replaced the native <textarea>\n // in 0.12.0 — reaches exactly the developers affected, in dev only.\n warnOnce(\n 'rich-upgrade',\n 'Since 0.12.0 Textarea renders a rich text surface (plain-text value ' +\n 'contract unchanged). Watch for: CSS \"textarea\" selectors, E2E ' +\n 'fill()/type(), and maxLength no longer blocking typing. Opt out per ' +\n 'field with richText={false} or use TextAreaPlain. See MIGRATION.md.'\n );\n if (labelVariant === 'floating') {\n warnOnce(\n 'floating',\n 'labelVariant=\"floating\" is not supported by the rich surface; ' +\n 'falling back to a stacked label. Use TextAreaPlain for floating labels.'\n );\n }\n if (autoResize === false) {\n warnOnce(\n 'autoResize',\n 'autoResize={false} is ignored; the rich surface always grows with ' +\n 'content. Use TextAreaPlain for a fixed-height textarea.'\n );\n }\n if (resize !== undefined) {\n warnOnce(\n 'resize',\n 'resize is ignored; the rich surface has no native resize handle. ' +\n 'Use TextAreaPlain for drag-resizing.'\n );\n }\n if (maxLength !== undefined) {\n warnOnce(\n 'maxLength',\n 'maxLength is not enforced while typing; the character count still ' +\n 'reflects it. Enforce limits in onChange or use TextAreaPlain.'\n );\n }\n\n const reactId = React.useId();\n const errorId = `${reactId}-error`;\n const helperId = `${reactId}-helper`;\n const countId = `${reactId}-count`;\n\n const controlledValue =\n value !== undefined ? normalizeNewlines(String(value)) : undefined;\n\n const [state, setState] = React.useState(() => {\n const plain =\n controlledValue ??\n (defaultValue !== undefined\n ? normalizeNewlines(String(defaultValue))\n : '');\n return { html: plainToHtml(plain), plain };\n });\n\n // Controlled resync: only when the parent hands us a value different from\n // the plain text we last reported — echoing our own value back (the usual\n // controlled round-trip) keeps the user's rich formatting intact.\n if (controlledValue !== undefined && controlledValue !== state.plain) {\n setState({ html: plainToHtml(controlledValue), plain: controlledValue });\n }\n\n const hiddenRef = React.useRef<HTMLTextAreaElement>(null);\n const editorWrapperRef = React.useRef<HTMLDivElement>(null);\n\n // Rejected edits need no DOM poking here: the Kerebron surface is\n // strictly controlled (it converges to `value` on every render — see\n // RichEditor's `strictValue`), so when a controlled parent refuses an\n // edit and the optimistic state above is reverted during the same\n // render, the editor reloads the committed HTML transaction-safely.\n\n // The ProseMirror surface mounts asynchronously, so a mount-time\n // `ref.current.focus()` (the autoFocus-era idiom) can run before\n // `[role=\"textbox\"]` exists. The request is retained and honored when\n // the editable appears — unless focus has moved on to another control\n // in the meantime, which must not have its focus stolen.\n const pendingFocusRef = React.useRef<MutationObserver | null>(null);\n React.useEffect(() => () => pendingFocusRef.current?.disconnect(), []);\n const focusEditor = React.useCallback(() => {\n const wrapper = editorWrapperRef.current;\n if (!wrapper) return;\n const editable = wrapper.querySelector<HTMLElement>('[role=\"textbox\"]');\n if (editable) {\n editable.focus();\n return;\n }\n pendingFocusRef.current?.disconnect();\n const observer = new MutationObserver(() => {\n const target = wrapper.querySelector<HTMLElement>('[role=\"textbox\"]');\n if (!target) return;\n observer.disconnect();\n pendingFocusRef.current = null;\n const active = document.activeElement;\n if (!active || active === document.body || wrapper.contains(active)) {\n target.focus();\n }\n });\n // `role=\"textbox\"` arrives as an ATTRIBUTE write in the adapter's\n // readiness effect, possibly after the node insertions — watch both.\n observer.observe(wrapper, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['role'],\n });\n pendingFocusRef.current = observer;\n }, []);\n\n // The forwarded ref is the hidden mirror <textarea> — `ref.current.value`\n // reads the current plain text — with focus/blur redirected to the editor.\n React.useImperativeHandle(ref, () => {\n const node = hiddenRef.current as HTMLTextAreaElement;\n node.focus = focusEditor;\n node.blur = () => {\n // A focus request may still be waiting for the editable to mount;\n // blur() must cancel it, or the editor grabs focus (and reopens the\n // mobile keyboard) as soon as it appears.\n pendingFocusRef.current?.disconnect();\n pendingFocusRef.current = null;\n const editable =\n editorWrapperRef.current?.querySelector<HTMLElement>(\n '[role=\"textbox\"]'\n );\n if (document.activeElement === editable) editable?.blur();\n };\n return node;\n }, [focusEditor]);\n\n // External-label bridge: existing call sites pair\n // `<Label htmlFor={id}>` with `<Textarea id={id}>`. The id now lands on a\n // contenteditable div, which `htmlFor` neither names nor focuses. Find\n // the external label, point `aria-labelledby` at it (restoring the\n // accessible name) and focus the editor when it is clicked.\n const [externalLabelId, setExternalLabelId] = React.useState<string>();\n React.useEffect(() => {\n if (!id) return;\n const externalLabel = document.querySelector<HTMLLabelElement>(\n `label[for=\"${globalThis.CSS.escape(id)}\"]`\n );\n if (!externalLabel) return;\n if (!externalLabel.id) externalLabel.id = `${reactId}-external-label`;\n setExternalLabelId(externalLabel.id);\n const handleClick = () => focusEditor();\n externalLabel.addEventListener('click', handleClick);\n return () => externalLabel.removeEventListener('click', handleClick);\n }, [id, reactId, focusEditor]);\n\n // Re-targets editor events at the mirror so legacy handlers keep reading\n // `event.target.value` as plain text, like they did on the native\n // textarea. The original event is the prototype — reads and propagation\n // state delegate to it — with only the targets overridden;\n // stopPropagation/preventDefault forward to the original so React's\n // dispatch loop (which checks the original) honours them.\n const retargetEvent = React.useCallback(\n <E extends React.SyntheticEvent>(event: E): E => {\n const node = hiddenRef.current;\n if (!node) return event;\n const retargeted = Object.create(event) as E;\n Object.defineProperties(retargeted, {\n target: { value: node, enumerable: true },\n currentTarget: { value: node, enumerable: true },\n stopPropagation: { value: () => event.stopPropagation() },\n preventDefault: { value: () => event.preventDefault() },\n });\n return retargeted;\n },\n []\n );\n\n type MirrorFocusEvent = React.FocusEvent<HTMLTextAreaElement>;\n type MirrorKeyboardEvent = React.KeyboardEvent<HTMLTextAreaElement>;\n\n // Focus boundary that includes the editor's own portals: the block\n // gutter menu mounts under `document.body` and moves focus to its first\n // item on open, so DOM containment alone would fire the host's blur\n // mid-format (a blur-to-save consumer would commit early). A portal is\n // ours when a trigger inside this wrapper `aria-controls` its menu.\n const focusStaysInside = (\n event: React.FocusEvent<HTMLDivElement>\n ): boolean => {\n const related = event.relatedTarget;\n if (!related) return false;\n if (event.currentTarget.contains(related)) return true;\n const menuId = related\n .closest('[data-slot=\"dropdown-menu\"]')\n ?.querySelector('[role=\"menu\"]')?.id;\n return (\n !!menuId &&\n !!event.currentTarget.querySelector(\n `[aria-controls=\"${globalThis.CSS.escape(menuId)}\"]`\n )\n );\n };\n\n const handleHtmlChange = (html: string) => {\n const plain = htmlToPlain(html);\n setState({ html, plain });\n const node = hiddenRef.current;\n if (onChange && node) {\n node.value = plain;\n const nativeEvent = new Event('change');\n onChange({\n target: node,\n currentTarget: node,\n type: 'change',\n bubbles: false,\n cancelable: false,\n defaultPrevented: false,\n eventPhase: 0,\n isTrusted: false,\n timeStamp: Date.now(),\n nativeEvent,\n preventDefault: () => {},\n stopPropagation: () => {},\n isDefaultPrevented: () => false,\n isPropagationStopped: () => false,\n persist: () => {},\n } as React.ChangeEvent<HTMLTextAreaElement>);\n }\n };\n\n const showError = !!error;\n const invalid = hasError || showError;\n const describedByIds =\n [\n showError ? errorId : null,\n helperText && !showError ? helperId : null,\n showCount ? countId : null,\n ariaDescribedBy,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n\n const characterCount = state.plain.length;\n\n // The editable's own metrics: `size` restyles the font, `rows` restores\n // the size-aware growth floor a native textarea got for free. Text\n // utilities cannot size the editable — unlayered package CSS\n // (kerebron.css's `[data-slot='textarea-rich'] .kb-editor` rule and\n // Kerebron's own base.css) outranks them on both font-size and\n // line-height — so the sm/lg metrics ride CSS variables that those\n // rules read. The defaults (16px/24px) are the md pair, keeping\n // `lineHeightPx` and the 40px rest-height match with Input honest.\n const lineHeightPx = size === 'sm' ? 20 : size === 'lg' ? 28 : 24;\n const sizeVars =\n size === 'sm'\n ? {\n '--textarea-rich-font-size': '0.875rem',\n '--textarea-rich-line-height': '1.25rem',\n }\n : size === 'lg'\n ? {\n '--textarea-rich-font-size': '1.125rem',\n '--textarea-rich-line-height': '1.75rem',\n }\n : null;\n const editorStyle =\n rows || sizeVars\n ? ({\n ...(rows\n ? // 7px block padding each side, matching the editable's py-[7px].\n { minHeight: `${rows * lineHeightPx + 14}px` }\n : null),\n ...sizeVars,\n } as React.CSSProperties)\n : undefined;\n\n return (\n <div data-slot=\"textarea-wrapper\" className=\"flex flex-col gap-1.5\">\n {label && (\n <label\n data-slot=\"textarea-label\"\n className={cn(\n 'text-foreground text-sm font-medium',\n hideLabel && 'sr-only'\n )}\n >\n {label}\n {required && <RequiredMark variant={requiredVariant} />}\n </label>\n )}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions --\n not interactive itself: delegates events bubbling from the\n contenteditable textbox inside, like a native field's wrapper */}\n <div\n ref={editorWrapperRef}\n className=\"w-full\"\n // Composed like native textarea events: blur/focus only fire when\n // focus actually leaves/enters the field (moves inside the editor\n // chrome — gutter menu, toolbar — don't count), and all events are\n // re-targeted at the mirror so `event.target.value` stays plain.\n onBlur={\n onBlur &&\n ((event: React.FocusEvent<HTMLDivElement>) => {\n if (focusStaysInside(event)) return;\n onBlur(retargetEvent(event) as unknown as MirrorFocusEvent);\n })\n }\n onFocus={\n onFocus &&\n ((event: React.FocusEvent<HTMLDivElement>) => {\n if (focusStaysInside(event)) return;\n onFocus(retargetEvent(event) as unknown as MirrorFocusEvent);\n })\n }\n onKeyDown={\n onKeyDown &&\n ((event: React.KeyboardEvent<HTMLDivElement>) =>\n onKeyDown(retargetEvent(event) as unknown as MirrorKeyboardEvent))\n }\n onKeyUp={\n onKeyUp &&\n ((event: React.KeyboardEvent<HTMLDivElement>) =>\n onKeyUp(retargetEvent(event) as unknown as MirrorKeyboardEvent))\n }\n >\n <TextAreaRichKerebron\n value={state.html}\n onChange={handleHtmlChange}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n id={id}\n // Paste flattening: honored by the legacy engine (which the unit\n // tests stub in — see src/test/textAreaRichKerebronStub); the\n // Kerebron engine instead filters pastes through its ProseMirror\n // schema, so markup never reaches the live document raw.\n sanitizeHtml={sanitizePastedHtml}\n aria-label={ariaLabel ?? label}\n aria-labelledby={ariaLabelledBy ?? externalLabelId}\n aria-describedby={describedByIds}\n aria-invalid={invalid || undefined}\n aria-required={required || undefined}\n editorClassName={cn(\n // A native textarea renders repeated spaces and tabs\n // faithfully; normal HTML layout would collapse them.\n // (Font metrics ride editorStyle's CSS variables — text-sm/\n // text-lg utilities lose to unlayered package CSS here.)\n 'whitespace-pre-wrap'\n )}\n editorStyle={editorStyle}\n className={cn(\n size === 'sm' && 'text-sm',\n size === 'lg' && 'text-lg',\n invalid &&\n 'border-destructive focus-within:ring-destructive focus-within:border-destructive',\n disabled && 'cursor-not-allowed opacity-50',\n className\n )}\n />\n </div>\n {/* Mirrors the plain value for form posts and the forwarded ref. */}\n <textarea\n data-slot=\"textarea-mirror\"\n ref={hiddenRef}\n hidden\n readOnly\n tabIndex={-1}\n aria-hidden=\"true\"\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n value={state.plain}\n />\n <div\n data-slot=\"textarea-footer\"\n className=\"flex items-center justify-between gap-2\"\n >\n <div className=\"flex-1\">\n {showError && (\n <p\n id={errorId}\n data-slot=\"textarea-error\"\n className=\"text-destructive-700 dark:text-destructive-400 text-sm\"\n role=\"alert\"\n >\n {error}\n </p>\n )}\n {helperText && !showError && (\n <p\n id={helperId}\n data-slot=\"textarea-helper\"\n className=\"text-muted-foreground text-sm\"\n >\n {helperText}\n </p>\n )}\n </div>\n {showCount && (\n <p\n id={countId}\n data-slot=\"textarea-count\"\n className={cn(\n 'text-muted-foreground shrink-0 text-xs',\n maxLength && characterCount >= maxLength && 'text-destructive'\n )}\n >\n {characterCount}\n {maxLength && `/${maxLength}`}\n </p>\n )}\n </div>\n </div>\n );\n }\n);\n\nRichTextarea.displayName = 'RichTextarea';\n\n/**\n * A multi-line text input that is rich text underneath. `Textarea` keeps its\n * plain-text contract — `value`, `defaultValue` and `onChange`'s\n * `event.target.value` are plain strings — while rendering `TextAreaRich`\n * (hidden toolbar, markdown shortcuts, block gutter menu) so every note\n * field gets formatting for free.\n *\n * Formatting the user applies is visible while editing but only the plain\n * text is reported through `onChange`; hosts that persist HTML should use\n * `TextAreaRich` directly. Need the native `<textarea>` element (hard\n * `maxLength`, native validation, autofill, drag-resize, floating label) —\n * pass `richText={false}` or use `TextAreaPlain`.\n *\n * A hidden `<textarea>` mirrors the plain value so `name` form posts and\n * `ref.current.value` keep working; `ref.current.focus()` focuses the editor.\n */\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ richText = true, ...props }, ref) =>\n richText ? (\n <RichTextarea ref={ref} {...props} />\n ) : (\n <TextAreaPlain ref={ref} {...props} />\n )\n);\n\nTextarea.displayName = 'Textarea';\n\nexport { Textarea };\n"]}
1
+ {"version":3,"sources":["../src/components/TextAreaPlain/TextAreaPlain.tsx","../src/components/Textarea/Textarea.tsx"],"names":["cva","React","jsx","RequiredMark","cn","jsxs","React2","TextAreaRichKerebron"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAM,gBAAA,GAAmBA,0BAAA;AAAA,EACvB;AAAA,IACE,kBAAA;AAAA,IACA,gCAAA;AAAA,IACA,+BAAA;AAAA,IACA,mCAAA;AAAA,IACA,gCAAA;AAAA,IACA,0EAAA;AAAA,IACA,iDAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,sBAAA;AAAA,QACJ,EAAA,EAAI,wBAAA;AAAA,QACJ,EAAA,EAAI;AAAA,OACN;AAAA,MACA,QAAA,EAAU;AAAA,QACR,IAAA,EAAM,2CAAA;AAAA,QACN,KAAA,EAAO;AAAA,OACT;AAAA,MACA,MAAA,EAAQ;AAAA,QACN,IAAA,EAAM,aAAA;AAAA,QACN,QAAA,EAAU,UAAA;AAAA,QACV,UAAA,EAAY,UAAA;AAAA,QACZ,IAAA,EAAM;AAAA,OACR;AAAA,MACA,YAAA,EAAc;AAAA,QACZ,OAAA,EAAS,EAAA;AAAA,QACT,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,UAAA,EAAY;AAAA,QACV,IAAA,EAAM,EAAA;AAAA,QACN,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IACA,gBAAA,EAAkB;AAAA;AAAA;AAAA,MAGhB;AAAA,QACE,YAAA,EAAc,UAAA;AAAA,QACd,IAAA,EAAM,IAAA;AAAA,QACN,SAAA,EAAW;AAAA,OACb;AAAA,MACA;AAAA,QACE,YAAA,EAAc,UAAA;AA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AEnCA,cAAAA,CAAC,aAAA,EAAA,EAAc,GAAA,EAAW,GAAG,KAAA,EAAO;AAE1C;AAEA,QAAA,CAAS,WAAA,GAAc,UAAA","file":"chunk-IKHK4GTF.cjs","sourcesContent":["import * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { RequiredMark, type RequiredMarkVariant } from '../Input';\n\nconst textareaVariants = cva(\n [\n 'w-full px-3 py-2',\n 'border border-input rounded-lg',\n 'bg-background text-foreground',\n 'placeholder:text-muted-foreground',\n 'transition-colors duration-200',\n 'focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n 'resize-y',\n ],\n {\n variants: {\n size: {\n sm: 'text-sm min-h-[60px]',\n md: 'text-base min-h-[80px]',\n lg: 'text-lg min-h-[100px]',\n },\n hasError: {\n true: 'border-destructive focus:ring-destructive',\n false: '',\n },\n resize: {\n none: 'resize-none',\n vertical: 'resize-y',\n horizontal: 'resize-x',\n both: 'resize',\n },\n labelVariant: {\n stacked: '',\n floating: 'peer placeholder:text-transparent',\n },\n autoResize: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n // Floating labels reserve top padding so entered text always starts\n // below the floated label, plus a little extra min-height.\n {\n labelVariant: 'floating',\n size: 'sm',\n className: 'pt-5 min-h-[76px]',\n },\n {\n labelVariant: 'floating',\n size: 'md',\n className: 'pt-6 min-h-[96px]',\n },\n {\n labelVariant: 'floating',\n size: 'lg',\n className: 'pt-7 min-h-[120px]',\n },\n // Auto-growing textareas start at the same visual height as a\n // single-line Input (h-8/h-10/h-12): min-height matches the Input\n // size token and the vertical padding is tuned so one line of text\n // plus padding plus borders lands exactly on that height.\n {\n autoResize: true,\n labelVariant: 'stacked',\n size: 'sm',\n className: 'min-h-8 py-[5px]',\n },\n {\n autoResize: true,\n labelVariant: 'stacked',\n size: 'md',\n className: 'min-h-10 py-[7px]',\n },\n {\n autoResize: true,\n labelVariant: 'stacked',\n size: 'lg',\n className: 'min-h-12 py-[9px]',\n },\n // Floating label + auto-grow: single line below the floated label.\n {\n autoResize: true,\n labelVariant: 'floating',\n size: 'sm',\n className: 'min-h-[50px]',\n },\n {\n autoResize: true,\n labelVariant: 'floating',\n size: 'md',\n className: 'min-h-[58px]',\n },\n {\n autoResize: true,\n labelVariant: 'floating',\n size: 'lg',\n className: 'min-h-[66px]',\n },\n ],\n defaultVariants: {\n size: 'md',\n hasError: false,\n resize: 'vertical',\n labelVariant: 'stacked',\n autoResize: true,\n },\n }\n);\n\nconst floatingLabelVariants = cva(\n [\n 'absolute start-3 pointer-events-none select-none',\n 'transition-all duration-200 ease-out',\n ],\n {\n variants: {\n size: {\n sm: [\n 'text-sm top-3',\n 'peer-focus:top-1 peer-[:not(:placeholder-shown)]:top-1 peer-autofill:top-1',\n 'peer-focus:text-[0.65rem] peer-[:not(:placeholder-shown)]:text-[0.65rem] peer-autofill:text-[0.65rem]',\n ],\n md: [\n 'text-base top-4',\n 'peer-focus:top-1.5 peer-[:not(:placeholder-shown)]:top-1.5 peer-autofill:top-1.5',\n 'peer-focus:text-xs peer-[:not(:placeholder-shown)]:text-xs peer-autofill:text-xs',\n ],\n lg: [\n 'text-lg top-5',\n 'peer-focus:top-2 peer-[:not(:placeholder-shown)]:top-2 peer-autofill:top-2',\n 'peer-focus:text-sm peer-[:not(:placeholder-shown)]:text-sm peer-autofill:text-sm',\n ],\n },\n hasError: {\n true: 'text-destructive',\n false: 'text-muted-foreground',\n },\n },\n defaultVariants: {\n size: 'md',\n hasError: false,\n },\n }\n);\n\nexport interface TextAreaPlainProps\n extends\n Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'>,\n Omit<VariantProps<typeof textareaVariants>, 'labelVariant'> {\n /** Label for the textarea */\n label?: string;\n /**\n * How the label is rendered.\n * - `stacked` (default): label above the textarea.\n * - `floating`: label rests inside the textarea like a placeholder and\n * floats to the top (staying inside it) when focused or filled.\n * Ignores `placeholder`; when `hideLabel` is set, falls back to a\n * visually-hidden stacked label.\n */\n labelVariant?: 'stacked' | 'floating';\n /** Whether the label should be visually hidden */\n hideLabel?: boolean;\n /** Error message to display */\n error?: string;\n /** Helper text to display */\n helperText?: string;\n /** Maximum character count */\n maxLength?: number;\n /** Show character count */\n showCount?: boolean;\n /**\n * Grow and shrink with content (default). The empty control matches a\n * single-line `Input`'s height; `rows` sets a taller growth floor, and\n * dragging the native resize handle sets a new floor the same way. Set\n * `false` for a classic fixed-height textarea.\n */\n autoResize?: boolean;\n /**\n * Color of the required asterisk.\n * - `default`: destructive (hard requirement).\n * - `warning`: warning color (soft requirement / recommended).\n */\n requiredVariant?: RequiredMarkVariant;\n}\n\n/**\n * A multi-line text input component with character count and auto-resize.\n *\n * @example\n * ```tsx\n * <TextAreaPlain label=\"Description\" placeholder=\"Enter a description...\" />\n * <TextAreaPlain\n * label=\"Bio\"\n * maxLength={280}\n * showCount\n * helperText=\"Tell us about yourself\"\n * />\n * ```\n */\nconst TextAreaPlain = React.forwardRef<HTMLTextAreaElement, TextAreaPlainProps>(\n (\n {\n className,\n size,\n hasError,\n resize,\n label,\n labelVariant = 'stacked',\n hideLabel,\n error,\n helperText,\n maxLength,\n showCount = false,\n autoResize = true,\n required = false,\n requiredVariant,\n id,\n rows,\n value,\n defaultValue,\n onChange,\n placeholder,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref\n ) => {\n const internalRef = React.useRef<HTMLTextAreaElement>(null);\n const [internalValue, setInternalValue] = React.useState(\n (defaultValue as string) || ''\n );\n\n const generatedId = React.useId();\n const textareaId = id || generatedId;\n const errorId = `${textareaId}-error`;\n const helperId = `${textareaId}-helper`;\n const countId = `${textareaId}-count`;\n\n // Combine refs\n React.useImperativeHandle(ref, () => internalRef.current!);\n\n // Get current value\n const currentValue = value !== undefined ? String(value) : internalValue;\n const characterCount = currentValue.length;\n\n // Auto-resize logic: collapse to natural height, then grow to fit\n // content. CSS min-height (single-line baseline) and rows (via\n // scrollHeight) act as floors; a consumer-configured initial height\n // (style/class) and dragging the native resize handle set a user floor;\n // a consumer max-height still caps the rendered height.\n const userFloorRef = React.useRef<number | null>(null);\n const expectedHeightRef = React.useRef<number | null>(null);\n const initialFloorCapturedRef = React.useRef(false);\n\n const adjustHeight = React.useCallback(() => {\n const textarea = internalRef.current;\n if (textarea && autoResize) {\n textarea.style.height = 'auto';\n const borders = textarea.offsetHeight - textarea.clientHeight;\n const next = Math.max(\n textarea.scrollHeight + borders,\n userFloorRef.current ?? 0\n );\n textarea.style.height = `${next}px`;\n // Record the actual rendered height (a CSS max-height may clamp the\n // value we set) so clamping is never mistaken for a manual drag.\n expectedHeightRef.current = textarea.offsetHeight || next;\n }\n }, [autoResize]);\n\n // Measures prefilled values on mount and controlled values on update.\n // On mount, a consumer-configured initial height (inline style or a\n // height class) that exceeds the content height becomes the growth\n // floor — auto-sizing must not collapse below a configured baseline.\n React.useEffect(() => {\n const textarea = internalRef.current;\n if (textarea && autoResize && !initialFloorCapturedRef.current) {\n initialFloorCapturedRef.current = true;\n const configured = textarea.offsetHeight;\n adjustHeight();\n if (configured - textarea.offsetHeight > 1) {\n userFloorRef.current = configured;\n textarea.style.height = `${configured}px`;\n expectedHeightRef.current = textarea.offsetHeight || configured;\n }\n return;\n }\n adjustHeight();\n }, [currentValue, adjustHeight, autoResize]);\n\n // Re-measure when the available width changes (wrapping changes), and\n // detect heights we didn't set ourselves — the user dragging the native\n // resize handle — adopting the dragged height as the new growth floor.\n // The drag check runs first so a diagonal resize (width + height in one\n // notification) keeps the dragged height through the re-measure.\n React.useEffect(() => {\n const textarea = internalRef.current;\n if (!autoResize || !textarea || typeof ResizeObserver === 'undefined') {\n return;\n }\n let lastWidth = textarea.offsetWidth;\n const observer = new ResizeObserver(() => {\n const expected = expectedHeightRef.current;\n const height = textarea.offsetHeight;\n if (expected !== null && Math.abs(height - expected) > 1) {\n userFloorRef.current = height;\n expectedHeightRef.current = height;\n }\n if (textarea.offsetWidth !== lastWidth) {\n lastWidth = textarea.offsetWidth;\n adjustHeight();\n }\n });\n observer.observe(textarea);\n return () => observer.disconnect();\n }, [autoResize, adjustHeight]);\n\n // Handle change\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (value === undefined) {\n setInternalValue(e.target.value);\n }\n onChange?.(e);\n adjustHeight();\n },\n [value, onChange, adjustHeight]\n );\n\n // Build aria-describedby\n const describedByIds = [\n error ? errorId : null,\n helperText && !error ? helperId : null,\n showCount ? countId : null,\n ariaDescribedBy,\n ]\n .filter(Boolean)\n .join(' ');\n\n const isFloating = labelVariant === 'floating' && !!label && !hideLabel;\n\n const requiredMark = required && <RequiredMark variant={requiredVariant} />;\n\n const textareaElement = (\n <textarea\n data-slot=\"textarea\"\n data-auto-resize={autoResize ? 'true' : undefined}\n ref={internalRef}\n id={textareaId}\n value={value}\n defaultValue={value === undefined ? defaultValue : undefined}\n onChange={handleChange}\n maxLength={maxLength}\n aria-invalid={hasError || !!error}\n aria-describedby={describedByIds || undefined}\n required={required}\n // Auto-grow starts at one visible line; an explicit rows raises the\n // floor (scrollHeight never reports less than the rows box).\n rows={autoResize ? (rows ?? 1) : rows}\n // A single-space placeholder keeps :placeholder-shown reliable so the\n // label can float via CSS alone.\n placeholder={isFloating ? ' ' : placeholder}\n className={cn(\n textareaVariants({\n size,\n hasError: hasError || !!error,\n resize,\n labelVariant: isFloating ? 'floating' : 'stacked',\n autoResize,\n }),\n className\n )}\n {...props}\n />\n );\n\n return (\n <div data-slot=\"textarea-wrapper\" className=\"flex flex-col gap-1.5\">\n {label && !isFloating && (\n <label\n data-slot=\"textarea-label\"\n htmlFor={textareaId}\n className={cn(\n 'text-foreground text-sm font-medium',\n hideLabel && 'sr-only'\n )}\n >\n {label}\n {requiredMark}\n </label>\n )}\n {isFloating ? (\n <div className=\"relative\">\n {textareaElement}\n <label\n data-slot=\"textarea-label\"\n htmlFor={textareaId}\n className={floatingLabelVariants({\n size,\n hasError: hasError || !!error,\n })}\n >\n {label}\n {requiredMark}\n </label>\n </div>\n ) : (\n textareaElement\n )}\n <div\n data-slot=\"textarea-footer\"\n className=\"flex items-center justify-between gap-2\"\n >\n <div className=\"flex-1\">\n {error && (\n <p\n id={errorId}\n data-slot=\"textarea-error\"\n className=\"text-destructive-700 dark:text-destructive-400 text-sm\"\n role=\"alert\"\n >\n {error}\n </p>\n )}\n {helperText && !error && (\n <p\n id={helperId}\n data-slot=\"textarea-helper\"\n className=\"text-muted-foreground text-sm\"\n >\n {helperText}\n </p>\n )}\n </div>\n {showCount && (\n <p\n id={countId}\n data-slot=\"textarea-count\"\n className={cn(\n 'text-muted-foreground shrink-0 text-xs',\n maxLength && characterCount >= maxLength && 'text-destructive'\n )}\n >\n {characterCount}\n {maxLength && `/${maxLength}`}\n </p>\n )}\n </div>\n </div>\n );\n }\n);\n\nTextAreaPlain.displayName = 'TextAreaPlain';\n\nexport { TextAreaPlain, textareaVariants };\n","import * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { RequiredMark } from '../Input';\nimport { TextAreaRichKerebron } from '../TextAreaRich/TextAreaRichKerebron';\nimport { TextAreaPlain } from '../TextAreaPlain';\nimport type { TextAreaPlainProps } from '../TextAreaPlain';\n\n/**\n * `Textarea` keeps `TextAreaPlain`'s prop surface so existing call sites\n * compile unchanged while rendering `TextAreaRich` underneath.\n */\nexport interface TextareaProps extends TextAreaPlainProps {\n /**\n * Set `false` to opt out of the rich surface: renders the native\n * `TextAreaPlain` instead — no block gutter menu, no formatting, no HTML —\n * and restores every native textarea behaviour (`maxLength` enforcement,\n * `resize`, `autoResize={false}`, floating labels).\n */\n richText?: boolean;\n}\n\n// --- plain text <-> HTML (lossless round-trip for plain text) --------------\n\nfunction escapeHtml(text: string): string {\n return text\n .replaceAll('&', '&amp;')\n .replaceAll('<', '&lt;')\n .replaceAll('>', '&gt;');\n}\n\n/**\n * Newline normalization applied to every incoming plain value: a native\n * textarea's API value never contains CR, so CRLF/CR collapse to LF before\n * any conversion. Without this, `'a\\r\\nb'` would leave a literal CR inside a\n * paragraph and gain a blank line on the next round-trip.\n */\nfunction normalizeNewlines(text: string): string {\n return text.replace(/\\r\\n?/g, '\\n');\n}\n\n/**\n * Converts plain text to the editor's HTML: each line becomes a paragraph,\n * empty lines become `<p><br></p>`. Newlines are normalized to LF first\n * (matching native textarea behaviour); after that,\n * `htmlToPlain(plainToHtml(text)) === text` for every string, so stored\n * plain values survive untouched.\n */\nexport function plainToHtml(text: string): string {\n if (!text) return '';\n return normalizeNewlines(text)\n .split('\\n')\n .map((line) => (line ? `<p>${escapeHtml(line)}</p>` : '<p><br></p>'))\n .join('');\n}\n\nconst BLOCK_TAGS = new Set([\n 'P',\n 'DIV',\n 'H1',\n 'H2',\n 'H3',\n 'H4',\n 'H5',\n 'H6',\n 'LI',\n 'UL',\n 'OL',\n 'BLOCKQUOTE',\n 'PRE',\n 'TABLE',\n 'CAPTION',\n 'THEAD',\n 'TBODY',\n 'TFOOT',\n 'TR',\n]);\n\n/** Table cells separate with tabs; their row supplies the newline. */\nconst CELL_TAGS = new Set(['TD', 'TH']);\n\n/**\n * Structural table tags never render text of their own — whitespace-only\n * text nodes directly under them are pretty-printing between cells/rows\n * (`<tr>\\n <td>`), not field content.\n */\nconst TABLE_STRUCTURE_TAGS = new Set([\n 'TABLE',\n 'THEAD',\n 'TBODY',\n 'TFOOT',\n 'TR',\n]);\n\n/** Tags whose text is invisible — contributing it would leak code as text. */\nconst IGNORED_TAGS = new Set(['SCRIPT', 'STYLE', 'TEMPLATE', 'NOSCRIPT']);\n\nfunction nodeListToText(nodes: Iterable<Node>): string {\n let out = '';\n // Cell separators are positional, not content-based: an empty cell still\n // owns a column, so `Drug | (blank) | Dose` must stay `Drug\\t\\tDose`.\n let afterCell = false;\n for (const node of nodes) {\n if (node.nodeType === Node.TEXT_NODE) {\n const text = node.textContent ?? '';\n const parentTag = node.parentElement?.tagName;\n // Indentation between structural table elements is markup\n // formatting, not content — whitespace inside cells still counts.\n if (!text.trim() && parentTag && TABLE_STRUCTURE_TAGS.has(parentTag)) {\n continue;\n }\n out += text;\n // Inter-cell whitespace from pretty-printed table markup does not\n // break the cell sequence.\n if (text.trim()) afterCell = false;\n continue;\n }\n if (node.nodeType !== Node.ELEMENT_NODE) continue;\n const el = node as Element;\n if (IGNORED_TAGS.has(el.tagName)) continue;\n if (el.tagName === 'BR') {\n afterCell = false;\n out += '\\n';\n continue;\n }\n if (CELL_TAGS.has(el.tagName)) {\n if (afterCell) out += '\\t';\n out += nodeListToText(el.childNodes);\n afterCell = true;\n continue;\n }\n afterCell = false;\n if (BLOCK_TAGS.has(el.tagName)) {\n // A block starts its own line — inline content before it\n // (`a<div>b</div>`) must not fuse with the block's first line.\n if (out && !out.endsWith('\\n')) out += '\\n';\n let inner = nodeListToText(el.childNodes);\n // A lone <br> inside a block is the \"empty paragraph\" convention,\n // not an extra line break.\n if (inner === '\\n') inner = '';\n out += inner;\n // A block ends its own line — but a nested block\n // (`<blockquote><p>a</p></blockquote>`) already supplied the\n // newline; adding another would fabricate a blank line.\n if (inner === '' || !inner.endsWith('\\n')) out += '\\n';\n continue;\n }\n out += nodeListToText(el.childNodes);\n }\n return out;\n}\n\n/** Extracts plain text from editor HTML: blocks and `<br>` become newlines. */\nexport function htmlToPlain(html: string): string {\n if (!html) return '';\n // A <template> is the spec's inert parser: untrusted markup (pasted HTML\n // reaches this extractor) cannot load resources or run handlers like\n // `<img onerror>` while being read — unlike a detached <div>, whose\n // subtree is still \"browsing-context connected\" enough to fetch.\n const root = document.createElement('template');\n root.innerHTML = html;\n const text = nodeListToText(root.content.childNodes);\n return text.endsWith('\\n') ? text.slice(0, -1) : text;\n}\n\n/**\n * Paste/drop insertion policy: clipboard HTML is flattened to escaped plain\n * paragraphs before it reaches the live editable, so clipboard styles, host\n * CSS classes and embedded content never become active inside a field whose\n * contract is plain text.\n */\nfunction sanitizePastedHtml(html: string): string {\n return plainToHtml(htmlToPlain(html));\n}\n\n// --- dev-only one-time warnings for dropped native behaviours ---------------\n\nconst warned = new Set<string>();\nfunction warnOnce(key: string, message: string): void {\n if (process.env.NODE_ENV !== 'production' && !warned.has(key)) {\n warned.add(key);\n console.warn(`[mieweb/ui Textarea] ${message}`);\n }\n}\n\n/**\n * The rich implementation behind `Textarea` (see its docs). Separate\n * component so the `richText={false}` branch never mounts these hooks.\n */\nconst RichTextarea = React.forwardRef<HTMLTextAreaElement, TextAreaPlainProps>(\n (\n {\n label,\n labelVariant = 'stacked',\n hideLabel,\n error,\n helperText,\n maxLength,\n showCount,\n autoResize = true,\n requiredVariant,\n size = 'md',\n hasError,\n resize,\n className,\n value,\n defaultValue,\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n onKeyUp,\n name,\n form,\n id,\n rows,\n required,\n readOnly,\n disabled,\n placeholder,\n 'aria-describedby': ariaDescribedBy,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n },\n ref\n ) => {\n // One-time upgrade notice: this surface replaced the native <textarea>\n // in 0.12.0 — reaches exactly the developers affected, in dev only.\n warnOnce(\n 'rich-upgrade',\n 'Since 0.12.0 Textarea renders a rich text surface (plain-text value ' +\n 'contract unchanged). Watch for: CSS \"textarea\" selectors, E2E ' +\n 'fill()/type(), and maxLength no longer blocking typing. Opt out per ' +\n 'field with richText={false} or use TextAreaPlain. See MIGRATION.md.'\n );\n if (labelVariant === 'floating') {\n warnOnce(\n 'floating',\n 'labelVariant=\"floating\" is not supported by the rich surface; ' +\n 'falling back to a stacked label. Use TextAreaPlain for floating labels.'\n );\n }\n if (autoResize === false) {\n warnOnce(\n 'autoResize',\n 'autoResize={false} is ignored; the rich surface always grows with ' +\n 'content. Use TextAreaPlain for a fixed-height textarea.'\n );\n }\n if (resize !== undefined) {\n warnOnce(\n 'resize',\n 'resize is ignored; the rich surface has no native resize handle. ' +\n 'Use TextAreaPlain for drag-resizing.'\n );\n }\n if (maxLength !== undefined) {\n warnOnce(\n 'maxLength',\n 'maxLength is not enforced while typing; the character count still ' +\n 'reflects it. Enforce limits in onChange or use TextAreaPlain.'\n );\n }\n\n const reactId = React.useId();\n const errorId = `${reactId}-error`;\n const helperId = `${reactId}-helper`;\n const countId = `${reactId}-count`;\n\n const controlledValue =\n value !== undefined ? normalizeNewlines(String(value)) : undefined;\n\n const [state, setState] = React.useState(() => {\n const plain =\n controlledValue ??\n (defaultValue !== undefined\n ? normalizeNewlines(String(defaultValue))\n : '');\n return { html: plainToHtml(plain), plain };\n });\n\n // Controlled resync: only when the parent hands us a value different from\n // the plain text we last reported — echoing our own value back (the usual\n // controlled round-trip) keeps the user's rich formatting intact.\n if (controlledValue !== undefined && controlledValue !== state.plain) {\n setState({ html: plainToHtml(controlledValue), plain: controlledValue });\n }\n\n const hiddenRef = React.useRef<HTMLTextAreaElement>(null);\n const editorWrapperRef = React.useRef<HTMLDivElement>(null);\n\n // Rejected edits need no DOM poking here: the Kerebron surface is\n // strictly controlled (it converges to `value` on every render — see\n // RichEditor's `strictValue`), so when a controlled parent refuses an\n // edit and the optimistic state above is reverted during the same\n // render, the editor reloads the committed HTML transaction-safely.\n\n // The ProseMirror surface mounts asynchronously, so a mount-time\n // `ref.current.focus()` (the autoFocus-era idiom) can run before\n // `[role=\"textbox\"]` exists. The request is retained and honored when\n // the editable appears — unless focus has moved on to another control\n // in the meantime, which must not have its focus stolen.\n const pendingFocusRef = React.useRef<MutationObserver | null>(null);\n React.useEffect(() => () => pendingFocusRef.current?.disconnect(), []);\n const focusEditor = React.useCallback(() => {\n const wrapper = editorWrapperRef.current;\n if (!wrapper) return;\n const editable = wrapper.querySelector<HTMLElement>('[role=\"textbox\"]');\n if (editable) {\n editable.focus();\n return;\n }\n pendingFocusRef.current?.disconnect();\n const observer = new MutationObserver(() => {\n const target = wrapper.querySelector<HTMLElement>('[role=\"textbox\"]');\n if (!target) return;\n observer.disconnect();\n pendingFocusRef.current = null;\n const active = document.activeElement;\n if (!active || active === document.body || wrapper.contains(active)) {\n target.focus();\n }\n });\n // `role=\"textbox\"` arrives as an ATTRIBUTE write in the adapter's\n // readiness effect, possibly after the node insertions — watch both.\n observer.observe(wrapper, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['role'],\n });\n pendingFocusRef.current = observer;\n }, []);\n\n // The forwarded ref is the hidden mirror <textarea> — `ref.current.value`\n // reads the current plain text — with focus/blur redirected to the editor.\n React.useImperativeHandle(ref, () => {\n const node = hiddenRef.current as HTMLTextAreaElement;\n node.focus = focusEditor;\n node.blur = () => {\n // A focus request may still be waiting for the editable to mount;\n // blur() must cancel it, or the editor grabs focus (and reopens the\n // mobile keyboard) as soon as it appears.\n pendingFocusRef.current?.disconnect();\n pendingFocusRef.current = null;\n const editable =\n editorWrapperRef.current?.querySelector<HTMLElement>(\n '[role=\"textbox\"]'\n );\n if (document.activeElement === editable) editable?.blur();\n };\n return node;\n }, [focusEditor]);\n\n // External-label bridge: existing call sites pair\n // `<Label htmlFor={id}>` with `<Textarea id={id}>`. The id now lands on a\n // contenteditable div, which `htmlFor` neither names nor focuses. Find\n // the external label, point `aria-labelledby` at it (restoring the\n // accessible name) and focus the editor when it is clicked.\n const [externalLabelId, setExternalLabelId] = React.useState<string>();\n React.useEffect(() => {\n if (!id) return;\n const externalLabel = document.querySelector<HTMLLabelElement>(\n `label[for=\"${globalThis.CSS.escape(id)}\"]`\n );\n if (!externalLabel) return;\n if (!externalLabel.id) externalLabel.id = `${reactId}-external-label`;\n setExternalLabelId(externalLabel.id);\n const handleClick = () => focusEditor();\n externalLabel.addEventListener('click', handleClick);\n return () => externalLabel.removeEventListener('click', handleClick);\n }, [id, reactId, focusEditor]);\n\n // Re-targets editor events at the mirror so legacy handlers keep reading\n // `event.target.value` as plain text, like they did on the native\n // textarea. The original event is the prototype — reads and propagation\n // state delegate to it — with only the targets overridden;\n // stopPropagation/preventDefault forward to the original so React's\n // dispatch loop (which checks the original) honours them.\n const retargetEvent = React.useCallback(\n <E extends React.SyntheticEvent>(event: E): E => {\n const node = hiddenRef.current;\n if (!node) return event;\n const retargeted = Object.create(event) as E;\n Object.defineProperties(retargeted, {\n target: { value: node, enumerable: true },\n currentTarget: { value: node, enumerable: true },\n stopPropagation: { value: () => event.stopPropagation() },\n preventDefault: { value: () => event.preventDefault() },\n });\n return retargeted;\n },\n []\n );\n\n type MirrorFocusEvent = React.FocusEvent<HTMLTextAreaElement>;\n type MirrorKeyboardEvent = React.KeyboardEvent<HTMLTextAreaElement>;\n\n // Focus boundary that includes the editor's own portals: the block\n // gutter menu mounts under `document.body` and moves focus to its first\n // item on open, so DOM containment alone would fire the host's blur\n // mid-format (a blur-to-save consumer would commit early). A portal is\n // ours when a trigger inside this wrapper `aria-controls` its menu.\n const focusStaysInside = (\n event: React.FocusEvent<HTMLDivElement>\n ): boolean => {\n const related = event.relatedTarget;\n if (!related) return false;\n if (event.currentTarget.contains(related)) return true;\n const menuId = related\n .closest('[data-slot=\"dropdown-menu\"]')\n ?.querySelector('[role=\"menu\"]')?.id;\n return (\n !!menuId &&\n !!event.currentTarget.querySelector(\n `[aria-controls=\"${globalThis.CSS.escape(menuId)}\"]`\n )\n );\n };\n\n const handleHtmlChange = (html: string) => {\n const plain = htmlToPlain(html);\n setState({ html, plain });\n const node = hiddenRef.current;\n if (onChange && node) {\n node.value = plain;\n const nativeEvent = new Event('change');\n onChange({\n target: node,\n currentTarget: node,\n type: 'change',\n bubbles: false,\n cancelable: false,\n defaultPrevented: false,\n eventPhase: 0,\n isTrusted: false,\n timeStamp: Date.now(),\n nativeEvent,\n preventDefault: () => {},\n stopPropagation: () => {},\n isDefaultPrevented: () => false,\n isPropagationStopped: () => false,\n persist: () => {},\n } as React.ChangeEvent<HTMLTextAreaElement>);\n }\n };\n\n const showError = !!error;\n const invalid = hasError || showError;\n const describedByIds =\n [\n showError ? errorId : null,\n helperText && !showError ? helperId : null,\n showCount ? countId : null,\n ariaDescribedBy,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n\n const characterCount = state.plain.length;\n\n // The editable's own metrics: `size` restyles the font, `rows` restores\n // the size-aware growth floor a native textarea got for free. Text\n // utilities cannot size the editable — unlayered package CSS\n // (kerebron.css's `[data-slot='textarea-rich'] .kb-editor` rule and\n // Kerebron's own base.css) outranks them on both font-size and\n // line-height — so the sm/lg metrics ride CSS variables that those\n // rules read. The defaults (16px/24px) are the md pair, keeping\n // `lineHeightPx` and the 40px rest-height match with Input honest.\n const lineHeightPx = size === 'sm' ? 20 : size === 'lg' ? 28 : 24;\n const sizeVars =\n size === 'sm'\n ? {\n '--textarea-rich-font-size': '0.875rem',\n '--textarea-rich-line-height': '1.25rem',\n }\n : size === 'lg'\n ? {\n '--textarea-rich-font-size': '1.125rem',\n '--textarea-rich-line-height': '1.75rem',\n }\n : null;\n const editorStyle =\n rows || sizeVars\n ? ({\n ...(rows\n ? // 7px block padding each side, matching the editable's py-[7px].\n { minHeight: `${rows * lineHeightPx + 14}px` }\n : null),\n ...sizeVars,\n } as React.CSSProperties)\n : undefined;\n\n return (\n <div data-slot=\"textarea-wrapper\" className=\"flex flex-col gap-1.5\">\n {label && (\n <label\n data-slot=\"textarea-label\"\n className={cn(\n 'text-foreground text-sm font-medium',\n hideLabel && 'sr-only'\n )}\n >\n {label}\n {required && <RequiredMark variant={requiredVariant} />}\n </label>\n )}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions --\n not interactive itself: delegates events bubbling from the\n contenteditable textbox inside, like a native field's wrapper */}\n <div\n ref={editorWrapperRef}\n className=\"w-full\"\n // Composed like native textarea events: blur/focus only fire when\n // focus actually leaves/enters the field (moves inside the editor\n // chrome — gutter menu, toolbar — don't count), and all events are\n // re-targeted at the mirror so `event.target.value` stays plain.\n onBlur={\n onBlur &&\n ((event: React.FocusEvent<HTMLDivElement>) => {\n if (focusStaysInside(event)) return;\n onBlur(retargetEvent(event) as unknown as MirrorFocusEvent);\n })\n }\n onFocus={\n onFocus &&\n ((event: React.FocusEvent<HTMLDivElement>) => {\n if (focusStaysInside(event)) return;\n onFocus(retargetEvent(event) as unknown as MirrorFocusEvent);\n })\n }\n onKeyDown={\n onKeyDown &&\n ((event: React.KeyboardEvent<HTMLDivElement>) =>\n onKeyDown(retargetEvent(event) as unknown as MirrorKeyboardEvent))\n }\n onKeyUp={\n onKeyUp &&\n ((event: React.KeyboardEvent<HTMLDivElement>) =>\n onKeyUp(retargetEvent(event) as unknown as MirrorKeyboardEvent))\n }\n >\n <TextAreaRichKerebron\n value={state.html}\n onChange={handleHtmlChange}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n id={id}\n // Paste flattening: honored by the legacy engine (which the unit\n // tests stub in — see src/test/textAreaRichKerebronStub); the\n // Kerebron engine instead filters pastes through its ProseMirror\n // schema, so markup never reaches the live document raw.\n sanitizeHtml={sanitizePastedHtml}\n aria-label={ariaLabel ?? label}\n aria-labelledby={ariaLabelledBy ?? externalLabelId}\n aria-describedby={describedByIds}\n aria-invalid={invalid || undefined}\n aria-required={required || undefined}\n editorClassName={cn(\n // A native textarea renders repeated spaces and tabs\n // faithfully; normal HTML layout would collapse them.\n // (Font metrics ride editorStyle's CSS variables — text-sm/\n // text-lg utilities lose to unlayered package CSS here.)\n 'whitespace-pre-wrap'\n )}\n editorStyle={editorStyle}\n className={cn(\n size === 'sm' && 'text-sm',\n size === 'lg' && 'text-lg',\n invalid &&\n 'border-destructive focus-within:ring-destructive focus-within:border-destructive',\n disabled && 'cursor-not-allowed opacity-50',\n className\n )}\n />\n </div>\n {/* Mirrors the plain value for form posts and the forwarded ref. */}\n <textarea\n data-slot=\"textarea-mirror\"\n ref={hiddenRef}\n hidden\n readOnly\n tabIndex={-1}\n aria-hidden=\"true\"\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n value={state.plain}\n />\n <div\n data-slot=\"textarea-footer\"\n className=\"flex items-center justify-between gap-2\"\n >\n <div className=\"flex-1\">\n {showError && (\n <p\n id={errorId}\n data-slot=\"textarea-error\"\n className=\"text-destructive-700 dark:text-destructive-400 text-sm\"\n role=\"alert\"\n >\n {error}\n </p>\n )}\n {helperText && !showError && (\n <p\n id={helperId}\n data-slot=\"textarea-helper\"\n className=\"text-muted-foreground text-sm\"\n >\n {helperText}\n </p>\n )}\n </div>\n {showCount && (\n <p\n id={countId}\n data-slot=\"textarea-count\"\n className={cn(\n 'text-muted-foreground shrink-0 text-xs',\n maxLength && characterCount >= maxLength && 'text-destructive'\n )}\n >\n {characterCount}\n {maxLength && `/${maxLength}`}\n </p>\n )}\n </div>\n </div>\n );\n }\n);\n\nRichTextarea.displayName = 'RichTextarea';\n\n/**\n * A multi-line text input that is rich text underneath. `Textarea` keeps its\n * plain-text contract — `value`, `defaultValue` and `onChange`'s\n * `event.target.value` are plain strings — while rendering `TextAreaRich`\n * (hidden toolbar, markdown shortcuts, block gutter menu) so every note\n * field gets formatting for free.\n *\n * Formatting the user applies is visible while editing but only the plain\n * text is reported through `onChange`; hosts that persist HTML should use\n * `TextAreaRich` directly. Need the native `<textarea>` element (hard\n * `maxLength`, native validation, autofill, drag-resize, floating label) —\n * pass `richText={false}` or use `TextAreaPlain`.\n *\n * A hidden `<textarea>` mirrors the plain value so `name` form posts and\n * `ref.current.value` keep working; `ref.current.focus()` focuses the editor.\n */\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ richText = true, ...props }, ref) =>\n richText ? (\n <RichTextarea ref={ref} {...props} />\n ) : (\n <TextAreaPlain ref={ref} {...props} />\n )\n);\n\nTextarea.displayName = 'Textarea';\n\nexport { Textarea };\n"]}