@vuer-ai/vuer-uikit 0.0.96 → 0.0.98

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 (341) hide show
  1. package/README.md +106 -7
  2. package/cli/dial-cli.js +49 -7
  3. package/dist/SyncScroll/SyncScroll.cjs +10 -10
  4. package/dist/SyncScroll/SyncScroll.mjs +3 -3
  5. package/dist/SyncScroll/index.cjs +10 -10
  6. package/dist/SyncScroll/index.mjs +3 -3
  7. package/dist/chunk-3HEZVWRW.mjs +62 -0
  8. package/dist/chunk-4KWGGESI.cjs +494 -0
  9. package/dist/{chunk-CCMKL2OA.cjs → chunk-7GWDO25E.cjs} +2 -2
  10. package/dist/chunk-A5LCX2UQ.cjs +208 -0
  11. package/dist/chunk-BEJIZ56L.mjs +300 -0
  12. package/dist/chunk-C7VGRU3O.mjs +283 -0
  13. package/dist/{chunk-LONOMMFA.cjs → chunk-LJMNHTTG.cjs} +21 -21
  14. package/dist/chunk-O66RESRR.cjs +285 -0
  15. package/dist/{chunk-RINTUFYQ.cjs → chunk-RMK6W774.cjs} +24 -19
  16. package/dist/{chunk-BFQ2WL5U.mjs → chunk-TTYSYGVE.mjs} +2 -2
  17. package/dist/chunk-VA3PEYFM.mjs +489 -0
  18. package/dist/chunk-VBBJSIY7.cjs +308 -0
  19. package/dist/{chunk-AIINOWEH.mjs → chunk-W4JCKCW7.mjs} +5 -5
  20. package/dist/chunk-WWGF6TBZ.mjs +206 -0
  21. package/dist/chunk-ZGN4UEJR.cjs +679 -0
  22. package/dist/chunk-ZQLRMOUW.mjs +661 -0
  23. package/dist/dial/DialPanel.cjs +24 -24
  24. package/dist/dial/DialPanel.mjs +23 -23
  25. package/dist/dial/DialProvider.cjs +3 -3
  26. package/dist/dial/DialProvider.d.cts +1 -0
  27. package/dist/dial/DialProvider.d.ts +1 -0
  28. package/dist/dial/DialProvider.example.cjs +72 -0
  29. package/dist/dial/DialProvider.example.d.cts +7 -0
  30. package/dist/dial/DialProvider.example.d.ts +7 -0
  31. package/dist/dial/DialProvider.example.mjs +68 -0
  32. package/dist/dial/DialProvider.mjs +1 -1
  33. package/dist/dial/index.cjs +42 -42
  34. package/dist/dial/index.mjs +23 -23
  35. package/dist/dial/wrapped-inputs/ControlledInputs.cjs +27 -27
  36. package/dist/dial/wrapped-inputs/ControlledInputs.mjs +23 -23
  37. package/dist/dial/wrapped-inputs/DialInputs.cjs +34 -34
  38. package/dist/dial/wrapped-inputs/DialInputs.mjs +23 -23
  39. package/dist/dial/wrapped-inputs/DialVectorInput.cjs +24 -24
  40. package/dist/dial/wrapped-inputs/DialVectorInput.mjs +23 -23
  41. package/dist/dial/wrapped-inputs/index.cjs +39 -39
  42. package/dist/dial/wrapped-inputs/index.mjs +23 -23
  43. package/dist/highlight-cursor/cursor-provider.cjs +3 -3
  44. package/dist/highlight-cursor/cursor-provider.mjs +2 -2
  45. package/dist/highlight-cursor/enhanced-components.cjs +10 -10
  46. package/dist/highlight-cursor/enhanced-components.mjs +5 -5
  47. package/dist/highlight-cursor/index.cjs +16 -16
  48. package/dist/highlight-cursor/index.mjs +6 -6
  49. package/dist/hooks/index.cjs +5 -5
  50. package/dist/hooks/index.mjs +1 -1
  51. package/dist/index.cjs +190 -190
  52. package/dist/index.mjs +23 -23
  53. package/dist/ui/UIKitBadge.cjs +6 -6
  54. package/dist/ui/UIKitBadge.mjs +2 -2
  55. package/dist/ui/avatar.cjs +1 -1
  56. package/dist/ui/avatar.mjs +1 -1
  57. package/dist/ui/badge.cjs +1 -1
  58. package/dist/ui/badge.d.cts +1 -1
  59. package/dist/ui/badge.d.ts +1 -1
  60. package/dist/ui/badge.mjs +1 -1
  61. package/dist/ui/button.cjs +1 -1
  62. package/dist/ui/button.mjs +1 -1
  63. package/dist/ui/card.cjs +1 -1
  64. package/dist/ui/card.mjs +1 -1
  65. package/dist/ui/checkbox.cjs +1 -1
  66. package/dist/ui/checkbox.mjs +1 -1
  67. package/dist/ui/collapsible.cjs +1 -1
  68. package/dist/ui/collapsible.mjs +1 -1
  69. package/dist/ui/drawer.cjs +1 -1
  70. package/dist/ui/drawer.mjs +1 -1
  71. package/dist/ui/dropdown.cjs +1 -1
  72. package/dist/ui/dropdown.mjs +1 -1
  73. package/dist/ui/index.cjs +107 -107
  74. package/dist/ui/index.mjs +17 -17
  75. package/dist/ui/inputs/color-input.cjs +1 -1
  76. package/dist/ui/inputs/color-input.mjs +1 -1
  77. package/dist/ui/inputs/index.cjs +11 -11
  78. package/dist/ui/inputs/index.mjs +3 -3
  79. package/dist/ui/inputs/input-numbers.cjs +1 -1
  80. package/dist/ui/inputs/input-numbers.mjs +1 -1
  81. package/dist/ui/inputs/input.cjs +1 -1
  82. package/dist/ui/inputs/input.d.cts +1 -1
  83. package/dist/ui/inputs/input.d.ts +1 -1
  84. package/dist/ui/inputs/input.mjs +1 -1
  85. package/dist/ui/inputs/number-inputs/CmInput.cjs +1 -1
  86. package/dist/ui/inputs/number-inputs/CmInput.mjs +1 -1
  87. package/dist/ui/inputs/number-inputs/DegInput.cjs +1 -1
  88. package/dist/ui/inputs/number-inputs/DegInput.mjs +1 -1
  89. package/dist/ui/inputs/number-inputs/EulerDegInput.cjs +1 -1
  90. package/dist/ui/inputs/number-inputs/EulerDegInput.mjs +1 -1
  91. package/dist/ui/inputs/number-inputs/EulerInput.cjs +1 -1
  92. package/dist/ui/inputs/number-inputs/EulerInput.mjs +1 -1
  93. package/dist/ui/inputs/number-inputs/EulerRadInput.cjs +1 -1
  94. package/dist/ui/inputs/number-inputs/EulerRadInput.mjs +1 -1
  95. package/dist/ui/inputs/number-inputs/InchInput.cjs +1 -1
  96. package/dist/ui/inputs/number-inputs/InchInput.mjs +1 -1
  97. package/dist/ui/inputs/number-inputs/IntInput.cjs +1 -1
  98. package/dist/ui/inputs/number-inputs/IntInput.mjs +1 -1
  99. package/dist/ui/inputs/number-inputs/KVectorInput.cjs +1 -1
  100. package/dist/ui/inputs/number-inputs/KVectorInput.mjs +1 -1
  101. package/dist/ui/inputs/number-inputs/QuaternionInput.cjs +1 -1
  102. package/dist/ui/inputs/number-inputs/QuaternionInput.mjs +1 -1
  103. package/dist/ui/inputs/number-inputs/RadInput.cjs +1 -1
  104. package/dist/ui/inputs/number-inputs/RadInput.mjs +1 -1
  105. package/dist/ui/inputs/number-inputs/TimeInput.cjs +1 -1
  106. package/dist/ui/inputs/number-inputs/TimeInput.mjs +1 -1
  107. package/dist/ui/inputs/number-inputs/Vec3Input.cjs +1 -1
  108. package/dist/ui/inputs/number-inputs/Vec3Input.mjs +1 -1
  109. package/dist/ui/inputs/number-inputs/VectorInput.cjs +1 -1
  110. package/dist/ui/inputs/number-inputs/VectorInput.mjs +1 -1
  111. package/dist/ui/inputs/number-inputs/index.cjs +11 -11
  112. package/dist/ui/inputs/number-inputs/index.mjs +3 -3
  113. package/dist/ui/inputs/presets-input.cjs +1 -1
  114. package/dist/ui/inputs/presets-input.mjs +1 -1
  115. package/dist/ui/label.cjs +1 -1
  116. package/dist/ui/label.mjs +1 -1
  117. package/dist/ui/layout.cjs +1 -1
  118. package/dist/ui/layout.mjs +1 -1
  119. package/dist/ui/layouts/dock-layout/DockLayoutView.cjs +1 -1
  120. package/dist/ui/layouts/dock-layout/DockLayoutView.mjs +1 -1
  121. package/dist/ui/layouts/dock-layout/LayoutSlots.cjs +1 -1
  122. package/dist/ui/layouts/dock-layout/LayoutSlots.mjs +1 -1
  123. package/dist/ui/layouts/dock-layout/index.cjs +1 -1
  124. package/dist/ui/layouts/dock-layout/index.mjs +1 -1
  125. package/dist/ui/layouts/index.cjs +2 -2
  126. package/dist/ui/layouts/index.mjs +2 -2
  127. package/dist/ui/layouts/liquid-layout/LayoutSlots.cjs +1 -1
  128. package/dist/ui/layouts/liquid-layout/LayoutSlots.mjs +1 -1
  129. package/dist/ui/layouts/liquid-layout/LiquidLayoutView.cjs +1 -1
  130. package/dist/ui/layouts/liquid-layout/LiquidLayoutView.mjs +1 -1
  131. package/dist/ui/layouts/liquid-layout/index.cjs +1 -1
  132. package/dist/ui/layouts/liquid-layout/index.mjs +1 -1
  133. package/dist/ui/modal.cjs +1 -1
  134. package/dist/ui/modal.mjs +1 -1
  135. package/dist/ui/navigation.cjs +1 -1
  136. package/dist/ui/navigation.mjs +1 -1
  137. package/dist/ui/pagination.cjs +1 -1
  138. package/dist/ui/pagination.mjs +1 -1
  139. package/dist/ui/panel.cjs +1 -1
  140. package/dist/ui/panel.mjs +1 -1
  141. package/dist/ui/popover.cjs +1 -1
  142. package/dist/ui/popover.mjs +1 -1
  143. package/dist/ui/radio-group.cjs +1 -1
  144. package/dist/ui/radio-group.mjs +1 -1
  145. package/dist/ui/resizable.cjs +1 -1
  146. package/dist/ui/resizable.mjs +1 -1
  147. package/dist/ui/select.cjs +1 -1
  148. package/dist/ui/select.d.cts +1 -1
  149. package/dist/ui/select.d.ts +1 -1
  150. package/dist/ui/select.mjs +1 -1
  151. package/dist/ui/separator.cjs +1 -1
  152. package/dist/ui/separator.mjs +1 -1
  153. package/dist/ui/sheet.cjs +1 -1
  154. package/dist/ui/sheet.mjs +1 -1
  155. package/dist/ui/sidebar.cjs +26 -26
  156. package/dist/ui/sidebar.mjs +2 -2
  157. package/dist/ui/simple-tree-view.cjs +1 -1
  158. package/dist/ui/simple-tree-view.mjs +1 -1
  159. package/dist/ui/skeleton.cjs +1 -1
  160. package/dist/ui/skeleton.mjs +1 -1
  161. package/dist/ui/slider.cjs +1 -1
  162. package/dist/ui/slider.mjs +1 -1
  163. package/dist/ui/switch.cjs +1 -1
  164. package/dist/ui/switch.mjs +1 -1
  165. package/dist/ui/table.cjs +1 -1
  166. package/dist/ui/table.mjs +1 -1
  167. package/dist/ui/tabs.cjs +1 -1
  168. package/dist/ui/tabs.mjs +1 -1
  169. package/dist/ui/textarea.cjs +1 -1
  170. package/dist/ui/textarea.d.cts +1 -1
  171. package/dist/ui/textarea.d.ts +1 -1
  172. package/dist/ui/textarea.mjs +1 -1
  173. package/dist/ui/theme/ThemeToggles.cjs +1 -1
  174. package/dist/ui/theme/ThemeToggles.mjs +1 -1
  175. package/dist/ui/theme/index.cjs +1 -1
  176. package/dist/ui/theme/index.mjs +1 -1
  177. package/dist/ui/toggle-buttons.cjs +1 -1
  178. package/dist/ui/toggle-buttons.mjs +1 -1
  179. package/dist/ui/toggle-group.cjs +1 -1
  180. package/dist/ui/toggle-group.mjs +1 -1
  181. package/dist/ui/toggle.cjs +1 -1
  182. package/dist/ui/toggle.mjs +1 -1
  183. package/dist/ui/toolbar.cjs +1 -1
  184. package/dist/ui/toolbar.mjs +1 -1
  185. package/dist/ui/tooltip.cjs +1 -1
  186. package/dist/ui/tooltip.mjs +1 -1
  187. package/dist/ui/tree-view/TreeSearchBar.cjs +1 -1
  188. package/dist/ui/tree-view/TreeSearchBar.mjs +1 -1
  189. package/dist/ui/tree-view/TreeView.cjs +1 -1
  190. package/dist/ui/tree-view/TreeView.mjs +1 -1
  191. package/dist/ui/tree-view/index.cjs +6 -6
  192. package/dist/ui/tree-view/index.mjs +2 -2
  193. package/dist/ui/tree-view-legacy.cjs +9 -9
  194. package/dist/ui/tree-view-legacy.mjs +5 -5
  195. package/dist/ui/waterfall/CursorOverlay.cjs +1 -1
  196. package/dist/ui/waterfall/CursorOverlay.mjs +1 -1
  197. package/dist/ui/waterfall/TimelineEvent.cjs +1 -1
  198. package/dist/ui/waterfall/TimelineEvent.mjs +1 -1
  199. package/dist/ui/waterfall/TimelineProcessBar.cjs +1 -1
  200. package/dist/ui/waterfall/TimelineProcessBar.mjs +1 -1
  201. package/dist/ui/waterfall/Wedges.cjs +1 -1
  202. package/dist/ui/waterfall/Wedges.mjs +1 -1
  203. package/dist/ui/waterfall/index.cjs +8 -8
  204. package/dist/ui/waterfall/index.mjs +7 -7
  205. package/package.json +28 -2
  206. package/src/SyncScroll/README.md +283 -0
  207. package/src/SyncScroll/SyncScroll.tsx +361 -0
  208. package/src/SyncScroll/index.ts +22 -0
  209. package/src/SyncScroll/useSyncScroll.tsx +226 -0
  210. package/src/cli/dial-cli.ts +1133 -0
  211. package/src/dial/DialPanel.tsx +208 -0
  212. package/src/dial/DialProvider.example.tsx +80 -0
  213. package/src/dial/DialProvider.tsx +138 -0
  214. package/src/dial/index.ts +26 -0
  215. package/src/dial/wrapped-inputs/ControlledInputs.tsx +176 -0
  216. package/src/dial/wrapped-inputs/DialInputs.tsx +401 -0
  217. package/src/dial/wrapped-inputs/DialVectorInput.tsx +125 -0
  218. package/src/dial/wrapped-inputs/index.ts +25 -0
  219. package/src/highlight-cursor/cursor-context.tsx +23 -0
  220. package/src/highlight-cursor/cursor-provider.tsx +264 -0
  221. package/src/highlight-cursor/enhanced-components.tsx +16 -0
  222. package/src/highlight-cursor/index.ts +21 -0
  223. package/src/highlight-cursor/tabs-cursor-context.tsx +121 -0
  224. package/src/highlight-cursor/types.ts +40 -0
  225. package/src/highlight-cursor/with-cursor.tsx +144 -0
  226. package/src/hooks/clientOnly.tsx +54 -0
  227. package/src/hooks/cn.ts +33 -0
  228. package/src/hooks/index.ts +9 -0
  229. package/src/hooks/useDocument.tsx +18 -0
  230. package/src/hooks/useDragSelect.ts +116 -0
  231. package/src/hooks/useIsMobile.ts +35 -0
  232. package/src/hooks/useLocalStorage.ts +122 -0
  233. package/src/hooks/useLocation.tsx +95 -0
  234. package/src/hooks/useQueryParams.tsx +31 -0
  235. package/src/hooks/useWindow.tsx +18 -0
  236. package/src/index.css +5 -0
  237. package/src/index.ts +5 -0
  238. package/src/styles/.editorconfig +0 -0
  239. package/src/styles/theme.css +152 -0
  240. package/src/styles/toast.css +67 -0
  241. package/src/styles/variables.css +229 -0
  242. package/src/ui/UIKitBadge.tsx +171 -0
  243. package/src/ui/avatar.tsx +221 -0
  244. package/src/ui/badge.tsx +74 -0
  245. package/src/ui/button.tsx +143 -0
  246. package/src/ui/card.tsx +146 -0
  247. package/src/ui/checkbox.tsx +78 -0
  248. package/src/ui/collapsible.tsx +43 -0
  249. package/src/ui/drag-selectable/DragSelectProvider.tsx +178 -0
  250. package/src/ui/drag-selectable/createSelectable.tsx +43 -0
  251. package/src/ui/drag-selectable/index.ts +2 -0
  252. package/src/ui/drawer.tsx +137 -0
  253. package/src/ui/dropdown.tsx +707 -0
  254. package/src/ui/icons/MouseCursorIcons.tsx +39 -0
  255. package/src/ui/icons/cursor.tsx +38 -0
  256. package/src/ui/icons/index.ts +2 -0
  257. package/src/ui/index.ts +45 -0
  258. package/src/ui/inputs/color-input.tsx +61 -0
  259. package/src/ui/inputs/index.tsx +5 -0
  260. package/src/ui/inputs/input-numbers.tsx +394 -0
  261. package/src/ui/inputs/input.tsx +155 -0
  262. package/src/ui/inputs/number-inputs/CmInput.tsx +26 -0
  263. package/src/ui/inputs/number-inputs/DegInput.tsx +26 -0
  264. package/src/ui/inputs/number-inputs/EulerDegInput.tsx +14 -0
  265. package/src/ui/inputs/number-inputs/EulerInput.tsx +30 -0
  266. package/src/ui/inputs/number-inputs/EulerRadInput.tsx +14 -0
  267. package/src/ui/inputs/number-inputs/InchInput.tsx +26 -0
  268. package/src/ui/inputs/number-inputs/IntInput.tsx +46 -0
  269. package/src/ui/inputs/number-inputs/KVectorInput.tsx +20 -0
  270. package/src/ui/inputs/number-inputs/QuaternionInput.tsx +27 -0
  271. package/src/ui/inputs/number-inputs/RadInput.tsx +26 -0
  272. package/src/ui/inputs/number-inputs/TimeInput.tsx +26 -0
  273. package/src/ui/inputs/number-inputs/Vec3Input.tsx +26 -0
  274. package/src/ui/inputs/number-inputs/VectorInput.tsx +38 -0
  275. package/src/ui/inputs/number-inputs/index.ts +38 -0
  276. package/src/ui/inputs/presets-input.tsx +59 -0
  277. package/src/ui/label.tsx +35 -0
  278. package/src/ui/layout.tsx +43 -0
  279. package/src/ui/layouts/dock-layout/DockLayoutView.tsx +128 -0
  280. package/src/ui/layouts/dock-layout/LayoutSlots.tsx +85 -0
  281. package/src/ui/layouts/dock-layout/index.tsx +2 -0
  282. package/src/ui/layouts/index.ts +2 -0
  283. package/src/ui/layouts/liquid-layout/LayoutSlots.tsx +82 -0
  284. package/src/ui/layouts/liquid-layout/LiquidLayoutView.tsx +76 -0
  285. package/src/ui/layouts/liquid-layout/index.ts +1 -0
  286. package/src/ui/modal.tsx +211 -0
  287. package/src/ui/navigation.tsx +86 -0
  288. package/src/ui/pagination.tsx +129 -0
  289. package/src/ui/panel.tsx +146 -0
  290. package/src/ui/popover.tsx +112 -0
  291. package/src/ui/radio-group.tsx +63 -0
  292. package/src/ui/resizable.tsx +52 -0
  293. package/src/ui/select.tsx +365 -0
  294. package/src/ui/separator.tsx +26 -0
  295. package/src/ui/sheet.tsx +257 -0
  296. package/src/ui/sidebar.tsx +695 -0
  297. package/src/ui/simple-tree-view.tsx +604 -0
  298. package/src/ui/skeleton.tsx +15 -0
  299. package/src/ui/slider.tsx +204 -0
  300. package/src/ui/switch.tsx +45 -0
  301. package/src/ui/table.tsx +99 -0
  302. package/src/ui/tabs.tsx +192 -0
  303. package/src/ui/textarea.tsx +55 -0
  304. package/src/ui/theme/ThemeProvider.tsx +319 -0
  305. package/src/ui/theme/ThemeToggles.tsx +84 -0
  306. package/src/ui/theme/index.ts +21 -0
  307. package/src/ui/theme/themeScript.tsx +179 -0
  308. package/src/ui/theme/types.ts +61 -0
  309. package/src/ui/toast.tsx +30 -0
  310. package/src/ui/toggle-buttons.tsx +290 -0
  311. package/src/ui/toggle-group.tsx +236 -0
  312. package/src/ui/toggle.tsx +94 -0
  313. package/src/ui/toolbar.tsx +54 -0
  314. package/src/ui/tooltip.tsx +171 -0
  315. package/src/ui/tree-view/TreeSearchBar.tsx +88 -0
  316. package/src/ui/tree-view/TreeView.tsx +232 -0
  317. package/src/ui/tree-view/hooks.tsx +289 -0
  318. package/src/ui/tree-view/index.ts +4 -0
  319. package/src/ui/tree-view/types.ts +23 -0
  320. package/src/ui/tree-view-legacy.tsx +644 -0
  321. package/src/ui/version-badge.tsx +0 -0
  322. package/src/ui/waterfall/CursorOverlay.tsx +96 -0
  323. package/src/ui/waterfall/NavigationControls.tsx +42 -0
  324. package/src/ui/waterfall/Tick.tsx +51 -0
  325. package/src/ui/waterfall/TimeRuleEventDot.tsx +19 -0
  326. package/src/ui/waterfall/TimelineEvent.tsx +60 -0
  327. package/src/ui/waterfall/TimelineProcessBar.tsx +207 -0
  328. package/src/ui/waterfall/Wedges.tsx +67 -0
  329. package/src/ui/waterfall/WheelZoomContext.tsx +128 -0
  330. package/src/ui/waterfall/hooks/useTimelineState.tsx +134 -0
  331. package/src/ui/waterfall/hooks/useViewport.tsx +293 -0
  332. package/src/ui/waterfall/index.tsx +326 -0
  333. package/src/ui/waterfall/types.ts +20 -0
  334. package/src/ui/waterfall/utils.ts +91 -0
  335. package/dist/chunk-W2YAQV5N.mjs +0 -57
  336. package/dist/{chunk-QLCEHV4Q.mjs → chunk-2OZK5DY5.mjs} +2 -2
  337. package/dist/{chunk-Z35DNFRZ.cjs → chunk-7IS37C3P.cjs} +2 -2
  338. package/dist/{chunk-4AOAH77D.mjs → chunk-A2PCEL5S.mjs} +2 -2
  339. package/dist/{chunk-K4VD5PPY.mjs → chunk-BIUDC66P.mjs} +1 -1
  340. package/dist/{chunk-RKJR6RZU.cjs → chunk-OYNLQTHW.cjs} +1 -1
  341. package/dist/{chunk-VE3XLQLO.cjs → chunk-QUFZWF4E.cjs} +2 -2
