plass-ui 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (454) hide show
  1. package/CHANGELOG.md +962 -0
  2. package/README.md +19 -17
  3. package/dist/components/accordion/PlAccordion.d.ts +1 -1
  4. package/dist/components/alert/PlAlert.js +1 -1
  5. package/dist/components/anchor/PlAnchor.d.ts +85 -0
  6. package/dist/components/anchor/PlAnchor.js +1 -0
  7. package/dist/components/anchor/index.d.ts +2 -0
  8. package/dist/components/anchor/index.js +1 -0
  9. package/dist/components/animate-appear/PlAnimateAppear.d.ts +10 -0
  10. package/dist/components/animate-appear/PlAnimateAppear.js +1 -1
  11. package/dist/components/animate-blink/PlAnimateBlink.d.ts +2 -2
  12. package/dist/components/animate-blink/PlAnimateBlink.js +1 -1
  13. package/dist/components/animate-counter/PlAnimateCounter.d.ts +83 -0
  14. package/dist/components/animate-counter/PlAnimateCounter.js +1 -0
  15. package/dist/components/animate-counter/index.d.ts +2 -0
  16. package/dist/components/animate-counter/index.js +1 -0
  17. package/dist/components/animate-fade/PlAnimateFade.d.ts +2 -2
  18. package/dist/components/animate-fade/PlAnimateFade.js +1 -1
  19. package/dist/components/animate-float/PlAnimateFloat.d.ts +51 -0
  20. package/dist/components/animate-float/PlAnimateFloat.js +1 -0
  21. package/dist/components/animate-float/index.d.ts +2 -0
  22. package/dist/components/animate-float/index.js +1 -0
  23. package/dist/components/animate-grow/PlAnimateGrow.d.ts +2 -2
  24. package/dist/components/animate-grow/PlAnimateGrow.js +1 -1
  25. package/dist/components/animate-headline/PlAnimateHeadline.js +1 -1
  26. package/dist/components/animate-lighting/PlAnimateLighting.js +1 -1
  27. package/dist/components/animate-marquee/PlAnimateMarquee.d.ts +13 -4
  28. package/dist/components/animate-marquee/PlAnimateMarquee.js +1 -1
  29. package/dist/components/animate-reveal/PlAnimateReveal.d.ts +51 -0
  30. package/dist/components/animate-reveal/PlAnimateReveal.js +1 -0
  31. package/dist/components/animate-reveal/index.d.ts +2 -0
  32. package/dist/components/animate-reveal/index.js +1 -0
  33. package/dist/components/animate-rotate/PlAnimateRotate.d.ts +2 -2
  34. package/dist/components/animate-rotate/PlAnimateRotate.js +1 -1
  35. package/dist/components/animate-scramble/PlAnimateScramble.d.ts +75 -0
  36. package/dist/components/animate-scramble/PlAnimateScramble.js +1 -0
  37. package/dist/components/animate-scramble/index.d.ts +2 -0
  38. package/dist/components/animate-scramble/index.js +1 -0
  39. package/dist/components/animate-shake/PlAnimateShake.d.ts +57 -0
  40. package/dist/components/animate-shake/PlAnimateShake.js +1 -0
  41. package/dist/components/animate-shake/index.d.ts +2 -0
  42. package/dist/components/animate-shake/index.js +1 -0
  43. package/dist/components/animate-slide/PlAnimateSlide.d.ts +2 -2
  44. package/dist/components/animate-slide/PlAnimateSlide.js +1 -1
  45. package/dist/components/animate-split/PlAnimateSplit.d.ts +57 -0
  46. package/dist/components/animate-split/PlAnimateSplit.js +1 -0
  47. package/dist/components/animate-split/index.d.ts +2 -0
  48. package/dist/components/animate-split/index.js +1 -0
  49. package/dist/components/animate-typing/PlAnimateTyping.d.ts +3 -2
  50. package/dist/components/animate-typing/PlAnimateTyping.js +1 -1
  51. package/dist/components/animate-zoom/PlAnimateZoom.d.ts +2 -2
  52. package/dist/components/animate-zoom/PlAnimateZoom.js +1 -1
  53. package/dist/components/app-logo/PlAppLogo.d.ts +78 -0
  54. package/dist/components/app-logo/PlAppLogo.js +1 -0
  55. package/dist/components/app-logo/index.d.ts +2 -0
  56. package/dist/components/app-logo/index.js +1 -0
  57. package/dist/components/area-chart/PlAreaChart.d.ts +54 -0
  58. package/dist/components/area-chart/PlAreaChart.js +1 -0
  59. package/dist/components/area-chart/index.d.ts +2 -0
  60. package/dist/components/area-chart/index.js +1 -0
  61. package/dist/components/aspect-ratio/PlAspectRatio.d.ts +2 -1
  62. package/dist/components/aspect-ratio/PlAspectRatio.js +1 -1
  63. package/dist/components/avatar/PlAvatar.js +1 -1
  64. package/dist/components/back-top/PlBackTop.d.ts +2 -1
  65. package/dist/components/back-top/PlBackTop.js +1 -1
  66. package/dist/components/badge/PlBadge.js +1 -1
  67. package/dist/components/bar-chart/PlBarChart.d.ts +63 -0
  68. package/dist/components/bar-chart/PlBarChart.js +1 -0
  69. package/dist/components/bar-chart/index.d.ts +2 -0
  70. package/dist/components/bar-chart/index.js +1 -0
  71. package/dist/components/bottom-navigation/PlBottomNavigation.d.ts +3 -0
  72. package/dist/components/breadcrumb/PlBreadcrumb.js +1 -1
  73. package/dist/components/button/PlButton.d.ts +8 -0
  74. package/dist/components/button/PlButton.js +1 -1
  75. package/dist/components/button-group/PlButtonGroup.js +1 -1
  76. package/dist/components/calendar/PlCalendar.js +1 -1
  77. package/dist/components/card/PlCard.js +1 -1
  78. package/dist/components/carousel/PlCarousel.d.ts +1 -1
  79. package/dist/components/carousel/PlCarousel.js +1 -1
  80. package/dist/components/chat-bubble/PlChatBubble.d.ts +4 -1
  81. package/dist/components/chat-bubble/PlChatBubble.js +1 -1
  82. package/dist/components/checkbox/PlCheckbox.js +1 -1
  83. package/dist/components/chip/PlChip.d.ts +6 -2
  84. package/dist/components/chip/PlChip.js +1 -1
  85. package/dist/components/code-block/PlCodeBlock.d.ts +192 -0
  86. package/dist/components/code-block/PlCodeBlock.js +1 -0
  87. package/dist/components/code-block/index.d.ts +2 -0
  88. package/dist/components/code-block/index.js +1 -0
  89. package/dist/components/color-picker/PlColorPicker.js +1 -1
  90. package/dist/components/combobox/PlCombobox.d.ts +6 -5
  91. package/dist/components/combobox/PlCombobox.js +1 -1
  92. package/dist/components/command-palette/PlCommandPalette.d.ts +6 -2
  93. package/dist/components/command-palette/PlCommandPalette.js +1 -1
  94. package/dist/components/confirm/PlConfirmProvider.js +1 -1
  95. package/dist/components/container/PlContainer.d.ts +22 -6
  96. package/dist/components/container/PlContainer.js +1 -1
  97. package/dist/components/data-list/PlDataList.d.ts +74 -0
  98. package/dist/components/data-list/PlDataList.js +1 -0
  99. package/dist/components/data-list/index.d.ts +2 -0
  100. package/dist/components/data-list/index.js +1 -0
  101. package/dist/components/data-table/PlDataTable.d.ts +216 -0
  102. package/dist/components/data-table/PlDataTable.js +1 -0
  103. package/dist/components/data-table/index.d.ts +2 -0
  104. package/dist/components/data-table/index.js +1 -0
  105. package/dist/components/date-picker/PlDatePicker.js +1 -1
  106. package/dist/components/date-range-picker/PlDateRangePicker.js +1 -1
  107. package/dist/components/date-time-picker/PlDateTimePicker.js +1 -1
  108. package/dist/components/drawer/PlDrawer.d.ts +1 -1
  109. package/dist/components/drawer/PlDrawer.js +1 -1
  110. package/dist/components/file-picker/PlFilePicker.d.ts +4 -1
  111. package/dist/components/file-picker/PlFilePicker.js +1 -1
  112. package/dist/components/flex/PlFlex.d.ts +83 -0
  113. package/dist/components/flex/PlFlex.js +1 -0
  114. package/dist/components/flex/index.d.ts +2 -0
  115. package/dist/components/flex/index.js +1 -0
  116. package/dist/components/floating-action-button/PlFloatingActionButton.d.ts +81 -0
  117. package/dist/components/floating-action-button/PlFloatingActionButton.js +1 -0
  118. package/dist/components/floating-action-button/index.d.ts +2 -0
  119. package/dist/components/floating-action-button/index.js +1 -0
  120. package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.d.ts +3 -0
  121. package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.js +1 -1
  122. package/dist/components/footer/PlFooter.d.ts +4 -3
  123. package/dist/components/footer/PlFooter.js +1 -1
  124. package/dist/components/form/PlForm.js +1 -1
  125. package/dist/components/gallery/PlGallery.d.ts +192 -0
  126. package/dist/components/gallery/PlGallery.js +1 -0
  127. package/dist/components/gallery/PlGalleryViewer.d.ts +31 -0
  128. package/dist/components/gallery/PlGalleryViewer.js +1 -0
  129. package/dist/components/gallery/index.d.ts +2 -0
  130. package/dist/components/gallery/index.js +1 -0
  131. package/dist/components/gauge-chart/PlGaugeChart.d.ts +64 -0
  132. package/dist/components/gauge-chart/PlGaugeChart.js +1 -0
  133. package/dist/components/gauge-chart/index.d.ts +2 -0
  134. package/dist/components/gauge-chart/index.js +1 -0
  135. package/dist/components/grid/PlGrid.js +1 -1
  136. package/dist/components/grid/PlGridItem.js +1 -1
  137. package/dist/components/header/PlHeader.d.ts +4 -3
  138. package/dist/components/header/PlHeader.js +1 -1
  139. package/dist/components/heatmap-chart/PlHeatmapChart.d.ts +69 -0
  140. package/dist/components/heatmap-chart/PlHeatmapChart.js +1 -0
  141. package/dist/components/heatmap-chart/index.d.ts +2 -0
  142. package/dist/components/heatmap-chart/index.js +1 -0
  143. package/dist/components/highlight/PlHighlight.js +1 -1
  144. package/dist/components/hot-keys/PlHotKeys.js +1 -1
  145. package/dist/components/hover-card/PlHoverCard.d.ts +96 -0
  146. package/dist/components/hover-card/PlHoverCard.js +1 -0
  147. package/dist/components/hover-card/index.d.ts +2 -0
  148. package/dist/components/hover-card/index.js +1 -0
  149. package/dist/components/how-to-steps/PlHowToSteps.d.ts +87 -0
  150. package/dist/components/how-to-steps/PlHowToSteps.js +1 -0
  151. package/dist/components/how-to-steps/index.d.ts +2 -0
  152. package/dist/components/how-to-steps/index.js +1 -0
  153. package/dist/components/image/PlImage.d.ts +195 -8
  154. package/dist/components/image/PlImage.js +1 -1
  155. package/dist/components/image/PlImagePreview.d.ts +58 -0
  156. package/dist/components/image/PlImagePreview.js +1 -0
  157. package/dist/components/image/index.d.ts +1 -1
  158. package/dist/components/line-chart/PlLineChart.d.ts +74 -0
  159. package/dist/components/line-chart/PlLineChart.js +1 -0
  160. package/dist/components/line-chart/index.d.ts +2 -0
  161. package/dist/components/line-chart/index.js +1 -0
  162. package/dist/components/menu/PlMenu.d.ts +14 -5
  163. package/dist/components/menu/PlMenu.js +1 -1
  164. package/dist/components/meter/PlMeter.d.ts +83 -0
  165. package/dist/components/meter/PlMeter.js +1 -0
  166. package/dist/components/meter/index.d.ts +2 -0
  167. package/dist/components/meter/index.js +1 -0
  168. package/dist/components/mockup/PlMockup.d.ts +146 -0
  169. package/dist/components/mockup/PlMockup.js +1 -0
  170. package/dist/components/mockup/index.d.ts +2 -0
  171. package/dist/components/mockup/index.js +1 -0
  172. package/dist/components/modal/PlModal.d.ts +1 -1
  173. package/dist/components/modal/PlModal.js +1 -1
  174. package/dist/components/navigation-menu/PlNavigationMenu.d.ts +7 -1
  175. package/dist/components/navigation-menu/PlNavigationMenu.js +1 -1
  176. package/dist/components/number-field/PlNumberField.d.ts +1 -1
  177. package/dist/components/number-field/PlNumberField.js +1 -1
  178. package/dist/components/otp-field/PlOtpField.d.ts +6 -0
  179. package/dist/components/otp-field/PlOtpField.js +1 -1
  180. package/dist/components/overlay/PlOverlay.d.ts +1 -1
  181. package/dist/components/overlay/PlOverlay.js +1 -1
  182. package/dist/components/page-layout/PlPageLayout.js +1 -1
  183. package/dist/components/pagination/PlPagination.d.ts +12 -9
  184. package/dist/components/pagination/PlPagination.js +1 -1
  185. package/dist/components/panes/PlPanes.d.ts +7 -2
  186. package/dist/components/panes/PlPanes.js +1 -1
  187. package/dist/components/pie-chart/PlPieChart.d.ts +58 -0
  188. package/dist/components/pie-chart/PlPieChart.js +1 -0
  189. package/dist/components/pie-chart/index.d.ts +2 -0
  190. package/dist/components/pie-chart/index.js +1 -0
  191. package/dist/components/pill/PlPill.js +1 -1
  192. package/dist/components/popconfirm/PlPopconfirm.d.ts +1 -1
  193. package/dist/components/popconfirm/PlPopconfirm.js +1 -1
  194. package/dist/components/popover/PlPopover.d.ts +6 -6
  195. package/dist/components/popover/PlPopover.js +1 -1
  196. package/dist/components/portal/PlPortal.d.ts +78 -0
  197. package/dist/components/portal/PlPortal.js +1 -0
  198. package/dist/components/portal/index.d.ts +2 -0
  199. package/dist/components/portal/index.js +1 -0
  200. package/dist/components/progress-box/PlProgressBox.js +1 -1
  201. package/dist/components/progress-circular/PlProgressCircular.js +1 -1
  202. package/dist/components/progress-linear/PlProgressLinear.js +1 -1
  203. package/dist/components/radio-group/PlRadioGroup.js +1 -1
  204. package/dist/components/rating/PlRating.d.ts +1 -1
  205. package/dist/components/rating/PlRating.js +1 -1
  206. package/dist/components/scatter-chart/PlScatterChart.d.ts +46 -0
  207. package/dist/components/scatter-chart/PlScatterChart.js +1 -0
  208. package/dist/components/scatter-chart/index.d.ts +2 -0
  209. package/dist/components/scatter-chart/index.js +1 -0
  210. package/dist/components/scroll-area/PlScrollArea.d.ts +98 -0
  211. package/dist/components/scroll-area/PlScrollArea.js +1 -0
  212. package/dist/components/scroll-area/index.d.ts +2 -0
  213. package/dist/components/scroll-area/index.js +1 -0
  214. package/dist/components/scroll-zone/PlScrollZone.d.ts +27 -10
  215. package/dist/components/scroll-zone/PlScrollZone.js +1 -1
  216. package/dist/components/segmented-button/PlSegmentedButton.js +1 -1
  217. package/dist/components/select/PlSelect.js +1 -1
  218. package/dist/components/show/PlShow.d.ts +76 -0
  219. package/dist/components/show/PlShow.js +1 -0
  220. package/dist/components/show/index.d.ts +2 -0
  221. package/dist/components/show/index.js +1 -0
  222. package/dist/components/sidebar/PlSidebar.js +1 -1
  223. package/dist/components/sidebar/PlSidebarTrigger.js +1 -1
  224. package/dist/components/skeleton/PlSkeleton.js +1 -1
  225. package/dist/components/slider/PlSlider.d.ts +13 -1
  226. package/dist/components/slider/PlSlider.js +1 -1
  227. package/dist/components/sparkline/PlSparkline.d.ts +68 -0
  228. package/dist/components/sparkline/PlSparkline.js +1 -0
  229. package/dist/components/sparkline/index.d.ts +2 -0
  230. package/dist/components/sparkline/index.js +1 -0
  231. package/dist/components/spoiler/PlSpoiler.d.ts +16 -1
  232. package/dist/components/spoiler/PlSpoiler.js +1 -1
  233. package/dist/components/stack/PlStack.d.ts +114 -0
  234. package/dist/components/stack/PlStack.js +1 -0
  235. package/dist/components/stack/index.d.ts +2 -0
  236. package/dist/components/stack/index.js +1 -0
  237. package/dist/components/stat/PlStat.d.ts +4 -0
  238. package/dist/components/stat/PlStat.js +1 -1
  239. package/dist/components/stepper/PlStepper.d.ts +3 -3
  240. package/dist/components/stepper/PlStepper.js +1 -1
  241. package/dist/components/switch/PlSwitch.js +1 -1
  242. package/dist/components/table/PlTable.d.ts +5 -5
  243. package/dist/components/table/PlTable.js +1 -1
  244. package/dist/components/tabs/PlTabs.d.ts +27 -2
  245. package/dist/components/tabs/PlTabs.js +1 -1
  246. package/dist/components/text-link/PlTextLink.js +1 -1
  247. package/dist/components/time-picker/PlTimePicker.js +1 -1
  248. package/dist/components/timeline/PlTimeline.d.ts +2 -2
  249. package/dist/components/timeline/PlTimeline.js +1 -1
  250. package/dist/components/timeline-chart/PlTimelineChart.d.ts +44 -0
  251. package/dist/components/timeline-chart/PlTimelineChart.js +1 -0
  252. package/dist/components/timeline-chart/index.d.ts +2 -0
  253. package/dist/components/timeline-chart/index.js +1 -0
  254. package/dist/components/toast/PlToast.d.ts +1 -1
  255. package/dist/components/toast/PlToast.js +1 -1
  256. package/dist/components/toggle/PlToggle.js +1 -1
  257. package/dist/components/toggle/PlToggleGroup.js +1 -1
  258. package/dist/components/tooltip/PlTooltip.js +1 -1
  259. package/dist/components/tour/PlTour.d.ts +134 -0
  260. package/dist/components/tour/PlTour.js +1 -0
  261. package/dist/components/tour/index.d.ts +2 -0
  262. package/dist/components/tour/index.js +1 -0
  263. package/dist/components/transfer/PlTransfer.d.ts +10 -1
  264. package/dist/components/transfer/PlTransfer.js +1 -1
  265. package/dist/components/tree/PlTree.js +1 -1
  266. package/dist/components/tree-select/PlTreeSelect.d.ts +99 -0
  267. package/dist/components/tree-select/PlTreeSelect.js +1 -0
  268. package/dist/components/tree-select/index.d.ts +2 -0
  269. package/dist/components/tree-select/index.js +1 -0
  270. package/dist/components/typography/PlTypography.js +1 -1
  271. package/dist/components/window-pane/PlWindowPane.d.ts +179 -0
  272. package/dist/components/window-pane/PlWindowPane.js +1 -0
  273. package/dist/components/window-pane/index.d.ts +2 -0
  274. package/dist/components/window-pane/index.js +1 -0
  275. package/dist/css/anchor.css +2 -0
  276. package/dist/css/animate-counter.css +2 -0
  277. package/dist/css/animate-float.css +2 -0
  278. package/dist/css/animate-reveal.css +2 -0
  279. package/dist/css/animate-scramble.css +2 -0
  280. package/dist/css/animate-shake.css +2 -0
  281. package/dist/css/animate-split.css +2 -0
  282. package/dist/css/app-logo.css +2 -0
  283. package/dist/css/area-chart.css +3 -0
  284. package/dist/css/back-top.css +2 -0
  285. package/dist/css/bar-chart.css +3 -0
  286. package/dist/css/calendar.css +1 -0
  287. package/dist/css/carousel.css +2 -0
  288. package/dist/css/code-block.css +2 -0
  289. package/dist/css/color-picker.css +1 -0
  290. package/dist/css/combobox.css +1 -0
  291. package/dist/css/command-palette.css +1 -0
  292. package/dist/css/confirm.css +2 -0
  293. package/dist/css/data-list.css +2 -0
  294. package/dist/css/data-table.css +7 -0
  295. package/dist/css/date-picker.css +1 -0
  296. package/dist/css/date-range-picker.css +1 -0
  297. package/dist/css/date-time-picker.css +1 -0
  298. package/dist/css/flex.css +2 -0
  299. package/dist/css/floating-action-button.css +4 -0
  300. package/dist/css/gallery.css +7 -0
  301. package/dist/css/gauge-chart.css +3 -0
  302. package/dist/css/heatmap-chart.css +3 -0
  303. package/dist/css/hover-card.css +2 -0
  304. package/dist/css/how-to-steps.css +2 -0
  305. package/dist/css/icon-button.css +1 -0
  306. package/dist/css/image.css +2 -0
  307. package/dist/css/line-chart.css +3 -0
  308. package/dist/css/menubar.css +1 -0
  309. package/dist/css/meter.css +2 -0
  310. package/dist/css/mockup.css +2 -0
  311. package/dist/css/pagination.css +1 -0
  312. package/dist/css/pie-chart.css +3 -0
  313. package/dist/css/popconfirm.css +2 -0
  314. package/dist/css/portal.css +2 -0
  315. package/dist/css/scatter-chart.css +3 -0
  316. package/dist/css/scroll-area.css +2 -0
  317. package/dist/css/scroll-zone.css +2 -0
  318. package/dist/css/show.css +2 -0
  319. package/dist/css/sidebar.css +3 -0
  320. package/dist/css/sparkline.css +3 -0
  321. package/dist/css/spoiler.css +1 -0
  322. package/dist/css/stack.css +2 -0
  323. package/dist/css/stat.css +1 -0
  324. package/dist/css/time-picker.css +1 -0
  325. package/dist/css/timeline-chart.css +3 -0
  326. package/dist/css/tour.css +3 -0
  327. package/dist/css/transfer.css +4 -0
  328. package/dist/css/tree-select.css +4 -0
  329. package/dist/css/window-pane.css +2 -0
  330. package/dist/hooks/index.d.ts +6 -0
  331. package/dist/hooks/index.js +1 -1
  332. package/dist/hooks/usePlBreakpoint.d.ts +3 -0
  333. package/dist/hooks/usePlBreakpoint.js +1 -1
  334. package/dist/hooks/usePlDisclosure.d.ts +44 -0
  335. package/dist/hooks/usePlDisclosure.js +1 -0
  336. package/dist/hooks/usePlElementSize.d.ts +34 -0
  337. package/dist/hooks/usePlElementSize.js +1 -0
  338. package/dist/hooks/usePlHotKeys.d.ts +5 -1
  339. package/dist/hooks/usePlHotKeys.js +1 -1
  340. package/dist/hooks/usePlOnScreen.d.ts +54 -0
  341. package/dist/hooks/usePlOnScreen.js +1 -0
  342. package/dist/index.d.ts +34 -1
  343. package/dist/index.js +1 -1
  344. package/dist/internal/animate.d.ts +121 -7
  345. package/dist/internal/animate.js +1 -1
  346. package/dist/internal/breakpoints.d.ts +31 -0
  347. package/dist/internal/breakpoints.js +1 -0
  348. package/dist/internal/button-group.d.ts +29 -2
  349. package/dist/internal/button-group.js +2 -2
  350. package/dist/internal/calendar.d.ts +11 -36
  351. package/dist/internal/calendar.js +1 -1
  352. package/dist/internal/chart-frame.d.ts +462 -0
  353. package/dist/internal/chart-frame.js +1 -0
  354. package/dist/internal/chart-line.d.ts +44 -0
  355. package/dist/internal/chart-line.js +1 -0
  356. package/dist/internal/chart.d.ts +551 -0
  357. package/dist/internal/chart.js +1 -0
  358. package/dist/internal/color-scheme.js +1 -1
  359. package/dist/internal/data-table.d.ts +70 -0
  360. package/dist/internal/data-table.js +1 -0
  361. package/dist/internal/date.d.ts +10 -0
  362. package/dist/internal/date.js +1 -1
  363. package/dist/internal/defaults.d.ts +8 -3
  364. package/dist/internal/drag.d.ts +65 -0
  365. package/dist/internal/drag.js +1 -0
  366. package/dist/internal/focusable.d.ts +8 -0
  367. package/dist/internal/focusable.js +1 -0
  368. package/dist/internal/form.d.ts +61 -0
  369. package/dist/internal/form.js +1 -0
  370. package/dist/internal/format.d.ts +2 -0
  371. package/dist/internal/format.js +1 -1
  372. package/dist/internal/gallery.d.ts +80 -0
  373. package/dist/internal/gallery.js +1 -0
  374. package/dist/internal/glow.d.ts +17 -0
  375. package/dist/internal/glow.js +1 -0
  376. package/dist/internal/grid.d.ts +6 -27
  377. package/dist/internal/grid.js +1 -1
  378. package/dist/internal/highlight.d.ts +98 -0
  379. package/dist/internal/highlight.js +1 -0
  380. package/dist/internal/icons.d.ts +10 -0
  381. package/dist/internal/icons.js +1 -1
  382. package/dist/internal/image.d.ts +94 -0
  383. package/dist/internal/image.js +1 -0
  384. package/dist/internal/inert.d.ts +19 -0
  385. package/dist/internal/inert.js +1 -0
  386. package/dist/internal/keys.d.ts +19 -0
  387. package/dist/internal/keys.js +1 -1
  388. package/dist/internal/labels.d.ts +182 -0
  389. package/dist/internal/labels.js +1 -0
  390. package/dist/internal/link.d.ts +17 -0
  391. package/dist/internal/link.js +1 -1
  392. package/dist/internal/mockup.d.ts +193 -0
  393. package/dist/internal/mockup.js +1 -0
  394. package/dist/internal/page-layout.d.ts +14 -7
  395. package/dist/internal/page-layout.js +1 -1
  396. package/dist/internal/picker.d.ts +43 -6
  397. package/dist/internal/picker.js +1 -1
  398. package/dist/internal/progress.d.ts +22 -8
  399. package/dist/internal/progress.js +1 -1
  400. package/dist/internal/responsive.d.ts +108 -0
  401. package/dist/internal/responsive.js +1 -0
  402. package/dist/internal/scramble.d.ts +35 -0
  403. package/dist/internal/scramble.js +1 -0
  404. package/dist/internal/scroll-target.d.ts +5 -0
  405. package/dist/internal/scroll-target.js +1 -0
  406. package/dist/internal/steps.js +1 -1
  407. package/dist/internal/styles.d.ts +81 -0
  408. package/dist/internal/styles.js +1 -1
  409. package/dist/internal/table.d.ts +86 -0
  410. package/dist/internal/table.js +1 -0
  411. package/dist/internal/text.d.ts +39 -0
  412. package/dist/internal/text.js +1 -0
  413. package/dist/internal/threshold.d.ts +19 -0
  414. package/dist/internal/threshold.js +1 -0
  415. package/dist/internal/tour.d.ts +42 -0
  416. package/dist/internal/tour.js +1 -0
  417. package/dist/internal/watermark.d.ts +44 -0
  418. package/dist/internal/watermark.js +1 -0
  419. package/dist/internal/wheel.d.ts +52 -0
  420. package/dist/internal/wheel.js +1 -0
  421. package/dist/internal/window.d.ts +201 -0
  422. package/dist/internal/window.js +1 -0
  423. package/dist/locales/de.d.ts +3 -0
  424. package/dist/locales/de.js +1 -0
  425. package/dist/locales/en.d.ts +2 -0
  426. package/dist/locales/en.js +1 -0
  427. package/dist/locales/es.d.ts +3 -0
  428. package/dist/locales/es.js +1 -0
  429. package/dist/locales/fr.d.ts +3 -0
  430. package/dist/locales/fr.js +1 -0
  431. package/dist/locales/index.d.ts +33 -0
  432. package/dist/locales/index.js +1 -0
  433. package/dist/locales/ja.d.ts +3 -0
  434. package/dist/locales/ja.js +1 -0
  435. package/dist/locales/ko.d.ts +3 -0
  436. package/dist/locales/ko.js +1 -0
  437. package/dist/locales/zh-Hans.d.ts +3 -0
  438. package/dist/locales/zh-Hans.js +1 -0
  439. package/dist/provider/PlColorSchemeScript.js +1 -1
  440. package/dist/provider/PlassProvider.js +1 -1
  441. package/dist/provider/index.d.ts +1 -0
  442. package/dist/provider/index.js +1 -1
  443. package/dist/styles.css +1 -1
  444. package/dist/tailwind.css +1357 -25
  445. package/dist/tokens.css +1357 -25
  446. package/dist/types.d.ts +368 -2
  447. package/package.json +26 -16
  448. package/dist/components/avatar-group/PlAvatarGroup.d.ts +0 -47
  449. package/dist/components/avatar-group/PlAvatarGroup.js +0 -1
  450. package/dist/components/avatar-group/index.d.ts +0 -2
  451. package/dist/components/avatar-group/index.js +0 -1
  452. package/dist/css/avatar-group.css +0 -2
  453. package/dist/internal/avatar-group.d.ts +0 -25
  454. package/dist/internal/avatar-group.js +0 -2
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{useDefaults as n}from"../../internal/defaults.js";import{StarIcon as r,StarOutlineIcon as l}from"../../internal/icons.js";import{controlSlots as i,cx as s,focusWithinRingClasses as o,gapClasses as c,iconSizeClasses as d,radiusClasses as u,srOnlyClasses as m,transitionClasses as h}from"../../internal/styles.js";const f="flex items-center justify-center";function defaultValueLabel(e,a){return e<=0?"No rating":`${e} out of ${a}`}export const PlRating=/* @__PURE__ */t.forwardRef(function PlRating({value:p,defaultValue:y=0,onValueChange:b,count:x=5,precision:v=1,icon:g,emptyIcon:N,clearable:M=!0,readOnly:j=!1,disabled:w=!1,name:L,required:P=!1,size:k,color:R,label:V="Rating",valueLabel:q=defaultValueLabel,className:C,style:I,onPointerLeave:S,...z},A){const $=n(),E=k??$.size??"md",F=R??$.color??"warning",O=t.useId(),B=L??O,[D,G]=t.useState(y),H=void 0!==p,J=H?p:D,[K,Q]=t.useState(null),T=Math.max(1,Math.floor(x)),U=v>0&&v<=1?v:1,W=Math.round(1/U),X=Math.max(0,Math.min(T,K??J)),change=e=>{H||G(e),b?.(e)},Y=Array.from({length:T},(t,n)=>{const i=Math.max(0,Math.min(1,X-n));return a("span",{className:s("relative inline-flex shrink-0",d[E],u.xs,j||w?"":o),children:[e("span",{className:s(f,d[E],"text-(--p-empty)"),children:N??e(l,{})}),e("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 start-0 overflow-hidden",style:{width:100*i+"%"},children:e("span",{className:s(f,d[E],"text-(--p-accent)",h),children:g??e(r,{})})}),j?null:Array.from({length:W},(a,t)=>{const r=Number((n+(t+1)*U).toFixed(4));return e("label",{className:s("absolute inset-y-0",w?"cursor-not-allowed":"cursor-pointer"),style:{insetInlineStart:100*t/W+"%",width:100/W+"%"},onPointerEnter:()=>{w||Q(r)},children:e("input",{type:"radio",className:m,name:B,value:r,checked:J===r,disabled:w,required:P,"aria-label":q(r,T),onChange:()=>change(r),onClick:()=>{M&&J===r&&change(0)}})},r)})]},n)}),Z=s("inline-flex items-center align-middle",c[E],w?"cursor-not-allowed opacity-50 saturate-[0.35]":"",C),_={...i(F,0,"solid"),"--p-empty":"color-mix(in oklab, var(--plass-muted-fg) 40%, transparent)",...I};return e("div",j?{ref:A,role:"img","aria-label":q(Math.max(0,Math.min(T,J)),T),className:Z,style:_,onPointerLeave:S,...z,children:Y}:{ref:A,role:"radiogroup","aria-label":V,"aria-disabled":w||void 0,"aria-required":P||void 0,className:Z,style:_,onPointerLeave:e=>{Q(null),S?.(e)},...z,children:Y})});
1
+ "use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{useDefaults as t}from"../../internal/defaults.js";import{useLabels as n}from"../../internal/labels.js";import{StarIcon as l,StarOutlineIcon as i}from"../../internal/icons.js";import{controlSlots as s,cx as o,focusWithinRingClasses as c,gapClasses as m,iconSizeClasses as d,radiusClasses as u,srOnlyClasses as h,transitionClasses as p}from"../../internal/styles.js";const f="flex items-center justify-center";export const PlRating=/* @__PURE__ */r.forwardRef(function PlRating({value:y,defaultValue:x=0,onValueChange:b,count:g=5,precision:v=1,icon:N,emptyIcon:M,clearable:j=!0,readOnly:w=!1,disabled:P=!1,name:k,required:L=!1,size:q,color:C,label:I,valueLabel:R,className:S,style:V,onPointerLeave:z,...A},E){const F=t(),O=n(),B=I??O.rating,D=R??((e,a)=>e<=0?O.ratingNone:O.ratingValue(e,a)),G=q??F.size??"md",H=C??F.color??"warning",J=r.useId(),K=k??J,[Q,T]=r.useState(x),U=void 0!==y,W=U?y:Q,[X,Y]=r.useState(null),Z=Math.max(1,Math.floor(g)),$=v>0&&v<=1?v:1,_=Math.round(1/$),ee=Math.max(0,Math.min(Z,X??W)),change=e=>{U||T(e),b?.(e)},ae=Array.from({length:Z},(r,t)=>{const n=Math.max(0,Math.min(1,ee-t));return a("span",{className:o("relative inline-flex shrink-0",d[G],u.xs,w||P?"":c),children:[e("span",{className:o(f,d[G],"text-(--p-empty)"),children:M??e(i,{})}),e("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 start-0 overflow-hidden",style:{width:100*n+"%"},children:e("span",{className:o(f,d[G],"text-(--p-accent)",p),children:N??e(l,{})})}),w?null:Array.from({length:_},(a,r)=>{const n=Number((t+(r+1)*$).toFixed(4));return e("label",{className:o("absolute inset-y-0",P?"cursor-not-allowed":"cursor-pointer"),style:{insetInlineStart:100*r/_+"%",width:100/_+"%"},onPointerEnter:()=>{P||Y(n)},children:e("input",{type:"radio",className:h,name:K,value:n,checked:W===n,disabled:P,required:L,"aria-label":D(n,Z),onChange:()=>change(n),onClick:()=>{j&&W===n&&change(0)}})},n)})]},t)}),re=o("inline-flex items-center align-middle",m[G],P?"cursor-not-allowed opacity-50 saturate-[0.35]":"",S),te={...s(H,0,"solid"),"--p-empty":"color-mix(in oklab, var(--plass-muted-fg) 40%, transparent)",...V};return e("div",w?{ref:E,role:"img","aria-label":D(Math.max(0,Math.min(Z,W)),Z),className:re,style:te,onPointerLeave:z,...A,children:ae}:{ref:E,role:"radiogroup","aria-label":B,"aria-disabled":P||void 0,"aria-required":L||void 0,className:re,style:te,onPointerLeave:e=>{Y(null),z?.(e)},...A,children:ae})});
@@ -0,0 +1,46 @@
1
+ import * as React from 'react';
2
+ import { type CartesianChartProps } from '../../internal/chart-frame.js';
3
+ import { type MarkShape } from '../../internal/chart.js';
4
+ export interface PlScatterChartProps extends CartesianChartProps {
5
+ /**
6
+ * What each mark is drawn as.
7
+ *
8
+ * - `auto` — the default. A circle while colour alone can carry identity, and
9
+ * a shape per series from the fourth on, because past three it cannot: two
10
+ * of the palette's hues are indistinguishable under deuteranopia, and a
11
+ * shape is the one channel a dot has going spare.
12
+ * - `varied` — a shape per series always, in the fixed order circle, square,
13
+ * triangle, diamond, cross. Reach for it when the chart will be printed or
14
+ * read in greyscale.
15
+ * - one of the five names — every mark the same shape. On four or more series
16
+ * this is opting out of the second channel; do it only when each series
17
+ * carries a `color` of its own.
18
+ * @default 'auto'
19
+ */
20
+ shape?: MarkShape | 'varied' | 'auto';
21
+ /**
22
+ * The radius of a mark with no `z`, in pixels.
23
+ * @default the `size` ladder — 4 at `md`
24
+ */
25
+ pointRadius?: number;
26
+ /**
27
+ * The radius of the largest bubble, in pixels. Everything else is scaled
28
+ * under it by area.
29
+ * @default a twelfth of the chart's height
30
+ */
31
+ maxRadius?: number;
32
+ }
33
+ /**
34
+ * Two numbers per point, and whether they move together.
35
+ *
36
+ * Both axes measure, which is what makes this the only chart in the library
37
+ * with no categories: there is no column a mark belongs to and no order the
38
+ * points could be shuffled out of. A point with a `z` is drawn as a bubble and
39
+ * one without it as a dot, so a scatter and a bubble chart are the same
40
+ * component reading the same data — the third number is simply present or not.
41
+ *
42
+ * `x` must be a number or a `Date`. A string has no place on a number line, and
43
+ * a chart of named things against one measure is a
44
+ * [`PlBarChart`](./bar-chart).
45
+ */
46
+ export declare function PlScatterChart({ shape, pointRadius, maxRadius, series, categories, size: sizeProp, xAxis, ...props }: PlScatterChartProps): React.JSX.Element;
@@ -0,0 +1 @@
1
+ "use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{CartesianChart as t,markTransitionClasses as l}from"../../internal/chart-frame.js";import{bubbleRadius as s,dimmedByHover as i,formatCategory as o,markerRadii as c,markGap as n,markPath as u,markShapes as d,plotHeights as h,pointX as m}from"../../internal/chart.js";import{useDefaults as x}from"../../internal/defaults.js";import{cx as f,srOnlyClasses as p}from"../../internal/styles.js";export function PlScatterChart({shape:r="auto",pointRadius:l,maxRadius:i,series:o,categories:n,size:f,xAxis:p,...b}){const v=x(),y=f??v.size??"md",g=l??c[y],z=i??Math.max(g+2,("number"==typeof b.height?b.height:h[y])/12),k=o.reduce((e,r)=>r.color?e:e+1,0),j="auto"===r||"varied"===r?"circle":r,M="varied"===r||"auto"===r&&k>3,w=a.useCallback(e=>M?d[e%d.length]:j,[M,j]),N=a.useCallback(e=>{const r=[];let a=0;return e.values.forEach(e=>{e.forEach(e=>{null!==e.value&&void 0!==e.z&&Number.isFinite(e.z)&&(a=Math.max(a,e.z))})}),e.values.forEach((t,l)=>{e.visible[l]&&t.forEach((t,i)=>{if(null===t.value)return;const o=m(t,i,n);null!==o&&r.push({series:l,index:i,x:e.categoryValuePx(o),y:e.valuePx(t.value),r:void 0===t.z?g:s(t.z,a,z,2)})})}),r},[n,g,z]);return e(t,{...b,series:o,categories:n,size:y,xScale:"value",xAxis:p,marks:N,markInset:z,includeZero:!1,swatch:(r,a)=>e("svg",{viewBox:"0 0 10 10",className:"size-2.5 overflow-visible","aria-hidden":"true",children:e("path",{d:u(w(r),5,5,4),fill:a})}),table:r=>e(ScatterTable,{id:r,series:o,categories:n,label:b.label,xLabel:p?.label,yLabel:b.yAxis?.label,locale:b.locale??v.locale,format:b.format}),children:r=>e(ScatterMarks,{context:r,shapeOf:w})})}function ScatterMarks({context:r,shapeOf:t}){const{marks:s,values:o,colors:c,visible:d,hovered:h,activeMark:m}=r,x=a.useMemo(()=>[...s].sort((e,r)=>r.r-e.r),[s]);return e("g",{children:x.map(r=>{const a=o[r.series]?.[r.index],s=i(h,r.series,d),x=m?.series===r.series&&m?.index===r.index;return e("path",{d:u(t(r.series),r.x,r.y,r.r),fill:a?.color??c[r.series],stroke:"var(--plass-chart-gap)",strokeWidth:n,opacity:s?.28:1,className:l,style:{transformBox:"view-box",transformOrigin:`${r.x}px ${r.y}px`,scale:x&&r.r>0?(r.r+1)/r.r:1}},`${r.series}-${r.index}`)})})}function ScatterTable({id:t,series:l,categories:s,label:i,xLabel:c,yLabel:n,locale:u,format:d}){const h=a.useMemo(()=>new Intl.NumberFormat(u,d??{maximumFractionDigits:2}),[u,d]),m=l.some(e=>e.data.some(e=>"object"==typeof e&&null!==e&&void 0!==e.z));return r("table",{id:t,className:f(p),children:[i?e("caption",{children:i}):null,e("thead",{children:r("tr",{children:[e("th",{scope:"col"}),e("th",{scope:"col",children:c??"x"}),e("th",{scope:"col",children:n??"y"}),m?e("th",{scope:"col",children:"z"}):null]})}),e("tbody",{children:l.flatMap((a,t)=>a.data.map((l,i)=>{const c="object"==typeof l&&null!==l?l:null,n=c?c.y:"number"==typeof l?l:null,d=c?.x??s?.[i]??i;return r("tr",{children:[e("th",{scope:"row",children:a.name??t+1}),e("td",{children:o(d,u)}),e("td",{children:null!==n&&Number.isFinite(n)?h.format(n):""}),m?e("td",{children:void 0===c?.z?"":h.format(c.z)}):null]},`${t}-${i}`)}))})]})}
@@ -0,0 +1,2 @@
1
+ export { PlScatterChart } from './PlScatterChart.js';
2
+ export type { PlScatterChartProps } from './PlScatterChart.js';
@@ -0,0 +1 @@
1
+ export{PlScatterChart}from"./PlScatterChart.js";
@@ -0,0 +1,98 @@
1
+ import * as React from 'react';
2
+ import type { PlassOrientation, PlassSize } from '../../types.js';
3
+ /**
4
+ * Which axes may scroll.
5
+ *
6
+ * `PlassOrientation` plus a third value rather than the shared type widened,
7
+ * because "both" is meaningless everywhere else it is used — a `PlDivider`, a
8
+ * `PlButtonGroup` and a `PlSlider` each run one way — and widening it there to
9
+ * say it here would be a fourth value nobody can answer.
10
+ */
11
+ export type PlScrollAreaAxis = PlassOrientation | 'both';
12
+ /** Classes for the parts a `className` does not reach. */
13
+ export interface PlScrollAreaClassNames {
14
+ /** The scrolling element itself — the one that takes the focus and the keys. */
15
+ viewport?: string;
16
+ /** The lane a scrollbar runs in. */
17
+ scrollbar?: string;
18
+ /** The bar inside it. */
19
+ thumb?: string;
20
+ }
21
+ export interface PlScrollAreaProps extends React.ComponentPropsWithoutRef<'div'> {
22
+ /**
23
+ * Which axes may scroll.
24
+ * @default 'vertical'
25
+ */
26
+ orientation?: PlScrollAreaAxis;
27
+ /**
28
+ * A fixed height. A number is pixels; a string is any CSS length.
29
+ *
30
+ * **A vertical scroll area has to be bounded by something**, or there is
31
+ * nothing for the content to overflow and the box simply grows. This is that
32
+ * something, and it is a prop rather than a `className` because it is the one
33
+ * measurement without which the component does nothing at all.
34
+ */
35
+ height?: number | string;
36
+ /** The height it stops growing at, for a box that should shrink to short content. */
37
+ maxHeight?: number | string;
38
+ /** The same two for a horizontal area. */
39
+ width?: number | string;
40
+ maxWidth?: number | string;
41
+ /**
42
+ * When the scrollbars are drawn.
43
+ *
44
+ * - `auto` — while the pointer is over the box or the content is moving, and
45
+ * never otherwise. The default, and what a reader is used to on a Mac.
46
+ * - `always` — kept at full strength. For a panel whose whole point is that
47
+ * there is more below, where a bar that appears on hover is a signal
48
+ * nobody standing back from the screen ever sees.
49
+ *
50
+ * Either way the lane is **overlaid**, so turning it on does not reflow the
51
+ * content underneath.
52
+ * @default 'auto'
53
+ */
54
+ scrollbars?: 'auto' | 'always';
55
+ /**
56
+ * A name for the region.
57
+ *
58
+ * Worth giving, and the reason is not obvious: a scrollable box **is a tab
59
+ * stop** when there is nothing focusable inside it, because a keyboard reader
60
+ * has to be able to scroll it. A tab stop with no name is announced as
61
+ * nothing at all, so a name is what turns it from a mystery landing point
62
+ * into "Release notes, region".
63
+ */
64
+ label?: string;
65
+ /** Thickness of the scrollbars and the corner the box is cut to. @default 'md' */
66
+ size?: PlassSize;
67
+ /** Classes on the parts a `className` does not reach. */
68
+ classNames?: PlScrollAreaClassNames;
69
+ /** What scrolls. */
70
+ children?: React.ReactNode;
71
+ }
72
+ /**
73
+ * A bounded box that scrolls, with the library's own scrollbar in it.
74
+ *
75
+ * The reason to reach for it over `overflow: auto` is the **bar**. A platform
76
+ * scrollbar is either an overlay that vanishes the moment the content stops
77
+ * moving, or fifteen pixels of permanent grey furniture, and neither of them
78
+ * belongs beside a translucent sheet. This one is the library's own material:
79
+ * the thumb is `--plass-track`, the same neutral ink a slider's rail and a
80
+ * progress groove are cut in, and the lane is overlaid so drawing it costs the
81
+ * content no width.
82
+ *
83
+ * It is **not** a [PlScrollZone](./scroll-zone), which is the other answer to
84
+ * the same fact. A scroll zone is a strip that runs off the end of its box: it
85
+ * takes the scrollbar away entirely, fades the end that still has something
86
+ * behind it and adds a pair of buttons. That is right for a row of tabs or
87
+ * chips, where a bar under one line of labels is heavier than the labels. This
88
+ * is right for a panel of content, where the bar is the honest signal and where
89
+ * a reader wants to know **how far through** they are, which a fade cannot say.
90
+ *
91
+ * There is no fade here for that reason: two signals for one fact, one of which
92
+ * is measured and one of which is not, is one more than the box needs.
93
+ *
94
+ * Base UI owns the behaviour — the overlay measurement, the thumb's size and
95
+ * position, the drag, and making the viewport a tab stop exactly while there is
96
+ * something to scroll.
97
+ */
98
+ export declare const PlScrollArea: React.ForwardRefExoticComponent<PlScrollAreaProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1 @@
1
+ "use client";import{jsx as a,jsxs as o}from"react/jsx-runtime";import*as t from"react";import{ScrollArea as r}from"@base-ui/react/scroll-area";import{useDefaults as l}from"../../internal/defaults.js";import{cx as e,focusRingInsetClasses as i,radiusClasses as n,toLength as s}from"../../internal/styles.js";const c={xs:"w-2 data-[orientation=horizontal]:h-2 data-[orientation=horizontal]:w-auto",sm:"w-2.5 data-[orientation=horizontal]:h-2.5 data-[orientation=horizontal]:w-auto",md:"w-3 data-[orientation=horizontal]:h-3 data-[orientation=horizontal]:w-auto",lg:"w-3.5 data-[orientation=horizontal]:h-3.5 data-[orientation=horizontal]:w-auto",xl:"w-4 data-[orientation=horizontal]:h-4 data-[orientation=horizontal]:w-auto"},h="flex-1 rounded-full bg-(--plass-track) forced-colors:[background-color:CanvasText]";export const PlScrollArea=/* @__PURE__ */t.forwardRef(function PlScrollArea({orientation:t="vertical",height:d,maxHeight:m,width:u,maxWidth:w,scrollbars:f="auto",label:p,size:z,classNames:v,className:b,style:x,children:g,...y},N){const j=l(),S=z??j.size??"md",C="horizontal"!==t,T="vertical"!==t,k=e("flex touch-none select-none","p-[0.125rem]",c[S],"[transition:opacity_var(--plass-duration)_var(--plass-ease)]","always"===f?"opacity-100":"opacity-0 data-[hovering]:opacity-100 data-[scrolling]:opacity-100",v?.scrollbar);return o(r.Root,{ref:N,className:e("plass-scroll-area relative overflow-hidden",n[S],b),style:{height:s(d),maxHeight:s(m),width:s(u),maxWidth:s(w),...x},...y,children:[a(r.Viewport,{role:p?"region":void 0,"aria-label":p,className:e("size-full overscroll-contain",n[S],i,v?.viewport),style:{overflowX:T?"scroll":"hidden",overflowY:C?"scroll":"hidden"},children:a(r.Content,{children:g})}),C?a(r.Scrollbar,{orientation:"vertical",className:k,children:a(r.Thumb,{className:e(h,v?.thumb)})}):null,T?a(r.Scrollbar,{orientation:"horizontal",className:k,children:a(r.Thumb,{className:e(h,v?.thumb)})}):null,C&&T?a(r.Corner,{}):null]})});
@@ -0,0 +1,2 @@
1
+ export { PlScrollArea } from './PlScrollArea.js';
2
+ export type { PlScrollAreaAxis, PlScrollAreaClassNames, PlScrollAreaProps } from './PlScrollArea.js';
@@ -0,0 +1 @@
1
+ export{PlScrollArea}from"./PlScrollArea.js";
@@ -1,11 +1,15 @@
1
1
  import * as React from 'react';
