@ctrl-ui/react 0.8.7 → 0.8.8

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 (351) hide show
  1. package/dist/action-bar.d.ts +15 -7
  2. package/dist/action-bar.js +40 -20
  3. package/dist/activity.js +8 -16
  4. package/dist/audio-recorder.d.ts +14 -4
  5. package/dist/audio-recorder.js +82 -29
  6. package/dist/audio-visualizer.js +1 -1
  7. package/dist/blocks/coding-agent.js +39 -39
  8. package/dist/blocks/design-canvas-inspector.js +2 -2
  9. package/dist/blocks/design-canvas.d.ts +5 -1
  10. package/dist/blocks/design-canvas.js +200 -94
  11. package/dist/blocks/discussion.d.ts +28 -0
  12. package/dist/blocks/discussion.js +67 -0
  13. package/dist/blocks/file-explorer-data.d.ts +1 -0
  14. package/dist/blocks/file-explorer-data.js +4 -1
  15. package/dist/blocks/file-explorer.d.ts +9 -1
  16. package/dist/blocks/file-explorer.js +461 -192
  17. package/dist/blocks/settings.d.ts +2 -1
  18. package/dist/blocks/settings.js +102 -80
  19. package/dist/blocks/team-chat.d.ts +12 -0
  20. package/dist/blocks/team-chat.js +26 -0
  21. package/dist/blocks/theme-toggle.js +23 -31
  22. package/dist/chat-composer-attachment.d.ts +4 -1
  23. package/dist/chat-composer-attachment.js +35 -10
  24. package/dist/chat-composer-editor/extensions/mention.d.ts +5 -1
  25. package/dist/chat-composer-editor/extensions/mention.js +58 -27
  26. package/dist/chat-composer-editor/ghost.js +2 -4
  27. package/dist/chat-composer-editor/types.d.ts +5 -0
  28. package/dist/chat-composer-editor.d.ts +1 -1
  29. package/dist/chat-composer-editor.js +57 -30
  30. package/dist/chat-composer.d.ts +13 -32
  31. package/dist/chat-composer.js +53 -13
  32. package/dist/chat-layout.d.ts +19 -0
  33. package/dist/chat-layout.js +91 -40
  34. package/dist/chat-message/social.d.ts +26 -0
  35. package/dist/chat-message/social.js +122 -0
  36. package/dist/chat-message.d.ts +28 -29
  37. package/dist/chat-message.js +106 -25
  38. package/dist/context.d.ts +2 -2
  39. package/dist/context.js +39 -24
  40. package/dist/dynamic-notification-canvas-loop.d.ts +24 -0
  41. package/dist/dynamic-notification-canvas-loop.js +113 -0
  42. package/dist/dynamic-notification-glass.js +23 -114
  43. package/dist/dynamic-notification-liquid.js +14 -118
  44. package/dist/dynamic-notification.d.ts +16 -8
  45. package/dist/dynamic-notification.js +86 -23
  46. package/dist/email/email-brand.d.ts +7 -4
  47. package/dist/email/email-brand.js +9 -6
  48. package/dist/email/email-code.d.ts +3 -2
  49. package/dist/email/email-code.js +11 -9
  50. package/dist/email/email-footer.d.ts +5 -3
  51. package/dist/email/email-footer.js +11 -5
  52. package/dist/email/email.d.ts +31 -9
  53. package/dist/email/email.js +50 -26
  54. package/dist/email/templates.d.ts +10 -9
  55. package/dist/email/templates.js +102 -38
  56. package/dist/email/theme.js +1 -1
  57. package/dist/environment-variables.d.ts +4 -2
  58. package/dist/environment-variables.js +52 -32
  59. package/dist/filter-bar/editor.js +20 -8
  60. package/dist/filter-bar/model.d.ts +1 -0
  61. package/dist/filter-bar/model.js +10 -1
  62. package/dist/filter-bar/motion.js +4 -4
  63. package/dist/filter-bar/parts.js +20 -9
  64. package/dist/filter-bar/types.d.ts +1 -0
  65. package/dist/filter-bar.js +20 -14
  66. package/dist/hooks/use-audio-recorder.js +12 -6
  67. package/dist/hooks/use-chat-composer.d.ts +19 -7
  68. package/dist/hooks/use-chat-composer.js +32 -5
  69. package/dist/hooks/use-chat-message.d.ts +28 -2
  70. package/dist/hooks/use-chat-message.js +41 -10
  71. package/dist/hooks/use-chat-thread-scroll.js +43 -7
  72. package/dist/hooks/use-color-area.d.ts +3 -3
  73. package/dist/hooks/use-color-area.js +13 -12
  74. package/dist/hooks/use-copy-to-clipboard.d.ts +2 -1
  75. package/dist/hooks/use-copy-to-clipboard.js +20 -20
  76. package/dist/hooks/use-dynamic-notification.d.ts +6 -2
  77. package/dist/hooks/use-dynamic-notification.js +26 -10
  78. package/dist/hooks/use-mobile.d.ts +3 -2
  79. package/dist/hooks/use-mobile.js +8 -4
  80. package/dist/hooks/use-textarea-trigger-menu.js +2 -1
  81. package/dist/hooks/use-trigger-menu.d.ts +54 -0
  82. package/dist/hooks/use-trigger-menu.js +102 -47
  83. package/dist/hooks/use-user-ask.d.ts +2 -0
  84. package/dist/hooks/use-user-ask.js +35 -41
  85. package/dist/inline-attachment.d.ts +6 -2
  86. package/dist/inline-attachment.js +36 -15
  87. package/dist/inline-citation.d.ts +12 -5
  88. package/dist/inline-citation.js +26 -17
  89. package/dist/knob-contracts/audio-recorder-knobs.d.ts +1 -1
  90. package/dist/knob-contracts/audio-recorder-knobs.js +2 -1
  91. package/dist/knob-contracts/audio-visualizer-knobs.d.ts +1 -1
  92. package/dist/knob-contracts/audio-visualizer-knobs.js +2 -1
  93. package/dist/knob-contracts/avatar-knobs.d.ts +1 -1
  94. package/dist/knob-contracts/avatar-knobs.js +6 -1
  95. package/dist/knob-contracts/badge-knobs.d.ts +1 -1
  96. package/dist/knob-contracts/badge-knobs.js +2 -1
  97. package/dist/knob-contracts/breadcrumb-knobs.d.ts +4 -0
  98. package/dist/knob-contracts/breadcrumb-knobs.js +8 -0
  99. package/dist/knob-contracts/button-knobs.d.ts +1 -1
  100. package/dist/knob-contracts/button-knobs.js +1 -0
  101. package/dist/knob-contracts/chat-message-knobs.d.ts +1 -1
  102. package/dist/knob-contracts/chat-message-knobs.js +8 -1
  103. package/dist/knob-contracts/code-diff-knobs.d.ts +1 -1
  104. package/dist/knob-contracts/code-diff-knobs.js +2 -0
  105. package/dist/knob-contracts/code-knobs.d.ts +1 -1
  106. package/dist/knob-contracts/code-knobs.js +2 -1
  107. package/dist/knob-contracts/dynamic-notification-knobs.d.ts +1 -1
  108. package/dist/knob-contracts/dynamic-notification-knobs.js +2 -0
  109. package/dist/knob-contracts/emoji-picker-knobs.d.ts +4 -0
  110. package/dist/knob-contracts/emoji-picker-knobs.js +10 -0
  111. package/dist/knob-contracts/field-knobs.d.ts +1 -1
  112. package/dist/knob-contracts/field-knobs.js +5 -1
  113. package/dist/knob-contracts/filter-bar-knobs.d.ts +1 -1
  114. package/dist/knob-contracts/filter-bar-knobs.js +1 -2
  115. package/dist/knob-contracts/markdown-knobs.d.ts +1 -1
  116. package/dist/knob-contracts/markdown-knobs.js +3 -1
  117. package/dist/knob-contracts/page-layout-knobs.d.ts +1 -1
  118. package/dist/knob-contracts/page-layout-knobs.js +2 -1
  119. package/dist/knob-contracts/popup-knobs.d.ts +1 -1
  120. package/dist/knob-contracts/popup-knobs.js +27 -0
  121. package/dist/knob-contracts/range-knobs.d.ts +1 -1
  122. package/dist/knob-contracts/range-knobs.js +1 -0
  123. package/dist/knob-contracts/rich-tooltip-knobs.d.ts +1 -1
  124. package/dist/knob-contracts/rich-tooltip-knobs.js +2 -1
  125. package/dist/knob-contracts/sidebar-knobs.d.ts +1 -1
  126. package/dist/knob-contracts/sidebar-knobs.js +27 -2
  127. package/dist/knob-contracts/spinner-knobs.d.ts +1 -1
  128. package/dist/knob-contracts/spinner-knobs.js +1 -1
  129. package/dist/knob-contracts/stepper-knobs.d.ts +1 -1
  130. package/dist/knob-contracts/stepper-knobs.js +4 -1
  131. package/dist/knob-contracts/switch-knobs.d.ts +1 -1
  132. package/dist/knob-contracts/switch-knobs.js +5 -0
  133. package/dist/knob-contracts/table-of-contents-knobs.d.ts +1 -1
  134. package/dist/knob-contracts/table-of-contents-knobs.js +2 -1
  135. package/dist/knob-contracts/tabs-knobs.d.ts +1 -1
  136. package/dist/knob-contracts/tabs-knobs.js +1 -0
  137. package/dist/knob-contracts/tree-knobs.d.ts +1 -1
  138. package/dist/knob-contracts/tree-knobs.js +2 -1
  139. package/dist/lib/cn.js +0 -4
  140. package/dist/lib/contrast.d.ts +1 -0
  141. package/dist/lib/contrast.js +17 -5
  142. package/dist/lib/dropzone-validation.js +41 -28
  143. package/dist/lib/env-file.d.ts +1 -1
  144. package/dist/lib/env-file.js +5 -5
  145. package/dist/lib/motion.d.ts +4 -0
  146. package/dist/lib/motion.js +15 -0
  147. package/dist/lib/phone-input-format.js +1 -1
  148. package/dist/lib/trigger-detect.js +6 -8
  149. package/dist/markdown-block.js +2 -1
  150. package/dist/popup-parts.d.ts +8 -0
  151. package/dist/popup-parts.js +43 -0
  152. package/dist/source-badge.js +3 -1
  153. package/dist/styles/code.css +0 -2
  154. package/dist/styles/effects.css +6 -32
  155. package/dist/styles/index.css +10 -5
  156. package/dist/styles/recipes/accordion.css +9 -6
  157. package/dist/styles/recipes/action-bar.css +0 -15
  158. package/dist/styles/recipes/activity.css +5 -11
  159. package/dist/styles/recipes/alert.css +4 -4
  160. package/dist/styles/recipes/audio-recorder.css +15 -3
  161. package/dist/styles/recipes/audio-visualizer.css +13 -2
  162. package/dist/styles/recipes/avatar.css +78 -1
  163. package/dist/styles/recipes/badge.css +14 -4
  164. package/dist/styles/recipes/breadcrumb.css +77 -0
  165. package/dist/styles/recipes/button-group.css +5 -7
  166. package/dist/styles/recipes/button-states.css +66 -0
  167. package/dist/styles/recipes/button.css +24 -83
  168. package/dist/styles/recipes/calendar.css +17 -23
  169. package/dist/styles/recipes/card.css +2 -2
  170. package/dist/styles/recipes/chat-composer-attachment.css +9 -3
  171. package/dist/styles/recipes/chat-composer.css +7 -10
  172. package/dist/styles/recipes/chat-layout.css +35 -0
  173. package/dist/styles/recipes/chat-message-social.css +123 -0
  174. package/dist/styles/recipes/chat-message.css +157 -37
  175. package/dist/styles/recipes/choice.css +18 -21
  176. package/dist/styles/recipes/code-diff.css +46 -33
  177. package/dist/styles/recipes/code.css +36 -16
  178. package/dist/styles/recipes/collapsible.css +7 -2
  179. package/dist/styles/recipes/color-picker-details.css +3 -4
  180. package/dist/styles/recipes/color-picker-values.css +9 -8
  181. package/dist/styles/recipes/color-picker.css +11 -2
  182. package/dist/styles/recipes/context.css +3 -3
  183. package/dist/styles/recipes/dockable-panel.css +7 -4
  184. package/dist/styles/recipes/dropzone.css +7 -8
  185. package/dist/styles/recipes/dynamic-notification-input.css +8 -5
  186. package/dist/styles/recipes/dynamic-notification-motion.css +12 -21
  187. package/dist/styles/recipes/dynamic-notification.css +40 -26
  188. package/dist/styles/recipes/emoji-picker.css +132 -0
  189. package/dist/styles/recipes/empty.css +5 -4
  190. package/dist/styles/recipes/environment-variables.css +4 -15
  191. package/dist/styles/recipes/field-parts.css +30 -24
  192. package/dist/styles/recipes/field.css +61 -26
  193. package/dist/styles/recipes/filter-bar.css +18 -31
  194. package/dist/styles/recipes/gradient-editor.css +18 -7
  195. package/dist/styles/recipes/infinite-canvas.css +0 -1
  196. package/dist/styles/recipes/inline-attachment.css +3 -3
  197. package/dist/styles/recipes/inline-citation.css +10 -4
  198. package/dist/styles/recipes/item.css +23 -9
  199. package/dist/styles/recipes/markdown-block.css +5 -4
  200. package/dist/styles/recipes/markdown.css +68 -26
  201. package/dist/styles/recipes/morphing-panel.css +8 -8
  202. package/dist/styles/recipes/page-layout.css +20 -12
  203. package/dist/styles/recipes/pagination.css +4 -5
  204. package/dist/styles/recipes/phone-input.css +12 -8
  205. package/dist/styles/recipes/popup-controls.css +166 -33
  206. package/dist/styles/recipes/popup-drawer.css +3 -14
  207. package/dist/styles/recipes/popup-lists.css +128 -27
  208. package/dist/styles/recipes/popup-motion.css +4 -45
  209. package/dist/styles/recipes/popup-toast.css +55 -26
  210. package/dist/styles/recipes/popup.css +139 -141
  211. package/dist/styles/recipes/range.css +54 -18
  212. package/dist/styles/recipes/resizable.css +2 -7
  213. package/dist/styles/recipes/rich-tooltip.css +24 -34
  214. package/dist/styles/recipes/scroll-area.css +8 -1
  215. package/dist/styles/recipes/sidebar-menu.css +149 -34
  216. package/dist/styles/recipes/sidebar-parts.css +154 -0
  217. package/dist/styles/recipes/sidebar.css +187 -128
  218. package/dist/styles/recipes/source-badge.css +1 -1
  219. package/dist/styles/recipes/spinner.css +8 -1
  220. package/dist/styles/recipes/stepper.css +31 -13
  221. package/dist/styles/recipes/switch.css +68 -23
  222. package/dist/styles/recipes/table-of-contents.css +9 -1
  223. package/dist/styles/recipes/table.css +14 -10
  224. package/dist/styles/recipes/tabs.css +17 -12
  225. package/dist/styles/recipes/task-list.css +7 -14
  226. package/dist/styles/recipes/thread-rail.css +42 -19
  227. package/dist/styles/recipes/timeline.css +2 -0
  228. package/dist/styles/recipes/toolbar.css +27 -25
  229. package/dist/styles/recipes/track-highlight.css +10 -7
  230. package/dist/styles/recipes/tree.css +31 -4
  231. package/dist/styles/recipes/user-ask-details.css +0 -1
  232. package/dist/styles/recipes/user-ask.css +4 -4
  233. package/dist/styles/theme.css +37 -16
  234. package/dist/task-list.d.ts +4 -1
  235. package/dist/task-list.js +24 -8
  236. package/dist/thread-rail.d.ts +1 -1
  237. package/dist/thread-rail.js +61 -19
  238. package/dist/transcript-divider.js +2 -1
  239. package/dist/ui/alert-dialog.js +1 -1
  240. package/dist/ui/alert.d.ts +3 -1
  241. package/dist/ui/alert.js +14 -8
  242. package/dist/ui/autocomplete.js +4 -2
  243. package/dist/ui/avatar.d.ts +8 -0
  244. package/dist/ui/avatar.js +23 -3
  245. package/dist/ui/badge.js +1 -1
  246. package/dist/ui/breadcrumb.d.ts +27 -0
  247. package/dist/ui/breadcrumb.js +88 -0
  248. package/dist/ui/button.d.ts +2 -1
  249. package/dist/ui/button.js +3 -3
  250. package/dist/ui/calendar.js +2 -2
  251. package/dist/ui/card.d.ts +3 -1
  252. package/dist/ui/card.js +12 -7
  253. package/dist/ui/checkbox.d.ts +2 -0
  254. package/dist/ui/code-diff.d.ts +1 -1
  255. package/dist/ui/code-diff.js +72 -28
  256. package/dist/ui/code.d.ts +5 -3
  257. package/dist/ui/code.js +28 -29
  258. package/dist/ui/collapsible.js +1 -1
  259. package/dist/ui/color-picker.d.ts +5 -2
  260. package/dist/ui/color-picker.js +85 -37
  261. package/dist/ui/combobox-disabled-selection.d.ts +1 -2
  262. package/dist/ui/combobox-disabled-selection.js +7 -9
  263. package/dist/ui/combobox.js +14 -6
  264. package/dist/ui/command.d.ts +8 -2
  265. package/dist/ui/command.js +30 -14
  266. package/dist/ui/context-menu.js +4 -1
  267. package/dist/ui/dialog.d.ts +2 -1
  268. package/dist/ui/dialog.js +4 -23
  269. package/dist/ui/dockable-panel-geometry.d.ts +1 -0
  270. package/dist/ui/dockable-panel-geometry.js +7 -1
  271. package/dist/ui/dockable-panel.d.ts +9 -6
  272. package/dist/ui/dockable-panel.js +63 -23
  273. package/dist/ui/drawer.js +1 -1
  274. package/dist/ui/dropdown-menu.js +5 -4
  275. package/dist/ui/dropzone.d.ts +2 -2
  276. package/dist/ui/dropzone.js +75 -16
  277. package/dist/ui/emoji-picker.d.ts +18 -0
  278. package/dist/ui/emoji-picker.js +136 -0
  279. package/dist/ui/empty.d.ts +3 -1
  280. package/dist/ui/empty.js +12 -7
  281. package/dist/ui/gradient-editor.d.ts +1 -1
  282. package/dist/ui/gradient-editor.js +37 -21
  283. package/dist/ui/hover-card.js +1 -1
  284. package/dist/ui/infinite-canvas.d.ts +3 -2
  285. package/dist/ui/infinite-canvas.js +63 -19
  286. package/dist/ui/input-group.d.ts +0 -3
  287. package/dist/ui/input-group.js +4 -14
  288. package/dist/ui/input-otp.d.ts +1 -1
  289. package/dist/ui/input-otp.js +32 -15
  290. package/dist/ui/input.js +4 -4
  291. package/dist/ui/item.d.ts +2 -1
  292. package/dist/ui/item.js +12 -8
  293. package/dist/ui/live-status.d.ts +7 -0
  294. package/dist/ui/live-status.js +17 -0
  295. package/dist/ui/markdown-elements.d.ts +6 -0
  296. package/dist/ui/markdown-elements.js +31 -1
  297. package/dist/ui/menubar.js +3 -3
  298. package/dist/ui/morphing-panel.js +3 -2
  299. package/dist/ui/native-select.d.ts +1 -1
  300. package/dist/ui/native-select.js +24 -11
  301. package/dist/ui/navigation-menu.js +1 -1
  302. package/dist/ui/page-layout.d.ts +2 -2
  303. package/dist/ui/page-layout.js +2 -4
  304. package/dist/ui/pagination.d.ts +7 -5
  305. package/dist/ui/pagination.js +19 -13
  306. package/dist/ui/phone-input.d.ts +1 -0
  307. package/dist/ui/phone-input.js +58 -60
  308. package/dist/ui/popover.js +1 -1
  309. package/dist/ui/radio-group.d.ts +2 -0
  310. package/dist/ui/resizable.d.ts +3 -2
  311. package/dist/ui/resizable.js +5 -3
  312. package/dist/ui/responsive-dialog.d.ts +1 -1
  313. package/dist/ui/responsive-dialog.js +4 -21
  314. package/dist/ui/rich-tooltip.d.ts +10 -4
  315. package/dist/ui/rich-tooltip.js +82 -34
  316. package/dist/ui/scroll-area.d.ts +1 -1
  317. package/dist/ui/scroll-area.js +43 -28
  318. package/dist/ui/select.js +1 -1
  319. package/dist/ui/sheet.js +1 -1
  320. package/dist/ui/sidebar-menu.d.ts +5 -1
  321. package/dist/ui/sidebar-menu.js +32 -34
  322. package/dist/ui/sidebar-provider.d.ts +10 -1
  323. package/dist/ui/sidebar-provider.js +39 -14
  324. package/dist/ui/sidebar-resize-rail.js +8 -4
  325. package/dist/ui/sidebar.d.ts +11 -6
  326. package/dist/ui/sidebar.js +47 -24
  327. package/dist/ui/slider.js +31 -22
  328. package/dist/ui/spinner.d.ts +3 -2
  329. package/dist/ui/spinner.js +3 -2
  330. package/dist/ui/stepper.d.ts +8 -1
  331. package/dist/ui/stepper.js +74 -25
  332. package/dist/ui/switch.d.ts +1 -0
  333. package/dist/ui/table-of-contents.d.ts +2 -2
  334. package/dist/ui/table-of-contents.js +20 -8
  335. package/dist/ui/table.js +4 -2
  336. package/dist/ui/textarea.d.ts +1 -1
  337. package/dist/ui/textarea.js +20 -9
  338. package/dist/ui/timeline.d.ts +3 -1
  339. package/dist/ui/timeline.js +17 -9
  340. package/dist/ui/toast.d.ts +11 -5
  341. package/dist/ui/toast.js +101 -55
  342. package/dist/ui/toolbar.d.ts +3 -2
  343. package/dist/ui/toolbar.js +4 -2
  344. package/dist/ui/tooltip.js +4 -21
  345. package/dist/ui/tree.js +121 -81
  346. package/dist/ui/trigger-menu.js +2 -1
  347. package/dist/user-ask.d.ts +10 -5
  348. package/dist/user-ask.js +32 -12
  349. package/package.json +5 -1
  350. package/dist/hooks/use-keyboard-navigation.d.ts +0 -3
  351. package/dist/hooks/use-keyboard-navigation.js +0 -22
