@ahrowe/ui 0.41.2 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/CHANGELOG.md +934 -0
  2. package/README.md +11 -10
  3. package/dist/cjs-types/common/accordion/accordion.types.d.ts +17 -2
  4. package/dist/cjs-types/common/actionButtons/actionButtons.types.d.ts +7 -1
  5. package/dist/cjs-types/common/actionIcon/actionIcon.d.ts +1 -1
  6. package/dist/cjs-types/common/actionIcon/actionIcon.types.d.ts +7 -9
  7. package/dist/cjs-types/common/alert/alert.types.d.ts +6 -8
  8. package/dist/cjs-types/common/animatedLogo/animatedLogo.types.d.ts +3 -2
  9. package/dist/cjs-types/common/badge/badge.types.d.ts +10 -6
  10. package/dist/cjs-types/common/button/button.types.d.ts +14 -4
  11. package/dist/cjs-types/common/calendar/calendar.types.d.ts +25 -10
  12. package/dist/cjs-types/common/calendar/components/agendaList/agendaList.d.ts +1 -1
  13. package/dist/cjs-types/common/calendar/components/agendaList/agendaList.types.d.ts +3 -0
  14. package/dist/cjs-types/common/calendar/components/calendarHeader/calendarHeader.d.ts +1 -1
  15. package/dist/cjs-types/common/calendar/components/calendarHeader/calendarHeader.types.d.ts +2 -0
  16. package/dist/cjs-types/common/calendar/components/compactMonth/compactMonth.d.ts +1 -1
  17. package/dist/cjs-types/common/calendar/components/monthView/monthView.d.ts +1 -1
  18. package/dist/cjs-types/common/calendar/components/monthView/monthView.types.d.ts +3 -2
  19. package/dist/cjs-types/common/calendar/components/timeGrid/timeGrid.d.ts +1 -1
  20. package/dist/cjs-types/common/calendar/components/timeGrid/timeGrid.types.d.ts +9 -1
  21. package/dist/cjs-types/common/calendar/dates.d.ts +21 -5
  22. package/dist/cjs-types/common/calendar/format.d.ts +3 -2
  23. package/dist/cjs-types/common/calendar/layout.d.ts +5 -0
  24. package/dist/cjs-types/common/calendar/useNow.d.ts +4 -0
  25. package/dist/cjs-types/common/calendar/view.types.d.ts +9 -2
  26. package/dist/cjs-types/common/card/card.types.d.ts +16 -2
  27. package/dist/cjs-types/common/chip/chip.types.d.ts +10 -5
  28. package/dist/cjs-types/common/copyButton/copyButton.types.d.ts +5 -4
  29. package/dist/cjs-types/common/fab/components/fabBase/fabBase.d.ts +1 -1
  30. package/dist/cjs-types/common/fab/components/fabBase/fabBase.types.d.ts +2 -1
  31. package/dist/cjs-types/common/floorPlan/floorPlan.graph.d.ts +10 -3
  32. package/dist/cjs-types/common/floorPlan/floorPlan.plan.d.ts +5 -0
  33. package/dist/cjs-types/common/floorPlan/floorPlan.rooms.d.ts +6 -2
  34. package/dist/cjs-types/common/floorPlan/floorPlan.snap.d.ts +1 -3
  35. package/dist/cjs-types/common/floorPlan/index.d.ts +1 -3
  36. package/dist/cjs-types/common/planCanvas/planCanvas.types.d.ts +1 -1
  37. package/dist/cjs-types/common/progressBar/progressBar.d.ts +0 -1
  38. package/dist/cjs-types/common/progressBar/progressBar.types.d.ts +3 -1
  39. package/dist/cjs-types/common/roomDrawer/roomDrawer.types.d.ts +29 -8
  40. package/dist/cjs-types/common/roomViewer/roomViewer.types.d.ts +4 -2
  41. package/dist/cjs-types/common/splitButton/splitButton.types.d.ts +4 -1
  42. package/dist/cjs-types/common/styles/tone.d.ts +11 -0
  43. package/dist/cjs-types/common/themeProvider/color.types.d.ts +20 -0
  44. package/dist/cjs-types/common/themeProvider/index.d.ts +2 -0
  45. package/dist/cjs-types/common/themeProvider/theme.types.d.ts +3 -6
  46. package/dist/cjs-types/common/timeline/timeline.types.d.ts +3 -10
  47. package/dist/cjs-types/common/toast/index.d.ts +1 -1
  48. package/dist/cjs-types/common/toast/toast.types.d.ts +7 -3
  49. package/dist/cjs-types/common/types/actions.types.d.ts +1 -1
  50. package/dist/cjs-types/common/utils/dismissClick.d.ts +4 -0
  51. package/dist/cjs-types/common/utils/isDev.d.ts +1 -0
  52. package/dist/esm/common/accordion/accordion.mjs +1 -1
  53. package/dist/esm/common/accordion/accordion.mjs.map +1 -1
  54. package/dist/esm/common/accordion/accordion.module.mjs +1 -1
  55. package/dist/esm/common/accordion/accordion.module.mjs.map +1 -1
  56. package/dist/esm/common/accordion/accordion.types.mjs +1 -1
  57. package/dist/esm/common/accordion/accordion.types.mjs.map +1 -1
  58. package/dist/esm/common/actionButtons/actionButtons.mjs +1 -1
  59. package/dist/esm/common/actionButtons/actionButtons.mjs.map +1 -1
  60. package/dist/esm/common/actionIcon/actionIcon.mjs +1 -1
  61. package/dist/esm/common/actionIcon/actionIcon.mjs.map +1 -1
  62. package/dist/esm/common/actionIcon/actionIcon.module.mjs +1 -1
  63. package/dist/esm/common/actionIcon/actionIcon.module.mjs.map +1 -1
  64. package/dist/esm/common/alert/alert.mjs +1 -1
  65. package/dist/esm/common/alert/alert.mjs.map +1 -1
  66. package/dist/esm/common/alert/alert.module.mjs +1 -1
  67. package/dist/esm/common/alert/alert.module.mjs.map +1 -1
  68. package/dist/esm/common/animatedLogo/animatedLogo.mjs +1 -1
  69. package/dist/esm/common/animatedLogo/animatedLogo.mjs.map +1 -1
  70. package/dist/esm/common/avatar/avatar.mjs +1 -1
  71. package/dist/esm/common/avatar/avatar.mjs.map +1 -1
  72. package/dist/esm/common/badge/badge.mjs +1 -1
  73. package/dist/esm/common/badge/badge.mjs.map +1 -1
  74. package/dist/esm/common/badge/badge.module.mjs +1 -1
  75. package/dist/esm/common/badge/badge.module.mjs.map +1 -1
  76. package/dist/esm/common/badge/badge.types.mjs +1 -1
  77. package/dist/esm/common/badge/badge.types.mjs.map +1 -1
  78. package/dist/esm/common/bodyEnd/bodyEnd.mjs +1 -1
  79. package/dist/esm/common/bodyEnd/bodyEnd.mjs.map +1 -1
  80. package/dist/esm/common/breadcrumb/breadcrumb.mjs +1 -1
  81. package/dist/esm/common/breadcrumb/breadcrumb.mjs.map +1 -1
  82. package/dist/esm/common/breadcrumb/breadcrumb.module.mjs.map +1 -1
  83. package/dist/esm/common/button/button.mjs +1 -1
  84. package/dist/esm/common/button/button.mjs.map +1 -1
  85. package/dist/esm/common/button/button.module.mjs +1 -1
  86. package/dist/esm/common/button/button.module.mjs.map +1 -1
  87. package/dist/esm/common/button/button.types.mjs +1 -1
  88. package/dist/esm/common/button/button.types.mjs.map +1 -1
  89. package/dist/esm/common/calendar/calendar.mjs +1 -1
  90. package/dist/esm/common/calendar/calendar.mjs.map +1 -1
  91. package/dist/esm/common/calendar/calendar.module.mjs.map +1 -1
  92. package/dist/esm/common/calendar/calendar.types.mjs.map +1 -1
  93. package/dist/esm/common/calendar/components/agendaList/agendaList.mjs +1 -1
  94. package/dist/esm/common/calendar/components/agendaList/agendaList.mjs.map +1 -1
  95. package/dist/esm/common/calendar/components/agendaList/agendaList.module.mjs.map +1 -1
  96. package/dist/esm/common/calendar/components/calendarHeader/calendarHeader.mjs +1 -1
  97. package/dist/esm/common/calendar/components/calendarHeader/calendarHeader.mjs.map +1 -1
  98. package/dist/esm/common/calendar/components/calendarHeader/calendarHeader.module.mjs +1 -1
  99. package/dist/esm/common/calendar/components/calendarHeader/calendarHeader.module.mjs.map +1 -1
  100. package/dist/esm/common/calendar/components/compactMonth/compactMonth.mjs +1 -1
  101. package/dist/esm/common/calendar/components/compactMonth/compactMonth.mjs.map +1 -1
  102. package/dist/esm/common/calendar/components/compactMonth/compactMonth.module.mjs +1 -1
  103. package/dist/esm/common/calendar/components/compactMonth/compactMonth.module.mjs.map +1 -1
  104. package/dist/esm/common/calendar/components/monthView/monthView.mjs +1 -1
  105. package/dist/esm/common/calendar/components/monthView/monthView.mjs.map +1 -1
  106. package/dist/esm/common/calendar/components/monthView/monthView.module.mjs +1 -1
  107. package/dist/esm/common/calendar/components/monthView/monthView.module.mjs.map +1 -1
  108. package/dist/esm/common/calendar/components/timeGrid/timeGrid.mjs +1 -1
  109. package/dist/esm/common/calendar/components/timeGrid/timeGrid.mjs.map +1 -1
  110. package/dist/esm/common/calendar/components/timeGrid/timeGrid.module.mjs +1 -1
  111. package/dist/esm/common/calendar/components/timeGrid/timeGrid.module.mjs.map +1 -1
  112. package/dist/esm/common/calendar/dates.mjs +1 -1
  113. package/dist/esm/common/calendar/dates.mjs.map +1 -1
  114. package/dist/esm/common/calendar/format.mjs +1 -1
  115. package/dist/esm/common/calendar/format.mjs.map +1 -1
  116. package/dist/esm/common/calendar/layout.mjs +1 -1
  117. package/dist/esm/common/calendar/layout.mjs.map +1 -1
  118. package/dist/esm/common/calendar/useNow.mjs +2 -0
  119. package/dist/esm/common/calendar/useNow.mjs.map +1 -0
  120. package/dist/esm/common/card/Card.mjs +1 -1
  121. package/dist/esm/common/card/Card.mjs.map +1 -1
  122. package/dist/esm/common/card/CardActions.mjs +1 -1
  123. package/dist/esm/common/card/CardActions.mjs.map +1 -1
  124. package/dist/esm/common/card/CardHeader.mjs.map +1 -1
  125. package/dist/esm/common/card/card.module.mjs +1 -1
  126. package/dist/esm/common/card/card.module.mjs.map +1 -1
  127. package/dist/esm/common/card/card.types.mjs +1 -1
  128. package/dist/esm/common/card/card.types.mjs.map +1 -1
  129. package/dist/esm/common/carousel/carousel.mjs +1 -1
  130. package/dist/esm/common/carousel/carousel.mjs.map +1 -1
  131. package/dist/esm/common/carousel/carousel.module.mjs.map +1 -1
  132. package/dist/esm/common/chip/chip.mjs +1 -1
  133. package/dist/esm/common/chip/chip.mjs.map +1 -1
  134. package/dist/esm/common/chip/chip.module.mjs +1 -1
  135. package/dist/esm/common/chip/chip.module.mjs.map +1 -1
  136. package/dist/esm/common/chip/chip.types.mjs +1 -1
  137. package/dist/esm/common/chip/chip.types.mjs.map +1 -1
  138. package/dist/esm/common/colorPicker/colorPicker.mjs +1 -1
  139. package/dist/esm/common/colorPicker/colorPicker.mjs.map +1 -1
  140. package/dist/esm/common/colorPicker/colorPicker.module.mjs.map +1 -1
  141. package/dist/esm/common/confirmModal/confirmModal.mjs +1 -1
  142. package/dist/esm/common/confirmModal/confirmModal.mjs.map +1 -1
  143. package/dist/esm/common/copyButton/copyButton.mjs +1 -1
  144. package/dist/esm/common/copyButton/copyButton.mjs.map +1 -1
  145. package/dist/esm/common/copyButton/copyButton.module.mjs +1 -1
  146. package/dist/esm/common/copyButton/copyButton.module.mjs.map +1 -1
  147. package/dist/esm/common/errorBoundary/errorBoundary.mjs +2 -2
  148. package/dist/esm/common/errorBoundary/errorBoundary.mjs.map +1 -1
  149. package/dist/esm/common/fab/components/fabBase/fabBase.mjs +1 -1
  150. package/dist/esm/common/fab/components/fabBase/fabBase.mjs.map +1 -1
  151. package/dist/esm/common/fab/fab.mjs +1 -1
  152. package/dist/esm/common/fab/fab.mjs.map +1 -1
  153. package/dist/esm/common/flip/flip.mjs +1 -1
  154. package/dist/esm/common/flip/flip.mjs.map +1 -1
  155. package/dist/esm/common/floorPlan/floorPlan.faces.mjs +1 -1
  156. package/dist/esm/common/floorPlan/floorPlan.faces.mjs.map +1 -1
  157. package/dist/esm/common/floorPlan/floorPlan.geometry.mjs +1 -1
  158. package/dist/esm/common/floorPlan/floorPlan.geometry.mjs.map +1 -1
  159. package/dist/esm/common/floorPlan/floorPlan.graph.mjs +1 -1
  160. package/dist/esm/common/floorPlan/floorPlan.graph.mjs.map +1 -1
  161. package/dist/esm/common/floorPlan/floorPlan.hit.mjs +1 -1
  162. package/dist/esm/common/floorPlan/floorPlan.hit.mjs.map +1 -1
  163. package/dist/esm/common/floorPlan/floorPlan.json.mjs +1 -1
  164. package/dist/esm/common/floorPlan/floorPlan.json.mjs.map +1 -1
  165. package/dist/esm/common/floorPlan/floorPlan.mesh.mjs +1 -1
  166. package/dist/esm/common/floorPlan/floorPlan.mesh.mjs.map +1 -1
  167. package/dist/esm/common/floorPlan/floorPlan.path.mjs +1 -1
  168. package/dist/esm/common/floorPlan/floorPlan.path.mjs.map +1 -1
  169. package/dist/esm/common/floorPlan/floorPlan.plan.mjs +1 -1
  170. package/dist/esm/common/floorPlan/floorPlan.plan.mjs.map +1 -1
  171. package/dist/esm/common/floorPlan/floorPlan.rooms.mjs +1 -1
  172. package/dist/esm/common/floorPlan/floorPlan.rooms.mjs.map +1 -1
  173. package/dist/esm/common/floorPlan/floorPlan.snap.mjs +1 -1
  174. package/dist/esm/common/floorPlan/floorPlan.snap.mjs.map +1 -1
  175. package/dist/esm/common/floorPlan/floorPlan.triangulate.mjs +1 -1
  176. package/dist/esm/common/floorPlan/floorPlan.triangulate.mjs.map +1 -1
  177. package/dist/esm/common/floorPlan/floorPlan.types.mjs +1 -1
  178. package/dist/esm/common/floorPlan/floorPlan.types.mjs.map +1 -1
  179. package/dist/esm/common/klipyPicker/klipyPicker.mjs +1 -1
  180. package/dist/esm/common/klipyPicker/klipyPicker.mjs.map +1 -1
  181. package/dist/esm/common/modal/modal.mjs +1 -1
  182. package/dist/esm/common/modal/modal.mjs.map +1 -1
  183. package/dist/esm/common/modal/modal.module.mjs.map +1 -1
  184. package/dist/esm/common/numberInput/numberInput.mjs +1 -1
  185. package/dist/esm/common/numberInput/numberInput.mjs.map +1 -1
  186. package/dist/esm/common/numberInput/numberInput.module.mjs.map +1 -1
  187. package/dist/esm/common/planCanvas/planCanvas.mjs +1 -1
  188. package/dist/esm/common/planCanvas/planCanvas.mjs.map +1 -1
  189. package/dist/esm/common/popover/popover.mjs +1 -1
  190. package/dist/esm/common/popover/popover.mjs.map +1 -1
  191. package/dist/esm/common/progressBar/progressBar.mjs +1 -1
  192. package/dist/esm/common/progressBar/progressBar.mjs.map +1 -1
  193. package/dist/esm/common/progressBar/progressBar.module.mjs +1 -1
  194. package/dist/esm/common/progressBar/progressBar.module.mjs.map +1 -1
  195. package/dist/esm/common/roomDrawer/roomDrawer.mjs +1 -1
  196. package/dist/esm/common/roomDrawer/roomDrawer.mjs.map +1 -1
  197. package/dist/esm/common/roomDrawer/roomDrawer.module.mjs.map +1 -1
  198. package/dist/esm/common/roomViewer/roomViewer.mjs +1 -1
  199. package/dist/esm/common/roomViewer/roomViewer.mjs.map +1 -1
  200. package/dist/esm/common/sectionHeader/sectionHeader.mjs.map +1 -1
  201. package/dist/esm/common/splitButton/splitButton.mjs +1 -1
  202. package/dist/esm/common/splitButton/splitButton.mjs.map +1 -1
  203. package/dist/esm/common/styles/tone.mjs +4 -0
  204. package/dist/esm/common/styles/tone.mjs.map +1 -0
  205. package/dist/esm/common/styles/tone.module.mjs +2 -0
  206. package/dist/esm/common/styles/tone.module.mjs.map +1 -0
  207. package/dist/esm/common/themeProvider/color.types.mjs +2 -0
  208. package/dist/esm/common/themeProvider/color.types.mjs.map +1 -0
  209. package/dist/esm/common/themeProvider/defaultTheme.mjs +1 -1
  210. package/dist/esm/common/themeProvider/defaultTheme.mjs.map +1 -1
  211. package/dist/esm/common/tilt/tilt.mjs +1 -1
  212. package/dist/esm/common/tilt/tilt.mjs.map +1 -1
  213. package/dist/esm/common/timeInput/timeInput.mjs +1 -1
  214. package/dist/esm/common/timeInput/timeInput.mjs.map +1 -1
  215. package/dist/esm/common/timeline/timeline.mjs +1 -1
  216. package/dist/esm/common/timeline/timeline.mjs.map +1 -1
  217. package/dist/esm/common/timeline/timeline.module.mjs +1 -1
  218. package/dist/esm/common/timeline/timeline.module.mjs.map +1 -1
  219. package/dist/esm/common/timeline/timeline.types.mjs +1 -1
  220. package/dist/esm/common/timeline/timeline.types.mjs.map +1 -1
  221. package/dist/esm/common/timer/timer.mjs +1 -1
  222. package/dist/esm/common/timer/timer.mjs.map +1 -1
  223. package/dist/esm/common/timer/timer.module.mjs +1 -1
  224. package/dist/esm/common/timer/timer.module.mjs.map +1 -1
  225. package/dist/esm/common/toast/toast.mjs +1 -1
  226. package/dist/esm/common/toast/toast.mjs.map +1 -1
  227. package/dist/esm/common/toast/toast.module.mjs +1 -1
  228. package/dist/esm/common/toast/toast.module.mjs.map +1 -1
  229. package/dist/esm/common/toast/toastHost.mjs +1 -1
  230. package/dist/esm/common/toast/toastHost.mjs.map +1 -1
  231. package/dist/esm/common/utils/dismissClick.mjs +2 -0
  232. package/dist/esm/common/utils/dismissClick.mjs.map +1 -0
  233. package/dist/esm/common/utils/isDev.mjs +2 -0
  234. package/dist/esm/common/utils/isDev.mjs.map +1 -0
  235. package/dist/esm/floor-plan.mjs +1 -0
  236. package/dist/esm/index.mjs +1 -1
  237. package/dist/esm/services/formValidation/FormValidatorGroupWithForm.mjs +1 -1
  238. package/dist/esm/services/formValidation/FormValidatorGroupWithForm.mjs.map +1 -1
  239. package/dist/floor-plan.cjs +1 -0
  240. package/dist/floorPlan-DLe5XAx6.cjs +2 -0
  241. package/dist/floorPlan-DLe5XAx6.cjs.map +1 -0
  242. package/dist/index.cjs +5 -3
  243. package/dist/index.cjs.map +1 -1
  244. package/dist/style.css +1 -1
  245. package/dist/types/common/accordion/accordion.types.d.ts +17 -2
  246. package/dist/types/common/actionButtons/actionButtons.types.d.ts +7 -1
  247. package/dist/types/common/actionIcon/actionIcon.d.ts +1 -1
  248. package/dist/types/common/actionIcon/actionIcon.types.d.ts +7 -9
  249. package/dist/types/common/alert/alert.types.d.ts +6 -8
  250. package/dist/types/common/animatedLogo/animatedLogo.types.d.ts +3 -2
  251. package/dist/types/common/badge/badge.types.d.ts +10 -6
  252. package/dist/types/common/button/button.types.d.ts +14 -4
  253. package/dist/types/common/calendar/calendar.types.d.ts +25 -10
  254. package/dist/types/common/calendar/components/agendaList/agendaList.d.ts +1 -1
  255. package/dist/types/common/calendar/components/agendaList/agendaList.types.d.ts +3 -0
  256. package/dist/types/common/calendar/components/calendarHeader/calendarHeader.d.ts +1 -1
  257. package/dist/types/common/calendar/components/calendarHeader/calendarHeader.types.d.ts +2 -0
  258. package/dist/types/common/calendar/components/compactMonth/compactMonth.d.ts +1 -1
  259. package/dist/types/common/calendar/components/monthView/monthView.d.ts +1 -1
  260. package/dist/types/common/calendar/components/monthView/monthView.types.d.ts +3 -2
  261. package/dist/types/common/calendar/components/timeGrid/timeGrid.d.ts +1 -1
  262. package/dist/types/common/calendar/components/timeGrid/timeGrid.types.d.ts +9 -1
  263. package/dist/types/common/calendar/dates.d.ts +21 -5
  264. package/dist/types/common/calendar/format.d.ts +3 -2
  265. package/dist/types/common/calendar/layout.d.ts +5 -0
  266. package/dist/types/common/calendar/useNow.d.ts +4 -0
  267. package/dist/types/common/calendar/view.types.d.ts +9 -2
  268. package/dist/types/common/card/card.types.d.ts +16 -2
  269. package/dist/types/common/chip/chip.types.d.ts +10 -5
  270. package/dist/types/common/copyButton/copyButton.types.d.ts +5 -4
  271. package/dist/types/common/fab/components/fabBase/fabBase.d.ts +1 -1
  272. package/dist/types/common/fab/components/fabBase/fabBase.types.d.ts +2 -1
  273. package/dist/types/common/floorPlan/floorPlan.graph.d.ts +10 -3
  274. package/dist/types/common/floorPlan/floorPlan.plan.d.ts +5 -0
  275. package/dist/types/common/floorPlan/floorPlan.rooms.d.ts +6 -2
  276. package/dist/types/common/floorPlan/floorPlan.snap.d.ts +1 -3
  277. package/dist/types/common/floorPlan/index.d.ts +1 -3
  278. package/dist/types/common/planCanvas/planCanvas.types.d.ts +1 -1
  279. package/dist/types/common/progressBar/progressBar.d.ts +0 -1
  280. package/dist/types/common/progressBar/progressBar.types.d.ts +3 -1
  281. package/dist/types/common/roomDrawer/roomDrawer.types.d.ts +29 -8
  282. package/dist/types/common/roomViewer/roomViewer.types.d.ts +4 -2
  283. package/dist/types/common/splitButton/splitButton.types.d.ts +4 -1
  284. package/dist/types/common/styles/tone.d.ts +11 -0
  285. package/dist/types/common/themeProvider/color.types.d.ts +20 -0
  286. package/dist/types/common/themeProvider/index.d.ts +2 -0
  287. package/dist/types/common/themeProvider/theme.types.d.ts +3 -6
  288. package/dist/types/common/timeline/timeline.types.d.ts +3 -10
  289. package/dist/types/common/toast/index.d.ts +1 -1
  290. package/dist/types/common/toast/toast.types.d.ts +7 -3
  291. package/dist/types/common/types/actions.types.d.ts +1 -1
  292. package/dist/types/common/utils/dismissClick.d.ts +4 -0
  293. package/dist/types/common/utils/isDev.d.ts +1 -0
  294. package/docs/Accordion.md +74 -5
  295. package/docs/ActionButtons.md +6 -3
  296. package/docs/ActionIcon.md +39 -14
  297. package/docs/Alert.md +27 -17
  298. package/docs/AnimatedLogo.md +1 -1
  299. package/docs/Badge.md +24 -7
  300. package/docs/Button.md +98 -40
  301. package/docs/ButtonGroup.md +18 -18
  302. package/docs/CLAUDE.md +24 -12
  303. package/docs/Calendar.md +35 -17
  304. package/docs/Card.md +53 -14
  305. package/docs/Chip.md +24 -9
  306. package/docs/ConfigProvider.md +3 -3
  307. package/docs/CopyButton.md +6 -5
  308. package/docs/FloorPlan.md +18 -14
  309. package/docs/ProgressBar.md +7 -4
  310. package/docs/RoomDrawer.md +42 -13
  311. package/docs/RoomViewer.md +1 -14
  312. package/docs/SectionHeader.md +1 -1
  313. package/docs/SplitButton.md +6 -5
  314. package/docs/ThemeColor.md +103 -0
  315. package/docs/ThemeProvider.md +5 -5
  316. package/docs/Timeline.md +18 -9
  317. package/docs/Toast.md +25 -11
  318. package/package.json +20 -2
  319. package/dist/cjs-types/common/floorPlan/legacySvg.d.ts +0 -27
  320. package/dist/esm/common/accordion/accordion.plain.module.mjs +0 -2
  321. package/dist/esm/common/accordion/accordion.plain.module.mjs.map +0 -1
  322. package/dist/esm/common/accordion/accordion.primary.module.mjs +0 -2
  323. package/dist/esm/common/accordion/accordion.primary.module.mjs.map +0 -1
  324. package/dist/esm/common/alert/alert.types.mjs +0 -2
  325. package/dist/esm/common/alert/alert.types.mjs.map +0 -1
  326. package/dist/esm/common/floorPlan/legacySvg.mjs +0 -2
  327. package/dist/esm/common/floorPlan/legacySvg.mjs.map +0 -1
  328. package/dist/types/common/floorPlan/legacySvg.d.ts +0 -27
