@rinzai/zen 0.14.0 → 0.16.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 (225) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/README.md +16 -1
  3. package/dist/animated-number/index.js +14 -14
  4. package/dist/breadcrumbs/index.js +14 -14
  5. package/dist/calendar/index.js +29 -29
  6. package/dist/calendar-heatmap/index.js +12 -12
  7. package/dist/canvas/index.js +19 -19
  8. package/dist/carousel/index.d.ts.map +1 -1
  9. package/dist/carousel/index.js +29 -29
  10. package/dist/chart/index.js +7 -7
  11. package/dist/code-block/index.js +5 -5
  12. package/dist/collapse/index.js +6 -6
  13. package/dist/color-picker/index.js +10 -10
  14. package/dist/combobox/index.js +61 -61
  15. package/dist/command-palette/index.js +5 -5
  16. package/dist/confirm-dialog/index.js +4 -4
  17. package/dist/date-picker/index.js +15 -15
  18. package/dist/dialog/index.d.ts.map +1 -1
  19. package/dist/dialog/index.js +45 -65
  20. package/dist/docs/README.md +205 -0
  21. package/dist/docs/accordion.md +122 -0
  22. package/dist/docs/alert.md +69 -0
  23. package/dist/docs/animated-number.md +105 -0
  24. package/dist/docs/avatar.md +91 -0
  25. package/dist/docs/backdrop.md +94 -0
  26. package/dist/docs/badge.md +37 -0
  27. package/dist/docs/breadcrumbs.md +44 -0
  28. package/dist/docs/button-group.md +76 -0
  29. package/dist/docs/button.md +131 -0
  30. package/dist/docs/calendar-heatmap.md +73 -0
  31. package/dist/docs/calendar.md +101 -0
  32. package/dist/docs/canvas.md +584 -0
  33. package/dist/docs/card.md +180 -0
  34. package/dist/docs/carousel.md +162 -0
  35. package/dist/docs/chart.md +325 -0
  36. package/dist/docs/checkbox.md +88 -0
  37. package/dist/docs/chip.md +52 -0
  38. package/dist/docs/code-block.md +116 -0
  39. package/dist/docs/code-input.md +52 -0
  40. package/dist/docs/collapse.md +46 -0
  41. package/dist/docs/color-picker.md +145 -0
  42. package/dist/docs/combobox.md +208 -0
  43. package/dist/docs/command-palette.md +65 -0
  44. package/dist/docs/date-picker.md +167 -0
  45. package/dist/docs/dialog.md +271 -0
  46. package/dist/docs/disclosure.md +88 -0
  47. package/dist/docs/editable-cell.md +90 -0
  48. package/dist/docs/empty-state.md +46 -0
  49. package/dist/docs/field.md +82 -0
  50. package/dist/docs/file-drop.md +44 -0
  51. package/dist/docs/filter-bar.md +66 -0
  52. package/dist/docs/header.md +51 -0
  53. package/dist/docs/hover-card.md +110 -0
  54. package/dist/docs/icon-picker.md +65 -0
  55. package/dist/docs/input-group.md +89 -0
  56. package/dist/docs/input.md +33 -0
  57. package/dist/docs/inset.md +57 -0
  58. package/dist/docs/kbd.md +34 -0
  59. package/dist/docs/keypad.md +51 -0
  60. package/dist/docs/load-more.md +66 -0
  61. package/dist/docs/locale-provider.md +99 -0
  62. package/dist/docs/marquee.md +86 -0
  63. package/dist/docs/menu.md +456 -0
  64. package/dist/docs/meter.md +102 -0
  65. package/dist/docs/money-input.md +169 -0
  66. package/dist/docs/month-picker.md +80 -0
  67. package/dist/docs/navigation-menu.md +157 -0
  68. package/dist/docs/number-field.md +129 -0
  69. package/dist/docs/page-header.md +44 -0
  70. package/dist/docs/page-transition.md +93 -0
  71. package/dist/docs/pagination.md +42 -0
  72. package/dist/docs/pills.md +85 -0
  73. package/dist/docs/player-bar.md +158 -0
  74. package/dist/docs/popover.md +200 -0
  75. package/dist/docs/progress-ring.md +70 -0
  76. package/dist/docs/radio-cards.md +82 -0
  77. package/dist/docs/radio-group.md +86 -0
  78. package/dist/docs/range-slider.md +64 -0
  79. package/dist/docs/repeat-picker.md +44 -0
  80. package/dist/docs/resizable.md +107 -0
  81. package/dist/docs/seek-bar.md +97 -0
  82. package/dist/docs/segmented.md +89 -0
  83. package/dist/docs/select.md +148 -0
  84. package/dist/docs/separator.md +76 -0
  85. package/dist/docs/side-nav.md +75 -0
  86. package/dist/docs/skeleton.md +89 -0
  87. package/dist/docs/slider.md +87 -0
  88. package/dist/docs/sortable.md +244 -0
  89. package/dist/docs/sparkline.md +56 -0
  90. package/dist/docs/spinner.md +69 -0
  91. package/dist/docs/status-pill.md +81 -0
  92. package/dist/docs/stepper.md +59 -0
  93. package/dist/docs/tab-bar.md +78 -0
  94. package/dist/docs/table-of-contents.md +43 -0
  95. package/dist/docs/table.md +714 -0
  96. package/dist/docs/tabs.md +140 -0
  97. package/dist/docs/tag-input.md +45 -0
  98. package/dist/docs/textarea.md +25 -0
  99. package/dist/docs/theme-toggle.md +85 -0
  100. package/dist/docs/theming.md +193 -0
  101. package/dist/docs/time-field.md +71 -0
  102. package/dist/docs/timeline.md +50 -0
  103. package/dist/docs/toast.md +53 -0
  104. package/dist/docs/toggle-group.md +83 -0
  105. package/dist/docs/toggle.md +38 -0
  106. package/dist/docs/toolbar.md +97 -0
  107. package/dist/docs/tooltip.md +102 -0
  108. package/dist/docs/tree.md +295 -0
  109. package/dist/docs/trend.md +50 -0
  110. package/dist/filter-bar/index.js +6 -6
  111. package/dist/header/index.js +6 -6
  112. package/dist/icon-picker/index.js +5 -5
  113. package/dist/icons/arrow-path.d.ts +3 -0
  114. package/dist/icons/arrow-path.d.ts.map +1 -0
  115. package/dist/icons/arrows-right-left.d.ts +3 -0
  116. package/dist/icons/arrows-right-left.d.ts.map +1 -0
  117. package/dist/icons/backward.d.ts +3 -0
  118. package/dist/icons/backward.d.ts.map +1 -0
  119. package/dist/icons/forward.d.ts +3 -0
  120. package/dist/icons/forward.d.ts.map +1 -0
  121. package/dist/icons/heart-solid.d.ts +3 -0
  122. package/dist/icons/heart-solid.d.ts.map +1 -0
  123. package/dist/icons/heart.d.ts +3 -0
  124. package/dist/icons/heart.d.ts.map +1 -0
  125. package/dist/icons/musical-note.d.ts +3 -0
  126. package/dist/icons/musical-note.d.ts.map +1 -0
  127. package/dist/icons/pause.d.ts +3 -0
  128. package/dist/icons/pause.d.ts.map +1 -0
  129. package/dist/icons/play.d.ts +3 -0
  130. package/dist/icons/play.d.ts.map +1 -0
  131. package/dist/icons/queue-list.d.ts +3 -0
  132. package/dist/icons/queue-list.d.ts.map +1 -0
  133. package/dist/icons/speaker-wave.d.ts +3 -0
  134. package/dist/icons/speaker-wave.d.ts.map +1 -0
  135. package/dist/icons/speaker-x-mark.d.ts +3 -0
  136. package/dist/icons/speaker-x-mark.d.ts.map +1 -0
  137. package/dist/index.d.ts +7 -1
  138. package/dist/index.d.ts.map +1 -1
  139. package/dist/keypad/index.js +5 -5
  140. package/dist/lib.js +86 -80
  141. package/dist/load-more/index.js +5 -5
  142. package/dist/marquee/index.d.ts +15 -0
  143. package/dist/marquee/index.d.ts.map +1 -0
  144. package/dist/marquee/index.js +90 -0
  145. package/dist/menu/index.d.ts +7 -1
  146. package/dist/menu/index.d.ts.map +1 -1
  147. package/dist/menu/index.js +222 -178
  148. package/dist/money-input/index.js +54 -54
  149. package/dist/month-picker/index.js +11 -11
  150. package/dist/number-field/index.js +5 -5
  151. package/dist/pagination/index.js +12 -12
  152. package/dist/player-bar/index.d.ts +11 -0
  153. package/dist/player-bar/index.d.ts.map +1 -0
  154. package/dist/player-bar/index.js +17 -0
  155. package/dist/radio-cards/index.d.ts +2 -1
  156. package/dist/radio-cards/index.d.ts.map +1 -1
  157. package/dist/radio-cards/index.js +3 -3
  158. package/dist/range-slider/index.js +11 -11
  159. package/dist/repeat-picker/index.js +5 -5
  160. package/dist/resizable/index.js +22 -22
  161. package/dist/seek-bar/index.d.ts +26 -0
  162. package/dist/seek-bar/index.d.ts.map +1 -0
  163. package/dist/seek-bar/index.js +121 -0
  164. package/dist/segmented/index.d.ts +3 -2
  165. package/dist/segmented/index.d.ts.map +1 -1
  166. package/dist/segmented/index.js +19 -18
  167. package/dist/select/index.js +21 -21
  168. package/dist/slider/index.d.ts +2 -1
  169. package/dist/slider/index.d.ts.map +1 -1
  170. package/dist/sortable/index.d.ts +13 -1
  171. package/dist/sortable/index.d.ts.map +1 -1
  172. package/dist/sortable/index.js +74 -55
  173. package/dist/sortable/shared.js +14 -14
  174. package/dist/sortable/tree.js +17 -17
  175. package/dist/sparkline/index.js +4 -4
  176. package/dist/stepper/index.js +13 -13
  177. package/dist/tab-bar/index.d.ts +4 -2
  178. package/dist/tab-bar/index.d.ts.map +1 -1
  179. package/dist/tab-bar/index.js +24 -19
  180. package/dist/table/index.js +26 -26
  181. package/dist/table/selection.js +9 -9
  182. package/dist/table-of-contents/index.js +11 -11
  183. package/dist/tag-input/index.js +5 -5
  184. package/dist/textarea/index.d.ts +6 -2
  185. package/dist/textarea/index.d.ts.map +1 -1
  186. package/dist/textarea/index.js +2 -1
  187. package/dist/theme-toggle/index.js +4 -4
  188. package/dist/theme.css +143 -0
  189. package/dist/time-field/index.js +21 -21
  190. package/dist/toast/index.d.ts.map +1 -1
  191. package/dist/toast/index.js +41 -41
  192. package/dist/tooltip/index.d.ts +9 -3
  193. package/dist/tooltip/index.d.ts.map +1 -1
  194. package/dist/tooltip/index.js +19 -16
  195. package/dist/tree/index.js +34 -34
  196. package/dist/trend/index.js +5 -5
  197. package/dist/utils/duration.d.ts +3 -0
  198. package/dist/utils/duration.d.ts.map +1 -0
  199. package/dist/utils/duration.js +7 -0
  200. package/dist/utils/messages.d.ts +3 -0
  201. package/dist/utils/messages.d.ts.map +1 -1
  202. package/dist/utils/messages.js +4 -1
  203. package/dist/utils/slot.d.ts +5 -2
  204. package/dist/utils/slot.d.ts.map +1 -1
  205. package/dist/utils/slot.js +16 -11
  206. package/dist/utils/swipe.d.ts +7 -0
  207. package/dist/utils/swipe.d.ts.map +1 -1
  208. package/dist/utils/swipe.js +45 -25
  209. package/dist/utils/useAnchoredPopup.d.ts +2 -1
  210. package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
  211. package/dist/utils/useAnchoredPopup.js +10 -5
  212. package/dist/utils/useHeightVar.d.ts +7 -0
  213. package/dist/utils/useHeightVar.d.ts.map +1 -0
  214. package/dist/utils/useHeightVar.js +17 -0
  215. package/dist/utils/useMediaPlayer.d.ts +38 -0
  216. package/dist/utils/useMediaPlayer.d.ts.map +1 -0
  217. package/dist/utils/useMediaPlayer.js +91 -0
  218. package/dist/utils/useMediaSession.d.ts +24 -0
  219. package/dist/utils/useMediaSession.d.ts.map +1 -0
  220. package/dist/utils/useMediaSession.js +76 -0
  221. package/dist/utils/useVirtualList.d.ts +6 -1
  222. package/dist/utils/useVirtualList.d.ts.map +1 -1
  223. package/dist/utils/useVirtualList.js +12 -12
  224. package/dist/zen.css +1 -1
  225. package/package.json +4 -2