@@ -1,11 +1,13 @@
1
1
  "use client";
2
- import { controlEffectsAttribute } from "../skin.js";
3
2
  import { cn } from "../lib/cn.js";
3
+ import { controlEffectsAttribute } from "../skin.js";
4
4
  import { useSkin } from "../skin-provider.js";
5
+ import { prefersReducedMotion } from "../lib/motion.js";
6
+ import { PopupArrowShape } from "../popup-parts.js";
5
7
  import { stepAfter, stepBefore, tourPosition } from "./rich-tooltip-tour.js";
6
- import { createContext, useContext, useEffect, useState } from "react";
8
+ import { createContext, useContext, useEffect, useId, useRef, useState } from "react";
7
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
- import { ChevronLeftIcon, ChevronRightIcon, XIcon } from "lucide-react";
10
+ import { CheckIcon, ChevronLeftIcon, ChevronRightIcon, XIcon } from "lucide-react";
9
11
  import { Popover } from "@base-ui/react/popover";
10
12
  //#region src/ui/rich-tooltip.tsx
11
13
  const TourContext = createContext(null);
@@ -66,11 +68,14 @@ function useRichTooltipContext() {
66
68
  if (!context) throw new Error("RichTooltip parts must be rendered inside <RichTooltip>.");
67
69
  return context;
68
70
  }