@@ -1,2 +1,2 @@
1
- "use client";import{OpeningKind as e}from"../floorPlan/floorPlan.types.mjs";import{buildWallPaths as t,openingGeometry as n}from"../floorPlan/floorPlan.path.mjs";import r from"./planCanvas.module.mjs";import{useMemo as i}from"react";import a from"classnames";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";var l=1,u=[];function d(e){let t=e/1e6;return`${t.toFixed(+(t<10))} m²`}function f(e){return e.length===0?``:`${e.map((e,t)=>`${t===0?`M`:`L`} ${e.x},${e.y}`).join(` `)} Z`}function p(e){return[f(e.outer),...e.holes.map(f)].filter(Boolean).join(` `)}function m(f){let{ref:m,floor:h,underlay:g,rooms:_,view:v,selection:y=u,hovered:b=null,interactiveRooms:x=!1,interactiveOpenings:S=!1,showGrid:C=!1,gridSize:w=100,showRoomLabels:T=!0,showOpeningSymbols:E=!0,getRoomColor:D,renderRoomLabel:O,getRoomLabel:k,formatArea:A=d,onRoomActivate:j,onOpeningActivate:M,onBackgroundActivate:N,onHoverChange:P,overlay:F,worldOverlay:I,size:L,className:R,style:z,classNames:B,styles:V,"aria-label":H}=f,U=v.zoom>0?1/v.zoom:1,W=l*U,G=i(()=>t(h),[h]),K=i(()=>g?Object.values(g.walls).flatMap(e=>{let t=g.nodes[e.a],n=g.nodes[e.b];return t&&n?[{id:e.id,x1:t.x,y1:t.y,x2:n.x,y2:n.y}]:[]}):[],[g]),q=e=>({x:(e.x-v.x)*v.zoom,y:(e.y-v.y)*v.zoom}),J=i(()=>{if(!C||w<=0)return null;let e=L.width*U,t=L.height*U,n=w*Math.max(1,10**Math.ceil(Math.log10(e/w/60))),r=Math.floor(v.x/n)*n,i=Math.floor(v.y/n)*n,a=[],o=[];for(let t=r;t<=v.x+e;t+=n)a.push(t);for(let e=i;e<=v.y+t;e+=n)o.push(e);return{verticals:a,horizontals:o,step:n,worldW:e,worldH:t}},[C,w,L.width,L.height,U,v.x,v.y]),Y=(e,t)=>y.some(n=>n.type===e&&n.id===t),X=(e,t)=>b?.type===e&&b.id===t,Z=i(()=>{let e=new Set(y.filter(e=>e.type===`room`).map(e=>e.id)),t=new Set;for(let n of _)if(n.roomId&&e.has(n.roomId))for(let e of n.wallIds)t.add(e);return t},[_,y]),Q=i(()=>Z.size>0?t(h,{wallIds:Z}):{groups:[],caps:[]},[h,Z]);function $(t){let i=n(h,t);if(!i)return null;let o=h.walls[t.wallId],l=o?o.thickness/2:50,{p1:u,p2:d,normal:f,dir:p,centre:m}=i,g=Y(`opening`,t.id),_=X(`opening`,t.id),v=Math.hypot(d.x-u.x,d.y-u.y),y=[];if(E&&t.kind===e.Door){let e=t.swing!==`endLeft`&&t.swing!==`endRight`,n=e?u:d,i=e?1:-1,a={x:n.x+f.x*v,y:n.y+f.y*v},o={x:n.x+p.x*v*i,y:n.y+p.y*v*i};y.push(s(`path`,{className:r.planCanvasDoorLeaf,d:`M ${n.x},${n.y} L ${a.x},${a.y}`,strokeWidth:W},`leaf`),s(`path`,{className:r.planCanvasDoorSwing,d:`M ${a.x},${a.y} A ${v},${v} 0 0,${+!e} ${o.x},${o.y}`,strokeWidth:W},`swing`))}E&&t.kind===e.Window&&y.push(s(`path`,{className:r.planCanvasWindowPane,d:`M ${u.x},${u.y} L ${d.x},${d.y}`,strokeWidth:W*2},`pane`));let b=`M ${u.x+f.x*l},${u.y+f.y*l} L ${d.x+f.x*l},${d.y+f.y*l} L ${d.x-f.x*l},${d.y-f.y*l} L ${u.x-f.x*l},${u.y-f.y*l} Z`;return c(`g`,{className:a(g&&r.planCanvasOpeningSelected,_&&r.planCanvasOpeningHovered,B?.opening),style:V?.opening,"data-opening-kind":t.kind,children:[y,s(`path`,{className:a(r.planCanvasOpeningHit,S&&r.planCanvasOpeningHitInteractive),d:b,onClick:S&&M?e=>{e.stopPropagation(),M(t.id)}:void 0,onPointerEnter:P?()=>P({type:`opening`,id:t.id}):void 0,children:S&&s(`title`,{children:t.kind})}),(g||_)&&s(`path`,{className:r.planCanvasOpeningOutline,d:b,vectorEffect:`non-scaling-stroke`}),s(`path`,{className:a(r.planCanvasJamb,Z.has(t.wallId)&&r.planCanvasJambHighlighted),d:`M ${u.x-f.x*l},${u.y-f.y*l} L ${u.x+f.x*l},${u.y+f.y*l} M ${d.x-f.x*l},${d.y-f.y*l} L ${d.x+f.x*l},${d.y+f.y*l}`,strokeWidth:W}),m&&null]},t.id)}return c(`svg`,{ref:m,className:a(r.planCanvas,R,B?.canvas),style:{...z,...V?.canvas},viewBox:`0 0 ${Math.max(1,L.width)} ${Math.max(1,L.height)}`,width:L.width,height:L.height,role:`img`,"aria-label":H,onClick:N?()=>N():void 0,onPointerLeave:P?()=>P(null):void 0,children:[c(`g`,{transform:`translate(${-v.x*v.zoom} ${-v.y*v.zoom}) scale(${v.zoom})`,children:[J&&c(`g`,{className:a(r.planCanvasGrid,B?.grid),style:V?.grid,"aria-hidden":`true`,children:[J.verticals.map(e=>s(`line`,{x1:e,y1:v.y,x2:e,y2:v.y+J.worldH,strokeWidth:U},`v${e}`)),J.horizontals.map(e=>s(`line`,{x1:v.x,y1:e,x2:v.x+J.worldW,y2:e,strokeWidth:U},`h${e}`))]}),K.length>0&&s(`g`,{className:a(r.planCanvasUnderlay,B?.underlay),style:V?.underlay,"aria-hidden":`true`,children:K.map(e=>s(`line`,{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,strokeWidth:1.5},e.id))}),s(`g`,{className:a(r.planCanvasRooms,B?.rooms),style:V?.rooms,children:_.map(e=>{let t=e.roomId?Y(`room`,e.roomId):!1,n=e.roomId?X(`room`,e.roomId):!1,i=e.meta?D?.(e.meta,e.area):void 0,o=k?.(e.meta,{area:e.area})??`${e.meta?.name??`Unnamed room`}, ${A(e.area)}`;return s(`path`,{className:a(r.planCanvasRoomFill,n&&r.planCanvasRoomFillHovered,x&&r.planCanvasRoomFillInteractive,B?.roomFill),"data-state":t?`selected`:n?`hovered`:void 0,style:{...V?.roomFill,...i?{fill:i}:null},d:p(e),fillRule:`evenodd`,tabIndex:x?0:void 0,role:x?`button`:void 0,"aria-pressed":x?t:void 0,onClick:x&&j&&e.roomId?t=>{t.stopPropagation(),j(e.roomId)}:void 0,onKeyDown:x&&j&&e.roomId?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),j(e.roomId))}:void 0,onPointerEnter:P&&e.roomId?()=>P({type:`room`,id:e.roomId}):void 0,children:x&&s(`title`,{children:o})},e.id)})}),c(`g`,{className:a(r.planCanvasWalls,B?.walls),style:V?.walls,"aria-hidden":`true`,children:[s(`g`,{className:r.planCanvasWallOutline,children:G.groups.map(e=>s(`path`,{className:B?.wallBody,style:V?.wallBody,d:e.d,strokeWidth:e.thickness},`o${e.thickness}`))}),s(`g`,{className:r.planCanvasWallFill,children:G.groups.map(e=>{let t=e.thickness-2*W;return t<=0?null:s(`path`,{d:e.d,strokeWidth:t},`f${e.thickness}`)})}),c(`g`,{className:r.planCanvasRoomEdgeSelected,children:[Q.groups.map(e=>s(`path`,{className:r.planCanvasRoomEdgeOutline,d:e.d,strokeWidth:e.thickness},`o${e.thickness}`)),Q.groups.map(e=>{let t=e.thickness-2*W;return t<=0?null:s(`path`,{className:r.planCanvasRoomEdgeFill,d:e.d,strokeWidth:t},`f${e.thickness}`)})]}),s(`g`,{className:r.planCanvasWallCaps,children:G.caps.filter(e=>!Z.has(e.wallId)).map((e,t)=>s(`line`,{x1:e.a.x,y1:e.a.y,x2:e.b.x,y2:e.b.y,strokeWidth:W},`${e.wallId}-${e.reason}-${t}`))}),s(`g`,{className:r.planCanvasRoomEdgeCaps,children:Q.caps.map((e,t)=>s(`line`,{x1:e.a.x,y1:e.a.y,x2:e.b.x,y2:e.b.y,strokeWidth:W},`${e.wallId}-${e.reason}-${t}`))})]}),s(`g`,{className:a(r.planCanvasOpenings,B?.openings),style:V?.openings,children:Object.values(h.openings).map($)}),c(`g`,{className:r.planCanvasSelection,"aria-hidden":`true`,children:[y.filter(e=>e.type===`wall`).map(e=>{let t=h.walls[e.id];if(!t)return null;let n=h.nodes[t.a],i=h.nodes[t.b];return!n||!i?null:s(`line`,{x1:n.x,y1:n.y,x2:i.x,y2:i.y,strokeWidth:t.thickness,className:r.planCanvasWallSelected},e.id)}),b?.type===`wall`&&!Y(`wall`,b.id)&&(()=>{let e=h.walls[b.id];if(!e)return null;let t=h.nodes[e.a],n=h.nodes[e.b];return!t||!n?null:s(`line`,{x1:t.x,y1:t.y,x2:n.x,y2:n.y,strokeWidth:e.thickness,className:r.planCanvasWallHovered})})()]}),I]}),c(`g`,{className:a(r.planCanvasScreen,B?.overlay),style:V?.overlay,children:[T&&_.map(e=>{let t=q(e.anchor);if(t.x<-200||t.y<-200||t.x>L.width+200||t.y>L.height+200)return null;let n=O?.(e.meta,{area:e.area,faceId:e.id});return n===null?null:s(`g`,{className:a(r.planCanvasRoomLabel,B?.roomLabel),style:V?.roomLabel,transform:`translate(${t.x} ${t.y})`,"aria-hidden":`true`,children:n===void 0?c(o,{children:[s(`text`,{className:r.planCanvasRoomName,textAnchor:`middle`,children:e.meta?.name??``}),s(`text`,{className:r.planCanvasRoomArea,textAnchor:`middle`,dy:`1.2em`,children:A(e.area)})]}):n},e.id)}),F]})]})}export{m as default};
1
+ "use client";import{OpeningKind as e}from"../floorPlan/floorPlan.types.mjs";import{buildWallPaths as t,openingGeometry as n}from"../floorPlan/floorPlan.path.mjs";import r from"./planCanvas.module.mjs";import{useMemo as i}from"react";import a from"classnames";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";var l=1,u=[];function d(e){let t=e/1e6;return`${t.toFixed(+(t<10))} m²`}function f(e){return e.length===0?``:`${e.map((e,t)=>`${t===0?`M`:`L`} ${e.x},${e.y}`).join(` `)} Z`}function p(e){return[f(e.outer),...e.holes.map(f)].filter(Boolean).join(` `)}function m(f){let{ref:m,floor:h,underlay:g,rooms:_,view:v,selection:y=u,hovered:b=null,interactiveRooms:x=!1,interactiveOpenings:S=!1,showGrid:C=!1,gridSize:w=100,showRoomLabels:T=!0,showOpeningSymbols:E=!0,getRoomColor:D,renderRoomLabel:O,getRoomLabel:k,formatArea:A=d,onRoomActivate:j,onOpeningActivate:M,onBackgroundActivate:N,onHoverChange:P,overlay:F,worldOverlay:I,size:L,className:R,style:z,classNames:B,styles:V,"aria-label":H}=f,U=v.zoom>0?1/v.zoom:1,W=l*U,G=i(()=>t(h),[h]),K=i(()=>g?Object.values(g.walls).flatMap(e=>{let t=g.nodes[e.a],n=g.nodes[e.b];return t&&n?[{id:e.id,x1:t.x,y1:t.y,x2:n.x,y2:n.y}]:[]}):[],[g]),q=e=>({x:(e.x-v.x)*v.zoom,y:(e.y-v.y)*v.zoom}),J=i(()=>{if(!C||w<=0)return null;let e=L.width*U,t=L.height*U,n=w*Math.max(1,10**Math.ceil(Math.log10(e/w/60))),r=Math.floor(v.x/n)*n,i=Math.floor(v.y/n)*n,a=[],o=[];for(let t=r;t<=v.x+e;t+=n)a.push(t);for(let e=i;e<=v.y+t;e+=n)o.push(e);return{verticals:a,horizontals:o,step:n,worldW:e,worldH:t}},[C,w,L.width,L.height,U,v.x,v.y]),Y=(e,t)=>y.some(n=>n.type===e&&n.id===t),X=(e,t)=>b?.type===e&&b.id===t,Z=i(()=>{let e=new Set(y.filter(e=>e.type===`room`).map(e=>e.id)),t=new Set;for(let n of _)if(n.roomId&&e.has(n.roomId))for(let e of n.wallIds)t.add(e);return t},[_,y]),Q=i(()=>Z.size>0?t(h,{wallIds:Z}):{groups:[],caps:[]},[h,Z]);function $(t){let i=n(h,t);if(!i)return null;let o=h.walls[t.wallId],l=o?o.thickness/2:50,{p1:u,p2:d,normal:f,dir:p,centre:m}=i,g=Y(`opening`,t.id),_=X(`opening`,t.id),v=Math.hypot(d.x-u.x,d.y-u.y),y=[];if(E&&t.kind===e.Door){let e=t.swing!==`endLeft`&&t.swing!==`endRight`,n=e?u:d,i=e?1:-1,a={x:n.x+f.x*v,y:n.y+f.y*v},o={x:n.x+p.x*v*i,y:n.y+p.y*v*i};y.push(s(`path`,{className:r.planCanvasDoorLeaf,d:`M ${n.x},${n.y} L ${a.x},${a.y}`,strokeWidth:W},`leaf`),s(`path`,{className:r.planCanvasDoorSwing,d:`M ${a.x},${a.y} A ${v},${v} 0 0,${+!e} ${o.x},${o.y}`,strokeWidth:W},`swing`))}E&&t.kind===e.Window&&y.push(s(`path`,{className:r.planCanvasWindowPane,d:`M ${u.x},${u.y} L ${d.x},${d.y}`,strokeWidth:W*2},`pane`));let b=`M ${u.x+f.x*l},${u.y+f.y*l} L ${d.x+f.x*l},${d.y+f.y*l} L ${d.x-f.x*l},${d.y-f.y*l} L ${u.x-f.x*l},${u.y-f.y*l} Z`;return c(`g`,{className:a(g&&r.planCanvasOpeningSelected,_&&r.planCanvasOpeningHovered,B?.opening),style:V?.opening,"data-opening-kind":t.kind,children:[y,s(`path`,{className:a(r.planCanvasOpeningHit,S&&r.planCanvasOpeningHitInteractive),d:b,onClick:S&&M?e=>{e.stopPropagation(),M(t.id)}:void 0,onPointerEnter:P?()=>P({type:`opening`,id:t.id}):void 0,children:S&&s(`title`,{children:t.kind})}),(g||_)&&s(`path`,{className:r.planCanvasOpeningOutline,d:b,vectorEffect:`non-scaling-stroke`}),s(`path`,{className:a(r.planCanvasJamb,Z.has(t.wallId)&&r.planCanvasJambHighlighted),d:`M ${u.x-f.x*l},${u.y-f.y*l} L ${u.x+f.x*l},${u.y+f.y*l} M ${d.x-f.x*l},${d.y-f.y*l} L ${d.x+f.x*l},${d.y+f.y*l}`,strokeWidth:W}),m&&null]},t.id)}return c(`svg`,{ref:m,className:a(r.planCanvas,R,B?.canvas),style:{...z,...V?.canvas},viewBox:`0 0 ${Math.max(1,L.width)} ${Math.max(1,L.height)}`,width:L.width,height:L.height,role:`img`,"aria-label":H,onClick:N?()=>N():void 0,onPointerLeave:P?()=>P(null):void 0,children:[c(`g`,{transform:`translate(${-v.x*v.zoom} ${-v.y*v.zoom}) scale(${v.zoom})`,children:[J&&c(`g`,{className:a(r.planCanvasGrid,B?.grid),style:V?.grid,"aria-hidden":`true`,children:[J.verticals.map(e=>s(`line`,{x1:e,y1:v.y,x2:e,y2:v.y+J.worldH,strokeWidth:U},`v${e}`)),J.horizontals.map(e=>s(`line`,{x1:v.x,y1:e,x2:v.x+J.worldW,y2:e,strokeWidth:U},`h${e}`))]}),K.length>0&&s(`g`,{className:a(r.planCanvasUnderlay,B?.underlay),style:V?.underlay,"aria-hidden":`true`,children:K.map(e=>s(`line`,{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,strokeWidth:1.5},e.id))}),s(`g`,{className:a(r.planCanvasRooms,B?.rooms),style:V?.rooms,children:_.map(e=>{let t=e.roomId?Y(`room`,e.roomId):!1,n=e.roomId?X(`room`,e.roomId):!1,i=e.meta?D?.(e.meta,e.area):void 0,o=k?.(e.meta,{area:e.area});return s(`path`,{className:a(r.planCanvasRoomFill,n&&r.planCanvasRoomFillHovered,x&&r.planCanvasRoomFillInteractive,B?.roomFill),"data-state":t?`selected`:n?`hovered`:void 0,style:{...V?.roomFill,...i?{fill:i}:null},d:p(e),fillRule:`evenodd`,tabIndex:x?0:void 0,role:x?`button`:void 0,"aria-pressed":x?t:void 0,onClick:x&&j&&e.roomId?t=>{t.stopPropagation(),j(e.roomId)}:void 0,onKeyDown:x&&j&&e.roomId?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),j(e.roomId))}:void 0,onPointerEnter:P&&e.roomId?()=>P({type:`room`,id:e.roomId}):void 0,children:x&&o&&s(`title`,{children:o})},e.id)})}),c(`g`,{className:a(r.planCanvasWalls,B?.walls),style:V?.walls,"aria-hidden":`true`,children:[s(`g`,{className:r.planCanvasWallOutline,children:G.groups.map(e=>s(`path`,{className:B?.wallBody,style:V?.wallBody,d:e.d,strokeWidth:e.thickness},`o${e.thickness}`))}),s(`g`,{className:r.planCanvasWallFill,children:G.groups.map(e=>{let t=e.thickness-2*W;return t<=0?null:s(`path`,{d:e.d,strokeWidth:t},`f${e.thickness}`)})}),c(`g`,{className:r.planCanvasRoomEdgeSelected,children:[Q.groups.map(e=>s(`path`,{className:r.planCanvasRoomEdgeOutline,d:e.d,strokeWidth:e.thickness},`o${e.thickness}`)),Q.groups.map(e=>{let t=e.thickness-2*W;return t<=0?null:s(`path`,{className:r.planCanvasRoomEdgeFill,d:e.d,strokeWidth:t},`f${e.thickness}`)})]}),s(`g`,{className:r.planCanvasWallCaps,children:G.caps.filter(e=>!Z.has(e.wallId)).map((e,t)=>s(`line`,{x1:e.a.x,y1:e.a.y,x2:e.b.x,y2:e.b.y,strokeWidth:W},`${e.wallId}-${e.reason}-${t}`))}),s(`g`,{className:r.planCanvasRoomEdgeCaps,children:Q.caps.map((e,t)=>s(`line`,{x1:e.a.x,y1:e.a.y,x2:e.b.x,y2:e.b.y,strokeWidth:W},`${e.wallId}-${e.reason}-${t}`))})]}),s(`g`,{className:a(r.planCanvasOpenings,B?.openings),style:V?.openings,children:Object.values(h.openings).map($)}),c(`g`,{className:r.planCanvasSelection,"aria-hidden":`true`,children:[y.filter(e=>e.type===`wall`).map(e=>{let t=h.walls[e.id];if(!t)return null;let n=h.nodes[t.a],i=h.nodes[t.b];return!n||!i?null:s(`line`,{x1:n.x,y1:n.y,x2:i.x,y2:i.y,strokeWidth:t.thickness,className:r.planCanvasWallSelected},e.id)}),b?.type===`wall`&&!Y(`wall`,b.id)&&(()=>{let e=h.walls[b.id];if(!e)return null;let t=h.nodes[e.a],n=h.nodes[e.b];return!t||!n?null:s(`line`,{x1:t.x,y1:t.y,x2:n.x,y2:n.y,strokeWidth:e.thickness,className:r.planCanvasWallHovered})})()]}),I]}),c(`g`,{className:a(r.planCanvasScreen,B?.overlay),style:V?.overlay,children:[T&&_.map(e=>{let t=q(e.anchor);if(t.x<-200||t.y<-200||t.x>L.width+200||t.y>L.height+200)return null;let n=O?.(e.meta,{area:e.area,faceId:e.id});return n===null?null:s(`g`,{className:a(r.planCanvasRoomLabel,B?.roomLabel),style:V?.roomLabel,transform:`translate(${t.x} ${t.y})`,"aria-hidden":`true`,children:n===void 0?c(o,{children:[s(`text`,{className:r.planCanvasRoomName,textAnchor:`middle`,children:e.meta?.name??``}),s(`text`,{className:r.planCanvasRoomArea,textAnchor:`middle`,dy:`1.2em`,children:A(e.area)})]}):n},e.id)}),F]})]})}export{m as default};
2
2
  //# sourceMappingURL=planCanvas.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"planCanvas.mjs","names":[],"sources":["../../../../package/common/planCanvas/planCanvas.tsx"],"sourcesContent":["import { useMemo, type ReactElement } from 'react';\nimport cx from 'classnames';\n\nimport {\n OpeningKind,\n buildWallPaths,\n openingGeometry,\n type DerivedRoom,\n type PlanOpening,\n type PlanPoint,\n type PlanSelection,\n} from '../floorPlan';\nimport type { PlanCanvasProps } from './planCanvas.types';\nimport styles from './planCanvas.module.pcss';\n\n/**\n * The read-only renderer shared by RoomDrawer and RoomViewer.\n *\n * It owns the projection, the layer stack, and the accessible room shapes. It owns no\n * editing state: the drawer supplies its handles and previews through `overlay`. Having\n * one renderer is the point, so that a plan cannot look different in the editor than it\n * does in the viewer.\n *\n * The viewport is a TRANSFORM on a group, not an SVG `viewBox`. That is what lets the\n * screen-space layer draw labels and handles at a fixed pixel size while the drawing\n * itself scales.\n */\n\nconst DEFAULT_OUTLINE_PX = 1;\n\n/** Stable identity, so a default-valued `selection` prop does not re-run memos. */\nconst EMPTY_SELECTION: readonly PlanSelection[] = [];\n\nfunction formatAreaDefault(areaMm2: number): string {\n const m2 = areaMm2 / 1_000_000;\n return `${m2.toFixed(m2 < 10 ? 1 : 0)} m²`;\n}\n\nfunction ringToPath(ring: PlanPoint[]): string {\n if (ring.length === 0) return '';\n return `${ring.map((p, i) => `${i === 0 ? 'M' : 'L'} ${p.x},${p.y}`).join(' ')} Z`;\n}\n\n/** Outer ring plus holes as one path; `fill-rule: evenodd` punches the holes out. */\nfunction faceToPath(face: DerivedRoom): string {\n return [ringToPath(face.outer), ...face.holes.map(ringToPath)].filter(Boolean).join(' ');\n}\n\n/**\n * The ref lands on the `<svg>` itself, which is what a consumer wants for measuring or\n * screenshotting. Both the drawer and the viewer expose it as `getSvgElement()`.\n */\nfunction PlanCanvas(props: PlanCanvasProps) {\n const {\n ref,\n floor,\n underlay,\n rooms,\n view,\n selection = EMPTY_SELECTION,\n hovered = null,\n interactiveRooms = false,\n interactiveOpenings = false,\n showGrid = false,\n gridSize = 100,\n showRoomLabels = true,\n showOpeningSymbols = true,\n getRoomColor,\n renderRoomLabel,\n getRoomLabel,\n formatArea = formatAreaDefault,\n onRoomActivate,\n onOpeningActivate,\n onBackgroundActivate,\n onHoverChange,\n overlay,\n worldOverlay,\n size,\n className,\n style,\n classNames,\n styles: slotStyles,\n 'aria-label': ariaLabel,\n } = props;\n\n const pxToWorld = view.zoom > 0 ? 1 / view.zoom : 1;\n const outlineWidth = DEFAULT_OUTLINE_PX * pxToWorld;\n\n const wallPaths = useMemo(() => buildWallPaths(floor), [floor]);\n\n /**\n * Centrelines only, at one stroke width. The underlay is there to line walls up\n * against, so it wants to read as a tracing rather than compete with the floor being\n * drawn; the two-pass thick-wall treatment would give it equal weight.\n */\n const underlayLines = useMemo(() => {\n if (!underlay) return [];\n return Object.values(underlay.walls).flatMap((wall) => {\n const a = underlay.nodes[wall.a];\n const b = underlay.nodes[wall.b];\n return a && b ? [{ id: wall.id, x1: a.x, y1: a.y, x2: b.x, y2: b.y }] : [];\n });\n }, [underlay]);\n\n /** World point to screen point, for the untransformed layer. */\n const toScreen = (p: PlanPoint) => ({\n x: (p.x - view.x) * view.zoom,\n y: (p.y - view.y) * view.zoom,\n });\n\n // Grid lines are generated for the visible rect only. Deliberately not an SVG\n // <pattern>: a pattern needs an id, and two canvases on one page then collide.\n const gridLines = useMemo(() => {\n if (!showGrid || gridSize <= 0) return null;\n const worldW = size.width * pxToWorld;\n const worldH = size.height * pxToWorld;\n // Keep the line count sane when zoomed far out.\n const step = gridSize * Math.max(1, Math.pow(10, Math.ceil(Math.log10(worldW / gridSize / 60))));\n const startX = Math.floor(view.x / step) * step;\n const startY = Math.floor(view.y / step) * step;\n const verticals: number[] = [];\n const horizontals: number[] = [];\n for (let x = startX; x <= view.x + worldW; x += step) verticals.push(x);\n for (let y = startY; y <= view.y + worldH; y += step) horizontals.push(y);\n return { verticals, horizontals, step, worldW, worldH };\n }, [showGrid, gridSize, size.width, size.height, pxToWorld, view.x, view.y]);\n\n const isSelected = (type: string, id: string) => selection.some((entry) => entry.type === type && entry.id === id);\n const isHovered = (type: string, id: string) => hovered?.type === type && hovered.id === id;\n\n /**\n * The walls bounding the selected rooms. A SELECTED room is marked by colouring its\n * boundary rather than by flooding its floor, which would bury its doors and its label;\n * hover keeps the faint floor tint instead, since the two say different things.\n */\n const highlightedWalls = useMemo(() => {\n const selectedRooms = new Set(selection.filter((entry) => entry.type === 'room').map((entry) => entry.id));\n const ids = new Set<string>();\n for (const room of rooms) {\n if (room.roomId && selectedRooms.has(room.roomId)) {\n // A wall shared by two selected rooms belongs to both; the set draws it once.\n for (const id of room.wallIds) ids.add(id);\n }\n }\n return ids;\n }, [rooms, selection]);\n\n const roomEdge = useMemo(\n () => (highlightedWalls.size > 0 ? buildWallPaths(floor, { wallIds: highlightedWalls }) : { groups: [], caps: [] }),\n [floor, highlightedWalls],\n );\n\n function renderOpening(opening: PlanOpening) {\n const geo = openingGeometry(floor, opening);\n if (!geo) return null;\n const wall = floor.walls[opening.wallId];\n const half = wall ? wall.thickness / 2 : 50;\n const { p1, p2, normal, dir, centre } = geo;\n\n const selected = isSelected('opening', opening.id);\n const hoveredNow = isHovered('opening', opening.id);\n const width = Math.hypot(p2.x - p1.x, p2.y - p1.y);\n\n const parts: ReactElement[] = [];\n\n if (showOpeningSymbols && opening.kind === OpeningKind.Door) {\n // Leaf plus swing arc, drawn on the wall's left side.\n const hingeAtStart = opening.swing !== 'endLeft' && opening.swing !== 'endRight';\n const hinge = hingeAtStart ? p1 : p2;\n const sweepDir = hingeAtStart ? 1 : -1;\n const leafEnd = { x: hinge.x + normal.x * width, y: hinge.y + normal.y * width };\n const arcEnd = {\n x: hinge.x + dir.x * width * sweepDir,\n y: hinge.y + dir.y * width * sweepDir,\n };\n parts.push(\n <path\n key='leaf'\n className={styles.planCanvasDoorLeaf}\n d={`M ${hinge.x},${hinge.y} L ${leafEnd.x},${leafEnd.y}`}\n strokeWidth={outlineWidth}\n />,\n <path\n key='swing'\n className={styles.planCanvasDoorSwing}\n d={`M ${leafEnd.x},${leafEnd.y} A ${width},${width} 0 0,${hingeAtStart ? 0 : 1} ${arcEnd.x},${arcEnd.y}`}\n strokeWidth={outlineWidth}\n />,\n );\n }\n\n if (showOpeningSymbols && opening.kind === OpeningKind.Window) {\n // A pane line down the middle of the wall's thickness.\n parts.push(\n <path\n key='pane'\n className={styles.planCanvasWindowPane}\n d={`M ${p1.x},${p1.y} L ${p2.x},${p2.y}`}\n strokeWidth={outlineWidth * 2}\n />,\n );\n }\n\n const hitPath = `M ${p1.x + normal.x * half},${p1.y + normal.y * half} L ${\n p2.x + normal.x * half\n },${p2.y + normal.y * half} L ${p2.x - normal.x * half},${p2.y - normal.y * half} L ${\n p1.x - normal.x * half\n },${p1.y - normal.y * half} Z`;\n\n return (\n <g\n key={opening.id}\n className={cx(\n selected && styles.planCanvasOpeningSelected,\n hoveredNow && styles.planCanvasOpeningHovered,\n classNames?.opening,\n )}\n style={slotStyles?.opening}\n data-opening-kind={opening.kind}\n >\n {parts}\n <path\n className={cx(styles.planCanvasOpeningHit, interactiveOpenings && styles.planCanvasOpeningHitInteractive)}\n d={hitPath}\n onClick={\n interactiveOpenings && onOpeningActivate\n ? (e) => {\n e.stopPropagation();\n onOpeningActivate(opening.id);\n }\n : undefined\n }\n onPointerEnter={onHoverChange ? () => onHoverChange({ type: 'opening', id: opening.id }) : undefined}\n >\n {interactiveOpenings && <title>{opening.kind}</title>}\n </path>\n {(selected || hoveredNow) && (\n <path className={styles.planCanvasOpeningOutline} d={hitPath} vectorEffect='non-scaling-stroke' />\n )}\n {/* The jamb faces, so an opening reads as a hole with sides rather than a blank. */}\n <path\n className={cx(\n styles.planCanvasJamb,\n // The jamb face belongs to the wall it is cut into, so it follows that wall\n // into the highlight rather than staying white against it.\n highlightedWalls.has(opening.wallId) && styles.planCanvasJambHighlighted,\n )}\n d={`M ${p1.x - normal.x * half},${p1.y - normal.y * half} L ${p1.x + normal.x * half},${\n p1.y + normal.y * half\n } M ${p2.x - normal.x * half},${p2.y - normal.y * half} L ${p2.x + normal.x * half},${\n p2.y + normal.y * half\n }`}\n strokeWidth={outlineWidth}\n />\n {centre && null}\n </g>\n );\n }\n\n return (\n <svg\n ref={ref}\n className={cx(styles.planCanvas, className, classNames?.canvas)}\n style={{ ...style, ...slotStyles?.canvas }}\n viewBox={`0 0 ${Math.max(1, size.width)} ${Math.max(1, size.height)}`}\n width={size.width}\n height={size.height}\n role='img'\n aria-label={ariaLabel}\n onClick={onBackgroundActivate ? () => onBackgroundActivate() : undefined}\n onPointerLeave={onHoverChange ? () => onHoverChange(null) : undefined}\n >\n <g transform={`translate(${-view.x * view.zoom} ${-view.y * view.zoom}) scale(${view.zoom})`}>\n {/* 1. Grid */}\n {gridLines && (\n <g className={cx(styles.planCanvasGrid, classNames?.grid)} style={slotStyles?.grid} aria-hidden='true'>\n {gridLines.verticals.map((x) => (\n <line key={`v${x}`} x1={x} y1={view.y} x2={x} y2={view.y + gridLines.worldH} strokeWidth={pxToWorld} />\n ))}\n {gridLines.horizontals.map((y) => (\n <line key={`h${y}`} x1={view.x} y1={y} x2={view.x + gridLines.worldW} y2={y} strokeWidth={pxToWorld} />\n ))}\n </g>\n )}\n\n {/* 1b. The storey below, traced */}\n {underlayLines.length > 0 && (\n <g\n className={cx(styles.planCanvasUnderlay, classNames?.underlay)}\n style={slotStyles?.underlay}\n aria-hidden='true'\n >\n {/* Screen units: the rule sets vector-effect: non-scaling-stroke, so the width\n is read in screen pixels rather than world millimetres. */}\n {underlayLines.map((line) => (\n <line key={line.id} x1={line.x1} y1={line.y1} x2={line.x2} y2={line.y2} strokeWidth={1.5} />\n ))}\n </g>\n )}\n\n {/* 2. Room fills — the only hit target for room selection */}\n <g className={cx(styles.planCanvasRooms, classNames?.rooms)} style={slotStyles?.rooms}>\n {rooms.map((room) => {\n const selected = room.roomId ? isSelected('room', room.roomId) : false;\n const hoveredNow = room.roomId ? isHovered('room', room.roomId) : false;\n const colour = room.meta ? getRoomColor?.(room.meta, room.area) : undefined;\n const label =\n getRoomLabel?.(room.meta, { area: room.area }) ??\n `${room.meta?.name ?? 'Unnamed room'}, ${formatArea(room.area)}`;\n\n return (\n <path\n key={room.id}\n className={cx(\n styles.planCanvasRoomFill,\n hoveredNow && styles.planCanvasRoomFillHovered,\n interactiveRooms && styles.planCanvasRoomFillInteractive,\n classNames?.roomFill,\n )}\n data-state={selected ? 'selected' : hoveredNow ? 'hovered' : undefined}\n style={{ ...slotStyles?.roomFill, ...(colour ? { fill: colour } : null) }}\n d={faceToPath(room)}\n fillRule='evenodd'\n tabIndex={interactiveRooms ? 0 : undefined}\n role={interactiveRooms ? 'button' : undefined}\n aria-pressed={interactiveRooms ? selected : undefined}\n onClick={\n interactiveRooms && onRoomActivate && room.roomId\n ? (e) => {\n e.stopPropagation();\n onRoomActivate(room.roomId!);\n }\n : undefined\n }\n onKeyDown={\n interactiveRooms && onRoomActivate && room.roomId\n ? (e) => {\n if (e.key !== 'Enter' && e.key !== ' ') return;\n e.preventDefault();\n onRoomActivate(room.roomId!);\n }\n : undefined\n }\n onPointerEnter={\n onHoverChange && room.roomId ? () => onHoverChange({ type: 'room', id: room.roomId! }) : undefined\n }\n >\n {/* Both a <title> and the aria-label: aria-label on SVG shapes is\n unreliable in older Safari/VoiceOver, and <title> doubles as the\n native tooltip. */}\n {interactiveRooms && <title>{label}</title>}\n </path>\n );\n })}\n </g>\n\n {/* 3. Wall bodies — outline pass, then fill pass. Never interleaved: the visible\n outline is what is left of the first pass after the second covers its middle. */}\n <g className={cx(styles.planCanvasWalls, classNames?.walls)} style={slotStyles?.walls} aria-hidden='true'>\n <g className={styles.planCanvasWallOutline}>\n {wallPaths.groups.map((group) => (\n <path\n key={`o${group.thickness}`}\n className={classNames?.wallBody}\n style={slotStyles?.wallBody}\n d={group.d}\n strokeWidth={group.thickness}\n />\n ))}\n </g>\n <g className={styles.planCanvasWallFill}>\n {wallPaths.groups.map((group) => {\n const fillWidth = group.thickness - 2 * outlineWidth;\n // Zoomed far out the fill would invert; walls collapsing to solid lines is\n // the right look at that scale.\n if (fillWidth <= 0) return null;\n return <path key={`f${group.thickness}`} d={group.d} strokeWidth={fillWidth} />;\n })}\n </g>\n <g className={styles.planCanvasRoomEdgeSelected}>\n {/* The same two passes the walls themselves use, on the same path data: an\n outline at full thickness, then a fill inside it. Recolouring only the body\n left the wall edged in its normal colour, so it did not read as one object. */}\n {roomEdge.groups.map((group) => (\n <path\n key={`o${group.thickness}`}\n className={styles.planCanvasRoomEdgeOutline}\n d={group.d}\n strokeWidth={group.thickness}\n />\n ))}\n {roomEdge.groups.map((group) => {\n const fillWidth = group.thickness - 2 * outlineWidth;\n if (fillWidth <= 0) return null;\n return (\n <path\n key={`f${group.thickness}`}\n className={styles.planCanvasRoomEdgeFill}\n d={group.d}\n strokeWidth={fillWidth}\n />\n );\n })}\n </g>\n\n <g className={styles.planCanvasWallCaps}>\n {/* A highlighted wall's caps are drawn below in the highlight colour. Skipped\n here rather than painted over: an antialiased hairline is never fully\n covered, and the two would blend into a pale seam. */}\n {wallPaths.caps\n .filter((cap) => !highlightedWalls.has(cap.wallId))\n .map((cap, i) => (\n <line\n key={`${cap.wallId}-${cap.reason}-${i}`}\n x1={cap.a.x}\n y1={cap.a.y}\n x2={cap.b.x}\n y2={cap.b.y}\n strokeWidth={outlineWidth}\n />\n ))}\n </g>\n <g className={styles.planCanvasRoomEdgeCaps}>\n {roomEdge.caps.map((cap, i) => (\n <line\n key={`${cap.wallId}-${cap.reason}-${i}`}\n x1={cap.a.x}\n y1={cap.a.y}\n x2={cap.b.x}\n y2={cap.b.y}\n strokeWidth={outlineWidth}\n />\n ))}\n </g>\n </g>\n\n {/* 4. Openings */}\n <g className={cx(styles.planCanvasOpenings, classNames?.openings)} style={slotStyles?.openings}>\n {Object.values(floor.openings).map(renderOpening)}\n </g>\n\n {/* 5. Selection / hover outlines for walls and nodes */}\n <g className={styles.planCanvasSelection} aria-hidden='true'>\n {selection\n .filter((entry) => entry.type === 'wall')\n .map((entry) => {\n const wall = floor.walls[entry.id];\n if (!wall) return null;\n const a = floor.nodes[wall.a];\n const b = floor.nodes[wall.b];\n if (!a || !b) return null;\n return (\n <line\n key={entry.id}\n x1={a.x}\n y1={a.y}\n x2={b.x}\n y2={b.y}\n strokeWidth={wall.thickness}\n className={styles.planCanvasWallSelected}\n />\n );\n })}\n {hovered?.type === 'wall' &&\n !isSelected('wall', hovered.id) &&\n (() => {\n const wall = floor.walls[hovered.id];\n if (!wall) return null;\n const a = floor.nodes[wall.a];\n const b = floor.nodes[wall.b];\n if (!a || !b) return null;\n return (\n <line\n x1={a.x}\n y1={a.y}\n x2={b.x}\n y2={b.y}\n strokeWidth={wall.thickness}\n className={styles.planCanvasWallHovered}\n />\n );\n })()}\n </g>\n\n {worldOverlay}\n </g>\n\n {/* Screen space: sized in pixels, so labels and handles stay constant under zoom */}\n <g className={cx(styles.planCanvasScreen, classNames?.overlay)} style={slotStyles?.overlay}>\n {showRoomLabels &&\n rooms.map((room) => {\n const at = toScreen(room.anchor);\n if (at.x < -200 || at.y < -200 || at.x > size.width + 200 || at.y > size.height + 200) {\n return null;\n }\n const custom = renderRoomLabel?.(room.meta, { area: room.area, faceId: room.id });\n if (custom === null) return null;\n\n return (\n <g\n key={room.id}\n className={cx(styles.planCanvasRoomLabel, classNames?.roomLabel)}\n style={slotStyles?.roomLabel}\n transform={`translate(${at.x} ${at.y})`}\n aria-hidden='true'\n >\n {custom !== undefined ? (\n custom\n ) : (\n <>\n <text className={styles.planCanvasRoomName} textAnchor='middle'>\n {room.meta?.name ?? ''}\n </text>\n <text className={styles.planCanvasRoomArea} textAnchor='middle' dy='1.2em'>\n {formatArea(room.area)}\n </text>\n </>\n )}\n </g>\n );\n })}\n {overlay}\n </g>\n </svg>\n );\n}\n\nexport default PlanCanvas;\n"],"mappings":"mUA4BA,IAAM,EAAqB,EAGrB,EAA4C,CAAC,EAEnD,SAAS,EAAkB,EAAyB,CAClD,IAAM,EAAK,EAAU,IACrB,MAAO,GAAG,EAAG,QAAQ,IAAK,GAAU,EAAE,IACxC,CAEA,SAAS,EAAW,EAA2B,CAE7C,OADI,EAAK,SAA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AC,GAAK,CAAC,EAAU,KAEnB,EAAC,OAAD,CACE,GAAI,EAAE,EACN,GAAI,EAAE,EACN,GAAI,EAAE,EACN,GAAI,EAAE,EACN,YAAa,EAAK,UAClB,UAAW,EAAO,qBACnB,CAAA,CAEL,EAAA,CAAG,CACJ,IAEF,CACA,CAGH,CAAA,EAAA,EAAC,IAAD,CAAG,UAAW,EAAG,EAAO,iBAAkB,GAAY,OAAO,EAAG,MAAO,GAAY,QAAnF,SAAA,CACG,GACC,EAAM,IAAK,GAAS,CAClB,IAAM,EAAK,EAAS,EAAK,MAAM,EAC/B,GAAI,EAAG,EAAI,MAAQ,EAAG,EAAI,MAAQ,EAAG,EAAI,EAAK,MAAQ,KAAO,EAAG,EAAI,EAAK,OAAS,IAChF,OAAO,KAET,IAAM,EAAS,IAAkB,EAAK,KAAM,CAAE,KAAM,EAAK,KAAM,OAAQ,EAAK,EAAG,CAAC,EAGhF,OAFI,IAAW,KAAa,KAG1B,EAAC,IAAD,CAEE,UAAW,EAAG,EAAO,oBAAqB,GAAY,SAAS,EAC/D,MAAO,GAAY,UACnB,UAAW,aAAa,EAAG,EAAE,GAAG,EAAG,EAAE,GACrC,cAAY,OAEX,SAAA,IAAW,IAAA,GAGV,EAAA,EAAA,CAAA,SAAA,CACE,EAAC,OAAD,CAAM,UAAW,EAAO,mBAAoB,WAAW,SACpD,SAAA,EAAK,MAAM,MAAQ,EAChB,CAAA,EACN,EAAC,OAAD,CAAM,UAAW,EAAO,mBAAoB,WAAW,SAAS,GAAG,QAChE,SAAA,EAAW,EAAK,IAAI,CACjB,CAAA,CACN,CAAA,CAAA,EATF,CAWD,EAlBI,EAAK,EAkBT,CAEP,CAAC,EACF,CACA,CACA,CAAA,CAAA,GAET"}