@@ -10,14 +10,20 @@ export default function Tooltip({ children }: {
10
10
  }): import('react').JSX.Element;
11
11
  /** What the tooltip describes: a button by default. With `asChild`, your own focusable element instead. */
12
12
  export declare function TooltipTrigger({ asChild, style, onPointerEnter, onPointerLeave, onFocus, onBlur, onKeyDown, children, ...rest }: TooltipTriggerProps): import('react').JSX.Element;
13
- /** The hint: glass, below the trigger (above it if there's no room), centred on it by default. */
14
- export declare function TooltipContent({ align, offset, className, style, onPointerEnter, onPointerLeave, children, ...rest }: TooltipContentProps): import('react').JSX.Element;
13
+ /**
14
+ * The hint: glass, below the trigger (above it if there's no room), centred on
15
+ * it by default. `side="beside"` puts it after the trigger instead (before it
16
+ * if there's no room), as for the icons of a collapsed sidebar.
17
+ */
18
+ export declare function TooltipContent({ side, align, offset, className, style, onPointerEnter, onPointerLeave, children, ...rest }: TooltipContentProps): import('react').JSX.Element;
15
19
  export interface TooltipTriggerProps extends ComponentProps<'button'> {
16
20
  /** Put the trigger's props on your own focusable element instead of rendering a button. */
17
21
  asChild?: boolean;
18
22
  }