2
- import type { PlassOrientation, PlassStyleProps } from '../../types.js';
2
+ import type { PlassOrientation, PlassOverscroll, PlassResponsive, PlassStyleProps } from '../../types.js';
3
3
  /**
4
4
  * When the scroll buttons are drawn.
5
5
  *
6
- * - `auto` — only the one that has somewhere to go, and neither of them while
7
- * everything fits. The default: a control that cannot do anything is worse
8
- * than no control, and a row that does not overflow is not a scroller.
6
+ * - `auto` — neither of them while everything fits, which is the whole of what
7
+ * it decides: a row that does not overflow is not a scroller. Once it is one,
8
+ * both lanes are drawn and the one with nowhere to go is `disabled`, exactly
9
+ * as `always` draws it. What `auto` removes is a **pair of controls on a
10
+ * strip that has nothing to scroll**, not one control on a strip that does.
11
+ * `overlay` still drops the spare button outright, because there its lane
12
+ * costs nothing to give up.
9
13
  * - `always` — both, from the first paint, with the one that has nowhere to go
10
14
  * `disabled` rather than gone. What a row whose content arrives later wants,
11
15
  * since the buttons do not appear under the pointer half a second in.
@@ -48,7 +52,7 @@ export interface PlScrollZoneProps extends PlassStyleProps, Omit<React.Component
48
52
  * Which way the children run, and therefore which way the zone scrolls.
49
53
  * @default 'horizontal'
50
54
  */
