xertica-ui 2.5.1 → 2.5.2

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 (535) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +14 -16
  3. package/assets/xertica-logo.svg +37 -37
  4. package/assets/xertica-x-logo.svg +20 -20
  5. package/bin/generate-tokens.ts +262 -262
  6. package/bin/language-config.ts +359 -358
  7. package/components/assistant/code-block/CodeBlock.tsx +268 -268
  8. package/components/assistant/formatted-document/FormattedDocument.tsx +147 -147
  9. package/components/assistant/modern-chat-input/ModernChatInput.tsx +564 -564
  10. package/components/assistant/xertica-assistant/parts/AssistantCollapsedView.tsx +99 -99
  11. package/components/assistant/xertica-assistant/parts/AssistantConversationList.tsx +104 -104
  12. package/components/assistant/xertica-assistant/parts/AssistantDocumentEditor.tsx +81 -81
  13. package/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.tsx +88 -88
  14. package/components/assistant/xertica-assistant/parts/AssistantHeader.tsx +75 -75
  15. package/components/assistant/xertica-assistant/parts/AssistantMessageBubble.tsx +564 -564
  16. package/components/assistant/xertica-assistant/parts/AssistantTabBar.tsx +67 -67
  17. package/components/assistant/xertica-assistant/parts/AssistantWelcomeScreen.tsx +103 -103
  18. package/components/assistant/xertica-assistant/use-assistant.ts +615 -615
  19. package/components/assistant/xertica-assistant/xertica-assistant.tsx +611 -611
  20. package/components/blocks/card-patterns/ActivityCard.tsx +100 -100
  21. package/components/blocks/card-patterns/ActivityCardSkeleton.tsx +56 -56
  22. package/components/blocks/card-patterns/FeatureCardSkeleton.tsx +58 -58
  23. package/components/blocks/card-patterns/NotificationCard.tsx +140 -140
  24. package/components/blocks/card-patterns/NotificationCardSkeleton.tsx +81 -81
  25. package/components/blocks/card-patterns/ProfileCard.tsx +112 -112
  26. package/components/blocks/card-patterns/ProfileCardSkeleton.tsx +69 -69
  27. package/components/blocks/card-patterns/ProjectCard.tsx +123 -123
  28. package/components/blocks/card-patterns/ProjectCardSkeleton.tsx +67 -67
  29. package/components/blocks/card-patterns/QuickActionCardSkeleton.tsx +44 -44
  30. package/components/blocks/card-patterns/card-patterns.stories.tsx +594 -594
  31. package/components/blocks/card-patterns/index.ts +29 -29
  32. package/components/brand/language-selector/LanguageSelector.tsx +102 -102
  33. package/components/brand/language-selector/language-selector.stories.tsx +111 -111
  34. package/components/brand/language-selector/language-selector.test.tsx +101 -101
  35. package/components/brand/theme-toggle/ThemeToggle.tsx +74 -74
  36. package/components/brand/xertica-provider/xertica-provider.mdx +61 -61
  37. package/components/index.ts +86 -86
  38. package/components/layout/sidebar/sidebar.mdx +1 -1
  39. package/components/layout/sidebar/sidebar.stories.tsx +1033 -787
  40. package/components/layout/sidebar/sidebar.tsx +338 -1
  41. package/components/media/FloatingMediaWrapper.tsx +371 -371
  42. package/components/media/audio-player/AudioPlayer.tsx +768 -768
  43. package/components/media/video-player/VideoPlayer.tsx +310 -310
  44. package/components/pages/home-content/HomeContent.tsx +120 -120
  45. package/components/pages/home-content/home-content.mdx +62 -62
  46. package/components/pages/home-page/HomePage.tsx +78 -78
  47. package/components/pages/home-page/home-page.mdx +53 -53
  48. package/components/pages/template-content/TemplateContent.tsx +1354 -1354
  49. package/components/pages/template-content/template-content.mdx +61 -61
  50. package/components/pages/template-page/TemplatePage.stories.tsx +32 -32
  51. package/components/pages/template-page/template-page.mdx +53 -53
  52. package/components/shared/error-boundary.stories.tsx +114 -114
  53. package/components/shared/error-boundary.tsx +150 -150
  54. package/components/shared/error-fallbacks.tsx +222 -222
  55. package/components/ui/accordion/accordion.mdx +8 -8
  56. package/components/ui/alert/alert.mdx +8 -8
  57. package/components/ui/alert-dialog/alert-dialog.mdx +8 -8
  58. package/components/ui/aspect-ratio/aspect-ratio.mdx +8 -8
  59. package/components/ui/assistant-chart/assistant-chart.mdx +8 -8
  60. package/components/ui/avatar/avatar.mdx +8 -8
  61. package/components/ui/badge/badge.mdx +8 -8
  62. package/components/ui/breadcrumb/breadcrumb.mdx +8 -8
  63. package/components/ui/button/button.mdx +8 -8
  64. package/components/ui/calendar/calendar.mdx +8 -8
  65. package/components/ui/card/card.mdx +8 -8
  66. package/components/ui/carousel/carousel.mdx +8 -8
  67. package/components/ui/chart/chart.mdx +8 -8
  68. package/components/ui/chart/chart.test.tsx +178 -178
  69. package/components/ui/chart/chart.tsx +2245 -2239
  70. package/components/ui/checkbox/checkbox.mdx +8 -8
  71. package/components/ui/collapsible/collapsible.mdx +8 -8
  72. package/components/ui/command/command.mdx +8 -8
  73. package/components/ui/context-menu/context-menu.mdx +8 -8
  74. package/components/ui/dialog/dialog.mdx +8 -8
  75. package/components/ui/drawer/drawer.mdx +8 -8
  76. package/components/ui/dropdown-menu/dropdown-menu.mdx +8 -8
  77. package/components/ui/empty/empty.mdx +8 -8
  78. package/components/ui/file-upload/file-upload.mdx +8 -8
  79. package/components/ui/hover-card/hover-card.mdx +8 -8
  80. package/components/ui/input/input.mdx +8 -8
  81. package/components/ui/input-otp/input-otp.mdx +8 -8
  82. package/components/ui/label/label.mdx +8 -8
  83. package/components/ui/map/map.mdx +8 -8
  84. package/components/ui/menubar/menubar.mdx +8 -8
  85. package/components/ui/navigation-menu/navigation-menu.mdx +8 -8
  86. package/components/ui/notification-badge/notification-badge.mdx +8 -8
  87. package/components/ui/pagination/pagination.mdx +8 -8
  88. package/components/ui/popover/popover.mdx +8 -8
  89. package/components/ui/progress/progress.mdx +8 -8
  90. package/components/ui/radio-group/radio-group.mdx +8 -8
  91. package/components/ui/rating/rating.mdx +8 -8
  92. package/components/ui/resizable/resizable.mdx +8 -8
  93. package/components/ui/route-map/route-map.mdx +8 -8
  94. package/components/ui/scroll-area/scroll-area.mdx +8 -8
  95. package/components/ui/search/search.mdx +8 -8
  96. package/components/ui/select/select.mdx +8 -8
  97. package/components/ui/separator/separator.mdx +8 -8
  98. package/components/ui/sheet/sheet.mdx +8 -8
  99. package/components/ui/simple-map/simple-map.mdx +8 -8
  100. package/components/ui/skeleton/skeleton.mdx +8 -8
  101. package/components/ui/slider/slider.mdx +8 -8
  102. package/components/ui/sonner/sonner.mdx +8 -8
  103. package/components/ui/stats-card/index.ts +2 -2
  104. package/components/ui/stats-card/stats-card-skeleton.tsx +60 -60
  105. package/components/ui/stats-card/stats-card.mdx +8 -8
  106. package/components/ui/stats-card/stats-card.tsx +109 -109
  107. package/components/ui/stepper/stepper.mdx +8 -8
  108. package/components/ui/switch/switch.mdx +8 -8
  109. package/components/ui/table/table.mdx +8 -8
  110. package/components/ui/tabs/tabs.mdx +8 -8
  111. package/components/ui/textarea/textarea.mdx +8 -8
  112. package/components/ui/timeline/timeline.mdx +8 -8
  113. package/components/ui/toggle/toggle.mdx +8 -8
  114. package/components/ui/toggle-group/toggle-group.mdx +8 -8
  115. package/components/ui/tooltip/tooltip.mdx +8 -8
  116. package/components/ui/tree-view/tree-view.mdx +8 -8
  117. package/components.json +511 -511
  118. package/contexts/AuthContext.tsx +121 -121
  119. package/contexts/BrandColorsContext.tsx +282 -282
  120. package/contexts/LanguageContext.test.tsx +121 -121
  121. package/contexts/LanguageContext.tsx +250 -250
  122. package/contexts/theme-data.ts +391 -391
  123. package/dist/{AssistantChart-DoZCyS5r.cjs → AssistantChart-9w31gdAb.cjs} +4 -4
  124. package/dist/{AssistantChart-CldVCVDe.cjs → AssistantChart-BAudAfne.cjs} +5 -5
  125. package/dist/{AssistantChart-Bdd44uBn.cjs → AssistantChart-BAx9VQvb.cjs} +127 -388
  126. package/dist/{AssistantChart-Cu3m7RBo.js → AssistantChart-BP8upjMk.js} +5 -5
  127. package/dist/{AssistantChart-CFhDdGyU.js → AssistantChart-CVko2A1W.js} +130 -391
  128. package/dist/{AssistantChart-C_hwFRRr.js → AssistantChart-CVzmmhx4.js} +4 -4
  129. package/dist/{AudioPlayer-IAU5q5T1.cjs → AudioPlayer-1ypwE2Wh.cjs} +1 -1
  130. package/dist/{AudioPlayer-CGRUtUdN.js → AudioPlayer-DuKXrCfy.js} +1 -1
  131. package/dist/{LanguageContext-CS14yCpi.js → LanguageContext-BwhwC3G2.js} +2 -2
  132. package/dist/{LanguageContext-B_KFTCzT.cjs → LanguageContext-DvUt5jBg.cjs} +2 -2
  133. package/dist/{ThemeContext-C2EwAPDt.js → ThemeContext-BbBNoFTG.js} +2 -2
  134. package/dist/{ThemeContext-Bmod0Cg2.cjs → ThemeContext-BblcjQup.cjs} +13 -8
  135. package/dist/{ThemeContext-BWq9ACPo.js → ThemeContext-Bo-W2WZH.js} +13 -8
  136. package/dist/{ThemeContext-j5aGtPky.cjs → ThemeContext-CP3a0jxy.cjs} +193 -262
  137. package/dist/{ThemeContext-vTjumZeM.cjs → ThemeContext-Cmr8Ex8H.cjs} +2 -2
  138. package/dist/ThemeContext-CpqYShLq.cjs +324 -0
  139. package/dist/{ThemeContext-CQSo4Iwc.js → ThemeContext-D3LzacmG.js} +8 -1
  140. package/dist/ThemeContext-Du2nE1PL.js +325 -0
  141. package/dist/ThemeContext-GeEBTJ3q.cjs +1621 -0
  142. package/dist/ThemeContext-JyLK9B1o.js +1622 -0
  143. package/dist/{ThemeContext-CGk3KK0k.cjs → ThemeContext-U4dEYc6C.cjs} +8 -1
  144. package/dist/{ThemeContext-BXjrgUjW.js → ThemeContext-ept8jhXI.js} +200 -261
  145. package/dist/{VerifyEmailPage-CGIwmWrm.js → VerifyEmailPage-B31mCrMc.js} +1 -1
  146. package/dist/{VerifyEmailPage-C0c2e5n0.js → VerifyEmailPage-BE-L9mB7.js} +7 -7
  147. package/dist/{VerifyEmailPage-DSBMRHtl.js → VerifyEmailPage-BIBOKV7Z.js} +41 -36
  148. package/dist/{VerifyEmailPage-DgIid028.js → VerifyEmailPage-BJjAMUTW.js} +4 -4
  149. package/dist/{VerifyEmailPage--1Vurewl.cjs → VerifyEmailPage-BRSP-Pwt.cjs} +3 -3
  150. package/dist/{VerifyEmailPage-Cwi3kbol.cjs → VerifyEmailPage-Bae2cBXT.cjs} +7 -7
  151. package/dist/{VerifyEmailPage-De6bQjrz.cjs → VerifyEmailPage-BiRm7Nh4.cjs} +41 -36
  152. package/dist/{VerifyEmailPage-ByerOcm4.cjs → VerifyEmailPage-Bv8Ah_TK.cjs} +23 -20
  153. package/dist/VerifyEmailPage-Bvfv8HVQ.js +3214 -0
  154. package/dist/{VerifyEmailPage-BComraR7.cjs → VerifyEmailPage-CR7kb5df.cjs} +22 -12
  155. package/dist/{VerifyEmailPage-CpqqpLpo.cjs → VerifyEmailPage-C_Zk6Gen.cjs} +1 -1
  156. package/dist/{VerifyEmailPage-MTD7AG1Z.js → VerifyEmailPage-C_ihbcth.js} +4 -4
  157. package/dist/{VerifyEmailPage-1WwWczAn.js → VerifyEmailPage-CbgjOF0v.js} +22 -12
  158. package/dist/{VerifyEmailPage-DvMLZgFt.js → VerifyEmailPage-CdYPSJoO.js} +1 -1
  159. package/dist/{VerifyEmailPage-By3Jf__L.cjs → VerifyEmailPage-CkBYfsNy.cjs} +4 -4
  160. package/dist/{VerifyEmailPage-CJLz3jrn.js → VerifyEmailPage-Cyl55sJb.js} +23 -20
  161. package/dist/VerifyEmailPage-D-FRj5TU.cjs +3213 -0
  162. package/dist/{VerifyEmailPage-B4peJjAT.cjs → VerifyEmailPage-DF2ilhum.cjs} +334 -356
  163. package/dist/{VerifyEmailPage-CYXtbKi3.cjs → VerifyEmailPage-DMBh4NM9.cjs} +1 -1
  164. package/dist/{VerifyEmailPage-CgMxRb4z.js → VerifyEmailPage-DTtFfC-J.js} +3 -3
  165. package/dist/{VerifyEmailPage-CFLMls1p.cjs → VerifyEmailPage-Dt7zgA4w.cjs} +4 -4
  166. package/dist/{VerifyEmailPage-C5TNQTBa.js → VerifyEmailPage-EhudUdqF.js} +343 -355
  167. package/dist/{VerifyEmailPage-DGhuIqkb.js → VerifyEmailPage-X14vhdyl.js} +4 -4
  168. package/dist/VerifyEmailPage-hdB8JQGv.cjs +3213 -0
  169. package/dist/{VerifyEmailPage-Bp1XXl3H.cjs → VerifyEmailPage-u_Dn7t1U.cjs} +4 -4
  170. package/dist/VerifyEmailPage-vYHbYK3q.js +3214 -0
  171. package/dist/{XerticaProvider-CBGc4EMA.cjs → XerticaProvider-AChwphCO.cjs} +4 -4
  172. package/dist/{XerticaProvider-BIrqfZ-i.cjs → XerticaProvider-AbWlr7Af.cjs} +8 -11
  173. package/dist/{XerticaProvider-D-yNhF94.cjs → XerticaProvider-B8CaV7xu.cjs} +1 -1
  174. package/dist/{XerticaProvider-CEoWMTxu.js → XerticaProvider-BITjgC5p.js} +2 -2
  175. package/dist/{XerticaProvider-CllrbMEJ.cjs → XerticaProvider-By8q3Roe.cjs} +2 -2
  176. package/dist/{XerticaProvider-C1DKnvLh.js → XerticaProvider-CUYJZc32.js} +4 -4
  177. package/dist/{XerticaProvider-ET0ihewn.cjs → XerticaProvider-CW9hpCdF.cjs} +2 -2
  178. package/dist/{XerticaProvider-Dt5HEzbQ.js → XerticaProvider-CWgby5mY.js} +10 -10
  179. package/dist/XerticaProvider-CWs6EwNa.js +49 -0
  180. package/dist/XerticaProvider-CjQAQPcn.cjs +48 -0
  181. package/dist/XerticaProvider-D5lLumH-.js +49 -0
  182. package/dist/{XerticaProvider-DYq4JWtg.js → XerticaProvider-DQtvJU7m.js} +1 -1
  183. package/dist/XerticaProvider-qQUDop71.cjs +48 -0
  184. package/dist/{XerticaProvider-B7EVH-NF.js → XerticaProvider-siSt9uG2.js} +2 -2
  185. package/dist/{XerticaXLogo-Zw2B276b.cjs → XerticaXLogo-8TTzBjHw.cjs} +1 -1
  186. package/dist/{XerticaXLogo-B7xQ5dhi.js → XerticaXLogo-BWaag64t.js} +1 -1
  187. package/dist/{XerticaXLogo-DZbo4vOE.js → XerticaXLogo-CFuIlYFH.js} +12 -12
  188. package/dist/{XerticaXLogo-bvZSgwGF.cjs → XerticaXLogo-CU-U-GP4.cjs} +7 -13
  189. package/dist/XerticaXLogo-ChryA6xj.js +252 -0
  190. package/dist/{XerticaXLogo-CQUUjXoH.cjs → XerticaXLogo-CziKMQil.cjs} +8 -8
  191. package/dist/XerticaXLogo-DHz5SugF.js +252 -0
  192. package/dist/XerticaXLogo-DTee_y8X.cjs +251 -0
  193. package/dist/{XerticaXLogo-Cmsp-Eey.js → XerticaXLogo-DfUvz-lD.js} +9 -9
  194. package/dist/XerticaXLogo-kslQ8Tk_.cjs +251 -0
  195. package/dist/{alert-dialog-s-vmNkJ_.js → alert-dialog-iDe5VE5o.js} +3 -3
  196. package/dist/{alert-dialog-DSKByiKZ.cjs → alert-dialog-yckpaOpy.cjs} +3 -3
  197. package/dist/cli.js +2 -1
  198. package/dist/components/ui/chart/chart.d.ts +7 -5
  199. package/dist/{google-maps-loader-Y-QkD-Li.cjs → google-maps-loader-BqsYL48U.cjs} +0 -5
  200. package/dist/{google-maps-loader-CTYySAun.js → google-maps-loader-t2IlYBzw.js} +0 -4
  201. package/dist/index-CkTUgOwX.js +8 -0
  202. package/dist/{index-COtD8bRW.cjs → index-D3RLKRAs.cjs} +1 -1
  203. package/dist/index.cjs.js +2 -2
  204. package/dist/index.es.js +2 -2
  205. package/dist/index.umd.js +454 -1027
  206. package/dist/layout.cjs.js +1 -1
  207. package/dist/layout.es.js +1 -1
  208. package/dist/pages.cjs.js +1 -1
  209. package/dist/pages.es.js +1 -1
  210. package/dist/{sidebar-DAaY8bRU.cjs → sidebar-B3EYhli0.cjs} +33 -24
  211. package/dist/{sidebar-nzPoVHBQ.cjs → sidebar-B9NR0lCe.cjs} +46 -41
  212. package/dist/{sidebar-CeTMuzOx.cjs → sidebar-BvF5I2Ue.cjs} +47 -128
  213. package/dist/{sidebar-q7P2Godd.cjs → sidebar-C5B_LHek.cjs} +1 -1
  214. package/dist/{sidebar-CrQDDdcz.js → sidebar-CA6_ek3f.js} +33 -24
  215. package/dist/sidebar-CLmIjgNd.cjs +1136 -0
  216. package/dist/{sidebar-BxGXsDAd.cjs → sidebar-CVUGHOS_.cjs} +8 -16
  217. package/dist/{sidebar-BViy8Eeu.js → sidebar-CmvwjnVb.js} +9 -17
  218. package/dist/{sidebar-B6SlKZYN.js → sidebar-CplprZpM.js} +49 -40
  219. package/dist/sidebar-Duermn32.js +1133 -0
  220. package/dist/{sidebar-BbVIQvlP.js → sidebar-Dz7bd3zP.js} +1 -1
  221. package/dist/{sidebar-0ocFLSks.js → sidebar-KIS0C2JH.js} +50 -127
  222. package/dist/sidebar-OTO_up7Z.js +801 -0
  223. package/dist/sidebar-zowjejT2.cjs +800 -0
  224. package/dist/{use-audio-player-nv8ZSGa1.js → use-audio-player-Bkh23vQ3.js} +3 -7
  225. package/dist/{use-audio-player-NKsWyjWu.cjs → use-audio-player-Dn1NR9xN.cjs} +3 -7
  226. package/dist/{xertica-assistant-dyP7KHM5.cjs → xertica-assistant-B1IaHXnB.cjs} +388 -529
  227. package/dist/{xertica-assistant-ciJaWqm1.js → xertica-assistant-BMqdyRVi.js} +10 -28
  228. package/dist/{xertica-assistant-V_IdW4WF.cjs → xertica-assistant-Bj3vBCq_.cjs} +9 -27
  229. package/dist/{xertica-assistant-yX1CFBBo.js → xertica-assistant-DPsESB6t.js} +390 -531
  230. package/dist/{CodeBlock-7TTgmdGG.cjs → xertica-assistant-Qp3ydksa.cjs} +51 -263
  231. package/dist/{CodeBlock-BeSt1h5P.js → xertica-assistant-gnCJdcZY.js} +7 -219
  232. package/dist/xertica-ui.css +2 -2
  233. package/docs/architecture-improvements.md +456 -456
  234. package/docs/architecture.md +312 -312
  235. package/docs/components/assistant.md +428 -428
  236. package/docs/components/branding.md +252 -252
  237. package/docs/components/card-patterns.md +447 -447
  238. package/docs/components/error-boundary.md +201 -201
  239. package/docs/components/hooks.md +432 -432
  240. package/docs/components/language-selector.md +176 -176
  241. package/docs/components/pages.md +323 -323
  242. package/docs/components/sidebar.md +331 -331
  243. package/docs/components/stats-card.md +138 -138
  244. package/docs/doc-audit.md +244 -244
  245. package/docs/getting-started.md +616 -616
  246. package/docs/guidelines.md +330 -330
  247. package/docs/i18n.md +480 -480
  248. package/docs/installation.md +268 -268
  249. package/docs/llms.md +295 -295
  250. package/docs/state-management.md +289 -289
  251. package/guidelines/Guidelines.md +409 -409
  252. package/llms-compact.txt +1 -1
  253. package/llms-full.txt +10688 -10688
  254. package/llms.txt +1 -1
  255. package/package.json +1 -1
  256. package/styles/xertica/base.css +90 -90
  257. package/styles/xertica/tokens.css +240 -240
  258. package/templates/.prettierignore +4 -4
  259. package/templates/.prettierrc +10 -10
  260. package/templates/CLAUDE.md +180 -180
  261. package/templates/package.json +2 -2
  262. package/templates/src/app/App.tsx +46 -46
  263. package/templates/src/app/components/AuthGuard.tsx +131 -131
  264. package/templates/src/features/assistant/data/mock.ts +75 -75
  265. package/templates/src/features/assistant/hooks/useAssistantConfig.ts +20 -20
  266. package/templates/src/features/assistant/index.ts +5 -5
  267. package/templates/src/features/auth/ui/ForgotPasswordContent.tsx +70 -70
  268. package/templates/src/features/auth/ui/LoginContent.tsx +92 -92
  269. package/templates/src/features/auth/ui/ResetPasswordContent.tsx +183 -183
  270. package/templates/src/features/auth/ui/SocialLoginButtons.tsx +78 -78
  271. package/templates/src/features/auth/ui/VerifyEmailContent.tsx +80 -80
  272. package/templates/src/features/home/data/mock.ts +41 -41
  273. package/templates/src/features/home/hooks/useFeatureCards.ts +20 -20
  274. package/templates/src/features/home/index.ts +11 -11
  275. package/templates/src/features/home/ui/HomeContent.tsx +117 -117
  276. package/templates/src/features/template/ui/CrudTemplate.tsx +112 -112
  277. package/templates/src/features/template/ui/DashboardTemplate.tsx +110 -110
  278. package/templates/src/features/template/ui/FormTemplate.tsx +117 -117
  279. package/templates/src/features/template/ui/LoginTemplate.tsx +59 -59
  280. package/templates/src/features/template/ui/TemplateContent.tsx +1322 -1322
  281. package/templates/src/i18n.ts +124 -124
  282. package/templates/src/locales/en/common.json +21 -21
  283. package/templates/src/locales/en/components/activityCard.json +10 -10
  284. package/templates/src/locales/en/components/assistant.json +119 -119
  285. package/templates/src/locales/en/components/media.json +29 -29
  286. package/templates/src/locales/en/components/notificationCard.json +5 -5
  287. package/templates/src/locales/en/components/profileCard.json +8 -8
  288. package/templates/src/locales/en/components/projectCard.json +10 -10
  289. package/templates/src/locales/en/components/sidebar.json +14 -14
  290. package/templates/src/locales/en/components/stats.json +8 -8
  291. package/templates/src/locales/en/components/team.json +14 -14
  292. package/templates/src/locales/en/errors.json +9 -9
  293. package/templates/src/locales/en/languageSelector.json +7 -7
  294. package/templates/src/locales/en/nav.json +6 -6
  295. package/templates/src/locales/en/pages/crudTemplate.json +25 -25
  296. package/templates/src/locales/en/pages/dashboardTemplate.json +20 -20
  297. package/templates/src/locales/en/pages/forgotPassword.json +10 -10
  298. package/templates/src/locales/en/pages/formTemplate.json +16 -16
  299. package/templates/src/locales/en/pages/home.json +7 -7
  300. package/templates/src/locales/en/pages/login.json +15 -15
  301. package/templates/src/locales/en/pages/loginTemplate.json +9 -9
  302. package/templates/src/locales/en/pages/resetPassword.json +18 -18
  303. package/templates/src/locales/en/pages/templates.json +317 -317
  304. package/templates/src/locales/en/pages/verifyEmail.json +12 -12
  305. package/templates/src/locales/en/themeToggle.json +6 -6
  306. package/templates/src/locales/es/common.json +21 -21
  307. package/templates/src/locales/es/components/activityCard.json +10 -10
  308. package/templates/src/locales/es/components/assistant.json +119 -119
  309. package/templates/src/locales/es/components/media.json +29 -29
  310. package/templates/src/locales/es/components/notificationCard.json +5 -5
  311. package/templates/src/locales/es/components/profileCard.json +8 -8
  312. package/templates/src/locales/es/components/projectCard.json +10 -10
  313. package/templates/src/locales/es/components/sidebar.json +14 -14
  314. package/templates/src/locales/es/components/stats.json +8 -8
  315. package/templates/src/locales/es/components/team.json +14 -14
  316. package/templates/src/locales/es/errors.json +9 -9
  317. package/templates/src/locales/es/languageSelector.json +7 -7
  318. package/templates/src/locales/es/nav.json +6 -6
  319. package/templates/src/locales/es/pages/crudTemplate.json +25 -25
  320. package/templates/src/locales/es/pages/dashboardTemplate.json +20 -20
  321. package/templates/src/locales/es/pages/forgotPassword.json +10 -10
  322. package/templates/src/locales/es/pages/formTemplate.json +16 -16
  323. package/templates/src/locales/es/pages/home.json +7 -7
  324. package/templates/src/locales/es/pages/login.json +15 -15
  325. package/templates/src/locales/es/pages/loginTemplate.json +9 -9
  326. package/templates/src/locales/es/pages/resetPassword.json +18 -18
  327. package/templates/src/locales/es/pages/templates.json +317 -317
  328. package/templates/src/locales/es/pages/verifyEmail.json +12 -12
  329. package/templates/src/locales/es/themeToggle.json +6 -6
  330. package/templates/src/locales/pt-BR/common.json +21 -21
  331. package/templates/src/locales/pt-BR/components/activityCard.json +10 -10
  332. package/templates/src/locales/pt-BR/components/assistant.json +119 -119
  333. package/templates/src/locales/pt-BR/components/media.json +29 -29
  334. package/templates/src/locales/pt-BR/components/notificationCard.json +5 -5
  335. package/templates/src/locales/pt-BR/components/profileCard.json +8 -8
  336. package/templates/src/locales/pt-BR/components/projectCard.json +10 -10
  337. package/templates/src/locales/pt-BR/components/sidebar.json +14 -14
  338. package/templates/src/locales/pt-BR/components/stats.json +8 -8
  339. package/templates/src/locales/pt-BR/components/team.json +14 -14
  340. package/templates/src/locales/pt-BR/errors.json +9 -9
  341. package/templates/src/locales/pt-BR/languageSelector.json +7 -7
  342. package/templates/src/locales/pt-BR/nav.json +6 -6
  343. package/templates/src/locales/pt-BR/pages/crudTemplate.json +25 -25
  344. package/templates/src/locales/pt-BR/pages/dashboardTemplate.json +20 -20
  345. package/templates/src/locales/pt-BR/pages/forgotPassword.json +10 -10
  346. package/templates/src/locales/pt-BR/pages/formTemplate.json +16 -16
  347. package/templates/src/locales/pt-BR/pages/home.json +7 -7
  348. package/templates/src/locales/pt-BR/pages/login.json +15 -15
  349. package/templates/src/locales/pt-BR/pages/loginTemplate.json +9 -9
  350. package/templates/src/locales/pt-BR/pages/resetPassword.json +18 -18
  351. package/templates/src/locales/pt-BR/pages/templates.json +317 -317
  352. package/templates/src/locales/pt-BR/pages/verifyEmail.json +12 -12
  353. package/templates/src/locales/pt-BR/themeToggle.json +6 -6
  354. package/templates/src/pages/AssistantPage.tsx +470 -470
  355. package/templates/src/pages/HomePage.tsx +53 -53
  356. package/templates/src/shared/error-boundary.tsx +150 -150
  357. package/templates/src/shared/error-fallbacks.tsx +222 -222
  358. package/templates/src/styles/xertica/tokens.css +240 -240
  359. package/templates/vite.config.js +20 -20
  360. package/templates/vite.config.ts +55 -55
  361. package/dist/AssistantChart-BKVtGUKF.js +0 -3383
  362. package/dist/AssistantChart-CxGjH7Qk.js +0 -3477
  363. package/dist/AssistantChart-DIpshm3i.js +0 -4784
  364. package/dist/AssistantChart-D_PTeu8P.cjs +0 -3503
  365. package/dist/AssistantChart-WeycT5Pd.cjs +0 -3551
  366. package/dist/AssistantChart-zjsy2GaZ.cjs +0 -4810
  367. package/dist/AudioPlayer-B1lt5cPl.cjs +0 -989
  368. package/dist/AudioPlayer-BZ7bibzU.cjs +0 -982
  369. package/dist/AudioPlayer-BpRPS4-1.cjs +0 -1277
  370. package/dist/AudioPlayer-C12BjQBV.cjs +0 -997
  371. package/dist/AudioPlayer-CFeV8t-5.cjs +0 -936
  372. package/dist/AudioPlayer-Coly3q5R.js +0 -1278
  373. package/dist/AudioPlayer-CySJIyvL.js +0 -937
  374. package/dist/AudioPlayer-DMcG_c7L.js +0 -990
  375. package/dist/AudioPlayer-DcFKRJE_.js +0 -998
  376. package/dist/AudioPlayer-e8LfNoqO.js +0 -983
  377. package/dist/BrandColorsContext-565dDHd5.js +0 -660
  378. package/dist/BrandColorsContext-BcJbtkqn.cjs +0 -659
  379. package/dist/CodeBlock-BgfYL_rD.cjs +0 -2094
  380. package/dist/CodeBlock-BlcqlA9M.cjs +0 -2094
  381. package/dist/CodeBlock-Bnmeu5ez.cjs +0 -2094
  382. package/dist/CodeBlock-BtfPlbAI.js +0 -2078
  383. package/dist/CodeBlock-CIySIuYr.js +0 -2078
  384. package/dist/CodeBlock-CuPtUM-7.cjs +0 -2094
  385. package/dist/CodeBlock-D6ffWXgc.js +0 -2078
  386. package/dist/CodeBlock-D8dcwbit.cjs +0 -2094
  387. package/dist/CodeBlock-DMZrFnlw.cjs +0 -2094
  388. package/dist/CodeBlock-DlBehYN8.js +0 -2078
  389. package/dist/CodeBlock-DnYNI8rQ.js +0 -2078
  390. package/dist/CodeBlock-DvKWbSnE.cjs +0 -2094
  391. package/dist/CodeBlock-DwMCfkFY.js +0 -2078
  392. package/dist/CodeBlock-Dy6CNYyj.js +0 -2078
  393. package/dist/CodeBlock-U1pPOQI7.cjs +0 -2094
  394. package/dist/CodeBlock-f_GpNhEB.js +0 -2078
  395. package/dist/CodeBlock-oB6u8nI1.js +0 -2078
  396. package/dist/CodeBlock-tZC31B73.cjs +0 -2094
  397. package/dist/FeatureCard-CxC-7C-C.cjs +0 -300
  398. package/dist/FeatureCard-DbHWCb4E.js +0 -301
  399. package/dist/ImageWithFallback-CGtidP6B.cjs +0 -4542
  400. package/dist/ImageWithFallback-lsg3pdFg.js +0 -4508
  401. package/dist/LanguageSelector-B5YfbHra.js +0 -231
  402. package/dist/LanguageSelector-D6uacAIM.cjs +0 -230
  403. package/dist/LayoutContext-B45-e9DI.cjs +0 -93
  404. package/dist/LayoutContext-BAql6ZRY.js +0 -97
  405. package/dist/LayoutContext-Bav3UMEA.js +0 -94
  406. package/dist/LayoutContext-BvK-ggDa.cjs +0 -96
  407. package/dist/ThemeContext-BoH4NLfN.js +0 -734
  408. package/dist/ThemeContext-r69W20Xg.cjs +0 -733
  409. package/dist/VerifyEmailPage-COiyNl1y.js +0 -2825
  410. package/dist/VerifyEmailPage-CqKsR2v8.js +0 -2827
  411. package/dist/VerifyEmailPage-DjQKRlUS.cjs +0 -2824
  412. package/dist/VerifyEmailPage-s-1X3LDJ.cjs +0 -2826
  413. package/dist/XerticaOrbe-KL1RBHzw.cjs +0 -1354
  414. package/dist/XerticaOrbe-zwS1p2a8.js +0 -1355
  415. package/dist/XerticaProvider-6btlAlzc.js +0 -17
  416. package/dist/XerticaProvider-BNoNOxQ5.cjs +0 -16
  417. package/dist/XerticaProvider-BlY2limY.cjs +0 -38
  418. package/dist/XerticaProvider-DDuiIcKo.js +0 -39
  419. package/dist/XerticaProvider-cI9hSs27.cjs +0 -38
  420. package/dist/XerticaProvider-hSwhNQex.js +0 -39
  421. package/dist/alert-dialog-BOje--vD.js +0 -847
  422. package/dist/alert-dialog-BtEuQqrg.cjs +0 -870
  423. package/dist/breadcrumb-CqJ7bHY5.js +0 -161
  424. package/dist/breadcrumb-m9Hb2_XN.cjs +0 -177
  425. package/dist/components/assistant/xertica-assistant/hooks/index.d.ts +0 -6
  426. package/dist/components/assistant/xertica-assistant/hooks/use-assistant-conversations.d.ts +0 -21
  427. package/dist/components/assistant/xertica-assistant/hooks/use-assistant-messages.d.ts +0 -49
  428. package/dist/components/assistant/xertica-assistant/hooks/use-assistant-suggestions.d.ts +0 -16
  429. package/dist/components/blocks/audio-player/AudioPlayer.d.ts +0 -35
  430. package/dist/components/blocks/audio-player/index.d.ts +0 -1
  431. package/dist/components/blocks/document-editor/DocumentEditor.d.ts +0 -26
  432. package/dist/components/blocks/document-editor/index.d.ts +0 -1
  433. package/dist/components/blocks/podcast-player/PodcastPlayer.d.ts +0 -41
  434. package/dist/components/blocks/podcast-player/index.d.ts +0 -1
  435. package/dist/components/ui/chart/parts/chart-dashboard.d.ts +0 -113
  436. package/dist/components/ui/chart/parts/chart-metric.d.ts +0 -118
  437. package/dist/components/ui/chart/parts/chart-primitives.d.ts +0 -101
  438. package/dist/components/ui/chart/parts/chart-shared.d.ts +0 -20
  439. package/dist/components/ui/chart/parts/chart-utils.d.ts +0 -12
  440. package/dist/components/ui/chart/parts/index.d.ts +0 -5
  441. package/dist/dropdown-menu-BDB5CmQs.cjs +0 -247
  442. package/dist/dropdown-menu-DQidbKBD.js +0 -231
  443. package/dist/google-maps-loader-BFWp6VPd.js +0 -287
  444. package/dist/google-maps-loader-BKcdgFbu.cjs +0 -312
  445. package/dist/google-maps-loader-CumCNXeG.js +0 -312
  446. package/dist/google-maps-loader-eS3uQ5TA.cjs +0 -287
  447. package/dist/header-Cgy6vYPk.cjs +0 -731
  448. package/dist/header-DRlT4jgI.js +0 -715
  449. package/dist/header-Dux00SI4.cjs +0 -731
  450. package/dist/header-EkGKXPsD.js +0 -715
  451. package/dist/header-WfEywpyc.cjs +0 -731
  452. package/dist/header-tifNQn2U.js +0 -715
  453. package/dist/index-BhapVLVj.js +0 -8
  454. package/dist/index-D6fxYEY8.cjs +0 -7
  455. package/dist/index-DAIp0_HK.js +0 -8
  456. package/dist/index-DW5tYe26.js +0 -8
  457. package/dist/index-GA__GvnG.cjs +0 -7
  458. package/dist/input-2R4loU86.js +0 -127
  459. package/dist/input-DWANSKGb.cjs +0 -145
  460. package/dist/progress-DPtzoVV8.js +0 -175
  461. package/dist/progress-EeaoqqUs.cjs +0 -191
  462. package/dist/rich-text-editor-0mraWT5y.cjs +0 -2376
  463. package/dist/rich-text-editor-B-IkcPD0.js +0 -2874
  464. package/dist/rich-text-editor-B6jMRLzk.cjs +0 -1939
  465. package/dist/rich-text-editor-B8_oYcIR.js +0 -1730
  466. package/dist/rich-text-editor-B9UbSXNb.js +0 -1203
  467. package/dist/rich-text-editor-BYuRBNBU.js +0 -2373
  468. package/dist/rich-text-editor-Bb9pySTs.cjs +0 -2374
  469. package/dist/rich-text-editor-BcL6L3cm.cjs +0 -2374
  470. package/dist/rich-text-editor-BoVZYtTs.cjs +0 -2391
  471. package/dist/rich-text-editor-Bp3zQqMC.js +0 -2954
  472. package/dist/rich-text-editor-CMgSN_w2.js +0 -1189
  473. package/dist/rich-text-editor-CPV1lEPH.cjs +0 -1748
  474. package/dist/rich-text-editor-CeucBdIv.cjs +0 -2971
  475. package/dist/rich-text-editor-CoKqbCtu.cjs +0 -1799
  476. package/dist/rich-text-editor-Cw56T_mB.js +0 -2356
  477. package/dist/rich-text-editor-Cyt8qs2b.js +0 -1921
  478. package/dist/rich-text-editor-D6H84OcX.cjs +0 -1220
  479. package/dist/rich-text-editor-D76gD-QI.js +0 -2328
  480. package/dist/rich-text-editor-DKkokOnA.js +0 -1781
  481. package/dist/rich-text-editor-DNsdpN64.cjs +0 -2359
  482. package/dist/rich-text-editor-DfG8bCyY.js +0 -2358
  483. package/dist/rich-text-editor-Dxjw31Z4.js +0 -2341
  484. package/dist/rich-text-editor-DzP0Epmb.js +0 -2356
  485. package/dist/rich-text-editor-bRkNoeZY.cjs +0 -2891
  486. package/dist/rich-text-editor-lyYE2ZG5.cjs +0 -1207
  487. package/dist/rich-text-editor-skplNlBM.cjs +0 -2345
  488. package/dist/select-Bkbr0f-Z.cjs +0 -162
  489. package/dist/select-CvIVdX2n.js +0 -145
  490. package/dist/sidebar-CK_0ZQHj.cjs +0 -803
  491. package/dist/sidebar-CUuOvYhK.js +0 -787
  492. package/dist/sidebar-DQj1z3jG.cjs +0 -758
  493. package/dist/sidebar-Djn5syhi.cjs +0 -786
  494. package/dist/sidebar-LluMXfam.js +0 -759
  495. package/dist/sidebar-_rT7rBMk.js +0 -787
  496. package/dist/slider-Bc5Hd0y1.js +0 -56
  497. package/dist/slider-N7hFFj6X.cjs +0 -73
  498. package/dist/tooltip-Ded96neP.cjs +0 -137
  499. package/dist/tooltip-HDOoD2-0.js +0 -120
  500. package/dist/use-audio-player-B31J-aqh.cjs +0 -187
  501. package/dist/use-audio-player-BkmEmj8Q.js +0 -185
  502. package/dist/use-audio-player-CLFTWFW1.cjs +0 -184
  503. package/dist/use-audio-player-CLLn00I6.js +0 -188
  504. package/dist/use-file-upload-BcjEo2S5.js +0 -404
  505. package/dist/use-file-upload-CRJR68Tj.cjs +0 -403
  506. package/dist/use-mobile-B0hNy_Y6.cjs +0 -4303
  507. package/dist/use-mobile-BXuYROXM.js +0 -4202
  508. package/dist/use-mobile-Bbd51ASU.cjs +0 -4392
  509. package/dist/use-mobile-Bk6CX-TC.js +0 -4359
  510. package/dist/use-mobile-BvYdisLP.js +0 -4202
  511. package/dist/use-mobile-BzuxjzNX.cjs +0 -4392
  512. package/dist/use-mobile-CG2-SdXV.cjs +0 -4235
  513. package/dist/use-mobile-CKb5pqTs.js +0 -4269
  514. package/dist/use-mobile-CYuAuGDl.js +0 -4202
  515. package/dist/use-mobile-CaENcqm-.js +0 -4508
  516. package/dist/use-mobile-CbrYgJGJ.js +0 -4203
  517. package/dist/use-mobile-Cd4xPrKq.cjs +0 -46
  518. package/dist/use-mobile-DMOvImGQ.cjs +0 -4542
  519. package/dist/use-mobile-DRB3BQgD.cjs +0 -4235
  520. package/dist/use-mobile-DZvv7QMR.js +0 -4359
  521. package/dist/use-mobile-DdI_TXam.cjs +0 -4235
  522. package/dist/use-mobile-DlceKf8a.js +0 -4359
  523. package/dist/use-mobile-DsOnow1o.cjs +0 -4236
  524. package/dist/use-mobile-Kcj6jSnK.cjs +0 -4392
  525. package/dist/use-mobile-bnKcua_i.js +0 -4202
  526. package/dist/use-mobile-j4w2Jrf1.js +0 -30
  527. package/dist/use-mobile-ncXBeE2z.cjs +0 -4235
  528. package/dist/use-rich-text-editor-DjiddBGv.js +0 -282
  529. package/dist/use-rich-text-editor-lpeswbCs.cjs +0 -281
  530. package/dist/xertica-assistant-BdiZag0h.js +0 -2187
  531. package/dist/xertica-assistant-CrgTb6Hs.cjs +0 -2155
  532. package/dist/xertica-assistant-DCsnQyi5.js +0 -2156
  533. package/dist/xertica-assistant-DUBpmEgo.cjs +0 -2186
  534. package/dist/{rich-text-editor-DgF8s7xW.js → rich-text-editor-BmsjY03B.js} +26 -26
  535. package/dist/{rich-text-editor-mWoaSCE4.cjs → rich-text-editor-GS2kpTAK.cjs} +26 -26