19
23
  export interface TooltipContentProps extends ComponentProps<'div'> {
20
- /** Centred on the trigger (default), or lined up with its start or end edge. */
24
+ /** Below the trigger (default; above if there's no room), or beside it (after it; before if there's no room). */
25
+ side?: 'below' | 'beside';
26
+ /** Centred on the trigger (default), or lined up with its start or end edge (beside: its top or bottom). */
21
27
  align?: 'start' | 'end' | 'center';
22
28
  /** Gap from the trigger, in px. */
23
29
  offset?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/tooltip/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAiB,SAAS,EAAsB,MAAM,OAAO,CAAC;AAUrF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,+BAIrE;AAED,2GAA2G;AAC3G,wBAAgB,cAAc,CAAC,EAC3B,OAAO,EACP,KAAK,EACL,cAAc,EACd,cAAc,EACd,OAAO,EACP,MAAM,EACN,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,mBAAmB,+BAerB;AAED,kGAAkG;AAClG,wBAAgB,cAAc,CAAC,EAC3B,KAAgB,EAChB,MAAU,EACV,SAAS,EACT,KAAK,EACL,cAAc,EACd,cAAc,EACd,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,mBAAmB,+BAmBrB;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc,CAAC,QAAQ,CAAC;IACjE,2FAA2F;IAC3F,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAC9D,gFAAgF;IAChF,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACnC,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/tooltip/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAiB,SAAS,EAAsB,MAAM,OAAO,CAAC;AAUrF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,+BAIrE;AAED,2GAA2G;AAC3G,wBAAgB,cAAc,CAAC,EAC3B,OAAO,EACP,KAAK,EACL,cAAc,EACd,cAAc,EACd,OAAO,EACP,MAAM,EACN,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,mBAAmB,+BAerB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC3B,IAAc,EACd,KAAgB,EAChB,MAAU,EACV,SAAS,EACT,KAAK,EACL,cAAc,EACd,cAAc,EACd,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,mBAAmB,+BAyBrB;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc,CAAC,QAAQ,CAAC;IACjE,2FAA2F;IAC3F,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAC9D,iHAAiH;IACjH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,4GAA4G;IAC5G,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACnC,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -48,28 +48,31 @@ function h({ asChild: e, style: t, onPointerEnter: i, onPointerLeave: a, onFocus
48
48
  children: l
49
49
  });
50
50
  }
