plass-ui 1.3.0 → 1.4.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 (340) hide show
  1. package/CHANGELOG.md +590 -0
  2. package/README.md +1 -1
  3. package/dist/components/alert/PlAlert.js +1 -1
  4. package/dist/components/anchor/PlAnchor.d.ts +72 -0
  5. package/dist/components/anchor/PlAnchor.js +1 -0
  6. package/dist/components/anchor/index.d.ts +2 -0
  7. package/dist/components/anchor/index.js +1 -0
  8. package/dist/components/animate-appear/PlAnimateAppear.d.ts +10 -0
  9. package/dist/components/animate-appear/PlAnimateAppear.js +1 -1
  10. package/dist/components/animate-blink/PlAnimateBlink.d.ts +2 -2
  11. package/dist/components/animate-blink/PlAnimateBlink.js +1 -1
  12. package/dist/components/animate-counter/PlAnimateCounter.d.ts +83 -0
  13. package/dist/components/animate-counter/PlAnimateCounter.js +1 -0
  14. package/dist/components/animate-counter/index.d.ts +2 -0
  15. package/dist/components/animate-counter/index.js +1 -0
  16. package/dist/components/animate-fade/PlAnimateFade.d.ts +2 -2
  17. package/dist/components/animate-fade/PlAnimateFade.js +1 -1
  18. package/dist/components/animate-float/PlAnimateFloat.d.ts +51 -0
  19. package/dist/components/animate-float/PlAnimateFloat.js +1 -0
  20. package/dist/components/animate-float/index.d.ts +2 -0
  21. package/dist/components/animate-float/index.js +1 -0
  22. package/dist/components/animate-grow/PlAnimateGrow.d.ts +2 -2
  23. package/dist/components/animate-grow/PlAnimateGrow.js +1 -1
  24. package/dist/components/animate-reveal/PlAnimateReveal.d.ts +51 -0
  25. package/dist/components/animate-reveal/PlAnimateReveal.js +1 -0
  26. package/dist/components/animate-reveal/index.d.ts +2 -0
  27. package/dist/components/animate-reveal/index.js +1 -0
  28. package/dist/components/animate-rotate/PlAnimateRotate.d.ts +2 -2
  29. package/dist/components/animate-rotate/PlAnimateRotate.js +1 -1
  30. package/dist/components/animate-scramble/PlAnimateScramble.d.ts +75 -0
  31. package/dist/components/animate-scramble/PlAnimateScramble.js +1 -0
  32. package/dist/components/animate-scramble/index.d.ts +2 -0
  33. package/dist/components/animate-scramble/index.js +1 -0
  34. package/dist/components/animate-shake/PlAnimateShake.d.ts +57 -0
  35. package/dist/components/animate-shake/PlAnimateShake.js +1 -0
  36. package/dist/components/animate-shake/index.d.ts +2 -0
  37. package/dist/components/animate-shake/index.js +1 -0
  38. package/dist/components/animate-slide/PlAnimateSlide.d.ts +2 -2
  39. package/dist/components/animate-slide/PlAnimateSlide.js +1 -1
  40. package/dist/components/animate-split/PlAnimateSplit.d.ts +54 -0
  41. package/dist/components/animate-split/PlAnimateSplit.js +1 -0
  42. package/dist/components/animate-split/index.d.ts +2 -0
  43. package/dist/components/animate-split/index.js +1 -0
  44. package/dist/components/animate-zoom/PlAnimateZoom.d.ts +2 -2
  45. package/dist/components/animate-zoom/PlAnimateZoom.js +1 -1
  46. package/dist/components/app-logo/PlAppLogo.d.ts +78 -0
  47. package/dist/components/app-logo/PlAppLogo.js +1 -0
  48. package/dist/components/app-logo/index.d.ts +2 -0
  49. package/dist/components/app-logo/index.js +1 -0
  50. package/dist/components/area-chart/PlAreaChart.d.ts +54 -0
  51. package/dist/components/area-chart/PlAreaChart.js +1 -0
  52. package/dist/components/area-chart/index.d.ts +2 -0
  53. package/dist/components/area-chart/index.js +1 -0
  54. package/dist/components/avatar/PlAvatar.js +1 -1
  55. package/dist/components/back-top/PlBackTop.js +1 -1
  56. package/dist/components/bar-chart/PlBarChart.d.ts +63 -0
  57. package/dist/components/bar-chart/PlBarChart.js +1 -0
  58. package/dist/components/bar-chart/index.d.ts +2 -0
  59. package/dist/components/bar-chart/index.js +1 -0
  60. package/dist/components/breadcrumb/PlBreadcrumb.js +1 -1
  61. package/dist/components/button-group/PlButtonGroup.js +1 -1
  62. package/dist/components/carousel/PlCarousel.js +1 -1
  63. package/dist/components/chat-bubble/PlChatBubble.js +1 -1
  64. package/dist/components/checkbox/PlCheckbox.js +1 -1
  65. package/dist/components/chip/PlChip.js +1 -1
  66. package/dist/components/code-block/PlCodeBlock.d.ts +175 -0
  67. package/dist/components/code-block/PlCodeBlock.js +1 -0
  68. package/dist/components/code-block/index.d.ts +2 -0
  69. package/dist/components/code-block/index.js +1 -0
  70. package/dist/components/combobox/PlCombobox.d.ts +1 -1
  71. package/dist/components/combobox/PlCombobox.js +1 -1
  72. package/dist/components/command-palette/PlCommandPalette.d.ts +1 -1
  73. package/dist/components/command-palette/PlCommandPalette.js +1 -1
  74. package/dist/components/container/PlContainer.d.ts +22 -6
  75. package/dist/components/container/PlContainer.js +1 -1
  76. package/dist/components/data-list/PlDataList.d.ts +74 -0
  77. package/dist/components/data-list/PlDataList.js +1 -0
  78. package/dist/components/data-list/index.d.ts +2 -0
  79. package/dist/components/data-list/index.js +1 -0
  80. package/dist/components/data-table/PlDataTable.d.ts +202 -0
  81. package/dist/components/data-table/PlDataTable.js +1 -0
  82. package/dist/components/data-table/index.d.ts +2 -0
  83. package/dist/components/data-table/index.js +1 -0
  84. package/dist/components/drawer/PlDrawer.d.ts +1 -1
  85. package/dist/components/drawer/PlDrawer.js +1 -1
  86. package/dist/components/flex/PlFlex.d.ts +83 -0
  87. package/dist/components/flex/PlFlex.js +1 -0
  88. package/dist/components/flex/index.d.ts +2 -0
  89. package/dist/components/flex/index.js +1 -0
  90. package/dist/components/floating-action-button/PlFloatingActionButton.d.ts +81 -0
  91. package/dist/components/floating-action-button/PlFloatingActionButton.js +1 -0
  92. package/dist/components/floating-action-button/index.d.ts +2 -0
  93. package/dist/components/floating-action-button/index.js +1 -0
  94. package/dist/components/footer/PlFooter.d.ts +4 -3
  95. package/dist/components/footer/PlFooter.js +1 -1
  96. package/dist/components/gallery/PlGallery.d.ts +154 -0
  97. package/dist/components/gallery/PlGallery.js +1 -0
  98. package/dist/components/gallery/PlGalleryViewer.d.ts +31 -0
  99. package/dist/components/gallery/PlGalleryViewer.js +1 -0
  100. package/dist/components/gallery/index.d.ts +2 -0
  101. package/dist/components/gallery/index.js +1 -0
  102. package/dist/components/gauge-chart/PlGaugeChart.d.ts +64 -0
  103. package/dist/components/gauge-chart/PlGaugeChart.js +1 -0
  104. package/dist/components/gauge-chart/index.d.ts +2 -0
  105. package/dist/components/gauge-chart/index.js +1 -0
  106. package/dist/components/grid/PlGrid.js +1 -1
  107. package/dist/components/grid/PlGridItem.js +1 -1
  108. package/dist/components/header/PlHeader.d.ts +4 -3
  109. package/dist/components/header/PlHeader.js +1 -1
  110. package/dist/components/heatmap-chart/PlHeatmapChart.d.ts +69 -0
  111. package/dist/components/heatmap-chart/PlHeatmapChart.js +1 -0
  112. package/dist/components/heatmap-chart/index.d.ts +2 -0
  113. package/dist/components/heatmap-chart/index.js +1 -0
  114. package/dist/components/hover-card/PlHoverCard.d.ts +94 -0
  115. package/dist/components/hover-card/PlHoverCard.js +1 -0
  116. package/dist/components/hover-card/index.d.ts +2 -0
  117. package/dist/components/hover-card/index.js +1 -0
  118. package/dist/components/how-to-steps/PlHowToSteps.d.ts +87 -0
  119. package/dist/components/how-to-steps/PlHowToSteps.js +1 -0
  120. package/dist/components/how-to-steps/index.d.ts +2 -0
  121. package/dist/components/how-to-steps/index.js +1 -0
  122. package/dist/components/image/PlImage.js +1 -1
  123. package/dist/components/line-chart/PlLineChart.d.ts +74 -0
  124. package/dist/components/line-chart/PlLineChart.js +1 -0
  125. package/dist/components/line-chart/index.d.ts +2 -0
  126. package/dist/components/line-chart/index.js +1 -0
  127. package/dist/components/meter/PlMeter.d.ts +83 -0
  128. package/dist/components/meter/PlMeter.js +1 -0
  129. package/dist/components/meter/index.d.ts +2 -0
  130. package/dist/components/meter/index.js +1 -0
  131. package/dist/components/mockup/PlMockup.d.ts +146 -0
  132. package/dist/components/mockup/PlMockup.js +1 -0
  133. package/dist/components/mockup/index.d.ts +2 -0
  134. package/dist/components/mockup/index.js +1 -0
  135. package/dist/components/modal/PlModal.d.ts +1 -1
  136. package/dist/components/modal/PlModal.js +1 -1
  137. package/dist/components/number-field/PlNumberField.d.ts +1 -1
  138. package/dist/components/number-field/PlNumberField.js +1 -1
  139. package/dist/components/overlay/PlOverlay.d.ts +1 -1
  140. package/dist/components/overlay/PlOverlay.js +1 -1
  141. package/dist/components/page-layout/PlPageLayout.js +1 -1
  142. package/dist/components/pagination/PlPagination.js +1 -1
  143. package/dist/components/panes/PlPanes.d.ts +2 -2
  144. package/dist/components/panes/PlPanes.js +1 -1
  145. package/dist/components/pie-chart/PlPieChart.d.ts +58 -0
  146. package/dist/components/pie-chart/PlPieChart.js +1 -0
  147. package/dist/components/pie-chart/index.d.ts +2 -0
  148. package/dist/components/pie-chart/index.js +1 -0
  149. package/dist/components/popconfirm/PlPopconfirm.d.ts +1 -1
  150. package/dist/components/popconfirm/PlPopconfirm.js +1 -1
  151. package/dist/components/popover/PlPopover.d.ts +1 -1
  152. package/dist/components/popover/PlPopover.js +1 -1
  153. package/dist/components/portal/PlPortal.d.ts +78 -0
  154. package/dist/components/portal/PlPortal.js +1 -0
  155. package/dist/components/portal/index.d.ts +2 -0
  156. package/dist/components/portal/index.js +1 -0
  157. package/dist/components/radio-group/PlRadioGroup.js +1 -1
  158. package/dist/components/rating/PlRating.js +1 -1
  159. package/dist/components/scatter-chart/PlScatterChart.d.ts +46 -0
  160. package/dist/components/scatter-chart/PlScatterChart.js +1 -0
  161. package/dist/components/scatter-chart/index.d.ts +2 -0
  162. package/dist/components/scatter-chart/index.js +1 -0
  163. package/dist/components/scroll-area/PlScrollArea.d.ts +98 -0
  164. package/dist/components/scroll-area/PlScrollArea.js +1 -0
  165. package/dist/components/scroll-area/index.d.ts +2 -0
  166. package/dist/components/scroll-area/index.js +1 -0
  167. package/dist/components/scroll-zone/PlScrollZone.d.ts +9 -5
  168. package/dist/components/scroll-zone/PlScrollZone.js +1 -1
  169. package/dist/components/select/PlSelect.js +1 -1
  170. package/dist/components/show/PlShow.d.ts +60 -0
  171. package/dist/components/show/PlShow.js +1 -0
  172. package/dist/components/show/index.d.ts +2 -0
  173. package/dist/components/show/index.js +1 -0
  174. package/dist/components/sidebar/PlSidebar.js +1 -1
  175. package/dist/components/slider/PlSlider.js +1 -1
  176. package/dist/components/sparkline/PlSparkline.d.ts +68 -0
  177. package/dist/components/sparkline/PlSparkline.js +1 -0
  178. package/dist/components/sparkline/index.d.ts +2 -0
  179. package/dist/components/sparkline/index.js +1 -0
  180. package/dist/components/spoiler/PlSpoiler.d.ts +8 -0
  181. package/dist/components/spoiler/PlSpoiler.js +1 -1
  182. package/dist/components/stack/PlStack.d.ts +114 -0
  183. package/dist/components/stack/PlStack.js +1 -0
  184. package/dist/components/stack/index.d.ts +2 -0
  185. package/dist/components/stack/index.js +1 -0
  186. package/dist/components/stepper/PlStepper.d.ts +2 -2
  187. package/dist/components/stepper/PlStepper.js +1 -1
  188. package/dist/components/table/PlTable.js +1 -1
  189. package/dist/components/tabs/PlTabs.d.ts +2 -2
  190. package/dist/components/tabs/PlTabs.js +1 -1
  191. package/dist/components/text-link/PlTextLink.js +1 -1
  192. package/dist/components/timeline/PlTimeline.d.ts +2 -2
  193. package/dist/components/timeline/PlTimeline.js +1 -1
  194. package/dist/components/timeline-chart/PlTimelineChart.d.ts +44 -0
  195. package/dist/components/timeline-chart/PlTimelineChart.js +1 -0
  196. package/dist/components/timeline-chart/index.d.ts +2 -0
  197. package/dist/components/timeline-chart/index.js +1 -0
  198. package/dist/components/toast/PlToast.d.ts +1 -1
  199. package/dist/components/toast/PlToast.js +1 -1
  200. package/dist/components/toggle/PlToggle.js +1 -1
  201. package/dist/components/toggle/PlToggleGroup.js +1 -1
  202. package/dist/components/tour/PlTour.d.ts +134 -0
  203. package/dist/components/tour/PlTour.js +1 -0
  204. package/dist/components/tour/index.d.ts +2 -0
  205. package/dist/components/tour/index.js +1 -0
  206. package/dist/components/transfer/PlTransfer.js +1 -1
  207. package/dist/components/tree/PlTree.js +1 -1
  208. package/dist/components/tree-select/PlTreeSelect.d.ts +99 -0
  209. package/dist/components/tree-select/PlTreeSelect.js +1 -0
  210. package/dist/components/tree-select/index.d.ts +2 -0
  211. package/dist/components/tree-select/index.js +1 -0
  212. package/dist/components/window-pane/PlWindowPane.d.ts +179 -0
  213. package/dist/components/window-pane/PlWindowPane.js +1 -0
  214. package/dist/components/window-pane/index.d.ts +2 -0
  215. package/dist/components/window-pane/index.js +1 -0
  216. package/dist/css/anchor.css +2 -0
  217. package/dist/css/animate-counter.css +2 -0
  218. package/dist/css/animate-float.css +2 -0
  219. package/dist/css/animate-reveal.css +2 -0
  220. package/dist/css/animate-scramble.css +2 -0
  221. package/dist/css/animate-shake.css +2 -0
  222. package/dist/css/animate-split.css +2 -0
  223. package/dist/css/app-logo.css +2 -0
  224. package/dist/css/area-chart.css +2 -0
  225. package/dist/css/bar-chart.css +2 -0
  226. package/dist/css/code-block.css +2 -0
  227. package/dist/css/data-list.css +2 -0
  228. package/dist/css/data-table.css +2 -0
  229. package/dist/css/flex.css +2 -0
  230. package/dist/css/floating-action-button.css +2 -0
  231. package/dist/css/gallery.css +2 -0
  232. package/dist/css/gauge-chart.css +2 -0
  233. package/dist/css/heatmap-chart.css +2 -0
  234. package/dist/css/hover-card.css +2 -0
  235. package/dist/css/how-to-steps.css +2 -0
  236. package/dist/css/line-chart.css +2 -0
  237. package/dist/css/meter.css +2 -0
  238. package/dist/css/mockup.css +2 -0
  239. package/dist/css/pie-chart.css +2 -0
  240. package/dist/css/portal.css +2 -0
  241. package/dist/css/scatter-chart.css +2 -0
  242. package/dist/css/scroll-area.css +2 -0
  243. package/dist/css/show.css +2 -0
  244. package/dist/css/sparkline.css +2 -0
  245. package/dist/css/stack.css +2 -0
  246. package/dist/css/timeline-chart.css +2 -0
  247. package/dist/css/tour.css +2 -0
  248. package/dist/css/tree-select.css +2 -0
  249. package/dist/css/window-pane.css +2 -0
  250. package/dist/hooks/index.d.ts +6 -0
  251. package/dist/hooks/index.js +1 -1
  252. package/dist/hooks/usePlBreakpoint.d.ts +3 -0
  253. package/dist/hooks/usePlBreakpoint.js +1 -1
  254. package/dist/hooks/usePlDisclosure.d.ts +44 -0
  255. package/dist/hooks/usePlDisclosure.js +1 -0
  256. package/dist/hooks/usePlElementSize.d.ts +31 -0
  257. package/dist/hooks/usePlElementSize.js +1 -0
  258. package/dist/hooks/usePlOnScreen.d.ts +50 -0
  259. package/dist/hooks/usePlOnScreen.js +1 -0
  260. package/dist/index.d.ts +34 -1
  261. package/dist/index.js +1 -1
  262. package/dist/internal/animate.d.ts +91 -5
  263. package/dist/internal/animate.js +1 -1
  264. package/dist/internal/breakpoints.d.ts +31 -0
  265. package/dist/internal/breakpoints.js +1 -0
  266. package/dist/internal/button-group.d.ts +29 -2
  267. package/dist/internal/button-group.js +2 -2
  268. package/dist/internal/calendar.d.ts +11 -36
  269. package/dist/internal/calendar.js +1 -1
  270. package/dist/internal/chart-frame.d.ts +458 -0
  271. package/dist/internal/chart-frame.js +1 -0
  272. package/dist/internal/chart-line.d.ts +44 -0
  273. package/dist/internal/chart-line.js +1 -0
  274. package/dist/internal/chart.d.ts +473 -0
  275. package/dist/internal/chart.js +1 -0
  276. package/dist/internal/data-table.d.ts +69 -0
  277. package/dist/internal/data-table.js +1 -0
  278. package/dist/internal/defaults.d.ts +8 -3
  279. package/dist/internal/drag.d.ts +49 -0
  280. package/dist/internal/drag.js +1 -0
  281. package/dist/internal/format.d.ts +2 -0
  282. package/dist/internal/format.js +1 -1
  283. package/dist/internal/gallery.d.ts +34 -0
  284. package/dist/internal/gallery.js +1 -0
  285. package/dist/internal/grid.d.ts +6 -27
  286. package/dist/internal/grid.js +1 -1
  287. package/dist/internal/highlight.d.ts +98 -0
  288. package/dist/internal/highlight.js +1 -0
  289. package/dist/internal/icons.d.ts +10 -0
  290. package/dist/internal/icons.js +1 -1
  291. package/dist/internal/labels.d.ts +138 -0
  292. package/dist/internal/labels.js +1 -0
  293. package/dist/internal/mockup.d.ts +193 -0
  294. package/dist/internal/mockup.js +1 -0
  295. package/dist/internal/page-layout.js +1 -1
  296. package/dist/internal/progress.d.ts +6 -0
  297. package/dist/internal/responsive.d.ts +108 -0
  298. package/dist/internal/responsive.js +1 -0
  299. package/dist/internal/scramble.d.ts +31 -0
  300. package/dist/internal/scramble.js +1 -0
  301. package/dist/internal/styles.d.ts +15 -0
  302. package/dist/internal/styles.js +1 -1
  303. package/dist/internal/table.d.ts +86 -0
  304. package/dist/internal/table.js +1 -0
  305. package/dist/internal/threshold.d.ts +19 -0
  306. package/dist/internal/threshold.js +1 -0
  307. package/dist/internal/tour.d.ts +42 -0
  308. package/dist/internal/tour.js +1 -0
  309. package/dist/internal/window.d.ts +201 -0
  310. package/dist/internal/window.js +1 -0
  311. package/dist/locales/de.d.ts +3 -0
  312. package/dist/locales/de.js +1 -0
  313. package/dist/locales/en.d.ts +2 -0
  314. package/dist/locales/en.js +1 -0
  315. package/dist/locales/es.d.ts +3 -0
  316. package/dist/locales/es.js +1 -0
  317. package/dist/locales/fr.d.ts +3 -0
  318. package/dist/locales/fr.js +1 -0
  319. package/dist/locales/index.d.ts +33 -0
  320. package/dist/locales/index.js +1 -0
  321. package/dist/locales/ja.d.ts +3 -0
  322. package/dist/locales/ja.js +1 -0
  323. package/dist/locales/ko.d.ts +3 -0
  324. package/dist/locales/ko.js +1 -0
  325. package/dist/locales/zh-Hans.d.ts +3 -0
  326. package/dist/locales/zh-Hans.js +1 -0
  327. package/dist/provider/index.d.ts +1 -0
  328. package/dist/provider/index.js +1 -1
  329. package/dist/styles.css +1 -1
  330. package/dist/tailwind.css +1104 -19
  331. package/dist/tokens.css +1104 -19
  332. package/dist/types.d.ts +381 -2
  333. package/package.json +14 -4
  334. package/dist/components/avatar-group/PlAvatarGroup.d.ts +0 -47
  335. package/dist/components/avatar-group/PlAvatarGroup.js +0 -1
  336. package/dist/components/avatar-group/index.d.ts +0 -2
  337. package/dist/components/avatar-group/index.js +0 -1
  338. package/dist/css/avatar-group.css +0 -2
  339. package/dist/internal/avatar-group.d.ts +0 -25
  340. package/dist/internal/avatar-group.js +0 -2