51
- orientation?: PlassOrientation;
55
+ orientation?: PlassResponsive<PlassOrientation>;
52
56
  /**
53
57
  * How many rows a horizontal zone lays its children out in before it starts a
54
58
  * new column — and how many columns a vertical one uses. `2` is the shelf
@@ -100,14 +104,27 @@ export interface PlScrollZoneProps extends PlassStyleProps, Omit<React.Component
100
104
  * reader happens to be in. The pointer being on the strip is them saying
101
105
  * which of the two things under it they meant to move.
102
106
  *
103
- * Only the vertical half of a gesture, and only while the strip has somewhere
104
- * to go. A trackpad's two fingers, a tilt wheel and Shift held down already
105
- * scroll it sideways and are left alone; and the moment it reaches an end the
106
- * wheel goes back to the page, so a reader on their way down a long page is
107
- * held up by one shelf rather than caught in it.
107
+ * Only the vertical half of a gesture: a trackpad's two fingers, a tilt wheel
108
+ * and Shift held down already scroll the strip sideways and are left alone.
109
+ * What happens once the strip has nowhere left to go is `overscroll`.
108
110
  * @default true
109
111
  */
110
112
  wheel?: boolean;
113
+ /**
114
+ * What the strip does with a gesture it has run out of room for.
115
+ *
116
+ * `contain`, the default, keeps it: the pointer being on the shelf is the
117
+ * reader saying which of the two things under it they meant to move, and a
118
+ * page that starts moving the instant the last card arrives is that answer
119
+ * being overruled halfway through a flick. `auto` is the browser's own
120
+ * chaining, held only for as long as the gesture lasts.
121
+ *
122
+ * A strip everything fits in is never a scroller and holds nothing back
123
+ * either way, and only the axis the strip runs on is contained — a shelf that
124
+ * kept the other one would be a box a finger cannot scroll the page from.
125
+ * @default 'contain'
126
+ */
127
+ overscroll?: PlassOverscroll;
111
128
  /** Shows the native scrollbar. @default false */