51
- function g({ align: t = "center", offset: n = 5, className: r, style: s, onPointerEnter: c, onPointerLeave: l, children: f, ...m }) {
52
- let h = p("TooltipContent"), g = u(null);
53
- return a(g), /* @__PURE__ */ d("div", {
54
- ...m,
55
- ref: g,
56
- id: h.id,
51
+ function g({ side: t = "below", align: n = "center", offset: r = 5, className: s, style: c, onPointerEnter: l, onPointerLeave: f, children: m, ...h }) {
52
+ let g = p("TooltipContent"), _ = u(null);
53
+ return a(_), /* @__PURE__ */ d("div", {
54
+ ...h,
55
+ ref: _,
56
+ id: g.id,
57
57
  role: "tooltip",
58
58
  popover: "manual",
59
- ...h.contentProps({
60
- onPointerEnter: c,
61
- onPointerLeave: l
59
+ ...g.contentProps({
60
+ onPointerEnter: l,
61
+ onPointerLeave: f
62
62
  }),
63
+ "data-zen-beside": t === "beside" ? "" : void 0,
63
64
  style: {
64
- ...i(h.id, {
65
- align: t,
66
- offset: n,
67
- width: "at-least"
65
+ ...i(g.id, {
66
+ side: t,
67
+ align: n,
68
+ offset: r,
69
+ width: t === "beside" ? void 0 : "at-least"
68
70
  }),
69
- ...s
71
+ ...t === "beside" && { marginBlock: 0 },
72
+ ...c
70
73
  },
71
- className: e("zen__popover fixed z-50 overflow-visible p-0", o, r),
72
- children: f
74
+ className: e("zen__popover fixed z-50 overflow-visible p-0", o, s),
75
+ children: m
73
76
  });
74
77
  }
75
78
  //#endregion
@@ -1,19 +1,19 @@
1
1
  "use client";
2
- import e from "../icons/micro/chevron-right.js";
3
- import { cx as t } from "../utils/cx.js";
4
- import { readingKey as n } from "../utils/direction.js";
5
- import { useMessages as r } from "../locale-provider/index.js";
2
+ import { useMessages as e } from "../locale-provider/index.js";
3
+ import t from "../icons/micro/chevron-right.js";
4
+ import { cx as n } from "../utils/cx.js";
5
+ import { readingKey as r } from "../utils/direction.js";
6
6
  import { reducedMotion as i } from "../utils/motion.js";
7
7
  import { TableCell as a, TableRow as o } from "../table/index.js";
8
8
  import { useCallback as s, useMemo as c, useRef as l, useState as u } from "react";
9
9
  import { jsx as d, jsxs as f } from "react/jsx-runtime";
10
10
  //#region packages/tree/index.tsx
11
- function p({ items: e, getKey: r, getChildren: a, defaultExpanded: o = !0, rowHeight: d = 36 }) {
11
+ function p({ items: e, getKey: t, getChildren: a, defaultExpanded: o = !0, rowHeight: d = 36 }) {
12
12
  let [f, p] = u(() => /* @__PURE__ */ new Set()), [m, h] = u(null), [g, _] = u(null), v = l(null), y = s((e) => f.has(e) !== o, [f, o]), b = c(() => {
13
- let t = [], n = (e, i, o) => {
13
+ let n = [], r = (e, i, o) => {
14
14
  e.forEach((s, c) => {
15
- let l = r(s), u = a(s), d = !!u?.length, f = d && y(l);
16
- t.push({
15
+ let l = t(s), u = a(s), d = !!u?.length, f = d && y(l);
16
+ n.push({
17
17
  item: s,
18
18
  key: l,
19
19
  depth: i,
@@ -22,23 +22,23 @@ function p({ items: e, getKey: r, getChildren: a, defaultExpanded: o = !0, rowHe
22
22
  expanded: f,
23
23
  position: c + 1,
24
24
  siblings: e.length
25
- }), f && n(u, i + 1, l);
25
+ }), f && r(u, i + 1, l);
26
26
  });
27
27
  };
28
- return n(e, 0, null), t;
28
+ return r(e, 0, null), n;
29
29
  }, [
30
30
  e,
31
- r,
31
+ t,
32
32
  a,
33
33
  y
34
34
  ]), x = () => {
35
- let t = [], n = (e) => {
35
+ let n = [], r = (e) => {
36
36
  for (let i of e) {
37
37
  let e = a(i);
38
- e?.length && (t.push(r(i)), n(e));
38
+ e?.length && (n.push(t(i)), r(e));
39
39
  }
40
40
  };
41
- return n(e), t;
41
+ return r(e), n;
42
42
  }, S = s((e, t) => p((n) => {
43
43
  let r = new Set(n);
44
44
  return t === o ? r.delete(e) : r.add(e), r;
@@ -62,12 +62,12 @@ function p({ items: e, getKey: r, getChildren: a, defaultExpanded: o = !0, rowHe
62
62
  }
63
63
  }, [w, T] = u(null), E = b.some((e) => e.key === w) ? w : b[0]?.key ?? null, D = (e) => e.expanded && g !== e.key, O = (e, t) => {
64
64
  if (t.target !== t.currentTarget) return;
65
- let r = b.indexOf(e), i, a = n(t.key, t.currentTarget);
66
- if (a === "ArrowDown") i = b[r + 1];
67
- else if (a === "ArrowUp") i = b[r - 1];
65
+ let n = b.indexOf(e), i, a = r(t.key, t.currentTarget);
66
+ if (a === "ArrowDown") i = b[n + 1];
67
+ else if (a === "ArrowUp") i = b[n - 1];
68
68
  else if (a === "Home") i = b[0];
69
69
  else if (a === "End") i = b.at(-1);
70
- else if (a === "ArrowRight" && e.hasChildren) D(e) ? i = b[r + 1] : C(e.key);
70
+ else if (a === "ArrowRight" && e.hasChildren) D(e) ? i = b[n + 1] : C(e.key);
71
71
  else if (a === "ArrowLeft") D(e) ? C(e.key) : i = b.find((t) => t.key === e.parentKey);
72
72
  else return;
73
73
  t.preventDefault(), i && t.currentTarget.closest("[role=\"treegrid\"], table")?.querySelector(`[data-tree-key="${CSS.escape(i.key)}"]`)?.focus();
@@ -93,7 +93,7 @@ function p({ items: e, getKey: r, getChildren: a, defaultExpanded: o = !0, rowHe
93
93
  t.target === t.currentTarget && T(e.key);
94
94
  },
95
95
  onKeyDown: (t) => O(e, t),
96
- className: t("outline-hidden focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring/60", m && e.parentKey === m.key && "zen__tree-row-enter", g && e.parentKey === g && "zen__tree-row-exit"),
96
+ className: n("outline-hidden focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring/60", m && e.parentKey === m.key && "zen__tree-row-enter", g && e.parentKey === g && "zen__tree-row-exit"),
97
97
  style: { "--row-h": `${d - 1}px` },
98
98
  onAnimationEnd: (t) => {
99
99
  t.animationName === "zen-row-close" && g && e.parentKey === g && v.current?.();
@@ -107,8 +107,8 @@ function p({ items: e, getKey: r, getChildren: a, defaultExpanded: o = !0, rowHe
107
107
  rowHeight: d
108
108
  };
109
109
  }
110
- function m({ row: e, tree: n, className: r, style: i, onFocus: a, onKeyDown: s, ...c }) {
111
- let l = n.rowProps(e);
110
+ function m({ row: e, tree: t, className: r, style: i, onFocus: a, onKeyDown: s, ...c }) {
111
+ let l = t.rowProps(e);
112
112
  return /* @__PURE__ */ d(o, {
113
113
  ...c,
114
114
  ...l,
@@ -118,41 +118,41 @@ function m({ row: e, tree: n, className: r, style: i, onFocus: a, onKeyDown: s,
118
118
  onKeyDown: (e) => {
119
119
  s?.(e), e.defaultPrevented || l.onKeyDown(e);
120
120
  },
121
- className: t(l.className, r),
121
+ className: n(l.className, r),
122
122
  style: {
123
123
  ...l.style,
124
124
  ...i
125
125
  }
126
126
  });
127
127
  }
128
- function h({ numeric: e, className: n, children: r, ...i }) {
128
+ function h({ numeric: e, className: t, children: r, ...i }) {
129
129
  return /* @__PURE__ */ d(a, {
130
130
  numeric: e,
131
- className: t("py-0 whitespace-nowrap", n),
131
+ className: n("py-0 whitespace-nowrap", t),
132
132
  ...i,
133
133
  children: /* @__PURE__ */ d("div", {
134
- className: t("zen__tree-cell flex h-[var(--row-h)] items-center", e && "justify-end"),
134
+ className: n("zen__tree-cell flex h-[var(--row-h)] items-center", e && "justify-end"),
135
135
  children: r
136
136
  })
137
137
  });
138
138
  }
139
- function g({ row: e, tree: n, indent: r = 20, children: i, className: a }) {
139
+ function g({ row: e, tree: t, indent: r = 20, children: i, className: a }) {
140
140
  return /* @__PURE__ */ f("div", {
141
- className: t("flex min-w-0 flex-1 items-center gap-1", a),
141
+ className: n("flex min-w-0 flex-1 items-center gap-1", a),
142
142
  style: { paddingLeft: e.depth * r },
143
- children: [e.hasChildren ? /* @__PURE__ */ d(_, { ...n.toggleProps(e) }) : /* @__PURE__ */ d("span", { className: "-ms-1 w-6 shrink-0" }), i]
143
+ children: [e.hasChildren ? /* @__PURE__ */ d(_, { ...t.toggleProps(e) }) : /* @__PURE__ */ d("span", { className: "-ms-1 w-6 shrink-0" }), i]
144
144
  });
145
145
  }
146
- function _({ expanded: n, onToggle: i, className: a, ...o }) {
147
- let s = r();
146
+ function _({ expanded: r, onToggle: i, className: a, ...o }) {
147
+ let s = e();
148
148
  return /* @__PURE__ */ d("button", {
149
149
  type: "button",
150
150
  onClick: i,
151
- "aria-label": n ? s.collapse : s.expand,
152
- "aria-expanded": n,
153
- className: t("text-muted-foreground hover:bg-tint/[0.08] hover:text-foreground -ms-1 grid size-6 shrink-0 cursor-pointer place-items-center rounded-md outline-hidden transition-colors focus-ring", a),
151
+ "aria-label": r ? s.collapse : s.expand,
152
+ "aria-expanded": r,
153
+ className: n("text-muted-foreground hover:bg-tint/[0.08] hover:text-foreground -ms-1 grid size-6 shrink-0 cursor-pointer place-items-center rounded-md outline-hidden transition-colors focus-ring", a),
154
154
  ...o,
155
- children: /* @__PURE__ */ d(e, { className: t("zen__tree-chevron size-4 transition-transform duration-200 ease-out rtl:-scale-x-100", n && "rotate-90 rtl:-rotate-90") })
155
+ children: /* @__PURE__ */ d(t, { className: n("zen__tree-chevron size-4 transition-transform duration-200 ease-out rtl:-scale-x-100", r && "rotate-90 rtl:-rotate-90") })
156
156
  });
157
157
  }
158
158
  //#endregion
@@ -1,22 +1,22 @@
1
1
  "use client";
2
- import { cx as e } from "../utils/cx.js";
3
- import { useLocale as t } from "../locale-provider/index.js";
2
+ import { useLocale as e } from "../locale-provider/index.js";
3
+ import { cx as t } from "../utils/cx.js";
4
4
  import n from "../icons/micro/arrow-trending-down.js";
5
5
  import r from "../icons/micro/arrow-trending-up.js";
6
6
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
7
7
  //#region packages/trend/index.tsx
8
8
  function o({ value: o, good: s = "up", locale: c, format: l, className: u, children: d, ...f }) {
9
- let p = t(c), m = l ?? ((e) => new Intl.NumberFormat(p, {
9
+ let p = e(c), m = l ?? ((e) => new Intl.NumberFormat(p, {
10
10
  style: "percent",
11
11
  maximumFractionDigits: 1,
12
12
  signDisplay: "exceptZero"
13
13
  }).format(e)), h = o > 0 ? "up" : o < 0 ? "down" : "flat", g = h === "up" ? r : h === "down" ? n : null;
14
14
  return /* @__PURE__ */ a("span", {
15
- className: e("zen__trend inline-flex items-center gap-1.5 text-xs", u),
15
+ className: t("zen__trend inline-flex items-center gap-1.5 text-xs", u),
16
16
  ...f,
17
17
  children: [/* @__PURE__ */ a("span", {
18
18
  "data-direction": h,
19
- className: e("inline-flex items-center gap-0.5 rounded-md border px-1.5 py-0.5 font-medium whitespace-nowrap tabular-nums", h === "flat" ? "border-tint/10 bg-tint/[0.06] text-muted-foreground" : h === s ? "border-glow/30 bg-glow/10 text-primary" : "border-destructive/40 bg-destructive/10 text-destructive"),
19
+ className: t("inline-flex items-center gap-0.5 rounded-md border px-1.5 py-0.5 font-medium whitespace-nowrap tabular-nums", h === "flat" ? "border-tint/10 bg-tint/[0.06] text-muted-foreground" : h === s ? "border-glow/30 bg-glow/10 text-primary" : "border-destructive/40 bg-destructive/10 text-destructive"),
20
20
  children: [g && /* @__PURE__ */ i(g, { className: "size-3.5" }), m(o)]
21
21
  }), d && /* @__PURE__ */ i("span", {
22
22
  className: "text-muted-foreground",
@@ -0,0 +1,3 @@
1
+ /** Seconds as a clock reads them: 3:07, or 1:02:07 from an hour up. */
2
+ export declare function formatDuration(seconds: number): string;
3
+ //# sourceMappingURL=duration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../packages/utils/duration.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,UAM7C"}
@@ -0,0 +1,7 @@
1
+ //#region packages/utils/duration.ts
2
+ function e(e) {
3
+ let t = Math.floor(Math.max(e, 0)), n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), i = String(t % 60).padStart(2, "0");
4
+ return n ? `${n}:${String(r).padStart(2, "0")}:${i}` : `${r}:${i}`;
5
+ }
6
+ //#endregion
7
+ export { e as formatDuration };
@@ -7,6 +7,7 @@ export declare const ENGLISH: {
7
7
  clear: string;
8
8
  cancel: string;
9
9
  close: string;
10
+ back: string;
10
11
  dismiss: string;
11
12
  delete: string;
12
13
  remove: (item: string) => string;
@@ -132,6 +133,8 @@ export declare const ENGLISH: {
132
133
  nextSlide: string;
133
134
  resize: string;
134
135
  notifications: string;
136
+ seek: string;
137
+ timeOf: (time: string, total: string) => string;
135
138
  };
136
139
  export type Messages = typeof ENGLISH;
137
140
  //# sourceMappingURL=messages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../packages/utils/messages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,OAAO;;;;;;mBAOD,MAAM;;;;;;;;;;;;;;gBAgBT,MAAM;;;;;;;;;;;;;gCAeU,MAAM;uBACf,MAAM;;;4CAKe,MAAM,cAAc,MAAM;;wBAG9C,MAAM;;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GAAG,MAAM,SAAS,MAAM;yBAC9C,MAAM,QAAQ,MAAM;qBACxB,MAAM,QAAQ,MAAM;mBACtB,MAAM;;oBAIL,MAAM;qBACL,MAAM,SAAS,MAAM;oBAEtB,MAAM,SAAS,MAAM;oBACrB,MAAM,SAAS,MAAM;oBACrB,MAAM,UAAU,MAAM;sBACpB,MAAM,SAAS,MAAM;wBACnB,MAAM,SAAS,MAAM,SAAS,MAAM;oBAGxC,MAAM,SAAS,MAAM,UAAU,MAAM;kBACvC,MAAM,KAAK,MAAM,KAAK,MAAM;sBACxB,MAAM;;;;2BAOD,MAAM;;;;uBAMV,MAAM;oBACT,MAAM,QAAQ,MAAM;;;;;;;;;;;;;;qBAgBnB,MAAM;;cAEb,MAAM;;;;;;iBAMH,MAAM,SAAS,MAAM;mBACnB,MAAM;;;;;;mBAQN,MAAM,SAAS,MAAM;CACvC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,OAAO,OAAO,CAAC"}
@@ -3,6 +3,7 @@ var e = {
3
3
  clear: "Clear",
4
4
  cancel: "Cancel",
5
5
  close: "Close",
6
+ back: "Back",
6
7
  dismiss: "Dismiss",
7
8
  delete: "Delete",
8
9
  remove: (e) => `Remove ${e}`,
@@ -127,7 +128,9 @@ var e = {
127
128
  previousSlide: "Previous slide",
128
129
  nextSlide: "Next slide",
129
130
  resize: "Resize",
130
- notifications: "Notifications (F8)"
131
+ notifications: "Notifications (F8)",
132
+ seek: "Seek",
133
+ timeOf: (e, t) => `${e} of ${t}`
131
134
  };
132
135
  //#endregion
133
136
  export { e as ENGLISH };
@@ -5,9 +5,12 @@ type Props = Record<string, unknown>;
5
5
  * props: a component's styles and attributes go onto the caller's own element,
6
6
  * such as a router's Link. Classes are combined, styles merged (the child's
7
7
  * win), event handlers both run (the child's first), and refs both receive the
8
- * element; other props from the component win.
8
+ * element; other props from the component win. `before` goes ahead of the
9
+ * child's own content (e.g. a component's icon), also when that content is a
10
+ * render function such as a router NavLink's.
9
11
  */
10
- export declare function Slot({ children, ...props }: ComponentProps<'a'> & {
12
+ export declare function Slot({ before, children, ...props }: ComponentProps<'a'> & {
13
+ before?: ReactNode;
11
14
  children?: ReactNode;
12
15
  }): ReactElement<Props, string | import('react').JSXElementConstructor<any>> | null;
13
16
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../packages/utils/slot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAkB,YAAY,EAAE,SAAS,EAAO,MAAM,OAAO,CAAC;AAKnG,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErC;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,mFAoB1F"}
1
+ {"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../packages/utils/slot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAkB,YAAY,EAAE,SAAS,EAAO,MAAM,OAAO,CAAC;AAKnG,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErC;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,EACjB,MAAM,EACN,QAAQ,EACR,GAAG,KAAK,EACX,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,mFAqCpE"}
@@ -2,20 +2,25 @@
2
2
  import { cx as e } from "./cx.js";
3
3
  import { mergeRefs as t } from "./refs.js";
4
4
  import { cloneElement as n, isValidElement as r } from "react";
5
+ import { Fragment as i, jsxs as a } from "react/jsx-runtime";
5
6
  //#region packages/utils/slot.tsx
6
- function i({ children: i, ...a }) {
7
- if (!r(i)) return null;
8
- let o = i, s = a, c = o.props, l = { ...s };
9
- for (let e of Object.keys(s)) {
10
- let t = s[e], n = c[e];
11
- /^on[A-Z]/.test(e) && typeof t == "function" && typeof n == "function" && (l[e] = (...e) => {
7
+ function o({ before: o, children: s, ...c }) {
8
+ if (!r(s)) return null;
9
+ let l = s, u = c, d = l.props, f = { ...u };
10
+ for (let e of Object.keys(u)) {
11
+ let t = u[e], n = d[e];
12
+ /^on[A-Z]/.test(e) && typeof t == "function" && typeof n == "function" && (f[e] = (...e) => {
12
13
  n(...e), t(...e);
13
14
  });
14
15
  }
15
- return l.className = e(s.className, c.className), (s.style || c.style) && (l.style = {
16
- ...s.style,
17
- ...c.style
18
- }), s.ref && c.ref && (l.ref = t(s.ref, c.ref)), n(o, l);
16
+ if (f.className = e(u.className, d.className), (u.style || d.style) && (f.style = {
17
+ ...u.style,
18
+ ...d.style
19
+ }), u.ref && d.ref && (f.ref = t(u.ref, d.ref)), o != null) {
20
+ let e = d.children;
21
+ f.children = typeof e == "function" ? ((...t) => /* @__PURE__ */ a(i, { children: [o, e(...t)] })) : /* @__PURE__ */ a(i, { children: [o, e] });
22
+ }
23
+ return n(l, f);
19
24
  }
20
25
  //#endregion
21
- export { i as Slot };
26
+ export { o as Slot };
@@ -26,4 +26,11 @@ export interface SwipeHandlers {
26
26
  * it is swallowed.
27
27
  */
28
28
  export declare function useSwipe(ref: RefObject<HTMLElement | null>, direction: SwipeDirection | undefined, handlers: SwipeHandlers): void;
29
+ /**
30
+ * A sheet follows a finger swiping it back to its edge, and closes when let go
31
+ * far enough along or flicked; otherwise it springs back. It's moved by the
32
+ * --zen-swipe custom property (a translate), and --zen-swipe-progress (0 to 1)
33
+ * says how far, for its scrim.
34
+ */
35
+ export declare function useSheetSwipe(ref: RefObject<HTMLElement | null>, side: 'bottom' | 'left' | 'right' | undefined, close: () => void): void;
29
36
  //# sourceMappingURL=swipe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"swipe.d.ts","sourceRoot":"","sources":["../../packages/ut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AC/D,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,qFAAqF;IACrF,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,8HAA8H;IAC9H,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACpB,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAClC,SAAS,EAAE,cAAc,GAAG,SAAS,EACrC,QAAQ,EAAE,aAAa,QAkG1B;AAKD;;;;;GAKG;AACH,wBAAgB,aAAa,CACzB,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAClC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,EAC7C,KAAK,EAAE,MAAM,IAAI,QAuBpB"}
@@ -2,25 +2,25 @@
2
2
  import { useEffect as e, useRef as t } from "react";
3
3
  //#region packages/utils/swipe.ts
4
4
  var n = .5, r = 100, i = 8;
5
- function a(n, a, c) {
6
- let l = t(c);
5
+ function a(n, a, o) {
6
+ let s = t(o);
7
7
  e(() => {
8
- l.current = c;
8
+ s.current = o;
9
9
  });
10
10
  let u = a?.axis, d = a?.sign;
11
11
  e(() => {
12
12
  let e = n.current;
13
13
  if (!e || !u || !d) return;
14
- let t = u === "y" ? "y" : "x", a = u === "inline" && getComputedStyle(e).direction === "rtl" ? -d : d, c = null, f = !1, p = (e) => (t === "y" ? e.clientY - c.y : e.clientX - c.x) * a, m = (e) => t === "y" ? e.clientX - c.x : e.clientY - c.y, h = () => {
15
- let t = c?.on;
16
- return c = null, t ? (delete e.dataset.swiping, f = !0, !0) : !1;
14
+ let t = u === "y" ? "y" : "x", a = u === "inline" && getComputedStyle(e).direction === "rtl" ? -d : d, o = null, f = !1, p = (e) => (t === "y" ? e.clientY - o.y : e.clientX - o.x) * a, m = (e) => t === "y" ? e.clientX - o.x : e.clientY - o.y, h = () => {
15
+ let t = o?.on;
16
+ return o = null, t ? (delete e.dataset.swiping, f = !0, !0) : !1;
17
17
  }, g = (n) => {
18
18
  if (f = !1, n.pointerType === "touch") {
19
19
  if (!n.isPrimary) {
20
- h() && l.current.cancel();
20
+ h() && s.current.cancel();
21
21
  return;
22
22
  }
23
- o(n.target, e, t) || (c = {
23
+ c(n.target, e, t) || (o = {
24
24
  id: n.pointerId,
25
25
  x: n.clientX,
26
26
  y: n.clientY,
@@ -30,25 +30,25 @@ function a(n, a, c) {
30
30
  });
31
31
  }
32
32
  }, _ = (n) => {
33
- if (!c || n.pointerId !== c.id) return;
34
- let o = p(n);
35
- if (!c.on) {
36
- if (Math.hypot(o, m(n)) < i) return;
37
- if (o <= 0 || Math.abs(m(n)) * 1.5 > o || s(n.target, t, a)) {
38
- c = null;
33
+ if (!o || n.pointerId !== o.id) return;
34
+ let c = p(n);
35
+ if (!o.on) {
36
+ if (Math.hypot(c, m(n)) < i) return;
37
+ if (c <= 0 || Math.abs(m(n)) * 1.5 > c || l(n.target, t, a)) {
38
+ o = null;
39
39
  return;
40
40
  }
41
- c.on = !0, e.dataset.swiping = "", e.setPointerCapture?.(n.pointerId);
41
+ o.on = !0, e.dataset.swiping = "", e.setPointerCapture?.(n.pointerId);
42
42
  }
43
- c.points = [...c.points.filter(([e]) => n.timeStamp - e < r), [n.timeStamp, o]], l.current.move(o);
44
- let u = l.current.threshold?.();
45
- u !== void 0 && o > u !== c.past && (c.past = !c.past, navigator.vibrate?.(8));
43
+ o.points = [...o.points.filter(([e]) => n.timeStamp - e < r), [n.timeStamp, c]], s.current.move(c);
44
+ let u = s.current.threshold?.();
45
+ u !== void 0 && c > u !== o.past && (o.past = !o.past, navigator.vibrate?.(8));
46
46
  }, v = (e) => {
47
- if (!c || e.pointerId !== c.id) return;
48
- let t = p(e), [n, i] = c.points.find(([t]) => e.timeStamp - t < r) ?? [e.timeStamp, t], a = (t - i) / Math.max(1, e.timeStamp - n);
49
- h() && (e.type === "pointerup" ? l.current.release(t, a) : l.current.cancel());
47
+ if (!o || e.pointerId !== o.id) return;
48
+ let t = p(e), [n, i] = o.points.find(([t]) => e.timeStamp - t < r) ?? [e.timeStamp, t], a = (t - i) / Math.max(1, e.timeStamp - n);
49
+ h() && (e.type === "pointerup" ? s.current.release(t, a) : s.current.cancel());
50
50
  }, y = (e) => {
51
- c?.on && e.preventDefault();
51
+ o?.on && e.preventDefault();
52
52
  }, b = (e) => {
53
53
  f && (f = !1, e.stopPropagation(), e.preventDefault());
54
54
  };
@@ -61,7 +61,27 @@ function a(n, a, c) {
61
61
  d
62
62
  ]);
63
63
  }
64
- function o(e, t, n) {
64
+ var o = .3;
65
+ function s(t, n, r) {
66
+ let i = n === "bottom" ? "y" : "x", s = n === "left" ? -1 : 1, c = () => i === "y" ? t.current.offsetHeight : t.current.offsetWidth, l = () => {
67
+ t.current?.style.removeProperty("--zen-swipe"), t.current?.style.removeProperty("--zen-swipe-progress");
68
+ };
69
+ e(l, [t, n]), a(t, n ? {
70
+ axis: i,
71
+ sign: s
72
+ } : void 0, {
73
+ move: (e) => {
74
+ let n = e > 0 ? e : e / 6;
75
+ t.current.style.setProperty("--zen-swipe", i === "y" ? `0 ${n}px` : `${n * s}px 0`), t.current.style.setProperty("--zen-swipe-progress", String(Math.max(0, Math.min(1, e / c()))));
76
+ },
77
+ release: (e, t) => {
78
+ e > c() * o || e > 0 && t > .5 ? r() : l();
79
+ },
80
+ cancel: l,
81
+ threshold: () => c() * o
82
+ });
83
+ }
84
+ function c(e, t, n) {
65
85
  if (e.closest("input, textarea, select, [contenteditable]:not([contenteditable=\"false\"])")) return !0;
66
86
  let r = n === "y" ? /pan-(y|up|down)/ : /pan-(x|left|right)/;
67
87
  for (let n = e; n && n !== t; n = n.parentElement) {
@@ -70,7 +90,7 @@ function o(e, t, n) {
70
90
  }
71
91
  return !1;
72
92
  }
73
- function s(e, t, n) {
93
+ function l(e, t, n) {
74
94
  for (let r = e; r; r = r.parentElement) {
75
95
  let e = getComputedStyle(r), i = t === "y" ? e.overflowY : e.overflowX;
76
96
  if (r === r.ownerDocument.scrollingElement ? i === "hidden" || i === "clip" : !/auto|scroll/.test(i)) continue;
@@ -82,4 +102,4 @@ function s(e, t, n) {
82
102
  return !1;
83
103
  }
84
104
  //#endregion
85
- export { n as FLICK_SPEED, a as useSwipe };
105
+ export { n as FLICK_SPEED, s as useSheetSwipe, a as useSwipe };
@@ -35,7 +35,8 @@ export declare function anchorFor(id: string): {
35
35
  * lined up with its start or end edge, or centred on it; `width` makes it as
36
36
  * wide as the trigger, or at least as wide. `side: 'beside'` puts it after the
37
37
  * trigger instead (before it if there's no room), its top level with the
38
- * trigger's, as a submenu opens. For parts that take their own `align`/`offset`
38
+ * trigger's, as a submenu opens; `align` then lines up the tops (start), the
39
+ * middles (center, as a tooltip beside an icon) or the bottoms (end). For parts that take their own `align`/`offset`
39
40
  * (PopoverContent, MenuContent). The same choices are kept as custom
40
41
  * properties, for placing it where anchor positioning isn't supported.
41
42
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useAnchoredPopup.d.ts","sourceRoot":"","sources":["../../packages/utils/useAnchoredPopup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAmD,MAAM,OAAO,CAAC;AAElG;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,WAAW,GAAG,cAAc,EAAE,EACrE,KAAe,EACf,MAAU,EACV,UAAkB,EAClB,YAAY,GACf,GAAE,oBAAyB;;;oBAgBb,OAAO;;;eA6CkD,aAAa;;;;;;;;;;;;;EAJpF;AAED,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM;;WACoC,aAAa;EACpF;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CACzB,EAAE,EAAE,MAAM,EACV,EAAE,KAAe,EAAE,MAAU,EAAE,KAAK,EAAE,IAAc,EAAE,GAAE,aAAkB,GAC3E,aAAa,CAuBf;AAED,U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AG,KAAK,GAAG,QAAQ,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC7B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC7B;AAYD,8FAA8F;AAC9F,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,QAiCnE;AA+CD,MAAM,WAAW,oBAAoB;IACjC,sFAAsF;IACtF,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACnC,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C"}
@@ -51,15 +51,20 @@ function o(e) {
51
51
  };
52
52
  }
53
53
  function s(e, { align: t = "start", offset: n = 4, width: r, side: i = "below" } = {}) {
54
- let a = i === "beside" ? "inline-end span-block-end" : {
54
+ let a = i === "beside" ? {
55
+ start: "inline-end span-block-end",
56
+ end: "inline-end span-block-start",
57
+ center: "inline-end"
58
+ }[t] : {
55
59
  start: "block-end span-inline-end",
56
60
  end: "block-end span-inline-start",
57
- center: "block-end center"
61
+ center: "block-end span-all"
58
62
  }[t];
59
63
  return {
60
64
  positionAnchor: `--${e}`,
61
65
  positionArea: a,
62
- positionTryFallbacks: i === "beside" ? "flip-inline, flip-block, flip-block flip-inline" : "flip-block",
66
+ ...t === "center" && (i === "beside" ? { alignSelf: "anchor-center" } : { justifySelf: "anchor-center" }),
67
+ positionTryFallbacks: t === "center" ? i === "beside" ? "flip-inline" : "flip-block" : "flip-inline, flip-block, flip-block flip-inline",
63
68
  inset: "auto",
64
69
  ...r === "at-least" && {
65
70
  width: "max-content",
@@ -114,8 +119,8 @@ function f(e) {
114
119
  height: e.offsetHeight
115
120
  }, u = document.documentElement.clientWidth, f = document.documentElement.clientHeight, p = getComputedStyle(n).direction === "rtl";
116
121
  if (o) {
117
- let e = s.right + i + l.width <= u - d, t = s.left - i - l.width >= d, n = p ? e && !t : e || !t, r = s.top + l.height > f - d && s.bottom - l.height >= d;
118
- c.left = n ? `${s.right}px` : "auto", c.right = n ? "auto" : `${u - s.left}px`, c.top = r ? "auto" : `${Math.max(d, Math.min(s.top, f - l.height - d))}px`, c.bottom = r ? `${f - s.bottom}px` : "auto";
122
+ let e = s.right + i + l.width <= u - d, t = s.left - i - l.width >= d, n = p ? e && !t : e || !t, a = r === "end" || r === "start" && s.top + l.height > f - d && s.bottom - l.height >= d, o = r === "center" ? s.top + (s.height - l.height) / 2 : a ? s.bottom - l.height : s.top;
123
+ c.left = n ? `${s.right}px` : "auto", c.right = n ? "auto" : `${u - s.left}px`, c.top = `${Math.max(d, Math.min(o, f - l.height - d))}px`, c.bottom = "auto";
119
124
  return;
120
125
  }
121
126
  let m = s.bottom + i + l.height > f - d && s.top - i - l.height >= d, h = p ? s.right - l.width : s.left, g = p ? s.left : s.right - l.width, _ = r === "center" ? s.left + (s.width - l.width) / 2 : r === "end" ? g : h;
@@ -0,0 +1,7 @@
1
+ import { RefObject } from 'react';
2
+ /**
3
+ * Keeps a fixed bar's height in a CSS variable on its parent (0px while the bar
4
+ * is hidden), so the bars and the page beside it can stack on it and pad for it.
5
+ */
6
+ export declare function useHeightVar(ref: RefObject<HTMLElement | null>, name: `--${string}`): void;
7
+ //# sourceMappingURL=useHeightVar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHeightVar.d.ts","sourceRoot":"","sources":["../../packages/utils/useHeightVar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,OAAO,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,MAAM,EAAE,QAcnF"}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { useLayoutEffect as e } from "react";
3
+ //#region packages/utils/useHeightVar.ts
4
+ function t(t, n) {
5
+ e(() => {
6
+ let e = t.current, r = e?.parentElement;
7
+ if (!e || !r) return;
8
+ let i = () => r.style.setProperty(n, `${e.offsetHeight}px`);
9
+ i();
10
+ let a = new ResizeObserver(i);
11
+ return a.observe(e), () => {
12
+ a.disconnect(), r.style.removeProperty(n);
13
+ };
14
+ }, [t, n]);
15
+ }
16
+ //#endregion
17
+ export { t as useHeightVar };