agentic-ds-kit 0.1.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 (345) hide show
  1. package/AGENTS.md +10 -0
  2. package/CLAUDE.md +1 -0
  3. package/LICENSE +21 -0
  4. package/README.md +38 -0
  5. package/contracts/accordion.json +38 -0
  6. package/contracts/alert.json +57 -0
  7. package/contracts/alertdialog.json +89 -0
  8. package/contracts/appheader.json +140 -0
  9. package/contracts/appnav.json +72 -0
  10. package/contracts/avatar.json +63 -0
  11. package/contracts/avatargroup.json +83 -0
  12. package/contracts/badge.json +92 -0
  13. package/contracts/barchart.json +55 -0
  14. package/contracts/breadcrumb.json +76 -0
  15. package/contracts/button.json +120 -0
  16. package/contracts/buttongroup.json +48 -0
  17. package/contracts/calendar.json +93 -0
  18. package/contracts/card.json +123 -0
  19. package/contracts/carousel.json +98 -0
  20. package/contracts/cell.json +203 -0
  21. package/contracts/chat.json +131 -0
  22. package/contracts/checkbox.json +101 -0
  23. package/contracts/collapsible.json +66 -0
  24. package/contracts/command.json +84 -0
  25. package/contracts/datatable.json +126 -0
  26. package/contracts/datepicker.json +102 -0
  27. package/contracts/drawer.json +93 -0
  28. package/contracts/dropdownmenu.json +190 -0
  29. package/contracts/empty.json +79 -0
  30. package/contracts/field.json +49 -0
  31. package/contracts/fieldset.json +29 -0
  32. package/contracts/headercell.json +107 -0
  33. package/contracts/index.json +478 -0
  34. package/contracts/input.json +119 -0
  35. package/contracts/inputotp.json +119 -0
  36. package/contracts/insightcard.json +130 -0
  37. package/contracts/linechart.json +51 -0
  38. package/contracts/loadinganimation.json +33 -0
  39. package/contracts/modal.json +100 -0
  40. package/contracts/modalcard.json +88 -0
  41. package/contracts/navigationmenu.json +65 -0
  42. package/contracts/numbertransition.json +33 -0
  43. package/contracts/pageheader.json +101 -0
  44. package/contracts/pagination.json +85 -0
  45. package/contracts/patterns/activity.json +30 -0
  46. package/contracts/patterns/assistant-workspace.json +16 -0
  47. package/contracts/patterns/dashboard.json +12 -0
  48. package/contracts/patterns/empty-first-run.json +15 -0
  49. package/contracts/patterns/inbox.json +32 -0
  50. package/contracts/patterns/invite-members.json +14 -0
  51. package/contracts/patterns/list-detail.json +13 -0
  52. package/contracts/patterns/settings-form.json +13 -0
  53. package/contracts/piechart.json +68 -0
  54. package/contracts/progress.json +124 -0
  55. package/contracts/progresssteps.json +91 -0
  56. package/contracts/radiogroup.json +132 -0
  57. package/contracts/scoreboard.json +46 -0
  58. package/contracts/scorecard.json +124 -0
  59. package/contracts/section.json +97 -0
  60. package/contracts/select.json +130 -0
  61. package/contracts/shimmertext.json +33 -0
  62. package/contracts/sidenav.json +133 -0
  63. package/contracts/slider.json +81 -0
  64. package/contracts/spinner.json +52 -0
  65. package/contracts/switch.json +94 -0
  66. package/contracts/table.json +92 -0
  67. package/contracts/tabs.json +90 -0
  68. package/contracts/textarea.json +54 -0
  69. package/contracts/thinkinganimation.json +32 -0
  70. package/contracts/timeline.json +49 -0
  71. package/contracts/toast.json +104 -0
  72. package/contracts/tooltip.json +66 -0
  73. package/lib/tokens.css +637 -0
  74. package/package.json +60 -0
  75. package/skills/prototype-from-kit/SKILL.md +29 -0
  76. package/src/index.ts +71 -0
  77. package/tokens/tokens.json +725 -0
  78. package/ui/Accordion/Accordion.module.css +68 -0
  79. package/ui/Accordion/Accordion.tsx +51 -0
  80. package/ui/Accordion/Accordion.types.ts +10 -0
  81. package/ui/Accordion/index.ts +2 -0
  82. package/ui/Alert/Alert.module.css +62 -0
  83. package/ui/Alert/Alert.tsx +27 -0
  84. package/ui/Alert/Alert.types.ts +7 -0
  85. package/ui/Alert/index.ts +2 -0
  86. package/ui/AlertDialog/AlertDialog.module.css +71 -0
  87. package/ui/AlertDialog/AlertDialog.tsx +109 -0
  88. package/ui/AlertDialog/AlertDialog.types.ts +14 -0
  89. package/ui/AlertDialog/index.ts +6 -0
  90. package/ui/AppHeader/AppHeader.module.css +120 -0
  91. package/ui/AppHeader/AppHeader.tsx +70 -0
  92. package/ui/AppHeader/AppHeader.types.ts +28 -0
  93. package/ui/AppHeader/index.ts +2 -0
  94. package/ui/AppNav/AppNav.module.css +168 -0
  95. package/ui/AppNav/AppNav.tsx +137 -0
  96. package/ui/AppNav/AppNav.types.ts +24 -0
  97. package/ui/AppNav/index.ts +2 -0
  98. package/ui/Avatar/Avatar.module.css +52 -0
  99. package/ui/Avatar/Avatar.tsx +62 -0
  100. package/ui/Avatar/Avatar.types.ts +8 -0
  101. package/ui/Avatar/index.ts +2 -0
  102. package/ui/AvatarGroup/AvatarGroup.module.css +49 -0
  103. package/ui/AvatarGroup/AvatarGroup.tsx +29 -0
  104. package/ui/AvatarGroup/AvatarGroup.types.ts +16 -0
  105. package/ui/AvatarGroup/index.ts +2 -0
  106. package/ui/Badge/Badge.module.css +92 -0
  107. package/ui/Badge/Badge.tsx +43 -0
  108. package/ui/Badge/Badge.types.ts +11 -0
  109. package/ui/Badge/index.ts +2 -0
  110. package/ui/BarChart/BarChart.module.css +56 -0
  111. package/ui/BarChart/BarChart.tsx +380 -0
  112. package/ui/BarChart/BarChart.types.ts +18 -0
  113. package/ui/BarChart/index.ts +2 -0
  114. package/ui/Breadcrumb/Breadcrumb.module.css +64 -0
  115. package/ui/Breadcrumb/Breadcrumb.tsx +89 -0
  116. package/ui/Breadcrumb/Breadcrumb.types.ts +14 -0
  117. package/ui/Breadcrumb/index.ts +2 -0
  118. package/ui/Button/Button.module.css +101 -0
  119. package/ui/Button/Button.tsx +49 -0
  120. package/ui/Button/Button.types.ts +18 -0
  121. package/ui/Button/index.ts +2 -0
  122. package/ui/Button/lucideName.tsx +188 -0
  123. package/ui/ButtonGroup/ButtonGroup.module.css +31 -0
  124. package/ui/ButtonGroup/ButtonGroup.tsx +12 -0
  125. package/ui/ButtonGroup/ButtonGroup.types.ts +6 -0
  126. package/ui/ButtonGroup/index.ts +2 -0
  127. package/ui/Calendar/Calendar.module.css +146 -0
  128. package/ui/Calendar/Calendar.tsx +296 -0
  129. package/ui/Calendar/Calendar.types.ts +11 -0
  130. package/ui/Calendar/index.ts +2 -0
  131. package/ui/Card/Card.module.css +95 -0
  132. package/ui/Card/Card.tsx +69 -0
  133. package/ui/Card/Card.types.ts +23 -0
  134. package/ui/Card/index.ts +2 -0
  135. package/ui/Carousel/Carousel.module.css +114 -0
  136. package/ui/Carousel/Carousel.tsx +152 -0
  137. package/ui/Carousel/Carousel.types.ts +17 -0
  138. package/ui/Carousel/index.ts +7 -0
  139. package/ui/Cell/Cell.module.css +133 -0
  140. package/ui/Cell/Cell.tsx +300 -0
  141. package/ui/Cell/Cell.types.ts +69 -0
  142. package/ui/Cell/index.ts +11 -0
  143. package/ui/Chat/Chat.module.css +149 -0
  144. package/ui/Chat/Chat.tsx +175 -0
  145. package/ui/Chat/Chat.types.ts +39 -0
  146. package/ui/Chat/index.ts +2 -0
  147. package/ui/Checkbox/Checkbox.module.css +135 -0
  148. package/ui/Checkbox/Checkbox.tsx +70 -0
  149. package/ui/Checkbox/Checkbox.types.ts +15 -0
  150. package/ui/Checkbox/index.ts +2 -0
  151. package/ui/Collapsible/Collapsible.module.css +68 -0
  152. package/ui/Collapsible/Collapsible.tsx +59 -0
  153. package/ui/Collapsible/Collapsible.types.ts +9 -0
  154. package/ui/Collapsible/index.ts +2 -0
  155. package/ui/Command/Command.module.css +138 -0
  156. package/ui/Command/Command.tsx +152 -0
  157. package/ui/Command/Command.types.ts +20 -0
  158. package/ui/Command/index.ts +2 -0
  159. package/ui/DataTable/DataTable.module.css +211 -0
  160. package/ui/DataTable/DataTable.tsx +429 -0
  161. package/ui/DataTable/DataTable.types.ts +35 -0
  162. package/ui/DataTable/index.ts +8 -0
  163. package/ui/DatePicker/DatePicker.module.css +44 -0
  164. package/ui/DatePicker/DatePicker.tsx +123 -0
  165. package/ui/DatePicker/DatePicker.types.ts +15 -0
  166. package/ui/DatePicker/index.ts +2 -0
  167. package/ui/Drawer/Drawer.module.css +204 -0
  168. package/ui/Drawer/Drawer.tsx +112 -0
  169. package/ui/Drawer/Drawer.types.ts +14 -0
  170. package/ui/Drawer/index.ts +2 -0
  171. package/ui/DropdownMenu/DropdownMenu.module.css +319 -0
  172. package/ui/DropdownMenu/DropdownMenu.tsx +580 -0
  173. package/ui/DropdownMenu/DropdownMenu.types.ts +48 -0
  174. package/ui/DropdownMenu/index.ts +8 -0
  175. package/ui/Empty/Empty.module.css +68 -0
  176. package/ui/Empty/Empty.tsx +35 -0
  177. package/ui/Empty/Empty.types.ts +10 -0
  178. package/ui/Empty/index.ts +2 -0
  179. package/ui/Field/Field.module.css +66 -0
  180. package/ui/Field/Field.tsx +46 -0
  181. package/ui/Field/Field.types.ts +12 -0
  182. package/ui/Field/index.ts +2 -0
  183. package/ui/FieldSet/FieldSet.module.css +30 -0
  184. package/ui/FieldSet/FieldSet.tsx +14 -0
  185. package/ui/FieldSet/FieldSet.types.ts +7 -0
  186. package/ui/FieldSet/index.ts +2 -0
  187. package/ui/HeaderCell/HeaderCell.module.css +85 -0
  188. package/ui/HeaderCell/HeaderCell.tsx +71 -0
  189. package/ui/HeaderCell/HeaderCell.types.ts +18 -0
  190. package/ui/HeaderCell/index.ts +2 -0
  191. package/ui/Input/Input.module.css +59 -0
  192. package/ui/Input/Input.tsx +65 -0
  193. package/ui/Input/Input.types.ts +22 -0
  194. package/ui/Input/index.ts +2 -0
  195. package/ui/InputOTP/InputOTP.module.css +139 -0
  196. package/ui/InputOTP/InputOTP.tsx +136 -0
  197. package/ui/InputOTP/InputOTP.types.ts +19 -0
  198. package/ui/InputOTP/index.ts +2 -0
  199. package/ui/InsightCard/InsightCard.module.css +166 -0
  200. package/ui/InsightCard/InsightCard.tsx +90 -0
  201. package/ui/InsightCard/InsightCard.types.ts +20 -0
  202. package/ui/InsightCard/index.ts +7 -0
  203. package/ui/LineChart/LineChart.module.css +93 -0
  204. package/ui/LineChart/LineChart.tsx +424 -0
  205. package/ui/LineChart/LineChart.types.ts +19 -0
  206. package/ui/LineChart/index.ts +2 -0
  207. package/ui/LoadingAnimation/LoadingAnimation.module.css +66 -0
  208. package/ui/LoadingAnimation/LoadingAnimation.tsx +41 -0
  209. package/ui/LoadingAnimation/LoadingAnimation.types.ts +9 -0
  210. package/ui/LoadingAnimation/index.ts +6 -0
  211. package/ui/Modal/Modal.module.css +48 -0
  212. package/ui/Modal/Modal.tsx +114 -0
  213. package/ui/Modal/Modal.types.ts +15 -0
  214. package/ui/Modal/index.ts +2 -0
  215. package/ui/ModalCard/ModalCard.module.css +137 -0
  216. package/ui/ModalCard/ModalCard.tsx +58 -0
  217. package/ui/ModalCard/ModalCard.types.ts +15 -0
  218. package/ui/ModalCard/index.ts +2 -0
  219. package/ui/NavigationMenu/NavigationMenu.module.css +31 -0
  220. package/ui/NavigationMenu/NavigationMenu.tsx +57 -0
  221. package/ui/NavigationMenu/NavigationMenu.types.ts +22 -0
  222. package/ui/NavigationMenu/index.ts +7 -0
  223. package/ui/NumberTransition/NumberTransition.module.css +110 -0
  224. package/ui/NumberTransition/NumberTransition.tsx +78 -0
  225. package/ui/NumberTransition/NumberTransition.types.ts +9 -0
  226. package/ui/NumberTransition/index.ts +2 -0
  227. package/ui/PageHeader/PageHeader.module.css +57 -0
  228. package/ui/PageHeader/PageHeader.tsx +39 -0
  229. package/ui/PageHeader/PageHeader.types.ts +12 -0
  230. package/ui/PageHeader/index.ts +2 -0
  231. package/ui/Pagination/Pagination.module.css +19 -0
  232. package/ui/Pagination/Pagination.tsx +147 -0
  233. package/ui/Pagination/Pagination.types.ts +12 -0
  234. package/ui/Pagination/index.ts +2 -0
  235. package/ui/PieChart/PieChart.module.css +116 -0
  236. package/ui/PieChart/PieChart.tsx +293 -0
  237. package/ui/PieChart/PieChart.types.ts +22 -0
  238. package/ui/PieChart/index.ts +2 -0
  239. package/ui/Progress/Progress.module.css +226 -0
  240. package/ui/Progress/Progress.tsx +167 -0
  241. package/ui/Progress/Progress.types.ts +15 -0
  242. package/ui/Progress/index.ts +8 -0
  243. package/ui/ProgressSteps/ProgressSteps.module.css +210 -0
  244. package/ui/ProgressSteps/ProgressSteps.tsx +105 -0
  245. package/ui/ProgressSteps/ProgressSteps.types.ts +19 -0
  246. package/ui/ProgressSteps/index.ts +8 -0
  247. package/ui/RadioGroup/RadioGroup.module.css +284 -0
  248. package/ui/RadioGroup/RadioGroup.tsx +116 -0
  249. package/ui/RadioGroup/RadioGroup.types.ts +30 -0
  250. package/ui/RadioGroup/index.ts +8 -0
  251. package/ui/Scoreboard/Scoreboard.module.css +53 -0
  252. package/ui/Scoreboard/Scoreboard.tsx +41 -0
  253. package/ui/Scoreboard/Scoreboard.types.ts +7 -0
  254. package/ui/Scoreboard/index.ts +2 -0
  255. package/ui/Scorecard/Scorecard.module.css +150 -0
  256. package/ui/Scorecard/Scorecard.tsx +92 -0
  257. package/ui/Scorecard/Scorecard.types.ts +18 -0
  258. package/ui/Scorecard/index.ts +2 -0
  259. package/ui/Section/Section.module.css +104 -0
  260. package/ui/Section/Section.tsx +75 -0
  261. package/ui/Section/Section.types.ts +15 -0
  262. package/ui/Section/index.ts +2 -0
  263. package/ui/Select/Select.module.css +7 -0
  264. package/ui/Select/Select.tsx +113 -0
  265. package/ui/Select/Select.types.ts +26 -0
  266. package/ui/Select/index.ts +2 -0
  267. package/ui/ShimmerText/ShimmerText.module.css +46 -0
  268. package/ui/ShimmerText/ShimmerText.tsx +48 -0
  269. package/ui/ShimmerText/ShimmerText.types.ts +12 -0
  270. package/ui/ShimmerText/index.ts +2 -0
  271. package/ui/SideNav/SideNav.module.css +347 -0
  272. package/ui/SideNav/SideNav.tsx +222 -0
  273. package/ui/SideNav/SideNav.types.ts +42 -0
  274. package/ui/SideNav/index.ts +8 -0
  275. package/ui/Slider/Slider.module.css +105 -0
  276. package/ui/Slider/Slider.tsx +187 -0
  277. package/ui/Slider/Slider.types.ts +11 -0
  278. package/ui/Slider/index.ts +2 -0
  279. package/ui/Spinner/Spinner.module.css +58 -0
  280. package/ui/Spinner/Spinner.tsx +19 -0
  281. package/ui/Spinner/Spinner.types.ts +6 -0
  282. package/ui/Spinner/index.ts +2 -0
  283. package/ui/Switch/Switch.module.css +189 -0
  284. package/ui/Switch/Switch.tsx +65 -0
  285. package/ui/Switch/Switch.types.ts +12 -0
  286. package/ui/Switch/index.ts +2 -0
  287. package/ui/Table/Table.module.css +132 -0
  288. package/ui/Table/Table.tsx +108 -0
  289. package/ui/Table/Table.types.ts +26 -0
  290. package/ui/Table/index.ts +8 -0
  291. package/ui/Tabs/Tabs.module.css +162 -0
  292. package/ui/Tabs/Tabs.tsx +150 -0
  293. package/ui/Tabs/Tabs.types.ts +21 -0
  294. package/ui/Tabs/index.ts +2 -0
  295. package/ui/Textarea/Textarea.module.css +74 -0
  296. package/ui/Textarea/Textarea.tsx +38 -0
  297. package/ui/Textarea/Textarea.types.ts +14 -0
  298. package/ui/Textarea/index.ts +2 -0
  299. package/ui/ThinkingAnimation/ThinkingAnimation.module.css +75 -0
  300. package/ui/ThinkingAnimation/ThinkingAnimation.tsx +31 -0
  301. package/ui/ThinkingAnimation/ThinkingAnimation.types.ts +8 -0
  302. package/ui/ThinkingAnimation/index.ts +2 -0
  303. package/ui/Timeline/Timeline.module.css +99 -0
  304. package/ui/Timeline/Timeline.tsx +47 -0
  305. package/ui/Timeline/Timeline.types.ts +16 -0
  306. package/ui/Timeline/index.ts +2 -0
  307. package/ui/Toast/Toast.module.css +133 -0
  308. package/ui/Toast/Toast.tsx +89 -0
  309. package/ui/Toast/Toast.types.ts +17 -0
  310. package/ui/Toast/index.ts +2 -0
  311. package/ui/Tooltip/Tooltip.module.css +111 -0
  312. package/ui/Tooltip/Tooltip.tsx +101 -0
  313. package/ui/Tooltip/index.ts +2 -0
  314. package/ui/patterns/ActivityPattern/ActivityFeed.tsx +77 -0
  315. package/ui/patterns/ActivityPattern/ActivityPattern.tsx +120 -0
  316. package/ui/patterns/ActivityPattern/ActivityTasks.tsx +86 -0
  317. package/ui/patterns/ActivityPattern/TaskDrawer.module.css +39 -0
  318. package/ui/patterns/ActivityPattern/TaskDrawer.tsx +186 -0
  319. package/ui/patterns/ActivityPattern/index.ts +2 -0
  320. package/ui/patterns/AssistantWorkspacePattern/AssistantWorkspacePattern.module.css +16 -0
  321. package/ui/patterns/AssistantWorkspacePattern/AssistantWorkspacePattern.tsx +159 -0
  322. package/ui/patterns/AssistantWorkspacePattern/index.ts +2 -0
  323. package/ui/patterns/DashboardPattern/DashboardPattern.tsx +102 -0
  324. package/ui/patterns/DashboardPattern/index.ts +1 -0
  325. package/ui/patterns/DashboardPattern/patterns.module.css +6 -0
  326. package/ui/patterns/EmptyFirstRunPattern/EmptyFirstRunPattern.tsx +125 -0
  327. package/ui/patterns/EmptyFirstRunPattern/index.ts +2 -0
  328. package/ui/patterns/InboxPattern/InboxPattern.module.css +40 -0
  329. package/ui/patterns/InboxPattern/InboxPattern.tsx +192 -0
  330. package/ui/patterns/InboxPattern/InboxReplyDrawer.tsx +97 -0
  331. package/ui/patterns/InboxPattern/inbox-data.ts +101 -0
  332. package/ui/patterns/InboxPattern/index.ts +2 -0
  333. package/ui/patterns/InviteMembersPattern/InviteMembersPattern.tsx +148 -0
  334. package/ui/patterns/InviteMembersPattern/index.ts +2 -0
  335. package/ui/patterns/ListDetailPattern/ListDetailPattern.module.css +34 -0
  336. package/ui/patterns/ListDetailPattern/ListDetailPattern.tsx +145 -0
  337. package/ui/patterns/ListDetailPattern/index.ts +2 -0
  338. package/ui/patterns/SettingsFormPattern/SettingsFormPattern.module.css +12 -0
  339. package/ui/patterns/SettingsFormPattern/SettingsFormPattern.tsx +89 -0
  340. package/ui/patterns/SettingsFormPattern/index.ts +3 -0
  341. package/ui/shared/ChartFrame.module.css +295 -0
  342. package/ui/shared/ChartFrame.tsx +87 -0
  343. package/ui/shared/chartMath.ts +228 -0
  344. package/ui/shared/controls.module.css +48 -0
  345. package/ui/shared/useChartSize.ts +22 -0