package/dist/index.d.ts CHANGED
@@ -3,22 +3,31 @@ export * from './hooks/index.js';
3
3
  export * from './provider/index.js';
4
4
  export * from './components/accordion/index.js';
5
5
  export * from './components/alert/index.js';
6
+ export * from './components/anchor/index.js';
6
7
  export * from './components/animate-appear/index.js';
7
8
  export * from './components/animate-blink/index.js';
9
+ export * from './components/animate-counter/index.js';
8
10
  export * from './components/animate-fade/index.js';
11
+ export * from './components/animate-float/index.js';
9
12
  export * from './components/animate-grow/index.js';
10
13
  export * from './components/animate-headline/index.js';
11
14
  export * from './components/animate-lighting/index.js';
12
15
  export * from './components/animate-marquee/index.js';
16
+ export * from './components/animate-reveal/index.js';
13
17
  export * from './components/animate-rotate/index.js';
18
+ export * from './components/animate-scramble/index.js';
19
+ export * from './components/animate-shake/index.js';
14
20
  export * from './components/animate-slide/index.js';
21
+ export * from './components/animate-split/index.js';
15
22
  export * from './components/animate-typing/index.js';
16
23
  export * from './components/animate-zoom/index.js';
24
+ export * from './components/app-logo/index.js';
25
+ export * from './components/area-chart/index.js';
17
26
  export * from './components/aspect-ratio/index.js';
18
27
  export * from './components/avatar/index.js';
19
- export * from './components/avatar-group/index.js';
20
28
  export * from './components/back-top/index.js';
21
29
  export * from './components/badge/index.js';
30
+ export * from './components/bar-chart/index.js';
22
31
  export * from './components/blockquote/index.js';