112
129
  scrollbar?: boolean;
113
130
  /** What the scrollable region is called — "Categories", "Recent files". */
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{useDefaults as r}from"../../internal/defaults.js";import{PlIconButton as o}from"../icon-button/PlIconButton.js";import{spacingValue as s}from"../../internal/grid.js";import{ChevronIcon as l}from"../../internal/icons.js";import{cx as i}from"../../internal/styles.js";const a={xs:"p-1",sm:"p-1.5",md:"p-2",lg:"p-3",xl:"p-4"},c={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-3",xl:"gap-4"};export const PlScrollZone=/* @__PURE__ */n.forwardRef(function PlScrollZone({orientation:u="horizontal",lines:d=1,spacing:f=2,buttons:p="auto",buttonPlacement:m="inline",mode:v="item",step:b=1,speed:w=900,snap:g=!1,drag:h=!0,wheel:y=!0,scrollbar:x=!1,variant:E="glass",size:L,color:k,density:M,label:C,previousLabel:P="Previous",nextLabel:D="Next",className:R,style:j,children:A,...B},N){const T=r(),z=L??T.size??"md",S=k??T.color??"primary",W=M??T.density??"default",Y="horizontal"===u,_=Math.max(1,Math.round(d)),H=Math.max(1,Math.round(b)),F=n.useRef(null),I=n.useRef(null),[O,X]=n.useState({back:!1,forward:!1}),$=n.useCallback(()=>{const e=F.current;if(!e)return;const t=Y?e.clientWidth:e.clientHeight,n=Y?e.scrollWidth:e.scrollHeight,r=Math.abs(Y?e.scrollLeft:e.scrollTop);X(e=>{const o=r>1,s=n-t-r>1;return e.back===o&&e.forward===s?e:{back:o,forward:s}})},[Y]);n.useEffect(()=>{const e=F.current,t=I.current;if(!e)return;if($(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver($);return n.observe(e),t&&n.observe(t),()=>n.disconnect()},[$]);const q=n.useCallback(()=>{const e=F.current;return e&&Y&&"rtl"===getComputedStyle(e).direction?-1:1},[Y]),Z=n.useCallback((e,t)=>{const n=F.current;if(!n)return;const r=t?function scrollBehavior(){return"undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}():"auto";n.scrollBy(Y?{left:e,behavior:r}:{top:e,behavior:r})},[Y]);n.useEffect(()=>{const e=F.current;if(!e||!y||!Y)return;const onWheel=t=>{if(Math.abs(t.deltaY)<=Math.abs(t.deltaX))return;const n=t.deltaMode===t.DOM_DELTA_LINE?16*t.deltaY:t.deltaMode===t.DOM_DELTA_PAGE?t.deltaY*e.clientWidth:t.deltaY,r=Math.abs(e.scrollLeft);(n>0?e.scrollWidth-e.clientWidth-r>1:r>1)&&(t.preventDefault(),Z(n*q(),!1))};return e.addEventListener("wheel",onWheel,{passive:!1}),()=>e.removeEventListener("wheel",onWheel)},[q,Y,Z,y]);const G=n.useCallback(()=>{const e=F.current,t=I.current;if(!e||!t)return[];const n=Y&&"rtl"===getComputedStyle(e).direction,r=Y?n?"right":"left":"top",o=n?-1:1,s=e.getBoundingClientRect()[r],l=[];for(const e of Array.from(t.children)){const t=Math.round((e.getBoundingClientRect()[r]-s)*o);l.includes(t)||l.push(t)}return l.sort((e,t)=>e-t)},[Y]),K=n.useCallback((e,t=v)=>{const n=F.current;if(!n)return;const r=q(),o=Y?n.clientWidth:n.clientHeight;if("page"===t)return void Z(o*(e?1:-1)*r,!0);const s=G(),l=s.filter(e=>e>1),i=s.filter(e=>e<-1),a=e?l[H-1]:i[i.length-H];Z(void 0!==a?a*r:o*(e?1:-1)*r,!0)},[q,Y,G,H,v,Z]),V=n.useRef(null);n.useEffect(()=>()=>V.current?.(),[]);const J=n.useCallback((e,t)=>{if(V.current)return;const n=q(),r=performance.now();let o=r,s=0;const tick=t=>{const r=t-o;o=t,Z(w*r/1e3*(e?1:-1)*n,!1),s=requestAnimationFrame(tick)};s=requestAnimationFrame(tick);const release=()=>{cancelAnimationFrame(s),V.current=null,window.removeEventListener(t,release),window.removeEventListener("pointercancel",release),window.removeEventListener("blur",release),performance.now()-r<140&&K(e,"item")};V.current=release,window.addEventListener(t,release),window.addEventListener("pointercancel",release),window.addEventListener("blur",release)},[K,q,Z,w]),Q=n.useRef(null);function pressHandlers(e){return"hold"!==v?{onClick:()=>K(e)}:{onPointerDown:t=>{0===t.button&&J(e,"pointerup")},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),J(e,"keyup"))}}}n.useEffect(()=>()=>Q.current?.(),[]);const U="none"!==p&&("always"===p||O.back||O.forward),ee="inline"===m;function scrollButton(t){const n=t?O.forward:O.back;if("auto"===p&&!n&&!ee)return e("span",{});const r="auto"===p&&!n,s=e(o,{variant:E,size:z,color:S,density:W,elevation:1,label:t?D:P,disabled:!n,className:"pointer-events-auto",icon:e("span",{className:i("flex items-center",Y?t?"-rotate-90 rtl:rotate-90":"rotate-90 rtl:-rotate-90":t?"":"rotate-180"),children:e(l,{})}),...pressHandlers(t)});return ee?e("span",{className:i("flex shrink-0 items-center justify-center",r?"invisible":""),inert:r,children:s}):s}return t("div",{ref:N,className:i("relative flex min-w-0",ee&&Y?"flex-row items-stretch":"flex-col",ee?c[z]:"",R),style:{"--p-ring":`var(--plass-${S}-ring)`,...j},...B,children:[U&&ee?scrollButton(!1):null,e("div",{ref:F,tabIndex:0,role:C?"group":void 0,"aria-label":C,className:i("min-h-0 min-w-0 grow",Y?"overflow-x-auto overflow-y-hidden":"overflow-y-auto overflow-x-hidden",g?Y?"snap-x snap-mandatory":"snap-y snap-mandatory":"",x?"":"[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",h&&(O.back||O.forward)?"cursor-grab data-[dragging]:cursor-grabbing":"","focus-visible:[outline:2px_solid_var(--p-ring)] focus-visible:[outline-offset:-2px]"),onScroll:$,onPointerDown:function beginDrag(e){if(!h||"touch"===e.pointerType||0!==e.button)return;Q.current?.();const t=e.currentTarget,n=e.clientX,r=e.clientY,o=t.scrollLeft,s=t.scrollTop;let l=!1;const i=document.body.style.getPropertyValue("-webkit-user-select"),move=e=>{const i=e.clientX-n,a=e.clientY-r;if(!l){if(Math.abs(Y?i:a)<4)return;l=!0,t.setPointerCapture(e.pointerId),t.dataset.dragging="true",document.body.style.setProperty("-webkit-user-select","none")}Y?t.scrollLeft=o-i:t.scrollTop=s-a},release=()=>{Q.current=null,t.removeEventListener("pointermove",move),t.removeEventListener("pointerup",end),t.removeEventListener("pointercancel",release),delete t.dataset.dragging,i?document.body.style.setProperty("-webkit-user-select",i):document.body.style.removeProperty("-webkit-user-select")},end=()=>{const e=l;if(release(),!e)return;const swallow=e=>{e.stopPropagation(),e.preventDefault()};t.addEventListener("click",swallow,{capture:!0,once:!0}),window.setTimeout(()=>t.removeEventListener("click",swallow,!0),0)};Q.current=release,t.addEventListener("pointermove",move),t.addEventListener("pointerup",end),t.addEventListener("pointercancel",release)},children:e("div",{ref:I,className:i(g?"[&>*]:snap-start":""),style:{display:"grid",gap:s(f),gridAutoFlow:Y?"column":"row",...Y?{width:"max-content",gridTemplateRows:`repeat(${_}, auto)`,gridAutoColumns:"max-content"}:{gridTemplateColumns:`repeat(${_}, minmax(0, 1fr))`,gridAutoRows:"max-content"}},children:A})}),U&&ee?scrollButton(!0):null,U&&!ee?t("div",{className:i("pointer-events-none absolute inset-0 flex justify-between",Y?"items-center":"flex-col items-center",a[z]),children:[scrollButton(!1),scrollButton(!0)]}):null]})});
1
+ "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{useDefaults as r}from"../../internal/defaults.js";import{useLabels as o}from"../../internal/labels.js";import{takeSelection as i}from"../../internal/drag.js";import{PlIconButton as s}from"../icon-button/PlIconButton.js";import{spacingValue as l}from"../../internal/grid.js";import{ChevronIcon as a}from"../../internal/icons.js";import{cx as c}from"../../internal/styles.js";import{useResponsiveValue as u}from"../../internal/responsive.js";import{overscrollClasses as d,useWheelScroll as f}from"../../internal/wheel.js";const p={xs:"p-1",sm:"p-1.5",md:"p-2",lg:"p-3",xl:"p-4"},m={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-3",xl:"gap-4"};export const PlScrollZone=/* @__PURE__ */n.forwardRef(function PlScrollZone({orientation:v,lines:g=1,spacing:w=2,buttons:b="auto",buttonPlacement:h="inline",mode:x="item",step:y=1,speed:k=900,snap:L=!1,drag:E=!0,wheel:j=!0,overscroll:C="contain",scrollbar:R=!1,variant:B="glass",size:M,color:N,density:P,label:T,previousLabel:z,nextLabel:A,className:D,style:S,children:H,...F},I){const W=u(v,"horizontal"),$=r(),q=o(),O=z??q.previous,X=A??q.next,Y=M??$.size??"md",Z=N??$.color??"primary",_=P??$.density??"default",K="horizontal"===W,G=Math.max(1,Math.round(g)),J=Math.max(1,Math.round(y)),Q=n.useRef(null),U=n.useRef(null),[V,ee]=n.useState({back:!1,forward:!1}),te=n.useCallback(()=>{const e=Q.current;if(!e)return;const t=K?e.clientWidth:e.clientHeight,n=K?e.scrollWidth:e.scrollHeight,r=Math.abs(K?e.scrollLeft:e.scrollTop);ee(e=>{const o=r>1,i=n-t-r>1;return e.back===o&&e.forward===i?e:{back:o,forward:i}})},[K]);n.useEffect(()=>{const e=Q.current,t=U.current;if(!e)return;if(te(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(te);return n.observe(e),t&&n.observe(t),()=>n.disconnect()},[te]);const ne=n.useCallback(()=>{const e=Q.current;return e&&K&&"rtl"===getComputedStyle(e).direction?-1:1},[K]),re=n.useCallback((e,t)=>{const n=Q.current;if(!n)return;const r=t?function scrollBehavior(){return"undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"instant":"smooth"}():"instant";n.scrollBy(K?{left:e,behavior:r}:{top:e,behavior:r})},[K]);f(Q,{enabled:j&&K,overscroll:C});const oe=n.useCallback(()=>{const e=Q.current,t=U.current;if(!e||!t)return[];const n=K&&"rtl"===getComputedStyle(e).direction,r=K?n?"right":"left":"top",o=n?-1:1,i=e.getBoundingClientRect()[r],s=[];for(const e of Array.from(t.children)){const t=Math.round((e.getBoundingClientRect()[r]-i)*o);s.includes(t)||s.push(t)}return s.sort((e,t)=>e-t)},[K]),ie=n.useCallback((e,t=x)=>{const n=Q.current;if(!n)return;const r=ne(),o=K?n.clientWidth:n.clientHeight;if("page"===t)return void re(o*(e?1:-1)*r,!0);const i=oe(),s=i.filter(e=>e>1),l=i.filter(e=>e<-1),a=e?s[J-1]:l[l.length-J];re(void 0!==a?a*r:o*(e?1:-1)*r,!0)},[ne,K,oe,J,x,re]),se=n.useRef(null);n.useEffect(()=>()=>se.current?.(),[]);const le=n.useCallback((e,t)=>{if(se.current)return;const n=ne(),r=performance.now();let o=r,i=0;const tick=t=>{const r=t-o;o=t,re(k*r/1e3*(e?1:-1)*n,!1),i=requestAnimationFrame(tick)};i=requestAnimationFrame(tick);const release=()=>{cancelAnimationFrame(i),se.current=null,window.removeEventListener(t,release),window.removeEventListener("pointercancel",release),window.removeEventListener("blur",release),performance.now()-r<140&&ie(e,"item")};se.current=release,window.addEventListener(t,release),window.addEventListener("pointercancel",release),window.addEventListener("blur",release)},[ie,ne,re,k]),ae=n.useRef(null);function pressHandlers(e){return"hold"!==x?{onClick:()=>ie(e)}:{onPointerDown:t=>{0===t.button&&le(e,"pointerup")},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),le(e,"keyup"))}}}n.useEffect(()=>()=>ae.current?.(),[]);const ce="none"!==b&&("always"===b||V.back||V.forward),ue="inline"===h;function scrollButton(t){const n=t?V.forward:V.back;if("auto"===b&&!n&&!ue)return e("span",{});const r=e(s,{variant:B,size:Y,color:Z,density:_,elevation:1,label:t?X:O,disabled:!n,className:"pointer-events-auto",icon:e("span",{className:c("flex items-center",K?t?"-rotate-90 rtl:rotate-90":"rotate-90 rtl:-rotate-90":t?"":"rotate-180"),children:e(a,{})}),...pressHandlers(t)});return ue?e("span",{className:"flex shrink-0 items-center justify-center",children:r}):r}return t("div",{ref:I,className:c("relative flex min-w-0",ue&&K?"flex-row items-stretch":"flex-col",ue?m[Y]:"",D),style:{"--p-ring":`var(--plass-${Z}-ring)`,...S},...F,children:[ce&&ue?scrollButton(!1):null,e("div",{ref:Q,tabIndex:V.back||V.forward?0:void 0,role:T?"group":void 0,"aria-label":T,className:c("min-h-0 min-w-0 grow",K?"overflow-x-auto overflow-y-hidden":"overflow-y-auto overflow-x-hidden",d(C,K),L?K?"snap-x snap-mandatory":"snap-y snap-mandatory":"",R?"":"[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",E&&(V.back||V.forward)?"cursor-grab data-[dragging]:cursor-grabbing":"","focus-visible:[outline:2px_solid_var(--p-ring)] focus-visible:[outline-offset:-2px]"),onScroll:te,onPointerDown:function beginDrag(e){if(!E||"touch"===e.pointerType||0!==e.button)return;ae.current?.();const t=e.currentTarget,n=e.clientX,r=e.clientY,o=t.scrollLeft,s=t.scrollTop;let l=!1,a=null;const move=e=>{if(0===e.buttons)return void end();const c=e.clientX-n,u=e.clientY-r;if(!l){if(Math.abs(K?c:u)<4)return;l=!0,t.setPointerCapture(e.pointerId),t.dataset.dragging="true",a=i()}K?t.scrollLeft=o-c:t.scrollTop=s-u},release=()=>{ae.current=null,t.removeEventListener("pointermove",move),t.removeEventListener("pointerup",end),t.removeEventListener("pointercancel",release),delete t.dataset.dragging,a?.(),a=null},end=()=>{const e=l;if(release(),!e)return;const swallow=e=>{e.stopPropagation(),e.preventDefault()};t.addEventListener("click",swallow,{capture:!0,once:!0}),window.setTimeout(()=>t.removeEventListener("click",swallow,!0),0)};ae.current=release,t.addEventListener("pointermove",move),t.addEventListener("pointerup",end),t.addEventListener("pointercancel",release)},children:e("div",{ref:U,className:c(L?"[&>*]:snap-start":""),style:{display:"grid",gap:l(w),gridAutoFlow:K?"column":"row",...K?{width:"max-content",gridTemplateRows:`repeat(${G}, auto)`,gridAutoColumns:"max-content"}:{gridTemplateColumns:`repeat(${G}, minmax(0, 1fr))`,gridAutoRows:"max-content"}},children:H})}),ce&&ue?scrollButton(!0):null,ce&&!ue?t("div",{className:c("pointer-events-none absolute inset-0 flex justify-between",K?"items-center":"flex-col items-center",p[Y]),children:[scrollButton(!1),scrollButton(!0)]}):null]})});
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as s}from"react/jsx-runtime";import*as t from"react";import{useDefaults as a}from"../../internal/defaults.js";import{Radio as r}from"@base-ui/react/radio";import{RadioGroup as l}from"@base-ui/react/radio-group";import{controlHeightClasses as n,controlSlots as o,controlTextClasses as i,focusRingInsetClasses as d,gapClasses as u,glassClasses as c,hasContent as p,iconClasses as f,paddingXClasses as h,transitionClasses as g}from"../../internal/styles.js";const m=/* @__PURE__ */t.createContext({variant:"glass",size:"md",density:"default",fullWidth:!1}),v={solid:`${c} bg-(--plass-glass-press) p-1 [box-shadow:var(--p-elev),var(--plass-well)]`,glass:`${c} border bg-(--plass-glass) p-1 [border-color:var(--plass-glass-line)] [box-shadow:var(--p-elev),var(--plass-well)]`,ghost:""},y={solid:"[background-image:var(--p-fill)] [box-shadow:var(--plass-shadow-1),var(--p-lift)]",glass:`${c} bg-(--plass-glass-press) [box-shadow:var(--plass-shadow-1),var(--plass-gloss-glass)]`,ghost:`${c} bg-(--plass-glass-press) [box-shadow:var(--plass-shadow-1),var(--plass-gloss-glass)]`},b={solid:"data-[checked]:text-(--p-on-solid)",glass:"data-[checked]:text-(--p-accent)",ghost:"data-[checked]:text-(--p-accent)"};export const PlSegment=/* @__PURE__ */t.forwardRef(function PlSegment({value:a,startIcon:l,endIcon:o,disabled:c=!1,className:v,children:y,...x},w){const{variant:k,size:j,density:P,fullWidth:R}=t.useContext(m);return s(r.Root,{ref:w,value:a,disabled:c,"data-segment":"",className:["relative z-10 inline-flex shrink-0 cursor-pointer items-center justify-center select-none","font-semibold whitespace-nowrap","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",n[j],i[j],u[j],h[P][j],"rounded-full",g,f,"text-(--plass-muted-fg) hover:text-(--plass-fg)",b[k],d,"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50","data-[readonly]:cursor-default",R?"flex-1":"",v??""].filter(Boolean).join(" "),...x,children:[p(l)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:l}):null,y,p(o)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:o}):null]})});export const PlSegmentedButton=/* @__PURE__ */t.forwardRef(function PlSegmentedButton({variant:r="glass",size:n,color:i,density:d,elevation:u=0,value:c,defaultValue:p=null,onValueChange:f,disabled:h=!1,readOnly:b=!1,name:x,fullWidth:w=!1,className:k,style:j,children:P,...R},$){const z=a(),N=n??z.size??"md",S=i??z.color??"primary",W=d??z.density??"default",[C,B]=t.useState(p),A=void 0!==c,O=A?c:C,V=t.useRef(null),E=t.useRef(null),I=t.useCallback(e=>{const s=V.current,t=E.current;if(!s||!t)return;const a=s.querySelector("[data-segment][data-checked]");if(!a)return;const r=!e||!t.hasAttribute("data-ready");r&&t.removeAttribute("data-ready"),t.style.setProperty("--p-seg-x",`${a.offsetLeft}px`),t.style.setProperty("--p-seg-y",`${a.offsetTop}px`),t.style.setProperty("--p-seg-w",`${a.offsetWidth}px`),t.style.setProperty("--p-seg-h",`${a.offsetHeight}px`),r&&t.offsetWidth,t.setAttribute("data-ready","")},[]);t.useLayoutEffect(()=>{I(!0)},[I,O,r,N,W,w,P]),t.useEffect(()=>{const e=V.current;if(!e)return;const s=new ResizeObserver(()=>I(!1));return s.observe(e),()=>s.disconnect()},[I]);const L=t.useMemo(()=>({variant:r,size:N,density:W,fullWidth:w}),[r,N,W,w]);return e(m.Provider,{value:L,children:s(l,{ref:e=>{V.current=e,"function"==typeof $?$(e):$&&($.current=e)},value:O,onValueChange:e=>{const s=e??null;A||B(s),f?.(s)},disabled:h,readOnly:b,name:x,className:["relative inline-flex items-center rounded-full",v[r],g,b?"saturate-[0.55]":"",h?"opacity-50 saturate-[0.35]":"",w?"flex w-full":"",k??""].filter(Boolean).join(" "),style:{...o(S,u,r),...j},...R,children:[null!=O?e("span",{ref:E,"aria-hidden":"true",className:["pointer-events-none absolute rounded-full","top-(--p-seg-y) left-(--p-seg-x) h-(--p-seg-h) w-(--p-seg-w)",y[r],"[transition-property:left,top,width,height]","[transition-timing-function:var(--plass-ease)]","[transition-duration:0ms] data-[ready]:[transition-duration:var(--plass-duration)]"].join(" ")}):null,P]})})});
1
+ "use client";import{jsx as e,jsxs as s}from"react/jsx-runtime";import*as t from"react";import{useDefaults as a}from"../../internal/defaults.js";import{Radio as r}from"@base-ui/react/radio";import{RadioGroup as l}from"@base-ui/react/radio-group";import{controlHeightClasses as n,controlSlots as o,controlTextClasses as i,focusRingInsetClasses as d,forcedCheckedTextClasses as u,forcedFieldEdgeClasses as c,forcedFillClasses as p,gapClasses as f,glassClasses as h,hasContent as g,iconClasses as m,paddingXClasses as v,transitionClasses as y}from"../../internal/styles.js";const b=/* @__PURE__ */t.createContext({variant:"glass",size:"md",density:"default",fullWidth:!1}),x={solid:`${h} bg-(--plass-glass-press) p-1 [box-shadow:var(--p-elev),var(--plass-well)] ${c}`,glass:`${h} border bg-(--plass-glass) p-1 [border-color:var(--plass-glass-line)] [box-shadow:var(--p-elev),var(--plass-well)]`,ghost:""},w={solid:"[background-image:var(--p-fill)] [box-shadow:var(--plass-shadow-1),var(--p-lift)]",glass:`${h} bg-(--plass-glass-press) [box-shadow:var(--plass-shadow-1),var(--plass-gloss-glass)]`,ghost:`${h} bg-(--plass-glass-press) [box-shadow:var(--plass-shadow-1),var(--plass-gloss-glass)]`},k={solid:"data-[checked]:text-(--p-on-solid)",glass:"data-[checked]:text-(--p-accent)",ghost:"data-[checked]:text-(--p-accent)"};export const PlSegment=/* @__PURE__ */t.forwardRef(function PlSegment({value:a,startIcon:l,endIcon:o,disabled:c=!1,className:p,children:h,...x},w){const{variant:j,size:P,density:$,fullWidth:R}=t.useContext(b);return s(r.Root,{ref:w,value:a,disabled:c,"data-segment":"",className:["relative z-10 inline-flex shrink-0 cursor-pointer items-center justify-center select-none","font-semibold whitespace-nowrap","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",n[P],i[P],f[P],v[$][P],"rounded-full",y,m,"text-(--plass-muted-fg) hover:text-(--plass-fg)",k[j],u,d,"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50","data-[readonly]:cursor-default",R?"flex-1":"",p??""].filter(Boolean).join(" "),...x,children:[g(l)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:l}):null,h,g(o)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:o}):null]})});export const PlSegmentedButton=/* @__PURE__ */t.forwardRef(function PlSegmentedButton({variant:r="glass",size:n,color:i,density:d,elevation:u=0,value:c,defaultValue:f=null,onValueChange:h,disabled:g=!1,readOnly:m=!1,name:v,fullWidth:k=!1,className:j,style:P,children:$,...R},z){const N=a(),S=n??N.size??"md",W=i??N.color??"primary",C=d??N.density??"default",[B,A]=t.useState(f),O=void 0!==c,V=O?c:B,E=t.useRef(null),I=t.useRef(null),L=t.useCallback(e=>{const s=E.current,t=I.current;if(!s||!t)return;const a=s.querySelector("[data-segment][data-checked]");if(!a)return;const r=!e||!t.hasAttribute("data-ready");r&&t.removeAttribute("data-ready"),t.style.setProperty("--p-seg-x",`${a.offsetLeft}px`),t.style.setProperty("--p-seg-y",`${a.offsetTop}px`),t.style.setProperty("--p-seg-w",`${a.offsetWidth}px`),t.style.setProperty("--p-seg-h",`${a.offsetHeight}px`),r&&t.offsetWidth,t.setAttribute("data-ready","")},[]);t.useLayoutEffect(()=>{L(!0)},[L,V,r,S,C,k,$]),t.useEffect(()=>{const e=E.current;if(!e)return;const s=new ResizeObserver(()=>L(!1));return s.observe(e),()=>s.disconnect()},[L]);const q=t.useMemo(()=>({variant:r,size:S,density:C,fullWidth:k}),[r,S,C,k]);return e(b.Provider,{value:q,children:s(l,{ref:e=>{E.current=e,"function"==typeof z?z(e):z&&(z.current=e)},value:V,onValueChange:e=>{const s=e??null;O||A(s),h?.(s)},disabled:g,readOnly:m,name:v,className:["relative inline-flex items-center rounded-full",x[r],y,m?"saturate-[0.55]":"",g?"opacity-50 saturate-[0.35]":"",k?"flex w-full":"",j??""].filter(Boolean).join(" "),style:{...o(W,u,r),...P},...R,children:[null!=V?e("span",{ref:I,"aria-hidden":"true",className:["pointer-events-none absolute rounded-full","top-(--p-seg-y) left-(--p-seg-x) h-(--p-seg-h) w-(--p-seg-w)",w[r],p,"[transition-property:left,top,width,height]","[transition-timing-function:var(--plass-ease)]","[transition-duration:0ms] data-[ready]:[transition-duration:var(--plass-duration)]"].join(" ")}):null,$]})})});
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{useDefaults as t}from"../../internal/defaults.js";import{Select as s}from"@base-ui/react/select";import{Field as r}from"@base-ui/react/field";import{CheckIcon as i,ChevronIcon as n}from"../../internal/icons.js";import{WidthSizer as o}from"../../internal/sizer.js";import{hotKeyHandler as c}from"../../internal/keys.js";import{controlHeightClasses as d,controlTextLeadingClasses as m,cx as p,disabledClasses as u,fieldReadOnlyClasses as f,fieldRestClasses as h,focusWithinRingClasses as g,gapClasses as x,glassClasses as v,hasContent as b,iconClasses as N,metaTextClasses as j,paddingXClasses as y,radiusClasses as w,stackGapClasses as I,surfaceSlots as S,transitionClasses as z}from"../../internal/styles.js";const P=/* @__PURE__ */["group relative flex w-full cursor-pointer items-center select-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",z,g,N].join(" "),V=/* @__PURE__ */[v,"max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain","min-w-[var(--anchor-width)] border bg-(--plass-glass-press) p-1","[border-color:var(--plass-glass-line)]","[box-shadow:var(--plass-shadow-3),var(--plass-gloss-glass)]","[outline:none]"].join(" "),k=/* @__PURE__ */["relative flex cursor-pointer items-center gap-2 select-none","rounded-(--plass-radius-xs) py-1.5 pe-2 ps-7",z,"data-[highlighted]:bg-(--p-soft-hover) data-[highlighted]:text-(--p-accent)","data-[selected]:font-semibold data-[selected]:text-(--p-accent)","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50","[outline:none]"].join(" ");export const PlSelect=/* @__PURE__ */l.forwardRef(function PlSelect({variant:g="glass",size:v,color:N,density:z,elevation:$=0,items:O,value:R,defaultValue:T,onValueChange:q,placeholder:B,label:C,description:D,error:K,invalid:M,startIcon:W,fullWidth:_=!1,disabled:E=!1,readOnly:L=!1,required:A=!1,name:F,id:G,className:H,hotKeys:J,classNames:Q,style:U,...X},Y){const Z=t(),ee=v??Z.size??"md",ae=N??Z.color??"primary",le=z??Z.density??"default",te=b(K),se=M??te,re=se?"danger":ae,ie=l.useMemo(()=>O.map(e=>({label:e.label??String(e.value),value:e.value})),[O]),ne=l.useMemo(()=>[...O.map(e=>e.label??String(e.value)),...b(B)?[B]:[]],[O,B]);return a(r.Root,{disabled:E,invalid:se,className:["flex-col align-top",I[ee],_?"flex w-full":"inline-flex",H??""].filter(Boolean).join(" "),style:{...S(re,$),...U},...X,children:[C?e(r.Label,{className:p(j[ee],"font-semibold",E?"text-(--plass-muted-fg)":"text-(--plass-fg)",Q?.label),children:C}):null,a(s.Root,{id:G,name:F,items:ie,value:R,defaultValue:T,onValueChange:e=>q?.(e),disabled:E,readOnly:L,required:A,children:[a(s.Trigger,{ref:Y,onKeyDown:c(J,void 0),className:[P,d[ee],m[ee],w[ee],x[ee],y[le][ee],E?u[g]:L?`${f[g]} cursor-default`:h[g],Q?.control].filter(Boolean).join(" "),children:[W?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--plass-muted-fg)",children:W}):null,a("span",{className:"flex min-w-0 flex-1 flex-col",children:[e(s.Value,{className:["w-full truncate text-start","data-[placeholder]:text-(--plass-muted-fg)"].join(" "),placeholder:B}),e(o,{samples:ne})]}),e(s.Icon,{className:["flex h-[1lh] shrink-0 items-center text-(--plass-muted-fg)","[transition:rotate_var(--plass-duration)_var(--plass-ease)]","data-[popup-open]:rotate-180"].join(" "),children:e(n,{})})]}),e(s.Portal,{children:e(s.Positioner,{className:"plass-portal z-(--plass-z-portal) [outline:none]",sideOffset:6,alignItemWithTrigger:!1,children:e(s.Popup,{className:`${V} ${w[ee]} ${m[ee]}`,style:S(re,3),children:O.map(l=>a(s.Item,{value:l.value,disabled:l.disabled,className:k,children:[e(s.ItemIndicator,{className:"absolute start-1.5 flex size-4 items-center justify-center",children:e(i,{})}),e(s.ItemText,{className:"truncate",children:l.label??String(l.value)})]},String(l.value)))})})})]}),D?e(r.Description,{className:p(j[ee],"text-(--plass-muted-fg)",Q?.description),children:D}):null,e(r.Error,te?{match:!0,className:p(j[ee],"text-(--p-accent)",Q?.error),children:K}:{className:p(j[ee],"text-(--p-accent)",Q?.error)})]})});
1
+ "use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{useDefaults as t}from"../../internal/defaults.js";import{Select as s}from"@base-ui/react/select";import{Field as r}from"@base-ui/react/field";import{CheckIcon as i,ChevronIcon as n}from"../../internal/icons.js";import{WidthSizer as o}from"../../internal/sizer.js";import{hotKeyHandler as c}from"../../internal/keys.js";import{controlHeightClasses as d,controlTextLeadingClasses as p,cx as m,disabledClasses as u,fieldReadOnlyClasses as f,fieldRestClasses as h,focusWithinRingClasses as g,forcedHighlightedClasses as v,gapClasses as x,glassClasses as b,hasContent as y,iconClasses as N,metaTextClasses as j,paddingXClasses as w,radiusClasses as S,stackGapClasses as I,surfaceSlots as z,transitionClasses as P}from"../../internal/styles.js";const V=/* @__PURE__ */["group relative flex w-full cursor-pointer items-center select-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",P,g,N].join(" "),k=/* @__PURE__ */[b,"max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain","min-w-[var(--anchor-width)] border bg-(--plass-glass-press) p-1","[border-color:var(--plass-glass-line)]","[box-shadow:var(--plass-shadow-3),var(--plass-gloss-glass)]","[outline:none]","[transition:opacity_var(--plass-duration)_var(--plass-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" "),O=/* @__PURE__ */["relative flex cursor-pointer items-center gap-2 select-none","rounded-(--plass-radius-xs) py-1.5 pe-2 ps-7",P,"data-[highlighted]:bg-(--p-soft-hover) data-[highlighted]:text-(--p-accent)",v,"data-[selected]:font-semibold data-[selected]:text-(--p-accent)","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50","[outline:none]"].join(" ");export const PlSelect=/* @__PURE__ */l.forwardRef(function PlSelect({variant:g="glass",size:v,color:b,density:N,elevation:P=0,items:$,value:_,defaultValue:C,onValueChange:R,placeholder:T,label:q,description:B,error:D,invalid:E,startIcon:K,fullWidth:M=!1,disabled:W=!1,readOnly:L=!1,required:A=!1,name:F,id:G,className:H,hotKeys:J,classNames:Q,style:U,...X},Y){const Z=t(),ee=v??Z.size??"md",ae=b??Z.color??"primary",le=N??Z.density??"default",te=y(D),se=E??te,re=se?"danger":ae,ie=l.useMemo(()=>$.map(e=>({label:e.label??String(e.value),value:e.value})),[$]),[ne,oe]=l.useState(!1);l.useEffect(()=>{L&&oe(!1)},[L]);const ce=l.useMemo(()=>M?[]:[...$.map(e=>e.label??String(e.value)),...y(T)?[T]:[]],[M,$,T]);return a(r.Root,{disabled:W,invalid:se,className:["flex-col align-top",I[ee],M?"flex w-full":"inline-flex",H??""].filter(Boolean).join(" "),style:{...z(re,P),...U},...X,children:[q?e(r.Label,{className:m(j[ee],"font-semibold",W?"text-(--plass-muted-fg)":"text-(--plass-fg)",Q?.label),children:q}):null,a(s.Root,{id:G,name:F,items:ie,value:_,defaultValue:C,onValueChange:e=>R?.(e),disabled:W,readOnly:L,required:A,open:ne&&!L,onOpenChange:e=>oe(e&&!L),children:[a(s.Trigger,{ref:Y,onKeyDown:c(J,void 0),className:[V,d[ee],p[ee],S[ee],x[ee],w[le][ee],W?u[g]:L?`${f[g]} cursor-default`:h[g],Q?.control].filter(Boolean).join(" "),children:[K?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--plass-muted-fg)",children:K}):null,a("span",{className:"flex min-w-0 flex-1 flex-col",children:[e(s.Value,{className:["w-full truncate text-start","data-[placeholder]:text-(--plass-muted-fg)"].join(" "),placeholder:T}),e(o,{samples:ce})]}),e(s.Icon,{className:["flex h-[1lh] shrink-0 items-center text-(--plass-muted-fg)","[transition:rotate_var(--plass-duration)_var(--plass-ease)]","data-[popup-open]:rotate-180"].join(" "),children:e(n,{})})]}),e(s.Portal,{children:e(s.Positioner,{className:"plass-portal z-(--plass-z-portal) [outline:none]",sideOffset:6,alignItemWithTrigger:!1,children:e(s.Popup,{className:`${k} ${S[ee]} ${p[ee]}`,style:z(re,3),children:$.map(l=>a(s.Item,{value:l.value,disabled:l.disabled,className:O,children:[e(s.ItemIndicator,{className:"absolute start-1.5 flex size-4 items-center justify-center",children:e(i,{})}),e(s.ItemText,{className:"truncate",children:l.label??String(l.value)})]},String(l.value)))})})})]}),B?e(r.Description,{className:m(j[ee],"text-(--plass-muted-fg)",Q?.description),children:B}):null,e(r.Error,te?{match:!0,className:m(j[ee],"text-(--p-accent)",Q?.error),children:D}:{className:m(j[ee],"text-(--p-accent)",Q?.error)})]})});
@@ -0,0 +1,76 @@
1
+ import * as React from 'react';
2
+ import { useRender } from '@base-ui/react/use-render';
3
+ import type { PlassBreakpointFloor } from '../../types.js';
4
+ export interface PlShowProps extends React.ComponentPropsWithoutRef<'div'> {
5
+ /**
6
+ * The narrowest width this is drawn at. Below it, nothing.
7
+ *
8
+ * There is no `xs`: everything is at or above the bottom rung, so `from="xs"`
9
+ * would mean "always" — which is what leaving the prop out already means.
10
+ */
11
+ from?: PlassBreakpointFloor;
12
+ /**
13
+ * The width it stops being drawn at. From that rung up, nothing.
14
+ *
15
+ * Exclusive, and it has to be: `until="md"` on one element and `from="md"` on
16
+ * another are then the two halves of one decision, with no width that draws
17
+ * both and none that draws neither.
18
+ */
19
+ until?: PlassBreakpointFloor;
20
+ /**
21
+ * Renders something other than a `<div>`: `render={<span />}`. Base UI's own
22
+ * escape hatch.
23
+ *
24
+ * A paragraph cannot hold a `<div>`, so inside a `<p>` an HTML parser closes
25
+ * the paragraph in front of it and a page rendered on a server no longer
26
+ * hydrates. A gate in a line of text wants a `<span>`, and gates the same way.
27
+ */
28
+ render?: useRender.RenderProp;
29
+ /** What is shown, at the widths it is shown at. */
30
+ children?: React.ReactNode;
31
+ }
32
+ /**
33
+ * Content at some widths and not others.
34
+ *
35
+ * ```tsx
36
+ * <PlShow from="md">
37
+ * <PlTable columns={columns} rows={rows} />
38
+ * </PlShow>
39
+ * <PlShow until="md">
40
+ * <PlList>…</PlList>
41
+ * </PlShow>
42
+ * ```
43
+ *
44
+ * **It is not a box.** While it is showing it is `display: contents`, so its
45
+ * children take part in the layout around it exactly as they would have without
46
+ * it — a gate inside a flex row does not become a flex item, and one inside a
47
+ * grid does not become a cell. Which also means a `className` carrying a margin
48
+ * or a width does nothing here: there is no box for it to land on. Put your own
49
+ * element inside.
50
+ *
51
+ * **It decides in CSS, and that is the whole point.** A media query answered in
52
+ * JavaScript is `false` on a server and on the first frame a browser renders,
53
+ * so a `useMediaQuery` and a ternary draw the wrong half of a responsive layout
54
+ * and then throw it away — a flash on every page load rather than an edge case.
55
+ * The stylesheet knows the width before React has been asked anything.
56
+ *
57
+ * What follows from that is the trade worth knowing: **both halves are in the
58
+ * document**. Hiding is `display: none`, which takes the subtree off the
59
+ * accessibility tree and out of the layout, so nothing is read twice and
60
+ * nothing is drawn — but both were rendered and both were sent. That is right
61
+ * for two arrangements of the same content and wrong for a subtree that is
62
+ * expensive to build or that must not mount at all; for those,
63
+ * `usePlBreakpointValue` picks one and only that one is mounted, at the cost of
64
+ * a server rendering the `xs` answer.
65
+ *
66
+ * **A layer that portals out is not hidden with its half.** A `PlModal`, a
67
+ * `PlDrawer` or a popover renders at the end of `<body>`, outside the box that
68
+ * `display: none` hides, so an open one in the closed half shows. Two halves
69
+ * that read the same `open` open two windows. Keep layers outside `PlShow`, or
70
+ * choose between them with `usePlBreakpointValue`.
71
+ *
72
+ * There is no `PlHide`, deliberately. `until` is the inverse of `from` and the
73
+ * two together are a band, so a second component would be a second way to spell
74
+ * the same three cases.
75
+ */
76
+ export declare const PlShow: React.ForwardRefExoticComponent<PlShowProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1 @@
1
+ import*as r from"react";import{useRender as e}from"@base-ui/react/use-render";import{cx as o}from"../../internal/styles.js";export const PlShow=/* @__PURE__ */r.forwardRef(function PlShow({from:r,until:a,render:s,className:t,children:n,...l},i){return e({render:s,ref:i,props:{className:o("plass-show",t),"data-from":r,"data-until":a,children:n,...l}})});
@@ -0,0 +1,2 @@
1
+ export { PlShow } from './PlShow.js';
2
+ export type { PlShowProps } from './PlShow.js';
@@ -0,0 +1 @@
1
+ export{PlShow}from"./PlShow.js";
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{useDefaults as n}from"../../internal/defaults.js";import{PlDrawer as o}from"../drawer/PlDrawer.js";import{drawerSide as s,expandedOnlyClasses as i,PlPageLayoutContext as l,PlassSidebarSideContext as a,useCollapsed as d}from"../../internal/page-layout.js";import{cx as c,sheetPaddingXClasses as u,sheetPaddingYClasses as p,sheetRestClasses as m,surfaceSlots as f,toLength as y,transitionClasses as b}from"../../internal/styles.js";const v={xs:"11rem",sm:"13rem",md:"16rem",lg:"18rem",xl:"21rem"},g=m;function toPixels(e,t){if(null==e)return t;if("number"==typeof e)return e;const r=/^\s*(-?[\d.]+)\s*(px|rem|em|%)\s*$/.exec(e);if(!r)return t;const n=Number(r[1]);if(Number.isNaN(n))return t;switch(r[2]){case"px":return n;case"%":return"undefined"==typeof window?t:window.innerWidth*n/100;default:return n*parseFloat(("undefined"==typeof document?"":getComputedStyle(document.documentElement).fontSize)||"16")}}export const PlSidebar=/* @__PURE__ */r.forwardRef(function PlSidebar({side:m,width:w,minWidth:h=160,maxWidth:x=480,resizable:P=!1,onResize:C,onResizeEnd:k,collapseBelow:z,open:L,defaultOpen:R=!1,onOpenChange:E,sticky:N=!0,title:S,variant:j="glass",size:B,color:D,density:O,elevation:A=0,divider:M=!0,padded:W=!0,label:I="Sidebar",closeLabel:T="Close sidebar",resizeLabel:X="Resize sidebar",className:$,style:_,children:F,...K},V){const q=n(),G=B??q.size??"md",H=D??q.color??"primary",J=O??q.density??"default",Q=r.useContext(l),U=r.useContext(a),Y=m??U??"start",Z=z??(Q.present?Q.collapseBelow:"none"),ee=d(Z),[te,re]=r.useState(R),ne=void 0!==L,oe=ne?L:Q.present?Q.open[Y]:te,se=y(w)??v[G],ie=r.useRef(null),le=r.useCallback(e=>{ie.current=e,"function"==typeof V?V(e):V&&(V.current=e)},[V]),ae=r.useRef(null);r.useEffect(()=>()=>ae.current?.(),[]);const applyWidth=e=>{const t=ie.current;if(!t)return e;const r=Math.min(toPixels(x,480),Math.max(toPixels(h,160),Math.round(e)));return t.style.setProperty("--p-sidebar-w",`${r}px`),r};return ee?e(o,{side:s(Y),mode:"overlay",open:oe,onOpenChange:e=>{ne||(Q.present?Q.setOpen(Y,e):re(e)),E?.(e)},title:S,size:G,color:H,density:J,closeLabel:T,extent:void 0===w?void 0:se,"aria-label":S?void 0:I,className:$,style:_,children:F}):t("aside",{ref:le,"aria-label":I,className:c("relative flex min-w-0 shrink-0 flex-col","w-(--p-sidebar-w)",g[j],M?c("start"===Y?"border-e":"border-s","[border-color:var(--plass-divider)]"):"","content"===Q.scroll?"h-full":N?c("self-start","sticky [top:var(--p-layout-header,0px)]","[height:calc(100dvh-var(--p-layout-header,0px)-var(--p-layout-footer,0px))]"):"",i[Z],b,$),style:{...f(H,A),"--p-sidebar-w":se,..._},...K,children:[e("div",{className:c("min-h-0 flex-1 overflow-y-auto overscroll-contain",W?c(u[J][G],p[J][G]):""),children:F}),P?e("div",{role:"separator","aria-orientation":"vertical","aria-label":X,tabIndex:0,className:c("absolute inset-y-0 z-1 w-2 cursor-col-resize","start"===Y?"end-0 -me-1":"start-0 -ms-1","bg-transparent hover:bg-(--p-soft) data-[dragging]:bg-(--p-soft)",b,"[outline:none] focus-visible:[outline:2px_solid_var(--p-ring)]","focus-visible:[outline-offset:0px]"),onPointerDown:e=>{const t=ie.current;if(!t||0!==e.button)return;const r=e.currentTarget;r.setPointerCapture(e.pointerId),r.dataset.dragging="true";const n=document.body.style.getPropertyValue("-webkit-user-select");document.body.style.setProperty("-webkit-user-select","none");const o=e.clientX,s=t.getBoundingClientRect().width,i="rtl"===getComputedStyle(t).direction,l="start"===Y===i?-1:1;let a=s;const move=e=>{a=applyWidth(s+(e.clientX-o)*l),C?.(a)},release=()=>{ae.current=null,r.removeEventListener("pointermove",move),r.removeEventListener("pointerup",end),r.removeEventListener("pointercancel",end),delete r.dataset.dragging,n?document.body.style.setProperty("-webkit-user-select",n):document.body.style.removeProperty("-webkit-user-select")},end=()=>{release(),k?.(a)};ae.current=release,r.addEventListener("pointermove",move),r.addEventListener("pointerup",end),r.addEventListener("pointercancel",end)},onKeyDown:e=>{if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();const t="rtl"===getComputedStyle(e.currentTarget).direction,r="start"===Y===t?-1:1;(e=>{const t=ie.current;if(!t)return;const r=applyWidth(t.getBoundingClientRect().width+e);C?.(r),k?.(r)})(("ArrowRight"===e.key?16:-16)*r)}}):null]})});
1
+ "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{useDefaults as n}from"../../internal/defaults.js";import{useLabels as o}from"../../internal/labels.js";import{beginPointerDrag as i}from"../../internal/drag.js";import{PlDrawer as a}from"../drawer/PlDrawer.js";import{drawerSide as s,expandedOnlyClasses as l,PlPageLayoutContext as u,PlassSidebarSideContext as d,useCollapsed as c}from"../../internal/page-layout.js";import{cx as p,sheetPaddingXClasses as m,sheetPaddingYClasses as f,sheetRestClasses as b,surfaceSlots as h,toLength as v,transitionClasses as x}from"../../internal/styles.js";const y={xs:"11rem",sm:"13rem",md:"16rem",lg:"18rem",xl:"21rem"},g=b;function toPixels(e,t){if(null==e)return t;if("number"==typeof e)return e;const r=/^\s*(-?[\d.]+)\s*(px|rem|em|%)\s*$/.exec(e);if(!r)return t;const n=Number(r[1]);if(Number.isNaN(n))return t;switch(r[2]){case"px":return n;case"%":return"undefined"==typeof window?t:window.innerWidth*n/100;default:return n*parseFloat(("undefined"==typeof document?"":getComputedStyle(document.documentElement).fontSize)||"16")}}export const PlSidebar=/* @__PURE__ */r.forwardRef(function PlSidebar({side:b,width:w,minWidth:z=160,maxWidth:C=480,resizable:R=!1,onResize:j,onResizeEnd:N,collapseBelow:P,open:S,defaultOpen:k=!1,onOpenChange:M,sticky:A=!0,title:B,variant:D="glass",size:E,color:L,density:O,elevation:I=0,divider:W=!0,padded:T=!0,label:X,closeLabel:$,resizeLabel:_,className:F,style:K,children:q,...G},H){const J=n(),Q=o(),U=X??Q.sidebar,V=$??Q.sidebarClose,Y=_??Q.sidebarResize,Z=E??J.size??"md",ee=L??J.color??"primary",te=O??J.density??"default",re=r.useContext(u),ne=r.useContext(d),oe=b??ne??"start",ie=P??(re.present?re.collapseBelow:"none"),ae=c(ie),[se,le]=r.useState(k),ue=void 0!==S,de=ue?S:re.present?re.open[oe]:se,ce=v(w)??y[Z],pe=r.useRef(null),me=r.useCallback(e=>{pe.current=e,"function"==typeof H?H(e):H&&(H.current=e)},[H]),fe=r.useRef(null);r.useEffect(()=>()=>fe.current?.(),[]);const be=r.useRef(null),he=toPixels(z,160),ve=toPixels(C,480),xe=Math.min(ve,Math.max(he,Math.round(toPixels(ce,he)))),applyWidth=e=>{const t=pe.current;if(!t)return e;const r=Math.min(ve,Math.max(he,Math.round(e)));return t.style.setProperty("--p-sidebar-w",`${r}px`),be.current?.setAttribute("aria-valuenow",String(r)),r};return ae?e(a,{side:s(oe,J.direction),mode:"overlay",open:de,onOpenChange:e=>{ue||(re.present?re.setOpen(oe,e):le(e)),M?.(e)},title:B,size:Z,color:ee,density:te,closeLabel:V,extent:void 0===w?void 0:ce,"aria-label":B?void 0:U,className:F,style:K,children:q}):t("aside",{ref:me,"aria-label":U,className:p("relative flex min-w-0 shrink-0 flex-col","w-(--p-sidebar-w)",g[D],W?p("start"===oe?"border-e":"border-s","[border-color:var(--plass-divider)]"):"","content"===re.scroll?"h-full":A?p("self-start","sticky [top:var(--p-layout-header,0px)]","[height:calc(100dvh-var(--p-layout-header,0px)-var(--p-layout-footer,0px))]"):"",l[ie],x,F),style:{...h(ee,I),"--p-sidebar-w":ce,...K},...G,children:[e("div",{className:p("min-h-0 flex-1 overflow-y-auto overscroll-contain",T?p(m[te][Z],f[te][Z]):""),children:q}),R?e("div",{ref:be,role:"separator","aria-orientation":"vertical","aria-label":Y,"aria-valuenow":xe,"aria-valuemin":he,"aria-valuemax":ve,tabIndex:0,className:p("absolute inset-y-0 z-1 w-2 cursor-col-resize touch-none","start"===oe?"end-0 -me-1":"start-0 -ms-1","bg-transparent hover:bg-(--p-soft) data-[dragging]:bg-(--p-soft)",x,"[outline:none] focus-visible:[outline:2px_solid_var(--p-ring)]","focus-visible:[outline-offset:0px]"),onPointerDown:e=>{const t=pe.current;if(!t||0!==e.button)return;const r=e.clientX,n=t.getBoundingClientRect().width,o="rtl"===getComputedStyle(t).direction,a="start"===oe===o?-1:1;let s=n;fe.current=i({target:e.currentTarget,pointerId:e.pointerId,onMove:e=>{s=applyWidth(n+(e.clientX-r)*a),j?.(s)},onEnd:()=>{fe.current=null,N?.(s)}})},onKeyDown:e=>{if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();const t="rtl"===getComputedStyle(e.currentTarget).direction,r="start"===oe===t?-1:1;(e=>{const t=pe.current;if(!t)return;const r=applyWidth(t.getBoundingClientRect().width+e);j?.(r),N?.(r)})(("ArrowRight"===e.key?16:-16)*r)}}):null]})});
@@ -1 +1 @@
1
- "use client";import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{PlIconButton as n}from"../icon-button/PlIconButton.js";import{collapsedOnlyClasses as o,PlPageLayoutContext as t}from"../../internal/page-layout.js";import{cx as i}from"../../internal/styles.js";function MenuIcon(){return e("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e("path",{d:"M4 7h16M4 12h16M4 17h16",strokeLinecap:"round"})})}export const PlSidebarTrigger=/* @__PURE__ */r.forwardRef(function PlSidebarTrigger({side:a="start",collapseBelow:s,icon:l,label:c,variant:u="ghost",className:p,onClick:d,...m},f){const h=r.useContext(t);if(!h.present)return null;const b=s??h.collapseBelow,g=h.open[a];return e(n,{ref:f,variant:u,icon:l??e(MenuIcon,{}),label:c??(g?"Close sidebar":"Open sidebar"),"aria-expanded":g,className:i(o[b],p),onClick:e=>{h.setOpen(a,!g),d?.(e)},...m})});
1
+ "use client";import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{PlIconButton as n}from"../icon-button/PlIconButton.js";import{useLabels as o}from"../../internal/labels.js";import{collapsedOnlyClasses as t,PlPageLayoutContext as i}from"../../internal/page-layout.js";import{cx as a}from"../../internal/styles.js";function MenuIcon(){return e("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e("path",{d:"M4 7h16M4 12h16M4 17h16",strokeLinecap:"round"})})}export const PlSidebarTrigger=/* @__PURE__ */r.forwardRef(function PlSidebarTrigger({side:s="start",collapseBelow:l,icon:c,label:p,variant:u="ghost",className:m,onClick:d,...f},b){const h=r.useContext(i),g=o();if(!h.present)return null;const j=l??h.collapseBelow,x=h.open[s];return e(n,{ref:b,variant:u,icon:c??e(MenuIcon,{}),label:p??(x?g.sidebarClose:g.sidebarOpen),"aria-expanded":x,className:a(t[j],m),onClick:e=>{h.setOpen(s,!x),d?.(e)},...f})});
@@ -1 +1 @@
1
- "use client";import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{useDefaults as l}from"../../internal/defaults.js";import{useRender as s}from"@base-ui/react/use-render";import{controlHeightClasses as o,controlSquareClasses as d,surfaceSlots as n}from"../../internal/styles.js";const a={xs:"h-[0.6875rem]",sm:"h-[0.75rem]",md:"h-[0.8125rem]",lg:"h-[0.9375rem]",xl:"h-[1.0625rem]"},m={xs:"gap-[0.3125rem]",sm:"gap-[0.375rem]",md:"gap-[0.5625rem]",lg:"gap-[0.5625rem]",xl:"gap-[0.6875rem]"},i={xs:"rounded-[0.3125rem]",sm:"rounded-[0.3125rem]",md:"rounded-[0.375rem]",lg:"rounded-[0.4375rem]",xl:"rounded-[0.5rem]"},t={xs:"h-12",sm:"h-16",md:"h-20",lg:"h-28",xl:"h-36"},u={xs:"rounded-(--plass-radius-xs)",sm:"rounded-(--plass-radius-sm)",md:"rounded-(--plass-radius-md)",lg:"rounded-(--plass-radius-lg)",xl:"rounded-(--plass-radius-xl)"},h="relative overflow-hidden bg-(--p-soft-hover)";function length(e){if(void 0!==e)return"number"==typeof e?`${e}px`:e}export const PlSkeleton=/* @__PURE__ */r.forwardRef(function PlSkeleton({shape:r="line",lines:f=1,size:p,color:c,width:g,height:x,animated:w=!0,label:y,render:$,className:b,style:j,...v},k){const N=l(),z=p??N.size??"md",B=c??N.color??"secondary",P=w?"plass-skeleton":"",S="circle"===r?`shrink-0 rounded-full ${o[z]} ${d[z]}`:"rect"===r?`w-full ${u[z]} ${void 0===x?t[z]:""}`:`w-full ${i[z]} ${a[z]}`,A=y?{role:"status","aria-busy":!0,"aria-label":y}:{"aria-hidden":!0},R="line"===r&&f>1;return s({render:$,ref:k,props:{className:(R?["flex w-full flex-col",m[z],b??""]:[h,P,S,b??""]).filter(Boolean).join(" "),style:{...n(B,0),width:length(g),height:length(x),...j},...A,...R?{children:Array.from({length:f},(r,l)=>e("div",{className:[h,P,i[z],a[z],l===f-1?"w-3/5":"w-full"].filter(Boolean).join(" ")},l))}:null,...v}})});
1
+ "use client";import{jsx as e,Fragment as r,jsxs as l}from"react/jsx-runtime";import*as s from"react";import{useDefaults as n}from"../../internal/defaults.js";import{useRender as d}from"@base-ui/react/use-render";import{controlHeightClasses as o,controlSquareClasses as a,srOnlyClasses as m,surfaceSlots as t}from"../../internal/styles.js";const i={xs:"h-[0.6875rem]",sm:"h-[0.75rem]",md:"h-[0.8125rem]",lg:"h-[0.9375rem]",xl:"h-[1.0625rem]"},u={xs:"gap-[0.3125rem]",sm:"gap-[0.375rem]",md:"gap-[0.5625rem]",lg:"gap-[0.5625rem]",xl:"gap-[0.6875rem]"},h={xs:"rounded-[0.3125rem]",sm:"rounded-[0.3125rem]",md:"rounded-[0.375rem]",lg:"rounded-[0.4375rem]",xl:"rounded-[0.5rem]"},f={xs:"h-12",sm:"h-16",md:"h-20",lg:"h-28",xl:"h-36"},p={xs:"rounded-(--plass-radius-xs)",sm:"rounded-(--plass-radius-sm)",md:"rounded-(--plass-radius-md)",lg:"rounded-(--plass-radius-lg)",xl:"rounded-(--plass-radius-xl)"},c="relative overflow-hidden bg-(--p-soft-hover)";function length(e){if(void 0!==e)return"number"==typeof e?`${e}px`:e}export const PlSkeleton=/* @__PURE__ */s.forwardRef(function PlSkeleton({shape:s="line",lines:g=1,size:x,color:w,width:j,height:$,animated:v=!0,label:y,render:b,className:k,style:N,...z},B){const P=n(),S=x??P.size??"md",A=w??P.color??"secondary",F=v?"plass-skeleton":"",R="circle"===s?`shrink-0 rounded-full ${o[S]} ${a[S]}`:"rect"===s?`w-full ${p[S]} ${void 0===$?f[S]:""}`:`w-full ${h[S]} ${i[S]}`,q=y?{role:"status"}:{"aria-hidden":!0},C=y?e("span",{className:m,children:y}):null,D="line"===s&&g>1;return d({render:b,ref:B,props:{className:(D?["flex w-full flex-col",u[S],k??""]:[c,F,R,k??""]).filter(Boolean).join(" "),style:{...t(A,0),width:length(j),height:length($),...N},...q,...D||C?{children:l(r,{children:[D?Array.from({length:g},(r,l)=>e("div",{className:[c,F,h[S],i[S],l===g-1?"w-3/5":"w-full"].filter(Boolean).join(" ")},l)):null,C]})}:null,...z}})});
@@ -21,8 +21,20 @@ export interface PlSliderProps extends BaseSliderProps {
21
21
  orientation?: PlassOrientation;
22
22
  /** The label above the track. */
23
23
  label?: React.ReactNode;
24
- /** Helper text below the track. */
24
+ /** Helper text below the track. Each thumb is described by it. */
25
25
  description?: React.ReactNode;
26
+ /**
27
+ * The name of the thumb at `index`, for a range whose two ends need names of
28
+ * their own, such as "Minimum price" and "Maximum price". Left out, every
29
+ * thumb is named by `label`.
30
+ */
31
+ getAriaLabel?: (index: number) => string;
32
+ /**
33
+ * What a screen reader says for the value of the thumb at `index`, given the
34
+ * value formatted for the locale and the raw number. Left out, it is the
35
+ * formatted number.
36
+ */
37
+ getAriaValueText?: (formattedValue: string, value: number, index: number) => string;
26
38
  /**
27
39
  * Shows the current value beside the label. Pass a function to format it —
28
40
  * the raw numbers and Base UI's already-localised strings are both handed in.
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as s from"react";import{useDefaults as r}from"../../internal/defaults.js";import{Slider as a}from"@base-ui/react/slider";import{controlSlots as o,focusRingClasses as t,metaTextClasses as i,transitionClasses as n}from"../../internal/styles.js";const c={xs:"h-1",sm:"h-1.5",md:"h-1.5",lg:"h-2",xl:"h-2.5"},d={xs:"w-1",sm:"w-1.5",md:"w-1.5",lg:"w-2",xl:"w-2.5"},m={xs:"size-3",sm:"size-3.5",md:"size-4.5",lg:"size-5",xl:"size-6"},f={xs:"h-4",sm:"h-4.5",md:"h-5",lg:"h-6",xl:"h-7"},u={xs:"w-4",sm:"w-4.5",md:"w-5",lg:"w-6",xl:"w-7"},h="rounded-full bg-(--plass-track)",p=`rounded-full [background-image:var(--p-fill)] ${n}`,x=/* @__PURE__ */["rounded-full border-2 [background-image:var(--p-fill)]","[border-color:var(--plass-surface)]","[box-shadow:var(--p-elev),var(--p-lift)]","cursor-grab select-none active:cursor-grabbing",n,"hover:[box-shadow:var(--p-elev-hover),var(--p-lift-hover),0_0_0_4px_var(--p-soft)]",t,"data-[dragging]:[box-shadow:var(--p-elev-press),var(--p-lift-press),0_0_0_6px_var(--p-soft-hover)]"].join(" ");export const PlSlider=/* @__PURE__ */s.forwardRef(function PlSlider({size:s,color:t,elevation:n=1,orientation:g="horizontal",label:v,description:w,showValue:b=!1,disabled:j=!1,className:y,style:N,...$},_){const z=r(),k=s??z.size??"md",A=t??z.color??"primary",S="vertical"===g,V=$.value??$.defaultValue,P=Array.isArray(V)?V.length:1;return l(a.Root,{ref:_,orientation:g,disabled:j,className:["flex",S?"w-fit flex-col items-center gap-2":"w-full flex-col gap-1.5",j?"opacity-50 saturate-[0.35] [&_*]:cursor-not-allowed":"",y??""].filter(Boolean).join(" "),style:{...o(A,n,"solid"),...N},...$,children:[v||b?l("div",{className:`flex w-full items-baseline gap-2 ${i[k]}`,children:[v?e(a.Label,{className:"font-semibold text-(--plass-fg)",children:v}):null,b?e(a.Value,{className:"ms-auto tabular-nums text-(--plass-muted-fg)",children:"function"==typeof b?b:null}):null]}):null,e(a.Control,{className:["flex touch-none items-center justify-center select-none",S?`${u[k]} h-40 flex-col`:`w-full ${f[k]}`].join(" "),children:l(a.Track,{className:[h,S?`${d[k]} h-full`:`${c[k]} w-full`].join(" "),children:[e(a.Indicator,{className:p}),Array.from({length:P},(l,s)=>e(a.Thumb,{index:s,className:`${x} ${m[k]}`},s))]})}),w?e("div",{className:`${i[k]} text-(--plass-muted-fg)`,children:w}):null]})});
1
+ "use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{useDefaults as l}from"../../internal/defaults.js";import{Slider as o}from"@base-ui/react/slider";import{controlSlots as s,focusRingClasses as t,forcedFieldEdgeClasses as i,forcedFillClasses as n,metaTextClasses as d}from"../../internal/styles.js";const c={xs:"h-1",sm:"h-1.5",md:"h-1.5",lg:"h-2",xl:"h-2.5"},u={xs:"w-1",sm:"w-1.5",md:"w-1.5",lg:"w-2",xl:"w-2.5"},m={xs:"size-3",sm:"size-3.5",md:"size-4.5",lg:"size-5",xl:"size-6"},f={xs:"h-4",sm:"h-4.5",md:"h-5",lg:"h-6",xl:"h-7"},p={xs:"w-4",sm:"w-4.5",md:"w-5",lg:"w-6",xl:"w-7"},g=`rounded-full bg-(--plass-track) ${i}`,h=/* @__PURE__ */["[transition-duration:var(--plass-duration)]","[transition-timing-function:var(--plass-ease)]","data-[dragging]:[transition-duration:0ms]","motion-reduce:[transition-duration:0ms]"].join(" "),x=/* @__PURE__ */["rounded-full [background-image:var(--p-fill)]",n,"forced-colors:data-[disabled]:[background-color:GrayText]","[transition-property:width,height,inset-inline-start,bottom,filter,opacity]",h].join(" "),b=/* @__PURE__ */["rounded-full border-2 [background-image:var(--p-fill)]","[border-color:var(--plass-surface)]","forced-colors:[background-color:CanvasText] forced-colors:[border-color:Canvas]","forced-colors:data-[disabled]:[background-color:GrayText]","[box-shadow:var(--p-elev),var(--p-lift)]","cursor-grab select-none active:cursor-grabbing","[transition-property:box-shadow,inset-inline-start,bottom,filter,opacity]",h,"hover:[box-shadow:var(--p-elev-hover),var(--p-lift-hover),0_0_0_4px_var(--p-soft)]",t,"data-[dragging]:[box-shadow:var(--p-elev-press),var(--p-lift-press),0_0_0_6px_var(--p-soft-hover)]"].join(" ");export const PlSlider=/* @__PURE__ */r.forwardRef(function PlSlider({size:t,color:i,elevation:n=1,orientation:h="horizontal",label:v,description:w,getAriaLabel:y,getAriaValueText:j,showValue:N=!1,disabled:$=!1,className:_,style:z,...k},A){const T=r.useId(),V=l(),C=t??V.size??"md",L=i??V.color??"primary",S="vertical"===h,G=k.value??k.defaultValue,I=Array.isArray(G)?G.length:1;return a(o.Root,{ref:A,orientation:h,disabled:$,className:["flex",S?"w-fit flex-col items-center gap-2":"w-full flex-col gap-1.5",$?"opacity-50 saturate-[0.35] [&_*]:cursor-not-allowed":"",_??""].filter(Boolean).join(" "),style:{...s(L,n,"solid"),...z},...k,children:[v||N?a("div",{className:`flex w-full items-baseline gap-2 ${d[C]}`,children:[v?e(o.Label,{className:"font-semibold text-(--plass-fg)",children:v}):null,N?e(o.Value,{className:"ms-auto tabular-nums text-(--plass-muted-fg)",children:"function"==typeof N?N:null}):null]}):null,e(o.Control,{className:["flex touch-none items-center justify-center select-none",S?`${p[C]} h-40 flex-col`:`w-full ${f[C]}`].join(" "),children:a(o.Track,{className:[g,S?`${u[C]} h-full`:`${c[C]} w-full`].join(" "),children:[e(o.Indicator,{className:x}),Array.from({length:I},(a,r)=>e(o.Thumb,{index:r,getAriaLabel:y,getAriaValueText:j,"aria-describedby":w?T:void 0,className:`${b} ${m[C]}`},r))]})}),w?e("div",{id:T,className:`${d[C]} text-(--plass-muted-fg)`,children:w}):null]})});