@zimyo/ui 1.0.2 → 1.1.1

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 (327) hide show
  1. package/dist/Accordion/index.d.ts +34 -0
  2. package/dist/Accordion/index.esm.js +129 -0
  3. package/dist/Accordion/index.js +137 -0
  4. package/dist/Button/index.d.ts +15 -0
  5. package/dist/Button/index.esm.js +23 -0
  6. package/dist/Button/index.js +28 -0
  7. package/dist/Card/index.d.ts +41 -0
  8. package/dist/Card/index.esm.js +36 -0
  9. package/dist/Card/index.js +38 -0
  10. package/dist/Popover/index.d.ts +19 -0
  11. package/dist/Popover/index.esm.js +22 -0
  12. package/dist/Popover/index.js +27 -0
  13. package/dist/RadioGroup/index.d.ts +31 -0
  14. package/dist/RadioGroup/index.esm.js +92 -0
  15. package/dist/RadioGroup/index.js +97 -0
  16. package/dist/Typography/index.d.ts +30 -0
  17. package/dist/Typography/index.esm.js +57 -0
  18. package/dist/Typography/index.js +66 -0
  19. package/package.json +106 -83
  20. package/dist/components/index.d.ts +0 -60
  21. package/dist/components/ui/accordion.d.ts +0 -10
  22. package/dist/components/ui/accordion.js +0 -58
  23. package/dist/components/ui/alert-dialog.d.ts +0 -17
  24. package/dist/components/ui/alert-dialog.js +0 -108
  25. package/dist/components/ui/alert.d.ts +0 -13
  26. package/dist/components/ui/alert.js +0 -52
  27. package/dist/components/ui/aspect-ratio.d.ts +0 -6
  28. package/dist/components/ui/aspect-ratio.js +0 -12
  29. package/dist/components/ui/avatar.d.ts +0 -9
  30. package/dist/components/ui/avatar.js +0 -37
  31. package/dist/components/ui/badge.d.ts +0 -13
  32. package/dist/components/ui/badge.js +0 -36
  33. package/dist/components/ui/breadcrumb.d.ts +0 -14
  34. package/dist/components/ui/breadcrumb.js +0 -94
  35. package/dist/components/ui/button.d.ts +0 -14
  36. package/dist/components/ui/button.js +0 -48
  37. package/dist/components/ui/calendar.d.ts +0 -13
  38. package/dist/components/ui/calendar.js +0 -137
  39. package/dist/components/ui/card.d.ts +0 -12
  40. package/dist/components/ui/card.js +0 -76
  41. package/dist/components/ui/carousel.d.ts +0 -25
  42. package/dist/components/ui/carousel.js +0 -173
  43. package/dist/components/ui/chart.d.ts +0 -44
  44. package/dist/components/ui/chart.js +0 -203
  45. package/dist/components/ui/checkbox.d.ts +0 -7
  46. package/dist/components/ui/checkbox.js +0 -26
  47. package/dist/components/ui/collapsible.d.ts +0 -8
  48. package/dist/components/ui/collapsible.js +0 -24
  49. package/dist/components/ui/command.d.ts +0 -22
  50. package/dist/components/ui/command.js +0 -119
  51. package/dist/components/ui/context-menu.d.ts +0 -28
  52. package/dist/components/ui/context-menu.js +0 -171
  53. package/dist/components/ui/dialog.d.ts +0 -18
  54. package/dist/components/ui/dialog.js +0 -106
  55. package/dist/components/ui/drawer.d.ts +0 -16
  56. package/dist/components/ui/drawer.js +0 -99
  57. package/dist/components/ui/dropdown-menu.d.ts +0 -28
  58. package/dist/components/ui/dropdown-menu.js +0 -173
  59. package/dist/components/ui/form.d.ts +0 -27
  60. package/dist/components/ui/form.js +0 -129
  61. package/dist/components/ui/hover-card.d.ts +0 -9
  62. package/dist/components/ui/hover-card.js +0 -36
  63. package/dist/components/ui/input-otp.d.ts +0 -14
  64. package/dist/components/ui/input-otp.js +0 -66
  65. package/dist/components/ui/input.d.ts +0 -6
  66. package/dist/components/ui/input.js +0 -18
  67. package/dist/components/ui/label.d.ts +0 -7
  68. package/dist/components/ui/label.js +0 -17
  69. package/dist/components/ui/menubar.d.ts +0 -29
  70. package/dist/components/ui/menubar.js +0 -191
  71. package/dist/components/ui/navigation-menu.d.ts +0 -18
  72. package/dist/components/ui/navigation-menu.js +0 -108
  73. package/dist/components/ui/pagination.d.ts +0 -18
  74. package/dist/components/ui/pagination.js +0 -103
  75. package/dist/components/ui/popover.d.ts +0 -10
  76. package/dist/components/ui/popover.js +0 -41
  77. package/dist/components/ui/progress.d.ts +0 -7
  78. package/dist/components/ui/progress.js +0 -26
  79. package/dist/components/ui/radio-group.d.ts +0 -8
  80. package/dist/components/ui/radio-group.js +0 -36
  81. package/dist/components/ui/resizable.d.ts +0 -11
  82. package/dist/components/ui/resizable.js +0 -42
  83. package/dist/components/ui/scroll-area.d.ts +0 -8
  84. package/dist/components/ui/scroll-area.js +0 -41
  85. package/dist/components/ui/select.d.ts +0 -18
  86. package/dist/components/ui/select.js +0 -136
  87. package/dist/components/ui/separator.d.ts +0 -7
  88. package/dist/components/ui/separator.js +0 -21
  89. package/dist/components/ui/sheet.d.ts +0 -16
  90. package/dist/components/ui/sheet.js +0 -106
  91. package/dist/components/ui/sidebar.d.ts +0 -74
  92. package/dist/components/ui/sidebar.js +0 -511
  93. package/dist/components/ui/skeleton.d.ts +0 -5
  94. package/dist/components/ui/skeleton.js +0 -16
  95. package/dist/components/ui/slider.d.ts +0 -7
  96. package/dist/components/ui/slider.js +0 -41
  97. package/dist/components/ui/sonner.d.ts +0 -6
  98. package/dist/components/ui/sonner.js +0 -18
  99. package/dist/components/ui/switch.d.ts +0 -7
  100. package/dist/components/ui/switch.js +0 -22
  101. package/dist/components/ui/table.d.ts +0 -13
  102. package/dist/components/ui/table.js +0 -90
  103. package/dist/components/ui/tabs.d.ts +0 -10
  104. package/dist/components/ui/tabs.js +0 -47
  105. package/dist/components/ui/textarea.d.ts +0 -6
  106. package/dist/components/ui/textarea.js +0 -16
  107. package/dist/components/ui/toggle-group.d.ts +0 -11
  108. package/dist/components/ui/toggle-group.js +0 -57
  109. package/dist/components/ui/toggle.d.ts +0 -13
  110. package/dist/components/ui/toggle.js +0 -41
  111. package/dist/components/ui/tooltip.d.ts +0 -10
  112. package/dist/components/ui/tooltip.js +0 -50
  113. package/dist/index.d.ts +0 -63
  114. package/dist/index.js +0 -48
  115. package/dist/lib/utils.d.ts +0 -5
  116. package/dist/lib/utils.js +0 -8
  117. package/dist/node_modules/@date-fns/tz/date/index.js +0 -101
  118. package/dist/node_modules/@date-fns/tz/date/mini.js +0 -207
  119. package/dist/node_modules/@date-fns/tz/tzOffset/index.js +0 -43
  120. package/dist/node_modules/@radix-ui/primitive/dist/index.js +0 -11
  121. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -39
  122. package/dist/node_modules/@radix-ui/react-context/dist/index.js +0 -79
  123. package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +0 -321
  124. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -211
  125. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +0 -29
  126. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -207
  127. package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -15
  128. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +0 -17
  129. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +0 -130
  130. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +0 -43
  131. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +0 -89
  132. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -12
  133. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -70
  134. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -18
  135. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -7
  136. package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -137
  137. package/dist/node_modules/class-variance-authority/dist/index.js +0 -44
  138. package/dist/node_modules/clsx/dist/clsx.js +0 -3
  139. package/dist/node_modules/cmdk/dist/chunk-NZJY6EH4.js +0 -3
  140. package/dist/node_modules/cmdk/dist/index.js +0 -10
  141. package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +0 -7
  142. package/dist/node_modules/date-fns/_lib/defaultOptions.js +0 -7
  143. package/dist/node_modules/date-fns/_lib/format/formatters.js +0 -775
  144. package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +0 -94
  145. package/dist/node_modules/date-fns/_lib/format/longFormatters.js +0 -66
  146. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +0 -31
  147. package/dist/node_modules/date-fns/_lib/normalizeDates.js +0 -11
  148. package/dist/node_modules/date-fns/_lib/normalizeInterval.js +0 -8
  149. package/dist/node_modules/date-fns/_lib/protectedTokens.js +0 -25
  150. package/dist/node_modules/date-fns/addDays.js +0 -41
  151. package/dist/node_modules/date-fns/addMonths.js +0 -75
  152. package/dist/node_modules/date-fns/addWeeks.js +0 -33
  153. package/dist/node_modules/date-fns/addYears.js +0 -33
  154. package/dist/node_modules/date-fns/constants.js +0 -46
  155. package/dist/node_modules/date-fns/constructFrom.js +0 -49
  156. package/dist/node_modules/date-fns/differenceInCalendarDays.js +0 -62
  157. package/dist/node_modules/date-fns/differenceInCalendarMonths.js +0 -42
  158. package/dist/node_modules/date-fns/eachMonthOfInterval.js +0 -65
  159. package/dist/node_modules/date-fns/endOfISOWeek.js +0 -35
  160. package/dist/node_modules/date-fns/endOfMonth.js +0 -37
  161. package/dist/node_modules/date-fns/endOfWeek.js +0 -53
  162. package/dist/node_modules/date-fns/endOfYear.js +0 -37
  163. package/dist/node_modules/date-fns/format.js +0 -423
  164. package/dist/node_modules/date-fns/getDayOfYear.js +0 -34
  165. package/dist/node_modules/date-fns/getDaysInMonth.js +0 -36
  166. package/dist/node_modules/date-fns/getISOWeek.js +0 -40
  167. package/dist/node_modules/date-fns/getISOWeekYear.js +0 -52
  168. package/dist/node_modules/date-fns/getMonth.js +0 -29
  169. package/dist/node_modules/date-fns/getWeek.js +0 -54
  170. package/dist/node_modules/date-fns/getWeekYear.js +0 -75
  171. package/dist/node_modules/date-fns/getYear.js +0 -29
  172. package/dist/node_modules/date-fns/isAfter.js +0 -25
  173. package/dist/node_modules/date-fns/isBefore.js +0 -25
  174. package/dist/node_modules/date-fns/isDate.js +0 -41
  175. package/dist/node_modules/date-fns/isSameDay.js +0 -46
  176. package/dist/node_modules/date-fns/isSameMonth.js +0 -43
  177. package/dist/node_modules/date-fns/isSameYear.js +0 -35
  178. package/dist/node_modules/date-fns/isValid.js +0 -39
  179. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +0 -10
  180. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +0 -64
  181. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +0 -59
  182. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +0 -22
  183. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +0 -103
  184. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +0 -41
  185. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +0 -13
  186. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +0 -189
  187. package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +0 -134
  188. package/dist/node_modules/date-fns/locale/en-US.js +0 -28
  189. package/dist/node_modules/date-fns/max.js +0 -49
  190. package/dist/node_modules/date-fns/min.js +0 -49
  191. package/dist/node_modules/date-fns/setMonth.js +0 -46
  192. package/dist/node_modules/date-fns/setYear.js +0 -40
  193. package/dist/node_modules/date-fns/startOfDay.js +0 -35
  194. package/dist/node_modules/date-fns/startOfISOWeek.js +0 -35
  195. package/dist/node_modules/date-fns/startOfISOWeekYear.js +0 -42
  196. package/dist/node_modules/date-fns/startOfMonth.js +0 -37
  197. package/dist/node_modules/date-fns/startOfWeek.js +0 -53
  198. package/dist/node_modules/date-fns/startOfWeekYear.js +0 -64
  199. package/dist/node_modules/date-fns/startOfYear.js +0 -36
  200. package/dist/node_modules/date-fns/toDate.js +0 -46
  201. package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +0 -1669
  202. package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +0 -37
  203. package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +0 -38
  204. package/dist/node_modules/get-nonce/dist/es2015/index.js +0 -8
  205. package/dist/node_modules/input-otp/dist/index.js +0 -24
  206. package/dist/node_modules/react-day-picker/dist/esm/DayPicker.js +0 -285
  207. package/dist/node_modules/react-day-picker/dist/esm/UI.js +0 -122
  208. package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js +0 -30
  209. package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js +0 -14
  210. package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js +0 -13
  211. package/dist/node_modules/react-day-picker/dist/esm/classes/DateLib.js +0 -522
  212. package/dist/node_modules/react-day-picker/dist/esm/components/Button.js +0 -13
  213. package/dist/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js +0 -13
  214. package/dist/node_modules/react-day-picker/dist/esm/components/Chevron.js +0 -18
  215. package/dist/node_modules/react-day-picker/dist/esm/components/Day.js +0 -18
  216. package/dist/node_modules/react-day-picker/dist/esm/components/DayButton.js +0 -19
  217. package/dist/node_modules/react-day-picker/dist/esm/components/Dropdown.js +0 -21
  218. package/dist/node_modules/react-day-picker/dist/esm/components/DropdownNav.js +0 -13
  219. package/dist/node_modules/react-day-picker/dist/esm/components/Footer.js +0 -13
  220. package/dist/node_modules/react-day-picker/dist/esm/components/Month.js +0 -15
  221. package/dist/node_modules/react-day-picker/dist/esm/components/MonthCaption.js +0 -14
  222. package/dist/node_modules/react-day-picker/dist/esm/components/MonthGrid.js +0 -13
  223. package/dist/node_modules/react-day-picker/dist/esm/components/Months.js +0 -13
  224. package/dist/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js +0 -15
  225. package/dist/node_modules/react-day-picker/dist/esm/components/Nav.js +0 -31
  226. package/dist/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js +0 -15
  227. package/dist/node_modules/react-day-picker/dist/esm/components/Option.js +0 -13
  228. package/dist/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js +0 -15
  229. package/dist/node_modules/react-day-picker/dist/esm/components/Root.js +0 -14
  230. package/dist/node_modules/react-day-picker/dist/esm/components/Select.js +0 -13
  231. package/dist/node_modules/react-day-picker/dist/esm/components/Week.js +0 -14
  232. package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumber.js +0 -14
  233. package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js +0 -13
  234. package/dist/node_modules/react-day-picker/dist/esm/components/Weekday.js +0 -13
  235. package/dist/node_modules/react-day-picker/dist/esm/components/Weekdays.js +0 -14
  236. package/dist/node_modules/react-day-picker/dist/esm/components/Weeks.js +0 -13
  237. package/dist/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js +0 -15
  238. package/dist/node_modules/react-day-picker/dist/esm/components/custom-components.js +0 -26
  239. package/dist/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js +0 -25
  240. package/dist/node_modules/react-day-picker/dist/esm/formatters/formatDay.js +0 -19
  241. package/dist/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js +0 -18
  242. package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js +0 -21
  243. package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js +0 -13
  244. package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js +0 -19
  245. package/dist/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js +0 -23
  246. package/dist/node_modules/react-day-picker/dist/esm/formatters/index.js +0 -7
  247. package/dist/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js +0 -73
  248. package/dist/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js +0 -95
  249. package/dist/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js +0 -22
  250. package/dist/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js +0 -28
  251. package/dist/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js +0 -33
  252. package/dist/node_modules/react-day-picker/dist/esm/helpers/getComponents.js +0 -20
  253. package/dist/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js +0 -27
  254. package/dist/node_modules/react-day-picker/dist/esm/helpers/getDates.js +0 -51
  255. package/dist/node_modules/react-day-picker/dist/esm/helpers/getDays.js +0 -19
  256. package/dist/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js +0 -33
  257. package/dist/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js +0 -24
  258. package/dist/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js +0 -46
  259. package/dist/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js +0 -24
  260. package/dist/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js +0 -28
  261. package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js +0 -33
  262. package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonths.js +0 -69
  263. package/dist/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js +0 -51
  264. package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js +0 -39
  265. package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js +0 -36
  266. package/dist/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js +0 -37
  267. package/dist/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js +0 -27
  268. package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js +0 -24
  269. package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js +0 -14
  270. package/dist/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js +0 -38
  271. package/dist/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js +0 -27
  272. package/dist/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js +0 -31
  273. package/dist/node_modules/react-day-picker/dist/esm/labels/index.js +0 -11
  274. package/dist/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js +0 -32
  275. package/dist/node_modules/react-day-picker/dist/esm/labels/labelGrid.js +0 -24
  276. package/dist/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js +0 -22
  277. package/dist/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js +0 -14
  278. package/dist/node_modules/react-day-picker/dist/esm/labels/labelNav.js +0 -13
  279. package/dist/node_modules/react-day-picker/dist/esm/labels/labelNext.js +0 -15
  280. package/dist/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js +0 -15
  281. package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js +0 -15
  282. package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js +0 -14
  283. package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js +0 -18
  284. package/dist/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js +0 -14
  285. package/dist/node_modules/react-day-picker/dist/esm/selection/useMulti.js +0 -57
  286. package/dist/node_modules/react-day-picker/dist/esm/selection/useRange.js +0 -45
  287. package/dist/node_modules/react-day-picker/dist/esm/selection/useSingle.js +0 -44
  288. package/dist/node_modules/react-day-picker/dist/esm/useAnimation.js +0 -175
  289. package/dist/node_modules/react-day-picker/dist/esm/useCalendar.js +0 -85
  290. package/dist/node_modules/react-day-picker/dist/esm/useDayPicker.js +0 -25
  291. package/dist/node_modules/react-day-picker/dist/esm/useFocus.js +0 -50
  292. package/dist/node_modules/react-day-picker/dist/esm/useSelection.js +0 -31
  293. package/dist/node_modules/react-day-picker/dist/esm/utils/addToRange.js +0 -92
  294. package/dist/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js +0 -62
  295. package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js +0 -30
  296. package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js +0 -74
  297. package/dist/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js +0 -35
  298. package/dist/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js +0 -21
  299. package/dist/node_modules/react-day-picker/dist/esm/utils/typeguards.js +0 -66
  300. package/dist/node_modules/react-hook-form/dist/index.esm.js +0 -507
  301. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +0 -9
  302. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +0 -160
  303. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +0 -38
  304. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -21
  305. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +0 -110
  306. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +0 -5
  307. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +0 -7
  308. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +0 -56
  309. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +0 -10
  310. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +0 -31
  311. package/dist/node_modules/react-resizable-panels/dist/react-resizable-panels.js +0 -2407
  312. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +0 -19
  313. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +0 -25
  314. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +0 -51
  315. package/dist/node_modules/sonner/dist/index.js +0 -1125
  316. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +0 -2956
  317. package/dist/node_modules/tslib/tslib.es6.js +0 -56
  318. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +0 -24
  319. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -48
  320. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +0 -42
  321. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +0 -21
  322. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +0 -77
  323. package/dist/node_modules/vaul/dist/index.js +0 -1627
  324. package/dist/providers/ThemeProvider.d.ts +0 -12
  325. package/dist/providers/ThemeProvider.js +0 -27
  326. package/dist/providers/index.d.ts +0 -3
  327. package/dist/styles.css +0 -1