23
32
  export * from './components/bottom-navigation/index.js';
24
33
  export * from './components/box/index.js';
@@ -31,12 +40,15 @@ export * from './components/carousel/index.js';
31
40
  export * from './components/chat-bubble/index.js';
32
41
  export * from './components/checkbox/index.js';
33
42
  export * from './components/chip/index.js';
43
+ export * from './components/code-block/index.js';
34
44
  export * from './components/collapsible/index.js';
35
45
  export * from './components/color-picker/index.js';
36
46
  export * from './components/combobox/index.js';
37
47
  export * from './components/confirm/index.js';
38
48
  export * from './components/command-palette/index.js';
39
49
  export * from './components/container/index.js';
50
+ export * from './components/data-list/index.js';
51
+ export * from './components/data-table/index.js';
40
52
  export * from './components/date-picker/index.js';
41
53
  export * from './components/date-range-picker/index.js';
42
54
  export * from './components/date-time-picker/index.js';
@@ -45,19 +57,29 @@ export * from './components/drawer/index.js';
45
57
  export * from './components/empty/index.js';
46
58
  export * from './components/fieldset/index.js';
47
59
  export * from './components/file-picker/index.js';
60
+ export * from './components/flex/index.js';
61
+ export * from './components/floating-action-button/index.js';
48
62
  export * from './components/floating-bottom-navigation/index.js';
49
63
  export * from './components/footer/index.js';
50
64
  export * from './components/form/index.js';
65
+ export * from './components/gallery/index.js';
66
+ export * from './components/gauge-chart/index.js';
51
67
  export * from './components/grid/index.js';
52
68
  export * from './components/header/index.js';
69
+ export * from './components/heatmap-chart/index.js';
53
70
  export * from './components/highlight/index.js';
54
71
  export * from './components/hot-keys/index.js';
72
+ export * from './components/hover-card/index.js';
73
+ export * from './components/how-to-steps/index.js';
55
74
  export * from './components/icon/index.js';
56
75
  export * from './components/icon-button/index.js';
57
76
  export * from './components/image/index.js';
77
+ export * from './components/line-chart/index.js';
58
78
  export * from './components/list/index.js';
59
79
  export * from './components/menu/index.js';
60
80
  export * from './components/menubar/index.js';
81
+ export * from './components/meter/index.js';
82
+ export * from './components/mockup/index.js';
61
83
  export * from './components/modal/index.js';
62
84
  export * from './components/navigation-menu/index.js';
63
85
  export * from './components/number-field/index.js';
@@ -66,21 +88,28 @@ export * from './components/overlay/index.js';
66
88
  export * from './components/page-layout/index.js';
67
89
  export * from './components/pagination/index.js';
68
90
  export * from './components/panes/index.js';
91
+ export * from './components/pie-chart/index.js';
69
92
  export * from './components/pill/index.js';
70
93
  export * from './components/popconfirm/index.js';
71
94
  export * from './components/popover/index.js';
95
+ export * from './components/portal/index.js';
72
96
  export * from './components/progress-box/index.js';
73
97
  export * from './components/progress-circular/index.js';
74
98
  export * from './components/progress-linear/index.js';
75
99
  export * from './components/radio-group/index.js';
76
100
  export * from './components/rating/index.js';
101
+ export * from './components/scatter-chart/index.js';
102
+ export * from './components/scroll-area/index.js';
77
103
  export * from './components/scroll-zone/index.js';
78
104
  export * from './components/segmented-button/index.js';
79
105
  export * from './components/select/index.js';
106
+ export * from './components/show/index.js';
80
107
  export * from './components/sidebar/index.js';
81
108
  export * from './components/skeleton/index.js';
82
109
  export * from './components/slider/index.js';
110
+ export * from './components/sparkline/index.js';
83
111
  export * from './components/spoiler/index.js';
112
+ export * from './components/stack/index.js';
84
113
  export * from './components/stat/index.js';
85
114
  export * from './components/stepper/index.js';
86
115
  export * from './components/switch/index.js';
@@ -90,11 +119,15 @@ export * from './components/text-field/index.js';
90
119
  export * from './components/text-link/index.js';
91
120
  export * from './components/time-picker/index.js';
92
121
  export * from './components/timeline/index.js';
122
+ export * from './components/timeline-chart/index.js';
93
123
  export * from './components/toast/index.js';
94
124
  export * from './components/toggle/index.js';
95
125
  export * from './components/toolbar/index.js';
96
126
  export * from './components/tooltip/index.js';
127
+ export * from './components/tour/index.js';
97
128
  export * from './components/tree/index.js';
129
+ export * from './components/tree-select/index.js';
98
130
  export * from './components/transfer/index.js';
99
131
  export * from './components/typography/index.js';
100
132
  export * from './components/visually-hidden/index.js';
133
+ export * from './components/window-pane/index.js';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export*from"./types.js";export*from"./hooks/index.js";export*from"./provider/index.js";export*from"./components/accordion/index.js";export*from"./components/alert/index.js";export*from"./components/animate-appear/index.js";export*from"./components/animate-blink/index.js";export*from"./components/animate-fade/index.js";export*from"./components/animate-grow/index.js";export*from"./components/animate-headline/index.js";export*from"./components/animate-lighting/index.js";export*from"./components/animate-marquee/index.js";export*from"./components/animate-rotate/index.js";export*from"./components/animate-slide/index.js";export*from"./components/animate-typing/index.js";export*from"./components/animate-zoom/index.js";export*from"./components/aspect-ratio/index.js";export*from"./components/avatar/index.js";export*from"./components/avatar-group/index.js";export*from"./components/back-top/index.js";export*from"./components/badge/index.js";export*from"./components/blockquote/index.js";export*from"./components/bottom-navigation/index.js";export*from"./components/box/index.js";export*from"./components/breadcrumb/index.js";export*from"./components/button/index.js";export*from"./components/button-group/index.js";export*from"./components/calendar/index.js";export*from"./components/card/index.js";export*from"./components/carousel/index.js";export*from"./components/chat-bubble/index.js";export*from"./components/checkbox/index.js";export*from"./components/chip/index.js";export*from"./components/collapsible/index.js";export*from"./components/color-picker/index.js";export*from"./components/combobox/index.js";export*from"./components/confirm/index.js";export*from"./components/command-palette/index.js";export*from"./components/container/index.js";export*from"./components/date-picker/index.js";export*from"./components/date-range-picker/index.js";export*from"./components/date-time-picker/index.js";export*from"./components/divider/index.js";export*from"./components/drawer/index.js";export*from"./components/empty/index.js";export*from"./components/fieldset/index.js";export*from"./components/file-picker/index.js";export*from"./components/floating-bottom-navigation/index.js";export*from"./components/footer/index.js";export*from"./components/form/index.js";export*from"./components/grid/index.js";export*from"./components/header/index.js";export*from"./components/highlight/index.js";export*from"./components/hot-keys/index.js";export*from"./components/icon/index.js";export*from"./components/icon-button/index.js";export*from"./components/image/index.js";export*from"./components/list/index.js";export*from"./components/menu/index.js";export*from"./components/menubar/index.js";export*from"./components/modal/index.js";export*from"./components/navigation-menu/index.js";export*from"./components/number-field/index.js";export*from"./components/otp-field/index.js";export*from"./components/overlay/index.js";export*from"./components/page-layout/index.js";export*from"./components/pagination/index.js";export*from"./components/panes/index.js";export*from"./components/pill/index.js";export*from"./components/popconfirm/index.js";export*from"./components/popover/index.js";export*from"./components/progress-box/index.js";export*from"./components/progress-circular/index.js";export*from"./components/progress-linear/index.js";export*from"./components/radio-group/index.js";export*from"./components/rating/index.js";export*from"./components/scroll-zone/index.js";export*from"./components/segmented-button/index.js";export*from"./components/select/index.js";export*from"./components/sidebar/index.js";export*from"./components/skeleton/index.js";export*from"./components/slider/index.js";export*from"./components/spoiler/index.js";export*from"./components/stat/index.js";export*from"./components/stepper/index.js";export*from"./components/switch/index.js";export*from"./components/table/index.js";export*from"./components/tabs/index.js";export*from"./components/text-field/index.js";export*from"./components/text-link/index.js";export*from"./components/time-picker/index.js";export*from"./components/timeline/index.js";export*from"./components/toast/index.js";export*from"./components/toggle/index.js";export*from"./components/toolbar/index.js";export*from"./components/tooltip/index.js";export*from"./components/tree/index.js";export*from"./components/transfer/index.js";export*from"./components/typography/index.js";export*from"./components/visually-hidden/index.js";
1
+ export*from"./types.js";export*from"./hooks/index.js";export*from"./provider/index.js";export*from"./components/accordion/index.js";export*from"./components/alert/index.js";export*from"./components/anchor/index.js";export*from"./components/animate-appear/index.js";export*from"./components/animate-blink/index.js";export*from"./components/animate-counter/index.js";export*from"./components/animate-fade/index.js";export*from"./components/animate-float/index.js";export*from"./components/animate-grow/index.js";export*from"./components/animate-headline/index.js";export*from"./components/animate-lighting/index.js";export*from"./components/animate-marquee/index.js";export*from"./components/animate-reveal/index.js";export*from"./components/animate-rotate/index.js";export*from"./components/animate-scramble/index.js";export*from"./components/animate-shake/index.js";export*from"./components/animate-slide/index.js";export*from"./components/animate-split/index.js";export*from"./components/animate-typing/index.js";export*from"./components/animate-zoom/index.js";export*from"./components/app-logo/index.js";export*from"./components/area-chart/index.js";export*from"./components/aspect-ratio/index.js";export*from"./components/avatar/index.js";export*from"./components/back-top/index.js";export*from"./components/badge/index.js";export*from"./components/bar-chart/index.js";export*from"./components/blockquote/index.js";export*from"./components/bottom-navigation/index.js";export*from"./components/box/index.js";export*from"./components/breadcrumb/index.js";export*from"./components/button/index.js";export*from"./components/button-group/index.js";export*from"./components/calendar/index.js";export*from"./components/card/index.js";export*from"./components/carousel/index.js";export*from"./components/chat-bubble/index.js";export*from"./components/checkbox/index.js";export*from"./components/chip/index.js";export*from"./components/code-block/index.js";export*from"./components/collapsible/index.js";export*from"./components/color-picker/index.js";export*from"./components/combobox/index.js";export*from"./components/confirm/index.js";export*from"./components/command-palette/index.js";export*from"./components/container/index.js";export*from"./components/data-list/index.js";export*from"./components/data-table/index.js";export*from"./components/date-picker/index.js";export*from"./components/date-range-picker/index.js";export*from"./components/date-time-picker/index.js";export*from"./components/divider/index.js";export*from"./components/drawer/index.js";export*from"./components/empty/index.js";export*from"./components/fieldset/index.js";export*from"./components/file-picker/index.js";export*from"./components/flex/index.js";export*from"./components/floating-action-button/index.js";export*from"./components/floating-bottom-navigation/index.js";export*from"./components/footer/index.js";export*from"./components/form/index.js";export*from"./components/gallery/index.js";export*from"./components/gauge-chart/index.js";export*from"./components/grid/index.js";export*from"./components/header/index.js";export*from"./components/heatmap-chart/index.js";export*from"./components/highlight/index.js";export*from"./components/hot-keys/index.js";export*from"./components/hover-card/index.js";export*from"./components/how-to-steps/index.js";export*from"./components/icon/index.js";export*from"./components/icon-button/index.js";export*from"./components/image/index.js";export*from"./components/line-chart/index.js";export*from"./components/list/index.js";export*from"./components/menu/index.js";export*from"./components/menubar/index.js";export*from"./components/meter/index.js";export*from"./components/mockup/index.js";export*from"./components/modal/index.js";export*from"./components/navigation-menu/index.js";export*from"./components/number-field/index.js";export*from"./components/otp-field/index.js";export*from"./components/overlay/index.js";export*from"./components/page-layout/index.js";export*from"./components/pagination/index.js";export*from"./components/panes/index.js";export*from"./components/pie-chart/index.js";export*from"./components/pill/index.js";export*from"./components/popconfirm/index.js";export*from"./components/popover/index.js";export*from"./components/portal/index.js";export*from"./components/progress-box/index.js";export*from"./components/progress-circular/index.js";export*from"./components/progress-linear/index.js";export*from"./components/radio-group/index.js";export*from"./components/rating/index.js";export*from"./components/scatter-chart/index.js";export*from"./components/scroll-area/index.js";export*from"./components/scroll-zone/index.js";export*from"./components/segmented-button/index.js";export*from"./components/select/index.js";export*from"./components/show/index.js";export*from"./components/sidebar/index.js";export*from"./components/skeleton/index.js";export*from"./components/slider/index.js";export*from"./components/sparkline/index.js";export*from"./components/spoiler/index.js";export*from"./components/stack/index.js";export*from"./components/stat/index.js";export*from"./components/stepper/index.js";export*from"./components/switch/index.js";export*from"./components/table/index.js";export*from"./components/tabs/index.js";export*from"./components/text-field/index.js";export*from"./components/text-link/index.js";export*from"./components/time-picker/index.js";export*from"./components/timeline/index.js";export*from"./components/timeline-chart/index.js";export*from"./components/toast/index.js";export*from"./components/toggle/index.js";export*from"./components/toolbar/index.js";export*from"./components/tooltip/index.js";export*from"./components/tour/index.js";export*from"./components/tree/index.js";export*from"./components/tree-select/index.js";export*from"./components/transfer/index.js";export*from"./components/typography/index.js";export*from"./components/visually-hidden/index.js";export*from"./components/window-pane/index.js";
@@ -25,15 +25,27 @@
25
25
  * `rotate` properties rather than on the `transform` shorthand, so a caller's