1
+ {"version":3,"file":"planCanvas.mjs","names":[],"sources":["../../../../package/common/planCanvas/planCanvas.tsx"],"sourcesContent":["import { useMemo, type ReactElement } from 'react';\nimport cx from 'classnames';\n\nimport {\n OpeningKind,\n buildWallPaths,\n openingGeometry,\n type DerivedRoom,\n type PlanOpening,\n type PlanPoint,\n type PlanSelection,\n} from '../floorPlan';\nimport type { PlanCanvasProps } from './planCanvas.types';\nimport styles from './planCanvas.module.pcss';\n\n/**\n * The read-only renderer shared by RoomDrawer and RoomViewer.\n *\n * It owns the projection, the layer stack, and the accessible room shapes. It owns no\n * editing state: the drawer supplies its handles and previews through `overlay`. Having\n * one renderer is the point, so that a plan cannot look different in the editor than it\n * does in the viewer.\n *\n * The viewport is a TRANSFORM on a group, not an SVG `viewBox`. That is what lets the\n * screen-space layer draw labels and handles at a fixed pixel size while the drawing\n * itself scales.\n */\n\nconst DEFAULT_OUTLINE_PX = 1;\n\n/** Stable identity, so a default-valued `selection` prop does not re-run memos. */\nconst EMPTY_SELECTION: readonly PlanSelection[] = [];\n\nfunction formatAreaDefault(areaMm2: number): string {\n const m2 = areaMm2 / 1_000_000;\n return `${m2.toFixed(m2 < 10 ? 1 : 0)} m²`;\n}\n\nfunction ringToPath(ring: PlanPoint[]): string {\n if (ring.length === 0) return '';\n return `${ring.map((p, i) => `${i === 0 ? 'M' : 'L'} ${p.x},${p.y}`).join(' ')} Z`;\n}\n\n/** Outer ring plus holes as one path; `fill-rule: evenodd` punches the holes out. */\nfunction faceToPath(face: DerivedRoom): string {\n return [ringToPath(face.outer), ...face.holes.map(ringToPath)].filter(Boolean).join(' ');\n}\n\n/**\n * The ref lands on the `<svg>` itself, which is what a consumer wants for measuring or\n * screenshotting. Both the drawer and the viewer expose it as `getSvgElement()`.\n */\nfunction PlanCanvas(props: PlanCanvasProps) {\n const {\n ref,\n floor,\n underlay,\n rooms,\n view,\n selection = EMPTY_SELECTION,\n hovered = null,\n interactiveRooms = false,\n interactiveOpenings = false,\n showGrid = false,\n gridSize = 100,\n showRoomLabels = true,\n showOpeningSymbols = true,\n getRoomColor,\n renderRoomLabel,\n getRoomLabel,\n formatArea = formatAreaDefault,\n onRoomActivate,\n onOpeningActivate,\n onBackgroundActivate,\n onHoverChange,\n overlay,\n worldOverlay,\n size,\n className,\n style,\n classNames,\n styles: slotStyles,\n 'aria-label': ariaLabel,\n } = props;\n\n const pxToWorld = view.zoom > 0 ? 1 / view.zoom : 1;\n const outlineWidth = DEFAULT_OUTLINE_PX * pxToWorld;\n\n const wallPaths = useMemo(() => buildWallPaths(floor), [floor]);\n\n /**\n * Centrelines only, at one stroke width. The underlay is there to line walls up\n * against, so it wants to read as a tracing rather than compete with the floor being\n * drawn; the two-pass thick-wall treatment would give it equal weight.\n */\n const underlayLines = useMemo(() => {\n if (!underlay) return [];\n return Object.values(underlay.walls).flatMap((wall) => {\n const a = underlay.nodes[wall.a];\n const b = underlay.nodes[wall.b];\n return a && b ? [{ id: wall.id, x1: a.x, y1: a.y, x2: b.x, y2: b.y }] : [];\n });\n }, [underlay]);\n\n /** World point to screen point, for the untransformed layer. */\n const toScreen = (p: PlanPoint) => ({\n x: (p.x - view.x) * view.zoom,\n y: (p.y - view.y) * view.zoom,\n });\n\n // Grid lines are generated for the visible rect only. Deliberately not an SVG\n // <pattern>: a pattern needs an id, and two canvases on one page then collide.\n const gridLines = useMemo(() => {\n if (!showGrid || gridSize <= 0) return null;\n const worldW = size.width * pxToWorld;\n const worldH = size.height * pxToWorld;\n // Keep the line count sane when zoomed far out.\n const step = gridSize * Math.max(1, Math.pow(10, Math.ceil(Math.log10(worldW / gridSize / 60))));\n const startX = Math.floor(view.x / step) * step;\n const startY = Math.floor(view.y / step) * step;\n const verticals: number[] = [];\n const horizontals: number[] = [];\n for (let x = startX; x <= view.x + worldW; x += step) verticals.push(x);\n for (let y = startY; y <= view.y + worldH; y += step) horizontals.push(y);\n return { verticals, horizontals, step, worldW, worldH };\n }, [showGrid, gridSize, size.width, size.height, pxToWorld, view.x, view.y]);\n\n const isSelected = (type: string, id: string) => selection.some((entry) => entry.type === type && entry.id === id);\n const isHovered = (type: string, id: string) => hovered?.type === type && hovered.id === id;\n\n /**\n * The walls bounding the selected rooms. A SELECTED room is marked by colouring its\n * boundary rather than by flooding its floor, which would bury its doors and its label;\n * hover keeps the faint floor tint instead, since the two say different things.\n */\n const highlightedWalls = useMemo(() => {\n const selectedRooms = new Set(selection.filter((entry) => entry.type === 'room').map((entry) => entry.id));\n const ids = new Set<string>();\n for (const room of rooms) {\n if (room.roomId && selectedRooms.has(room.roomId)) {\n // A wall shared by two selected rooms belongs to both; the set draws it once.\n for (const id of room.wallIds) ids.add(id);\n }\n }\n return ids;\n }, [rooms, selection]);\n\n const roomEdge = useMemo(\n () => (highlightedWalls.size > 0 ? buildWallPaths(floor, { wallIds: highlightedWalls }) : { groups: [], caps: [] }),\n [floor, highlightedWalls],\n );\n\n function renderOpening(opening: PlanOpening) {\n const geo = openingGeometry(floor, opening);\n if (!geo) return null;\n const wall = floor.walls[opening.wallId];\n const half = wall ? wall.thickness / 2 : 50;\n const { p1, p2, normal, dir, centre } = geo;\n\n const selected = isSelected('opening', opening.id);\n const hoveredNow = isHovered('opening', opening.id);\n const width = Math.hypot(p2.x - p1.x, p2.y - p1.y);\n\n const parts: ReactElement[] = [];\n\n if (showOpeningSymbols && opening.kind === OpeningKind.Door) {\n // Leaf plus swing arc, drawn on the wall's left side.\n const hingeAtStart = opening.swing !== 'endLeft' && opening.swing !== 'endRight';\n const hinge = hingeAtStart ? p1 : p2;\n const sweepDir = hingeAtStart ? 1 : -1;\n const leafEnd = { x: hinge.x + normal.x * width, y: hinge.y + normal.y * width };\n const arcEnd = {\n x: hinge.x + dir.x * width * sweepDir,\n y: hinge.y + dir.y * width * sweepDir,\n };\n parts.push(\n <path\n key='leaf'\n className={styles.planCanvasDoorLeaf}\n d={`M ${hinge.x},${hinge.y} L ${leafEnd.x},${leafEnd.y}`}\n strokeWidth={outlineWidth}\n />,\n <path\n key='swing'\n className={styles.planCanvasDoorSwing}\n d={`M ${leafEnd.x},${leafEnd.y} A ${width},${width} 0 0,${hingeAtStart ? 0 : 1} ${arcEnd.x},${arcEnd.y}`}\n strokeWidth={outlineWidth}\n />,\n );\n }\n\n if (showOpeningSymbols && opening.kind === OpeningKind.Window) {\n // A pane line down the middle of the wall's thickness.\n parts.push(\n <path\n key='pane'\n className={styles.planCanvasWindowPane}\n d={`M ${p1.x},${p1.y} L ${p2.x},${p2.y}`}\n strokeWidth={outlineWidth * 2}\n />,\n );\n }\n\n const hitPath = `M ${p1.x + normal.x * half},${p1.y + normal.y * half} L ${\n p2.x + normal.x * half\n },${p2.y + normal.y * half} L ${p2.x - normal.x * half},${p2.y - normal.y * half} L ${\n p1.x - normal.x * half\n },${p1.y - normal.y * half} Z`;\n\n return (\n <g\n key={opening.id}\n className={cx(\n selected && styles.planCanvasOpeningSelected,\n hoveredNow && styles.planCanvasOpeningHovered,\n classNames?.opening,\n )}\n style={slotStyles?.opening}\n data-opening-kind={opening.kind}\n >\n {parts}\n <path\n className={cx(styles.planCanvasOpeningHit, interactiveOpenings && styles.planCanvasOpeningHitInteractive)}\n d={hitPath}\n onClick={\n interactiveOpenings && onOpeningActivate\n ? (e) => {\n e.stopPropagation();\n onOpeningActivate(opening.id);\n }\n : undefined\n }\n onPointerEnter={onHoverChange ? () => onHoverChange({ type: 'opening', id: opening.id }) : undefined}\n >\n {interactiveOpenings && <title>{opening.kind}</title>}\n </path>\n {(selected || hoveredNow) && (\n <path className={styles.planCanvasOpeningOutline} d={hitPath} vectorEffect='non-scaling-stroke' />\n )}\n {/* The jamb faces, so an opening reads as a hole with sides rather than a blank. */}\n <path\n className={cx(\n styles.planCanvasJamb,\n // The jamb face belongs to the wall it is cut into, so it follows that wall\n // into the highlight rather than staying white against it.\n highlightedWalls.has(opening.wallId) && styles.planCanvasJambHighlighted,\n )}\n d={`M ${p1.x - normal.x * half},${p1.y - normal.y * half} L ${p1.x + normal.x * half},${\n p1.y + normal.y * half\n } M ${p2.x - normal.x * half},${p2.y - normal.y * half} L ${p2.x + normal.x * half},${\n p2.y + normal.y * half\n }`}\n strokeWidth={outlineWidth}\n />\n {centre && null}\n </g>\n );\n }\n\n return (\n <svg\n ref={ref}\n className={cx(styles.planCanvas, className, classNames?.canvas)}\n style={{ ...style, ...slotStyles?.canvas }}\n viewBox={`0 0 ${Math.max(1, size.width)} ${Math.max(1, size.height)}`}\n width={size.width}\n height={size.height}\n role='img'\n aria-label={ariaLabel}\n onClick={onBackgroundActivate ? () => onBackgroundActivate() : undefined}\n onPointerLeave={onHoverChange ? () => onHoverChange(null) : undefined}\n >\n <g transform={`translate(${-view.x * view.zoom} ${-view.y * view.zoom}) scale(${view.zoom})`}>\n {/* 1. Grid */}\n {gridLines && (\n <g className={cx(styles.planCanvasGrid, classNames?.grid)} style={slotStyles?.grid} aria-hidden='true'>\n {gridLines.verticals.map((x) => (\n <line key={`v${x}`} x1={x} y1={view.y} x2={x} y2={view.y + gridLines.worldH} strokeWidth={pxToWorld} />\n ))}\n {gridLines.horizontals.map((y) => (\n <line key={`h${y}`} x1={view.x} y1={y} x2={view.x + gridLines.worldW} y2={y} strokeWidth={pxToWorld} />\n ))}\n </g>\n )}\n\n {/* 1b. The storey below, traced */}\n {underlayLines.length > 0 && (\n <g\n className={cx(styles.planCanvasUnderlay, classNames?.underlay)}\n style={slotStyles?.underlay}\n aria-hidden='true'\n >\n {/* Screen units: the rule sets vector-effect: non-scaling-stroke, so the width\n is read in screen pixels rather than world millimetres. */}\n {underlayLines.map((line) => (\n <line key={line.id} x1={line.x1} y1={line.y1} x2={line.x2} y2={line.y2} strokeWidth={1.5} />\n ))}\n </g>\n )}\n\n {/* 2. Room fills — the only hit target for room selection */}\n <g className={cx(styles.planCanvasRooms, classNames?.rooms)} style={slotStyles?.rooms}>\n {rooms.map((room) => {\n const selected = room.roomId ? isSelected('room', room.roomId) : false;\n const hoveredNow = room.roomId ? isHovered('room', room.roomId) : false;\n const colour = room.meta ? getRoomColor?.(room.meta, room.area) : undefined;\n const label = getRoomLabel?.(room.meta, { area: room.area });\n\n return (\n <path\n key={room.id}\n className={cx(\n styles.planCanvasRoomFill,\n hoveredNow && styles.planCanvasRoomFillHovered,\n interactiveRooms && styles.planCanvasRoomFillInteractive,\n classNames?.roomFill,\n )}\n data-state={selected ? 'selected' : hoveredNow ? 'hovered' : undefined}\n style={{ ...slotStyles?.roomFill, ...(colour ? { fill: colour } : null) }}\n d={faceToPath(room)}\n fillRule='evenodd'\n tabIndex={interactiveRooms ? 0 : undefined}\n role={interactiveRooms ? 'button' : undefined}\n aria-pressed={interactiveRooms ? selected : undefined}\n onClick={\n interactiveRooms && onRoomActivate && room.roomId\n ? (e) => {\n e.stopPropagation();\n onRoomActivate(room.roomId!);\n }\n : undefined\n }\n onKeyDown={\n interactiveRooms && onRoomActivate && room.roomId\n ? (e) => {\n if (e.key !== 'Enter' && e.key !== ' ') return;\n e.preventDefault();\n onRoomActivate(room.roomId!);\n }\n : undefined\n }\n onPointerEnter={\n onHoverChange && room.roomId ? () => onHoverChange({ type: 'room', id: room.roomId! }) : undefined\n }\n >\n {/* Both a <title> and the aria-label: aria-label on SVG shapes is\n unreliable in older Safari/VoiceOver, and <title> doubles as the\n native tooltip. */}\n {interactiveRooms && label && <title>{label}</title>}\n </path>\n );\n })}\n </g>\n\n {/* 3. Wall bodies — outline pass, then fill pass. Never interleaved: the visible\n outline is what is left of the first pass after the second covers its middle. */}\n <g className={cx(styles.planCanvasWalls, classNames?.walls)} style={slotStyles?.walls} aria-hidden='true'>\n <g className={styles.planCanvasWallOutline}>\n {wallPaths.groups.map((group) => (\n <path\n key={`o${group.thickness}`}\n className={classNames?.wallBody}\n style={slotStyles?.wallBody}\n d={group.d}\n strokeWidth={group.thickness}\n />\n ))}\n </g>\n <g className={styles.planCanvasWallFill}>\n {wallPaths.groups.map((group) => {\n const fillWidth = group.thickness - 2 * outlineWidth;\n // Zoomed far out the fill would invert; walls collapsing to solid lines is\n // the right look at that scale.\n if (fillWidth <= 0) return null;\n return <path key={`f${group.thickness}`} d={group.d} strokeWidth={fillWidth} />;\n })}\n </g>\n <g className={styles.planCanvasRoomEdgeSelected}>\n {/* The same two passes the walls themselves use, on the same path data: an\n outline at full thickness, then a fill inside it. Recolouring only the body\n left the wall edged in its normal colour, so it did not read as one object. */}\n {roomEdge.groups.map((group) => (\n <path\n key={`o${group.thickness}`}\n className={styles.planCanvasRoomEdgeOutline}\n d={group.d}\n strokeWidth={group.thickness}\n />\n ))}\n {roomEdge.groups.map((group) => {\n const fillWidth = group.thickness - 2 * outlineWidth;\n if (fillWidth <= 0) return null;\n return (\n <path\n key={`f${group.thickness}`}\n className={styles.planCanvasRoomEdgeFill}\n d={group.d}\n strokeWidth={fillWidth}\n />\n );\n })}\n </g>\n\n <g className={styles.planCanvasWallCaps}>\n {/* A highlighted wall's caps are drawn below in the highlight colour. Skipped\n here rather than painted over: an antialiased hairline is never fully\n covered, and the two would blend into a pale seam. */}\n {wallPaths.caps\n .filter((cap) => !highlightedWalls.has(cap.wallId))\n .map((cap, i) => (\n <line\n key={`${cap.wallId}-${cap.reason}-${i}`}\n x1={cap.a.x}\n y1={cap.a.y}\n x2={cap.b.x}\n y2={cap.b.y}\n strokeWidth={outlineWidth}\n />\n ))}\n </g>\n <g className={styles.planCanvasRoomEdgeCaps}>\n {roomEdge.caps.map((cap, i) => (\n <line\n key={`${cap.wallId}-${cap.reason}-${i}`}\n x1={cap.a.x}\n y1={cap.a.y}\n x2={cap.b.x}\n y2={cap.b.y}\n strokeWidth={outlineWidth}\n />\n ))}\n </g>\n </g>\n\n {/* 4. Openings */}\n <g className={cx(styles.planCanvasOpenings, classNames?.openings)} style={slotStyles?.openings}>\n {Object.values(floor.openings).map(renderOpening)}\n </g>\n\n {/* 5. Selection / hover outlines for walls and nodes */}\n <g className={styles.planCanvasSelection} aria-hidden='true'>\n {selection\n .filter((entry) => entry.type === 'wall')\n .map((entry) => {\n const wall = floor.walls[entry.id];\n if (!wall) return null;\n const a = floor.nodes[wall.a];\n const b = floor.nodes[wall.b];\n if (!a || !b) return null;\n return (\n <line\n key={entry.id}\n x1={a.x}\n y1={a.y}\n x2={b.x}\n y2={b.y}\n strokeWidth={wall.thickness}\n className={styles.planCanvasWallSelected}\n />\n );\n })}\n {hovered?.type === 'wall' &&\n !isSelected('wall', hovered.id) &&\n (() => {\n const wall = floor.walls[hovered.id];\n if (!wall) return null;\n const a = floor.nodes[wall.a];\n const b = floor.nodes[wall.b];\n if (!a || !b) return null;\n return (\n <line\n x1={a.x}\n y1={a.y}\n x2={b.x}\n y2={b.y}\n strokeWidth={wall.thickness}\n className={styles.planCanvasWallHovered}\n />\n );\n })()}\n </g>\n\n {worldOverlay}\n </g>\n\n {/* Screen space: sized in pixels, so labels and handles stay constant under zoom */}\n <g className={cx(styles.planCanvasScreen, classNames?.overlay)} style={slotStyles?.overlay}>\n {showRoomLabels &&\n rooms.map((room) => {\n const at = toScreen(room.anchor);\n if (at.x < -200 || at.y < -200 || at.x > size.width + 200 || at.y > size.height + 200) {\n return null;\n }\n const custom = renderRoomLabel?.(room.meta, { area: room.area, faceId: room.id });\n if (custom === null) return null;\n\n return (\n <g\n key={room.id}\n className={cx(styles.planCanvasRoomLabel, classNames?.roomLabel)}\n style={slotStyles?.roomLabel}\n transform={`translate(${at.x} ${at.y})`}\n aria-hidden='true'\n >\n {custom !== undefined ? (\n custom\n ) : (\n <>\n <text className={styles.planCanvasRoomName} textAnchor='middle'>\n {room.meta?.name ?? ''}\n </text>\n <text className={styles.planCanvasRoomArea} textAnchor='middle' dy='1.2em'>\n {formatArea(room.area)}\n </text>\n </>\n )}\n </g>\n );\n })}\n {overlay}\n </g>\n </svg>\n );\n}\n\nexport default PlanCanvas;\n"],"mappings":"mUA4BA,IAAM,EAAqB,EAGrB,EAA4C,CAAC,EAEnD,SAAS,EAAkB,EAAyB,CAClD,IAAM,EAAK,EAAU,IACrB,MAAO,GAAG,EAAG,QAAQ,IAAK,GAAU,EAAE,IACxC,CAEA,SAAS,EAAW,EAA2B,CAE7C,OADI,EAAK,SAAW,EAAU,GACvB,GAAG,EAAK,KAAK,EAAG,IAAM,GAAG,IAAM,EAAI,IAAM,IAAI,GAAG,EAAE,EAAE,GAAG,E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A,CAEL,EAAA,CAAG,CACJ,IAEF,CACA,CAGH,CAAA,EAAA,EAAC,IAAD,CAAG,UAAW,EAAG,EAAO,iBAAkB,GAAY,OAAO,EAAG,MAAO,GAAY,QAAnF,SAAA,CACG,GACC,EAAM,IAAK,GAAS,CAClB,IAAM,EAAK,EAAS,EAAK,MAAM,EAC/B,GAAI,EAAG,EAAI,MAAQ,EAAG,EAAI,MAAQ,EAAG,EAAI,EAAK,MAAQ,KAAO,EAAG,EAAI,EAAK,OAAS,IAChF,OAAO,KAET,IAAM,EAAS,IAAkB,EAAK,KAAM,CAAE,KAAM,EAAK,KAAM,OAAQ,EAAK,EAAG,CAAC,EAGhF,OAFI,IAAW,KAAa,KAG1B,EAAC,IAAD,CAEE,UAAW,EAAG,EAAO,oBAAqB,GAAY,SAAS,EAC/D,MAAO,GAAY,UACnB,UAAW,aAAa,EAAG,EAAE,GAAG,EAAG,EAAE,GACrC,cAAY,OAEX,SAAA,IAAW,IAAA,GAGV,EAAA,EAAA,CAAA,SAAA,CACE,EAAC,OAAD,CAAM,UAAW,EAAO,mBAAoB,WAAW,SACpD,SAAA,EAAK,MAAM,MAAQ,EAChB,CAAA,EACN,EAAC,OAAD,CAAM,UAAW,EAAO,mBAAoB,WAAW,SAAS,GAAG,QAChE,SAAA,EAAW,EAAK,IAAI,CACjB,CAAA,CACN,CAAA,CAAA,EATF,CAWD,EAlBI,EAAK,EAkBT,CAEP,CAAC,EACF,CACA,CACA,CAAA,CAAA,GAET"}
@@ -1,2 +1,2 @@
1
- "use client";import{useComponentDefaults as e}from"../configProvider/useComponentDefaults.mjs";import{usePresentationDefault as t}from"../configProvider/usePresentationDefault.mjs";import{Presentation as n}from"../configProvider/presentation.types.mjs";import r from"../bodyEnd/bodyEnd.mjs";import i from"./popover.module.mjs";import a from"../styles/sheet.module.mjs";import ee from"../sheetBackdrop/sheetBackdrop.mjs";import{PopoverAlign as te,PopoverPlacement as ne,PopoverTrigger as o}from"./popover.types.mjs";import{usePopoverPosition as re}from"./usePopoverPosition.mjs";import{tabbablesIn as s,useFocusBoundary as ie}from"../hooks/useFocusBoundary.mjs";import ae from"../hooks/useSheet.mjs";import{useOverlay as oe}from"../hooks/useOverlay.mjs";import{useCallback as c,useEffect as l,useRef as u,useState as d}from"react";import f from"classnames";import{jsx as p,jsxs as m}from"react/jsx-runtime";var se=1e3;function h(e,t){return e?{current:e}:t}function g(g){let{children:ce=null,anchor:_,content:le=null,placement:v=ne.Bottom,align:ue=te.Center,trigger:y=o.Click,isOpen:b,defaultOpen:de=!1,onOpenChange:x=()=>{},offset:fe=10,withArrow:S=!0,closeOnOutsideClick:C=!0,closeOnEscape:pe=!0,openDelay:me=100,closeDelay:he=120,disabled:w=!1,focusOnOpen:T=`keyboard`,closeOnTriggerClick:ge=!0,width:_e=`auto`,constrainWidth:ve=!0,presentation:ye,className:be,style:xe,classNames:E,styles:D,...Se}=e(`Popover`,g),O=u(null),k=u(null),A=u(null),j=u(null),M=u(void 0),N=u(!1),P=u(!1),F=u(!1),I=u(null);function L(){N.current=!0}function Ce(e){L(),I.current=e.target}let[R,we]=d(()=>({anchor:_,ref:h(_,O)}));R.anchor!==_&&we({anchor:_,ref:h(_,O)});let z=R.ref,B=u(null),V=_!==void 0;l(()=>{if(!V)return;function e(e){B.current={target:e.target,keyboard:e.detail===0,time:performance.now()}}return document.addEventListener(`click`,e,!0),()=>document.removeEventListener(`click`,e,!0)},[V]);let H=b!==void 0,[Te,Ee]=d(de),U=H?b:Te,W=u(x);l(()=>{W.current=x});let G=c((e,t=!1)=>{w&&e||(e&&(F.current=t),H||Ee(e),W.current(e,{fromKeyboard:t}))},[w,H]),De=t(),Oe=ye??De??n.Default,{isSheet:ke,sheetStyle:Ae}=ae(Oe),K=ke&&y===o.Click,q=u(!1),J=u(!1);function Y(){J.current=!1;let e=s(A.current);e.length!==0&&(k.current?.setAttribute(`role`,`dialog`),e[0].focus())}re({isOpen:!!U&&!K,placement:v,align:ue,offset:fe,triggerRef:z,floatingRef:k,panelRef:A,arrowRef:S?j:{current:null},matchTriggerWidth:_e===`trigger`,onShown:()=>{q.current=!0,J.current&&Y()}});let{restoreFocusToTrigger:X,focusAfterTrigger:je}=ie({triggerRef:z,contentRef:k}),Z=u(X);l(()=>{Z.current=X});let Q=u(!1),Me=c(e=>{if(k.current=e,Q.current=!1,e)return()=>{k.current=null;let t=document.activeElement;Q.current=!!t&&(e.contains(t)||t===I.current)}},[]);l(()=>{if(U||!Q.current)return;Q.current=!1;let e=document.activeElement;(!e||e===document.body)&&Z.current()},[U]),oe({isActive:!!U,containerRef:A,onEscape:pe?()=>{k.current?.contains(document.activeElement)&&X(),G(!1,!0)}:void 0,trapFocus:!1,lockScroll:K}),l(()=>{if(!U){F.current=!1,q.current=!1,J.current=!1;return}let e=B.current;B.current=null;let t=!!_&&!!e?.keyboard&&_.contains(e.target)&&performance.now()-e.time<se;(T===!0||T===`keyboard`&&(F.current||t))&&y===o.Click&&(q.current?Y():J.current=!0)},[U,y,T,_]);function Ne(e){if(e.key!==`Tab`||y!==o.Click)return;let t=s(A.current);if(t.length===0)return;let n=document.activeElement;!e.shiftKey&&n===t[t.length-1]?(e.preventDefault(),je(),G(!1,!0)):e.shiftKey&&n===t[0]&&(e.preventDefault(),X(),G(!1,!0))}l(()=>{if(!U)return;N.current=!1,P.current=!1;function e(e){return!!(k.current?.contains(e)||O.current?.contains(e)||z.current?.contains(e))}function t(t){let n=N.current;return N.current=!1,n||e(t.target)}function n(e){P.current=!t(e)}function r(e){let n=P.current;P.current=!1,!t(e)&&n&&G(!1)}function i(n){if(t(n))return;let r=n.relatedTarget;r&&(r===I.current||e(r))&&G(!1,!P.current)}return C&&y!==o.Hover&&(window.addEventListener(`mousedown`,n),window.addEventListener(`mouseup`,r),document.addEventListener(`focusin`,i)),()=>{window.removeEventListener(`mousedown`,n),window.removeEventListener(`mouseup`,r),document.removeEventListener(`focusin`,i)}},[U,C,y,G,z]),l(()=>()=>clearTimeout(M.current),[]);function $(e){clearTimeout(M.current),M.current=setTimeout(()=>G(e),e?me:he)}function Pe(e){U||e.key!==`ArrowDown`&&e.key!==`ArrowUp`||(e.preventDefault(),G(!0,!0))}let Fe=y===o.Click?{onClick:e=>{(!U||ge)&&G(!U,e.detail===0)},onKeyDown:Pe}:y===o.Hover?{onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1)}:{onFocus:()=>G(!0),onBlur:()=>G(!1)},Ie=y===o.Hover?{onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1)}:{};return m(`div`,{...Se,className:f(i.popover,be,E?.root),style:{...xe,...D?.root},children:[p(`div`,{ref:O,className:f(i.popoverTrigger,E?.trigger),style:D?.trigger,...Fe,children:ce}),U&&m(r,{children:[K&&p(ee,{onClose:()=>{C&&G(!1)},className:E?.backdrop,style:D?.backdrop}),m(`div`,{ref:Me,className:f(K?a.sheet:i.popoverFloating,E?.floating),style:{...K?Ae:void 0,...D?.floating},"data-placement":v,onKeyDown:Ne,onMouseDownCapture:L,onMouseUpCapture:L,onFocusCapture:Ce,...Ie,children:[p(`div`,{ref:A,className:f(i.popoverPanel,ve&&i.popoverPanelConstrained,K&&a.sheetPanel,E?.panel),style:D?.panel,children:le}),S&&!K&&p(`div`,{ref:j,className:f(i.popoverArrow,E?.arrow),style:D?.arrow})]})]})]})}export{g as default};
1
+ "use client";import{useComponentDefaults as e}from"../configProvider/useComponentDefaults.mjs";import{usePresentationDefault as t}from"../configProvider/usePresentationDefault.mjs";import{Presentation as n}from"../configProvider/presentation.types.mjs";import r from"../bodyEnd/bodyEnd.mjs";import i from"./popover.module.mjs";import a from"../styles/sheet.module.mjs";import ee from"../sheetBackdrop/sheetBackdrop.mjs";import{PopoverAlign as te,PopoverPlacement as ne,PopoverTrigger as o}from"./popover.types.mjs";import{usePopoverPosition as re}from"./usePopoverPosition.mjs";import{tabbablesIn as s,useFocusBoundary as ie}from"../hooks/useFocusBoundary.mjs";import ae from"../hooks/useSheet.mjs";import{useOverlay as oe}from"../hooks/useOverlay.mjs";import{markDismiss as c}from"../utils/dismissClick.mjs";import{useCallback as l,useEffect as u,useRef as d,useState as f}from"react";import p from"classnames";import{jsx as m,jsxs as h}from"react/jsx-runtime";var se=1e3;function g(e,t){return e?{current:e}:t}function _(_){let{children:ce=null,anchor:v,content:le=null,placement:y=ne.Bottom,align:ue=te.Center,trigger:b=o.Click,isOpen:x,defaultOpen:de=!1,onOpenChange:S=()=>{},offset:fe=10,withArrow:C=!0,closeOnOutsideClick:w=!0,closeOnEscape:pe=!0,openDelay:me=100,closeDelay:he=120,disabled:T=!1,focusOnOpen:E=`keyboard`,closeOnTriggerClick:ge=!0,width:_e=`auto`,constrainWidth:ve=!0,presentation:ye,className:be,style:xe,classNames:D,styles:O,...Se}=e(`Popover`,_),k=d(null),A=d(null),j=d(null),M=d(null),N=d(void 0),P=d(!1),F=d(!1),I=d(!1),L=d(null);function R(){P.current=!0}function Ce(e){R(),L.current=e.target}let[z,we]=f(()=>({anchor:v,ref:g(v,k)}));z.anchor!==v&&we({anchor:v,ref:g(v,k)});let B=z.ref,V=d(null),H=v!==void 0;u(()=>{if(!H)return;function e(e){V.current={target:e.target,keyboard:e.detail===0,time:performance.now()}}return document.addEventListener(`click`,e,!0),()=>document.removeEventListener(`click`,e,!0)},[H]);let U=x!==void 0,[Te,Ee]=f(de),W=U?x:Te,G=d(S);u(()=>{G.current=S});let K=l((e,t=!1)=>{T&&e||(e&&(I.current=t),U||Ee(e),G.current(e,{fromKeyboard:t}))},[T,U]),De=t(),Oe=ye??De??n.Default,{isSheet:ke,sheetStyle:Ae}=ae(Oe),q=ke&&b===o.Click,J=d(!1),Y=d(!1);function X(){Y.current=!1;let e=s(j.current);e.length!==0&&(A.current?.setAttribute(`role`,`dialog`),e[0].focus())}re({isOpen:!!W&&!q,placement:y,align:ue,offset:fe,triggerRef:B,floatingRef:A,panelRef:j,arrowRef:C?M:{current:null},matchTriggerWidth:_e===`trigger`,onShown:()=>{J.current=!0,Y.current&&X()}});let{restoreFocusToTrigger:Z,focusAfterTrigger:je}=ie({triggerRef:B,contentRef:A}),Me=d(Z);u(()=>{Me.current=Z});let Q=d(!1),Ne=l(e=>{if(A.current=e,Q.current=!1,e)return()=>{A.current=null;let t=document.activeElement;Q.current=!!t&&(e.contains(t)||t===L.current)}},[]);u(()=>{if(W||!Q.current)return;Q.current=!1;let e=document.activeElement;(!e||e===document.body)&&Me.current()},[W]),oe({isActive:!!W,containerRef:j,onEscape:pe?()=>{A.current?.contains(document.activeElement)&&Z(),K(!1,!0)}:void 0,trapFocus:!1,lockScroll:q}),u(()=>{if(!W){I.current=!1,J.current=!1,Y.current=!1;return}let e=V.current;V.current=null;let t=!!v&&!!e?.keyboard&&v.contains(e.target)&&performance.now()-e.time<se;(E===!0||E===`keyboard`&&(I.current||t))&&b===o.Click&&(J.current?X():Y.current=!0)},[W,b,E,v]);function Pe(e){if(e.key!==`Tab`||b!==o.Click)return;let t=s(j.current);if(t.length===0)return;let n=document.activeElement;!e.shiftKey&&n===t[t.length-1]?(e.preventDefault(),je(),K(!1,!0)):e.shiftKey&&n===t[0]&&(e.preventDefault(),Z(),K(!1,!0))}u(()=>{if(!W)return;P.current=!1,F.current=!1;function e(e){return!!(A.current?.contains(e)||k.current?.contains(e)||B.current?.contains(e))}function t(t){let n=P.current;return P.current=!1,n||e(t.target)}function n(e){F.current=!t(e)}function r(e){let n=F.current;F.current=!1,!t(e)&&n&&(c(),K(!1))}function i(n){if(t(n))return;let r=n.relatedTarget;if(!r||r!==L.current&&!e(r))return;let i=F.current;i&&c(),K(!1,!i)}return w&&b!==o.Hover&&(window.addEventListener(`mousedown`,n),window.addEventListener(`mouseup`,r),document.addEventListener(`focusin`,i)),()=>{window.removeEventListener(`mousedown`,n),window.removeEventListener(`mouseup`,r),document.removeEventListener(`focusin`,i)}},[W,w,b,K,B]),u(()=>()=>clearTimeout(N.current),[]);function $(e){clearTimeout(N.current),N.current=setTimeout(()=>K(e),e?me:he)}function Fe(e){W||e.key!==`ArrowDown`&&e.key!==`ArrowUp`||(e.preventDefault(),K(!0,!0))}let Ie=b===o.Click?{onClick:e=>{(!W||ge)&&K(!W,e.detail===0)},onKeyDown:Fe}:b===o.Hover?{onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1)}:{onFocus:()=>K(!0),onBlur:()=>K(!1)},Le=b===o.Hover?{onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1)}:{};return h(`div`,{...Se,className:p(i.popover,be,D?.root),style:{...xe,...O?.root},children:[m(`div`,{ref:k,className:p(i.popoverTrigger,D?.trigger),style:O?.trigger,...Ie,children:ce}),W&&h(r,{children:[q&&m(ee,{onClose:()=>{w&&K(!1)},className:D?.backdrop,style:O?.backdrop}),h(`div`,{ref:Ne,className:p(q?a.sheet:i.popoverFloating,D?.floating),style:{...q?Ae:void 0,...O?.floating},"data-placement":y,onKeyDown:Pe,onMouseDownCapture:R,onMouseUpCapture:R,onFocusCapture:Ce,...Le,children:[m(`div`,{ref:j,className:p(i.popoverPanel,ve&&i.popoverPanelConstrained,q&&a.sheetPanel,D?.panel),style:O?.panel,children:le}),C&&!q&&m(`div`,{ref:M,className:p(i.popoverArrow,D?.arrow),style:O?.arrow})]})]})]})}export{_ as default};
2
2
  //# sourceMappingURL=popover.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"popover.mjs","names":[],"sources":["../../../../package/common/popover/popover.tsx"],"sourcesContent":["import { useRef, useEffect, useState, useCallback, type RefObject } from 'react';\nimport cx from 'classnames';\nimport BodyEnd from 'components/common/bodyEnd';\n\nimport styles from './popover.module.pcss';\nimport sheetStyles from '../styles/sheet.module.pcss';\nimport SheetBackdrop from '../sheetBackdrop';\nimport { usePopoverPosition } from './usePopoverPosition';\nimport { useFocusBoundary, tabbablesIn } from '../hooks/useFocusBoundary';\nimport { useSheet } from '../hooks/useSheet';\nimport { useOverlay } from '../hooks/useOverlay';\nimport { useComponentDefaults, usePresentationDefault } from '../configProvider';\nimport { Presentation } from '../configProvider/presentation.types';\nimport { PopoverPlacement, PopoverAlign, PopoverTrigger, type PopoverProps } from './popover.types';\n\n/**\n * How long after its click an anchored popover still counts as opened by it: long enough for the\n * render the click causes, short enough that an old keypress does not decide a later open.\n */\nconst ACTIVATION_WINDOW_MS = 1000;\n\nfunction toReference(\n anchor: HTMLElement | null | undefined,\n triggerRef: RefObject<HTMLElement | null>,\n): RefObject<HTMLElement | null> {\n return anchor ? { current: anchor } : triggerRef;\n}\n\nfunction Popover(props: PopoverProps) {\n const {\n children = null,\n anchor,\n content = null,\n placement = PopoverPlacement.Bottom,\n align = PopoverAlign.Center,\n trigger = PopoverTrigger.Click,\n isOpen,\n defaultOpen = false,\n onOpenChange = () => {},\n offset = 10,\n withArrow = true,\n closeOnOutsideClick = true,\n closeOnEscape = true,\n openDelay = 100,\n closeDelay = 120,\n disabled = false,\n focusOnOpen = 'keyboard',\n closeOnTriggerClick = true,\n width = 'auto',\n constrainWidth = true,\n presentation: presentationProp,\n className,\n style,\n classNames,\n styles: slotStyles,\n ...rest\n } = useComponentDefaults('Popover', props);\n const triggerRef = useRef<HTMLDivElement>(null);\n const floatingRef = useRef<HTMLDivElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const arrowRef = useRef<HTMLDivElement>(null);\n const hoverTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n // Set from a capture handler on the panel, which React fires for its whole\n // React subtree — including children that portal elsewhere in the DOM, such as\n // a Dropdown's list inside a DatePicker's calendar. A DOM `contains` check\n // cannot see those, and without this the panel closes when one is used.\n const panelInteractedRef = useRef(false);\n // An outside click is a press that starts and ends outside while the panel is open. One that\n // starts inside is a drag, such as selecting a field's text, and Chromium and WebKit send its\n // `mouseup` to wherever it ends. One that started before the panel opened is the gesture that\n // opened it, such as Calendar's drag to create, which opens an editor on `pointerup`.\n const pressStartedOutsideRef = useRef(false);\n // Whether the open that is running came from the keyboard, which is what the\n // default `focusOnOpen` follows and what `onOpenChange` reports. A click raised\n // by Enter or Space reports `detail === 0`, where a pointer press counts the\n // clicks; an open with no trigger event at all, such as a panel that appears\n // while the user types, leaves this false.\n const openedByKeyboardRef = useRef(false);\n // A nested portal sits outside the panel's DOM; this is how focus leaving one counts as leaving.\n const lastPanelFocusRef = useRef<EventTarget | null>(null);\n function markPanelInteraction() {\n panelInteractedRef.current = true;\n }\n function markPanelFocus(event: React.FocusEvent) {\n markPanelInteraction();\n lastPanelFocusRef.current = event.target;\n }\n\n // What the panel is placed against, and where the focus goes back to. A new object exactly when\n // `anchor` changes, which is what restarts the position tracking for the new element: state, not\n // a memo, because a memo React chose to drop would restart it for no reason.\n const [reference, setReference] = useState(() => ({ anchor, ref: toReference(anchor, triggerRef) }));\n if (reference.anchor !== anchor) setReference({ anchor, ref: toReference(anchor, triggerRef) });\n const referenceRef = reference.ref;\n\n // An anchored popover is opened by its consumer through `isOpen`, so none of the key handling\n // below sees how. The click that caused it does: Enter and Space raise one with `detail === 0`,\n // the same test the trigger uses. Not `:focus-visible`, which a text field matches after a\n // mouse click too, and which stays on a keyboard-focused button that is then clicked.\n const activationRef = useRef<{ target: Node; keyboard: boolean; time: number } | null>(null);\n const anchored = anchor !== undefined;\n useEffect(() => {\n if (!anchored) return;\n function onClick(event: MouseEvent) {\n activationRef.current = { target: event.target as Node, keyboard: event.detail === 0, time: performance.now() };\n }\n // Capturing, so it is recorded before the consumer's own handler opens the panel.\n document.addEventListener('click', onClick, true);\n return () => document.removeEventListener('click', onClick, true);\n }, [anchored]);\n\n const isControlled = isOpen !== undefined;\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const open = isControlled ? isOpen : internalOpen;\n\n // Keep the outside-click/Escape listeners pointed at the latest setter without re-subscribing.\n const onOpenChangeRef = useRef(onOpenChange);\n useEffect(() => {\n onOpenChangeRef.current = onOpenChange;\n });\n\n const setOpen = useCallback(\n (next: boolean, fromKeyboard = false) => {\n if (disabled && next) return;\n if (next) openedByKeyboardRef.current = fromKeyboard;\n if (!isControlled) setInternalOpen(next);\n onOpenChangeRef.current(next, { fromKeyboard });\n },\n [disabled, isControlled],\n );\n\n // Explicit prop → this component's global default → the app-wide one → anchored.\n const appPresentation = usePresentationDefault();\n const presentation = presentationProp ?? appPresentation ?? Presentation.Default;\n const { isSheet: sheetPresentation, sheetStyle } = useSheet(presentation);\n // Hover and focus are pointer affordances that open something small next to what caused them;\n // a sheet is a deliberate, screen-owning open. Only a click asks for one.\n const isSheet = sheetPresentation && trigger === PopoverTrigger.Click;\n\n // Focus into the panel waits until it shows, since one that waits out a moving ancestor hidden\n // takes none.\n const shownRef = useRef(false);\n const focusPendingRef = useRef(false);\n function focusPanel() {\n focusPendingRef.current = false;\n const focusables = tabbablesIn(panelRef.current);\n if (focusables.length === 0) return;\n // Only claim the dialog role when we're actually managing focus for real content.\n floatingRef.current?.setAttribute('role', 'dialog');\n focusables[0].focus();\n }\n\n // A sheet isn't anchored to anything, so there's nothing to track, flip or clamp.\n usePopoverPosition({\n isOpen: !!open && !isSheet,\n placement,\n align,\n offset,\n triggerRef: referenceRef,\n floatingRef,\n panelRef,\n arrowRef: withArrow ? arrowRef : { current: null },\n matchTriggerWidth: width === 'trigger',\n onShown: () => {\n shownRef.current = true;\n if (focusPendingRef.current) focusPanel();\n },\n });\n\n // Registered for as long as it's open, not just as a sheet: this is what puts the popover on\n // the overlay stack, so an enclosing Modal knows something sits above it and neither drags\n // focus out of this (portaled, so outside the modal's panel) panel nor closes itself on the\n // Escape meant for this. Focus isn't trapped: a Popover is deliberately non-modal, and it\n // already moves focus into the panel on open by itself.\n const { restoreFocusToTrigger, focusAfterTrigger } = useFocusBoundary({\n triggerRef: referenceRef,\n contentRef: floatingRef,\n });\n const restoreFocusRef = useRef(restoreFocusToTrigger);\n useEffect(() => {\n restoreFocusRef.current = restoreFocusToTrigger;\n });\n\n // Focus inside the panel returns to the trigger however it closes, as with `hidePopover()`. Read\n // in a ref cleanup, while the panel is still in the DOM; moved in an effect, because StrictMode\n // detaches a new panel's refs once more right after it took the focus.\n const focusLeftWithPanelRef = useRef(false);\n const floatingCallbackRef = useCallback((node: HTMLDivElement | null) => {\n floatingRef.current = node;\n focusLeftWithPanelRef.current = false;\n if (!node) return;\n return () => {\n floatingRef.current = null;\n const active = document.activeElement;\n focusLeftWithPanelRef.current = !!active && (node.contains(active) || active === lastPanelFocusRef.current);\n };\n }, []);\n useEffect(() => {\n if (open || !focusLeftWithPanelRef.current) return;\n focusLeftWithPanelRef.current = false;\n const active = document.activeElement;\n if (!active || active === document.body) restoreFocusRef.current();\n }, [open]);\n\n useOverlay({\n isActive: !!open,\n containerRef: panelRef,\n onEscape: closeOnEscape\n ? () => {\n // Hand focus back to the trigger when it currently sits inside the panel.\n if (floatingRef.current?.contains(document.activeElement)) restoreFocusToTrigger();\n setOpen(false, true);\n }\n : undefined,\n trapFocus: false,\n lockScroll: isSheet,\n });\n\n // The panel is portaled to the end of the DOM, so Tab never flows into it naturally. When we\n // manage focus (click trigger + focusable content), move focus in on open and, on Tab out of\n // either end, close and continue focus as if the panel sat right after the trigger.\n useEffect(() => {\n if (!open) {\n openedByKeyboardRef.current = false;\n shownRef.current = false;\n focusPendingRef.current = false;\n return;\n }\n const activation = activationRef.current;\n activationRef.current = null;\n const anchorKeyed =\n !!anchor &&\n !!activation?.keyboard &&\n anchor.contains(activation.target) &&\n performance.now() - activation.time < ACTIVATION_WINDOW_MS;\n const takeFocus =\n focusOnOpen === true || (focusOnOpen === 'keyboard' && (openedByKeyboardRef.current || anchorKeyed));\n if (!takeFocus || trigger !== PopoverTrigger.Click) return;\n if (shownRef.current) focusPanel();\n else focusPendingRef.current = true;\n }, [open, trigger, focusOnOpen, anchor]);\n\n function handleFloatingKeyDown(event: React.KeyboardEvent) {\n if (event.key !== 'Tab' || trigger !== PopoverTrigger.Click) return;\n const focusables = tabbablesIn(panelRef.current);\n if (focusables.length === 0) return;\n const active = document.activeElement;\n if (!event.shiftKey && active === focusables[focusables.length - 1]) {\n event.preventDefault();\n focusAfterTrigger();\n setOpen(false, true);\n } else if (event.shiftKey && active === focusables[0]) {\n event.preventDefault();\n restoreFocusToTrigger();\n setOpen(false, true);\n }\n }\n\n // Outside click. Registered only while open and only for the relevant trigger mode; Escape is\n // handled by `useOverlay` above, which scopes it to the innermost open layer.\n useEffect(() => {\n if (!open) return;\n // Focus that landed in the panel before these listeners existed (ours on open, or content\n // that focuses itself on mount) set the flag with nothing to clear it, and the first\n // click outside was swallowed.\n panelInteractedRef.current = false;\n pressStartedOutsideRef.current = false;\n\n function containsNode(node: Node) {\n // Both trigger refs: with an anchor, `children` still toggle the panel, and a press on them is theirs.\n return Boolean(\n floatingRef.current?.contains(node) ||\n triggerRef.current?.contains(node) ||\n referenceRef.current?.contains(node),\n );\n }\n function isInside(event: Event) {\n // Read and clear: the flag describes this one event, and the panel's React\n // handler has already run by the time this does.\n const inPanelSubtree = panelInteractedRef.current;\n panelInteractedRef.current = false;\n return inPanelSubtree || containsNode(event.target as Node);\n }\n function onMouseDown(event: MouseEvent) {\n pressStartedOutsideRef.current = !isInside(event);\n }\n function onMouseUp(event: MouseEvent) {\n const pressStartedOutside = pressStartedOutsideRef.current;\n pressStartedOutsideRef.current = false;\n if (!isInside(event) && pressStartedOutside) setOpen(false);\n }\n // Keyboard counterpart to the outside click. Only focus that comes from inside closes it: code\n // moving focus elsewhere (a Modal restoring it) must not, nor `null`, focus back from another tab.\n function onFocusIn(event: FocusEvent) {\n if (isInside(event)) return;\n const from = event.relatedTarget as Node | null;\n if (!from || (from !== lastPanelFocusRef.current && !containsNode(from))) return;\n // A press on an outside field focuses it before its `mouseup`, and that is not the keyboard.\n setOpen(false, !pressStartedOutsideRef.current);\n }\n\n if (closeOnOutsideClick && trigger !== PopoverTrigger.Hover) {\n window.addEventListener('mousedown', onMouseDown);\n window.addEventListener('mouseup', onMouseUp);\n document.addEventListener('focusin', onFocusIn);\n }\n return () => {\n window.removeEventListener('mousedown', onMouseDown);\n window.removeEventListener('mouseup', onMouseUp);\n document.removeEventListener('focusin', onFocusIn);\n };\n }, [open, closeOnOutsideClick, trigger, setOpen, referenceRef]);\n\n useEffect(() => () => clearTimeout(hoverTimer.current), []);\n\n function scheduleHover(next: boolean) {\n clearTimeout(hoverTimer.current);\n hoverTimer.current = setTimeout(() => setOpen(next), next ? openDelay : closeDelay);\n }\n\n // Opening from the keyboard without the trigger having to be a button that\n // happens to toggle on Enter: the arrow keys are what the menu-button pattern\n // asks for, and what a consumer reaches for first.\n function handleTriggerKeyDown(event: React.KeyboardEvent) {\n if (open || (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')) return;\n event.preventDefault();\n setOpen(true, true);\n }\n\n const triggerHandlers =\n trigger === PopoverTrigger.Click\n ? {\n onClick: (event: React.MouseEvent) => {\n // A field that opens a picker keeps it open when clicked again, so\n // that placing the caret in the field does not close the panel.\n if (open && !closeOnTriggerClick) return;\n setOpen(!open, event.detail === 0);\n },\n onKeyDown: handleTriggerKeyDown,\n }\n : trigger === PopoverTrigger.Hover\n ? { onMouseEnter: () => scheduleHover(true), onMouseLeave: () => scheduleHover(false) }\n : { onFocus: () => setOpen(true), onBlur: () => setOpen(false) };\n\n const floatingHoverHandlers =\n trigger === PopoverTrigger.Hover\n ? { onMouseEnter: () => scheduleHover(true), onMouseLeave: () => scheduleHover(false) }\n : {};\n\n return (\n <div\n {...rest}\n className={cx(styles.popover, className, classNames?.root)}\n style={{ ...style, ...slotStyles?.root }}\n >\n <div\n ref={triggerRef}\n className={cx(styles.popoverTrigger, classNames?.trigger)}\n style={slotStyles?.trigger}\n {...triggerHandlers}\n >\n {children}\n </div>\n {open && (\n <BodyEnd>\n {isSheet && (\n <SheetBackdrop\n onClose={() => {\n if (closeOnOutsideClick) setOpen(false);\n }}\n className={classNames?.backdrop}\n style={slotStyles?.backdrop}\n />\n )}\n <div\n ref={floatingCallbackRef}\n className={cx(isSheet ? sheetStyles.sheet : styles.popoverFloating, classNames?.floating)}\n style={{ ...(isSheet ? sheetStyle : undefined), ...slotStyles?.floating }}\n data-placement={placement}\n onKeyDown={handleFloatingKeyDown}\n onMouseDownCapture={markPanelInteraction}\n onMouseUpCapture={markPanelInteraction}\n onFocusCapture={markPanelFocus}\n {...floatingHoverHandlers}\n >\n <div\n ref={panelRef}\n className={cx(\n styles.popoverPanel,\n constrainWidth && styles.popoverPanelConstrained,\n isSheet && sheetStyles.sheetPanel,\n classNames?.panel,\n )}\n style={slotStyles?.panel}\n >\n {content}\n </div>\n {withArrow && !isSheet && (\n <div ref={arrowRef} className={cx(styles.popoverArrow, classNames?.arrow)} style={slotStyles?.arrow} />\n )}\n </div>\n </BodyEnd>\n )}\n </div>\n );\n}\n\nexport default Popover;\n"],"mappings":"04BAmBA,IAAM,GAAuB,IAE7B,SAAS,EACP,EACA,EAC+B,CAC/B,OAAO,EAAS,CAAE,QAAS,CAAO,EAAI,CACxC,CAEA,SAAS,EAAQ,EAAqB,CACpC,GAAM,CACJ,YAAW,KACX,SACA,WAAU,KACV,YAAY,GAAiB,OAC7B,SAAQ,GAAa,OACrB,UAAU,EAAe,MACzB,SACA,eAAc,GACd,mBAAqB,CAAC,EACtB,UAAS,GACT,YAAY,GACZ,sBAAsB,GACtB,iBAAgB,GAChB,aAAY,IACZ,cAAa,IACb,WAAW,GACX,cAAc,WACd,uBAAsB,GACtB,SAAQ,OACR,kBAAiB,GACjB,aAAc,GACd,aACA,SACA,aACA,OAAQ,EACR,GAAG,IACD,EAAqB,UAAW,CAAK,EACnC,EAAa,EAAuB,IAAI,EACxC,EAAc,EAAuB,IAAI,EACzC,EAAW,EAAuB,IAAI,EACtC,EAAW,EAAuB,IAAI,EACtC,EAAa,EAAkD,IAAA,EAAS,EAKxE,EAAqB,EAAO,EAAK,EAKjC,EAAyB,EAAO,EAAK,EAMrC,EAAsB,EAAO,EAAK,EAElC,EAAoB,EAA2B,IAAI,EACzD,SAAS,GAAuB,CAC9B,EAAmB,QAAU,EAC/B,CACA,SAAS,GAAe,EAAyB,CAC/C,EAAqB,EACrB,EAAkB,QAAU,EAAM,MACpC,CAKA,GAAM,CAAC,EAAW,IAA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C,GAAD,CACE,YAAe,CACT,GAAqB,EAAQ,EAAK,CACxC,EACA,UAAW,GAAY,SACvB,MAAO,GAAY,QACpB,CAAA,EAEH,EAAC,MAAD,CACE,IAAK,GACL,UAAW,EAAG,EAAU,EAAY,MAAQ,EAAO,gBAAiB,GAAY,QAAQ,EACxF,MAAO,CAAE,GAAI,EAAU,GAAa,IAAA,GAAY,GAAG,GAAY,QAAS,EACxE,iBAAgB,EAChB,UAAW,GACX,mBAAoB,EACpB,iBAAkB,EAClB,eAAgB,GAChB,GAAI,GATN,SAAA,CAWE,EAAC,MAAD,CACE,IAAK,EACL,UAAW,EACT,EAAO,aACP,IAAkB,EAAO,wBACzB,GAAW,EAAY,WACvB,GAAY,KACd,EACA,MAAO,GAAY,MAElB,SAAA,EACE,CAAA,EACJ,GAAa,CAAC,GACb,EAAC,MAAD,CAAK,IAAK,EAAU,UAAW,EAAG,EAAO,aAAc,GAAY,KAAK,EAAG,MAAO,GAAY,KAAQ,CAAA,CAErG,CACE,CAAA,CAAA,CAAA,CAAA,CAER,GAET"}