@@ -0,0 +1,204 @@
1
+ import * as SliderPrimitive from "@radix-ui/react-slider";
2
+ import { ComponentProps, ComponentRef, forwardRef, useEffect, useMemo, useState } from "react";
3
+
4
+ import { cn } from "../hooks";
5
+
6
+ interface SliderProps extends ComponentProps<typeof SliderPrimitive.Root> {
7
+ showStep?: boolean;
8
+ }
9
+
10
+ /**
11
+ * Slider with optional step markers and multi-thumb support.
12
+ */
13
+ const Slider = forwardRef<ComponentRef<typeof SliderPrimitive.Root>, SliderProps>(
14
+ function SliderRoot(
15
+ {
16
+ className,
17
+ defaultValue,
18
+ value,
19
+ onValueChange,
20
+ showStep = false,
21
+ step = 1,
22
+ min = 0,
23
+ max = 100,
24
+ ...props
25
+ },
26
+ ref,
27
+ ) {
28
+ const [currentValue, setCurrentValue] = useState<number[]>(value ?? defaultValue ?? [0]);
29
+
30
+ const _values = useMemo(
31
+ () =>
32
+ Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
33
+ [value, defaultValue, min, max],
34
+ );
35
+
36
+ useEffect(() => {
37
+ if (value) {
38
+ setCurrentValue(value);
39
+ }
40
+ }, [value]);
41
+
42
+ return (
43
+ <SliderPrimitive.Root
44
+ data-slot="slider"
45
+ value={value}
46
+ defaultValue={defaultValue}
47
+ onValueChange={(v) => {
48
+ onValueChange?.(v);
49
+ setCurrentValue(v);
50
+ }}
51
+ ref={ref}
52
+ min={min}
53
+ max={max}
54
+ step={step}
55
+ className={cn(
56
+ "relative",
57
+ "flex",
58
+ "w-full",
59
+ "touch-none",
60
+ "select-none",
61
+ "items-center",
62
+ "data-[orientation=vertical]:h-full",
63
+ "data-[orientation=vertical]:min-h-44",
64
+ "data-[orientation=vertical]:w-auto",
65
+ "data-[orientation=vertical]:flex-col",
66
+ className,
67
+ )}
68
+ {...props}
69
+ >
70
+ <SliderPrimitive.Track
71
+ data-slot="slider-track"
72
+ className={cn(
73
+ "peer/slider-track",
74
+ "bg-line-primary",
75
+ "relative",
76
+ "grow",
77
+ "overflow-hidden",
78
+ "rounded-full",
79
+ "data-[disabled]:bg-bg-secondary",
80
+ "data-[orientation=vertical]:w-0.5",
81
+ "data-[orientation=vertical]:h-full",
82
+ "data-[orientation=horizontal]:h-0.5",
83
+ "data-[orientation=horizontal]:w-full",
84
+ )}
85
+ >
86
+ <SliderPrimitive.Range
87
+ data-slot="slider-range"
88
+ className={cn(
89
+ "bg-brand-primary",
90
+ "absolute",
91
+ "data-[disabled]:bg-bg-secondary",
92
+ "data-[orientation=vertical]:w-full",
93
+ "data-[orientation=horizontal]:h-full",
94
+ )}
95
+ />
96
+ </SliderPrimitive.Track>
97
+
98
+ {showStep && <SliderSteps currentValue={currentValue} max={max} min={min} step={step} />}
99
+
100
+ {Array.from({ length: _values.length }, (_, index) => (
101
+ <SliderPrimitive.Thumb
102
+ data-slot="slider-thumb"
103
+ key={index}
104
+ className={cn(
105
+ "ring-brand-primary/50",
106
+ "bg-brand-primary",
107
+ "block",
108
+ "h-4",
109
+ "w-[0.6rem]",
110
+ "shrink-0",
111
+ "rounded-[3px]",
112
+ "transition-[color,box-shadow]",
113
+ "hover:ring-4",
114
+ "hover:cursor-ew-resize",
115
+ "focus-visible:ring-4",
116
+ "focus-visible:outline-hidden",
117
+ "data-[disabled]:bg-bg-tertiary",
118
+ "data-[disabled]:pointer-events-none",
119
+ )}
120
+ />
121
+ ))}
122
+ </SliderPrimitive.Root>
123
+ );
124
+ },
125
+ );
126
+
127
+ interface SliderStepsProps {
128
+ min: number;
129
+ max: number;
130
+ step: number;
131
+ currentValue: number[];
132
+ }
133
+
134
+ /**
135
+ * Visual step indicators drawn on the track.
136
+ */
137
+ function SliderSteps({ step, min, max, currentValue }: SliderStepsProps) {
138
+ const steps = useMemo(() => {
139
+ const value = max - min;
140
+ const stepCount = Math.ceil(value / step);
141
+ return Array.from({ length: stepCount + 1 }, (_, i) => {
142
+ return { position: Math.min((100 / value) * (i * step), 100), v: i * step + min };
143
+ });
144
+ }, [max, min, step]);
145
+
146
+ const [minRange, maxRange] = useMemo(() => {
147
+ if (currentValue.length > 1) {
148
+ return [Math.min(...currentValue), Math.max(...currentValue)];
149
+ } else {
150
+ return [0, ...currentValue];
151
+ }
152
+ }, [currentValue]);
153
+
154
+ return steps.map((step, i) => {
155
+ /*
156
+ * 9.6 is the width of the thumb in pixels
157
+ * 1 is the direction of the thumb (1 for right, -1 for left)
158
+ * */
159
+ const thumbInBoundsOffset = getThumbInBoundsOffset(9.6, step.position, 1);
160
+ return (
161
+ <span
162
+ key={i}
163
+ data-slot="slider-step"
164
+ style={{ left: `calc(${step.position}% + ${thumbInBoundsOffset}px)` }}
165
+ className={cn(
166
+ "absolute",
167
+ "top-1/2",
168
+ "translate-y-[-50%]",
169
+ "translate-x-[-50%]",
170
+ "bg-brand-primary",
171
+ "block",
172
+ "h-[5pt]",
173
+ "w-[1pt]",
174
+ "shrink-0",
175
+ "rounded-[1px]",
176
+ "peer-has-data-[disabled]/slider-track:bg-bg-tertiary",
177
+ { "bg-bg-tertiary": step.v < minRange || step.v > maxRange },
178
+ )}
179
+ />
180
+ );
181
+ });
182
+ }
183
+
184
+ /**
185
+ * Offsets the thumb centre point while sliding to ensure it remains
186
+ * within the bounds of the slider when reaching the edges
187
+ */
188
+ function getThumbInBoundsOffset(width: number, left: number, direction: number) {
189
+ const halfWidth = width / 2;
190
+ const halfPercent = 50;
191
+ const offset = linearScale([0, halfPercent], [0, halfWidth]);
192
+ return (halfWidth - offset(left) * direction) * direction;
193
+ }
194
+
195
+ function linearScale(input: [number, number], output: [number, number]) {
196
+ return (value: number) => {
197
+ if (input[0] === input[1] || output[0] === output[1]) return output[0];
198
+ const ratio = (output[1] - output[0]) / (input[1] - input[0]);
199
+ return output[0] + ratio * (value - input[0]);
200
+ };
201
+ }
202
+
203
+ export { Slider };
204
+ export type { SliderProps };
@@ -0,0 +1,45 @@
1
+ import * as SwitchPrimitive from "@radix-ui/react-switch";
2
+ import { type ComponentProps } from "react";
3
+
4
+ import { cn } from "../hooks";
5
+
6
+ /**
7
+ * Toggle switch control.
8
+ * todo: need to add sizing - Ge
9
+ */
10
+ function Switch({ className, ...props }: ComponentProps<typeof SwitchPrimitive.Root>) {
11
+ return (
12
+ <SwitchPrimitive.Root
13
+ data-slot="switch"
14
+ className={cn(
15
+ className,
16
+ "group",
17
+ "w-[32px]",
18
+ "h-[16px]",
19
+ "rounded-[24px]",
20
+ "bg-bg-tertiary",
21
+ "aria-checked:bg-brand-primary",
22
+ "disabled:bg-bg-secondary",
23
+ "disabled:cursor-not-allowed",
24
+ )}
25
+ {...props}
26
+ >
27
+ <SwitchPrimitive.Thumb
28
+ data-slot="switch-thumb"
29
+ className={cn(
30
+ "block",
31
+ "size-[12px]",
32
+ "rounded-full",
33
+ "bg-icon-withbg",
34
+ "group-disabled:bg-bg-primary",
35
+ "transition-transform",
36
+ "duration-200",
37
+ "translate-x-[2px]",
38
+ "data-[state=checked]:translate-x-[18px]",
39
+ )}
40
+ />
41
+ </SwitchPrimitive.Root>
42
+ );
43
+ }
44
+
45
+ export { Switch };
@@ -0,0 +1,99 @@
1
+ import * as React from "react";
2
+
3
+ import { cn } from "../hooks";
4
+
5
+ function Table({ className, ...props }: React.ComponentProps<"table">) {
6
+ return (
7
+ <div data-slot="table-container" className="relative w-full overflow-x-auto">
8
+ <table
9
+ data-slot="table"
10
+ className={cn("text-uk-md w-full caption-bottom rounded-none!", className)}
11
+ {...props}
12
+ />
13
+ </div>
14
+ );
15
+ }
16
+
17
+ function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
18
+ return (
19
+ <thead
20
+ data-slot="table-header"
21
+ className={cn("hover:bg-bg-tertiary [&_tr]:border-b", className)}
22
+ {...props}
23
+ />
24
+ );
25
+ }
26
+
27
+ function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
28
+ return (
29
+ <tbody
30
+ data-slot="table-body"
31
+ className={cn("[&_tr:last-child]:border-0", className)}
32
+ {...props}
33
+ />
34
+ );
35
+ }
36
+
37
+ function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
38
+ return (
39
+ <tfoot
40
+ data-slot="table-footer"
41
+ className={cn(
42
+ "bg-bg-secondary border-bg-secondary hover:bg-bg-tertiary border-t font-medium [&>tr]:last:border-b-0",
43
+ className,
44
+ )}
45
+ {...props}
46
+ />
47
+ );
48
+ }
49
+
50
+ function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
51
+ return (
52
+ <tr
53
+ data-slot="table-row"
54
+ className={cn(
55
+ "hover:bg-bg-secondary data-[state=selected]:bg-bg-secondary border-bg-secondary border-b transition-colors",
56
+ className,
57
+ )}
58
+ {...props}
59
+ />
60
+ );
61
+ }
62
+
63
+ function TableHead({ className, ...props }: React.ComponentProps<"th">) {
64
+ return (
65
+ <th
66
+ data-slot="table-head"
67
+ className={cn(
68
+ "bg-bg-secondary! px-lg! text-text-primary! text-uk-md h-[40px] py-0! text-left align-middle font-medium! whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
69
+ className,
70
+ )}
71
+ {...props}
72
+ />
73
+ );
74
+ }
75
+
76
+ function TableCell({ className, ...props }: React.ComponentProps<"td">) {
77
+ return (
78
+ <td
79
+ data-slot="table-cell"
80
+ className={cn(
81
+ "px-lg! text-text-primary! text-uk-md h-[40px] py-0! align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
82
+ className,
83
+ )}
84
+ {...props}
85
+ />
86
+ );
87
+ }
88
+
89
+ function TableCaption({ className, ...props }: React.ComponentProps<"caption">) {
90
+ return (
91
+ <caption
92
+ data-slot="table-caption"
93
+ className={cn("text-text-tertiary text-uk-md mt-4", className)}
94
+ {...props}
95
+ />
96
+ );
97
+ }
98
+
99
+ export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
@@ -0,0 +1,192 @@
1
+ import * as TabsPrimitive from "@radix-ui/react-tabs";
2
+ import { cva } from "class-variance-authority";
3
+ import { type ComponentProps, createContext, useContext } from "react";
4
+
5
+ import { TabsCursorProvider, useTabsCursor } from "../highlight-cursor/tabs-cursor-context";
6
+ import { cn, createClientOnlyComponent } from "../hooks";
7
+
8
+ interface TabsContextType {
9
+ size?: "sm" | "base" | "lg";
10
+ }
11
+
12
+ const TabsContext = createContext<TabsContextType | undefined>(undefined);
13
+
14
+ const useTabsContext = () => {
15
+ const context = useContext(TabsContext);
16
+ if (!context) {
17
+ throw new Error("Tabs components must be used within a Tabs component");
18
+ }
19
+ return context;
20
+ };
21
+
22
+ interface TabsProps extends ComponentProps<typeof TabsPrimitive.Root> {
23
+ size?: "sm" | "base" | "lg";
24
+ }
25
+
26
+ /**
27
+ * Tabs root that provides size context to child tabs components.
28
+ *
29
+ * @param props -
30
+ * @param className -
31
+ * @param size - Control size ("sm" | "base" | "lg"), defaults to "base" */
32
+ function TabsRoot({ className, size = "base", ...props }: TabsProps) {
33
+ return (
34
+ <TabsContext.Provider value={{ size }}>
35
+ <TabsPrimitive.Root
36
+ data-slot="tabs"
37
+ className={cn("flex w-full flex-col", className)}
38
+ {...props}
39
+ />
40
+ </TabsContext.Provider>
41
+ );
42
+ }
43
+
44
+ function TabsFallback({ className, size = "base", ...props }: TabsProps & ComponentProps<"div">) {
45
+ return (
46
+ <TabsContext.Provider value={{ size }}>
47
+ <div data-slot="tabs" className={cn("flex w-full flex-col", className)} {...props} />
48
+ </TabsContext.Provider>
49
+ );
50
+ }
51
+
52
+ const Tabs = createClientOnlyComponent(TabsRoot, TabsFallback);
53
+
54
+ const tabsListVariants = cva(["inline-flex", "items-center", "justify-center"], {
55
+ variants: {
56
+ size: {
57
+ sm: "gap-xs",
58
+ base: "gap-sm",
59
+ lg: "gap-md",
60
+ },
61
+ },
62
+ defaultVariants: {
63
+ size: "base",
64
+ },
65
+ });
66
+
67
+ type TabsListProps = ComponentProps<typeof TabsPrimitive.List>;
68
+
69
+ /**
70
+ * Container for tab triggers. Emits cursor interactions for visual effects.
71
+ */
72
+ function TabsListRoot({ className, ...props }: TabsListProps) {
73
+ const { setCursorTarget } = useTabsCursor();
74
+ const { size } = useTabsContext();
75
+ return (
76
+ <TabsCursorProvider>
77
+ <TabsPrimitive.List
78
+ onMouseLeave={() => setCursorTarget(null)}
79
+ data-slot="tabs-list"
80
+ className={cn(tabsListVariants({ size }), "justify-start", className)}
81
+ {...props}
82
+ />
83
+ </TabsCursorProvider>
84
+ );
85
+ }
86
+
87
+ function TabsListFallback({ className, ...props }: TabsListProps & ComponentProps<"div">) {
88
+ const { size } = useTabsContext();
89
+ return (
90
+ <TabsCursorProvider>
91
+ <div
92
+ data-slot="tabs-list"
93
+ className={cn(tabsListVariants({ size }), "justify-start", className)}
94
+ {...props}
95
+ />
96
+ </TabsCursorProvider>
97
+ );
98
+ }
99
+
100
+ const TabsList = createClientOnlyComponent(TabsListRoot, TabsListFallback);
101
+
102
+ const tabsTriggerVariants = cva(
103
+ [
104
+ "inline-flex",
105
+ "items-center",
106
+ "justify-center",
107
+ "font-normal",
108
+ "whitespace-nowrap",
109
+ "transition-all",
110
+ "disabled:pointer-events-none",
111
+ "disabled:bg-bg-tertiary",
112
+ "[&_svg]:pointer-events-none",
113
+ "[&_svg:not([class*='size-'])]:size-xl",
114
+ "shrink-0",
115
+ "[&_svg]:shrink-0",
116
+ "outline-none",
117
+ "text-text-primary",
118
+ "data-[state=active]:bg-bg-secondary",
119
+ "data-[state=active]:font-medium",
120
+ ],
121
+ {
122
+ variants: {
123
+ size: {
124
+ sm: "text-uk-sm leading-uk-sm px-md py-xs rounded-uk-sm",
125
+ base: "text-uk-md leading-uk-md px-lg py-sm rounded-uk-md",
126
+ lg: "text-uk-lg leading-uk-lg px-xl py-sm rounded-uk-md",
127
+ },
128
+ },
129
+ defaultVariants: {
130
+ size: "base",
131
+ },
132
+ },
133
+ );
134
+
135
+ type TabsTriggerProps = ComponentProps<typeof TabsPrimitive.Trigger>;
136
+
137
+ /**
138
+ * Single tab trigger button.
139
+ */
140
+ function TabsTriggerRoot({ className, ...props }: TabsTriggerProps) {
141
+ const { setCursorTarget } = useTabsCursor();
142
+ const { size } = useTabsContext();
143
+ return (
144
+ <TabsPrimitive.Trigger
145
+ onMouseEnter={(e) => setCursorTarget(e.currentTarget)}
146
+ data-slot="tabs-trigger"
147
+ className={cn(tabsTriggerVariants({ size }), className)}
148
+ {...props}
149
+ />
150
+ );
151
+ }
152
+
153
+ function TabsTriggerFallback({ className, ...props }: TabsTriggerProps & ComponentProps<"button">) {
154
+ const { setCursorTarget } = useTabsCursor();
155
+ const { size } = useTabsContext();
156
+ return (
157
+ <button
158
+ onMouseEnter={(e) => setCursorTarget(e.currentTarget)}
159
+ data-slot="tabs-trigger"
160
+ className={cn(tabsTriggerVariants({ size }), className)}
161
+ {...props}
162
+ />
163
+ );
164
+ }
165
+
166
+ const TabsTrigger = createClientOnlyComponent(TabsTriggerRoot, TabsTriggerFallback);
167
+
168
+ type TabsContentProps = ComponentProps<typeof TabsPrimitive.Content>;
169
+
170
+ /**
171
+ * Content area for a tab panel.
172
+ */
173
+ function TabsContentRoot({ className, ...props }: TabsContentProps) {
174
+ return (
175
+ <TabsPrimitive.Content
176
+ data-slot="tabs-content"
177
+ className={cn("flex-1 outline-none", className)}
178
+ {...props}
179
+ />
180
+ );
181
+ }
182
+
183
+ function TabsContentFallback({ className, ...props }: TabsContentProps & ComponentProps<"div">) {
184
+ return (
185
+ <div data-slot="tabs-content" className={cn("flex-1 outline-none", className)} {...props} />
186
+ );
187
+ }
188
+
189
+ const TabsContent = createClientOnlyComponent(TabsContentRoot, TabsContentFallback);
190
+
191
+ export { Tabs, TabsList, TabsTrigger, TabsContent };
192
+ export type { TabsProps, TabsListProps, TabsTriggerProps, TabsContentProps };
@@ -0,0 +1,55 @@
1
+ import { cva, type VariantProps } from "class-variance-authority";
2
+ import { type ComponentProps } from "react";
3
+
4
+ import { cn } from "../hooks";
5
+
6
+ const textareaVariants = cva(
7
+ [
8
+ "bg-bg-secondary",
9
+ "disabled:bg-bg-tertiary",
10
+ "disabled:text-text-tertiary",
11
+ "disabled:cursor-not-allowed",
12
+ "outline-transparent",
13
+ "placehoder:text-text-secondary/20",
14
+ "min-h-16",
15
+ "flex",
16
+ "w-full",
17
+ ],
18
+ {
19
+ variants: {
20
+ state: {
21
+ default: ["hover:bg-bg-tertiary", "focus:bg-bg-quaternary"],
22
+ error: ["hover:bg-danger-primary/10", "bg-danger-primary/20"],
23
+ },
24
+ size: {
25
+ sm: ["text-uk-sm", "leading-uk-sm", "rounded-uk-sm", "px-sm", "py-xs"],
26
+ base: ["text-uk-md", "leading-uk-md", "rounded-uk-md", "px-md", "py-sm"],
27
+ lg: ["text-uk-lg", "leading-uk-lg", "rounded-uk-md", "px-lg", "py-sm"],
28
+ },
29
+ },
30
+ defaultVariants: {
31
+ state: "default",
32
+ size: "base",
33
+ },
34
+ },
35
+ );
36
+
37
+ interface TextareaProps extends ComponentProps<"textarea">, VariantProps<typeof textareaVariants> {
38
+ state?: "default" | "error";
39
+ size?: "sm" | "base" | "lg";
40
+ }
41
+
42
+ /**
43
+ * Multiline text input with size and error variants.
44
+ */
45
+ function Textarea({ className, state, size, ...props }: TextareaProps) {
46
+ return (
47
+ <textarea
48
+ className={cn(textareaVariants({ className, state, size }))}
49
+ data-slot="textarea"
50
+ {...props}
51
+ />
52
+ );
53
+ }
54
+
55
+ export { Textarea };