@@ -0,0 +1,48 @@
1
+ import type { CSSProperties } from "react";
2
+ import type { ShimmerTextProps, ShimmerTextSpeed } from "./ShimmerText.types";
3
+ import styles from "./ShimmerText.module.css";
4
+
5
+ export type { ShimmerTextProps, ShimmerTextSize, ShimmerTextSpeed } from "./ShimmerText.types";
6
+
7
+ const NAMED_SPEED_FACTORS: Record<Exclude<ShimmerTextSpeed, number>, number> = {
8
+ slow: 6,
9
+ normal: 4,
10
+ fast: 3,
11
+ };
12
+
13
+ function getDurationFactor(speed: ShimmerTextSpeed): number {
14
+ if (typeof speed === "number") return speed;
15
+ return NAMED_SPEED_FACTORS[speed];
16
+ }
17
+
18
+ export function ShimmerText({
19
+ children,
20
+ size = "md",
21
+ speed = "normal",
22
+ className = "",
23
+ style,
24
+ }: ShimmerTextProps) {
25
+ const text = String(children);
26
+ const characters = Array.from(text);
27
+ const phaseSpan = Math.max(characters.length - 1, 1);
28
+ const cssVars = {
29
+ "--shimmer-duration-factor": getDurationFactor(speed),
30
+ ...style,
31
+ } as CSSProperties;
32
+
33
+ return (
34
+ <span className={`${styles.root} ${styles[size]} ${className}`.trim()} style={cssVars} aria-label={text}>
35
+ <span className={styles.content} aria-hidden="true">
36
+ {characters.map((character, index) => (
37
+ <span
38
+ className={styles.character}
39
+ style={{ "--shimmer-phase": 1 - index / phaseSpan } as CSSProperties}
40
+ key={`${character}-${index}`}
41
+ >
42
+ {character}
43
+ </span>
44
+ ))}
45
+ </span>
46
+ </span>
47
+ );
48
+ }
@@ -0,0 +1,12 @@
1
+ import type { CSSProperties, ReactNode } from "react";
2
+
3
+ export type ShimmerTextSize = "sm" | "md" | "lg";
4
+ export type ShimmerTextSpeed = number | "slow" | "normal" | "fast";
5
+
6
+ export interface ShimmerTextProps {
7
+ children: ReactNode;
8
+ size?: ShimmerTextSize;
9
+ speed?: ShimmerTextSpeed;
10
+ className?: string;
11
+ style?: CSSProperties;
12
+ }
@@ -0,0 +1,2 @@
1
+ export { ShimmerText } from "./ShimmerText";
2
+ export type { ShimmerTextProps, ShimmerTextSize, ShimmerTextSpeed } from "./ShimmerText.types";
@@ -0,0 +1,347 @@
1
+ .root {
2
+ display: flex;
3
+ flex-direction: column;
4
+ flex-shrink: 0;
5
+ align-self: stretch;
6
+ width: var(--layout-sidebar);
7
+ max-width: var(--layout-sidebar);
8
+ min-height: 0;
9
+ overflow: hidden;
10
+ border: var(--border-surface) solid var(--border-faint);
11
+ border-radius: var(--radius-surface-md);
12
+ background: var(--surface-card);
13
+ color: var(--text-primary);
14
+ transition:
15
+ width var(--motion-expand-duration) var(--motion-expand-easing),
16
+ max-width var(--motion-expand-duration) var(--motion-expand-easing);
17
+ }
18
+
19
+ .radiusNone {
20
+ border-radius: var(--radius-0);
21
+ }
22
+
23
+ .rootClosed {
24
+ width: var(--layout-sidebar-compact);
25
+ max-width: var(--layout-sidebar-compact);
26
+ }
27
+
28
+ .header {
29
+ position: relative;
30
+ display: flex;
31
+ align-items: center;
32
+ gap: var(--space-inline-md);
33
+ flex-shrink: 0;
34
+ min-width: 0;
35
+ padding: var(--space-inset-md) var(--space-inset-lg);
36
+ border-bottom: var(--border-divider) solid var(--border-subtle);
37
+ overflow: hidden;
38
+ transition: padding var(--motion-expand-duration) var(--motion-expand-easing);
39
+ }
40
+
41
+ .rootClosed .header {
42
+ justify-content: center;
43
+ gap: 0;
44
+ padding: var(--space-inset-sm);
45
+ }
46
+
47
+ .mark {
48
+ display: grid;
49
+ place-items: center;
50
+ flex-shrink: 0;
51
+ width: var(--space-inset-2xl);
52
+ height: var(--space-inset-2xl);
53
+ margin: 0;
54
+ padding: 0;
55
+ border: 0;
56
+ border-radius: var(--radius-control-md);
57
+ background: var(--fill-brand);
58
+ color: var(--brand-on-brand);
59
+ font-family: var(--font-sans);
60
+ font-size: var(--type-size-label);
61
+ font-weight: var(--type-weight-label);
62
+ line-height: 1;
63
+ }
64
+
65
+ .markButton {
66
+ appearance: none;
67
+ cursor: pointer;
68
+ }
69
+
70
+ .markButton:focus-visible {
71
+ outline: var(--border-focus-width) solid var(--focus-ring);
72
+ outline-offset: var(--space-inset-2xs);
73
+ }
74
+
75
+ .title {
76
+ min-width: 0;
77
+ margin: 0;
78
+ overflow: hidden;
79
+ text-overflow: ellipsis;
80
+ white-space: nowrap;
81
+ font-family: var(--font-sans);
82
+ font-size: var(--type-size-heading);
83
+ font-weight: var(--type-weight-heading);
84
+ line-height: var(--type-line-heading);
85
+ color: var(--text-primary);
86
+ transition: opacity var(--motion-overlay-duration) var(--motion-overlay-easing);
87
+ }
88
+
89
+ .rootClosed .title {
90
+ flex: 0 0 0;
91
+ width: 0;
92
+ min-width: 0;
93
+ max-width: 0;
94
+ height: 0;
95
+ margin: 0;
96
+ opacity: 0;
97
+ overflow: hidden;
98
+ pointer-events: none;
99
+ }
100
+
101
+ .close {
102
+ margin-inline-start: auto;
103
+ flex-shrink: 0;
104
+ transition: opacity var(--motion-overlay-duration) var(--motion-overlay-easing);
105
+ }
106
+
107
+ .nav {
108
+ flex: 1;
109
+ display: grid;
110
+ align-content: start;
111
+ gap: var(--space-stack-md);
112
+ min-height: 0;
113
+ padding: var(--space-inset-md) var(--space-inset-lg);
114
+ overflow-x: hidden;
115
+ overflow-y: auto;
116
+ scrollbar-width: none;
117
+ transition: padding var(--motion-expand-duration) var(--motion-expand-easing);
118
+ }
119
+
120
+ .nav::-webkit-scrollbar {
121
+ display: none;
122
+ }
123
+
124
+ .rootClosed .nav {
125
+ padding: var(--space-inset-sm);
126
+ }
127
+
128
+ .section {
129
+ position: relative;
130
+ display: grid;
131
+ gap: var(--space-stack-xs);
132
+ min-width: 0;
133
+ }
134
+
135
+ .sectionLabel {
136
+ margin: 0;
137
+ padding-inline: var(--space-inset-md);
138
+ overflow: hidden;
139
+ font-family: var(--font-sans);
140
+ font-size: var(--type-size-caption);
141
+ font-weight: var(--type-weight-caption);
142
+ color: var(--text-secondary);
143
+ max-height: 2rem;
144
+ transition:
145
+ opacity var(--motion-overlay-duration) var(--motion-overlay-easing),
146
+ max-height var(--motion-expand-duration) var(--motion-expand-easing),
147
+ padding var(--motion-expand-duration) var(--motion-expand-easing);
148
+ }
149
+
150
+ .rootClosed .sectionLabel {
151
+ opacity: 0;
152
+ max-height: 0;
153
+ padding: 0;
154
+ pointer-events: none;
155
+ }
156
+
157
+ .list {
158
+ display: grid;
159
+ gap: 0;
160
+ margin: 0;
161
+ padding: 0;
162
+ list-style: none;
163
+ }
164
+
165
+ .entry {
166
+ display: grid;
167
+ min-width: 0;
168
+ }
169
+
170
+ .item {
171
+ position: relative;
172
+ display: flex;
173
+ align-items: center;
174
+ gap: var(--space-inline-md);
175
+ width: 100%;
176
+ margin: 0;
177
+ padding: var(--space-inset-sm) var(--space-inset-md);
178
+ appearance: none;
179
+ border: 0;
180
+ border-radius: var(--radius-control-md);
181
+ background: transparent;
182
+ color: var(--text-primary);
183
+ font-family: var(--font-sans);
184
+ font-size: var(--type-size-body-sm);
185
+ font-weight: var(--type-weight-body);
186
+ line-height: var(--type-line-body);
187
+ text-align: start;
188
+ text-decoration: none;
189
+ cursor: pointer;
190
+ transition: padding var(--motion-expand-duration) var(--motion-expand-easing);
191
+ }
192
+
193
+ .rootClosed .item {
194
+ width: auto;
195
+ justify-self: center;
196
+ justify-content: center;
197
+ gap: 0;
198
+ padding: var(--space-inset-sm);
199
+ aspect-ratio: 1;
200
+ line-height: 1;
201
+ overflow: hidden;
202
+ }
203
+
204
+ .item:hover:not(:disabled):not(.itemDisabled) {
205
+ background: var(--surface-muted);
206
+ color: var(--text-primary);
207
+ }
208
+
209
+ .itemActive,
210
+ .itemActive:hover:not(:disabled):not(.itemDisabled) {
211
+ background: var(--surface-brand-subtle);
212
+ color: var(--text-brand);
213
+ }
214
+
215
+ .item:focus-visible {
216
+ outline: var(--border-focus-width) solid var(--focus-ring);
217
+ outline-offset: var(--space-inset-2xs);
218
+ }
219
+
220
+ .item:disabled,
221
+ .itemDisabled {
222
+ background: var(--surface-disabled);
223
+ color: var(--text-disabled);
224
+ cursor: not-allowed;
225
+ }
226
+
227
+ .icon {
228
+ display: grid;
229
+ place-items: center;
230
+ flex-shrink: 0;
231
+ width: var(--space-inset-lg);
232
+ height: var(--space-inset-lg);
233
+ color: var(--icon-secondary);
234
+ }
235
+
236
+ .itemActive .icon {
237
+ color: var(--icon-brand);
238
+ }
239
+
240
+ .item:disabled .icon,
241
+ .itemDisabled .icon {
242
+ color: var(--text-disabled);
243
+ }
244
+
245
+ .label {
246
+ min-width: 0;
247
+ flex: 1;
248
+ overflow: hidden;
249
+ text-overflow: ellipsis;
250
+ white-space: nowrap;
251
+ transition: opacity var(--motion-overlay-duration) var(--motion-overlay-easing);
252
+ }
253
+
254
+ .rootClosed .label,
255
+ .rootClosed .meta {
256
+ flex: 0 0 0;
257
+ width: 0;
258
+ min-width: 0;
259
+ max-width: 0;
260
+ height: 0;
261
+ margin: 0;
262
+ padding: 0;
263
+ opacity: 0;
264
+ overflow: hidden;
265
+ pointer-events: none;
266
+ }
267
+
268
+ .meta {
269
+ display: flex;
270
+ align-items: center;
271
+ gap: var(--space-inline-xs);
272
+ margin-inline-start: auto;
273
+ flex-shrink: 0;
274
+ overflow: hidden;
275
+ transition: opacity var(--motion-overlay-duration) var(--motion-overlay-easing);
276
+ }
277
+
278
+ .badge {
279
+ padding: var(--space-inset-2xs) var(--space-inset-xs);
280
+ border-radius: var(--radius-pill);
281
+ background: var(--surface-muted);
282
+ color: var(--text-secondary);
283
+ font-family: var(--font-sans);
284
+ font-size: var(--type-size-caption);
285
+ font-weight: var(--type-weight-caption);
286
+ line-height: 1;
287
+ }
288
+
289
+ .itemActive .badge {
290
+ background: var(--surface-brand-subtle);
291
+ color: var(--text-brand);
292
+ }
293
+
294
+ .chevron {
295
+ display: grid;
296
+ place-items: center;
297
+ flex-shrink: 0;
298
+ color: var(--icon-muted);
299
+ transition: transform var(--motion-expand-duration) var(--motion-expand-easing);
300
+ }
301
+
302
+ .chevronOpen {
303
+ transform: rotate(90deg);
304
+ }
305
+
306
+ .submenu {
307
+ display: grid;
308
+ margin: 0;
309
+ margin-inline-start: var(--space-inset-lg);
310
+ padding: 0;
311
+ padding-inline-start: var(--space-inset-xs);
312
+ list-style: none;
313
+ border-inline-start: var(--border-divider) solid var(--border-faint);
314
+ }
315
+
316
+ .rootClosed .submenu {
317
+ margin-inline-start: 0;
318
+ padding-inline-start: 0;
319
+ border-inline-start: 0;
320
+ }
321
+
322
+ .footer {
323
+ flex-shrink: 0;
324
+ padding: var(--space-inset-md) var(--space-inset-lg);
325
+ border-top: var(--border-divider) solid var(--border-subtle);
326
+ transition: padding var(--motion-expand-duration) var(--motion-expand-easing);
327
+ }
328
+
329
+ .rootClosed .footer {
330
+ padding: var(--space-inset-sm);
331
+ }
332
+
333
+ @media (prefers-reduced-motion: reduce) {
334
+ .root,
335
+ .header,
336
+ .nav,
337
+ .footer,
338
+ .item,
339
+ .title,
340
+ .label,
341
+ .sectionLabel,
342
+ .meta,
343
+ .close,
344
+ .chevron {
345
+ transition: none;
346
+ }
347
+ }
@@ -0,0 +1,222 @@
1
+ "use client";
2
+
3
+ import { useId, useState } from "react";
4
+ import { Button } from "../Button";
5
+ import { LucideByName } from "../Button/lucideName";
6
+ import type { SideNavItem, SideNavProps } from "./SideNav.types";
7
+ import styles from "./SideNav.module.css";
8
+
9
+ export type {
10
+ SideNavGroup,
11
+ SideNavItem,
12
+ SideNavProps,
13
+ SideNavRadius,
14
+ SideNavSide,
15
+ } from "./SideNav.types";
16
+
17
+ const ICON_SIZE = 16;
18
+
19
+ function ItemBody({
20
+ item,
21
+ expanded,
22
+ }: {
23
+ item: SideNavItem;
24
+ expanded?: boolean;
25
+ }) {
26
+ const nested = Boolean(item.items && item.items.length > 0);
27
+
28
+ return (
29
+ <>
30
+ {item.icon ? (
31
+ <span className={styles.icon} aria-hidden>
32
+ <LucideByName name={item.icon} size={ICON_SIZE} />
33
+ </span>
34
+ ) : null}
35
+ <span className={styles.label}>{item.label}</span>
36
+ {item.badge || nested ? (
37
+ <span className={styles.meta}>
38
+ {item.badge ? <span className={styles.badge}>{item.badge}</span> : null}
39
+ {nested ? (
40
+ <span className={`${styles.chevron} ${expanded ? styles.chevronOpen : ""}`}>
41
+ <LucideByName name="ChevronRight" size={ICON_SIZE} />
42
+ </span>
43
+ ) : null}
44
+ </span>
45
+ ) : null}
46
+ </>
47
+ );
48
+ }
49
+
50
+ function NavItem({ item, rail }: { item: SideNavItem; rail: boolean }) {
51
+ const nested = Boolean(item.items && item.items.length > 0);
52
+ const submenuId = useId();
53
+ const [expanded, setExpanded] = useState(nested);
54
+
55
+ const className = [
56
+ styles.item,
57
+ item.active ? styles.itemActive : "",
58
+ item.disabled ? styles.itemDisabled : "",
59
+ ]
60
+ .filter(Boolean)
61
+ .join(" ");
62
+
63
+ if (nested) {
64
+ return (
65
+ <li className={styles.entry}>
66
+ <button
67
+ type="button"
68
+ className={className}
69
+ disabled={item.disabled}
70
+ aria-expanded={expanded}
71
+ aria-controls={submenuId}
72
+ aria-current={item.active ? "page" : undefined}
73
+ onClick={() => {
74
+ if (!rail) setExpanded((current) => !current);
75
+ }}
76
+ >
77
+ <ItemBody item={item} expanded={expanded} />
78
+ </button>
79
+ {expanded && !rail ? (
80
+ <ul className={styles.submenu} id={submenuId}>
81
+ {item.items!.map((child) => (
82
+ <NavItem key={child.id} item={child} rail={rail} />
83
+ ))}
84
+ </ul>
85
+ ) : null}
86
+ </li>
87
+ );
88
+ }
89
+
90
+ if (item.onClick && !item.disabled) {
91
+ return (
92
+ <li className={styles.entry}>
93
+ <button
94
+ type="button"
95
+ className={className}
96
+ aria-current={item.active ? "page" : undefined}
97
+ onClick={item.onClick}
98
+ >
99
+ <ItemBody item={item} />
100
+ </button>
101
+ </li>
102
+ );
103
+ }
104
+
105
+ if (item.href && !item.disabled) {
106
+ return (
107
+ <li className={styles.entry}>
108
+ <a
109
+ href={item.href}
110
+ className={className}
111
+ aria-current={item.active ? "page" : undefined}
112
+ >
113
+ <ItemBody item={item} />
114
+ </a>
115
+ </li>
116
+ );
117
+ }
118
+
119
+ return (
120
+ <li className={styles.entry}>
121
+ <button
122
+ type="button"
123
+ className={className}
124
+ disabled={item.disabled}
125
+ aria-current={item.active ? "page" : undefined}
126
+ >
127
+ <ItemBody item={item} />
128
+ </button>
129
+ </li>
130
+ );
131
+ }
132
+
133
+ function NavList({ items, rail }: { items: SideNavItem[]; rail: boolean }) {
134
+ return (
135
+ <ul className={styles.list}>
136
+ {items.map((item) => (
137
+ <NavItem key={item.id} item={item} rail={rail} />
138
+ ))}
139
+ </ul>
140
+ );
141
+ }
142
+
143
+ export function SideNav({
144
+ title,
145
+ mark,
146
+ showHeader = true,
147
+ radius = "md",
148
+ open: openProp,
149
+ defaultOpen = true,
150
+ onOpenChange,
151
+ side = "left",
152
+ groups,
153
+ items = [],
154
+ footer,
155
+ }: SideNavProps) {
156
+ const isControlled = typeof openProp === "boolean";
157
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
158
+ const expanded = showHeader ? (isControlled ? openProp : uncontrolledOpen) : true;
159
+ const useGroups = Boolean(groups && groups.length > 0);
160
+ const markLetter = (mark && mark.length > 0 ? mark : title.charAt(0)) || "·";
161
+
162
+ function setOpen(next: boolean) {
163
+ if (!isControlled) setUncontrolledOpen(next);
164
+ onOpenChange?.(next);
165
+ }
166
+
167
+ return (
168
+ <aside
169
+ className={`${styles.root} ${radius === "none" ? styles.radiusNone : ""} ${expanded ? "" : styles.rootClosed}`.trim()}
170
+ aria-label={title}
171
+ data-side={side}
172
+ >
173
+ {showHeader ? (
174
+ <header className={styles.header}>
175
+ {expanded ? (
176
+ <span className={styles.mark} aria-hidden>
177
+ {markLetter}
178
+ </span>
179
+ ) : (
180
+ <button
181
+ type="button"
182
+ className={`${styles.mark} ${styles.markButton}`}
183
+ aria-label="Open"
184
+ onClick={() => setOpen(true)}
185
+ >
186
+ {markLetter}
187
+ </button>
188
+ )}
189
+ <p className={styles.title}>{title}</p>
190
+ {expanded ? (
191
+ <span className={styles.close}>
192
+ <Button
193
+ variant="tertiary"
194
+ size="sm"
195
+ iconStart={side === "right" ? "PanelRightClose" : "PanelLeftClose"}
196
+ ariaLabel="Close"
197
+ onClick={() => setOpen(false)}
198
+ />
199
+ </span>
200
+ ) : null}
201
+ </header>
202
+ ) : null}
203
+
204
+ <nav className={styles.nav} aria-label={title}>
205
+ {useGroups
206
+ ? groups!.map((group) => (
207
+ <div key={group.label} className={styles.section}>
208
+ <p className={styles.sectionLabel}>{group.label}</p>
209
+ <NavList items={group.items} rail={!expanded} />
210
+ </div>
211
+ ))
212
+ : <NavList items={items} rail={!expanded} />}
213
+ </nav>
214
+
215
+ {footer ? (
216
+ <div className={styles.footer}>
217
+ <NavList items={Array.isArray(footer) ? footer : [footer]} rail={!expanded} />
218
+ </div>
219
+ ) : null}
220
+ </aside>
221
+ );
222
+ }
@@ -0,0 +1,42 @@
1
+ export type SideNavSide = "left" | "right";
2
+
3
+ export type SideNavRadius = "md" | "none";
4
+
5
+ export interface SideNavItem {
6
+ id: string;
7
+ label: string;
8
+ href?: string;
9
+ /** In-app select. When set, the leaf is a button and href is not used. */
10
+ onClick?: () => void;
11
+ /** Lucide name, via LucideByName from @/ui/Button/lucideName */
12
+ icon?: string;
13
+ active?: boolean;
14
+ disabled?: boolean;
15
+ badge?: string;
16
+ /** One nested submenu level. */
17
+ items?: SideNavItem[];
18
+ }
19
+
20
+ export interface SideNavGroup {
21
+ label: string;
22
+ items: SideNavItem[];
23
+ }
24
+
25
+ export interface SideNavProps {
26
+ title: string;
27
+ /** Brand letter; default first char of title. */
28
+ mark?: string;
29
+ /** Brand header and close. Default true. Set false when AppHeader already provides brand. */
30
+ showHeader?: boolean;
31
+ /** Rail corners. Default md. Use none when SideNav is flush in an app shell. */
32
+ radius?: SideNavRadius;
33
+ open?: boolean;
34
+ defaultOpen?: boolean;
35
+ onOpenChange?: (open: boolean) => void;
36
+ side?: SideNavSide;
37
+ groups?: SideNavGroup[];
38
+ /** Flat list if no groups. */
39
+ items?: SideNavItem[];
40
+ /** Footer rows. One or many. */
41
+ footer?: SideNavItem | SideNavItem[];
42
+ }
@@ -0,0 +1,8 @@
1
+ export { SideNav } from "./SideNav";
2
+ export type {
3
+ SideNavProps,
4
+ SideNavRadius,
5
+ SideNavSide,
6
+ SideNavItem,
7
+ SideNavGroup,
8
+ } from "./SideNav.types";