1
+ {"version":3,"file":"popover.mjs","names":[],"sources":["../../../../package/common/popover/popover.tsx"],"sourcesContent":["import { useRef, useEffect, useState, useCallback, type RefObject } from 'react';\nimport cx from 'classnames';\nimport BodyEnd from 'components/common/bodyEnd';\n\nimport styles from './popover.module.pcss';\nimport sheetStyles from '../styles/sheet.module.pcss';\nimport SheetBackdrop from '../sheetBackdrop';\nimport { usePopoverPosition } from './usePopoverPosition';\nimport { useFocusBoundary, tabbablesIn } from '../hooks/useFocusBoundary';\nimport { useSheet } from '../hooks/useSheet';\nimport { useOverlay } from '../hooks/useOverlay';\nimport { useComponentDefaults, usePresentationDefault } from '../configProvider';\nimport { markDismiss } from '../utils/dismissClick';\nimport { Presentation } from '../configProvider/presentation.types';\nimport { PopoverPlacement, PopoverAlign, PopoverTrigger, type PopoverProps } from './popover.types';\n\n/**\n * How long after its click an anchored popover still counts as opened by it: long enough for the\n * render the click causes, short enough that an old keypress does not decide a later open.\n */\nconst ACTIVATION_WINDOW_MS = 1000;\n\nfunction toReference(\n anchor: HTMLElement | null | undefined,\n triggerRef: RefObject<HTMLElement | null>,\n): RefObject<HTMLElement | null> {\n return anchor ? { current: anchor } : triggerRef;\n}\n\nfunction Popover(props: PopoverProps) {\n const {\n children = null,\n anchor,\n content = null,\n placement = PopoverPlacement.Bottom,\n align = PopoverAlign.Center,\n trigger = PopoverTrigger.Click,\n isOpen,\n defaultOpen = false,\n onOpenChange = () => {},\n offset = 10,\n withArrow = true,\n closeOnOutsideClick = true,\n closeOnEscape = true,\n openDelay = 100,\n closeDelay = 120,\n disabled = false,\n focusOnOpen = 'keyboard',\n closeOnTriggerClick = true,\n width = 'auto',\n constrainWidth = true,\n presentation: presentationProp,\n className,\n style,\n classNames,\n styles: slotStyles,\n ...rest\n } = useComponentDefaults('Popover', props);\n const triggerRef = useRef<HTMLDivElement>(null);\n const floatingRef = useRef<HTMLDivElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const arrowRef = useRef<HTMLDivElement>(null);\n const hoverTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n // Set from a capture handler on the panel, which React fires for its whole\n // React subtree — including children that portal elsewhere in the DOM, such as\n // a Dropdown's list inside a DatePicker's calendar. A DOM `contains` check\n // cannot see those, and without this the panel closes when one is used.\n const panelInteractedRef = useRef(false);\n // An outside click is a press that starts and ends outside while the panel is open. One that\n // starts inside is a drag, such as selecting a field's text, and Chromium and WebKit send its\n // `mouseup` to wherever it ends. One that started before the panel opened is the gesture that\n // opened it, such as Calendar's drag to create, which opens an editor on `pointerup`.\n const pressStartedOutsideRef = useRef(false);\n // Whether the open that is running came from the keyboard, which is what the\n // default `focusOnOpen` follows and what `onOpenChange` reports. A click raised\n // by Enter or Space reports `detail === 0`, where a pointer press counts the\n // clicks; an open with no trigger event at all, such as a panel that appears\n // while the user types, leaves this false.\n const openedByKeyboardRef = useRef(false);\n // A nested portal sits outside the panel's DOM; this is how focus leaving one counts as leaving.\n const lastPanelFocusRef = useRef<EventTarget | null>(null);\n function markPanelInteraction() {\n panelInteractedRef.current = true;\n }\n function markPanelFocus(event: React.FocusEvent) {\n markPanelInteraction();\n lastPanelFocusRef.current = event.target;\n }\n\n // What the panel is placed against, and where the focus goes back to. A new object exactly when\n // `anchor` changes, which is what restarts the position tracking for the new element: state, not\n // a memo, because a memo React chose to drop would restart it for no reason.\n const [reference, setReference] = useState(() => ({ anchor, ref: toReference(anchor, triggerRef) }));\n if (reference.anchor !== anchor) setReference({ anchor, ref: toReference(anchor, triggerRef) });\n const referenceRef = reference.ref;\n\n // An anchored popover is opened by its consumer through `isOpen`, so none of the key handling\n // below sees how. The click that caused it does: Enter and Space raise one with `detail === 0`,\n // the same test the trigger uses. Not `:focus-visible`, which a text field matches after a\n // mouse click too, and which stays on a keyboard-focused button that is then clicked.\n const activationRef = useRef<{ target: Node; keyboard: boolean; time: number } | null>(null);\n const anchored = anchor !== undefined;\n useEffect(() => {\n if (!anchored) return;\n function onClick(event: MouseEvent) {\n activationRef.current = { target: event.target as Node, keyboard: event.detail === 0, time: performance.now() };\n }\n // Capturing, so it is recorded before the consumer's own handler opens the panel.\n document.addEventListener('click', onClick, true);\n return () => document.removeEventListener('click', onClick, true);\n }, [anchored]);\n\n const isControlled = isOpen !== undefined;\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const open = isControlled ? isOpen : internalOpen;\n\n // Keep the outside-click/Escape listeners pointed at the latest setter without re-subscribing.\n const onOpenChangeRef = useRef(onOpenChange);\n useEffect(() => {\n onOpenChangeRef.current = onOpenChange;\n });\n\n const setOpen = useCallback(\n (next: boolean, fromKeyboard = false) => {\n if (disabled && next) return;\n if (next) openedByKeyboardRef.current = fromKeyboard;\n if (!isControlled) setInternalOpen(next);\n onOpenChangeRef.current(next, { fromKeyboard });\n },\n [disabled, isControlled],\n );\n\n // Explicit prop → this component's global default → the app-wide one → anchored.\n const appPresentation = usePresentationDefault();\n const presentation = presentationProp ?? appPresentation ?? Presentation.Default;\n const { isSheet: sheetPresentation, sheetStyle } = useSheet(presentation);\n // Hover and focus are pointer affordances that open something small next to what caused them;\n // a sheet is a deliberate, screen-owning open. Only a click asks for one.\n const isSheet = sheetPresentation && trigger === PopoverTrigger.Click;\n\n // Focus into the panel waits until it shows, since one that waits out a moving ancestor hidden\n // takes none.\n const shownRef = useRef(false);\n const focusPendingRef = useRef(false);\n function focusPanel() {\n focusPendingRef.current = false;\n const focusables = tabbablesIn(panelRef.current);\n if (focusables.length === 0) return;\n // Only claim the dialog role when we're actually managing focus for real content.\n floatingRef.current?.setAttribute('role', 'dialog');\n focusables[0].focus();\n }\n\n // A sheet isn't anchored to anything, so there's nothing to track, flip or clamp.\n usePopoverPosition({\n isOpen: !!open && !isSheet,\n placement,\n align,\n offset,\n triggerRef: referenceRef,\n floatingRef,\n panelRef,\n arrowRef: withArrow ? arrowRef : { current: null },\n matchTriggerWidth: width === 'trigger',\n onShown: () => {\n shownRef.current = true;\n if (focusPendingRef.current) focusPanel();\n },\n });\n\n // Registered for as long as it's open, not just as a sheet: this is what puts the popover on\n // the overlay stack, so an enclosing Modal knows something sits above it and neither drags\n // focus out of this (portaled, so outside the modal's panel) panel nor closes itself on the\n // Escape meant for this. Focus isn't trapped: a Popover is deliberately non-modal, and it\n // already moves focus into the panel on open by itself.\n const { restoreFocusToTrigger, focusAfterTrigger } = useFocusBoundary({\n triggerRef: referenceRef,\n contentRef: floatingRef,\n });\n const restoreFocusRef = useRef(restoreFocusToTrigger);\n useEffect(() => {\n restoreFocusRef.current = restoreFocusToTrigger;\n });\n\n // Focus inside the panel returns to the trigger however it closes, as with `hidePopover()`. Read\n // in a ref cleanup, while the panel is still in the DOM; moved in an effect, because StrictMode\n // detaches a new panel's refs once more right after it took the focus.\n const focusLeftWithPanelRef = useRef(false);\n const floatingCallbackRef = useCallback((node: HTMLDivElement | null) => {\n floatingRef.current = node;\n focusLeftWithPanelRef.current = false;\n if (!node) return;\n return () => {\n floatingRef.current = null;\n const active = document.activeElement;\n focusLeftWithPanelRef.current = !!active && (node.contains(active) || active === lastPanelFocusRef.current);\n };\n }, []);\n useEffect(() => {\n if (open || !focusLeftWithPanelRef.current) return;\n focusLeftWithPanelRef.current = false;\n const active = document.activeElement;\n if (!active || active === document.body) restoreFocusRef.current();\n }, [open]);\n\n useOverlay({\n isActive: !!open,\n containerRef: panelRef,\n onEscape: closeOnEscape\n ? () => {\n // Hand focus back to the trigger when it currently sits inside the panel.\n if (floatingRef.current?.contains(document.activeElement)) restoreFocusToTrigger();\n setOpen(false, true);\n }\n : undefined,\n trapFocus: false,\n lockScroll: isSheet,\n });\n\n // The panel is portaled to the end of the DOM, so Tab never flows into it naturally. When we\n // manage focus (click trigger + focusable content), move focus in on open and, on Tab out of\n // either end, close and continue focus as if the panel sat right after the trigger.\n useEffect(() => {\n if (!open) {\n openedByKeyboardRef.current = false;\n shownRef.current = false;\n focusPendingRef.current = false;\n return;\n }\n const activation = activationRef.current;\n activationRef.current = null;\n const anchorKeyed =\n !!anchor &&\n !!activation?.keyboard &&\n anchor.contains(activation.target) &&\n performance.now() - activation.time < ACTIVATION_WINDOW_MS;\n const takeFocus =\n focusOnOpen === true || (focusOnOpen === 'keyboard' && (openedByKeyboardRef.current || anchorKeyed));\n if (!takeFocus || trigger !== PopoverTrigger.Click) return;\n if (shownRef.current) focusPanel();\n else focusPendingRef.current = true;\n }, [open, trigger, focusOnOpen, anchor]);\n\n function handleFloatingKeyDown(event: React.KeyboardEvent) {\n if (event.key !== 'Tab' || trigger !== PopoverTrigger.Click) return;\n const focusables = tabbablesIn(panelRef.current);\n if (focusables.length === 0) return;\n const active = document.activeElement;\n if (!event.shiftKey && active === focusables[focusables.length - 1]) {\n event.preventDefault();\n focusAfterTrigger();\n setOpen(false, true);\n } else if (event.shiftKey && active === focusables[0]) {\n event.preventDefault();\n restoreFocusToTrigger();\n setOpen(false, true);\n }\n }\n\n // Outside click. Registered only while open and only for the relevant trigger mode; Escape is\n // handled by `useOverlay` above, which scopes it to the innermost open layer.\n useEffect(() => {\n if (!open) return;\n // Focus that landed in the panel before these listeners existed (ours on open, or content\n // that focuses itself on mount) set the flag with nothing to clear it, and the first\n // click outside was swallowed.\n panelInteractedRef.current = false;\n pressStartedOutsideRef.current = false;\n\n function containsNode(node: Node) {\n // Both trigger refs: with an anchor, `children` still toggle the panel, and a press on them is theirs.\n return Boolean(\n floatingRef.current?.contains(node) ||\n triggerRef.current?.contains(node) ||\n referenceRef.current?.contains(node),\n );\n }\n function isInside(event: Event) {\n // Read and clear: the flag describes this one event, and the panel's React\n // handler has already run by the time this does.\n const inPanelSubtree = panelInteractedRef.current;\n panelInteractedRef.current = false;\n return inPanelSubtree || containsNode(event.target as Node);\n }\n function onMouseDown(event: MouseEvent) {\n pressStartedOutsideRef.current = !isInside(event);\n }\n function onMouseUp(event: MouseEvent) {\n const pressStartedOutside = pressStartedOutsideRef.current;\n pressStartedOutsideRef.current = false;\n if (isInside(event) || !pressStartedOutside) return;\n markDismiss();\n setOpen(false);\n }\n // Keyboard counterpart to the outside click. Only focus that comes from inside closes it: code\n // moving focus elsewhere (a Modal restoring it) must not, nor `null`, focus back from another tab.\n function onFocusIn(event: FocusEvent) {\n if (isInside(event)) return;\n const from = event.relatedTarget as Node | null;\n if (!from || (from !== lastPanelFocusRef.current && !containsNode(from))) return;\n // A press on an outside field focuses it before its `mouseup`, and that is not the keyboard.\n // It closes here, before the `mouseup` that would mark its click, so it marks it now.\n const pressed = pressStartedOutsideRef.current;\n if (pressed) markDismiss();\n setOpen(false, !pressed);\n }\n\n if (closeOnOutsideClick && trigger !== PopoverTrigger.Hover) {\n window.addEventListener('mousedown', onMouseDown);\n window.addEventListener('mouseup', onMouseUp);\n document.addEventListener('focusin', onFocusIn);\n }\n return () => {\n window.removeEventListener('mousedown', onMouseDown);\n window.removeEventListener('mouseup', onMouseUp);\n document.removeEventListener('focusin', onFocusIn);\n };\n }, [open, closeOnOutsideClick, trigger, setOpen, referenceRef]);\n\n useEffect(() => () => clearTimeout(hoverTimer.current), []);\n\n function scheduleHover(next: boolean) {\n clearTimeout(hoverTimer.current);\n hoverTimer.current = setTimeout(() => setOpen(next), next ? openDelay : closeDelay);\n }\n\n // Opening from the keyboard without the trigger having to be a button that\n // happens to toggle on Enter: the arrow keys are what the menu-button pattern\n // asks for, and what a consumer reaches for first.\n function handleTriggerKeyDown(event: React.KeyboardEvent) {\n if (open || (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')) return;\n event.preventDefault();\n setOpen(true, true);\n }\n\n const triggerHandlers =\n trigger === PopoverTrigger.Click\n ? {\n onClick: (event: React.MouseEvent) => {\n // A field that opens a picker keeps it open when clicked again, so\n // that placing the caret in the field does not close the panel.\n if (open && !closeOnTriggerClick) return;\n setOpen(!open, event.detail === 0);\n },\n onKeyDown: handleTriggerKeyDown,\n }\n : trigger === PopoverTrigger.Hover\n ? { onMouseEnter: () => scheduleHover(true), onMouseLeave: () => scheduleHover(false) }\n : { onFocus: () => setOpen(true), onBlur: () => setOpen(false) };\n\n const floatingHoverHandlers =\n trigger === PopoverTrigger.Hover\n ? { onMouseEnter: () => scheduleHover(true), onMouseLeave: () => scheduleHover(false) }\n : {};\n\n return (\n <div\n {...rest}\n className={cx(styles.popover, className, classNames?.root)}\n style={{ ...style, ...slotStyles?.root }}\n >\n <div\n ref={triggerRef}\n className={cx(styles.popoverTrigger, classNames?.trigger)}\n style={slotStyles?.trigger}\n {...triggerHandlers}\n >\n {children}\n </div>\n {open && (\n <BodyEnd>\n {isSheet && (\n <SheetBackdrop\n onClose={() => {\n if (closeOnOutsideClick) setOpen(false);\n }}\n className={classNames?.backdrop}\n style={slotStyles?.backdrop}\n />\n )}\n <div\n ref={floatingCallbackRef}\n className={cx(isSheet ? sheetStyles.sheet : styles.popoverFloating, classNames?.floating)}\n style={{ ...(isSheet ? sheetStyle : undefined), ...slotStyles?.floating }}\n data-placement={placement}\n onKeyDown={handleFloatingKeyDown}\n onMouseDownCapture={markPanelInteraction}\n onMouseUpCapture={markPanelInteraction}\n onFocusCapture={markPanelFocus}\n {...floatingHoverHandlers}\n >\n <div\n ref={panelRef}\n className={cx(\n styles.popoverPanel,\n constrainWidth && styles.popoverPanelConstrained,\n isSheet && sheetStyles.sheetPanel,\n classNames?.panel,\n )}\n style={slotStyles?.panel}\n >\n {content}\n </div>\n {withArrow && !isSheet && (\n <div ref={arrowRef} className={cx(styles.popoverArrow, classNames?.arrow)} style={slotStyles?.arrow} />\n )}\n </div>\n </BodyEnd>\n )}\n </div>\n );\n}\n\nexport default Popover;\n"],"mappings":"k8BAoBA,IAAM,GAAuB,IAE7B,SAAS,EACP,EACA,EAC+B,CAC/B,OAAO,EAAS,CAAE,QAAS,CAAO,EAAI,CACxC,CAEA,SAAS,EAAQ,EAAqB,CACpC,GAAM,CACJ,YAAW,KACX,SACA,WAAU,KACV,YAAY,GAAiB,OAC7B,SAAQ,GAAa,OACrB,UAAU,EAAe,MACzB,SACA,eAAc,GACd,mBAAqB,CAAC,EACtB,UAAS,GACT,YAAY,GACZ,sBAAsB,GACtB,iBAAgB,GAChB,aAAY,IACZ,cAAa,IACb,WAAW,GACX,cAAc,WACd,uBAAsB,GACtB,SAAQ,OACR,kBAAiB,GACjB,aAAc,GACd,aACA,SACA,aACA,OAAQ,EACR,GAAG,IACD,EAAqB,UAAW,CAAK,EACnC,EAAa,EAAuB,IAAI,EACxC,EAAc,EAAuB,IAAI,EACzC,EAAW,EAAuB,IAAI,EACtC,EAAW,EAAuB,IAAI,EACtC,EAAa,EAAkD,IAAA,EAAS,EAKxE,EAAqB,EAAO,EAAK,EAKjC,EAAyB,EAAO,EAAK,EAMrC,EAAsB,EAAO,EAAK,EAElC,EAAoB,EAA2B,IAAI,EACzD,SAAS,GAAuB,CAC9B,EAAmB,QAAU,EAC/B,CACA,SAAS,GAAe,EAAyB,CAC/C,EAAqB,EACrB,EAAkB,QAAU,EAAM,MACpC,CAKA,GAAM,CAAC,EAAW,IAAgB,OAAgB,CAAE,SA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,GACC,EAAC,EAAD,CAAA,SAAA,CACG,GACC,EAAC,GAAD,CACE,YAAe,CACT,GAAqB,EAAQ,EAAK,CACxC,EACA,UAAW,GAAY,SACvB,MAAO,GAAY,QACpB,CAAA,EAEH,EAAC,MAAD,CACE,IAAK,GACL,UAAW,EAAG,EAAU,EAAY,MAAQ,EAAO,gBAAiB,GAAY,QAAQ,EACxF,MAAO,CAAE,GAAI,EAAU,GAAa,IAAA,GAAY,GAAG,GAAY,QAAS,EACxE,iBAAgB,EAChB,UAAW,GACX,mBAAoB,EACpB,iBAAkB,EAClB,eAAgB,GAChB,GAAI,GATN,SAAA,CAWE,EAAC,MAAD,CACE,IAAK,EACL,UAAW,EACT,EAAO,aACP,IAAkB,EAAO,wBACzB,GAAW,EAAY,WACvB,GAAY,KACd,EACA,MAAO,GAAY,MAElB,SAAA,EACE,CAAA,EACJ,GAAa,CAAC,GACb,EAAC,MAAD,CAAK,IAAK,EAAU,UAAW,EAAG,EAAO,aAAc,GAAY,KAAK,EAAG,MAAO,GAAY,KAAQ,CAAA,CAErG,CACE,CAAA,CAAA,CAAA,CAAA,CAER,GAET"}
@@ -1,2 +1,2 @@
1
- "use client";import e from"./progressBar.module.mjs";import t from"classnames";import{jsx as n}from"react/jsx-runtime";function r(e){let t=e.replace(`#`,``),n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16);return(.299*n+.587*r+.114*i)/255>.5?`#000000`:`#ffffff`}function i({className:i=void 0,total:a=100,progress:o=0,style:s=void 0,classNames:c,styles:l,...u}){function d(){let i=[];return Array.isArray(o)?i.push(...o):typeof o==`object`?i.push(o):i.push({amount:o}),i.map((o,s)=>{let u=a?o.amount/a*100:0;return n(`div`,{className:t(e.progressBarFill,s===i.length-1&&e.progressBarFillEnd,o.class,c?.fill),style:{width:`${u}%`,background:o.color||void 0,...l?.fill},title:o.label?`${o.label}: ${o.amount}`:void 0,children:o.label&&n(`div`,{className:t(e.progressBarLabel,c?.label),style:{...o.color?{color:r(o.color)}:{},...l?.label},children:o.label})},s)})}return n(`div`,{...u,className:t(e.progressBar,i,c?.root),style:{...s,...l?.root},children:d()})}export{i as default,r as getContrastColor};
1
+ "use client";import{toneProps as e,useToneCheck as t}from"../styles/tone.mjs";import n from"./progressBar.module.mjs";import r from"classnames";import{jsx as i}from"react/jsx-runtime";function a({className:a=void 0,total:o=100,progress:s=0,style:c=void 0,classNames:l,styles:u,...d}){let f=Array.isArray(s)?s:typeof s==`object`?[s]:[{amount:s}];t(`ProgressBar`,f.map(e=>e.color));function p(){return f.map((t,a)=>{let s=o?t.amount/o*100:0,c=t.color?e(t.color):void 0;return i(`div`,{className:r(n.progressBarFill,c&&[c.className,n.progressBarFillToned],a===f.length-1&&n.progressBarFillEnd,t.class,l?.fill),style:{width:`${s}%`,...c?.style,...u?.fill},title:t.label?`${t.label}: ${t.amount}`:void 0,children:t.label&&i(`div`,{className:r(n.progressBarLabel,l?.label),style:u?.label,children:t.label})},a)})}return i(`div`,{...d,className:r(n.progressBar,a,l?.root),style:{...c,...u?.root},children:p()})}export{a as default};
2
2
  //# sourceMappingURL=progressBar.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"progressBar.mjs","names":[],"sources":["../../../../package/common/progressBar/progressBar.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport cx from 'classnames';\nimport { Progress, ProgressBarProps } from './progressBar.types';\n\nimport styles from './progressBar.module.pcss';\n\nexport function getContrastColor(hexColor: string): string {\n const hex = hexColor.replace('#', '');\n const r = parseInt(hex.substring(0, 2), 16);\n const g = parseInt(hex.substring(2, 4), 16);\n const b = parseInt(hex.substring(4, 6), 16);\n\n const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;\n return luminance > 0.5 ? '#000000' : '#ffffff';\n}\n\nfunction ProgressBar({\n className = undefined,\n total = 100,\n progress = 0,\n style = undefined,\n classNames,\n styles: slotStyles,\n ...rest\n}: ProgressBarProps): ReactElement {\n function renderProgressBars() {\n const progressArray: Progress[] = [];\n\n if (Array.isArray(progress)) progressArray.push(...progress);\n else if (typeof progress === 'object') progressArray.push(progress);\n else progressArray.push({ amount: progress });\n\n return progressArray.map((prog, index) => {\n const widthPercentage = !total ? 0 : (prog.amount / total) * 100;\n\n return (\n <div\n key={index}\n className={cx(\n styles.progressBarFill,\n index === progressArray.length - 1 && styles.progressBarFillEnd,\n prog.class,\n classNames?.fill,\n )}\n style={{\n width: `${widthPercentage}%`,\n background: prog.color || undefined,\n ...slotStyles?.fill,\n }}\n title={prog.label ? `${prog.label}: ${prog.amount}` : undefined}\n >\n {prog.label && (\n <div\n className={cx(styles.progressBarLabel, classNames?.label)}\n style={{ ...(prog.color ? { color: getContrastColor(prog.color) } : {}), ...slotStyles?.label }}\n >\n {prog.label}\n </div>\n )}\n </div>\n );\n });\n }\n\n return (\n <div\n {...rest}\n className={cx(styles.progressBar, className, classNames?.root)}\n style={{ ...style, ...slotStyles?.root }}\n >\n {renderProgressBars()}\n </div>\n );\n}\n\nexport default ProgressBar;\n"],"mappings":"uHAMA,SAAgB,EAAiB,EAA0B,CACzD,IAAM,EAAM,EAAS,QAAQ,IAAK,EAAE,EAC9B,EAAI,SAAS,EAAI,UAAU,EAAG,CAAC,EAAG,EAAE,EACpC,EAAI,SAAS,EAAI,UAAU,EAAG,CAAC,EAAG,EAAE,EACpC,EAAI,SAAS,EAAI,UAAU,EAAG,CAAC,EAAG,EAAE,EAG1C,OADmB,KAAQ,EAAI,KAAQ,EAAI,KAAQ,GAAK,IACrC,GAAM,UAAY,SACvC,CAEA,SAAS,EAAY,CACnB,YAAY,IAAA,GACZ,QAAQ,IACR,WAAW,EACX,QAAQ,IAAA,GACR,aACA,OAAQ,EACR,GAAG,GAC8B,CACjC,SAAS,GAAqB,CAC5B,IAAM,EAA4B,CAAC,EAMnC,OAJI,MAAM,QAAQ,CAAQ,EAAG,EAAc,KAAK,GAAG,CAAQ,EAClD,OAAO,GAAa,SAAU,EAAc,KAAK,CAAQ,EAC7D,EAAc,KAAK,CAAE,OAAQ,CAAS,CAAC,EAErC,EAAc,KAAK,EAAM,IAAU,CACxC,IAAM,EAAmB,EAAa,EAAK,OAAS,EAAS,IAA5B,EAEjC,OACE,EAAC,MAAD,CAEE,UAAW,EACT,EAAO,gBACP,IAAU,EAAc,OAAS,GAAK,EAAO,mBAC7C,EAAK,MACL,GAAY,IACd,EACA,MAAO,CACL,MAAO,GAAG,EAAgB,GAC1B,WAAY,EAAK,OAAS,IAAA,GAC1B,GAAG,GAAY,IACjB,EACA,MAAO,EAAK,MAAQ,GAAG,EAAK,MAAM,IAAI,EAAK,SAAW,IAAA,GAErD,SAAA,EAAK,OACJ,EAAC,MAAD,CACE,UAAW,EAAG,EAAO,iBAAkB,GAAY,KAAK,EACxD,MAAO,CAAE,GAAI,EAAK,MAAQ,CAAE,MAAO,EAAiB,EAAK,KAAK,CAAE,EAAI,CAAC,EAAI,GAAG,GAAY,KAAM,EAE7F,SAAA,EAAK,KACH,CAAA,CAEJ,EAtBE,CAsBF,CAET,CAAC,CACH,CAEA,OACE,EAAC,MAAD,CACE,GAAI,EACJ,UAAW,EAAG,EAAO,YAAa,EAAW,GAAY,IAAI,EAC7D,MAAO,CAAE,GAAG,EAAO,GAAG,GAAY,IAAK,EAEtC,SAAA,EAAmB,CACjB,CAAA,CAET"}