@@ -1,2407 +0,0 @@
1
- import * as React from 'react';
2
- import { createContext, forwardRef, createElement, useContext, useRef, useLayoutEffect, useImperativeHandle, useState, useEffect, useCallback, useMemo } from 'react';
3
-
4
- const isBrowser = typeof window !== "undefined";
5
-
6
- // The "contextmenu" event is not supported as a PointerEvent in all browsers yet, so MouseEvent still need to be handled
7
-
8
- const PanelGroupContext = createContext(null);
9
- PanelGroupContext.displayName = "PanelGroupContext";
10
-
11
- const DATA_ATTRIBUTES = {
12
- group: "data-panel-group",
13
- groupDirection: "data-panel-group-direction",
14
- groupId: "data-panel-group-id",
15
- panel: "data-panel",
16
- panelCollapsible: "data-panel-collapsible",
17
- panelId: "data-panel-id",
18
- panelSize: "data-panel-size",
19
- resizeHandle: "data-resize-handle",
20
- resizeHandleActive: "data-resize-handle-active",
21
- resizeHandleEnabled: "data-panel-resize-handle-enabled",
22
- resizeHandleId: "data-panel-resize-handle-id",
23
- resizeHandleState: "data-resize-handle-state"
24
- };
25
- const PRECISION = 10;
26
-
27
- const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : () => {};
28
-
29
- const useId = React["useId".toString()];
30
- const wrappedUseId = typeof useId === "function" ? useId : () => null;
31
- let counter = 0;
32
- function useUniqueId(idFromParams = null) {
33
- const idFromUseId = wrappedUseId();
34
- const idRef = useRef(idFromParams || idFromUseId || null);
35
- if (idRef.current === null) {
36
- idRef.current = "" + counter++;
37
- }
38
- return idFromParams !== null && idFromParams !== void 0 ? idFromParams : idRef.current;
39
- }
40
-
41
- function PanelWithForwardedRef({
42
- children,
43
- className: classNameFromProps = "",
44
- collapsedSize,
45
- collapsible,
46
- defaultSize,
47
- forwardedRef,
48
- id: idFromProps,
49
- maxSize,
50
- minSize,
51
- onCollapse,
52
- onExpand,
53
- onResize,
54
- order,
55
- style: styleFromProps,
56
- tagName: Type = "div",
57
- ...rest
58
- }) {
59
- const context = useContext(PanelGroupContext);
60
- if (context === null) {
61
- throw Error(`Panel components must be rendered within a PanelGroup container`);
62
- }
63
- const {
64
- collapsePanel,
65
- expandPanel,
66
- getPanelSize,
67
- getPanelStyle,
68
- groupId,
69
- isPanelCollapsed,
70
- reevaluatePanelConstraints,
71
- registerPanel,
72
- resizePanel,
73
- unregisterPanel
74
- } = context;
75
- const panelId = useUniqueId(idFromProps);
76
- const panelDataRef = useRef({
77
- callbacks: {
78
- onCollapse,
79
- onExpand,
80
- onResize
81
- },
82
- constraints: {
83
- collapsedSize,
84
- collapsible,
85
- defaultSize,
86
- maxSize,
87
- minSize
88
- },
89
- id: panelId,
90
- idIsFromProps: idFromProps !== undefined,
91
- order
92
- });
93
- useRef({
94
- didLogMissingDefaultSizeWarning: false
95
- });
96
- useIsomorphicLayoutEffect(() => {
97
- const {
98
- callbacks,
99
- constraints
100
- } = panelDataRef.current;
101
- const prevConstraints = {
102
- ...constraints
103
- };
104
- panelDataRef.current.id = panelId;
105
- panelDataRef.current.idIsFromProps = idFromProps !== undefined;
106
- panelDataRef.current.order = order;
107
- callbacks.onCollapse = onCollapse;
108
- callbacks.onExpand = onExpand;
109
- callbacks.onResize = onResize;
110
- constraints.collapsedSize = collapsedSize;
111
- constraints.collapsible = collapsible;
112
- constraints.defaultSize = defaultSize;
113
- constraints.maxSize = maxSize;
114
- constraints.minSize = minSize;
115
-
116
- // If constraints have changed, we should revisit panel sizes.
117
- // This is uncommon but may happen if people are trying to implement pixel based constraints.
118
- if (prevConstraints.collapsedSize !== constraints.collapsedSize || prevConstraints.collapsible !== constraints.collapsible || prevConstraints.maxSize !== constraints.maxSize || prevConstraints.minSize !== constraints.minSize) {
119
- reevaluatePanelConstraints(panelDataRef.current, prevConstraints);
120
- }
121
- });
122
- useIsomorphicLayoutEffect(() => {
123
- const panelData = panelDataRef.current;
124
- registerPanel(panelData);
125
- return () => {
126
- unregisterPanel(panelData);
127
- };
128
- }, [order, panelId, registerPanel, unregisterPanel]);
129
- useImperativeHandle(forwardedRef, () => ({
130
- collapse: () => {
131
- collapsePanel(panelDataRef.current);
132
- },
133
- expand: minSize => {
134
- expandPanel(panelDataRef.current, minSize);
135
- },
136
- getId() {
137
- return panelId;
138
- },
139
- getSize() {
140
- return getPanelSize(panelDataRef.current);
141
- },
142
- isCollapsed() {
143
- return isPanelCollapsed(panelDataRef.current);
144
- },
145
- isExpanded() {
146
- return !isPanelCollapsed(panelDataRef.current);
147
- },
148
- resize: size => {
149
- resizePanel(panelDataRef.current, size);
150
- }
151
- }), [collapsePanel, expandPanel, getPanelSize, isPanelCollapsed, panelId, resizePanel]);
152
- const style = getPanelStyle(panelDataRef.current, defaultSize);
153
- return createElement(Type, {
154
- ...rest,
155
- children,
156
- className: classNameFromProps,
157
- id: panelId,
158
- style: {
159
- ...style,
160
- ...styleFromProps
161
- },
162
- // CSS selectors
163
- [DATA_ATTRIBUTES.groupId]: groupId,
164
- [DATA_ATTRIBUTES.panel]: "",
165
- [DATA_ATTRIBUTES.panelCollapsible]: collapsible || undefined,
166
- [DATA_ATTRIBUTES.panelId]: panelId,
167
- [DATA_ATTRIBUTES.panelSize]: parseFloat("" + style.flexGrow).toFixed(1)
168
- });
169
- }
170
- const Panel = forwardRef((props, ref) => createElement(PanelWithForwardedRef, {
171
- ...props,
172
- forwardedRef: ref
173
- }));
174
- PanelWithForwardedRef.displayName = "Panel";
175
- Panel.displayName = "forwardRef(Panel)";
176
-
177
- let currentCursorStyle = null;
178
- let prevRuleIndex = -1;
179
- let styleElement = null;
180
- function getCursorStyle(state, constraintFlags) {
181
- if (constraintFlags) {
182
- const horizontalMin = (constraintFlags & EXCEEDED_HORIZONTAL_MIN) !== 0;
183
- const horizontalMax = (constraintFlags & EXCEEDED_HORIZONTAL_MAX) !== 0;
184
- const verticalMin = (constraintFlags & EXCEEDED_VERTICAL_MIN) !== 0;
185
- const verticalMax = (constraintFlags & EXCEEDED_VERTICAL_MAX) !== 0;
186
- if (horizontalMin) {
187
- if (verticalMin) {
188
- return "se-resize";
189
- } else if (verticalMax) {
190
- return "ne-resize";
191
- } else {
192
- return "e-resize";
193
- }
194
- } else if (horizontalMax) {
195
- if (verticalMin) {
196
- return "sw-resize";
197
- } else if (verticalMax) {
198
- return "nw-resize";
199
- } else {
200
- return "w-resize";
201
- }
202
- } else if (verticalMin) {
203
- return "s-resize";
204
- } else if (verticalMax) {
205
- return "n-resize";
206
- }
207
- }
208
- switch (state) {
209
- case "horizontal":
210
- return "ew-resize";
211
- case "intersection":
212
- return "move";
213
- case "vertical":
214
- return "ns-resize";
215
- }
216
- }
217
- function resetGlobalCursorStyle() {
218
- if (styleElement !== null) {
219
- document.head.removeChild(styleElement);
220
- currentCursorStyle = null;
221
- styleElement = null;
222
- prevRuleIndex = -1;
223
- }
224
- }
225
- function setGlobalCursorStyle(state, constraintFlags) {
226
- var _styleElement$sheet$i, _styleElement$sheet2;
227
- const style = getCursorStyle(state, constraintFlags);
228
- if (currentCursorStyle === style) {
229
- return;
230
- }
231
- currentCursorStyle = style;
232
- if (styleElement === null) {
233
- styleElement = document.createElement("style");
234
- document.head.appendChild(styleElement);
235
- }
236
- if (prevRuleIndex >= 0) {
237
- var _styleElement$sheet;
238
- (_styleElement$sheet = styleElement.sheet) === null || _styleElement$sheet === void 0 ? void 0 : _styleElement$sheet.removeRule(prevRuleIndex);
239
- }
240
- prevRuleIndex = (_styleElement$sheet$i = (_styleElement$sheet2 = styleElement.sheet) === null || _styleElement$sheet2 === void 0 ? void 0 : _styleElement$sheet2.insertRule(`*{cursor: ${style} !important;}`)) !== null && _styleElement$sheet$i !== void 0 ? _styleElement$sheet$i : -1;
241
- }
242
-
243
- function isKeyDown(event) {
244
- return event.type === "keydown";
245
- }
246
- function isPointerEvent(event) {
247
- return event.type.startsWith("pointer");
248
- }
249
- function isMouseEvent(event) {
250
- return event.type.startsWith("mouse");
251
- }
252
-
253
- function getResizeEventCoordinates(event) {
254
- if (isPointerEvent(event)) {
255
- if (event.isPrimary) {
256
- return {
257
- x: event.clientX,
258
- y: event.clientY
259
- };
260
- }
261
- } else if (isMouseEvent(event)) {
262
- return {
263
- x: event.clientX,
264
- y: event.clientY
265
- };
266
- }
267
- return {
268
- x: Infinity,
269
- y: Infinity
270
- };
271
- }
272
-
273
- function getInputType() {
274
- if (typeof matchMedia === "function") {
275
- return matchMedia("(pointer:coarse)").matches ? "coarse" : "fine";
276
- }
277
- }
278
-
279
- function intersects(rectOne, rectTwo, strict) {
280
- {
281
- return rectOne.x < rectTwo.x + rectTwo.width && rectOne.x + rectOne.width > rectTwo.x && rectOne.y < rectTwo.y + rectTwo.height && rectOne.y + rectOne.height > rectTwo.y;
282
- }
283
- }
284
-
285
- // Forked from NPM stacking-order@2.0.0
286
-
287
- /**
288
- * Determine which of two nodes appears in front of the other —
289
- * if `a` is in front, returns 1, otherwise returns -1
290
- * @param {HTMLElement | SVGElement} a
291
- * @param {HTMLElement | SVGElement} b
292
- */
293
- function compare(a, b) {
294
- if (a === b) throw new Error("Cannot compare node with itself");
295
- const ancestors = {
296
- a: get_ancestors(a),
297
- b: get_ancestors(b)
298
- };
299
- let common_ancestor;
300
-
301
- // remove shared ancestors
302
- while (ancestors.a.at(-1) === ancestors.b.at(-1)) {
303
- a = ancestors.a.pop();
304
- b = ancestors.b.pop();
305
- common_ancestor = a;
306
- }
307
- assert(common_ancestor, "Stacking order can only be calculated for elements with a common ancestor");
308
- const z_indexes = {
309
- a: get_z_index(find_stacking_context(ancestors.a)),
310
- b: get_z_index(find_stacking_context(ancestors.b))
311
- };
312
- if (z_indexes.a === z_indexes.b) {
313
- const children = common_ancestor.childNodes;
314
- const furthest_ancestors = {
315
- a: ancestors.a.at(-1),
316
- b: ancestors.b.at(-1)
317
- };
318
- let i = children.length;
319
- while (i--) {
320
- const child = children[i];
321
- if (child === furthest_ancestors.a) return 1;
322
- if (child === furthest_ancestors.b) return -1;
323
- }
324
- }
325
- return Math.sign(z_indexes.a - z_indexes.b);
326
- }
327
- const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
328
-
329
- /** @param {HTMLElement | SVGElement} node */
330
- function is_flex_item(node) {
331
- var _get_parent;
332
- // @ts-ignore
333
- const display = getComputedStyle((_get_parent = get_parent(node)) !== null && _get_parent !== void 0 ? _get_parent : node).display;
334
- return display === "flex" || display === "inline-flex";
335
- }
336
-
337
- /** @param {HTMLElement | SVGElement} node */
338
- function creates_stacking_context(node) {
339
- const style = getComputedStyle(node);
340
-
341
- // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
342
- if (style.position === "fixed") return true;
343
- // Forked to fix upstream bug https://github.com/Rich-Harris/stacking-order/issues/3
344
- // if (
345
- // (style.zIndex !== "auto" && style.position !== "static") ||
346
- // is_flex_item(node)
347
- // )
348
- if (style.zIndex !== "auto" && (style.position !== "static" || is_flex_item(node))) return true;
349
- if (+style.opacity < 1) return true;
350
- if ("transform" in style && style.transform !== "none") return true;
351
- if ("webkitTransform" in style && style.webkitTransform !== "none") return true;
352
- if ("mixBlendMode" in style && style.mixBlendMode !== "normal") return true;
353
- if ("filter" in style && style.filter !== "none") return true;
354
- if ("webkitFilter" in style && style.webkitFilter !== "none") return true;
355
- if ("isolation" in style && style.isolation === "isolate") return true;
356
- if (props.test(style.willChange)) return true;
357
- // @ts-expect-error
358
- if (style.webkitOverflowScrolling === "touch") return true;
359
- return false;
360
- }
361
-
362
- /** @param {(HTMLElement| SVGElement)[]} nodes */
363
- function find_stacking_context(nodes) {
364
- let i = nodes.length;
365
- while (i--) {
366
- const node = nodes[i];
367
- assert(node, "Missing node");
368
- if (creates_stacking_context(node)) return node;
369
- }
370
- return null;
371
- }
372
-
373
- /** @param {HTMLElement | SVGElement} node */
374
- function get_z_index(node) {
375
- return node && Number(getComputedStyle(node).zIndex) || 0;
376
- }
377
-
378
- /** @param {HTMLElement} node */
379
- function get_ancestors(node) {
380
- const ancestors = [];
381
- while (node) {
382
- ancestors.push(node);
383
- // @ts-ignore
384
- node = get_parent(node);
385
- }
386
- return ancestors; // [ node, ... <body>, <html>, document ]
387
- }
388
-
389
- /** @param {HTMLElement} node */
390
- function get_parent(node) {
391
- const {
392
- parentNode
393
- } = node;
394
- if (parentNode && parentNode instanceof ShadowRoot) {
395
- return parentNode.host;
396
- }
397
- return parentNode;
398
- }
399
-
400
- const EXCEEDED_HORIZONTAL_MIN = 0b0001;
401
- const EXCEEDED_HORIZONTAL_MAX = 0b0010;
402
- const EXCEEDED_VERTICAL_MIN = 0b0100;
403
- const EXCEEDED_VERTICAL_MAX = 0b1000;
404
- const isCoarsePointer = getInputType() === "coarse";
405
- let intersectingHandles = [];
406
- let isPointerDown = false;
407
- let ownerDocumentCounts = new Map();
408
- let panelConstraintFlags = new Map();
409
- const registeredResizeHandlers = new Set();
410
- function registerResizeHandle(resizeHandleId, element, direction, hitAreaMargins, setResizeHandlerState) {
411
- var _ownerDocumentCounts$;
412
- const {
413
- ownerDocument
414
- } = element;
415
- const data = {
416
- direction,
417
- element,
418
- hitAreaMargins,
419
- setResizeHandlerState
420
- };
421
- const count = (_ownerDocumentCounts$ = ownerDocumentCounts.get(ownerDocument)) !== null && _ownerDocumentCounts$ !== void 0 ? _ownerDocumentCounts$ : 0;
422
- ownerDocumentCounts.set(ownerDocument, count + 1);
423
- registeredResizeHandlers.add(data);
424
- updateListeners();
425
- return function unregisterResizeHandle() {
426
- var _ownerDocumentCounts$2;
427
- panelConstraintFlags.delete(resizeHandleId);
428
- registeredResizeHandlers.delete(data);
429
- const count = (_ownerDocumentCounts$2 = ownerDocumentCounts.get(ownerDocument)) !== null && _ownerDocumentCounts$2 !== void 0 ? _ownerDocumentCounts$2 : 1;
430
- ownerDocumentCounts.set(ownerDocument, count - 1);
431
- updateListeners();
432
- if (count === 1) {
433
- ownerDocumentCounts.delete(ownerDocument);
434
- }
435
-
436
- // If the resize handle that is currently unmounting is intersecting with the pointer,
437
- // update the global pointer to account for the change
438
- if (intersectingHandles.includes(data)) {
439
- const index = intersectingHandles.indexOf(data);
440
- if (index >= 0) {
441
- intersectingHandles.splice(index, 1);
442
- }
443
- updateCursor();
444
-
445
- // Also instruct the handle to stop dragging; this prevents the parent group from being left in an inconsistent state
446
- // See github.com/bvaughn/react-resizable-panels/issues/402
447
- setResizeHandlerState("up", true, null);
448
- }
449
- };
450
- }
451
- function handlePointerDown(event) {
452
- const {
453
- target
454
- } = event;
455
- const {
456
- x,
457
- y
458
- } = getResizeEventCoordinates(event);
459
- isPointerDown = true;
460
- recalculateIntersectingHandles({
461
- target,
462
- x,
463
- y
464
- });
465
- updateListeners();
466
- if (intersectingHandles.length > 0) {
467
- updateResizeHandlerStates("down", event);
468
- event.preventDefault();
469
- if (!isWithinResizeHandle(target)) {
470
- event.stopImmediatePropagation();
471
- }
472
- }
473
- }
474
- function handlePointerMove(event) {
475
- const {
476
- x,
477
- y
478
- } = getResizeEventCoordinates(event);
479
-
480
- // Edge case (see #340)
481
- // Detect when the pointer has been released outside an iframe on a different domain
482
- if (isPointerDown && event.buttons === 0) {
483
- isPointerDown = false;
484
- updateResizeHandlerStates("up", event);
485
- }
486
- if (!isPointerDown) {
487
- const {
488
- target
489
- } = event;
490
-
491
- // Recalculate intersecting handles whenever the pointer moves, except if it has already been pressed
492
- // at that point, the handles may not move with the pointer (depending on constraints)
493
- // but the same set of active handles should be locked until the pointer is released
494
- recalculateIntersectingHandles({
495
- target,
496
- x,
497
- y
498
- });
499
- }
500
- updateResizeHandlerStates("move", event);
501
-
502
- // Update cursor based on return value(s) from active handles
503
- updateCursor();
504
- if (intersectingHandles.length > 0) {
505
- event.preventDefault();
506
- }
507
- }
508
- function handlePointerUp(event) {
509
- const {
510
- target
511
- } = event;
512
- const {
513
- x,
514
- y
515
- } = getResizeEventCoordinates(event);
516
- panelConstraintFlags.clear();
517
- isPointerDown = false;
518
- if (intersectingHandles.length > 0) {
519
- event.preventDefault();
520
- if (!isWithinResizeHandle(target)) {
521
- event.stopImmediatePropagation();
522
- }
523
- }
524
- updateResizeHandlerStates("up", event);
525
- recalculateIntersectingHandles({
526
- target,
527
- x,
528
- y
529
- });
530
- updateCursor();
531
- updateListeners();
532
- }
533
- function isWithinResizeHandle(element) {
534
- let currentElement = element;
535
- while (currentElement) {
536
- if (currentElement.hasAttribute(DATA_ATTRIBUTES.resizeHandle)) {
537
- return true;
538
- }
539
- currentElement = currentElement.parentElement;
540
- }
541
- return false;
542
- }
543
- function recalculateIntersectingHandles({
544
- target,
545
- x,
546
- y
547
- }) {
548
- intersectingHandles.splice(0);
549
- let targetElement = null;
550
- if (target instanceof HTMLElement || target instanceof SVGElement) {
551
- targetElement = target;
552
- }
553
- registeredResizeHandlers.forEach(data => {
554
- const {
555
- element: dragHandleElement,
556
- hitAreaMargins
557
- } = data;
558
- const dragHandleRect = dragHandleElement.getBoundingClientRect();
559
- const {
560
- bottom,
561
- left,
562
- right,
563
- top
564
- } = dragHandleRect;
565
- const margin = isCoarsePointer ? hitAreaMargins.coarse : hitAreaMargins.fine;
566
- const eventIntersects = x >= left - margin && x <= right + margin && y >= top - margin && y <= bottom + margin;
567
- if (eventIntersects) {
568
- // TRICKY
569
- // We listen for pointers events at the root in order to support hit area margins
570
- // (determining when the pointer is close enough to an element to be considered a "hit")
571
- // Clicking on an element "above" a handle (e.g. a modal) should prevent a hit though
572
- // so at this point we need to compare stacking order of a potentially intersecting drag handle,
573
- // and the element that was actually clicked/touched
574
- if (targetElement !== null && document.contains(targetElement) && dragHandleElement !== targetElement && !dragHandleElement.contains(targetElement) && !targetElement.contains(dragHandleElement) &&
575
- // Calculating stacking order has a cost, so we should avoid it if possible
576
- // That is why we only check potentially intersecting handles,
577
- // and why we skip if the event target is within the handle's DOM
578
- compare(targetElement, dragHandleElement) > 0) {
579
- // If the target is above the drag handle, then we also need to confirm they overlap
580
- // If they are beside each other (e.g. a panel and its drag handle) then the handle is still interactive
581
- //
582
- // It's not enough to compare only the target
583
- // The target might be a small element inside of a larger container
584
- // (For example, a SPAN or a DIV inside of a larger modal dialog)
585
- let currentElement = targetElement;
586
- let didIntersect = false;
587
- while (currentElement) {
588
- if (currentElement.contains(dragHandleElement)) {
589
- break;
590
- } else if (intersects(currentElement.getBoundingClientRect(), dragHandleRect)) {
591
- didIntersect = true;
592
- break;
593
- }
594
- currentElement = currentElement.parentElement;
595
- }
596
- if (didIntersect) {
597
- return;
598
- }
599
- }
600
- intersectingHandles.push(data);
601
- }
602
- });
603
- }
604
- function reportConstraintsViolation(resizeHandleId, flag) {
605
- panelConstraintFlags.set(resizeHandleId, flag);
606
- }
607
- function updateCursor() {
608
- let intersectsHorizontal = false;
609
- let intersectsVertical = false;
610
- intersectingHandles.forEach(data => {
611
- const {
612
- direction
613
- } = data;
614
- if (direction === "horizontal") {
615
- intersectsHorizontal = true;
616
- } else {
617
- intersectsVertical = true;
618
- }
619
- });
620
- let constraintFlags = 0;
621
- panelConstraintFlags.forEach(flag => {
622
- constraintFlags |= flag;
623
- });
624
- if (intersectsHorizontal && intersectsVertical) {
625
- setGlobalCursorStyle("intersection", constraintFlags);
626
- } else if (intersectsHorizontal) {
627
- setGlobalCursorStyle("horizontal", constraintFlags);
628
- } else if (intersectsVertical) {
629
- setGlobalCursorStyle("vertical", constraintFlags);
630
- } else {
631
- resetGlobalCursorStyle();
632
- }
633
- }
634
- let listenersAbortController;
635
- function updateListeners() {
636
- var _listenersAbortContro;
637
- (_listenersAbortContro = listenersAbortController) === null || _listenersAbortContro === void 0 ? void 0 : _listenersAbortContro.abort();
638
- listenersAbortController = new AbortController();
639
- const options = {
640
- capture: true,
641
- signal: listenersAbortController.signal
642
- };
643
- if (!registeredResizeHandlers.size) {
644
- return;
645
- }
646
- if (isPointerDown) {
647
- if (intersectingHandles.length > 0) {
648
- ownerDocumentCounts.forEach((count, ownerDocument) => {
649
- const {
650
- body
651
- } = ownerDocument;
652
- if (count > 0) {
653
- body.addEventListener("contextmenu", handlePointerUp, options);
654
- body.addEventListener("pointerleave", handlePointerMove, options);
655
- body.addEventListener("pointermove", handlePointerMove, options);
656
- }
657
- });
658
- }
659
- ownerDocumentCounts.forEach((_, ownerDocument) => {
660
- const {
661
- body
662
- } = ownerDocument;
663
- body.addEventListener("pointerup", handlePointerUp, options);
664
- body.addEventListener("pointercancel", handlePointerUp, options);
665
- });
666
- } else {
667
- ownerDocumentCounts.forEach((count, ownerDocument) => {
668
- const {
669
- body
670
- } = ownerDocument;
671
- if (count > 0) {
672
- body.addEventListener("pointerdown", handlePointerDown, options);
673
- body.addEventListener("pointermove", handlePointerMove, options);
674
- }
675
- });
676
- }
677
- }
678
- function updateResizeHandlerStates(action, event) {
679
- registeredResizeHandlers.forEach(data => {
680
- const {
681
- setResizeHandlerState
682
- } = data;
683
- const isActive = intersectingHandles.includes(data);
684
- setResizeHandlerState(action, isActive, event);
685
- });
686
- }
687
-
688
- function useForceUpdate() {
689
- const [_, setCount] = useState(0);
690
- return useCallback(() => setCount(prevCount => prevCount + 1), []);
691
- }
692
-
693
- function assert(expectedCondition, message) {
694
- if (!expectedCondition) {
695
- console.error(message);
696
- throw Error(message);
697
- }
698
- }
699
-
700
- function fuzzyCompareNumbers(actual, expected, fractionDigits = PRECISION) {
701
- if (actual.toFixed(fractionDigits) === expected.toFixed(fractionDigits)) {
702
- return 0;
703
- } else {
704
- return actual > expected ? 1 : -1;
705
- }
706
- }
707
- function fuzzyNumbersEqual$1(actual, expected, fractionDigits = PRECISION) {
708
- return fuzzyCompareNumbers(actual, expected, fractionDigits) === 0;
709
- }
710
-
711
- function fuzzyNumbersEqual(actual, expected, fractionDigits) {
712
- return fuzzyCompareNumbers(actual, expected, fractionDigits) === 0;
713
- }
714
-
715
- function fuzzyLayoutsEqual(actual, expected, fractionDigits) {
716
- if (actual.length !== expected.length) {
717
- return false;
718
- }
719
- for (let index = 0; index < actual.length; index++) {
720
- const actualSize = actual[index];
721
- const expectedSize = expected[index];
722
- if (!fuzzyNumbersEqual(actualSize, expectedSize, fractionDigits)) {
723
- return false;
724
- }
725
- }
726
- return true;
727
- }
728
-
729
- // Panel size must be in percentages; pixel values should be pre-converted
730
- function resizePanel({
731
- panelConstraints: panelConstraintsArray,
732
- panelIndex,
733
- size
734
- }) {
735
- const panelConstraints = panelConstraintsArray[panelIndex];
736
- assert(panelConstraints != null, `Panel constraints not found for index ${panelIndex}`);
737
- let {
738
- collapsedSize = 0,
739
- collapsible,
740
- maxSize = 100,
741
- minSize = 0
742
- } = panelConstraints;
743
- if (fuzzyCompareNumbers(size, minSize) < 0) {
744
- if (collapsible) {
745
- // Collapsible panels should snap closed or open only once they cross the halfway point between collapsed and min size.
746
- const halfwayPoint = (collapsedSize + minSize) / 2;
747
- if (fuzzyCompareNumbers(size, halfwayPoint) < 0) {
748
- size = collapsedSize;
749
- } else {
750
- size = minSize;
751
- }
752
- } else {
753
- size = minSize;
754
- }
755
- }
756
- size = Math.min(maxSize, size);
757
- size = parseFloat(size.toFixed(PRECISION));
758
- return size;
759
- }
760
-
761
- // All units must be in percentages; pixel values should be pre-converted
762
- function adjustLayoutByDelta({
763
- delta,
764
- initialLayout,
765
- panelConstraints: panelConstraintsArray,
766
- pivotIndices,
767
- prevLayout,
768
- trigger
769
- }) {
770
- if (fuzzyNumbersEqual(delta, 0)) {
771
- return initialLayout;
772
- }
773
- const nextLayout = [...initialLayout];
774
- const [firstPivotIndex, secondPivotIndex] = pivotIndices;
775
- assert(firstPivotIndex != null, "Invalid first pivot index");
776
- assert(secondPivotIndex != null, "Invalid second pivot index");
777
- let deltaApplied = 0;
778
-
779
- // const DEBUG = [];
780
- // DEBUG.push(`adjustLayoutByDelta()`);
781
- // DEBUG.push(` initialLayout: ${initialLayout.join(", ")}`);
782
- // DEBUG.push(` prevLayout: ${prevLayout.join(", ")}`);
783
- // DEBUG.push(` delta: ${delta}`);
784
- // DEBUG.push(` pivotIndices: ${pivotIndices.join(", ")}`);
785
- // DEBUG.push(` trigger: ${trigger}`);
786
- // DEBUG.push("");
787
-
788
- // A resizing panel affects the panels before or after it.
789
- //
790
- // A negative delta means the panel(s) immediately after the resize handle should grow/expand by decreasing its offset.
791
- // Other panels may also need to shrink/contract (and shift) to make room, depending on the min weights.
792
- //
793
- // A positive delta means the panel(s) immediately before the resize handle should "expand".
794
- // This is accomplished by shrinking/contracting (and shifting) one or more of the panels after the resize handle.
795
-
796
- {
797
- // If this is a resize triggered by a keyboard event, our logic for expanding/collapsing is different.
798
- // We no longer check the halfway threshold because this may prevent the panel from expanding at all.
799
- if (trigger === "keyboard") {
800
- {
801
- // Check if we should expand a collapsed panel
802
- const index = delta < 0 ? secondPivotIndex : firstPivotIndex;
803
- const panelConstraints = panelConstraintsArray[index];
804
- assert(panelConstraints, `Panel constraints not found for index ${index}`);
805
- const {
806
- collapsedSize = 0,
807
- collapsible,
808
- minSize = 0
809
- } = panelConstraints;
810
-
811
- // DEBUG.push(`edge case check 1: ${index}`);
812
- // DEBUG.push(` -> collapsible? ${collapsible}`);
813
- if (collapsible) {
814
- const prevSize = initialLayout[index];
815
- assert(prevSize != null, `Previous layout not found for panel index ${index}`);
816
- if (fuzzyNumbersEqual(prevSize, collapsedSize)) {
817
- const localDelta = minSize - prevSize;
818
- // DEBUG.push(` -> expand delta: ${localDelta}`);
819
-
820
- if (fuzzyCompareNumbers(localDelta, Math.abs(delta)) > 0) {
821
- delta = delta < 0 ? 0 - localDelta : localDelta;
822
- // DEBUG.push(` -> delta: ${delta}`);
823
- }
824
- }
825
- }
826
- }
827
-
828
- {
829
- // Check if we should collapse a panel at its minimum size
830
- const index = delta < 0 ? firstPivotIndex : secondPivotIndex;
831
- const panelConstraints = panelConstraintsArray[index];
832
- assert(panelConstraints, `No panel constraints found for index ${index}`);
833
- const {
834
- collapsedSize = 0,
835
- collapsible,
836
- minSize = 0
837
- } = panelConstraints;
838
-
839
- // DEBUG.push(`edge case check 2: ${index}`);
840
- // DEBUG.push(` -> collapsible? ${collapsible}`);
841
- if (collapsible) {
842
- const prevSize = initialLayout[index];
843
- assert(prevSize != null, `Previous layout not found for panel index ${index}`);
844
- if (fuzzyNumbersEqual(prevSize, minSize)) {
845
- const localDelta = prevSize - collapsedSize;
846
- // DEBUG.push(` -> expand delta: ${localDelta}`);
847
-
848
- if (fuzzyCompareNumbers(localDelta, Math.abs(delta)) > 0) {
849
- delta = delta < 0 ? 0 - localDelta : localDelta;
850
- // DEBUG.push(` -> delta: ${delta}`);
851
- }
852
- }
853
- }
854
- }
855
- }
856
- // DEBUG.push("");
857
- }
858
-
859
- {
860
- // Pre-calculate max available delta in the opposite direction of our pivot.
861
- // This will be the maximum amount we're allowed to expand/contract the panels in the primary direction.
862
- // If this amount is less than the requested delta, adjust the requested delta.
863
- // If this amount is greater than the requested delta, that's useful information too–
864
- // as an expanding panel might change from collapsed to min size.
865
-
866
- const increment = delta < 0 ? 1 : -1;
867
- let index = delta < 0 ? secondPivotIndex : firstPivotIndex;
868
- let maxAvailableDelta = 0;
869
-
870
- // DEBUG.push("pre calc...");
871
- while (true) {
872
- const prevSize = initialLayout[index];
873
- assert(prevSize != null, `Previous layout not found for panel index ${index}`);
874
- const maxSafeSize = resizePanel({
875
- panelConstraints: panelConstraintsArray,
876
- panelIndex: index,
877
- size: 100
878
- });
879
- const delta = maxSafeSize - prevSize;
880
- // DEBUG.push(` ${index}: ${prevSize} -> ${maxSafeSize}`);
881
-
882
- maxAvailableDelta += delta;
883
- index += increment;
884
- if (index < 0 || index >= panelConstraintsArray.length) {
885
- break;
886
- }
887
- }
888
-
889
- // DEBUG.push(` -> max available delta: ${maxAvailableDelta}`);
890
- const minAbsDelta = Math.min(Math.abs(delta), Math.abs(maxAvailableDelta));
891
- delta = delta < 0 ? 0 - minAbsDelta : minAbsDelta;
892
- // DEBUG.push(` -> adjusted delta: ${delta}`);
893
- // DEBUG.push("");
894
- }
895
-
896
- {
897
- // Delta added to a panel needs to be subtracted from other panels (within the constraints that those panels allow).
898
-
899
- const pivotIndex = delta < 0 ? firstPivotIndex : secondPivotIndex;
900
- let index = pivotIndex;
901
- while (index >= 0 && index < panelConstraintsArray.length) {
902
- const deltaRemaining = Math.abs(delta) - Math.abs(deltaApplied);
903
- const prevSize = initialLayout[index];
904
- assert(prevSize != null, `Previous layout not found for panel index ${index}`);
905
- const unsafeSize = prevSize - deltaRemaining;
906
- const safeSize = resizePanel({
907
- panelConstraints: panelConstraintsArray,
908
- panelIndex: index,
909
- size: unsafeSize
910
- });
911
- if (!fuzzyNumbersEqual(prevSize, safeSize)) {
912
- deltaApplied += prevSize - safeSize;
913
- nextLayout[index] = safeSize;
914
- if (deltaApplied.toPrecision(3).localeCompare(Math.abs(delta).toPrecision(3), undefined, {
915
- numeric: true
916
- }) >= 0) {
917
- break;
918
- }
919
- }
920
- if (delta < 0) {
921
- index--;
922
- } else {
923
- index++;
924
- }
925
- }
926
- }
927
- // DEBUG.push(`after 1: ${nextLayout.join(", ")}`);
928
- // DEBUG.push(` deltaApplied: ${deltaApplied}`);
929
- // DEBUG.push("");
930
-
931
- // If we were unable to resize any of the panels panels, return the previous state.
932
- // This will essentially bailout and ignore e.g. drags past a panel's boundaries
933
- if (fuzzyLayoutsEqual(prevLayout, nextLayout)) {
934
- // DEBUG.push(`bailout to previous layout: ${prevLayout.join(", ")}`);
935
- // console.log(DEBUG.join("\n"));
936
-
937
- return prevLayout;
938
- }
939
- {
940
- // Now distribute the applied delta to the panels in the other direction
941
- const pivotIndex = delta < 0 ? secondPivotIndex : firstPivotIndex;
942
- const prevSize = initialLayout[pivotIndex];
943
- assert(prevSize != null, `Previous layout not found for panel index ${pivotIndex}`);
944
- const unsafeSize = prevSize + deltaApplied;
945
- const safeSize = resizePanel({
946
- panelConstraints: panelConstraintsArray,
947
- panelIndex: pivotIndex,
948
- size: unsafeSize
949
- });
950
-
951
- // Adjust the pivot panel before, but only by the amount that surrounding panels were able to shrink/contract.
952
- nextLayout[pivotIndex] = safeSize;
953
-
954
- // Edge case where expanding or contracting one panel caused another one to change collapsed state
955
- if (!fuzzyNumbersEqual(safeSize, unsafeSize)) {
956
- let deltaRemaining = unsafeSize - safeSize;
957
- const pivotIndex = delta < 0 ? secondPivotIndex : firstPivotIndex;
958
- let index = pivotIndex;
959
- while (index >= 0 && index < panelConstraintsArray.length) {
960
- const prevSize = nextLayout[index];
961
- assert(prevSize != null, `Previous layout not found for panel index ${index}`);
962
- const unsafeSize = prevSize + deltaRemaining;
963
- const safeSize = resizePanel({
964
- panelConstraints: panelConstraintsArray,
965
- panelIndex: index,
966
- size: unsafeSize
967
- });
968
- if (!fuzzyNumbersEqual(prevSize, safeSize)) {
969
- deltaRemaining -= safeSize - prevSize;
970
- nextLayout[index] = safeSize;
971
- }
972
- if (fuzzyNumbersEqual(deltaRemaining, 0)) {
973
- break;
974
- }
975
- if (delta > 0) {
976
- index--;
977
- } else {
978
- index++;
979
- }
980
- }
981
- }
982
- }
983
- // DEBUG.push(`after 2: ${nextLayout.join(", ")}`);
984
- // DEBUG.push(` deltaApplied: ${deltaApplied}`);
985
- // DEBUG.push("");
986
-
987
- const totalSize = nextLayout.reduce((total, size) => size + total, 0);
988
- // DEBUG.push(`total size: ${totalSize}`);
989
-
990
- // If our new layout doesn't add up to 100%, that means the requested delta can't be applied
991
- // In that case, fall back to our most recent valid layout
992
- if (!fuzzyNumbersEqual(totalSize, 100)) {
993
- // DEBUG.push(`bailout to previous layout: ${prevLayout.join(", ")}`);
994
- // console.log(DEBUG.join("\n"));
995
-
996
- return prevLayout;
997
- }
998
-
999
- // console.log(DEBUG.join("\n"));
1000
- return nextLayout;
1001
- }
1002
-
1003
- function calculateAriaValues({
1004
- layout,
1005
- panelsArray,
1006
- pivotIndices
1007
- }) {
1008
- let currentMinSize = 0;
1009
- let currentMaxSize = 100;
1010
- let totalMinSize = 0;
1011
- let totalMaxSize = 0;
1012
- const firstIndex = pivotIndices[0];
1013
- assert(firstIndex != null, "No pivot index found");
1014
-
1015
- // A panel's effective min/max sizes also need to account for other panel's sizes.
1016
- panelsArray.forEach((panelData, index) => {
1017
- const {
1018
- constraints
1019
- } = panelData;
1020
- const {
1021
- maxSize = 100,
1022
- minSize = 0
1023
- } = constraints;
1024
- if (index === firstIndex) {
1025
- currentMinSize = minSize;
1026
- currentMaxSize = maxSize;
1027
- } else {
1028
- totalMinSize += minSize;
1029
- totalMaxSize += maxSize;
1030
- }
1031
- });
1032
- const valueMax = Math.min(currentMaxSize, 100 - totalMinSize);
1033
- const valueMin = Math.max(currentMinSize, 100 - totalMaxSize);
1034
- const valueNow = layout[firstIndex];
1035
- return {
1036
- valueMax,
1037
- valueMin,
1038
- valueNow
1039
- };
1040
- }
1041
-
1042
- function getResizeHandleElementsForGroup(groupId, scope = document) {
1043
- return Array.from(scope.querySelectorAll(`[${DATA_ATTRIBUTES.resizeHandleId}][data-panel-group-id="${groupId}"]`));
1044
- }
1045
-
1046
- function getResizeHandleElementIndex(groupId, id, scope = document) {
1047
- const handles = getResizeHandleElementsForGroup(groupId, scope);
1048
- const index = handles.findIndex(handle => handle.getAttribute(DATA_ATTRIBUTES.resizeHandleId) === id);
1049
- return index !== null && index !== void 0 ? index : null;
1050
- }
1051
-
1052
- function determinePivotIndices(groupId, dragHandleId, panelGroupElement) {
1053
- const index = getResizeHandleElementIndex(groupId, dragHandleId, panelGroupElement);
1054
- return index != null ? [index, index + 1] : [-1, -1];
1055
- }
1056
-
1057
- function isHTMLElement(target) {
1058
- if (target instanceof HTMLElement) {
1059
- return true;
1060
- }
1061
-
1062
- // Fallback to duck typing to handle edge case of portals within a popup window
1063
- return typeof target === "object" && target !== null && "tagName" in target && "getAttribute" in target;
1064
- }
1065
-
1066
- function getPanelGroupElement(id, rootElement = document) {
1067
- // If the root element is the PanelGroup
1068
- if (isHTMLElement(rootElement) && rootElement.dataset.panelGroupId == id) {
1069
- return rootElement;
1070
- }
1071
-
1072
- // Else query children
1073
- const element = rootElement.querySelector(`[data-panel-group][data-panel-group-id="${id}"]`);
1074
- if (element) {
1075
- return element;
1076
- }
1077
- return null;
1078
- }
1079
-
1080
- function getResizeHandleElement(id, scope = document) {
1081
- const element = scope.querySelector(`[${DATA_ATTRIBUTES.resizeHandleId}="${id}"]`);
1082
- if (element) {
1083
- return element;
1084
- }
1085
- return null;
1086
- }
1087
-
1088
- function getResizeHandlePanelIds(groupId, handleId, panelsArray, scope = document) {
1089
- var _panelsArray$index$id, _panelsArray$index, _panelsArray$id, _panelsArray;
1090
- const handle = getResizeHandleElement(handleId, scope);
1091
- const handles = getResizeHandleElementsForGroup(groupId, scope);
1092
- const index = handle ? handles.indexOf(handle) : -1;
1093
- const idBefore = (_panelsArray$index$id = (_panelsArray$index = panelsArray[index]) === null || _panelsArray$index === void 0 ? void 0 : _panelsArray$index.id) !== null && _panelsArray$index$id !== void 0 ? _panelsArray$index$id : null;
1094
- const idAfter = (_panelsArray$id = (_panelsArray = panelsArray[index + 1]) === null || _panelsArray === void 0 ? void 0 : _panelsArray.id) !== null && _panelsArray$id !== void 0 ? _panelsArray$id : null;
1095
- return [idBefore, idAfter];
1096
- }
1097
-
1098
- // https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/
1099
-
1100
- function useWindowSplitterPanelGroupBehavior({
1101
- committedValuesRef,
1102
- eagerValuesRef,
1103
- groupId,
1104
- layout,
1105
- panelDataArray,
1106
- panelGroupElement,
1107
- setLayout
1108
- }) {
1109
- useRef({
1110
- didWarnAboutMissingResizeHandle: false
1111
- });
1112
- useIsomorphicLayoutEffect(() => {
1113
- if (!panelGroupElement) {
1114
- return;
1115
- }
1116
- const resizeHandleElements = getResizeHandleElementsForGroup(groupId, panelGroupElement);
1117
- for (let index = 0; index < panelDataArray.length - 1; index++) {
1118
- const {
1119
- valueMax,
1120
- valueMin,
1121
- valueNow
1122
- } = calculateAriaValues({
1123
- layout,
1124
- panelsArray: panelDataArray,
1125
- pivotIndices: [index, index + 1]
1126
- });
1127
- const resizeHandleElement = resizeHandleElements[index];
1128
- if (resizeHandleElement == null) ; else {
1129
- const panelData = panelDataArray[index];
1130
- assert(panelData, `No panel data found for index "${index}"`);
1131
- resizeHandleElement.setAttribute("aria-controls", panelData.id);
1132
- resizeHandleElement.setAttribute("aria-valuemax", "" + Math.round(valueMax));
1133
- resizeHandleElement.setAttribute("aria-valuemin", "" + Math.round(valueMin));
1134
- resizeHandleElement.setAttribute("aria-valuenow", valueNow != null ? "" + Math.round(valueNow) : "");
1135
- }
1136
- }
1137
- return () => {
1138
- resizeHandleElements.forEach((resizeHandleElement, index) => {
1139
- resizeHandleElement.removeAttribute("aria-controls");
1140
- resizeHandleElement.removeAttribute("aria-valuemax");
1141
- resizeHandleElement.removeAttribute("aria-valuemin");
1142
- resizeHandleElement.removeAttribute("aria-valuenow");
1143
- });
1144
- };
1145
- }, [groupId, layout, panelDataArray, panelGroupElement]);
1146
- useEffect(() => {
1147
- if (!panelGroupElement) {
1148
- return;
1149
- }
1150
- const eagerValues = eagerValuesRef.current;
1151
- assert(eagerValues, `Eager values not found`);
1152
- const {
1153
- panelDataArray
1154
- } = eagerValues;
1155
- const groupElement = getPanelGroupElement(groupId, panelGroupElement);
1156
- assert(groupElement != null, `No group found for id "${groupId}"`);
1157
- const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
1158
- assert(handles, `No resize handles found for group id "${groupId}"`);
1159
- const cleanupFunctions = handles.map(handle => {
1160
- const handleId = handle.getAttribute(DATA_ATTRIBUTES.resizeHandleId);
1161
- assert(handleId, `Resize handle element has no handle id attribute`);
1162
- const [idBefore, idAfter] = getResizeHandlePanelIds(groupId, handleId, panelDataArray, panelGroupElement);
1163
- if (idBefore == null || idAfter == null) {
1164
- return () => {};
1165
- }
1166
- const onKeyDown = event => {
1167
- if (event.defaultPrevented) {
1168
- return;
1169
- }
1170
- switch (event.key) {
1171
- case "Enter":
1172
- {
1173
- event.preventDefault();
1174
- const index = panelDataArray.findIndex(panelData => panelData.id === idBefore);
1175
- if (index >= 0) {
1176
- const panelData = panelDataArray[index];
1177
- assert(panelData, `No panel data found for index ${index}`);
1178
- const size = layout[index];
1179
- const {
1180
- collapsedSize = 0,
1181
- collapsible,
1182
- minSize = 0
1183
- } = panelData.constraints;
1184
- if (size != null && collapsible) {
1185
- const nextLayout = adjustLayoutByDelta({
1186
- delta: fuzzyNumbersEqual(size, collapsedSize) ? minSize - collapsedSize : collapsedSize - size,
1187
- initialLayout: layout,
1188
- panelConstraints: panelDataArray.map(panelData => panelData.constraints),
1189
- pivotIndices: determinePivotIndices(groupId, handleId, panelGroupElement),
1190
- prevLayout: layout,
1191
- trigger: "keyboard"
1192
- });
1193
- if (layout !== nextLayout) {
1194
- setLayout(nextLayout);
1195
- }
1196
- }
1197
- }
1198
- break;
1199
- }
1200
- }
1201
- };
1202
- handle.addEventListener("keydown", onKeyDown);
1203
- return () => {
1204
- handle.removeEventListener("keydown", onKeyDown);
1205
- };
1206
- });
1207
- return () => {
1208
- cleanupFunctions.forEach(cleanupFunction => cleanupFunction());
1209
- };
1210
- }, [panelGroupElement, committedValuesRef, eagerValuesRef, groupId, layout, panelDataArray, setLayout]);
1211
- }
1212
-
1213
- function areEqual(arrayA, arrayB) {
1214
- if (arrayA.length !== arrayB.length) {
1215
- return false;
1216
- }
1217
- for (let index = 0; index < arrayA.length; index++) {
1218
- if (arrayA[index] !== arrayB[index]) {
1219
- return false;
1220
- }
1221
- }
1222
- return true;
1223
- }
1224
-
1225
- function getResizeEventCursorPosition(direction, event) {
1226
- const isHorizontal = direction === "horizontal";
1227
- const {
1228
- x,
1229
- y
1230
- } = getResizeEventCoordinates(event);
1231
- return isHorizontal ? x : y;
1232
- }
1233
-
1234
- function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement) {
1235
- const isHorizontal = direction === "horizontal";
1236
- const handleElement = getResizeHandleElement(dragHandleId, panelGroupElement);
1237
- assert(handleElement, `No resize handle element found for id "${dragHandleId}"`);
1238
- const groupId = handleElement.getAttribute(DATA_ATTRIBUTES.groupId);
1239
- assert(groupId, `Resize handle element has no group id attribute`);
1240
- let {
1241
- initialCursorPosition
1242
- } = initialDragState;
1243
- const cursorPosition = getResizeEventCursorPosition(direction, event);
1244
- const groupElement = getPanelGroupElement(groupId, panelGroupElement);
1245
- assert(groupElement, `No group element found for id "${groupId}"`);
1246
- const groupRect = groupElement.getBoundingClientRect();
1247
- const groupSizeInPixels = isHorizontal ? groupRect.width : groupRect.height;
1248
- const offsetPixels = cursorPosition - initialCursorPosition;
1249
- const offsetPercentage = offsetPixels / groupSizeInPixels * 100;
1250
- return offsetPercentage;
1251
- }
1252
-
1253
- // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/movementX
1254
- function calculateDeltaPercentage(event, dragHandleId, direction, initialDragState, keyboardResizeBy, panelGroupElement) {
1255
- if (isKeyDown(event)) {
1256
- const isHorizontal = direction === "horizontal";
1257
- let delta = 0;
1258
- if (event.shiftKey) {
1259
- delta = 100;
1260
- } else if (keyboardResizeBy != null) {
1261
- delta = keyboardResizeBy;
1262
- } else {
1263
- delta = 10;
1264
- }
1265
- let movement = 0;
1266
- switch (event.key) {
1267
- case "ArrowDown":
1268
- movement = isHorizontal ? 0 : delta;
1269
- break;
1270
- case "ArrowLeft":
1271
- movement = isHorizontal ? -delta : 0;
1272
- break;
1273
- case "ArrowRight":
1274
- movement = isHorizontal ? delta : 0;
1275
- break;
1276
- case "ArrowUp":
1277
- movement = isHorizontal ? 0 : -delta;
1278
- break;
1279
- case "End":
1280
- movement = 100;
1281
- break;
1282
- case "Home":
1283
- movement = -100;
1284
- break;
1285
- }
1286
- return movement;
1287
- } else {
1288
- if (initialDragState == null) {
1289
- return 0;
1290
- }
1291
- return calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement);
1292
- }
1293
- }
1294
-
1295
- function calculateUnsafeDefaultLayout({
1296
- panelDataArray
1297
- }) {
1298
- const layout = Array(panelDataArray.length);
1299
- const panelConstraintsArray = panelDataArray.map(panelData => panelData.constraints);
1300
- let numPanelsWithSizes = 0;
1301
- let remainingSize = 100;
1302
-
1303
- // Distribute default sizes first
1304
- for (let index = 0; index < panelDataArray.length; index++) {
1305
- const panelConstraints = panelConstraintsArray[index];
1306
- assert(panelConstraints, `Panel constraints not found for index ${index}`);
1307
- const {
1308
- defaultSize
1309
- } = panelConstraints;
1310
- if (defaultSize != null) {
1311
- numPanelsWithSizes++;
1312
- layout[index] = defaultSize;
1313
- remainingSize -= defaultSize;
1314
- }
1315
- }
1316
-
1317
- // Remaining size should be distributed evenly between panels without default sizes
1318
- for (let index = 0; index < panelDataArray.length; index++) {
1319
- const panelConstraints = panelConstraintsArray[index];
1320
- assert(panelConstraints, `Panel constraints not found for index ${index}`);
1321
- const {
1322
- defaultSize
1323
- } = panelConstraints;
1324
- if (defaultSize != null) {
1325
- continue;
1326
- }
1327
- const numRemainingPanels = panelDataArray.length - numPanelsWithSizes;
1328
- const size = remainingSize / numRemainingPanels;
1329
- numPanelsWithSizes++;
1330
- layout[index] = size;
1331
- remainingSize -= size;
1332
- }
1333
- return layout;
1334
- }
1335
-
1336
- // Layout should be pre-converted into percentages
1337
- function callPanelCallbacks(panelsArray, layout, panelIdToLastNotifiedSizeMap) {
1338
- layout.forEach((size, index) => {
1339
- const panelData = panelsArray[index];
1340
- assert(panelData, `Panel data not found for index ${index}`);
1341
- const {
1342
- callbacks,
1343
- constraints,
1344
- id: panelId
1345
- } = panelData;
1346
- const {
1347
- collapsedSize = 0,
1348
- collapsible
1349
- } = constraints;
1350
- const lastNotifiedSize = panelIdToLastNotifiedSizeMap[panelId];
1351
- if (lastNotifiedSize == null || size !== lastNotifiedSize) {
1352
- panelIdToLastNotifiedSizeMap[panelId] = size;
1353
- const {
1354
- onCollapse,
1355
- onExpand,
1356
- onResize
1357
- } = callbacks;
1358
- if (onResize) {
1359
- onResize(size, lastNotifiedSize);
1360
- }
1361
- if (collapsible && (onCollapse || onExpand)) {
1362
- if (onExpand && (lastNotifiedSize == null || fuzzyNumbersEqual$1(lastNotifiedSize, collapsedSize)) && !fuzzyNumbersEqual$1(size, collapsedSize)) {
1363
- onExpand();
1364
- }
1365
- if (onCollapse && (lastNotifiedSize == null || !fuzzyNumbersEqual$1(lastNotifiedSize, collapsedSize)) && fuzzyNumbersEqual$1(size, collapsedSize)) {
1366
- onCollapse();
1367
- }
1368
- }
1369
- }
1370
- });
1371
- }
1372
-
1373
- function compareLayouts(a, b) {
1374
- if (a.length !== b.length) {
1375
- return false;
1376
- } else {
1377
- for (let index = 0; index < a.length; index++) {
1378
- if (a[index] != b[index]) {
1379
- return false;
1380
- }
1381
- }
1382
- }
1383
- return true;
1384
- }
1385
-
1386
- // This method returns a number between 1 and 100 representing
1387
-
1388
- // the % of the group's overall space this panel should occupy.
1389
- function computePanelFlexBoxStyle({
1390
- defaultSize,
1391
- dragState,
1392
- layout,
1393
- panelData,
1394
- panelIndex,
1395
- precision = 3
1396
- }) {
1397
- const size = layout[panelIndex];
1398
- let flexGrow;
1399
- if (size == null) {
1400
- // Initial render (before panels have registered themselves)
1401
- // In order to support server rendering, fall back to default size if provided
1402
- flexGrow = defaultSize != undefined ? defaultSize.toPrecision(precision) : "1";
1403
- } else if (panelData.length === 1) {
1404
- // Special case: Single panel group should always fill full width/height
1405
- flexGrow = "1";
1406
- } else {
1407
- flexGrow = size.toPrecision(precision);
1408
- }
1409
- return {
1410
- flexBasis: 0,
1411
- flexGrow,
1412
- flexShrink: 1,
1413
- // Without this, Panel sizes may be unintentionally overridden by their content
1414
- overflow: "hidden",
1415
- // Disable pointer events inside of a panel during resize
1416
- // This avoid edge cases like nested iframes
1417
- pointerEvents: dragState !== null ? "none" : undefined
1418
- };
1419
- }
1420
-
1421
- function debounce(callback, durationMs = 10) {
1422
- let timeoutId = null;
1423
- let callable = (...args) => {
1424
- if (timeoutId !== null) {
1425
- clearTimeout(timeoutId);
1426
- }
1427
- timeoutId = setTimeout(() => {
1428
- callback(...args);
1429
- }, durationMs);
1430
- };
1431
- return callable;
1432
- }
1433
-
1434
- // PanelGroup might be rendering in a server-side environment where localStorage is not available
1435
- // or on a browser with cookies/storage disabled.
1436
- // In either case, this function avoids accessing localStorage until needed,
1437
- // and avoids throwing user-visible errors.
1438
- function initializeDefaultStorage(storageObject) {
1439
- try {
1440
- if (typeof localStorage !== "undefined") {
1441
- // Bypass this check for future calls
1442
- storageObject.getItem = name => {
1443
- return localStorage.getItem(name);
1444
- };
1445
- storageObject.setItem = (name, value) => {
1446
- localStorage.setItem(name, value);
1447
- };
1448
- } else {
1449
- throw new Error("localStorage not supported in this environment");
1450
- }
1451
- } catch (error) {
1452
- console.error(error);
1453
- storageObject.getItem = () => null;
1454
- storageObject.setItem = () => {};
1455
- }
1456
- }
1457
-
1458
- function getPanelGroupKey(autoSaveId) {
1459
- return `react-resizable-panels:${autoSaveId}`;
1460
- }
1461
-
1462
- // Note that Panel ids might be user-provided (stable) or useId generated (non-deterministic)
1463
- // so they should not be used as part of the serialization key.
1464
- // Using the min/max size attributes should work well enough as a backup.
1465
- // Pre-sorting by minSize allows remembering layouts even if panels are re-ordered/dragged.
1466
- function getPanelKey(panels) {
1467
- return panels.map(panel => {
1468
- const {
1469
- constraints,
1470
- id,
1471
- idIsFromProps,
1472
- order
1473
- } = panel;
1474
- if (idIsFromProps) {
1475
- return id;
1476
- } else {
1477
- return order ? `${order}:${JSON.stringify(constraints)}` : JSON.stringify(constraints);
1478
- }
1479
- }).sort((a, b) => a.localeCompare(b)).join(",");
1480
- }
1481
- function loadSerializedPanelGroupState(autoSaveId, storage) {
1482
- try {
1483
- const panelGroupKey = getPanelGroupKey(autoSaveId);
1484
- const serialized = storage.getItem(panelGroupKey);
1485
- if (serialized) {
1486
- const parsed = JSON.parse(serialized);
1487
- if (typeof parsed === "object" && parsed != null) {
1488
- return parsed;
1489
- }
1490
- }
1491
- } catch (error) {}
1492
- return null;
1493
- }
1494
- function loadPanelGroupState(autoSaveId, panels, storage) {
1495
- var _loadSerializedPanelG, _state$panelKey;
1496
- const state = (_loadSerializedPanelG = loadSerializedPanelGroupState(autoSaveId, storage)) !== null && _loadSerializedPanelG !== void 0 ? _loadSerializedPanelG : {};
1497
- const panelKey = getPanelKey(panels);
1498
- return (_state$panelKey = state[panelKey]) !== null && _state$panelKey !== void 0 ? _state$panelKey : null;
1499
- }
1500
- function savePanelGroupState(autoSaveId, panels, panelSizesBeforeCollapse, sizes, storage) {
1501
- var _loadSerializedPanelG2;
1502
- const panelGroupKey = getPanelGroupKey(autoSaveId);
1503
- const panelKey = getPanelKey(panels);
1504
- const state = (_loadSerializedPanelG2 = loadSerializedPanelGroupState(autoSaveId, storage)) !== null && _loadSerializedPanelG2 !== void 0 ? _loadSerializedPanelG2 : {};
1505
- state[panelKey] = {
1506
- expandToSizes: Object.fromEntries(panelSizesBeforeCollapse.entries()),
1507
- layout: sizes
1508
- };
1509
- try {
1510
- storage.setItem(panelGroupKey, JSON.stringify(state));
1511
- } catch (error) {
1512
- console.error(error);
1513
- }
1514
- }
1515
-
1516
- // All units must be in percentages; pixel values should be pre-converted
1517
- function validatePanelGroupLayout({
1518
- layout: prevLayout,
1519
- panelConstraints
1520
- }) {
1521
- const nextLayout = [...prevLayout];
1522
- const nextLayoutTotalSize = nextLayout.reduce((accumulated, current) => accumulated + current, 0);
1523
-
1524
- // Validate layout expectations
1525
- if (nextLayout.length !== panelConstraints.length) {
1526
- throw Error(`Invalid ${panelConstraints.length} panel layout: ${nextLayout.map(size => `${size}%`).join(", ")}`);
1527
- } else if (!fuzzyNumbersEqual(nextLayoutTotalSize, 100) && nextLayout.length > 0) {
1528
- for (let index = 0; index < panelConstraints.length; index++) {
1529
- const unsafeSize = nextLayout[index];
1530
- assert(unsafeSize != null, `No layout data found for index ${index}`);
1531
- const safeSize = 100 / nextLayoutTotalSize * unsafeSize;
1532
- nextLayout[index] = safeSize;
1533
- }
1534
- }
1535
- let remainingSize = 0;
1536
-
1537
- // First pass: Validate the proposed layout given each panel's constraints
1538
- for (let index = 0; index < panelConstraints.length; index++) {
1539
- const unsafeSize = nextLayout[index];
1540
- assert(unsafeSize != null, `No layout data found for index ${index}`);
1541
- const safeSize = resizePanel({
1542
- panelConstraints,
1543
- panelIndex: index,
1544
- size: unsafeSize
1545
- });
1546
- if (unsafeSize != safeSize) {
1547
- remainingSize += unsafeSize - safeSize;
1548
- nextLayout[index] = safeSize;
1549
- }
1550
- }
1551
-
1552
- // If there is additional, left over space, assign it to any panel(s) that permits it
1553
- // (It's not worth taking multiple additional passes to evenly distribute)
1554
- if (!fuzzyNumbersEqual(remainingSize, 0)) {
1555
- for (let index = 0; index < panelConstraints.length; index++) {
1556
- const prevSize = nextLayout[index];
1557
- assert(prevSize != null, `No layout data found for index ${index}`);
1558
- const unsafeSize = prevSize + remainingSize;
1559
- const safeSize = resizePanel({
1560
- panelConstraints,
1561
- panelIndex: index,
1562
- size: unsafeSize
1563
- });
1564
- if (prevSize !== safeSize) {
1565
- remainingSize -= safeSize - prevSize;
1566
- nextLayout[index] = safeSize;
1567
-
1568
- // Once we've used up the remainder, bail
1569
- if (fuzzyNumbersEqual(remainingSize, 0)) {
1570
- break;
1571
- }
1572
- }
1573
- }
1574
- }
1575
- return nextLayout;
1576
- }
1577
-
1578
- const LOCAL_STORAGE_DEBOUNCE_INTERVAL = 100;
1579
- const defaultStorage = {
1580
- getItem: name => {
1581
- initializeDefaultStorage(defaultStorage);
1582
- return defaultStorage.getItem(name);
1583
- },
1584
- setItem: (name, value) => {
1585
- initializeDefaultStorage(defaultStorage);
1586
- defaultStorage.setItem(name, value);
1587
- }
1588
- };
1589
- const debounceMap = {};
1590
- function PanelGroupWithForwardedRef({
1591
- autoSaveId = null,
1592
- children,
1593
- className: classNameFromProps = "",
1594
- direction,
1595
- forwardedRef,
1596
- id: idFromProps = null,
1597
- onLayout = null,
1598
- keyboardResizeBy = null,
1599
- storage = defaultStorage,
1600
- style: styleFromProps,
1601
- tagName: Type = "div",
1602
- ...rest
1603
- }) {
1604
- const groupId = useUniqueId(idFromProps);
1605
- const panelGroupElementRef = useRef(null);
1606
- const [dragState, setDragState] = useState(null);
1607
- const [layout, setLayout] = useState([]);
1608
- const forceUpdate = useForceUpdate();
1609
- const panelIdToLastNotifiedSizeMapRef = useRef({});
1610
- const panelSizeBeforeCollapseRef = useRef(new Map());
1611
- const prevDeltaRef = useRef(0);
1612
- const committedValuesRef = useRef({
1613
- autoSaveId,
1614
- direction,
1615
- dragState,
1616
- id: groupId,
1617
- keyboardResizeBy,
1618
- onLayout,
1619
- storage
1620
- });
1621
- const eagerValuesRef = useRef({
1622
- layout,
1623
- panelDataArray: [],
1624
- panelDataArrayChanged: false
1625
- });
1626
- useRef({
1627
- didLogIdAndOrderWarning: false,
1628
- didLogPanelConstraintsWarning: false,
1629
- prevPanelIds: []
1630
- });
1631
- useImperativeHandle(forwardedRef, () => ({
1632
- getId: () => committedValuesRef.current.id,
1633
- getLayout: () => {
1634
- const {
1635
- layout
1636
- } = eagerValuesRef.current;
1637
- return layout;
1638
- },
1639
- setLayout: unsafeLayout => {
1640
- const {
1641
- onLayout
1642
- } = committedValuesRef.current;
1643
- const {
1644
- layout: prevLayout,
1645
- panelDataArray
1646
- } = eagerValuesRef.current;
1647
- const safeLayout = validatePanelGroupLayout({
1648
- layout: unsafeLayout,
1649
- panelConstraints: panelDataArray.map(panelData => panelData.constraints)
1650
- });
1651
- if (!areEqual(prevLayout, safeLayout)) {
1652
- setLayout(safeLayout);
1653
- eagerValuesRef.current.layout = safeLayout;
1654
- if (onLayout) {
1655
- onLayout(safeLayout);
1656
- }
1657
- callPanelCallbacks(panelDataArray, safeLayout, panelIdToLastNotifiedSizeMapRef.current);
1658
- }
1659
- }
1660
- }), []);
1661
- useIsomorphicLayoutEffect(() => {
1662
- committedValuesRef.current.autoSaveId = autoSaveId;
1663
- committedValuesRef.current.direction = direction;
1664
- committedValuesRef.current.dragState = dragState;
1665
- committedValuesRef.current.id = groupId;
1666
- committedValuesRef.current.onLayout = onLayout;
1667
- committedValuesRef.current.storage = storage;
1668
- });
1669
- useWindowSplitterPanelGroupBehavior({
1670
- committedValuesRef,
1671
- eagerValuesRef,
1672
- groupId,
1673
- layout,
1674
- panelDataArray: eagerValuesRef.current.panelDataArray,
1675
- setLayout,
1676
- panelGroupElement: panelGroupElementRef.current
1677
- });
1678
- useEffect(() => {
1679
- const {
1680
- panelDataArray
1681
- } = eagerValuesRef.current;
1682
-
1683
- // If this panel has been configured to persist sizing information, save sizes to local storage.
1684
- if (autoSaveId) {
1685
- if (layout.length === 0 || layout.length !== panelDataArray.length) {
1686
- return;
1687
- }
1688
- let debouncedSave = debounceMap[autoSaveId];
1689
-
1690
- // Limit the frequency of localStorage updates.
1691
- if (debouncedSave == null) {
1692
- debouncedSave = debounce(savePanelGroupState, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
1693
- debounceMap[autoSaveId] = debouncedSave;
1694
- }
1695
-
1696
- // Clone mutable data before passing to the debounced function,
1697
- // else we run the risk of saving an incorrect combination of mutable and immutable values to state.
1698
- const clonedPanelDataArray = [...panelDataArray];
1699
- const clonedPanelSizesBeforeCollapse = new Map(panelSizeBeforeCollapseRef.current);
1700
- debouncedSave(autoSaveId, clonedPanelDataArray, clonedPanelSizesBeforeCollapse, layout, storage);
1701
- }
1702
- }, [autoSaveId, layout, storage]);
1703
-
1704
- // DEV warnings
1705
- useEffect(() => {
1706
- });
1707
-
1708
- // External APIs are safe to memoize via committed values ref
1709
- const collapsePanel = useCallback(panelData => {
1710
- const {
1711
- onLayout
1712
- } = committedValuesRef.current;
1713
- const {
1714
- layout: prevLayout,
1715
- panelDataArray
1716
- } = eagerValuesRef.current;
1717
- if (panelData.constraints.collapsible) {
1718
- const panelConstraintsArray = panelDataArray.map(panelData => panelData.constraints);
1719
- const {
1720
- collapsedSize = 0,
1721
- panelSize,
1722
- pivotIndices
1723
- } = panelDataHelper(panelDataArray, panelData, prevLayout);
1724
- assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
1725
- if (!fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
1726
- // Store size before collapse;
1727
- // This is the size that gets restored if the expand() API is used.
1728
- panelSizeBeforeCollapseRef.current.set(panelData.id, panelSize);
1729
- const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
1730
- const delta = isLastPanel ? panelSize - collapsedSize : collapsedSize - panelSize;
1731
- const nextLayout = adjustLayoutByDelta({
1732
- delta,
1733
- initialLayout: prevLayout,
1734
- panelConstraints: panelConstraintsArray,
1735
- pivotIndices,
1736
- prevLayout,
1737
- trigger: "imperative-api"
1738
- });
1739
- if (!compareLayouts(prevLayout, nextLayout)) {
1740
- setLayout(nextLayout);
1741
- eagerValuesRef.current.layout = nextLayout;
1742
- if (onLayout) {
1743
- onLayout(nextLayout);
1744
- }
1745
- callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
1746
- }
1747
- }
1748
- }
1749
- }, []);
1750
-
1751
- // External APIs are safe to memoize via committed values ref
1752
- const expandPanel = useCallback((panelData, minSizeOverride) => {
1753
- const {
1754
- onLayout
1755
- } = committedValuesRef.current;
1756
- const {
1757
- layout: prevLayout,
1758
- panelDataArray
1759
- } = eagerValuesRef.current;
1760
- if (panelData.constraints.collapsible) {
1761
- const panelConstraintsArray = panelDataArray.map(panelData => panelData.constraints);
1762
- const {
1763
- collapsedSize = 0,
1764
- panelSize = 0,
1765
- minSize: minSizeFromProps = 0,
1766
- pivotIndices
1767
- } = panelDataHelper(panelDataArray, panelData, prevLayout);
1768
- const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
1769
- if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
1770
- // Restore this panel to the size it was before it was collapsed, if possible.
1771
- const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
1772
- const baseSize = prevPanelSize != null && prevPanelSize >= minSize ? prevPanelSize : minSize;
1773
- const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
1774
- const delta = isLastPanel ? panelSize - baseSize : baseSize - panelSize;
1775
- const nextLayout = adjustLayoutByDelta({
1776
- delta,
1777
- initialLayout: prevLayout,
1778
- panelConstraints: panelConstraintsArray,
1779
- pivotIndices,
1780
- prevLayout,
1781
- trigger: "imperative-api"
1782
- });
1783
- if (!compareLayouts(prevLayout, nextLayout)) {
1784
- setLayout(nextLayout);
1785
- eagerValuesRef.current.layout = nextLayout;
1786
- if (onLayout) {
1787
- onLayout(nextLayout);
1788
- }
1789
- callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
1790
- }
1791
- }
1792
- }
1793
- }, []);
1794
-
1795
- // External APIs are safe to memoize via committed values ref
1796
- const getPanelSize = useCallback(panelData => {
1797
- const {
1798
- layout,
1799
- panelDataArray
1800
- } = eagerValuesRef.current;
1801
- const {
1802
- panelSize
1803
- } = panelDataHelper(panelDataArray, panelData, layout);
1804
- assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
1805
- return panelSize;
1806
- }, []);
1807
-
1808
- // This API should never read from committedValuesRef
1809
- const getPanelStyle = useCallback((panelData, defaultSize) => {
1810
- const {
1811
- panelDataArray
1812
- } = eagerValuesRef.current;
1813
- const panelIndex = findPanelDataIndex(panelDataArray, panelData);
1814
- return computePanelFlexBoxStyle({
1815
- defaultSize,
1816
- dragState,
1817
- layout,
1818
- panelData: panelDataArray,
1819
- panelIndex
1820
- });
1821
- }, [dragState, layout]);
1822
-
1823
- // External APIs are safe to memoize via committed values ref
1824
- const isPanelCollapsed = useCallback(panelData => {
1825
- const {
1826
- layout,
1827
- panelDataArray
1828
- } = eagerValuesRef.current;
1829
- const {
1830
- collapsedSize = 0,
1831
- collapsible,
1832
- panelSize
1833
- } = panelDataHelper(panelDataArray, panelData, layout);
1834
- assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
1835
- return collapsible === true && fuzzyNumbersEqual$1(panelSize, collapsedSize);
1836
- }, []);
1837
-
1838
- // External APIs are safe to memoize via committed values ref
1839
- const isPanelExpanded = useCallback(panelData => {
1840
- const {
1841
- layout,
1842
- panelDataArray
1843
- } = eagerValuesRef.current;
1844
- const {
1845
- collapsedSize = 0,
1846
- collapsible,
1847
- panelSize
1848
- } = panelDataHelper(panelDataArray, panelData, layout);
1849
- assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
1850
- return !collapsible || fuzzyCompareNumbers(panelSize, collapsedSize) > 0;
1851
- }, []);
1852
- const registerPanel = useCallback(panelData => {
1853
- const {
1854
- panelDataArray
1855
- } = eagerValuesRef.current;
1856
- panelDataArray.push(panelData);
1857
- panelDataArray.sort((panelA, panelB) => {
1858
- const orderA = panelA.order;
1859
- const orderB = panelB.order;
1860
- if (orderA == null && orderB == null) {
1861
- return 0;
1862
- } else if (orderA == null) {
1863
- return -1;
1864
- } else if (orderB == null) {
1865
- return 1;
1866
- } else {
1867
- return orderA - orderB;
1868
- }
1869
- });
1870
- eagerValuesRef.current.panelDataArrayChanged = true;
1871
- forceUpdate();
1872
- }, [forceUpdate]);
1873
-
1874
- // (Re)calculate group layout whenever panels are registered or unregistered.
1875
- // eslint-disable-next-line react-hooks/exhaustive-deps
1876
- useIsomorphicLayoutEffect(() => {
1877
- if (eagerValuesRef.current.panelDataArrayChanged) {
1878
- eagerValuesRef.current.panelDataArrayChanged = false;
1879
- const {
1880
- autoSaveId,
1881
- onLayout,
1882
- storage
1883
- } = committedValuesRef.current;
1884
- const {
1885
- layout: prevLayout,
1886
- panelDataArray
1887
- } = eagerValuesRef.current;
1888
-
1889
- // If this panel has been configured to persist sizing information,
1890
- // default size should be restored from local storage if possible.
1891
- let unsafeLayout = null;
1892
- if (autoSaveId) {
1893
- const state = loadPanelGroupState(autoSaveId, panelDataArray, storage);
1894
- if (state) {
1895
- panelSizeBeforeCollapseRef.current = new Map(Object.entries(state.expandToSizes));
1896
- unsafeLayout = state.layout;
1897
- }
1898
- }
1899
- if (unsafeLayout == null) {
1900
- unsafeLayout = calculateUnsafeDefaultLayout({
1901
- panelDataArray
1902
- });
1903
- }
1904
-
1905
- // Validate even saved layouts in case something has changed since last render
1906
- // e.g. for pixel groups, this could be the size of the window
1907
- const nextLayout = validatePanelGroupLayout({
1908
- layout: unsafeLayout,
1909
- panelConstraints: panelDataArray.map(panelData => panelData.constraints)
1910
- });
1911
- if (!areEqual(prevLayout, nextLayout)) {
1912
- setLayout(nextLayout);
1913
- eagerValuesRef.current.layout = nextLayout;
1914
- if (onLayout) {
1915
- onLayout(nextLayout);
1916
- }
1917
- callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
1918
- }
1919
- }
1920
- });
1921
-
1922
- // Reset the cached layout if hidden by the Activity/Offscreen API
1923
- useIsomorphicLayoutEffect(() => {
1924
- const eagerValues = eagerValuesRef.current;
1925
- return () => {
1926
- eagerValues.layout = [];
1927
- };
1928
- }, []);
1929
- const registerResizeHandle = useCallback(dragHandleId => {
1930
- let isRTL = false;
1931
- const panelGroupElement = panelGroupElementRef.current;
1932
- if (panelGroupElement) {
1933
- const style = window.getComputedStyle(panelGroupElement, null);
1934
- if (style.getPropertyValue("direction") === "rtl") {
1935
- isRTL = true;
1936
- }
1937
- }
1938
- return function resizeHandler(event) {
1939
- event.preventDefault();
1940
- const panelGroupElement = panelGroupElementRef.current;
1941
- if (!panelGroupElement) {
1942
- return () => null;
1943
- }
1944
- const {
1945
- direction,
1946
- dragState,
1947
- id: groupId,
1948
- keyboardResizeBy,
1949
- onLayout
1950
- } = committedValuesRef.current;
1951
- const {
1952
- layout: prevLayout,
1953
- panelDataArray
1954
- } = eagerValuesRef.current;
1955
- const {
1956
- initialLayout
1957
- } = dragState !== null && dragState !== void 0 ? dragState : {};
1958
- const pivotIndices = determinePivotIndices(groupId, dragHandleId, panelGroupElement);
1959
- let delta = calculateDeltaPercentage(event, dragHandleId, direction, dragState, keyboardResizeBy, panelGroupElement);
1960
- const isHorizontal = direction === "horizontal";
1961
- if (isHorizontal && isRTL) {
1962
- delta = -delta;
1963
- }
1964
- const panelConstraints = panelDataArray.map(panelData => panelData.constraints);
1965
- const nextLayout = adjustLayoutByDelta({
1966
- delta,
1967
- initialLayout: initialLayout !== null && initialLayout !== void 0 ? initialLayout : prevLayout,
1968
- panelConstraints,
1969
- pivotIndices,
1970
- prevLayout,
1971
- trigger: isKeyDown(event) ? "keyboard" : "mouse-or-touch"
1972
- });
1973
- const layoutChanged = !compareLayouts(prevLayout, nextLayout);
1974
-
1975
- // Only update the cursor for layout changes triggered by touch/mouse events (not keyboard)
1976
- // Update the cursor even if the layout hasn't changed (we may need to show an invalid cursor state)
1977
- if (isPointerEvent(event) || isMouseEvent(event)) {
1978
- // Watch for multiple subsequent deltas; this might occur for tiny cursor movements.
1979
- // In this case, Panel sizes might not change–
1980
- // but updating cursor in this scenario would cause a flicker.
1981
- if (prevDeltaRef.current != delta) {
1982
- prevDeltaRef.current = delta;
1983
- if (!layoutChanged && delta !== 0) {
1984
- // If the pointer has moved too far to resize the panel any further, note this so we can update the cursor.
1985
- // This mimics VS Code behavior.
1986
- if (isHorizontal) {
1987
- reportConstraintsViolation(dragHandleId, delta < 0 ? EXCEEDED_HORIZONTAL_MIN : EXCEEDED_HORIZONTAL_MAX);
1988
- } else {
1989
- reportConstraintsViolation(dragHandleId, delta < 0 ? EXCEEDED_VERTICAL_MIN : EXCEEDED_VERTICAL_MAX);
1990
- }
1991
- } else {
1992
- reportConstraintsViolation(dragHandleId, 0);
1993
- }
1994
- }
1995
- }
1996
- if (layoutChanged) {
1997
- setLayout(nextLayout);
1998
- eagerValuesRef.current.layout = nextLayout;
1999
- if (onLayout) {
2000
- onLayout(nextLayout);
2001
- }
2002
- callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
2003
- }
2004
- };
2005
- }, []);
2006
-
2007
- // External APIs are safe to memoize via committed values ref
2008
- const resizePanel = useCallback((panelData, unsafePanelSize) => {
2009
- const {
2010
- onLayout
2011
- } = committedValuesRef.current;
2012
- const {
2013
- layout: prevLayout,
2014
- panelDataArray
2015
- } = eagerValuesRef.current;
2016
- const panelConstraintsArray = panelDataArray.map(panelData => panelData.constraints);
2017
- const {
2018
- panelSize,
2019
- pivotIndices
2020
- } = panelDataHelper(panelDataArray, panelData, prevLayout);
2021
- assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
2022
- const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
2023
- const delta = isLastPanel ? panelSize - unsafePanelSize : unsafePanelSize - panelSize;
2024
- const nextLayout = adjustLayoutByDelta({
2025
- delta,
2026
- initialLayout: prevLayout,
2027
- panelConstraints: panelConstraintsArray,
2028
- pivotIndices,
2029
- prevLayout,
2030
- trigger: "imperative-api"
2031
- });
2032
- if (!compareLayouts(prevLayout, nextLayout)) {
2033
- setLayout(nextLayout);
2034
- eagerValuesRef.current.layout = nextLayout;
2035
- if (onLayout) {
2036
- onLayout(nextLayout);
2037
- }
2038
- callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
2039
- }
2040
- }, []);
2041
- const reevaluatePanelConstraints = useCallback((panelData, prevConstraints) => {
2042
- const {
2043
- layout,
2044
- panelDataArray
2045
- } = eagerValuesRef.current;
2046
- const {
2047
- collapsedSize: prevCollapsedSize = 0,
2048
- collapsible: prevCollapsible
2049
- } = prevConstraints;
2050
- const {
2051
- collapsedSize: nextCollapsedSize = 0,
2052
- collapsible: nextCollapsible,
2053
- maxSize: nextMaxSize = 100,
2054
- minSize: nextMinSize = 0
2055
- } = panelData.constraints;
2056
- const {
2057
- panelSize: prevPanelSize
2058
- } = panelDataHelper(panelDataArray, panelData, layout);
2059
- if (prevPanelSize == null) {
2060
- // It's possible that the panels in this group have changed since the last render
2061
- return;
2062
- }
2063
- if (prevCollapsible && nextCollapsible && fuzzyNumbersEqual$1(prevPanelSize, prevCollapsedSize)) {
2064
- if (!fuzzyNumbersEqual$1(prevCollapsedSize, nextCollapsedSize)) {
2065
- resizePanel(panelData, nextCollapsedSize);
2066
- }
2067
- } else if (prevPanelSize < nextMinSize) {
2068
- resizePanel(panelData, nextMinSize);
2069
- } else if (prevPanelSize > nextMaxSize) {
2070
- resizePanel(panelData, nextMaxSize);
2071
- }
2072
- }, [resizePanel]);
2073
-
2074
- // TODO Multiple drag handles can be active at the same time so this API is a bit awkward now
2075
- const startDragging = useCallback((dragHandleId, event) => {
2076
- const {
2077
- direction
2078
- } = committedValuesRef.current;
2079
- const {
2080
- layout
2081
- } = eagerValuesRef.current;
2082
- if (!panelGroupElementRef.current) {
2083
- return;
2084
- }
2085
- const handleElement = getResizeHandleElement(dragHandleId, panelGroupElementRef.current);
2086
- assert(handleElement, `Drag handle element not found for id "${dragHandleId}"`);
2087
- const initialCursorPosition = getResizeEventCursorPosition(direction, event);
2088
- setDragState({
2089
- dragHandleId,
2090
- dragHandleRect: handleElement.getBoundingClientRect(),
2091
- initialCursorPosition,
2092
- initialLayout: layout
2093
- });
2094
- }, []);
2095
- const stopDragging = useCallback(() => {
2096
- setDragState(null);
2097
- }, []);
2098
- const unregisterPanel = useCallback(panelData => {
2099
- const {
2100
- panelDataArray
2101
- } = eagerValuesRef.current;
2102
- const index = findPanelDataIndex(panelDataArray, panelData);
2103
- if (index >= 0) {
2104
- panelDataArray.splice(index, 1);
2105
-
2106
- // TRICKY
2107
- // When a panel is removed from the group, we should delete the most recent prev-size entry for it.
2108
- // If we don't do this, then a conditionally rendered panel might not call onResize when it's re-mounted.
2109
- // Strict effects mode makes this tricky though because all panels will be registered, unregistered, then re-registered on mount.
2110
- delete panelIdToLastNotifiedSizeMapRef.current[panelData.id];
2111
- eagerValuesRef.current.panelDataArrayChanged = true;
2112
- forceUpdate();
2113
- }
2114
- }, [forceUpdate]);
2115
- const context = useMemo(() => ({
2116
- collapsePanel,
2117
- direction,
2118
- dragState,
2119
- expandPanel,
2120
- getPanelSize,
2121
- getPanelStyle,
2122
- groupId,
2123
- isPanelCollapsed,
2124
- isPanelExpanded,
2125
- reevaluatePanelConstraints,
2126
- registerPanel,
2127
- registerResizeHandle,
2128
- resizePanel,
2129
- startDragging,
2130
- stopDragging,
2131
- unregisterPanel,
2132
- panelGroupElement: panelGroupElementRef.current
2133
- }), [collapsePanel, dragState, direction, expandPanel, getPanelSize, getPanelStyle, groupId, isPanelCollapsed, isPanelExpanded, reevaluatePanelConstraints, registerPanel, registerResizeHandle, resizePanel, startDragging, stopDragging, unregisterPanel]);
2134
- const style = {
2135
- display: "flex",
2136
- flexDirection: direction === "horizontal" ? "row" : "column",
2137
- height: "100%",
2138
- overflow: "hidden",
2139
- width: "100%"
2140
- };
2141
- return createElement(PanelGroupContext.Provider, {
2142
- value: context
2143
- }, createElement(Type, {
2144
- ...rest,
2145
- children,
2146
- className: classNameFromProps,
2147
- id: idFromProps,
2148
- ref: panelGroupElementRef,
2149
- style: {
2150
- ...style,
2151
- ...styleFromProps
2152
- },
2153
- // CSS selectors
2154
- [DATA_ATTRIBUTES.group]: "",
2155
- [DATA_ATTRIBUTES.groupDirection]: direction,
2156
- [DATA_ATTRIBUTES.groupId]: groupId
2157
- }));
2158
- }
2159
- const PanelGroup = forwardRef((props, ref) => createElement(PanelGroupWithForwardedRef, {
2160
- ...props,
2161
- forwardedRef: ref
2162
- }));
2163
- PanelGroupWithForwardedRef.displayName = "PanelGroup";
2164
- PanelGroup.displayName = "forwardRef(PanelGroup)";
2165
- function findPanelDataIndex(panelDataArray, panelData) {
2166
- return panelDataArray.findIndex(prevPanelData => prevPanelData === panelData || prevPanelData.id === panelData.id);
2167
- }
2168
- function panelDataHelper(panelDataArray, panelData, layout) {
2169
- const panelIndex = findPanelDataIndex(panelDataArray, panelData);
2170
- const isLastPanel = panelIndex === panelDataArray.length - 1;
2171
- const pivotIndices = isLastPanel ? [panelIndex - 1, panelIndex] : [panelIndex, panelIndex + 1];
2172
- const panelSize = layout[panelIndex];
2173
- return {
2174
- ...panelData.constraints,
2175
- panelSize,
2176
- pivotIndices
2177
- };
2178
- }
2179
-
2180
- // https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/
2181
-
2182
- function useWindowSplitterResizeHandlerBehavior({
2183
- disabled,
2184
- handleId,
2185
- resizeHandler,
2186
- panelGroupElement
2187
- }) {
2188
- useEffect(() => {
2189
- if (disabled || resizeHandler == null || panelGroupElement == null) {
2190
- return;
2191
- }
2192
- const handleElement = getResizeHandleElement(handleId, panelGroupElement);
2193
- if (handleElement == null) {
2194
- return;
2195
- }
2196
- const onKeyDown = event => {
2197
- if (event.defaultPrevented) {
2198
- return;
2199
- }
2200
- switch (event.key) {
2201
- case "ArrowDown":
2202
- case "ArrowLeft":
2203
- case "ArrowRight":
2204
- case "ArrowUp":
2205
- case "End":
2206
- case "Home":
2207
- {
2208
- event.preventDefault();
2209
- resizeHandler(event);
2210
- break;
2211
- }
2212
- case "F6":
2213
- {
2214
- event.preventDefault();
2215
- const groupId = handleElement.getAttribute(DATA_ATTRIBUTES.groupId);
2216
- assert(groupId, `No group element found for id "${groupId}"`);
2217
- const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
2218
- const index = getResizeHandleElementIndex(groupId, handleId, panelGroupElement);
2219
- assert(index !== null, `No resize element found for id "${handleId}"`);
2220
- const nextIndex = event.shiftKey ? index > 0 ? index - 1 : handles.length - 1 : index + 1 < handles.length ? index + 1 : 0;
2221
- const nextHandle = handles[nextIndex];
2222
- nextHandle.focus();
2223
- break;
2224
- }
2225
- }
2226
- };
2227
- handleElement.addEventListener("keydown", onKeyDown);
2228
- return () => {
2229
- handleElement.removeEventListener("keydown", onKeyDown);
2230
- };
2231
- }, [panelGroupElement, disabled, handleId, resizeHandler]);
2232
- }
2233
-
2234
- function PanelResizeHandle({
2235
- children = null,
2236
- className: classNameFromProps = "",
2237
- disabled = false,
2238
- hitAreaMargins,
2239
- id: idFromProps,
2240
- onBlur,
2241
- onClick,
2242
- onDragging,
2243
- onFocus,
2244
- onPointerDown,
2245
- onPointerUp,
2246
- style: styleFromProps = {},
2247
- tabIndex = 0,
2248
- tagName: Type = "div",
2249
- ...rest
2250
- }) {
2251
- var _hitAreaMargins$coars, _hitAreaMargins$fine;
2252
- const elementRef = useRef(null);
2253
-
2254
- // Use a ref to guard against users passing inline props
2255
- const callbacksRef = useRef({
2256
- onClick,
2257
- onDragging,
2258
- onPointerDown,
2259
- onPointerUp
2260
- });
2261
- useEffect(() => {
2262
- callbacksRef.current.onClick = onClick;
2263
- callbacksRef.current.onDragging = onDragging;
2264
- callbacksRef.current.onPointerDown = onPointerDown;
2265
- callbacksRef.current.onPointerUp = onPointerUp;
2266
- });
2267
- const panelGroupContext = useContext(PanelGroupContext);
2268
- if (panelGroupContext === null) {
2269
- throw Error(`PanelResizeHandle components must be rendered within a PanelGroup container`);
2270
- }
2271
- const {
2272
- direction,
2273
- groupId,
2274
- registerResizeHandle: registerResizeHandleWithParentGroup,
2275
- startDragging,
2276
- stopDragging,
2277
- panelGroupElement
2278
- } = panelGroupContext;
2279
- const resizeHandleId = useUniqueId(idFromProps);
2280
- const [state, setState] = useState("inactive");
2281
- const [isFocused, setIsFocused] = useState(false);
2282
- const [resizeHandler, setResizeHandler] = useState(null);
2283
- const committedValuesRef = useRef({
2284
- state
2285
- });
2286
- useIsomorphicLayoutEffect(() => {
2287
- committedValuesRef.current.state = state;
2288
- });
2289
- useEffect(() => {
2290
- if (disabled) {
2291
- setResizeHandler(null);
2292
- } else {
2293
- const resizeHandler = registerResizeHandleWithParentGroup(resizeHandleId);
2294
- setResizeHandler(() => resizeHandler);
2295
- }
2296
- }, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
2297
-
2298
- // Extract hit area margins before passing them to the effect's dependency array
2299
- // so that inline object values won't trigger re-renders
2300
- const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
2301
- const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
2302
- useEffect(() => {
2303
- if (disabled || resizeHandler == null) {
2304
- return;
2305
- }
2306
- const element = elementRef.current;
2307
- assert(element, "Element ref not attached");
2308
- let didMove = false;
2309
- const setResizeHandlerState = (action, isActive, event) => {
2310
- if (!isActive) {
2311
- setState("inactive");
2312
- return;
2313
- }
2314
- switch (action) {
2315
- case "down":
2316
- {
2317
- setState("drag");
2318
- didMove = false;
2319
- assert(event, 'Expected event to be defined for "down" action');
2320
- startDragging(resizeHandleId, event);
2321
- const {
2322
- onDragging,
2323
- onPointerDown
2324
- } = callbacksRef.current;
2325
- onDragging === null || onDragging === void 0 ? void 0 : onDragging(true);
2326
- onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown();
2327
- break;
2328
- }
2329
- case "move":
2330
- {
2331
- const {
2332
- state
2333
- } = committedValuesRef.current;
2334
- didMove = true;
2335
- if (state !== "drag") {
2336
- setState("hover");
2337
- }
2338
- assert(event, 'Expected event to be defined for "move" action');
2339
- resizeHandler(event);
2340
- break;
2341
- }
2342
- case "up":
2343
- {
2344
- setState("hover");
2345
- stopDragging();
2346
- const {
2347
- onClick,
2348
- onDragging,
2349
- onPointerUp
2350
- } = callbacksRef.current;
2351
- onDragging === null || onDragging === void 0 ? void 0 : onDragging(false);
2352
- onPointerUp === null || onPointerUp === void 0 ? void 0 : onPointerUp();
2353
- if (!didMove) {
2354
- onClick === null || onClick === void 0 ? void 0 : onClick();
2355
- }
2356
- break;
2357
- }
2358
- }
2359
- };
2360
- return registerResizeHandle(resizeHandleId, element, direction, {
2361
- coarse: coarseHitAreaMargins,
2362
- fine: fineHitAreaMargins
2363
- }, setResizeHandlerState);
2364
- }, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
2365
- useWindowSplitterResizeHandlerBehavior({
2366
- disabled,
2367
- handleId: resizeHandleId,
2368
- resizeHandler,
2369
- panelGroupElement
2370
- });
2371
- const style = {
2372
- touchAction: "none",
2373
- userSelect: "none"
2374
- };
2375
- return createElement(Type, {
2376
- ...rest,
2377
- children,
2378
- className: classNameFromProps,
2379
- id: idFromProps,
2380
- onBlur: () => {
2381
- setIsFocused(false);
2382
- onBlur === null || onBlur === void 0 ? void 0 : onBlur();
2383
- },
2384
- onFocus: () => {
2385
- setIsFocused(true);
2386
- onFocus === null || onFocus === void 0 ? void 0 : onFocus();
2387
- },
2388
- ref: elementRef,
2389
- role: "separator",
2390
- style: {
2391
- ...style,
2392
- ...styleFromProps
2393
- },
2394
- tabIndex,
2395
- // CSS selectors
2396
- [DATA_ATTRIBUTES.groupDirection]: direction,
2397
- [DATA_ATTRIBUTES.groupId]: groupId,
2398
- [DATA_ATTRIBUTES.resizeHandle]: "",
2399
- [DATA_ATTRIBUTES.resizeHandleActive]: state === "drag" ? "pointer" : isFocused ? "keyboard" : undefined,
2400
- [DATA_ATTRIBUTES.resizeHandleEnabled]: !disabled,
2401
- [DATA_ATTRIBUTES.resizeHandleId]: resizeHandleId,
2402
- [DATA_ATTRIBUTES.resizeHandleState]: state
2403
- });
2404
- }
2405
- PanelResizeHandle.displayName = "PanelResizeHandle";
2406
-
2407
- export { DATA_ATTRIBUTES, Panel, PanelGroup, PanelResizeHandle, assert, getPanelGroupElement, getResizeHandleElement, getResizeHandleElementIndex, getResizeHandleElementsForGroup, getResizeHandlePanelIds, intersects };