26
26
  * own transform on the same element survives.
27
27
  *
28
+ * ## Telling the children apart
29
+ *
30
+ * `stagger`, `durationStep` and `reverse` move an effect off the box and onto
31
+ * the things inside it, one after another. There is no `PlAnimateStagger`
32
+ * component and there should not be: a stagger is a *differential* rather than
33
+ * an effect, and a wrapper would be a second way to spell something all six
34
+ * effects can already say. `animateChildren` and `staggerSlots` are what
35
+ * `PlAnimateAppear` — which was staggering long before the six could — now runs
36
+ * on as well, because two implementations of "one after another" is two
37
+ * opinions about the arithmetic.
38
+ *
28
39
  * ## What is deliberately not here
29
40
  *
30
41
  * An effect that has to know what its children *are* — a marquee that lays them
31
42
  * down twice, a headline that swaps between them, a typewriter that counts
32
43
  * graphemes — cannot be a class name and a few numbers. Those are components,
33
- * and their logic stays in their own files.
44
+ * and their logic stays in their own files. They are also the four that cannot
45
+ * take a `stagger`, for the same reason: their children are already spoken for.
34
46
  */
35
47
  import * as React from 'react';
36
- import type { PlassAnimateRepeat, PlassAnimateTrigger, PlassAnimation, PlassSide } from '../types.js';
48
+ import type { PlassAnimateRepeat, PlassAnimateStaggerProps, PlassAnimateTimelineProps, PlassAnimateTrigger, PlassAnimation, PlassSide } from '../types.js';
37
49
  /**
38
50
  * Which keyframe an effect runs.
39
51
  *
@@ -59,7 +71,15 @@ export declare function isInfinite(repeat: PlassAnimateRepeat | undefined): bool
59
71
  * is `both`, so a faded-out element stays faded out instead of snapping back.
60
72
  */
61
73
  export declare function directionValue(mode: 'in' | 'out', alternate: boolean | undefined): string;