69
- function RichTooltip({ step, tone = "accent", storageKey, dismissOnOutsidePress = false, trapFocus = false, open, defaultOpen = true, onOpenChange, children, ...props }) {
71
+ function RichTooltip({ step, tone = "accent", storageKey, dismissOnOutsidePress = false, dismissOnFocusOut = false, trapFocus = false, open, defaultOpen = true, onOpenChange, children, ...props }) {
70
72
  const tour = useTour();
71
73
  const inTour = tour !== null && step !== void 0;
72
74
  const [standaloneOpen, setStandaloneOpen] = useState(defaultOpen);
73
75
  const standaloneAllowed = useSeenGate(storageKey, open === void 0 && !inTour);
76
+ const nextRef = useRef(null);
77
+ const [descriptionId, setDescriptionId] = useState();
78
+ const [progressId, setProgressId] = useState();
74
79
  const resolvedOpen = open ?? (inTour ? tour.activeStep === step : standaloneOpen && standaloneAllowed);
75
80
  function dismiss() {
76
81
  if (inTour) {
@@ -82,12 +87,19 @@ function RichTooltip({ step, tone = "accent", storageKey, dismissOnOutsidePress
82
87
  }
83
88
  const handleOpenChange = (nextOpen, details) => {
84
89
  if (!dismissOnOutsidePress && details.reason === "outside-press") return;
90
+ if (!dismissOnFocusOut && details.reason === "focus-out") return;
85
91
  onOpenChange?.(nextOpen, details);
86
92
  if (!nextOpen) dismiss();
87
93
  };
88
94
  const context = {
89
95
  tone,
90
- dismiss
96
+ inTour,
97
+ dismiss,
98
+ nextRef,
99
+ descriptionId,
100
+ setDescriptionId,
101
+ progressId,
102
+ setProgressId
91
103
  };
92
104
  return /* @__PURE__ */ jsx(RichTooltipContext.Provider, {
93
105
  value: context,
@@ -122,11 +134,10 @@ function useAnchorScroll(anchor, open, enabled) {
122
134
  if (!(open && enabled)) return;
123
135
  const element = resolveAnchorElement(anchor);
124
136
  if (!element) return;
125
- const reduced = globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
126
137
  element.scrollIntoView({
127
138
  block: "center",
128
139
  inline: "nearest",
129
- behavior: reduced ? "auto" : "smooth"
140
+ behavior: prefersReducedMotion(element) ? "auto" : "smooth"
130
141
  });
131
142
  }, [
132
143
  anchor,
@@ -134,11 +145,20 @@ function useAnchorScroll(anchor, open, enabled) {
134
145
  open
135
146
  ]);
136
147
  }
148
+ const richTooltipContentSelector = "[data-control-ui=\"rich-tooltip\"][data-slot=\"content\"]";
137
149
  function RichTooltipContent({ className, children, side = "bottom", align = "center", sideOffset = 10, anchor, collisionPadding = 12, arrow = true, scrollAnchorIntoView = true, ...props }) {
138
150
  const skin = useSkin();
139
- const { tone } = useRichTooltipContext();
151
+ const { tone, inTour, nextRef, descriptionId, progressId } = useRichTooltipContext();
140
152
  const isSurface = tone === "surface";
141
153
  useAnchorScroll(anchor, true, scrollAnchorIntoView);
154
+ const describedBy = [descriptionId, progressId].filter(Boolean).join(" ") || void 0;
155
+ const initialFocus = (openType) => {
156
+ const active = document.activeElement;
157
+ const openedWithoutInteraction = !openType;
158
+ const focusIsElsewhere = active !== null && active !== document.body && active.closest(richTooltipContentSelector) === null;
159
+ if (openedWithoutInteraction && focusIsElsewhere) return false;
160
+ return inTour && nextRef.current ? nextRef.current : true;
161
+ };
142
162
  return /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, {
143
163
  "data-control-ui": "rich-tooltip",
144
164
  "data-popup-kind": "rich-tooltip",
@@ -161,6 +181,8 @@ function RichTooltipContent({ className, children, side = "bottom", align = "cen
161
181
  "data-surface": isSurface ? "floating" : void 0,
162
182
  "data-popup-part": isSurface ? "surface" : void 0,
163
183
  className: cn("relative grid w-80 max-w-[calc(100vw-2rem)]", className),
184
+ initialFocus,
185
+ "aria-describedby": describedBy,
164
186
  ...props,
165
187
  children: [children, arrow ? /* @__PURE__ */ jsx(Popover.Arrow, {
166
188
  "data-control-ui": "rich-tooltip",
@@ -168,24 +190,12 @@ function RichTooltipContent({ className, children, side = "bottom", align = "cen
168
190
  "data-control-family": "popup",
169
191
  "data-slot": "arrow",
170
192
  "data-tone": tone,
171
- className: cn("flex", "data-[side=top]:-bottom-[8px]", "data-[side=bottom]:-top-[8px]", "data-[side=left]:-right-[10px]", "data-[side=right]:-left-[10px]"),
172
- children: /* @__PURE__ */ jsx(RichTooltipArrowSvg, {})
193
+ className: "flex",
194
+ children: /* @__PURE__ */ jsx(PopupArrowShape, {})
173
195
  }) : null]
174
196
  })
175
197
  }) });
176
198
  }
177
- function RichTooltipArrowSvg() {
178
- return /* @__PURE__ */ jsx("svg", {
179
- "aria-hidden": "true",
180
- focusable: "false",
181
- width: "12",
182
- height: "8",
183
- viewBox: "0 0 12 8",
184
- fill: "none",
185
- overflow: "visible",
186
- children: /* @__PURE__ */ jsx("path", { d: "M0 7L4 2Q6 0 8 2L12 7L12 8L0 8Z" })
187
- });
188
- }
189
199
  function RichTooltipMedia({ className, ...props }) {
190
200
  return /* @__PURE__ */ jsx("div", {
191
201
  "data-control-ui": "rich-tooltip",
@@ -217,8 +227,15 @@ function RichTooltipTitle({ className, ...props }) {
217
227
  });
218
228
  }
219
229
  function RichTooltipDescription({ className, ...props }) {
220
- const { tone } = useRichTooltipContext();
230
+ const { tone, setDescriptionId } = useRichTooltipContext();
231
+ const generatedId = useId();
232
+ const id = props.id ?? generatedId;
233
+ useEffect(() => {
234
+ setDescriptionId(id);
235
+ return () => setDescriptionId(void 0);
236
+ }, [id, setDescriptionId]);
221
237
  return /* @__PURE__ */ jsx(Popover.Description, {
238
+ id,
222
239
  "data-control-ui": "rich-tooltip",
223
240
  "data-control-family": "popup",
224
241
  "data-popup-kind": "rich-tooltip",
@@ -239,9 +256,20 @@ function RichTooltipFooter({ className, ...props }) {
239
256
  });
240
257
  }
241
258
  function RichTooltipProgress({ className, variant = "count", children, ...props }) {
242
- const { tone } = useRichTooltipContext();
259
+ const { tone, setProgressId } = useRichTooltipContext();
243
260
  const tour = useTour();
244
- if (!tour || tour.total < 2 || tour.index < 0) return null;
261
+ const statusId = useId();
262
+ const rendered = tour !== null && tour.total >= 2 && tour.index >= 0;
263
+ useEffect(() => {
264
+ if (!rendered) return;
265
+ setProgressId(statusId);
266
+ return () => setProgressId(void 0);
267
+ }, [
268
+ rendered,
269
+ statusId,
270
+ setProgressId
271
+ ]);
272
+ if (!tour || !rendered) return null;
245
273
  return /* @__PURE__ */ jsxs("div", {
246
274
  "data-control-ui": "rich-tooltip",
247
275
  "data-control-family": "popup",
@@ -252,6 +280,7 @@ function RichTooltipProgress({ className, variant = "count", children, ...props
252
280
  className: cn("flex items-center", className),
253
281
  ...props,
254
282
  children: [/* @__PURE__ */ jsx("span", {
283
+ id: statusId,
255
284
  className: "sr-only",
256
285
  children: `Step ${tour.index + 1} of ${tour.total}`
257
286
  }), children ?? (variant === "dots" ? Array.from({ length: tour.total }, (_, dot) => /* @__PURE__ */ jsx("span", {
@@ -267,8 +296,12 @@ function RichTooltipProgress({ className, variant = "count", children, ...props
267
296
  }))]
268
297
  });
269
298
  }
299
+ function assignRef(ref, node) {
300
+ if (typeof ref === "function") ref(node);
301
+ else if (ref) ref.current = node;
302
+ }
270
303
  const actionClasses = "inline-flex shrink-0 cursor-pointer items-center justify-center disabled:pointer-events-none [&_svg]:size-4";
271
- function RichTooltipPrevious({ className, children, onClick, ...props }) {
304
+ function RichTooltipPrevious({ className, children, label = "Previous step", onClick, ...props }) {
272
305
  const tour = useTour();
273
306
  if (!tour || tour.total < 2) return null;
274
307
  return /* @__PURE__ */ jsx("button", {
@@ -277,6 +310,7 @@ function RichTooltipPrevious({ className, children, onClick, ...props }) {
277
310
  "data-control-family": "popup",
278
311
  "data-popup-kind": "rich-tooltip",
279
312
  "data-slot": "previous",
313
+ "data-icon-only": children === void 0 ? "true" : void 0,
280
314
  disabled: tour.isFirst,
281
315
  onClick: (event) => {
282
316
  onClick?.(event);
@@ -284,21 +318,30 @@ function RichTooltipPrevious({ className, children, onClick, ...props }) {
284
318
  },
285
319
  className: cn(actionClasses, className),
286
320
  ...props,
287
- children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ChevronLeftIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", {
321
+ children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ChevronLeftIcon, {
322
+ "aria-hidden": "true",
323
+ "data-icon-dir": "inline"
324
+ }), /* @__PURE__ */ jsx("span", {
288
325
  className: "sr-only",
289
- children: "Previous step"
326
+ children: label
290
327
  })] })
291
328
  });
292
329
  }
293
- function RichTooltipNext({ className, children, onClick, ...props }) {
294
- const { dismiss } = useRichTooltipContext();
330
+ function RichTooltipNext({ className, children, nextLabel = "Next step", finishLabel = "Finish", gotItLabel = "Got it", onClick, ref, ...props }) {
331
+ const { dismiss, nextRef } = useRichTooltipContext();
295
332
  const tour = useTour();
333
+ const setRef = (node) => {
334
+ nextRef.current = node;
335
+ assignRef(ref, node);
336
+ };
296
337
  return /* @__PURE__ */ jsx("button", {
297
338
  type: "button",
298
339
  "data-control-ui": "rich-tooltip",
299
340
  "data-control-family": "popup",
300
341
  "data-popup-kind": "rich-tooltip",
301
342
  "data-slot": "next",
343
+ "data-icon-only": children === void 0 && tour ? "true" : void 0,
344
+ ref: setRef,
302
345
  onClick: (event) => {
303
346
  onClick?.(event);
304
347
  if (event.defaultPrevented) return;
@@ -309,21 +352,26 @@ function RichTooltipNext({ className, children, onClick, ...props }) {
309
352
  ...props,
310
353
  children: children ?? (tour ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
311
354
  className: "sr-only",
312
- children: tour.isLast ? "Finish" : "Next step"
313
- }), /* @__PURE__ */ jsx(ChevronRightIcon, { "aria-hidden": "true" })] }) : "Got it")
355
+ children: tour.isLast ? finishLabel : nextLabel
356
+ }), tour.isLast ? /* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(ChevronRightIcon, {
357
+ "aria-hidden": "true",
358
+ "data-icon-dir": "inline"
359
+ })] }) : gotItLabel)
314
360
  });
315
361
  }
316
- function RichTooltipClose({ className, children, ...props }) {
362
+ function RichTooltipClose({ className, children, label, ...props }) {
363
+ const { inTour } = useRichTooltipContext();
317
364
  return /* @__PURE__ */ jsx(Popover.Close, {
318
365
  "data-control-ui": "rich-tooltip",
319
366
  "data-control-family": "popup",
320
367
  "data-popup-kind": "rich-tooltip",
321
368
  "data-slot": "close",
369
+ "data-icon-only": children === void 0 ? "true" : void 0,
322
370
  className: cn(actionClasses, className),
323
371
  ...props,
324
372
  children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(XIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", {
325
373
  className: "sr-only",
326
- children: "Dismiss"
374
+ children: label ?? (inTour ? "End tour" : "Dismiss")
327
375
  })] })
328
376
  });
329
377
  }
@@ -26,5 +26,5 @@ export type ScrollAreaProps = Omit<ComponentProps<"div">, "style"> & {
26
26
  lockAxis?: ScrollAreaLockAxis;
27
27
  scrollbarVisibility?: ScrollAreaScrollbarVisibility;
28
28
  };
29
- export declare function ScrollArea({ className, viewportClassName, contentClassName, viewportProps, viewportRef, maxHeight, mask, blur, blurProps, lockAxis, scrollbarVisibility, children, style, ...props }: ScrollAreaProps): import("react").JSX.Element;
29
+ export declare function ScrollArea({ className, viewportClassName, contentClassName, viewportProps, viewportRef, maxHeight, mask, blur, blurProps, lockAxis, scrollbarVisibility, children, style, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ...props }: ScrollAreaProps): import("react").JSX.Element;
30
30
  //#endregion
@@ -2,7 +2,7 @@
2
2
  import { cn } from "../lib/cn.js";
3
3
  import { useSkin } from "../skin-provider.js";
4
4
  import { ProgressiveBlur } from "./progressive-blur.js";
5
- import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
7
7
  //#region src/ui/scroll-area.tsx
8
8
  const scrollAreaScrollbarVisibilities = [
@@ -27,25 +27,54 @@ function Scrollbar({ orientation, visibility, thumbStyle }) {
27
27
  })
28
28
  });
29
29
  }
30
- function viewportStyle(maxHeight, lockX, lockY) {
31
- if (!maxHeight && !lockX && !lockY) return void 0;
30
+ function viewportStyle(baseStyle, maxHeight, lockX, lockY) {
31
+ if (!maxHeight && !lockX && !lockY) return baseStyle;
32
32
  return {
33
+ ...baseStyle,
33
34
  ...maxHeight ? { maxHeight } : {},
34
35
  ...lockX ? { overflowX: "hidden" } : {},
35
36
  ...lockY ? { overflowY: "hidden" } : {}
36
37
  };
37
38
  }
38
- function ScrollArea({ className, viewportClassName, contentClassName, viewportProps, viewportRef, maxHeight, mask = true, blur, blurProps, lockAxis, scrollbarVisibility = "hover", children, style, ...props }) {
39
+ function regionProps(ariaLabel, ariaLabelledby) {
40
+ if (!ariaLabel && !ariaLabelledby) return {};
41
+ return {
42
+ role: "region",
43
+ "aria-label": ariaLabel,
44
+ "aria-labelledby": ariaLabelledby
45
+ };
46
+ }
47
+ function EdgeBlurs({ blurProps, lockX, lockY }) {
48
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
49
+ !lockY && /* @__PURE__ */ jsx(ProgressiveBlur, {
50
+ ...blurProps,
51
+ side: "top",
52
+ visible: false
53
+ }),
54
+ !lockY && /* @__PURE__ */ jsx(ProgressiveBlur, {
55
+ ...blurProps,
56
+ side: "bottom",
57
+ visible: false
58
+ }),
59
+ !lockX && /* @__PURE__ */ jsx(ProgressiveBlur, {
60
+ ...blurProps,
61
+ side: "inline-start",
62
+ visible: false
63
+ }),
64
+ !lockX && /* @__PURE__ */ jsx(ProgressiveBlur, {
65
+ ...blurProps,
66
+ side: "inline-end",
67
+ visible: false
68
+ })
69
+ ] });
70
+ }
71
+ function ScrollArea({ className, viewportClassName, contentClassName, viewportProps, viewportRef, maxHeight, mask = true, blur, blurProps, lockAxis, scrollbarVisibility = "hover", children, style, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ...props }) {
39
72
  const skin = useSkin();
40
73
  const resolvedBlur = blur ?? skin.scrollAreaBlur ?? false;
41
74
  const lockX = lockAxis === "x" || lockAxis === "both";
42
75
  const lockY = lockAxis === "y" || lockAxis === "both";
43
- const resolvedViewportStyle = viewportStyle(maxHeight, lockX, lockY);
44
76
  const { style: viewportPropsStyle, ...resolvedViewportProps } = viewportProps ?? {};
45
- const mergedViewportStyle = viewportPropsStyle || resolvedViewportStyle ? {
46
- ...viewportPropsStyle,
47
- ...resolvedViewportStyle
48
- } : void 0;
77
+ const mergedViewportStyle = viewportStyle(viewportPropsStyle, maxHeight, lockX, lockY);
49
78
  const thumbStyle = style;
50
79
  const cornerStyle = style;
51
80
  return /* @__PURE__ */ jsxs(ScrollArea$1.Root, {
@@ -64,6 +93,7 @@ function ScrollArea({ className, viewportClassName, contentClassName, viewportPr
64
93
  "data-control-family": "scroll-area",
65
94
  "data-slot": "viewport",
66
95
  ...resolvedViewportProps,
96
+ ...regionProps(ariaLabel, ariaLabelledby),
67
97
  "data-scroll-area-viewport": "",
68
98
  ref: viewportRef,
69
99
  className: cn("h-full w-full", viewportClassName),
@@ -77,25 +107,10 @@ function ScrollArea({ className, viewportClassName, contentClassName, viewportPr
77
107
  children
78
108
  })
79
109
  }),
80
- resolvedBlur && !lockY && /* @__PURE__ */ jsx(ProgressiveBlur, {
81
- ...blurProps,
82
- side: "top",
83
- visible: false
84
- }),
85
- resolvedBlur && !lockY && /* @__PURE__ */ jsx(ProgressiveBlur, {
86
- ...blurProps,
87
- side: "bottom",
88
- visible: false
89
- }),
90
- resolvedBlur && !lockX && /* @__PURE__ */ jsx(ProgressiveBlur, {
91
- ...blurProps,
92
- side: "inline-start",
93
- visible: false
94
- }),
95
- resolvedBlur && !lockX && /* @__PURE__ */ jsx(ProgressiveBlur, {
96
- ...blurProps,
97
- side: "inline-end",
98
- visible: false
110
+ resolvedBlur && /* @__PURE__ */ jsx(EdgeBlurs, {
111
+ blurProps,
112
+ lockX,
113
+ lockY
99
114
  }),
100
115
  !lockY && /* @__PURE__ */ jsx(Scrollbar, {
101
116
  orientation: "vertical",
package/dist/ui/select.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { controlEffectsAttribute } from "../skin.js";
3
2
  import { cn } from "../lib/cn.js";
3
+ import { controlEffectsAttribute } from "../skin.js";
4
4
  import { useSkin } from "../skin-provider.js";
5
5
  import { Button } from "./button.js";
6
6
  import { ScrollArea } from "./scroll-area.js";
package/dist/ui/sheet.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { controlEffectsAttribute } from "../skin.js";
3
2
  import { cn } from "../lib/cn.js";
3
+ import { controlEffectsAttribute } from "../skin.js";
4
4
  import { useSkin } from "../skin-provider.js";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { Dialog } from "@base-ui/react/dialog";
@@ -43,6 +43,10 @@ export declare function SidebarMenu({ className, indicator, style, children, ...
43
43
  export declare function SidebarMenuItem({ className, ...props }: ComponentProps<"li"> & {
44
44
  style?: CSSProperties & SidebarKnobStyle;
45
45
  }): import("react").JSX.Element;
46
- export declare function SidebarMenuButton({ render, isActive, variant, size, tooltip, className, children, ...props }: SidebarMenuButtonProps): import("react").JSX.Element;
46
+ export type SidebarMenuBadgeProps = Omit<ComponentProps<"div">, "style"> & {
47
+ style?: CSSProperties & SidebarKnobStyle;
48
+ };
49
+ export declare function SidebarMenuBadge({ className, ...props }: SidebarMenuBadgeProps): import("react").JSX.Element;
50
+ export declare function SidebarMenuButton({ render, isActive, variant, size, tooltip, className, children, ref, ...props }: SidebarMenuButtonProps): import("react").JSX.Element;
47
51
  export declare function SidebarMenuSub({ className, ...props }: ComponentProps<typeof SidebarMenu>): import("react").JSX.Element;
48
52
  //#endregion
@@ -2,12 +2,11 @@
2
2
  import { cn } from "../lib/cn.js";
3
3
  import { useSkin } from "../skin-provider.js";
4
4
  import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
5
- import { useSidebar } from "./sidebar-provider.js";
5
+ import { SidebarSurfaceContext, useSidebar } from "./sidebar-provider.js";
6
6
  import { TrackHighlight } from "../extensions/track-highlight.js";
7
- import { createContext, useContext } from "react";
8
- import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { createContext, useContext, useRef, useState } from "react";
9
8
  import { useRender } from "@base-ui/react/use-render";
10
- import { cva } from "class-variance-authority";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
11
10
  //#region src/ui/sidebar-menu.tsx
12
11
  const sidebarMenuButtonVariants = ["default", "outline"];
13
12
  const sidebarMenuButtonSizes = [
@@ -102,31 +101,28 @@ function SidebarMenuItem({ className, ...props }) {
102
101
  ...props
103
102
  });
104
103
  }
105
- const sidebarMenuButtonClasses = cva("peer/menu-button flex w-full items-center overflow-hidden text-start group-data-[collapsible=icon]:px-0! disabled:pointer-events-none aria-disabled:pointer-events-none [&>span]:truncate [&>svg]:size-4 [&>svg]:shrink-0", {
106
- variants: {
107
- variant: {
108
- default: null,
109
- outline: null
110
- },
111
- size: {
112
- default: "group-data-[collapsible=icon]:size-[var(--control-h-md)]!",
113
- sm: "group-data-[collapsible=icon]:size-[var(--control-h-sm)]!",
114
- lg: "group-data-[collapsible=icon]:size-[var(--control-h-lg)]!"
115
- }
116
- },
117
- defaultVariants: {
118
- variant: "default",
119
- size: "default"
120
- }
121
- });
122
- function SidebarMenuButton({ render, isActive = false, variant = "default", size = "default", tooltip, className, children, ...props }) {
104
+ function SidebarMenuBadge({ className, ...props }) {
105
+ return /* @__PURE__ */ jsx("div", {
106
+ "data-control-ui": "sidebar",
107
+ "data-control-family": "sidebar",
108
+ "data-slot": "menu-badge",
109
+ className: cn("pointer-events-none absolute flex -translate-y-1/2 select-none items-center justify-center tabular-nums group-data-[collapsible=icon]:hidden", className),
110
+ ...props
111
+ });
112
+ }
113
+ function SidebarMenuButton({ render, isActive = false, variant = "default", size = "default", tooltip, className, children, ref, ...props }) {
123
114
  const { isMobile, state } = useSidebar();
115
+ const surface = useContext(SidebarSurfaceContext);
124
116
  const indicator = useContext(SidebarMenuContext);
117
+ const buttonRef = useRef(null);
118
+ const [textLabel, setTextLabel] = useState("");
125
119
  const button = useRender({
126
120
  defaultTagName: "button",
127
121
  render,
122
+ ref: [ref ?? null, buttonRef],
128
123
  props: {
129
124
  type: "button",
125
+ "aria-current": isActive ? "page" : void 0,
130
126
  ...props,
131
127
  "data-control-ui": "sidebar",
132
128
  "data-control-family": "sidebar",
@@ -135,20 +131,22 @@ function SidebarMenuButton({ render, isActive = false, variant = "default", size
135
131
  "data-variant": variant,
136
132
  "data-active": isActive || void 0,
137
133
  "data-track-item": indicator !== "none" ? "" : void 0,
138
- className: cn(sidebarMenuButtonClasses({
139
- variant,
140
- size
141
- }), className),
134
+ className: cn("peer/menu-button flex w-full items-center overflow-hidden text-start group-data-[collapsible=icon]:w-(--cui-sidebar-menu-button-height) disabled:pointer-events-none aria-disabled:pointer-events-none [&>span]:truncate [&>svg]:size-4 [&>svg]:shrink-0", className),
142
135
  children
143
136
  }
144
137
  });
145
- if (!tooltip) return button;
146
- return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: button }), /* @__PURE__ */ jsx(TooltipContent, {
147
- side: "right",
148
- align: "center",
149
- hidden: state !== "collapsed" || isMobile,
150
- children: tooltip
151
- })] });
138
+ if (!tooltip && surface?.collapsible !== "icon") return button;
139
+ return /* @__PURE__ */ jsxs(Tooltip, {
140
+ onOpenChange: (open) => {
141
+ if (open && !tooltip) setTextLabel(buttonRef.current?.textContent?.trim() ?? "");
142
+ },
143
+ children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: button }), /* @__PURE__ */ jsx(TooltipContent, {
144
+ side: surface?.side === "right" ? "inline-start" : "inline-end",
145
+ align: "center",
146
+ hidden: state !== "collapsed" || isMobile,
147
+ children: tooltip ?? textLabel
148
+ })]
149
+ });
152
150
  }
153
151
  function SidebarMenuSub({ className, ...props }) {
154
152
  return /* @__PURE__ */ jsx(SidebarMenu, {
@@ -158,4 +156,4 @@ function SidebarMenuSub({ className, ...props }) {
158
156
  });
159
157
  }
160
158
  //#endregion
161
- export { SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, sidebarMenuButtonSizes, sidebarMenuButtonVariants };
159
+ export { SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, sidebarMenuButtonSizes, sidebarMenuButtonVariants };
@@ -5,6 +5,7 @@ export type SidebarStyle = CSSProperties & SidebarKnobStyle & {
5
5
  "--sidebar-width"?: string;
6
6
  "--sidebar-width-icon"?: string;
7
7
  };
8
+ export type SidebarLayoutMode = "viewport" | "contained";
8
9
  type SidebarContextProps = {
9
10
  state: "expanded" | "collapsed";
10
11
  open: boolean;
@@ -17,12 +18,17 @@ type SidebarContextProps = {
17
18
  minWidth: number;
18
19
  maxWidth: number;
19
20
  setWidth: (width: number) => void;
21
+ layout: SidebarLayoutMode;
22
+ keyboardShortcut: string | null;
23
+ sidebarId: string;
24
+ contentId: string;
20
25
  };
21
26
  type SidebarElements = {
22
27
  wrapperRef: RefObject<HTMLDivElement | null>;
23
28
  offcanvasRef: RefObject<HTMLDivElement | null>;
24
29
  railRef: RefObject<HTMLElement | null>;
25
30
  triggerRef: RefObject<HTMLButtonElement | null>;
31
+ insetRef: RefObject<HTMLElement | null>;
26
32
  };
27
33
  export declare const SidebarSurfaceContext: import("react").Context<{
28
34
  side: "left" | "right";
@@ -47,7 +53,10 @@ export type SidebarProviderProps = Omit<ComponentProps<"div">, "style"> & {
47
53
  onWidthChange?: (width: number) => void;
48
54
  persistOpen?: boolean;
49
55
  keyboardShortcut?: string | null;
56
+ layout?: SidebarLayoutMode;
57
+ skipLinkLabel?: string;
58
+ contentId?: string;
50
59
  style?: SidebarStyle;
51
60
  };
52
- export declare function SidebarProvider({ defaultOpen, open: openProp, onOpenChange, defaultWidth, minWidth, maxWidth, width: widthProp, onWidthChange, persistOpen, keyboardShortcut, ref, className, style, children, ...props }: SidebarProviderProps): import("react").JSX.Element;
61
+ export declare function SidebarProvider({ defaultOpen, open: openProp, onOpenChange, defaultWidth, minWidth, maxWidth, width: widthProp, onWidthChange, persistOpen, keyboardShortcut, layout, skipLinkLabel, contentId: contentIdProp, ref, className, style, children, ...props }: SidebarProviderProps): import("react").JSX.Element;
53
62
  //#endregion