@@ -1,787 +1,1033 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { Sidebar, useSidebar } from './sidebar';
3
- import { useLayout } from '../../../contexts/LayoutContext';
4
- import { BrowserRouter } from 'react-router-dom';
5
- import {
6
- Home,
7
- Users,
8
- Settings,
9
- BarChart,
10
- Plus,
11
- Clock,
12
- FileEdit,
13
- ArrowRightLeft,
14
- PanelLeft,
15
- Menu,
16
- Trash2,
17
- Map,
18
- Archive,
19
- } from 'lucide-react';
20
- import React, { useState } from 'react';
21
- import { Badge } from '../../ui/badge';
22
- import { Button } from '../../ui/button';
23
- import { Progress } from '../../ui/progress';
24
-
25
- const meta: Meta<typeof Sidebar> = {
26
- title: 'Layout/Sidebar',
27
- component: Sidebar,
28
- decorators: [
29
- Story => (
30
- <BrowserRouter>
31
- <div className="flex h-screen w-full overflow-hidden bg-background">
32
- <Story />
33
- </div>
34
- </BrowserRouter>
35
- ),
36
- ],
37
- parameters: {
38
- layout: 'fullscreen',
39
- },
40
- };
41
-
42
- export default meta;
43
- type Story = StoryObj<typeof Sidebar>;
44
-
45
- export const Default: Story = {
46
- args: {
47
- variant: 'default',
48
- expanded: false,
49
- user: { email: 'admin@example.com' },
50
- onLogout: () => console.log('Logged out'),
51
- location: { pathname: '/home' },
52
- routes: [
53
- { path: '/home', label: 'Home', icon: Home },
54
- { path: '/dashboard', label: 'Dashboard', icon: Users },
55
- { path: '/settings', label: 'Settings', icon: Settings },
56
- ],
57
- footer: {
58
- showUser: true,
59
- showSettings: true,
60
- showLogout: true,
61
- },
62
- },
63
- render: args => {
64
- const { sidebarWidth: contextWidth } = useLayout();
65
- const [isExpanded, setIsExpanded] = useState(args.expanded);
66
-
67
- // In Storybook, we match the sidebar widths (280 expanded, 80 collapsed)
68
- const currentWidth = isExpanded ? 280 : 80;
69
-
70
- return (
71
- <div
72
- className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
73
- style={{ transform: 'translateZ(0)' }}
74
- >
75
- <Sidebar
76
- {...args}
77
- expanded={isExpanded}
78
- onToggle={() => setIsExpanded(!isExpanded)}
79
- width={currentWidth}
80
- navigate={() => {}}
81
- />
82
- <div
83
- className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
84
- style={{ left: `${currentWidth}px` }}
85
- >
86
- <div className="text-center">
87
- <p className="text-muted-foreground">Traditional System Navigation</p>
88
- <p className="text-xs text-muted-foreground mt-2">Click on the menu icon to expand</p>
89
- </div>
90
- </div>
91
- </div>
92
- );
93
- },
94
- };
95
-
96
- export const DefaultWithGroups: Story = {
97
- args: {
98
- variant: 'default',
99
- expanded: false,
100
- user: { name: 'Admin', email: 'admin@example.com' },
101
- onLogout: () => console.log('Logged out'),
102
- location: { pathname: '/home' },
103
- navigationGroups: [
104
- {
105
- id: 'main',
106
- label: 'Principal',
107
- items: [
108
- { path: '/home', label: 'Início', icon: Home },
109
- {
110
- path: '/dashboard',
111
- label: 'Dashboard',
112
- icon: BarChart,
113
- children: [
114
- { path: '/dashboard/overview', label: 'Visão Geral', icon: BarChart },
115
- { path: '/dashboard/reports', label: 'Relatórios', icon: FileEdit },
116
- { path: '/dashboard/analytics', label: 'Analytics', icon: Map },
117
- ],
118
- },
119
- ],
120
- },
121
- {
122
- id: 'admin',
123
- label: 'Administração',
124
- items: [
125
- {
126
- path: '/users',
127
- label: 'Usuários',
128
- icon: Users,
129
- children: [
130
- { path: '/users/list', label: 'Lista de Usuários', icon: Users },
131
- { path: '/users/roles', label: 'Perfis de Acesso', icon: Settings },
132
- ],
133
- },
134
- { path: '/settings', label: 'Configurações', icon: Settings },
135
- ],
136
- },
137
- ],
138
- footer: {
139
- showUser: true,
140
- showSettings: false,
141
- showLogout: true,
142
- },
143
- },
144
- render: args => {
145
- const [isExpanded, setIsExpanded] = useState(args.expanded);
146
- const currentWidth = isExpanded ? 280 : 80;
147
-
148
- return (
149
- <div
150
- className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
151
- style={{ transform: 'translateZ(0)' }}
152
- >
153
- <Sidebar
154
- {...args}
155
- expanded={isExpanded}
156
- onToggle={() => setIsExpanded(!isExpanded)}
157
- width={currentWidth}
158
- navigate={() => {}}
159
- />
160
- <div
161
- className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
162
- style={{ left: `${currentWidth}px` }}
163
- >
164
- <div className="text-center">
165
- <p className="text-muted-foreground">Navigation with Groups and Children</p>
166
- <p className="text-xs text-muted-foreground mt-2">
167
- Expand and click the arrow button on items to see sub-menus
168
- </p>
169
- </div>
170
- </div>
171
- </div>
172
- );
173
- },
174
- };
175
-
176
- export const Assistant: Story = {
177
- args: {
178
- variant: 'assistant',
179
- expanded: false,
180
- user: { email: 'admin@example.com' },
181
- onLogout: () => console.log('Logged out'),
182
- location: { pathname: '/assistant/refatoracao' },
183
- search: {
184
- show: true,
185
- placeholder: 'Buscar tópicos...',
186
- filter: {
187
- show: true,
188
- content: (
189
- <div className="p-2 space-y-2">
190
- <div className="text-xs font-semibold uppercase text-muted-foreground px-2 text-left">
191
- Filter by Status
192
- </div>
193
- <div className="flex flex-wrap gap-2 p-1">
194
- <Badge className="bg-sidebar-foreground/20 text-sidebar-foreground border-none cursor-pointer hover:bg-sidebar-foreground/30">
195
- Active
196
- </Badge>
197
- <Badge
198
- variant="outline"
199
- className="text-sidebar-foreground/70 border-sidebar-foreground/20 cursor-pointer hover:bg-sidebar-foreground/10"
200
- >
201
- Archived
202
- </Badge>
203
- <Badge
204
- variant="outline"
205
- className="text-sidebar-foreground/70 border-sidebar-foreground/20 cursor-pointer hover:bg-sidebar-foreground/10"
206
- >
207
- Pending
208
- </Badge>
209
- </div>
210
- </div>
211
- ),
212
- },
213
- },
214
- fixedArea: {
215
- show: true,
216
- icon: Plus,
217
- onClick: () => console.log('New Conversation clicked'),
218
- content: (
219
- <Button className="w-full bg-sidebar-primary hover:bg-sidebar-primary/90 text-sidebar-primary-foreground shadow-lg font-bold border-none transition-all duration-300 transform hover:scale-[1.02] active:scale-[0.98]">
220
- <Plus className="w-4 h-4 mr-2" />
221
- New Conversation
222
- </Button>
223
- ),
224
- },
225
- navigationGroups: [
226
- {
227
- id: 'recent',
228
- label: 'Recent',
229
- icon: Clock,
230
- items: [
231
- {
232
- path: '/assistant/refatoracao',
233
- label: 'Edit Sidebar',
234
- description: 'Active now',
235
- actions: [
236
- { label: 'Rename', icon: FileEdit, onClick: () => console.log('Open rename...') },
237
- {
238
- label: 'Move',
239
- icon: ArrowRightLeft,
240
- children: [
241
- {
242
- label: 'Active Projects',
243
- onClick: () => console.log('Moved to Active Projects'),
244
- },
245
- { label: 'Monitoring', onClick: () => console.log('Moved to Monitoring') },
246
- { label: 'Archive', onClick: () => console.log('Moved to Archive') },
247
- ],
248
- },
249
- {
250
- label: 'Clear',
251
- icon: Trash2,
252
- onClick: () => console.log('History Cleared!'),
253
- variant: 'destructive',
254
- },
255
- ],
256
- },
257
- ],
258
- },
259
- {
260
- id: 'projects',
261
- label: 'Project Monitoring',
262
- icon: Map,
263
- actions: [
264
- {
265
- label: 'New Category',
266
- icon: Plus,
267
- onClick: () => console.log('Create new category...'),
268
- },
269
- {
270
- label: 'Archive Group',
271
- icon: Archive,
272
- onClick: () => console.log('Archiving group...'),
273
- },
274
- ],
275
- items: [
276
- {
277
- path: '/assistant/br163',
278
- label: 'Panel Status',
279
- icon: () => <div className="w-2 h-2 rounded-full bg-yellow-500" />,
280
- description: (
281
- <div className="space-y-1.5 min-w-[160px]">
282
- <Progress value={67} className="h-1.5 bg-sidebar-foreground/10" />
283
- <div className="flex justify-between items-center text-[10px] text-sidebar-foreground/60">
284
- <span>Label</span>
285
- <span>67%</span>
286
- </div>
287
- </div>
288
- ),
289
- },
290
- ],
291
- },
292
- ],
293
- },
294
- render: args => {
295
- const [isExpanded, setIsExpanded] = useState(args.expanded);
296
- const currentWidth = isExpanded ? 280 : 80;
297
-
298
- return (
299
- <div
300
- className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
301
- style={{ transform: 'translateZ(0)' }}
302
- >
303
- <Sidebar
304
- {...args}
305
- expanded={isExpanded}
306
- onToggle={() => setIsExpanded(!isExpanded)}
307
- width={currentWidth}
308
- navigate={() => {}}
309
- />
310
- <div
311
- className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
312
- style={{ left: `${currentWidth}px` }}
313
- >
314
- <div className="text-center">
315
- <p className="text-muted-foreground">Assistant Mode Content</p>
316
- <p className="text-xs text-muted-foreground mt-2">Click on the menu icon to expand</p>
317
- </div>
318
- </div>
319
- </div>
320
- );
321
- },
322
- };
323
-
324
- export const Collapsed: Story = {
325
- args: {
326
- ...Default.args,
327
- expanded: false,
328
- },
329
- render: args => {
330
- const [isExpanded, setIsExpanded] = useState(args.expanded);
331
- const currentWidth = isExpanded ? 280 : 80;
332
-
333
- return (
334
- <div
335
- className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
336
- style={{ transform: 'translateZ(0)' }}
337
- >
338
- <Sidebar
339
- {...args}
340
- expanded={isExpanded}
341
- onToggle={() => setIsExpanded(!isExpanded)}
342
- width={currentWidth}
343
- navigate={() => {}}
344
- />
345
- <div
346
- className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
347
- style={{ left: `${currentWidth}px` }}
348
- >
349
- <div className="text-center">
350
- <p className="text-muted-foreground">Compact Navigation</p>
351
- <p className="text-xs text-muted-foreground mt-2">Click on the menu icon to expand</p>
352
- </div>
353
- </div>
354
- </div>
355
- );
356
- },
357
- };
358
- export const NoFooter: Story = {
359
- args: {
360
- ...Default.args,
361
- showFooter: false,
362
- },
363
- render: args => {
364
- const [isExpanded, setIsExpanded] = useState(args.expanded);
365
- const currentWidth = isExpanded ? 280 : 80;
366
-
367
- return (
368
- <div
369
- className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
370
- style={{ transform: 'translateZ(0)' }}
371
- >
372
- <Sidebar
373
- {...args}
374
- expanded={isExpanded}
375
- onToggle={() => setIsExpanded(!isExpanded)}
376
- width={currentWidth}
377
- navigate={() => {}}
378
- />
379
- <div
380
- className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
381
- style={{ left: `${currentWidth}px` }}
382
- >
383
- <div className="text-center">
384
- <p className="text-muted-foreground">Sidebar without Footer</p>
385
- <p className="text-xs text-muted-foreground mt-2">Click on the menu icon to expand</p>
386
- </div>
387
- </div>
388
- </div>
389
- );
390
- },
391
- };
392
-
393
- export const Autonomous: Story = {
394
- args: {
395
- ...Default.args,
396
- expanded: undefined,
397
- onToggle: undefined,
398
- },
399
- render: args => {
400
- return (
401
- <div
402
- className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
403
- style={{ transform: 'translateZ(0)' }}
404
- >
405
- <Sidebar {...args} />
406
- <div
407
- className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
408
- style={{ left: `80px` }}
409
- >
410
- <div className="text-center max-w-md">
411
- <p className="text-muted-foreground font-bold">Autonomous Sidebar</p>
412
- <p className="text-sm text-muted-foreground/80 mt-2">
413
- This instance is managing its own state internally. No `expanded` or `onToggle` props
414
- are passed.
415
- </p>
416
- <p className="text-xs text-muted-foreground mt-4">
417
- Note: Layout coordination (content padding) must be handled manually when using
418
- autonomous mode without LayoutProvider.
419
- </p>
420
- </div>
421
- </div>
422
- </div>
423
- );
424
- },
425
- };
426
-
427
- /**
428
- * Desktop view with sub-items expanded.
429
- * Items with `children` show a ChevronRight button; clicking it opens a
430
- * dropdown listing the child routes positioned to the right of the sidebar.
431
- */
432
- export const WithSubitemsDesktop: Story = {
433
- name: 'With Sub-items (Desktop)',
434
- args: {
435
- variant: 'default',
436
- expanded: true,
437
- user: { name: 'Admin', email: 'admin@example.com' },
438
- onLogout: () => console.log('Logged out'),
439
- location: { pathname: '/dashboard' },
440
- navigationGroups: [
441
- {
442
- id: 'main',
443
- label: 'Principal',
444
- items: [
445
- { path: '/home', label: 'Início', icon: Home },
446
- {
447
- path: '/dashboard',
448
- label: 'Dashboard',
449
- icon: BarChart,
450
- children: [
451
- { path: '/dashboard/overview', label: 'Visão Geral', icon: BarChart },
452
- { path: '/dashboard/reports', label: 'Relatórios', icon: FileEdit },
453
- { path: '/dashboard/analytics', label: 'Analytics', icon: Map },
454
- ],
455
- },
456
- ],
457
- },
458
- {
459
- id: 'admin',
460
- label: 'Administração',
461
- items: [
462
- {
463
- path: '/users',
464
- label: 'Usuários',
465
- icon: Users,
466
- children: [
467
- { path: '/users/list', label: 'Lista de Usuários', icon: Users },
468
- { path: '/users/roles', label: 'Perfis de Acesso', icon: Settings },
469
- ],
470
- },
471
- { path: '/settings', label: 'Configurações', icon: Settings },
472
- ],
473
- },
474
- ],
475
- footer: {
476
- showUser: true,
477
- showSettings: false,
478
- showLogout: true,
479
- },
480
- },
481
- render: args => {
482
- const [isExpanded, setIsExpanded] = useState(true);
483
- const currentWidth = isExpanded ? 280 : 80;
484
-
485
- return (
486
- <div
487
- className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
488
- style={{ transform: 'translateZ(0)' }}
489
- >
490
- <Sidebar
491
- {...args}
492
- expanded={isExpanded}
493
- onToggle={() => setIsExpanded(!isExpanded)}
494
- width={currentWidth}
495
- navigate={() => {}}
496
- />
497
- <div
498
- className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
499
- style={{ left: `${currentWidth}px` }}
500
- >
501
- <div className="text-center max-w-sm space-y-2">
502
- <p className="text-muted-foreground font-medium">Desktop — Subitens</p>
503
- <p className="text-xs text-muted-foreground">
504
- Itens com subitens exibem um botão{' '}
505
- <code className="bg-muted px-1 rounded text-xs">ChevronRight</code> ao final da
506
- linha. Clique nele para abrir o dropdown de rotas filhas.
507
- </p>
508
- <p className="text-xs text-muted-foreground mt-2">
509
- Use o botão de toggle para alternar entre expandido e recolhido.
510
- </p>
511
- </div>
512
- </div>
513
- </div>
514
- );
515
- },
516
- };
517
-
518
- /**
519
- * Mobile view with sub-items.
520
- * Simulates a narrow viewport (375 px) so the sidebar renders in its
521
- * full-screen overlay mode. When expanded the sidebar covers the entire
522
- * container; clicking a nav item (or the back-arrow toggle) closes it.
523
- *
524
- * Sub-item dropdowns behave identically to desktop — the ChevronRight
525
- * button opens a `DropdownMenuContent` positioned to the right.
526
- * This story exists so the mobile layout can be inspected and adjusted.
527
- */
528
- export const WithSubitemsMobile: Story = {
529
- name: 'With Sub-items (Mobile)',
530
- parameters: {
531
- viewport: { defaultViewport: 'mobile1' },
532
- },
533
- args: {
534
- variant: 'default',
535
- expanded: false,
536
- user: { name: 'Admin', email: 'admin@example.com' },
537
- onLogout: () => console.log('Logged out'),
538
- location: { pathname: '/dashboard' },
539
- navigationGroups: [
540
- {
541
- id: 'main',
542
- label: 'Principal',
543
- items: [
544
- { path: '/home', label: 'Início', icon: Home },
545
- {
546
- path: '/dashboard',
547
- label: 'Dashboard',
548
- icon: BarChart,
549
- children: [
550
- { path: '/dashboard/overview', label: 'Visão Geral', icon: BarChart },
551
- { path: '/dashboard/reports', label: 'Relatórios', icon: FileEdit },
552
- { path: '/dashboard/analytics', label: 'Analytics', icon: Map },
553
- ],
554
- },
555
- ],
556
- },
557
- {
558
- id: 'admin',
559
- label: 'Administração',
560
- items: [
561
- {
562
- path: '/users',
563
- label: 'Usuários',
564
- icon: Users,
565
- children: [
566
- { path: '/users/list', label: 'Lista de Usuários', icon: Users },
567
- { path: '/users/roles', label: 'Perfis de Acesso', icon: Settings },
568
- ],
569
- },
570
- { path: '/settings', label: 'Configurações', icon: Settings },
571
- ],
572
- },
573
- ],
574
- footer: {
575
- showUser: true,
576
- showSettings: false,
577
- showLogout: true,
578
- },
579
- },
580
- render: args => {
581
- const [isExpanded, setIsExpanded] = useState(false);
582
-
583
- return (
584
- /* Constrain to ~375 px to reproduce a mobile viewport inside Storybook */
585
- <div
586
- className="relative bg-muted/20 overflow-hidden border rounded-[var(--radius-lg)]"
587
- style={{ width: '375px', height: '100vh', margin: '0 auto' }}
588
- >
589
- {/* Page content visible when sidebar is closed */}
590
- {!isExpanded && (
591
- <div className="h-full flex flex-col">
592
- <div className="flex items-center gap-3 px-4 py-3 border-b border-border bg-background">
593
- <button
594
- onClick={() => setIsExpanded(true)}
595
- className="p-2 rounded-md hover:bg-accent transition-colors"
596
- aria-label="Abrir menu"
597
- >
598
- <Menu className="w-5 h-5" />
599
- </button>
600
- <span className="font-semibold text-sm">Minha Aplicação</span>
601
- </div>
602
- <div className="flex-1 flex items-center justify-center p-8">
603
- <div className="text-center space-y-2">
604
- <p className="text-muted-foreground font-medium">Mobile — Subitens</p>
605
- <p className="text-xs text-muted-foreground">
606
- Clique no ícone de menu (☰) no topo para abrir a sidebar em modo
607
- tela-cheia. Itens com subitens mostram um{' '}
608
- <code className="bg-muted px-1 rounded text-xs">ChevronRight</code> ao final
609
- da linha.
610
- </p>
611
- </div>
612
- </div>
613
- </div>
614
- )}
615
-
616
- <Sidebar
617
- {...args}
618
- expanded={isExpanded}
619
- onToggle={() => setIsExpanded(prev => !prev)}
620
- width={375}
621
- navigate={() => setIsExpanded(false)}
622
- />
623
- </div>
624
- );
625
- },
626
- };
627
-
628
- /**
629
- * Compound Component API — demonstrates using Sidebar.Root + sub-components
630
- * for full layout control. This is the recommended pattern for advanced
631
- * customization without forking the component.
632
- */
633
- export const CompoundComponentAPI: Story = {
634
- name: 'Compound Component API',
635
- render: () => {
636
- const [isExpanded, setIsExpanded] = React.useState(true);
637
- const currentWidth = isExpanded ? 280 : 80;
638
- const groups = [
639
- {
640
- id: 'main',
641
- label: 'Principal',
642
- items: [
643
- { path: '/home', label: 'Início', icon: Home },
644
- { path: '/dashboard', label: 'Dashboard', icon: BarChart },
645
- ],
646
- },
647
- {
648
- id: 'admin',
649
- label: 'Administração',
650
- items: [
651
- { path: '/users', label: 'Usuários', icon: Users },
652
- { path: '/settings', label: 'Configurações', icon: Settings },
653
- ],
654
- },
655
- ];
656
-
657
- return (
658
- <div
659
- className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
660
- style={{ transform: 'translateZ(0)' }}
661
- >
662
- {/* Compound Component usage */}
663
- <Sidebar.Root
664
- expanded={isExpanded}
665
- onToggle={() => setIsExpanded(prev => !prev)}
666
- width={currentWidth}
667
- location={{ pathname: '/home' }}
668
- navigate={() => {}}
669
- >
670
- <Sidebar.Header />
671
- <Sidebar.Nav navigationGroups={groups} />
672
- <Sidebar.Footer
673
- user={{ name: 'Admin', email: 'admin@example.com' }}
674
- onLogout={() => console.log('logout')}
675
- showUser
676
- showSettings
677
- showLogout
678
- />
679
- </Sidebar.Root>
680
-
681
- <div
682
- className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
683
- style={{ left: `${currentWidth}px` }}
684
- >
685
- <div className="text-center max-w-md space-y-3">
686
- <p className="text-muted-foreground font-bold">Compound Component API</p>
687
- <p className="text-sm text-muted-foreground/80">
688
- Built with <code className="bg-muted px-1 rounded text-xs">&lt;Sidebar.Root&gt;</code>
689
- , <code className="bg-muted px-1 rounded text-xs">&lt;Sidebar.Header&gt;</code>,{' '}
690
- <code className="bg-muted px-1 rounded text-xs">&lt;Sidebar.Nav&gt;</code>, and{' '}
691
- <code className="bg-muted px-1 rounded text-xs">&lt;Sidebar.Footer&gt;</code>.
692
- </p>
693
- <p className="text-xs text-muted-foreground">
694
- Each sub-component reads shared state from{' '}
695
- <code className="bg-muted px-1 rounded text-xs">SidebarContext</code> via{' '}
696
- <code className="bg-muted px-1 rounded text-xs">Sidebar.Root</code>.
697
- </p>
698
- </div>
699
- </div>
700
- </div>
701
- );
702
- },
703
- };
704
-
705
- /**
706
- * Headless Hook — demonstrates using `useSidebar` directly for fully custom rendering.
707
- * The hook manages all state; the UI is entirely up to the consumer.
708
- */
709
- export const HeadlessHook: Story = {
710
- name: 'Headless Hook (useSidebar)',
711
- render: () => {
712
- const groups = [
713
- {
714
- id: 'main',
715
- label: 'Principal',
716
- items: [
717
- { path: '/home', label: 'Início', icon: Home },
718
- { path: '/dashboard', label: 'Dashboard', icon: BarChart },
719
- { path: '/users', label: 'Usuários', icon: Users },
720
- ],
721
- },
722
- ];
723
-
724
- const {
725
- expanded,
726
- toggleExpanded,
727
- navigationGroups: resolvedGroups,
728
- } = useSidebar({ defaultExpanded: true, navigationGroups: groups });
729
-
730
- const width = expanded ? 280 : 80;
731
-
732
- return (
733
- <div
734
- className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
735
- style={{ transform: 'translateZ(0)' }}
736
- >
737
- {/* Fully custom sidebar built with useSidebar hook */}
738
- <div
739
- className="absolute inset-y-0 left-0 bg-sidebar text-sidebar-foreground flex flex-col transition-all duration-300 z-50"
740
- style={{ width: `${width}px` }}
741
- >
742
- <div className="p-4">
743
- <button
744
- onClick={toggleExpanded}
745
- className="w-full h-10 flex items-center justify-center rounded-md bg-sidebar-foreground/10 hover:bg-sidebar-foreground/20 text-sidebar-foreground transition-colors"
746
- aria-label={expanded ? 'Collapse' : 'Expand'}
747
- >
748
- {expanded ? <PanelLeft className="w-5 h-5" /> : <Menu className="w-5 h-5" />}
749
- </button>
750
- </div>
751
- <nav className="flex-1 px-3 space-y-1">
752
- {resolvedGroups
753
- .flatMap(g => g.items)
754
- .map(item => {
755
- const Icon = item.icon;
756
- return (
757
- <button
758
- key={item.path}
759
- className="w-full h-10 flex items-center gap-3 px-3 rounded-md text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground transition-colors"
760
- >
761
- {Icon && <Icon className="w-5 h-5 flex-shrink-0" />}
762
- {expanded && <span className="truncate text-sm">{item.label}</span>}
763
- </button>
764
- );
765
- })}
766
- </nav>
767
- </div>
768
-
769
- <div
770
- className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
771
- style={{ left: `${width}px` }}
772
- >
773
- <div className="text-center max-w-md space-y-3">
774
- <p className="text-muted-foreground font-bold">Headless Hook</p>
775
- <p className="text-sm text-muted-foreground/80">
776
- State managed by <code className="bg-muted px-1 rounded text-xs">useSidebar()</code>.
777
- The entire UI is custom — no Sidebar component used.
778
- </p>
779
- <p className="text-xs text-muted-foreground">
780
- Sidebar is currently: <strong>{expanded ? 'Expanded' : 'Collapsed'}</strong>
781
- </p>
782
- </div>
783
- </div>
784
- </div>
785
- );
786
- },
787
- };
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Sidebar, useSidebar } from './sidebar';
3
+ import { useLayout } from '../../../contexts/LayoutContext';
4
+ import { BrowserRouter } from 'react-router-dom';
5
+ import {
6
+ Home,
7
+ Users,
8
+ Settings,
9
+ BarChart,
10
+ Plus,
11
+ Clock,
12
+ FileEdit,
13
+ ArrowRightLeft,
14
+ PanelLeft,
15
+ Menu,
16
+ Trash2,
17
+ Map,
18
+ Archive,
19
+ ShoppingCart,
20
+ Package,
21
+ Tag,
22
+ Truck,
23
+ CreditCard,
24
+ Bell,
25
+ Shield,
26
+ Key,
27
+ Database,
28
+ Server,
29
+ Activity,
30
+ TrendingUp,
31
+ PieChart,
32
+ BarChart2,
33
+ FileText,
34
+ Folder,
35
+ MessageSquare,
36
+ Mail,
37
+ Phone,
38
+ Globe,
39
+ Layers,
40
+ Zap,
41
+ } from 'lucide-react';
42
+ import React, { useState } from 'react';
43
+ import { Badge } from '../../ui/badge';
44
+ import { Button } from '../../ui/button';
45
+ import { Progress } from '../../ui/progress';
46
+
47
+ const meta: Meta<typeof Sidebar> = {
48
+ title: 'Layout/Sidebar',
49
+ component: Sidebar,
50
+ decorators: [
51
+ Story => (
52
+ <BrowserRouter>
53
+ <div className="flex h-screen w-full overflow-hidden bg-background">
54
+ <Story />
55
+ </div>
56
+ </BrowserRouter>
57
+ ),
58
+ ],
59
+ parameters: {
60
+ layout: 'fullscreen',
61
+ },
62
+ };
63
+
64
+ export default meta;
65
+ type Story = StoryObj<typeof Sidebar>;
66
+
67
+ export const Default: Story = {
68
+ args: {
69
+ variant: 'default',
70
+ expanded: false,
71
+ user: { email: 'admin@example.com' },
72
+ onLogout: () => console.log('Logged out'),
73
+ location: { pathname: '/home' },
74
+ routes: [
75
+ { path: '/home', label: 'Home', icon: Home },
76
+ { path: '/dashboard', label: 'Dashboard', icon: Users },
77
+ { path: '/settings', label: 'Settings', icon: Settings },
78
+ ],
79
+ footer: {
80
+ showUser: true,
81
+ showSettings: true,
82
+ showLogout: true,
83
+ },
84
+ },
85
+ render: args => {
86
+ const { sidebarWidth: contextWidth } = useLayout();
87
+ const [isExpanded, setIsExpanded] = useState(args.expanded);
88
+
89
+ // In Storybook, we match the sidebar widths (280 expanded, 80 collapsed)
90
+ const currentWidth = isExpanded ? 280 : 80;
91
+
92
+ return (
93
+ <div
94
+ className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
95
+ style={{ transform: 'translateZ(0)' }}
96
+ >
97
+ <Sidebar
98
+ {...args}
99
+ expanded={isExpanded}
100
+ onToggle={() => setIsExpanded(!isExpanded)}
101
+ width={currentWidth}
102
+ navigate={() => {}}
103
+ />
104
+ <div
105
+ className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
106
+ style={{ left: `${currentWidth}px` }}
107
+ >
108
+ <div className="text-center">
109
+ <p className="text-muted-foreground">Traditional System Navigation</p>
110
+ <p className="text-xs text-muted-foreground mt-2">Click on the menu icon to expand</p>
111
+ </div>
112
+ </div>
113
+ </div>
114
+ );
115
+ },
116
+ };
117
+
118
+ export const DefaultWithGroups: Story = {
119
+ args: {
120
+ variant: 'default',
121
+ expanded: false,
122
+ user: { name: 'Admin', email: 'admin@example.com' },
123
+ onLogout: () => console.log('Logged out'),
124
+ location: { pathname: '/home' },
125
+ navigationGroups: [
126
+ {
127
+ id: 'main',
128
+ label: 'Principal',
129
+ items: [
130
+ { path: '/home', label: 'Início', icon: Home },
131
+ {
132
+ path: '/dashboard',
133
+ label: 'Dashboard',
134
+ icon: BarChart,
135
+ children: [
136
+ { path: '/dashboard/overview', label: 'Visão Geral', icon: BarChart },
137
+ { path: '/dashboard/reports', label: 'Relatórios', icon: FileEdit },
138
+ { path: '/dashboard/analytics', label: 'Analytics', icon: Map },
139
+ ],
140
+ },
141
+ ],
142
+ },
143
+ {
144
+ id: 'admin',
145
+ label: 'Administração',
146
+ items: [
147
+ {
148
+ path: '/users',
149
+ label: 'Usuários',
150
+ icon: Users,
151
+ children: [
152
+ { path: '/users/list', label: 'Lista de Usuários', icon: Users },
153
+ { path: '/users/roles', label: 'Perfis de Acesso', icon: Settings },
154
+ ],
155
+ },
156
+ { path: '/settings', label: 'Configurações', icon: Settings },
157
+ ],
158
+ },
159
+ ],
160
+ footer: {
161
+ showUser: true,
162
+ showSettings: false,
163
+ showLogout: true,
164
+ },
165
+ },
166
+ render: args => {
167
+ const [isExpanded, setIsExpanded] = useState(args.expanded);
168
+ const currentWidth = isExpanded ? 280 : 80;
169
+
170
+ return (
171
+ <div
172
+ className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
173
+ style={{ transform: 'translateZ(0)' }}
174
+ >
175
+ <Sidebar
176
+ {...args}
177
+ expanded={isExpanded}
178
+ onToggle={() => setIsExpanded(!isExpanded)}
179
+ width={currentWidth}
180
+ navigate={() => {}}
181
+ />
182
+ <div
183
+ className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
184
+ style={{ left: `${currentWidth}px` }}
185
+ >
186
+ <div className="text-center">
187
+ <p className="text-muted-foreground">Navigation with Groups and Children</p>
188
+ <p className="text-xs text-muted-foreground mt-2">
189
+ Expand and click the arrow button on items to see sub-menus
190
+ </p>
191
+ </div>
192
+ </div>
193
+ </div>
194
+ );
195
+ },
196
+ };
197
+
198
+ export const Assistant: Story = {
199
+ args: {
200
+ variant: 'assistant',
201
+ expanded: false,
202
+ user: { email: 'admin@example.com' },
203
+ onLogout: () => console.log('Logged out'),
204
+ location: { pathname: '/assistant/refatoracao' },
205
+ search: {
206
+ show: true,
207
+ placeholder: 'Buscar tópicos...',
208
+ filter: {
209
+ show: true,
210
+ content: (
211
+ <div className="p-2 space-y-2">
212
+ <div className="text-xs font-semibold uppercase text-muted-foreground px-2 text-left">
213
+ Filter by Status
214
+ </div>
215
+ <div className="flex flex-wrap gap-2 p-1">
216
+ <Badge className="bg-sidebar-foreground/20 text-sidebar-foreground border-none cursor-pointer hover:bg-sidebar-foreground/30">
217
+ Active
218
+ </Badge>
219
+ <Badge
220
+ variant="outline"
221
+ className="text-sidebar-foreground/70 border-sidebar-foreground/20 cursor-pointer hover:bg-sidebar-foreground/10"
222
+ >
223
+ Archived
224
+ </Badge>
225
+ <Badge
226
+ variant="outline"
227
+ className="text-sidebar-foreground/70 border-sidebar-foreground/20 cursor-pointer hover:bg-sidebar-foreground/10"
228
+ >
229
+ Pending
230
+ </Badge>
231
+ </div>
232
+ </div>
233
+ ),
234
+ },
235
+ },
236
+ fixedArea: {
237
+ show: true,
238
+ icon: Plus,
239
+ onClick: () => console.log('New Conversation clicked'),
240
+ content: (
241
+ <Button className="w-full bg-sidebar-primary hover:bg-sidebar-primary/90 text-sidebar-primary-foreground shadow-lg font-bold border-none transition-all duration-300 transform hover:scale-[1.02] active:scale-[0.98]">
242
+ <Plus className="w-4 h-4 mr-2" />
243
+ New Conversation
244
+ </Button>
245
+ ),
246
+ },
247
+ navigationGroups: [
248
+ {
249
+ id: 'recent',
250
+ label: 'Recent',
251
+ icon: Clock,
252
+ items: [
253
+ {
254
+ path: '/assistant/refatoracao',
255
+ label: 'Edit Sidebar',
256
+ description: 'Active now',
257
+ actions: [
258
+ { label: 'Rename', icon: FileEdit, onClick: () => console.log('Open rename...') },
259
+ {
260
+ label: 'Move',
261
+ icon: ArrowRightLeft,
262
+ children: [
263
+ {
264
+ label: 'Active Projects',
265
+ onClick: () => console.log('Moved to Active Projects'),
266
+ },
267
+ { label: 'Monitoring', onClick: () => console.log('Moved to Monitoring') },
268
+ { label: 'Archive', onClick: () => console.log('Moved to Archive') },
269
+ ],
270
+ },
271
+ {
272
+ label: 'Clear',
273
+ icon: Trash2,
274
+ onClick: () => console.log('History Cleared!'),
275
+ variant: 'destructive',
276
+ },
277
+ ],
278
+ },
279
+ ],
280
+ },
281
+ {
282
+ id: 'projects',
283
+ label: 'Project Monitoring',
284
+ icon: Map,
285
+ actions: [
286
+ {
287
+ label: 'New Category',
288
+ icon: Plus,
289
+ onClick: () => console.log('Create new category...'),
290
+ },
291
+ {
292
+ label: 'Archive Group',
293
+ icon: Archive,
294
+ onClick: () => console.log('Archiving group...'),
295
+ },
296
+ ],
297
+ items: [
298
+ {
299
+ path: '/assistant/br163',
300
+ label: 'Panel Status',
301
+ icon: () => <div className="w-2 h-2 rounded-full bg-yellow-500" />,
302
+ description: (
303
+ <div className="space-y-1.5 min-w-[160px]">
304
+ <Progress value={67} className="h-1.5 bg-sidebar-foreground/10" />
305
+ <div className="flex justify-between items-center text-[10px] text-sidebar-foreground/60">
306
+ <span>Label</span>
307
+ <span>67%</span>
308
+ </div>
309
+ </div>
310
+ ),
311
+ },
312
+ ],
313
+ },
314
+ ],
315
+ },
316
+ render: args => {
317
+ const [isExpanded, setIsExpanded] = useState(args.expanded);
318
+ const currentWidth = isExpanded ? 280 : 80;
319
+
320
+ return (
321
+ <div
322
+ className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
323
+ style={{ transform: 'translateZ(0)' }}
324
+ >
325
+ <Sidebar
326
+ {...args}
327
+ expanded={isExpanded}
328
+ onToggle={() => setIsExpanded(!isExpanded)}
329
+ width={currentWidth}
330
+ navigate={() => {}}
331
+ />
332
+ <div
333
+ className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
334
+ style={{ left: `${currentWidth}px` }}
335
+ >
336
+ <div className="text-center">
337
+ <p className="text-muted-foreground">Assistant Mode Content</p>
338
+ <p className="text-xs text-muted-foreground mt-2">Click on the menu icon to expand</p>
339
+ </div>
340
+ </div>
341
+ </div>
342
+ );
343
+ },
344
+ };
345
+
346
+ export const Collapsed: Story = {
347
+ args: {
348
+ ...Default.args,
349
+ expanded: false,
350
+ },
351
+ render: args => {
352
+ const [isExpanded, setIsExpanded] = useState(args.expanded);
353
+ const currentWidth = isExpanded ? 280 : 80;
354
+
355
+ return (
356
+ <div
357
+ className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
358
+ style={{ transform: 'translateZ(0)' }}
359
+ >
360
+ <Sidebar
361
+ {...args}
362
+ expanded={isExpanded}
363
+ onToggle={() => setIsExpanded(!isExpanded)}
364
+ width={currentWidth}
365
+ navigate={() => {}}
366
+ />
367
+ <div
368
+ className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
369
+ style={{ left: `${currentWidth}px` }}
370
+ >
371
+ <div className="text-center">
372
+ <p className="text-muted-foreground">Compact Navigation</p>
373
+ <p className="text-xs text-muted-foreground mt-2">Click on the menu icon to expand</p>
374
+ </div>
375
+ </div>
376
+ </div>
377
+ );
378
+ },
379
+ };
380
+ export const NoFooter: Story = {
381
+ args: {
382
+ ...Default.args,
383
+ showFooter: false,
384
+ },
385
+ render: args => {
386
+ const [isExpanded, setIsExpanded] = useState(args.expanded);
387
+ const currentWidth = isExpanded ? 280 : 80;
388
+
389
+ return (
390
+ <div
391
+ className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
392
+ style={{ transform: 'translateZ(0)' }}
393
+ >
394
+ <Sidebar
395
+ {...args}
396
+ expanded={isExpanded}
397
+ onToggle={() => setIsExpanded(!isExpanded)}
398
+ width={currentWidth}
399
+ navigate={() => {}}
400
+ />
401
+ <div
402
+ className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
403
+ style={{ left: `${currentWidth}px` }}
404
+ >
405
+ <div className="text-center">
406
+ <p className="text-muted-foreground">Sidebar without Footer</p>
407
+ <p className="text-xs text-muted-foreground mt-2">Click on the menu icon to expand</p>
408
+ </div>
409
+ </div>
410
+ </div>
411
+ );
412
+ },
413
+ };
414
+
415
+ export const Autonomous: Story = {
416
+ args: {
417
+ ...Default.args,
418
+ expanded: undefined,
419
+ onToggle: undefined,
420
+ },
421
+ render: args => {
422
+ return (
423
+ <div
424
+ className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
425
+ style={{ transform: 'translateZ(0)' }}
426
+ >
427
+ <Sidebar {...args} />
428
+ <div
429
+ className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
430
+ style={{ left: `80px` }}
431
+ >
432
+ <div className="text-center max-w-md">
433
+ <p className="text-muted-foreground font-bold">Autonomous Sidebar</p>
434
+ <p className="text-sm text-muted-foreground/80 mt-2">
435
+ This instance is managing its own state internally. No `expanded` or `onToggle` props
436
+ are passed.
437
+ </p>
438
+ <p className="text-xs text-muted-foreground mt-4">
439
+ Note: Layout coordination (content padding) must be handled manually when using
440
+ autonomous mode without LayoutProvider.
441
+ </p>
442
+ </div>
443
+ </div>
444
+ </div>
445
+ );
446
+ },
447
+ };
448
+
449
+ /**
450
+ * Desktop view with sub-items expanded.
451
+ * Items with `children` show a ChevronRight button; clicking it opens a
452
+ * dropdown listing the child routes positioned to the right of the sidebar.
453
+ */
454
+ export const WithSubitemsDesktop: Story = {
455
+ name: 'With Sub-items (Desktop)',
456
+ args: {
457
+ variant: 'default',
458
+ expanded: true,
459
+ user: { name: 'Admin', email: 'admin@example.com' },
460
+ onLogout: () => console.log('Logged out'),
461
+ location: { pathname: '/dashboard' },
462
+ navigationGroups: [
463
+ {
464
+ id: 'main',
465
+ label: 'Principal',
466
+ items: [
467
+ { path: '/home', label: 'Início', icon: Home },
468
+ {
469
+ path: '/dashboard',
470
+ label: 'Dashboard',
471
+ icon: BarChart,
472
+ children: [
473
+ { path: '/dashboard/overview', label: 'Visão Geral', icon: BarChart },
474
+ { path: '/dashboard/reports', label: 'Relatórios', icon: FileEdit },
475
+ { path: '/dashboard/analytics', label: 'Analytics', icon: Map },
476
+ { path: '/dashboard/trends', label: 'Tendências', icon: TrendingUp },
477
+ { path: '/dashboard/kpis', label: 'KPIs', icon: Activity },
478
+ { path: '/dashboard/charts', label: 'Gráficos', icon: PieChart },
479
+ { path: '/dashboard/comparison', label: 'Comparativos', icon: BarChart2 },
480
+ ],
481
+ },
482
+ {
483
+ path: '/reports',
484
+ label: 'Relatórios',
485
+ icon: FileText,
486
+ children: [
487
+ { path: '/reports/sales', label: 'Vendas', icon: ShoppingCart },
488
+ { path: '/reports/financial', label: 'Financeiro', icon: CreditCard },
489
+ { path: '/reports/operational', label: 'Operacional', icon: Layers },
490
+ { path: '/reports/exports', label: 'Exportações', icon: FileEdit },
491
+ ],
492
+ },
493
+ {
494
+ path: '/catalog',
495
+ label: 'Catálogo',
496
+ icon: Package,
497
+ children: [
498
+ { path: '/catalog/products', label: 'Produtos', icon: Package },
499
+ { path: '/catalog/categories', label: 'Categorias', icon: Tag },
500
+ { path: '/catalog/inventory', label: 'Estoque', icon: Database },
501
+ ],
502
+ },
503
+ ],
504
+ },
505
+ {
506
+ id: 'commerce',
507
+ label: 'Comercial',
508
+ items: [
509
+ {
510
+ path: '/orders',
511
+ label: 'Pedidos',
512
+ icon: ShoppingCart,
513
+ children: [
514
+ { path: '/orders/pending', label: 'Pendentes', icon: Clock },
515
+ { path: '/orders/processing', label: 'Em Andamento', icon: Zap },
516
+ { path: '/orders/shipped', label: 'Enviados', icon: Truck },
517
+ { path: '/orders/delivered', label: 'Entregues', icon: Package },
518
+ { path: '/orders/cancelled', label: 'Cancelados', icon: Trash2 },
519
+ ],
520
+ },
521
+ {
522
+ path: '/logistics',
523
+ label: 'Logística',
524
+ icon: Truck,
525
+ children: [
526
+ { path: '/logistics/carriers', label: 'Transportadoras', icon: Truck },
527
+ { path: '/logistics/tracking', label: 'Rastreamento', icon: Map },
528
+ { path: '/logistics/warehouses', label: 'Armazéns', icon: Archive },
529
+ ],
530
+ },
531
+ {
532
+ path: '/billing',
533
+ label: 'Faturamento',
534
+ icon: CreditCard,
535
+ children: [
536
+ { path: '/billing/invoices', label: 'Faturas', icon: FileText },
537
+ { path: '/billing/payments', label: 'Pagamentos', icon: CreditCard },
538
+ { path: '/billing/refunds', label: 'Estornos', icon: ArrowRightLeft },
539
+ ],
540
+ },
541
+ ],
542
+ },
543
+ {
544
+ id: 'communication',
545
+ label: 'Comunicação',
546
+ items: [
547
+ {
548
+ path: '/notifications',
549
+ label: 'Notificações',
550
+ icon: Bell,
551
+ children: [
552
+ { path: '/notifications/email', label: 'E-mail', icon: Mail },
553
+ { path: '/notifications/sms', label: 'SMS', icon: Phone },
554
+ { path: '/notifications/push', label: 'Push', icon: Bell },
555
+ ],
556
+ },
557
+ {
558
+ path: '/messages',
559
+ label: 'Mensagens',
560
+ icon: MessageSquare,
561
+ children: [
562
+ { path: '/messages/inbox', label: 'Caixa de Entrada', icon: Mail },
563
+ { path: '/messages/sent', label: 'Enviadas', icon: MessageSquare },
564
+ { path: '/messages/templates', label: 'Templates', icon: FileText },
565
+ ],
566
+ },
567
+ { path: '/integrations', label: 'Integrações', icon: Globe },
568
+ ],
569
+ },
570
+ {
571
+ id: 'admin',
572
+ label: 'Administração',
573
+ items: [
574
+ {
575
+ path: '/users',
576
+ label: 'Usuários',
577
+ icon: Users,
578
+ children: [
579
+ { path: '/users/list', label: 'Lista de Usuários', icon: Users },
580
+ { path: '/users/roles', label: 'Perfis de Acesso', icon: Shield },
581
+ { path: '/users/permissions', label: 'Permissões', icon: Key },
582
+ { path: '/users/audit', label: 'Auditoria', icon: Activity },
583
+ ],
584
+ },
585
+ {
586
+ path: '/infrastructure',
587
+ label: 'Infraestrutura',
588
+ icon: Server,
589
+ children: [
590
+ { path: '/infrastructure/servers', label: 'Servidores', icon: Server },
591
+ { path: '/infrastructure/databases', label: 'Bancos de Dados', icon: Database },
592
+ { path: '/infrastructure/backups', label: 'Backups', icon: Archive },
593
+ ],
594
+ },
595
+ {
596
+ path: '/files',
597
+ label: 'Arquivos',
598
+ icon: Folder,
599
+ children: [
600
+ { path: '/files/documents', label: 'Documentos', icon: FileText },
601
+ { path: '/files/media', label: 'Mídia', icon: Layers },
602
+ { path: '/files/exports', label: 'Exportações', icon: FileEdit },
603
+ ],
604
+ },
605
+ { path: '/settings', label: 'Configurações', icon: Settings },
606
+ ],
607
+ },
608
+ ],
609
+ footer: {
610
+ showUser: true,
611
+ showSettings: false,
612
+ showLogout: true,
613
+ },
614
+ },
615
+ render: args => {
616
+ const [isExpanded, setIsExpanded] = useState(true);
617
+ const currentWidth = isExpanded ? 280 : 80;
618
+
619
+ return (
620
+ <div
621
+ className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
622
+ style={{ transform: 'translateZ(0)' }}
623
+ >
624
+ <Sidebar
625
+ {...args}
626
+ expanded={isExpanded}
627
+ onToggle={() => setIsExpanded(!isExpanded)}
628
+ width={currentWidth}
629
+ navigate={() => {}}
630
+ />
631
+ <div
632
+ className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
633
+ style={{ left: `${currentWidth}px` }}
634
+ >
635
+ <div className="text-center max-w-sm space-y-2">
636
+ <p className="text-muted-foreground font-medium">Desktop Subitens</p>
637
+ <p className="text-xs text-muted-foreground">
638
+ Itens com subitens exibem um botão{' '}
639
+ <code className="bg-muted px-1 rounded text-xs">ChevronRight</code> ao final da
640
+ linha. Clique nele para abrir o dropdown de rotas filhas.
641
+ </p>
642
+ <p className="text-xs text-muted-foreground mt-2">
643
+ Use o botão de toggle para alternar entre expandido e recolhido.
644
+ </p>
645
+ </div>
646
+ </div>
647
+ </div>
648
+ );
649
+ },
650
+ };
651
+
652
+ /**
653
+ * Mobile view with sub-items.
654
+ * Simulates a narrow viewport (375 px) so the sidebar renders in its
655
+ * full-screen overlay mode. When expanded the sidebar covers the entire
656
+ * container; clicking a nav item (or the back-arrow toggle) closes it.
657
+ *
658
+ * Sub-item dropdowns behave identically to desktop — the ChevronRight
659
+ * button opens a `DropdownMenuContent` positioned to the right.
660
+ * This story exists so the mobile layout can be inspected and adjusted.
661
+ */
662
+ export const WithSubitemsMobile: Story = {
663
+ name: 'With Sub-items (Mobile)',
664
+ parameters: {
665
+ viewport: { defaultViewport: 'mobile1' },
666
+ },
667
+ args: {
668
+ variant: 'default',
669
+ expanded: false,
670
+ user: { name: 'Admin', email: 'admin@example.com' },
671
+ onLogout: () => console.log('Logged out'),
672
+ location: { pathname: '/dashboard' },
673
+ navigationGroups: [
674
+ {
675
+ id: 'main',
676
+ label: 'Principal',
677
+ items: [
678
+ { path: '/home', label: 'Início', icon: Home },
679
+ {
680
+ path: '/dashboard',
681
+ label: 'Dashboard',
682
+ icon: BarChart,
683
+ children: [
684
+ { path: '/dashboard/overview', label: 'Visão Geral', icon: BarChart },
685
+ { path: '/dashboard/reports', label: 'Relatórios', icon: FileEdit },
686
+ { path: '/dashboard/analytics', label: 'Analytics', icon: Map },
687
+ { path: '/dashboard/trends', label: 'Tendências', icon: TrendingUp },
688
+ { path: '/dashboard/kpis', label: 'KPIs', icon: Activity },
689
+ { path: '/dashboard/charts', label: 'Gráficos', icon: PieChart },
690
+ { path: '/dashboard/comparison', label: 'Comparativos', icon: BarChart2 },
691
+ ],
692
+ },
693
+ {
694
+ path: '/reports',
695
+ label: 'Relatórios',
696
+ icon: FileText,
697
+ children: [
698
+ { path: '/reports/sales', label: 'Vendas', icon: ShoppingCart },
699
+ { path: '/reports/financial', label: 'Financeiro', icon: CreditCard },
700
+ { path: '/reports/operational', label: 'Operacional', icon: Layers },
701
+ { path: '/reports/exports', label: 'Exportações', icon: FileEdit },
702
+ ],
703
+ },
704
+ {
705
+ path: '/catalog',
706
+ label: 'Catálogo',
707
+ icon: Package,
708
+ children: [
709
+ { path: '/catalog/products', label: 'Produtos', icon: Package },
710
+ { path: '/catalog/categories', label: 'Categorias', icon: Tag },
711
+ { path: '/catalog/inventory', label: 'Estoque', icon: Database },
712
+ ],
713
+ },
714
+ ],
715
+ },
716
+ {
717
+ id: 'commerce',
718
+ label: 'Comercial',
719
+ items: [
720
+ {
721
+ path: '/orders',
722
+ label: 'Pedidos',
723
+ icon: ShoppingCart,
724
+ children: [
725
+ { path: '/orders/pending', label: 'Pendentes', icon: Clock },
726
+ { path: '/orders/processing', label: 'Em Andamento', icon: Zap },
727
+ { path: '/orders/shipped', label: 'Enviados', icon: Truck },
728
+ { path: '/orders/delivered', label: 'Entregues', icon: Package },
729
+ { path: '/orders/cancelled', label: 'Cancelados', icon: Trash2 },
730
+ ],
731
+ },
732
+ {
733
+ path: '/logistics',
734
+ label: 'Logística',
735
+ icon: Truck,
736
+ children: [
737
+ { path: '/logistics/carriers', label: 'Transportadoras', icon: Truck },
738
+ { path: '/logistics/tracking', label: 'Rastreamento', icon: Map },
739
+ { path: '/logistics/warehouses', label: 'Armazéns', icon: Archive },
740
+ ],
741
+ },
742
+ {
743
+ path: '/billing',
744
+ label: 'Faturamento',
745
+ icon: CreditCard,
746
+ children: [
747
+ { path: '/billing/invoices', label: 'Faturas', icon: FileText },
748
+ { path: '/billing/payments', label: 'Pagamentos', icon: CreditCard },
749
+ { path: '/billing/refunds', label: 'Estornos', icon: ArrowRightLeft },
750
+ ],
751
+ },
752
+ ],
753
+ },
754
+ {
755
+ id: 'communication',
756
+ label: 'Comunicação',
757
+ items: [
758
+ {
759
+ path: '/notifications',
760
+ label: 'Notificações',
761
+ icon: Bell,
762
+ children: [
763
+ { path: '/notifications/email', label: 'E-mail', icon: Mail },
764
+ { path: '/notifications/sms', label: 'SMS', icon: Phone },
765
+ { path: '/notifications/push', label: 'Push', icon: Bell },
766
+ ],
767
+ },
768
+ {
769
+ path: '/messages',
770
+ label: 'Mensagens',
771
+ icon: MessageSquare,
772
+ children: [
773
+ { path: '/messages/inbox', label: 'Caixa de Entrada', icon: Mail },
774
+ { path: '/messages/sent', label: 'Enviadas', icon: MessageSquare },
775
+ { path: '/messages/templates', label: 'Templates', icon: FileText },
776
+ ],
777
+ },
778
+ { path: '/integrations', label: 'Integrações', icon: Globe },
779
+ ],
780
+ },
781
+ {
782
+ id: 'admin',
783
+ label: 'Administração',
784
+ items: [
785
+ {
786
+ path: '/users',
787
+ label: 'Usuários',
788
+ icon: Users,
789
+ children: [
790
+ { path: '/users/list', label: 'Lista de Usuários', icon: Users },
791
+ { path: '/users/roles', label: 'Perfis de Acesso', icon: Shield },
792
+ { path: '/users/permissions', label: 'Permissões', icon: Key },
793
+ { path: '/users/audit', label: 'Auditoria', icon: Activity },
794
+ ],
795
+ },
796
+ {
797
+ path: '/infrastructure',
798
+ label: 'Infraestrutura',
799
+ icon: Server,
800
+ children: [
801
+ { path: '/infrastructure/servers', label: 'Servidores', icon: Server },
802
+ { path: '/infrastructure/databases', label: 'Bancos de Dados', icon: Database },
803
+ { path: '/infrastructure/backups', label: 'Backups', icon: Archive },
804
+ ],
805
+ },
806
+ {
807
+ path: '/files',
808
+ label: 'Arquivos',
809
+ icon: Folder,
810
+ children: [
811
+ { path: '/files/documents', label: 'Documentos', icon: FileText },
812
+ { path: '/files/media', label: 'Mídia', icon: Layers },
813
+ { path: '/files/exports', label: 'Exportações', icon: FileEdit },
814
+ ],
815
+ },
816
+ { path: '/settings', label: 'Configurações', icon: Settings },
817
+ ],
818
+ },
819
+ ],
820
+ footer: {
821
+ showUser: true,
822
+ showSettings: false,
823
+ showLogout: true,
824
+ },
825
+ },
826
+ render: args => {
827
+ const [isExpanded, setIsExpanded] = useState(false);
828
+
829
+ return (
830
+ /* Constrain to ~375 px to reproduce a mobile viewport inside Storybook */
831
+ <div
832
+ className="relative bg-muted/20 overflow-hidden border rounded-[var(--radius-lg)]"
833
+ style={{ width: '375px', height: '100vh', margin: '0 auto' }}
834
+ >
835
+ {/* Page content visible when sidebar is closed */}
836
+ {!isExpanded && (
837
+ <div className="h-full flex flex-col">
838
+ <div className="flex items-center gap-3 px-4 py-3 border-b border-border bg-background">
839
+ <button
840
+ onClick={() => setIsExpanded(true)}
841
+ className="p-2 rounded-md hover:bg-accent transition-colors"
842
+ aria-label="Abrir menu"
843
+ >
844
+ <Menu className="w-5 h-5" />
845
+ </button>
846
+ <span className="font-semibold text-sm">Minha Aplicação</span>
847
+ </div>
848
+ <div className="flex-1 flex items-center justify-center p-8">
849
+ <div className="text-center space-y-2">
850
+ <p className="text-muted-foreground font-medium">Mobile — Subitens</p>
851
+ <p className="text-xs text-muted-foreground">
852
+ Clique no ícone de menu (☰) no topo para abrir a sidebar em modo
853
+ tela-cheia. Itens com subitens mostram um{' '}
854
+ <code className="bg-muted px-1 rounded text-xs">ChevronRight</code> ao final
855
+ da linha.
856
+ </p>
857
+ </div>
858
+ </div>
859
+ </div>
860
+ )}
861
+
862
+ <Sidebar
863
+ {...args}
864
+ expanded={isExpanded}
865
+ onToggle={() => setIsExpanded(prev => !prev)}
866
+ width={375}
867
+ navigate={() => setIsExpanded(false)}
868
+ />
869
+ </div>
870
+ );
871
+ },
872
+ };
873
+
874
+ /**
875
+ * Compound Component API — demonstrates using Sidebar.Root + sub-components
876
+ * for full layout control. This is the recommended pattern for advanced
877
+ * customization without forking the component.
878
+ */
879
+ export const CompoundComponentAPI: Story = {
880
+ name: 'Compound Component API',
881
+ render: () => {
882
+ const [isExpanded, setIsExpanded] = React.useState(true);
883
+ const currentWidth = isExpanded ? 280 : 80;
884
+ const groups = [
885
+ {
886
+ id: 'main',
887
+ label: 'Principal',
888
+ items: [
889
+ { path: '/home', label: 'Início', icon: Home },
890
+ { path: '/dashboard', label: 'Dashboard', icon: BarChart },
891
+ ],
892
+ },
893
+ {
894
+ id: 'admin',
895
+ label: 'Administração',
896
+ items: [
897
+ { path: '/users', label: 'Usuários', icon: Users },
898
+ { path: '/settings', label: 'Configurações', icon: Settings },
899
+ ],
900
+ },
901
+ ];
902
+
903
+ return (
904
+ <div
905
+ className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
906
+ style={{ transform: 'translateZ(0)' }}
907
+ >
908
+ {/* Compound Component usage */}
909
+ <Sidebar.Root
910
+ expanded={isExpanded}
911
+ onToggle={() => setIsExpanded(prev => !prev)}
912
+ width={currentWidth}
913
+ location={{ pathname: '/home' }}
914
+ navigate={() => {}}
915
+ >
916
+ <Sidebar.Header />
917
+ <Sidebar.Nav navigationGroups={groups} />
918
+ <Sidebar.Footer
919
+ user={{ name: 'Admin', email: 'admin@example.com' }}
920
+ onLogout={() => console.log('logout')}
921
+ showUser
922
+ showSettings
923
+ showLogout
924
+ />
925
+ </Sidebar.Root>
926
+
927
+ <div
928
+ className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
929
+ style={{ left: `${currentWidth}px` }}
930
+ >
931
+ <div className="text-center max-w-md space-y-3">
932
+ <p className="text-muted-foreground font-bold">Compound Component API</p>
933
+ <p className="text-sm text-muted-foreground/80">
934
+ Built with <code className="bg-muted px-1 rounded text-xs">&lt;Sidebar.Root&gt;</code>
935
+ , <code className="bg-muted px-1 rounded text-xs">&lt;Sidebar.Header&gt;</code>,{' '}
936
+ <code className="bg-muted px-1 rounded text-xs">&lt;Sidebar.Nav&gt;</code>, and{' '}
937
+ <code className="bg-muted px-1 rounded text-xs">&lt;Sidebar.Footer&gt;</code>.
938
+ </p>
939
+ <p className="text-xs text-muted-foreground">
940
+ Each sub-component reads shared state from{' '}
941
+ <code className="bg-muted px-1 rounded text-xs">SidebarContext</code> via{' '}
942
+ <code className="bg-muted px-1 rounded text-xs">Sidebar.Root</code>.
943
+ </p>
944
+ </div>
945
+ </div>
946
+ </div>
947
+ );
948
+ },
949
+ };
950
+
951
+ /**
952
+ * Headless Hook — demonstrates using `useSidebar` directly for fully custom rendering.
953
+ * The hook manages all state; the UI is entirely up to the consumer.
954
+ */
955
+ export const HeadlessHook: Story = {
956
+ name: 'Headless Hook (useSidebar)',
957
+ render: () => {
958
+ const groups = [
959
+ {
960
+ id: 'main',
961
+ label: 'Principal',
962
+ items: [
963
+ { path: '/home', label: 'Início', icon: Home },
964
+ { path: '/dashboard', label: 'Dashboard', icon: BarChart },
965
+ { path: '/users', label: 'Usuários', icon: Users },
966
+ ],
967
+ },
968
+ ];
969
+
970
+ const {
971
+ expanded,
972
+ toggleExpanded,
973
+ navigationGroups: resolvedGroups,
974
+ } = useSidebar({ defaultExpanded: true, navigationGroups: groups });
975
+
976
+ const width = expanded ? 280 : 80;
977
+
978
+ return (
979
+ <div
980
+ className="relative h-screen w-full border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
981
+ style={{ transform: 'translateZ(0)' }}
982
+ >
983
+ {/* Fully custom sidebar built with useSidebar hook */}
984
+ <div
985
+ className="absolute inset-y-0 left-0 bg-sidebar text-sidebar-foreground flex flex-col transition-all duration-300 z-50"
986
+ style={{ width: `${width}px` }}
987
+ >
988
+ <div className="p-4">
989
+ <button
990
+ onClick={toggleExpanded}
991
+ className="w-full h-10 flex items-center justify-center rounded-md bg-sidebar-foreground/10 hover:bg-sidebar-foreground/20 text-sidebar-foreground transition-colors"
992
+ aria-label={expanded ? 'Collapse' : 'Expand'}
993
+ >
994
+ {expanded ? <PanelLeft className="w-5 h-5" /> : <Menu className="w-5 h-5" />}
995
+ </button>
996
+ </div>
997
+ <nav className="flex-1 px-3 space-y-1">
998
+ {resolvedGroups
999
+ .flatMap(g => g.items)
1000
+ .map(item => {
1001
+ const Icon = item.icon;
1002
+ return (
1003
+ <button
1004
+ key={item.path}
1005
+ className="w-full h-10 flex items-center gap-3 px-3 rounded-md text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground transition-colors"
1006
+ >
1007
+ {Icon && <Icon className="w-5 h-5 flex-shrink-0" />}
1008
+ {expanded && <span className="truncate text-sm">{item.label}</span>}
1009
+ </button>
1010
+ );
1011
+ })}
1012
+ </nav>
1013
+ </div>
1014
+
1015
+ <div
1016
+ className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
1017
+ style={{ left: `${width}px` }}
1018
+ >
1019
+ <div className="text-center max-w-md space-y-3">
1020
+ <p className="text-muted-foreground font-bold">Headless Hook</p>
1021
+ <p className="text-sm text-muted-foreground/80">
1022
+ State managed by <code className="bg-muted px-1 rounded text-xs">useSidebar()</code>.
1023
+ The entire UI is custom — no Sidebar component used.
1024
+ </p>
1025
+ <p className="text-xs text-muted-foreground">
1026
+ Sidebar is currently: <strong>{expanded ? 'Expanded' : 'Collapsed'}</strong>
1027
+ </p>
1028
+ </div>
1029
+ </div>
1030
+ </div>
1031
+ );
1032
+ },
1033
+ };