62
- export interface AnimationSlotOptions {
74
+ /**
75
+ * Where a scroll-linked effect starts and finishes, as an `animation-range`.
76
+ *
77
+ * Finished while the element is still arriving rather than when it reaches the
78
+ * middle of the screen: an entrance that is only half drawn by the time a
79
+ * reader has read past it is an entrance that never happened.
80
+ */
81
+ export declare const defaultViewRange = "entry 0% cover 45%";
82
+ export interface AnimationSlotOptions extends PlassAnimateTimelineProps {
63
83
  duration: number;
64
84
  delay: number;
65
85
  easing?: string;
@@ -73,6 +93,8 @@ export interface AnimationSlotOptions {
73
93
  y?: string;
74
94
  angle?: string;
75
95
  angleTo?: string;
96
+ /** The `clip-path` a reveal is uncovered from. */
97
+ clip?: string;
76
98
  }
77
99
  /**
78
100
  * The `--p-anim-*` slots, as an inline style object.
@@ -82,6 +104,14 @@ export interface AnimationSlotOptions {
82
104
  * has never seen written down.
83
105
  */
84
106
  export declare function animationSlots(options: AnimationSlotOptions): React.CSSProperties;
107
+ /**
108
+ * The `clip-path` a reveal starts from, given the edge it uncovers from.
109
+ *
110
+ * `inset()` takes its four sides in the physical order CSS writes them, and
111
+ * `PlassSide` is physical for the same reason it is on a slide: a title wiped
112
+ * in from the top is wiped in from the top in every writing direction.
113
+ */
114
+ export declare function revealClip(from: PlassSide): string;
85
115
  /**
86
116
  * Which way a slide starts, given the edge it comes from.
87
117
  *
@@ -101,6 +131,17 @@ export interface AnimationRunOptions {
101
131
  paused?: boolean;
102
132
  /** An infinite effect stops when the pointer leaves; a finite one finishes. */
103
133
  infinite: boolean;
134
+ /**
135
+ * A value that plays the effect again whenever it changes, and never on the
136
+ * first render.
137
+ *
138
+ * `play` is a boolean, so replaying with it means toggling off and on — two
139
+ * renders for one event, and a piece of state whose only job is to be
140
+ * flipped back. A response to something that can happen twice needs the
141
+ * *event*, and a value that has changed is the closest React has to one: a
142
+ * count of failed attempts already is this.
143
+ */
144
+ nonce?: unknown;
104
145
  }
105
146
  export interface AnimationRun {
106
147
  /** Goes on the animated element. */
@@ -131,10 +172,53 @@ export interface AnimationRun {
131
172
  * style to settle, and putting it back is the one move that rewinds the element
132
173
  * and leaves everything inside it alone.
133
174
  */
134
- export declare function useAnimationRun({ trigger, play, once, threshold, paused, infinite }: AnimationRunOptions): AnimationRun;
135
- export interface AnimateElementParams extends AnimationSlotOptions, AnimationRunOptions {
175
+ export declare function useAnimationRun({ trigger, play, once, threshold, paused, infinite, nonce }: AnimationRunOptions): AnimationRun;
176
+ export interface StaggerPosition extends Required<PlassAnimateStaggerProps> {
177
+ index: number;
178
+ count: number;
179
+ }
180
+ /**
181
+ * Where one child sits in a staggered run.
182
+ *
183
+ * `reverse` turns the *order* round and nothing else: the last child goes
184
+ * first and every child still plays forwards. An effect that ran backwards is
185
+ * `mode="out"`, which is a different question and already has an answer.
186
+ *
187
+ * The duration is floored at zero rather than allowed to go negative, because a
188
+ * negative `animation-duration` is invalid and an invalid declaration is
189
+ * dropped — which would leave that one child playing at the CSS default while
190
+ * its neighbours honoured the prop.
191
+ */
192
+ export declare function staggerSlots(slots: AnimationSlotOptions, { index, count, stagger, durationStep, reverse }: StaggerPosition): AnimationSlotOptions;
193
+ /**
194
+ * Writes one effect onto each child, with that child's own slots.
195
+ *
196
+ * Onto the children **themselves** rather than onto wrappers around them, which
197
+ * is the whole reason this is worth sharing: a row of `<li>`s stays a row of
198
+ * `<li>`s, a grid's cells stay its direct children, and nothing about the
199
+ * layout changes because the set is being animated. A wrapper per child would
200
+ * break every one of those.
201
+ *
202
+ * The trade is the one `React.cloneElement` always makes — a child has to
203
+ * accept a `className` and a `style` — and it is taken here and nowhere else in
204
+ * the library. It is bearable because what is being copied is *only* the
205
+ * animation, so a child that ignores both is a child that does not animate,
206
+ * rather than a child that lands in the wrong place. `PlStack` draws a wrapper
207
+ * per item instead, and takes the layout cost, precisely because *there* the
208
+ * failure would not be survivable: a child that dropped the class would land in
209
+ * the wrong place rather than merely arriving without an entrance.
210
+ *
211
+ * A bare string has no element to write onto, so that one is wrapped in a
212
+ * `<span>`. It is the only case that gets a wrapper.
213
+ */
214
+ export declare function animateChildren(children: React.ReactNode, className: string, slotsFor: (index: number, count: number) => React.CSSProperties): React.ReactNode[];
215
+ export interface AnimateElementParams extends AnimationSlotOptions, AnimationRunOptions, PlassAnimateStaggerProps {
136
216
  /** Which keyframe. `null` for the components that write their own. */
137
217
  effect: PlassAnimation | null;
218
+ /** `transform-origin`, for the two effects that turn about a point. */
219
+ origin?: string;
220
+ /** Needed only to be handed back staggered. Passed straight through otherwise. */
221
+ children?: React.ReactNode;
138
222
  }
139
223
  export interface AnimateElement {
140
224
  ref: React.RefCallback<HTMLElement>;
@@ -142,6 +226,8 @@ export interface AnimateElement {
142
226
  style: React.CSSProperties;
143
227
  /** The hover handlers and the two data attributes, ready to be spread. */
144
228
  props: React.HTMLAttributes<HTMLElement> & Record<string, unknown>;
229
+ /** The children, with the effect written onto them if it was staggered. */
230
+ children: React.ReactNode;
145
231
  }
146
232
  /**
147
233
  * Everything a one-keyframe `PlAnimate*` root needs, in one call.
@@ -1 +1 @@
1
- import*as e from"react";export const animationClasses={fade:"plass-anim-fade",grow:"plass-anim-scale",slide:"plass-anim-slide",zoom:"plass-anim-scale",rotate:"plass-anim-rotate",blink:"plass-anim-blink"};export const animBaseClass="plass-anim";export function lengthValue(e){return"number"==typeof e?`${e}px`:e}export function repeatValue(e){return"infinite"===e?"infinite":String(e)}export function isInfinite(e){return"infinite"===e}export function directionValue(e,n){return"out"===e?n?"alternate-reverse":"reverse":n?"alternate":"normal"}export function animationSlots(e){const n={"--p-anim-duration":`${e.duration}ms`,"--p-anim-delay":`${e.delay}ms`,"--p-anim-repeat":repeatValue(e.repeat),"--p-anim-direction":directionValue(e.mode??"in",e.alternate)};return e.easing&&(n["--p-anim-ease"]=e.easing),void 0!==e.opacity&&(n["--p-anim-opacity"]=String(e.opacity)),void 0!==e.scale&&(n["--p-anim-scale"]=String(e.scale)),void 0!==e.x&&(n["--p-anim-x"]=e.x),void 0!==e.y&&(n["--p-anim-y"]=e.y),void 0!==e.angle&&(n["--p-anim-angle"]=e.angle),void 0!==e.angleTo&&(n["--p-anim-angle-to"]=e.angleTo),n}export function slideOffsets(e,n){const t=lengthValue(n),a="number"==typeof n?-n+"px":`calc(-1 * ${t})`;switch(e){case"top":return{x:"0px",y:a};case"bottom":return{x:"0px",y:t};case"left":return{x:a,y:"0px"};default:return{x:t,y:"0px"}}}export function useAnimationRun({trigger:n,play:t,once:a,threshold:i,paused:s,infinite:r}){const o=e.useRef(null),[l,u]=e.useState("mount"===n),[c,p]=e.useState(0),m=e.useCallback(()=>{u(!0),p(e=>e+1)},[]);e.useLayoutEffect(()=>{const e=o.current;if(!e||0===c)return;const n=[e,...e.querySelectorAll(".plass-anim, .plass-marquee-track")];for(const e of n)e.style.animationName="none";e.offsetWidth;for(const e of n)e.style.animationName=""},[c]),e.useEffect(()=>{if("visible"!==n)return;const e=o.current;if(!e||"undefined"==typeof IntersectionObserver)return void u(!0);const t=new IntersectionObserver(([e])=>{e.isIntersecting?(m(),a&&t.disconnect()):a||u(!1)},{threshold:i});return t.observe(e),()=>t.disconnect()},[n,a,i,m]),e.useEffect(()=>{"manual"===n&&(t?m():u(!1))},[n,t,m]);const f="hover"===n?{onPointerEnter:m,onFocus:m,onPointerLeave:()=>{r&&u(!1)},onBlur:()=>{r&&u(!1)}}:{};return{ref:e.useCallback(e=>{o.current=e},[]),state:l&&!s?"running":"paused",started:l,handlers:f}}export function useAnimateElement(e){const{effect:n,trigger:t,play:a,once:i,threshold:s,paused:r,infinite:o,...l}=e,u=useAnimationRun({trigger:t,play:a,once:i,threshold:s,paused:r,infinite:o});return{ref:u.ref,className:n?`plass-anim ${animationClasses[n]}`:"",style:{...animationSlots(l),"--p-anim-state":u.state},props:{...u.handlers,"data-plass-animation":n??void 0,"data-state":u.state}}}
1
+ import*as e from"react";import{cx as n}from"./styles.js";export const animationClasses={fade:"plass-anim-fade",grow:"plass-anim-scale",slide:"plass-anim-slide",zoom:"plass-anim-scale",rotate:"plass-anim-rotate",blink:"plass-anim-blink",reveal:"plass-anim-reveal"};export const animBaseClass="plass-anim";export function lengthValue(e){return"number"==typeof e?`${e}px`:e}export function repeatValue(e){return"infinite"===e?"infinite":String(e)}export function isInfinite(e){return"infinite"===e}export function directionValue(e,n){return"out"===e?n?"alternate-reverse":"reverse":n?"alternate":"normal"}export const defaultViewRange="entry 0% cover 45%";export function animationSlots(e){const n={"--p-anim-duration":`${e.duration}ms`,"--p-anim-delay":`${e.delay}ms`,"--p-anim-repeat":repeatValue(e.repeat),"--p-anim-direction":directionValue(e.mode??"in",e.alternate)};return e.easing&&(n["--p-anim-ease"]=e.easing),"view"===e.timeline&&(n["--p-anim-timeline"]="view()",n["--p-anim-range"]=e.range??defaultViewRange),void 0!==e.opacity&&(n["--p-anim-opacity"]=String(e.opacity)),void 0!==e.scale&&(n["--p-anim-scale"]=String(e.scale)),void 0!==e.x&&(n["--p-anim-x"]=e.x),void 0!==e.y&&(n["--p-anim-y"]=e.y),void 0!==e.angle&&(n["--p-anim-angle"]=e.angle),void 0!==e.angleTo&&(n["--p-anim-angle-to"]=e.angleTo),void 0!==e.clip&&(n["--p-anim-clip"]=e.clip),n}export function revealClip(e){switch(e){case"top":return"inset(0 0 100% 0)";case"bottom":return"inset(100% 0 0 0)";case"right":return"inset(0 0 0 100%)";default:return"inset(0 100% 0 0)"}}export function slideOffsets(e,n){const t=lengthValue(n),a="number"==typeof n?-n+"px":`calc(-1 * ${t})`;switch(e){case"top":return{x:"0px",y:a};case"bottom":return{x:"0px",y:t};case"left":return{x:a,y:"0px"};default:return{x:t,y:"0px"}}}export function useAnimationRun({trigger:n,play:t,once:a,threshold:i,paused:r,infinite:s,nonce:o}){const l=e.useRef(null),[c,u]=e.useState("mount"===n),[p,m]=e.useState(0),d=e.useCallback(()=>{u(!0),m(e=>e+1)},[]);e.useLayoutEffect(()=>{const e=l.current;if(!e||0===p)return;const n=[e,...e.querySelectorAll(".plass-anim, .plass-marquee-track")];for(const e of n)e.style.animationName="none";e.offsetWidth;for(const e of n)e.style.animationName=""},[p]),e.useEffect(()=>{if("visible"!==n)return;const e=l.current;if(!e||"undefined"==typeof IntersectionObserver)return void u(!0);const t=new IntersectionObserver(([e])=>{e.isIntersecting?(d(),a&&t.disconnect()):a||u(!1)},{threshold:i});return t.observe(e),()=>t.disconnect()},[n,a,i,d]);const f=e.useRef(o);e.useEffect(()=>{Object.is(o,f.current)||(f.current=o,d())},[o,d]),e.useEffect(()=>{"manual"===n&&(t?d():u(!1))},[n,t,d]);const g="hover"===n?{onPointerEnter:d,onFocus:d,onPointerLeave:()=>{s&&u(!1)},onBlur:()=>{s&&u(!1)}}:{};return{ref:e.useCallback(e=>{l.current=e},[]),state:c&&!r?"running":"paused",started:c,handlers:g}}export function staggerSlots(e,{index:n,count:t,stagger:a,durationStep:i,reverse:r}){const s=r?t-1-n:n;return{...e,delay:e.delay+s*a,duration:Math.max(0,e.duration+s*i)}}export function animateChildren(t,a,i){const r=e.Children.toArray(t);return r.map((t,s)=>{const o=i(s,r.length);if(!e.isValidElement(t))return e.createElement("span",{key:s,className:a,style:o},t);const l=t.props;return e.cloneElement(t,{className:n(a,l.className),style:{...o,...l.style}})})}export function useAnimateElement(e){const{effect:n,trigger:t,play:a,once:i,threshold:r,paused:s,infinite:o,nonce:l,stagger:c=0,durationStep:u=0,reverse:p=!1,origin:m,children:d,...f}=e,g=useAnimationRun({trigger:"view"===f.timeline?"mount":t,play:a,once:i,threshold:r,paused:s,infinite:o,nonce:l}),y=n?`plass-anim ${animationClasses[n]}`:"",x=0!==c&&null!==n,v=void 0===m?null:{transformOrigin:m};return{ref:g.ref,className:x?"":y,style:{...v,...x?null:animationSlots(f),"--p-anim-state":g.state},props:{...g.handlers,"data-plass-animation":n??void 0,"data-state":g.state},children:x?animateChildren(d,y,(e,n)=>({...v,...animationSlots(staggerSlots(f,{index:e,count:n,stagger:c,durationStep:u,reverse:p}))})):d}}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The width of each rung, and the queries the library asks about them.
3
+ *
4
+ * The ladder itself is declared **in the stylesheet**, as
5
+ * `--plass-breakpoint-*`, because a page must not have two answers about how
6
+ * wide it is. That file explains the whole arrangement; the short version is
7
+ * that a media query's *condition* cannot read a custom property, so the CSS
8
+ * half resolves Tailwind's `--breakpoint-*` theme at build time through
9
+ * `@variant`, and this — where a breakpoint is a *value* rather than a
10
+ * condition — reads the same answer off the document at runtime.
11
+ *
12
+ * So a project that moves a breakpoint moves one thing:
13
+ *
14
+ * @theme { --breakpoint-md: 50rem; }
15
+ *
16
+ * and both halves follow.
17
+ */
18
+ import type { PlassBreakpointFloor } from '../types.js';
19
+ /**
20
+ * Tailwind's own widths, and what is used when the stylesheet cannot be read.
21
+ *
22
+ * That is not an edge case: it is every server render, and the first client
23
+ * render of a page whose CSS has not arrived. Both want the same answer the
24
+ * shipped stylesheet has baked in, which is this.
25
+ */
26
+ export declare const defaultFloors: Record<PlassBreakpointFloor, string>;
27
+ export declare function breakpointFloors(): Record<PlassBreakpointFloor, string>;
28
+ /** `(width >= …)` — at this rung and above. */
29
+ export declare function fromQuery(rung: PlassBreakpointFloor): string;
30
+ /** `(width < …)` — below this rung. The mirror of `fromQuery`, never both. */
31
+ export declare function belowQuery(rung: PlassBreakpointFloor): string;
@@ -0,0 +1 @@
1
+ "use client";export const defaultFloors={sm:"40rem",md:"48rem",lg:"64rem",xl:"80rem"};let e=null;export function breakpointFloors(){if(e)return e;if("undefined"==typeof document||"undefined"==typeof getComputedStyle)return defaultFloors;const t=getComputedStyle(document.documentElement),read=e=>{const o=t.getPropertyValue(`--plass-breakpoint-${e}`).trim();return""===o?defaultFloors[e]:o};return e={sm:read("sm"),md:read("md"),lg:read("lg"),xl:read("xl")},e}export function fromQuery(e){return`(width >= ${breakpointFloors()[e]})`}export function belowQuery(e){return`(width < ${breakpointFloors()[e]})`}
@@ -1,5 +1,6 @@
1
1
  /**
2
- * What a `PlButton` inherits from the `PlButtonGroup` around it.
2
+ * What a `PlButton` inherits from the `PlButtonGroup` around it, and what a run
3
+ * of keys is made of.
3
4
  *
4
5
  * A context rather than `React.Children.map` with `cloneElement`, and a file of
5
6
  * its own rather than something the group exports, for one reason each.
@@ -13,9 +14,13 @@
13
14
  * Every field is optional, and every one of them means *not specified* rather
14
15
  * than a value: a button falls back to its own default, so a `PlButtonGroup`
15
16
  * with no props of its own changes nothing except the corners.
17
+ *
18
+ * The three class lists at the end are here for the same reason the context is:
19
+ * a `PlToggleGroup` is the same run of keys with a selection on it, and two
20
+ * copies of the join would be two places for the seam to stop lining up.
16
21
  */
17
22
  import * as React from 'react';
18
- import type { PlassColor, PlassDensity, PlassElevation, PlassSize, PlassVariant } from '../types.js';
23
+ import type { PlassColor, PlassDensity, PlassElevation, PlassOrientation, PlassSize, PlassVariant } from '../types.js';
19
24
  export interface PlassButtonGroupContextValue {
20
25
  variant?: PlassVariant;
21
26
  size?: PlassSize;
@@ -25,3 +30,25 @@ export interface PlassButtonGroupContextValue {
25
30
  disabled?: boolean;
26
31
  }
27
32
  export declare const ButtonGroupContext: React.Context<PlassButtonGroupContextValue | null>;
33
+ /**
34
+ * The corners that face a neighbour are squared off, so a run reads as one
35
+ * piece scored into segments rather than as three keys that happen to be
36
+ * touching.
37
+ *
38
+ * Logical properties (`s`/`e`) rather than left/right: under RTL the first key
39
+ * is on the right, and `rounded-l-none` would flatten the wrong side.
40
+ */
41
+ export declare const groupJoinClasses: Record<PlassOrientation, string>;
42
+ /**
43
+ * Only `glass` needs the overlap, because it is the only variant that draws an
44
+ * edge. Two glass keys meeting would otherwise show both of their hairlines and
45
+ * the seam would be twice as heavy as every other edge on the page; pulling the
46
+ * second one back a pixel makes the two share one line.
47
+ *
48
+ * A `solid` run must **not** do this. Its keys have no border to double up, and
49
+ * overlapping would put one gradient over the start of the next — which is
50
+ * exactly the join the squared corners are drawing.
51
+ */
52
+ export declare const groupOverlapClasses: Record<PlassOrientation, string>;
53
+ /** What a run of keys is, before either of the two above. */
54
+ export declare const groupBaseClasses: string;
@@ -1,2 +1,2 @@
1
- import*as t from"react";export const ButtonGroupContext=
2
- /* @__PURE__ */t.createContext(null);
1
+ import*as o from"react";export const ButtonGroupContext=
2
+ /* @__PURE__ */o.createContext(null);export const groupJoinClasses={horizontal:"[&>*:not(:first-child)]:rounded-s-none [&>*:not(:last-child)]:rounded-e-none",vertical:"[&>*:not(:first-child)]:rounded-t-none [&>*:not(:last-child)]:rounded-b-none"};export const groupOverlapClasses={horizontal:"[&>*:not(:first-child)]:-ms-px",vertical:"[&>*:not(:first-child)]:-mt-px"};export const groupBaseClasses=/* @__PURE__ */["inline-flex align-middle","[&>*]:relative [&>*:hover]:z-10 [&>*:focus-visible]:z-10","[&>*]:shrink-0"].join(" ");
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { type PlassLabels } from './labels.js';
2
3
  import { type CalendarView, type TimeUnit } from './date.js';
3
4
  import type { PlassColor, PlassDensity, PlassSize, PlassWeekday } from '../types.js';
4
5
  /**
@@ -19,43 +20,17 @@ import type { PlassColor, PlassDensity, PlassSize, PlassWeekday } from '../types
19
20
  /**
20
21
  * Every string a picker says that is not a date.
21
22
  *
22
- * One object rather than eighteen props. These are a set: a caller who has to
23
- * translate "Previous month" has to translate "Next month" in the same breath,
24
- * and a component with eighteen `*Label` props is a component whose signature is
25
- * mostly apology. The dates themselves are never in here those come from
26
- * `Intl`, which already knows what July is called in more languages than this
27
- * file ever will.
23
+ * A slice of `PlassLabels` rather than a set of its own, which it used to be:
24
+ * the words were collected here first, and when the rest of the library's own
25
+ * vocabulary was gathered they went in beside them. The type stays, because
26
+ * the pickers are the one place that needs *all* of these and nothing else, and
27
+ * because a caller who has only translated a picker still has a name for what
28
+ * they translated.
29
+ *
30
+ * The dates themselves are never in here — those come from `Intl`, which
31
+ * already knows what July is called in more languages than this file ever will.
28
32
  */
29
- export interface PlassPickerLabels {
30
- /** The calendar's steppers, in day view. */
31
- previousMonth: string;
32
- nextMonth: string;
33
- /** The same steppers in month view, where they move by a year. */
34
- previousYear: string;
35
- nextYear: string;
36
- /** And in year view, where they move by a page of twelve. */
37
- previousYears: string;
38
- nextYears: string;
39
- /** The two header buttons that open the month grid and the year grid. */
40
- chooseMonth: string;
41
- chooseYear: string;
42
- /** The footer's actions. */
43
- today: string;
44
- /** The same shortcut on a picker that only asks for a month or a year. */
45
- thisMonth: string;
46
- thisYear: string;
47
- now: string;
48
- clear: string;
49
- done: string;
50
- /** The clock's columns. */
51
- hour: string;
52
- minute: string;
53
- second: string;
54
- meridiem: string;
55
- /** Which end of a range the calendar is currently asking for. */
56
- start: string;
57
- end: string;
58
- }
33
+ export type PlassPickerLabels = Pick<PlassLabels, 'previousMonth' | 'nextMonth' | 'previousYear' | 'nextYear' | 'previousYears' | 'nextYears' | 'chooseMonth' | 'chooseYear' | 'today' | 'thisMonth' | 'thisYear' | 'now' | 'clear' | 'done' | 'hour' | 'minute' | 'second' | 'meridiem' | 'start' | 'end'>;
59
34
  export declare const defaultPickerLabels: PlassPickerLabels;
60
35
  /**
61
36
  * The labels a picker says, resolved once per render.
@@ -1 +1 @@
1
- import{jsx as e,jsxs as o}from"react/jsx-runtime";import*as t from"react";import{useDefaults as r}from"./defaults.js";import{PlButton as s}from"../components/button/PlButton.js";import{ChevronIcon as n}from"./icons.js";import{dateFormatter as l}from"./format.js";import{addDays as a,addMonths as i,addYears as c,calendarWeeks as u,compareDay as d,isDayOutside as m,isMonthBeforeYear as h,isMonthOutside as p,isSameDay as g,isSameMonth as f,isValidDate as v,isYearOutside as x,makeDate as b,meridiemLabels as y,monthLabels as w,startOfDay as D,startOfMonth as N,today as M,weekdayLabels as C,withTime as S,YEAR_PAGE_SIZE as P,yearPageStart as k}from"./date.js";import{controlHeightClasses as Y,controlTextClasses as z,cx as A,gapClasses as j,metaTextClasses as E,srOnlyClasses as F,transitionClasses as T}from"./styles.js";export const defaultPickerLabels={previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",today:"Today",thisMonth:"This month",thisYear:"This year",now:"Now",clear:"Clear",done:"Done",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End"};export function usePickerLabels(e){const{labels:o}=r();return t.useMemo(()=>o||e?{...defaultPickerLabels,...o,...e}:defaultPickerLabels,[o,e])}const H={year:0,month:1,day:2},R={xs:"1.5rem",sm:"2rem",md:"2.5rem",lg:"3rem",xl:"3.5rem"},B={xs:"rounded-(--plass-radius-xs)",sm:"rounded-(--plass-radius-xs)",md:"rounded-(--plass-radius-sm)",lg:"rounded-(--plass-radius-md)",xl:"rounded-(--plass-radius-lg)"},L={xs:"rounded-s-(--plass-radius-xs)",sm:"rounded-s-(--plass-radius-xs)",md:"rounded-s-(--plass-radius-sm)",lg:"rounded-s-(--plass-radius-md)",xl:"rounded-s-(--plass-radius-lg)"},G={xs:"rounded-e-(--plass-radius-xs)",sm:"rounded-e-(--plass-radius-xs)",md:"rounded-e-(--plass-radius-sm)",lg:"rounded-e-(--plass-radius-md)",xl:"rounded-e-(--plass-radius-lg)"},K=/* @__PURE__ */["relative flex items-center justify-center tabular-nums select-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",T,"focus-visible:z-10 focus-visible:[outline:2px_solid_var(--p-ring)]","focus-visible:[outline-offset:-2px]"].join(" ");function Cell({children:t,label:r,selected:s,inRange:n=!1,rangeEdge:l=null,current:a=!1,muted:i=!1,disabled:c=!1,focused:u=!1,size:d,className:m,onClick:h,onPointerEnter:p,onKeyDown:g}){return o("button",{type:"button",role:"gridcell","aria-label":r,"aria-selected":s,"aria-current":a?"date":void 0,"aria-disabled":c||void 0,tabIndex:u?0:-1,"data-focus-target":u?"true":void 0,className:A(K,"start"===l?L[d]:"end"===l?G[d]:"middle"===l?"rounded-none":B[d],c?"cursor-not-allowed text-(--plass-muted-fg) opacity-50":s?"cursor-pointer font-semibold text-(--p-on-solid) [background-image:var(--p-fill)] hover:brightness-105 active:brightness-95":n?"cursor-pointer bg-(--p-soft) text-(--plass-fg) hover:bg-(--p-soft-hover) active:bg-(--p-soft-press)":a?"cursor-pointer font-semibold text-(--p-accent) hover:bg-(--p-soft) active:bg-(--p-soft-hover)":i?"cursor-pointer text-(--plass-muted-fg) hover:bg-(--p-soft) active:bg-(--p-soft-hover)":"cursor-pointer text-(--plass-fg) hover:bg-(--p-soft) active:bg-(--p-soft-hover)",m),onClick:()=>{c||h()},onPointerEnter:p,onKeyDown:g,children:[t,a?e("span",{"aria-hidden":"true",className:"absolute bottom-[0.18em] size-[0.22em] rounded-full bg-current"}):null]})}function Header({size:r,color:l,view:a,precision:i,month:c,locale:u,labels:d,showPreviousButton:m,showNextButton:p,onStep:g,onViewChange:f}){const v=w(u,"long")[c.getMonth()],x=String(c.getFullYear()),b=h(u),y="day"===a?[d.previousMonth,d.nextMonth]:"month"===a?[d.previousYear,d.nextYear]:[d.previousYears,d.nextYears],stepper=(o,t)=>t?e(s,{variant:"ghost",size:r,color:l,density:"compact","aria-label":y[-1===o?0:1],onClick:()=>g(o),startIcon:e("span",{className:A("flex items-center",-1===o?"rotate-90 rtl:-rotate-90":"-rotate-90 rtl:rotate-90"),children:e(n,{})})}):e("span",{"aria-hidden":"true",className:A(Y[r],"w-(--p-cell)")}),disclosure=o=>e("span",{className:A("flex items-center text-(--plass-muted-fg)","[transition:rotate_var(--plass-duration)_var(--plass-ease)]",o&&"rotate-180"),children:e(n,{})}),D=e(s,{variant:"ghost",size:r,color:l,density:"compact","aria-label":d.chooseMonth,"aria-expanded":"month"===a,onClick:()=>f("month"===a?i:"month"),endIcon:disclosure("month"===a),children:v},"month"),N=e(s,{variant:"ghost",size:r,color:l,density:"compact",className:"tabular-nums","aria-label":d.chooseYear,"aria-expanded":"year"===a,onClick:()=>f("year"===a?i:"year"),endIcon:disclosure("year"===a),children:x},"year"),M=k(c.getFullYear());return o("div",{className:"flex items-center justify-between gap-1",children:[stepper(-1,m),e("div",{className:A("flex min-w-0 flex-1 items-center justify-center",j[r]),children:"year"===a?e("span",{className:A("flex items-center font-semibold tabular-nums text-(--plass-fg)",Y[r],z[r]),children:`${M}–${M+P-1}`}):"month"===a?N:o(t.Fragment,b?{children:[D,N]}:{children:[N,D]})}),stepper(1,p)]})}export function Calendar({size:r,color:s,locale:n,weekStartsOn:l,month:a,onMonthChange:u,precision:d="day",selected:h,rangeStart:p=null,rangeEnd:g=null,onSelect:x,onPreviewChange:y,minDate:w,maxDate:C,shouldDisableDate:S,showOutsideDays:k=!0,autoFocus:Y=!1,showPreviousButton:z=!0,showNextButton:E=!0,labels:F,className:T}){const[B,L]=t.useState(d),G=H[B]>H[d]?d:B,K=t.useMemo(()=>h.filter(v),[h]),[I,O]=t.useState(()=>{const e=K.find(e=>f(e,a));return e?D(e):f(M(),a)?M():N(a)}),U=t.useRef(Y),q=t.useRef(null);t.useEffect(()=>{O(e=>f(e,a)?e:N(a))},[a]),t.useLayoutEffect(()=>{U.current&&(U.current=!1,q.current?.querySelector('[data-focus-target="true"]')?.focus({preventScroll:!0}))});const $=t.useCallback(e=>m(e,w,C)||(S?.(e)??!1),[w,C,S]),changeView=e=>{U.current=!0,L(e)},moveCursor=e=>{U.current=!0,u(e)};return o("div",{ref:q,className:A("flex flex-col",j[r],T),style:{"--p-cell":R[r]},onPointerLeave:()=>y?.(null),children:[e(Header,{size:r,color:s,view:G,precision:d,month:a,locale:n,labels:F,showPreviousButton:z,showNextButton:E,onStep:e=>{u("day"===G?i(a,e):c(a,"month"===G?e:e*P))},onViewChange:changeView}),e("div",{className:"h-[calc(var(--p-cell)*7)] w-[calc(var(--p-cell)*7)]",children:"day"===G?e(DayGrid,{size:r,locale:n,weekStartsOn:l,month:a,chosen:K,rangeStart:p,rangeEnd:g,focusedDate:I,showOutsideDays:k,isDisabled:$,onSelect:e=>{O(e),x(e)},onPreviewChange:y,onMoveFocus:e=>{U.current=!0,O(e),f(e,a)||u(N(e))}}):"month"===G?e(MonthGrid,{size:r,locale:n,month:a,chosen:K,minDate:w,maxDate:C,onMoveCursor:moveCursor,onPick:e=>{const o=b(a.getFullYear(),e,1);u(o),"month"===d?x(o):changeView("day")}}):e(YearGrid,{size:r,month:a,chosen:K,minDate:w,maxDate:C,onMoveCursor:moveCursor,onPick:e=>{const o=b(e,"year"===d?0:a.getMonth(),1);u(o),"year"===d?x(o):changeView("month")}})})]})}function DayGrid({size:t,locale:r,weekStartsOn:s,month:n,chosen:c,rangeStart:m,rangeEnd:h,focusedDate:p,showOutsideDays:x,isDisabled:b,onSelect:y,onPreviewChange:w,onMoveFocus:D}){const N=u(n,s),S=C(r,s,"short"),P=C(r,s,"long"),k=l(r,{dateStyle:"full"}),Y=function orderedRange(e,o){return v(e)&&v(o)?d(e,o)<=0?[e,o]:[o,e]:null}(m,h),j=M();return o("div",{role:"grid",className:"flex h-full flex-col",children:[e("div",{role:"row",className:"grid grid-cols-7",children:S.map((o,r)=>e("span",{role:"columnheader","aria-label":P[r],className:A("flex h-(--p-cell) items-center justify-center font-semibold text-(--plass-muted-fg) select-none",E[t]),children:o},r))}),N.map((o,r)=>e("div",{role:"row",className:"grid grid-cols-7",children:o.map(o=>{const r=!f(o,n);if(r&&!x)return e("span",{role:"gridcell","aria-hidden":"true",className:"size-(--p-cell)"},o.getTime());const l=c.some(e=>g(e,o)),u=null!==Y&&d(o,Y[0])>=0&&d(o,Y[1])<=0,m=null!==Y&&u&&g(o,Y[0]),h=null!==Y&&u&&g(o,Y[1]);return e(Cell,{size:t,label:k.format(o),selected:l,inRange:u&&!l,rangeEdge:u?m&&h?"both":m?"start":h?"end":"middle":null,current:g(o,j)&&!l,muted:r,disabled:b(o),focused:g(o,p),className:A("size-(--p-cell)",z[t]),onClick:()=>y(o),onPointerEnter:()=>w?.(o),onKeyDown:e=>((e,o)=>{const t=(o.getDay()-s+7)%7,r={ArrowLeft:()=>a(o,-1),ArrowRight:()=>a(o,1),ArrowUp:()=>a(o,-7),ArrowDown:()=>a(o,7),Home:()=>a(o,-t),End:()=>a(o,6-t),PageUp:()=>i(o,e.shiftKey?-12:-1),PageDown:()=>i(o,e.shiftKey?12:1)}[e.key];r&&(e.preventDefault(),D(r()))})(e,o),children:o.getDate()},o.getTime())})},r))]})}function MonthGrid({size:o,locale:t,month:r,chosen:s,minDate:n,maxDate:l,onMoveCursor:a,onPick:c}){const u=w(t,"short"),d=w(t,"long"),m=r.getFullYear(),h=new Date,onKeyDown=e=>{const o={ArrowLeft:-1,ArrowRight:1,ArrowUp:-3,ArrowDown:3,PageUp:-12,PageDown:12}[e.key];void 0!==o&&(e.preventDefault(),a(i(N(r),o)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2,3].map(t=>e("div",{role:"row",className:"grid grid-cols-3 gap-1",children:[0,1,2].map(a=>{const i=3*t+a;return e(Cell,{size:o,label:`${d[i]} ${m}`,selected:s.some(e=>e.getFullYear()===m&&e.getMonth()===i),current:h.getFullYear()===m&&h.getMonth()===i,disabled:p(b(m,i,1),n,l),focused:i===r.getMonth(),className:A("h-(--p-cell) w-full",z[o]),onClick:()=>c(i),onKeyDown,children:u[i]},i)})},t))})}function YearGrid({size:o,month:t,chosen:r,minDate:s,maxDate:n,onMoveCursor:l,onPick:a}){const i=k(t.getFullYear()),u=(new Date).getFullYear(),onKeyDown=e=>{const o={ArrowLeft:-1,ArrowRight:1,ArrowUp:-4,ArrowDown:4,PageUp:-P,PageDown:P}[e.key];void 0!==o&&(e.preventDefault(),l(c(N(t),o)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2].map(l=>e("div",{role:"row",className:"grid grid-cols-4 gap-1",children:[0,1,2,3].map(c=>{const d=i+4*l+c;return e(Cell,{size:o,label:String(d),selected:r.some(e=>e.getFullYear()===d),current:d===u,disabled:x(b(d,0,1),s,n),focused:d===t.getFullYear(),className:A("h-(--p-cell) w-full",z[o]),onClick:()=>a(d),onKeyDown,children:d},d)})},l))})}function revealInColumn(e){const o=e.parentElement;if(!o)return;const t=e.getBoundingClientRect(),r=o.getBoundingClientRect(),s=t.top-r.top-o.clientTop+o.scrollTop,n=s+t.height;s<o.scrollTop?o.scrollTop=s:n>o.scrollTop+o.clientHeight&&(o.scrollTop=n-o.clientHeight)}export function TimeGrid({size:r,density:s,locale:n,value:a,referenceDate:i,onChange:c,hour12:u,showSeconds:d,hourStep:m,minuteStep:h,secondStep:p,shouldDisableTime:g,autoFocus:f=!1,labels:v,className:x}){const b=a??i,w=t.useRef(null),[D,N]=t.useMemo(()=>y(n),[n]);t.useEffect(()=>{const e=w.current;if(e?.querySelectorAll('[data-chosen="true"]').forEach(revealInColumn),f){const o=e?.querySelector('[role="listbox"]');(o?.querySelector('[data-chosen="true"]')??o?.querySelector('[role="option"]'))?.focus({preventScroll:!0})}},[f]);const M=t.useMemo(()=>{const e=Math.ceil((u?12:24)/m),o=Array.from({length:e},(e,o)=>o*m);return u?o.map(e=>0===e?12:e):o},[u,m]),C=t.useMemo(()=>Array.from({length:Math.ceil(60/h)},(e,o)=>o*h),[h]),P=t.useMemo(()=>Array.from({length:Math.ceil(60/p)},(e,o)=>o*p),[p]),pad=e=>String(e).padStart(2,"0"),k=u?b.getHours()%12||12:b.getHours(),column=(o,t,s,n,l)=>e("div",{role:"listbox","aria-label":t,className:A("flex flex-col gap-0.5 overflow-y-auto overscroll-contain","h-[calc(var(--p-cell)*7)] w-[calc(var(--p-cell)*1.75)]","scroll-py-0.5 [scrollbar-width:thin]"),children:s.map(t=>{const s=((e,o)=>S(b,"hour"===e?{hours:u?o%12+(b.getHours()>=12?12:0):o}:"minute"===e?{minutes:o}:"second"===e?{seconds:o}:{hours:b.getHours()%12+12*o}))(o,t),i=null!==a&&n(t),d=g?.(s,o)??!1;return e("button",{type:"button",role:"option","aria-selected":i,"aria-disabled":d||void 0,"data-chosen":i?"true":void 0,className:A(K,B[r],Y[r],z[r],"w-full shrink-0",d?"cursor-not-allowed text-(--plass-muted-fg) opacity-50":i?"cursor-pointer font-semibold text-(--p-on-solid) [background-image:var(--p-fill)] hover:brightness-105 active:brightness-95":"cursor-pointer text-(--plass-fg) hover:bg-(--p-soft) active:bg-(--p-soft-hover)"),onClick:()=>{d||c(s)},children:l(t)},t)})},o);return o("div",{ref:w,className:A("flex","compact"===s?"gap-0.5":"gap-1",x),style:{"--p-cell":R[r]},children:[column("hour",v.hour,M,e=>e===k,e=>u?String(e):pad(e)),column("minute",v.minute,C,e=>e===b.getMinutes(),pad),d?column("second",v.second,P,e=>e===b.getSeconds(),pad):null,u?column("meridiem",v.meridiem,[0,1],e=>(b.getHours()>=12?1:0)===e,e=>0===e?D:N):null,e("span",{className:F,"aria-live":"polite",children:null===a?"":l(n,{hour:"numeric",minute:"2-digit",...d?{second:"2-digit"}:{}}).format(a)})]})}
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{defaultLabels as r,useLabels as s}from"./labels.js";import{PlButton as n}from"../components/button/PlButton.js";import{ChevronIcon as l}from"./icons.js";import{dateFormatter as a}from"./format.js";import{addDays as i,addMonths as c,addYears as u,calendarWeeks as d,compareDay as m,isDayOutside as h,isMonthBeforeYear as p,isMonthOutside as g,isSameDay as f,isSameMonth as v,isValidDate as b,isYearOutside as x,makeDate as w,meridiemLabels as y,monthLabels as D,startOfDay as N,startOfMonth as S,today as C,weekdayLabels as M,withTime as k,YEAR_PAGE_SIZE as P,yearPageStart as z}from"./date.js";import{controlHeightClasses as Y,controlTextClasses as j,cx as A,gapClasses as F,metaTextClasses as E,srOnlyClasses as R,transitionClasses as H}from"./styles.js";export const defaultPickerLabels=r;export function usePickerLabels(e){const t=s();return o.useMemo(()=>e?{...t,...e}:t,[t,e])}const T={year:0,month:1,day:2},B={xs:"1.5rem",sm:"2rem",md:"2.5rem",lg:"3rem",xl:"3.5rem"},G={xs:"rounded-(--plass-radius-xs)",sm:"rounded-(--plass-radius-xs)",md:"rounded-(--plass-radius-sm)",lg:"rounded-(--plass-radius-md)",xl:"rounded-(--plass-radius-lg)"},K={xs:"rounded-s-(--plass-radius-xs)",sm:"rounded-s-(--plass-radius-xs)",md:"rounded-s-(--plass-radius-sm)",lg:"rounded-s-(--plass-radius-md)",xl:"rounded-s-(--plass-radius-lg)"},L={xs:"rounded-e-(--plass-radius-xs)",sm:"rounded-e-(--plass-radius-xs)",md:"rounded-e-(--plass-radius-sm)",lg:"rounded-e-(--plass-radius-md)",xl:"rounded-e-(--plass-radius-lg)"},I=/* @__PURE__ */["relative flex items-center justify-center tabular-nums select-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",H,"focus-visible:z-10 focus-visible:[outline:2px_solid_var(--p-ring)]","focus-visible:[outline-offset:-2px]"].join(" ");function Cell({children:o,label:r,selected:s,inRange:n=!1,rangeEdge:l=null,current:a=!1,muted:i=!1,disabled:c=!1,focused:u=!1,size:d,className:m,onClick:h,onPointerEnter:p,onKeyDown:g}){return t("button",{type:"button",role:"gridcell","aria-label":r,"aria-selected":s,"aria-current":a?"date":void 0,"aria-disabled":c||void 0,tabIndex:u?0:-1,"data-focus-target":u?"true":void 0,className:A(I,"start"===l?K[d]:"end"===l?L[d]:"middle"===l?"rounded-none":G[d],c?"cursor-not-allowed text-(--plass-muted-fg) opacity-50":s?"cursor-pointer font-semibold text-(--p-on-solid) [background-image:var(--p-fill)] hover:brightness-105 active:brightness-95":n?"cursor-pointer bg-(--p-soft) text-(--plass-fg) hover:bg-(--p-soft-hover) active:bg-(--p-soft-press)":a?"cursor-pointer font-semibold text-(--p-accent) hover:bg-(--p-soft) active:bg-(--p-soft-hover)":i?"cursor-pointer text-(--plass-muted-fg) hover:bg-(--p-soft) active:bg-(--p-soft-hover)":"cursor-pointer text-(--plass-fg) hover:bg-(--p-soft) active:bg-(--p-soft-hover)",m),onClick:()=>{c||h()},onPointerEnter:p,onKeyDown:g,children:[o,a?e("span",{"aria-hidden":"true",className:"absolute bottom-[0.18em] size-[0.22em] rounded-full bg-current"}):null]})}function Header({size:r,color:s,view:a,precision:i,month:c,locale:u,labels:d,showPreviousButton:m,showNextButton:h,onStep:g,onViewChange:f}){const v=D(u,"long")[c.getMonth()],b=String(c.getFullYear()),x=p(u),w="day"===a?[d.previousMonth,d.nextMonth]:"month"===a?[d.previousYear,d.nextYear]:[d.previousYears,d.nextYears],stepper=(t,o)=>o?e(n,{variant:"ghost",size:r,color:s,density:"compact","aria-label":w[-1===t?0:1],onClick:()=>g(t),startIcon:e("span",{className:A("flex items-center",-1===t?"rotate-90 rtl:-rotate-90":"-rotate-90 rtl:rotate-90"),children:e(l,{})})}):e("span",{"aria-hidden":"true",className:A(Y[r],"w-(--p-cell)")}),disclosure=t=>e("span",{className:A("flex items-center text-(--plass-muted-fg)","[transition:rotate_var(--plass-duration)_var(--plass-ease)]",t&&"rotate-180"),children:e(l,{})}),y=e(n,{variant:"ghost",size:r,color:s,density:"compact","aria-label":d.chooseMonth,"aria-expanded":"month"===a,onClick:()=>f("month"===a?i:"month"),endIcon:disclosure("month"===a),children:v},"month"),N=e(n,{variant:"ghost",size:r,color:s,density:"compact",className:"tabular-nums","aria-label":d.chooseYear,"aria-expanded":"year"===a,onClick:()=>f("year"===a?i:"year"),endIcon:disclosure("year"===a),children:b},"year"),S=z(c.getFullYear());return t("div",{className:"flex items-center justify-between gap-1",children:[stepper(-1,m),e("div",{className:A("flex min-w-0 flex-1 items-center justify-center",F[r]),children:"year"===a?e("span",{className:A("flex items-center font-semibold tabular-nums text-(--plass-fg)",Y[r],j[r]),children:`${S}–${S+P-1}`}):"month"===a?N:t(o.Fragment,x?{children:[y,N]}:{children:[N,y]})}),stepper(1,h)]})}export function Calendar({size:r,color:s,locale:n,weekStartsOn:l,month:a,onMonthChange:i,precision:d="day",selected:m,rangeStart:p=null,rangeEnd:g=null,onSelect:f,onPreviewChange:x,minDate:y,maxDate:D,shouldDisableDate:M,showOutsideDays:k=!0,autoFocus:z=!1,showPreviousButton:Y=!0,showNextButton:j=!0,labels:E,className:R}){const[H,G]=o.useState(d),K=T[H]>T[d]?d:H,L=o.useMemo(()=>m.filter(b),[m]),[I,O]=o.useState(()=>{const e=L.find(e=>v(e,a));return e?N(e):v(C(),a)?C():S(a)}),U=o.useRef(z),q=o.useRef(null);o.useEffect(()=>{O(e=>v(e,a)?e:S(a))},[a]),o.useLayoutEffect(()=>{U.current&&(U.current=!1,q.current?.querySelector('[data-focus-target="true"]')?.focus({preventScroll:!0}))});const $=o.useCallback(e=>h(e,y,D)||(M?.(e)??!1),[y,D,M]),changeView=e=>{U.current=!0,G(e)},moveCursor=e=>{U.current=!0,i(e)};return t("div",{ref:q,className:A("flex flex-col",F[r],R),style:{"--p-cell":B[r]},onPointerLeave:()=>x?.(null),children:[e(Header,{size:r,color:s,view:K,precision:d,month:a,locale:n,labels:E,showPreviousButton:Y,showNextButton:j,onStep:e=>{i("day"===K?c(a,e):u(a,"month"===K?e:e*P))},onViewChange:changeView}),e("div",{className:"h-[calc(var(--p-cell)*7)] w-[calc(var(--p-cell)*7)]",children:"day"===K?e(DayGrid,{size:r,locale:n,weekStartsOn:l,month:a,chosen:L,rangeStart:p,rangeEnd:g,focusedDate:I,showOutsideDays:k,isDisabled:$,onSelect:e=>{O(e),f(e)},onPreviewChange:x,onMoveFocus:e=>{U.current=!0,O(e),v(e,a)||i(S(e))}}):"month"===K?e(MonthGrid,{size:r,locale:n,month:a,chosen:L,minDate:y,maxDate:D,onMoveCursor:moveCursor,onPick:e=>{const t=w(a.getFullYear(),e,1);i(t),"month"===d?f(t):changeView("day")}}):e(YearGrid,{size:r,month:a,chosen:L,minDate:y,maxDate:D,onMoveCursor:moveCursor,onPick:e=>{const t=w(e,"year"===d?0:a.getMonth(),1);i(t),"year"===d?f(t):changeView("month")}})})]})}function DayGrid({size:o,locale:r,weekStartsOn:s,month:n,chosen:l,rangeStart:u,rangeEnd:h,focusedDate:p,showOutsideDays:g,isDisabled:x,onSelect:w,onPreviewChange:y,onMoveFocus:D}){const N=d(n,s),S=M(r,s,"short"),k=M(r,s,"long"),P=a(r,{dateStyle:"full"}),z=function orderedRange(e,t){return b(e)&&b(t)?m(e,t)<=0?[e,t]:[t,e]:null}(u,h),Y=C();return t("div",{role:"grid",className:"flex h-full flex-col",children:[e("div",{role:"row",className:"grid grid-cols-7",children:S.map((t,r)=>e("span",{role:"columnheader","aria-label":k[r],className:A("flex h-(--p-cell) items-center justify-center font-semibold text-(--plass-muted-fg) select-none",E[o]),children:t},r))}),N.map((t,r)=>e("div",{role:"row",className:"grid grid-cols-7",children:t.map(t=>{const r=!v(t,n);if(r&&!g)return e("span",{role:"gridcell","aria-hidden":"true",className:"size-(--p-cell)"},t.getTime());const a=l.some(e=>f(e,t)),u=null!==z&&m(t,z[0])>=0&&m(t,z[1])<=0,d=null!==z&&u&&f(t,z[0]),h=null!==z&&u&&f(t,z[1]);return e(Cell,{size:o,label:P.format(t),selected:a,inRange:u&&!a,rangeEdge:u?d&&h?"both":d?"start":h?"end":"middle":null,current:f(t,Y)&&!a,muted:r,disabled:x(t),focused:f(t,p),className:A("size-(--p-cell)",j[o]),onClick:()=>w(t),onPointerEnter:()=>y?.(t),onKeyDown:e=>((e,t)=>{const o=(t.getDay()-s+7)%7,r={ArrowLeft:()=>i(t,-1),ArrowRight:()=>i(t,1),ArrowUp:()=>i(t,-7),ArrowDown:()=>i(t,7),Home:()=>i(t,-o),End:()=>i(t,6-o),PageUp:()=>c(t,e.shiftKey?-12:-1),PageDown:()=>c(t,e.shiftKey?12:1)}[e.key];r&&(e.preventDefault(),D(r()))})(e,t),children:t.getDate()},t.getTime())})},r))]})}function MonthGrid({size:t,locale:o,month:r,chosen:s,minDate:n,maxDate:l,onMoveCursor:a,onPick:i}){const u=D(o,"short"),d=D(o,"long"),m=r.getFullYear(),h=new Date,onKeyDown=e=>{const t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-3,ArrowDown:3,PageUp:-12,PageDown:12}[e.key];void 0!==t&&(e.preventDefault(),a(c(S(r),t)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2,3].map(o=>e("div",{role:"row",className:"grid grid-cols-3 gap-1",children:[0,1,2].map(a=>{const c=3*o+a;return e(Cell,{size:t,label:`${d[c]} ${m}`,selected:s.some(e=>e.getFullYear()===m&&e.getMonth()===c),current:h.getFullYear()===m&&h.getMonth()===c,disabled:g(w(m,c,1),n,l),focused:c===r.getMonth(),className:A("h-(--p-cell) w-full",j[t]),onClick:()=>i(c),onKeyDown,children:u[c]},c)})},o))})}function YearGrid({size:t,month:o,chosen:r,minDate:s,maxDate:n,onMoveCursor:l,onPick:a}){const i=z(o.getFullYear()),c=(new Date).getFullYear(),onKeyDown=e=>{const t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-4,ArrowDown:4,PageUp:-P,PageDown:P}[e.key];void 0!==t&&(e.preventDefault(),l(u(S(o),t)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2].map(l=>e("div",{role:"row",className:"grid grid-cols-4 gap-1",children:[0,1,2,3].map(u=>{const d=i+4*l+u;return e(Cell,{size:t,label:String(d),selected:r.some(e=>e.getFullYear()===d),current:d===c,disabled:x(w(d,0,1),s,n),focused:d===o.getFullYear(),className:A("h-(--p-cell) w-full",j[t]),onClick:()=>a(d),onKeyDown,children:d},d)})},l))})}function revealInColumn(e){const t=e.parentElement;if(!t)return;const o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s=o.top-r.top-t.clientTop+t.scrollTop,n=s+o.height;s<t.scrollTop?t.scrollTop=s:n>t.scrollTop+t.clientHeight&&(t.scrollTop=n-t.clientHeight)}export function TimeGrid({size:r,density:s,locale:n,value:l,referenceDate:i,onChange:c,hour12:u,showSeconds:d,hourStep:m,minuteStep:h,secondStep:p,shouldDisableTime:g,autoFocus:f=!1,labels:v,className:b}){const x=l??i,w=o.useRef(null),[D,N]=o.useMemo(()=>y(n),[n]);o.useEffect(()=>{const e=w.current;if(e?.querySelectorAll('[data-chosen="true"]').forEach(revealInColumn),f){const t=e?.querySelector('[role="listbox"]');(t?.querySelector('[data-chosen="true"]')??t?.querySelector('[role="option"]'))?.focus({preventScroll:!0})}},[f]);const S=o.useMemo(()=>{const e=Math.ceil((u?12:24)/m),t=Array.from({length:e},(e,t)=>t*m);return u?t.map(e=>0===e?12:e):t},[u,m]),C=o.useMemo(()=>Array.from({length:Math.ceil(60/h)},(e,t)=>t*h),[h]),M=o.useMemo(()=>Array.from({length:Math.ceil(60/p)},(e,t)=>t*p),[p]),pad=e=>String(e).padStart(2,"0"),P=u?x.getHours()%12||12:x.getHours(),column=(t,o,s,n,a)=>e("div",{role:"listbox","aria-label":o,className:A("flex flex-col gap-0.5 overflow-y-auto overscroll-contain","h-[calc(var(--p-cell)*7)] w-[calc(var(--p-cell)*1.75)]","scroll-py-0.5 [scrollbar-width:thin]"),children:s.map(o=>{const s=((e,t)=>k(x,"hour"===e?{hours:u?t%12+(x.getHours()>=12?12:0):t}:"minute"===e?{minutes:t}:"second"===e?{seconds:t}:{hours:x.getHours()%12+12*t}))(t,o),i=null!==l&&n(o),d=g?.(s,t)??!1;return e("button",{type:"button",role:"option","aria-selected":i,"aria-disabled":d||void 0,"data-chosen":i?"true":void 0,className:A(I,G[r],Y[r],j[r],"w-full shrink-0",d?"cursor-not-allowed text-(--plass-muted-fg) opacity-50":i?"cursor-pointer font-semibold text-(--p-on-solid) [background-image:var(--p-fill)] hover:brightness-105 active:brightness-95":"cursor-pointer text-(--plass-fg) hover:bg-(--p-soft) active:bg-(--p-soft-hover)"),onClick:()=>{d||c(s)},children:a(o)},o)})},t);return t("div",{ref:w,className:A("flex","compact"===s?"gap-0.5":"gap-1",b),style:{"--p-cell":B[r]},children:[column("hour",v.hour,S,e=>e===P,e=>u?String(e):pad(e)),column("minute",v.minute,C,e=>e===x.getMinutes(),pad),d?column("second",v.second,M,e=>e===x.getSeconds(),pad):null,u?column("meridiem",v.meridiem,[0,1],e=>(x.getHours()>=12?1:0)===e,e=>0===e?D:N):null,e("span",{className:R,"aria-live":"polite",children:null===l?"":a(n,{hour:"numeric",minute:"2-digit",...d?{second:"2-digit"}:{}}).format(l)})]})}