1
+ {"version":3,"file":"progressBar.mjs","names":[],"sources":["../../../../package/common/progressBar/progressBar.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport cx from 'classnames';\nimport { Progress, ProgressBarProps } from './progressBar.types';\n\nimport styles from './progressBar.module.pcss';\nimport { toneProps, useToneCheck } from '../styles/tone';\n\nfunction ProgressBar({\n className = undefined,\n total = 100,\n progress = 0,\n style = undefined,\n classNames,\n styles: slotStyles,\n ...rest\n}: ProgressBarProps): ReactElement {\n const progressArray: Progress[] = Array.isArray(progress)\n ? progress\n : typeof progress === 'object'\n ? [progress]\n : [{ amount: progress }];\n useToneCheck(\n 'ProgressBar',\n progressArray.map((prog) => prog.color),\n );\n\n function renderProgressBars() {\n return progressArray.map((prog, index) => {\n const widthPercentage = !total ? 0 : (prog.amount / total) * 100;\n const tone = prog.color ? toneProps(prog.color) : undefined;\n\n return (\n <div\n key={index}\n className={cx(\n styles.progressBarFill,\n tone && [tone.className, styles.progressBarFillToned],\n index === progressArray.length - 1 && styles.progressBarFillEnd,\n prog.class,\n classNames?.fill,\n )}\n style={{\n width: `${widthPercentage}%`,\n ...tone?.style,\n ...slotStyles?.fill,\n }}\n title={prog.label ? `${prog.label}: ${prog.amount}` : undefined}\n >\n {prog.label && (\n <div className={cx(styles.progressBarLabel, classNames?.label)} style={slotStyles?.label}>\n {prog.label}\n </div>\n )}\n </div>\n );\n });\n }\n\n return (\n <div\n {...rest}\n className={cx(styles.progressBar, className, classNames?.root)}\n style={{ ...style, ...slotStyles?.root }}\n >\n {renderProgressBars()}\n </div>\n );\n}\n\nexport default ProgressBar;\n"],"mappings":"wLAOA,SAAS,EAAY,CACnB,YAAY,IAAA,GACZ,QAAQ,IACR,WAAW,EACX,QAAQ,IAAA,GACR,aACA,OAAQ,EACR,GAAG,GAC8B,CACjC,IAAM,EAA4B,MAAM,QAAQ,CAAQ,EACpD,EACA,OAAO,GAAa,SAClB,CAAC,CAAQ,EACT,CAAC,CAAE,OAAQ,CAAS,CAAC,EAC3B,EACE,cACA,EAAc,IAAK,GAAS,EAAK,KAAK,CACxC,EAEA,SAAS,GAAqB,CAC5B,OAAO,EAAc,KAAK,EAAM,IAAU,CACxC,IAAM,EAAmB,EAAa,EAAK,OAAS,EAAS,IAA5B,EAC3B,EAAO,EAAK,MAAQ,EAAU,EAAK,KAAK,EAAI,IAAA,GAElD,OACE,EAAC,MAAD,CAEE,UAAW,EACT,EAAO,gBACP,GAAQ,CAAC,EAAK,UAAW,EAAO,oBAAoB,EACpD,IAAU,EAAc,OAAS,GAAK,EAAO,mBAC7C,EAAK,MACL,GAAY,IACd,EACA,MAAO,CACL,MAAO,GAAG,EAAgB,GAC1B,GAAG,GAAM,MACT,GAAG,GAAY,IACjB,EACA,MAAO,EAAK,MAAQ,GAAG,EAAK,MAAM,IAAI,EAAK,SAAW,IAAA,GAErD,SAAA,EAAK,OACJ,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,iBAAkB,GAAY,KAAK,EAAG,MAAO,GAAY,MAChF,SAAA,EAAK,KACH,CAAA,CAEJ,EApBE,CAoBF,CAET,CAAC,CACH,CAEA,OACE,EAAC,MAAD,CACE,GAAI,EACJ,UAAW,EAAG,EAAO,YAAa,EAAW,GAAY,IAAI,EAC7D,MAAO,CAAE,GAAG,EAAO,GAAG,GAAY,IAAK,EAEtC,SAAA,EAAmB,CACjB,CAAA,CAET"}
@@ -1,2 +1,2 @@
1
- "use client";var e=`progressBar_LO0sX`,t=`progressBar-fill_rt32j`,n=`progressBar-fill-end_71wL3`,r=`progressBar-label_jWud2`,i={progressBar:e,"progressBar-fill":`progressBar-fill_rt32j`,progressBarFill:t,"progressBar-fill-end":`progressBar-fill-end_71wL3`,progressBarFillEnd:n,"progressBar-label":`progressBar-label_jWud2`,progressBarLabel:r};export{i as default,e as progressBar,t as progressBarFill,n as progressBarFillEnd,r as progressBarLabel};
1
+ "use client";var e=`progressBar_LO0sX`,t=`progressBar-fill_rt32j`,n=`progressBar-fill-end_71wL3`,r=`progressBar-fill-toned_cM4yE`,i=`progressBar-label_jWud2`,a={progressBar:e,"progressBar-fill":`progressBar-fill_rt32j`,progressBarFill:t,"progressBar-fill-end":`progressBar-fill-end_71wL3`,progressBarFillEnd:n,"progressBar-fill-toned":`progressBar-fill-toned_cM4yE`,progressBarFillToned:r,"progressBar-label":`progressBar-label_jWud2`,progressBarLabel:i};export{a as default,e as progressBar,t as progressBarFill,n as progressBarFillEnd,r as progressBarFillToned,i as progressBarLabel};
2
2
  //# sourceMappingURL=progressBar.module.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"progressBar.module.mjs","names":[],"sources":["../../../../package/common/progressBar/progressBar.module.pcss"],"sourcesContent":[".progressBar {\n min-width: 100px;\n min-height: 10px;\n background-color: var(--progress-bar-track-color, var(--background-accent-light));\n border-radius: var(--default-border-radius);\n overflow: hidden;\n display: flex;\n align-items: stretch;\n\n &-fill {\n background-color: var(--primary-color);\n background-image: var(--primary-gradient, none);\n width: 0;\n display: flex;\n align-items: center;\n overflow: hidden;\n transition: width 0.3s ease;\n transform: translateZ(0);\n container-type: inline-size;\n\n &-end {\n border-radius: 0 var(--default-border-radius) var(--default-border-radius) 0;\n }\n }\n\n &-label {\n color: var(--text-on-primary);\n font-size: 12px;\n padding: 0 min(5px, 4cqw);\n box-sizing: border-box;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n}\n\n/* The bar still shows its value, it just stops sliding to it. */\n@media (prefers-reduced-motion: reduce) {\n .progressBar-fill {\n transition: none;\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"progressBar.module.mjs","names":[],"sources":["../../../../package/common/progressBar/progressBar.module.pcss"],"sourcesContent":[".progressBar {\n min-width: 100px;\n min-height: 10px;\n background-color: var(--progress-bar-track-color, var(--background-accent-light));\n border-radius: var(--default-border-radius);\n overflow: hidden;\n display: flex;\n align-items: stretch;\n\n &-fill {\n background-color: var(--primary-color);\n background-image: var(--primary-gradient, none);\n width: 0;\n display: flex;\n align-items: center;\n overflow: hidden;\n transition: width 0.3s ease;\n transform: translateZ(0);\n container-type: inline-size;\n\n &-end {\n border-radius: 0 var(--default-border-radius) var(--default-border-radius) 0;\n }\n\n /* After the rule above, which it ties on specificity. */\n &-toned {\n background-color: var(--tone-fill);\n background-image: var(--tone-gradient);\n }\n }\n\n &-label {\n color: var(--text-on-primary);\n font-size: 12px;\n padding: 0 min(5px, 4cqw);\n box-sizing: border-box;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &-fill-toned &-label {\n color: var(--tone-contrast);\n }\n}\n\n/* The bar still shows its value, it just stops sliding to it. */\n@media (prefers-reduced-motion: reduce) {\n .progressBar-fill {\n transition: none;\n }\n}\n"],"mappings":""}